I'm creating a NFT and I want the transferFrom function to be payable. In order to do so I need to edit the ERC721 interface and make that function payable also there.

If I do so everything compiles smoothly, but my question is:
- Will other platforms don't accept my token as a standard ERC721 token? How do other platforms (eg. wallets as Trust Wallet) recognize that my token is a standard ERC721?
- Is there a better way to do this without editing the ERC721 interface? There is this discussion but no real solution: https://github.com/OpenZeppelin/openzeppelin-contracts/issues/1015

  • Wouldn't it be better if you didn't have to implement the interface at all and could easily deploy your NFT smart contract? This tutorial had my NFT up and running in less than 15minutes - docs.alchemyapi.io/alchemy/tutorials/…
    – thesuperb1
    Mar 15 at 23:28

Actually, transferFrom is payable in EIP 721.

From https://eips.ethereum.org/EIPS/eip-721:

function transferFrom(address _from, address _to, uint256 _tokenId) external payable;

So it's not a modification at all. It's already part of the interface.

If the code you're using doesn't have payable there, you can simply add it.

  • Hah, didn't check it, thanks. Will modify my answer to be more general Oct 7 '19 at 12:50
  • But the problem is that I'm importing Openzeppelin contracts and those functions are not payable in their repository. Do I need to edit those and compile my own ERC721.sol contracts?
    – Agilulfo
    Oct 14 '19 at 21:34
  • Yes, just edit them.
    – user19510
    Oct 15 '19 at 0:26

In short: yes it's bad.

If you wish your contract to be recognized (and used) as an ERC721 contract you have to implement the correct interface (correctly).

If your contract is not ERC721 standard compliant exchanges will most likely not accept it as it would require extra coding from their part just to get your token to work. The point of standards is that everyone uses the same logic and third parties (such as exchanges) need to implement functionality only once and they can be sure that the same functionality works for all standard tokens.

Here's some more info and ideas what you could do (it's about ERC20 but it's the same idea):Can we modify ERC20 functions?


As noted by others the transferFrom is already payable so in your case you wouldn't be breaking the standard (you'd be actually implementing it more correctly).

  • I don't see how making a function payable breaks the ERC721 interface.
    – user19510
    Oct 7 '19 at 11:43
  • Actually, reading the spec, that function is already marked payable.
    – user19510
    Oct 7 '19 at 11:52

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.