Some functions from ERC-721 interface contain payable
modifiers.
function transferFrom(address _from, address _to, uint256 _tokenId) external payable;
I was wondering why it is payable
and found from [EIP-721][1] that explains why.
Solidity issue #3412: The above interfaces include explicit mutability guarantees for each function. Mutability guarantees are, in order weak to strong: payable, implicit nonpayable, view, and pure. Your implementation MUST meet the mutability guarantee in this interface and you MAY meet a stronger guarantee. For example, a payable function in this interface may be implemented as nonpayble (no state mutability specified) in your contract. We expect a later Solidity release will allow your stricter contract to inherit from this interface, but a workaround for version 0.4.20 is that you can edit this interface to add stricter mutability before inheriting from your contract.
Does this mean that when a function in the interface includes payable
and when it is implemented, it can be changed to anything? such as public
, view
, pure
? or did it mean that it can only be changed to nonpayable which is public
?
Also the definition Mutability guarantees
is hard to understand. Can someone explain this in a simpler way please?
[1]: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md