1

Creating a contract for a privateSale fo ERC721 NFTs, first I mint some inventory to the privateSale contract address implementing onErc721Received(...) what I want to guarantee is that this privateSaleContract does only receive ERC721 tokens from one given NFT type (by its contract address)

How can I guarantee that?

Char
  • 925
  • 2
  • 10
  • 24

1 Answers1

2

The ERC721 standard defines two types of transfer functions:

  • safeTransferFrom() that checks if the receiver is a contract - and if it is, tries to execute the onERC721Received() function on the receiver.
  • But also a non-safe transfer function (transferFrom()) that is not supposed to call the onERC721Received().

So anyone can send you NFTs using the non-safe transfer function without invoking any function on your contract. Which makes these transfers unblockable.

Petr Hejda
  • 40,554
  • 8
  • 72
  • 100
  • sure, it won't matter if they send the NFTs without safeTransferFrom because then the onERC721Received() will not be invoked, thus I will not inventory that tokenId on my privateSale contract – Char Jan 19 '22 at 19:14