Closed megaturbo closed 4 years ago
I think this is incorrect, perhaps an incorrect assumption at some point on my part around return values not being accessible on transactions. There is no way to read a return value from a transaction, only events. However it is possible for a state modifying call to return a value which could be read by another smart contract. I'll accept a PR. Thanks.
use the
constant
keyword of theABI
.I know it doesn't change anything since the solidity compiler outputs the
stateMutability
parameters, but thevyper
compiler doesn't. So that would help to be vyper-compatible.
I think you should check both of them. Something like abi.constant || abi.stateMutability === 'payable' || abi.stateMutability === 'nonpayable'
, since acording to solidity's doc constant
will be removed in the future.
@alcuadrado I think that the case when stateMutability
is set is already handled here
Btw I did a PR, feel free to review it
Should be fixed in v4.0.6
Why checking for outputs to define if a function is constant ?
web3x-codegen
defines here a function constant if there are outputs. Why not rather checking for:A function can be state-modifying even if it has output, right ? I just wanted to understand why. I can do a PR if that makes sense to use the
constant
keyword of theABI
.I know it doesn't change anything since the solidity compiler outputs the
stateMutability
parameters, but thevyper
compiler doesn't. So that would help to be vyper-compatible.