2

Here is the code:

Calling contract:

pragma solidity ^0.4.24;

contract Caller {

    address public called_address;

    constructor() public payable {

    }

    function set_address(address _addy) public {
        called_address = address(_addy);
    }
    function () public payable{
        Called c = Called(called_address);
        if (c.get() > 10 ){
            revert("Too much sauce");
        }
        c.set();
    }

}

interface Called{

    function set() external;
    function get() external view returns (uint);
}

Called Contract:

pragma solidity ^0.4.24;

contract Called{

    uint public number;

    function myuint() public view returns(uint _number) {
        _number = number;
    }

    function set() public {
        number++;
    }

    function get() public view returns (uint){
        return number;
    }
}

When I call the fallback function I get an error. This only happens when using Web3 provider, but works well in JavaScript VM. Saw this question too Can't call another contract constant function in Remix in Web3 provider mode, but it works in Javascript VM

Is it a bug in Remix? Does my code have an error? Why do I get different results with the different environments?

0

Current online version of remix (0.6.4) has some bugs related to intercontract communication which are present using external web3 provider or facility. Try to use current alpha version (http://remix-alpha.ethereum.org) and, if all is then ok, simply switch to it. The current alpha version shall be the current online version (as 0.7.0 version) in short.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.