VirtualMachineError: revert when calling a stupidly simple Solidity function

61 views Asked by At

I can't understand why I consistently get the same error when trying to get a value from a simple Solidity function using Python/Brownie, and a local instance of Ganache.

This is the first time I've come across this problem, and I haven't been able to find anything in the forums that can shed some light on me.

Originally, the function was more complex, but I have been simplifying it to find the point where it works, and I have not been able to do it.

This is my silly Solidity function (as I said, is the result of some desperate simplification iterations):

    function testFunction(uint256 _value) public view returns (uint256) {
        uint256 value = _value;
        return value;
    }
}

This is my silly call statement with Python:

print(Agreement.testFunction(2))

And, despite the above newbie code, this is the error I get:

File "brownie/_cli/run.py", line 51, in main
    return_value, frame = run(
  File "brownie/project/scripts.py", line 110, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File "./scripts/GetAgreementData.py", line 18, in main
    print(Agreement.testFunction(2))
  File "brownie/network/multicall.py", line 115, in _proxy_call
    result = ContractCall.__call__(*args, **kwargs)  # type: ignore
  File "brownie/network/contract.py", line 1902, in __call__
    return self.call(*args, block_identifier=block_identifier, override=override)
  File "brownie/network/contract.py", line 1693, in call
    raise VirtualMachineError(e) from None
VirtualMachineError: revert

And this is the error I get:

Any help would be very appreciated Thank you in advance!

0

There are 0 answers