1

I wonder is it is possible to extend the ERC721 functions that handles transfering tokens. I want to have a variable, and change its state if an nft has been transferred to someone else. Is that possible, without breaking the ERC721 standard? If possible, how would i exactly do that?

I saw this question, but it doesnt really answer my question if it is possible and how.

1 Answer 1

0

Yes you can. And we definitely welcome your innovation and extension here.

In your smart contract you will just use an existing ERC-721 implementation, inherit from that contract and then implement your function something like this:

function _transfer(...) {
   // Update a counter for the token recipient
   super._transfer(...);
}
4
  • Thanks, do you know what function is called when someone buys an nft from someone else on opensea? I assume it is some of the transfer functions, but it is like 3 or 4 of them. Commented Jan 26, 2022 at 0:44
  • The ERC-721 functions that are called are transferFrom or safeTransferFrom. However, depending on which implementation of ERC-721 you are using, there may a be an internal _transfer inside which is the preferred override point. Commented Jan 27, 2022 at 14:38
  • Yea, but i want to implement something that happens, after a user has bought an nft on opensea. Is that possible? Commented Jan 27, 2022 at 14:40
  • Yes. Please use a new question for that. Commented Jan 31, 2022 at 14:46

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.