Skip to main content
added 181 characters in body
Source Link

Your function is expectingThis looks like a return statementbug to me.

I was able to find a solution, but this only works if you call sendToAnother() from sendToAnother()Another first, and then call it from Test.

pragma solidity 0.4.25;

contract Another {
    uint public balance;
    function sendToAnother() public returns (bool success) {
        balance += 10;
        return true;
    }
}

contract Test {
    function send(address another) public {
        Another(another).sendToAnother();
    }
}

Even though this solution works, I'm not 100% clear as to why it worked for the Javascript VM and not for Ganache. It looks like while using Remix, Ganache is searching for a return first, thus the immediate revert being thrown. My guess is it's a bug, but would love to hear some more ideas/theories if anyone has them.

Your function is expecting a return statement from sendToAnother().

pragma solidity 0.4.25;

contract Another {
    uint public balance;
    function sendToAnother() public returns (bool success) {
        balance += 10;
        return true;
    }
}

contract Test {
    function send(address another) public {
        Another(another).sendToAnother();
    }
}

Even though this solution works, I'm not 100% clear as to why it worked for the Javascript VM and not for Ganache. It looks like while using Remix, Ganache is searching for a return first, thus the immediate revert being thrown.

This looks like a bug to me.

I was able to find a solution, but this only works if you call sendToAnother() from Another first, and then call it from Test.

pragma solidity 0.4.25;

contract Another {
    uint public balance;
    function sendToAnother() public returns (bool success) {
        balance += 10;
        return true;
    }
}

contract Test {
    function send(address another) public {
        Another(another).sendToAnother();
    }
}

Even though this solution works, I'm not 100% clear as to why it worked for the Javascript VM and not for Ganache. It looks like while using Remix, Ganache is searching for a return first, thus the immediate revert being thrown. My guess is it's a bug, but would love to hear some more ideas/theories if anyone has them.

Post Undeleted by Devon Yarbrough
Post Deleted by Devon Yarbrough
Source Link

Your function is expecting a return statement from sendToAnother().

pragma solidity 0.4.25;

contract Another {
    uint public balance;
    function sendToAnother() public returns (bool success) {
        balance += 10;
        return true;
    }
}

contract Test {
    function send(address another) public {
        Another(another).sendToAnother();
    }
}

Even though this solution works, I'm not 100% clear as to why it worked for the Javascript VM and not for Ganache. It looks like while using Remix, Ganache is searching for a return first, thus the immediate revert being thrown.