question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remix + Ganache - Cannot call one contract from another

See original GitHub issue

I have an innocent looking contracts that work painlessly in Remix. Test contract can easily call Another if I use JavaScript VM in Remix.

I also have ganache-cli running on port 7454. If I connect Remix to ganache-cli, each of these contracts work well individually. But I cant call Another from Test. Remix console says transact to Test.send errored: VM Exception while processing transaction: revert

My contracts look like:

    pragma solidity 0.4.25;
    
    contract Another {
        uint public balance;
        function sendToAnother() public {
            balance += 10;
        }
    }
    
    contract Test {
        function send(address another) public {
            Another(another).sendToAnother();
        }
    }

Expected Behavior

The contract works as is in JavaScript VM and Ropsten (with Metamask) as expected. Also, individual contacts work with ganache-cli. Just calling one contract from another doesnt seem to work.

Current Behavior

transact to Test.send errored: VM Exception while processing transaction: revert

Possible Solution

NA

Steps to Reproduce (for bugs)

  1. Put he given contract in Remix Editor
  2. Run ganache-ui. It starts on port 7545
  3. Run the SmartContract after setting the Environment to Web3 Provider
  4. Deploy the Another Contract first
  5. Deploy the Test Contract next
  6. Call the method send() with address of Another contract

Your Environment

  • Version used ; ganache-ui 1.2.2, Solidity 0.5.0 screen shot 2018-12-04 at 11 14 35 am screen shot 2018-12-04 at 11 14 25 am

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
fbalwycommented, Mar 15, 2019

It’s been 25 days since labeling this issue as priority-high. Any news about releasing a beta with a fix for this issue?

0reactions
nicholasjpaternocommented, Mar 28, 2019

This should now be fixed in the latest beta tagged releases of ganache-cli and ganache-core.

This fix involved pretty significant code changes; check out the release notes for details.

We’d love it if you’d test this beta out to make sure things are good to go before we release to stable.

If you using ganache-cli, run:

npm install -g ganache-cli@beta

If you are using ganache-core, run:

npm install ganache-core@beta

Let us know if you discover any bugs with this new beta release! Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remix + Ganache - Cannot call one contract from another
One suspicion I have is - am I picking up the address of the Another contract correctly? I am copying it from Remix's...
Read more >
Remix Documentation - Read the Docs
Remix IDE is used for the entire journey of smart contract development by users at every knowledge level. It requires.
Read more >
Creating and Deploying a Contract - Remix's documentation!
Go to the File Explorer, create a new file, name it and in the editor paste the contract below. // SPDX-License-Identifier: GPL-3.0 pragma...
Read more >
Ethereum - Interacting with Deployed Contract - Tutorialspoint
You may check the various functions of the contract as in the case of Remix deployment. Note that the contact is now deployed...
Read more >
How to call another smart contract from your solidity code
1. Smart contracts are the most popular feature of the Ethereum network. Smart contracts have functions ... 2. Smart contracts are computer code,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found