0

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

0

2 Answers 2

2

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.

3
  • Hah, didn't check it, thanks. Will modify my answer to be more general Commented Oct 7, 2019 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
    Commented Oct 14, 2019 at 21:34
  • Yes, just edit them.
    – user19510
    Commented Oct 15, 2019 at 0:26
1

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?

EDIT

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).

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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