New answers tagged

0

I had this problem when I was using in function block variables like block.number or block. difficulty which some are not available in remix i suppose, when I removed them code worked.


2

Here is an example; Note that ETH is not a contract so there is no balanceOf() method to be called. This is how it's done. uint balance = address(this).balance; address(this) is your contract address. This is done inside you contract with solidity so the balance will be available inside your contract. You can also get it from the cli Check out these methods....


1

You can simply try this uint256 balance = address(this).balance; return balance;


0

Truffle and Ganache generates different seed phrases. In order to have the same addresses from truffle develop into ganache gui, you need to copy and paste the seed phrase com truffle develop and paste it into the ganache accounts tab, when creating a new workspace


0

Check your compiled contract abi JSON representation. Most probably getAgentDetails() is missing in the abi. Remove any default network in your environment and set the test net address properly and compile again. It should work.


0

"UniswapV2 addLiquidity revert ds-math-sub-underflow" error happened because "msg.value" parameter has not been provided for calling "addLiquidity" method. Now call the addLiquidity method as: await uniswapV2Router02.addLiquidity(token0.address, token1.address, 500, 250, 250 , 125, accounts[0], 1618158769, {value : "125&...


1

Iv run into similar issues. In your truffle configuration file, make sure you enable optimization i. The compiler settings. Setting to 200 is fine. Essentially the fact that the contract code isn't optimized, you end up running out of gas Hope this helps, Alex


0

Ganache UI under Windows is not the same as Ganache-cli under WSL The Ganache UI on Windows is listening to Windows Port. The WSL2 instance have it's own set of ports. So Even if they are set to the same port they are not What you should do is use Ganache-cli in WSL2. This will fix your issue. Since they will both be on the same system.


2

okay. I found the solution. I can add a local network in my network list with : brownie networks add Ethereum ganache-local host=http://127.0.0.1:7545 chainid=5777 where ganache-local is a name i choose and where host + chainid is from the running Ganache-desktop version. After running that command you can see a Success message: SUCCESS: A new network '...


0

You are able to use Blockscout as a block explorer for ganache-cli. To do a local trial run I recommend using Blockscout via Docker: Start a local chain via ganache-cli Clone Blockscout and change to docker Run (assuming you are on macOS) COIN=ETH \ ETHEREUM_JSONRPC_VARIANT=ganache \ ETHEREUM_JSONRPC_HTTP_URL=http://host.docker.internal:8545 \ ...


1

I figured out the answer to this error. Turns out I was deploying using a specific MockV3Aggregator Address and then I had another script to interact with the contract, but used a different MockV3Aggregator address, hence giving me that error. Specifically in my deploy.py function, account = get_account() # pass the price feed address to our fundme ...


Top 50 recent answers are included