2

I was researching the ERC721 standard on Openzeppelin and I have noticed that there is not public or external "transfer" function.

I see internal "_transfer" function, that is called by "_safeTransfer" (which has internal visibility too) and transferFrom (public function).

I want to make sure that the only way to transfer an ERC721 token (NFT) is using the "transferFrom" function. Is there any other way to let users transfer their NFTs directly from their wallets, without requiring to indicate their address in "transferFrom" function?

In ERC20 standard the "transfer" function gets the owner using msg.sender property. Why ERC721 does not implement the same mechanism?

1 Answer 1

2

We did not include a transfer function because it may be ambiguous whether you mean to transfer something that you are the owner of versus something you are authorized to get.

The current owner must always be specified, because of security reasons (specifically, front-running). This is why transferFrom is the closest to the wire you can get.

1
  • 1
    Thanks too much for the explanation, makes totally sense!
    – AlexAcc
    Apr 22 at 22:03

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.