New answers tagged

0

This is certainly not a code error, not a compiler error. Just proper setting is required on IDE. Just see left hand side, the third tab in 'CONTRACT' section select 'OWNED'


0

this is just a way to import any solidity contract, when you deploy a contract all of your imports became the part of the your contract in other words you are deploying a flattened contract. In short your contracts has no link with github they will function as long as ethereum is functional.


0

Had the same issue and it turned out i was on Metamask Mainnet instead of Rinkeby where my contract was deployed.


1

Like in other programming languages, in Solidity the prefix/postfix operator means that the place of the ++ or -- determines what will happen next. From the docs: a++ and a-- are equivalent to a += 1 / a -= 1 but the expression itself still has the previous value of a. In contrast, --a and ++a have the same effect on a but return the value after the change. ...


0

Try this https://abi.hashex.org/#. Paste your contract abi and the parameters that you give for your constructor (if any)


0

I'm guessing the issue might be when you are trying to verify the contracts on etherscan you are not updating the import line in token contract after adding multiple files. Make sure you have all the import files in the ERC20 dependencies ready and change the import line in the token contract to import "ERC20.sol". Now upload all these files ...


0

Fixed! The issue was that I used the mainnet PancakeSwapV2 router address, and not the testnet one. For anyone else encountering this issue, the mainnet router is: 0x10ED43C718714eb63d5aA57B78B54704E256024E and the testnet one is: 0xD99D1c33F9fC3444f8101754aBC46c52416550D1 Hopefully this helps someone else!


0

I think that you should use the following order in variables: type arg_name storage. Thus it should be uint[] value memory Relevant StackExchange question: getting error ParserError: Expected type name function


0

Excellent question. This was the same problem that had me stumped too, until I saw @Briomkez's answer with reference to the yellow paper as well as the other answers . In case someone doesn't understand his excellent but slightly technical answer or needs to see it in code action, please see below: Please copy-paste the below sample (modified from the usual ...


0

Your formatting is just off with the call. The Solidity Documentation details this as the way to do this: address(nameReg).call{gas: 1000000}(abi.encodeWithSignature("register(string)", "MyName")); So you should change your code to be: return to.call{value:value, gas:gaslimit}(data);


0

Firstly, it is a warning and not an error. constructor(uint256 initialSupply) public ERC20 ("PecizeCoin", "PCC") can be written as constructor(uint256 initialSupply) ERC20 ("PecizeCoin", "PCC") for compiler version > 0.7, constructor visibility is not required. From solidity 0.7 breaking changes: Visibility (...


0

This happened to me on my react app. I deployed to contract to Ropsten network, but metamask was using the Rinkeby account. So make sure whichever network you deployed, metamask should be using account from that network.


0

I'm seeing this issue too. It looked promising at first - I could see the local variables, state variables, stack and opcodes in the debug panel. But when I tried to move through the code (tried step into/over and also the slider) the debug panel just disappeared and I couldn't seem to recover it. EDIT: Doing some further digging, my theory is that my local ...


1

Unfortunately, there is no way to recover the funds from a smart contract if there isn't any function to do so. The only way to recover the funds is to contact the token creator. Tether (USDT) for example, would help you recover funds stuck in a contract. Not all tokens have such support though. All the best


0

In your code above, _startingTime is defined as a mapping. When calling it, you need to pass it a correctly formatted address as an input for it to return anything meaningful. Apparently, you were calling it without passing in any value.


2

I wrote that contract :-D It's a basic Safemoon fork that includes fixes for all of the issues found in the HashEx and CertiK audits. That plus there's a dev fee feature that taxes individual transactions so devs can earn something without having to do the traditional "team wallet" method of compensation that so many traders are weary of. The whole ...


0

Once a contract is deployed, it does not "run itself". Functions always need to be called if you want the contract to do anything. They can be called directly or by another contract. In your example, the setBurnFeePercent function takes one parameter, a uint256. The function can only be called externally (the external keyword), which means that ...


1

I think, it would be better if you define a structure and then return as a memory pointer to the result. structure MyReturnData { uint256 tTransferAmount; uint256 tFee; uint256 tLiquidity; uint256 tDev; uint256 tBurn; uint256 tCharity; } function _getTValues(uint256 tAmount) private view returns (MyReturnData memory) {} Sometime, if you ...


0

You should try httpS://remix.ethereum.org instead then


2

TL;DR Yes, it's a scam. The functions used are hidden in the Manager object imported with this line import "ipfs://Qmf5Ua79ZT8ERFa9q32fQtGuWkqk1eZXxnzRdeTi6wvzUy". I cannot see that code, but it probably transfers BNB sent to the contract to the scammer address as you mention. The code that is commented out in the contract makes not sense at all. ...


0

I have faced a similar issue. Using HTTP instead of https solved. hape this might help.


0

I had the same problem. Has anyone figured out what is causing this. I have used the imports suggested above but still get the error: from web3 import Web3


1

Yes, it is possible to put custom data in the DATA field of a transaction. But you should be aware of possible harmful code execution. You are probably getting a revert because your contract does not have a fallback function and there is no function with id 7b224e61. (Given your 'data' : '7b224e616d65223a202')


0

According to Solidity Docs block.timestamp returns the timestamp of current block in seconds since the epoch. That means how many seconds passed since January 1, 1970. So, if you want to release your token after 1 years from now, you have to add 1 year to the current timestamp and pass that value. You can manually add 31556926 * YEARS seconds to the today's ...


0

The problem is that you are using the WETH mainnet address in a smart contract that you are trying to deploy, I understand, on the Remix javaScript VM environment, a private local blockchain used for testing. Since the address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 is not a smart contract on the test network, the call to approve fails in the _approveWeth ...


2

Infura is a gateway to enable access to some Ethereum networks. Remix may work with a simulated blockchain or be attached to a real blockchain network. For example, you can use Remix linked to Metamask. Your Metamask may point to an Infura gateway or not. You can use Metamask to point to a permissioned blockchain network for example. You will probably use ...


0

Are you sure to write this data on your smart contract ? They will be accessible for anyone in the world with no restrictions. And you will pay like 100 000gas for it so it's quite expansive for a user. Why not store them on a local database, then ask user to sign it with EIP712 so they can log in ?


0

This == is an equality operator - it checks whether both sides are equal. This = is an assignment operator - it assigns whatever variable is on the left-hand side to whatever is on the right-hand side. This line: require(msg.value = amount + interest, 'borrower need to reimburse exactly amount + interest'); ...should be doing an equality check. You need to ...


0

Yes you must link contract together. But it's kind of one after another. You deploy a contract A first. Then contract B take contract A address in his source code. If you want a dividends there is a smart contract for it : https://github.com/wardesqwe/funds-distribution-token


1

Game is a type. You have defined the type as a struct. In the makeBet() function you have not created a local variable of type Game. What you're doing is trying to assign a value to a type definition, not a variable. You need something along the lines of: function makeBet(uint _guess, string memory deadline) public payable { Game memory newGame = Game(msg....


1

Optimization is the property of the solidity compiler (solc) and not the remix. From solidity docs: Before you deploy your contract, activate the optimizer when compiling using solc --optimize --bin sourceFile.sol. By default, the optimizer will optimize the contract assuming it is called 200 times across its lifetime (more specifically, it assumes each ...


1

You can declare the current_price variable at the head of the contract, along with the other global variables: contract Price { address payable owner; AggregatorV3Interface internal priceFeed; uint current_price; ... And then set it in the constructor: constructor() public payable { priceFeed = AggregatorV3Interface(address(...


0

I would create a process in Python or Javascript. Then use Web3 to listen to events on the blockchain or query an AMM like Uniswap at a pre determined interval. Finally if inspect the price to determine if it meets your condition. If it does perform an action. Here are some basics tutorials on using Python to connect to the blockchain: https://...


0

here is a guide on how to deploy a contract to the Binance smart chain test environment https://cryptomarketpool.com/deploy-a-contract-to-the-binance-smart-chain/


1

Smart Contracts can't automatically trigger themselves, they require something external to the blockchain to create a transaction. With Chainlink you have 2 options: Create a job on a Chainlink node that uses a cron initiator to periodically call a function in your smart contract that checks the price of ETH/USD, and take action if required. You can ...


0

Your code has typo in it. In solidity we use unit (unsigned integer) not unit here is the working version of your code pragma solidity ^0.4.0; contract SimpleStorage { uint storedData; function set(uint x) public { storedData = x; } function get() constant public returns (uint) { return storedData; } ...


0

Change testnet, the gas limit per block is not constant and currently on Kovan is about 12.500.000. Yesterday this limit was higher, apparently. Here you can see the gas limit of the latest blocks. However, even if the gas limit per block in the mainnet was great enough your transaction would cost thousands of dollars with the current gas price and Ether ...


0

If you're sending a value along with the transaction that deploys your contract, you'll need to make the constructor payable: constructor() payable public { owner = msg.sender; } If you want to send ETH to the contract at a later time, you'll need a way to receive it, either in a named deposit function, or in a Fallback Function. You're using a ...


0

In the constructor, what do you think owner == msg.sender; does? What it does, a comparison. The result of it is false and discarded anyway. What do you need to do? Change that to owner = msg.sender;, an assignment.


1

It is likely that the init code hash in the UniswapV2Library is incorrect: Uniswap addLiquidity function transaction revert


Top 50 recent answers are included