IERC721Receiver.sol 1.2 KB

12345678910111213141516171819202122232425
  1. pragma solidity ^0.5.0;
  2. /**
  3. * @title ERC721 token receiver interface
  4. * @dev Interface for any contract that wants to support safeTransfers
  5. * from ERC721 asset contracts.
  6. */
  7. contract IERC721Receiver {
  8. /**
  9. * @notice Handle the receipt of an NFT
  10. * @dev The ERC721 smart contract calls this function on the recipient
  11. * after a {IERC721-safeTransferFrom}. This function MUST return the function selector,
  12. * otherwise the caller will revert the transaction. The selector to be
  13. * returned can be obtained as `this.onERC721Received.selector`. This
  14. * function MAY throw to revert and reject the transfer.
  15. * Note: the ERC721 contract address is always the message sender.
  16. * @param operator The address which called `safeTransferFrom` function
  17. * @param from The address which previously owned the token
  18. * @param tokenId The NFT identifier which is being transferred
  19. * @param data Additional data with no specified format
  20. * @return bytes4 `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
  21. */
  22. function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
  23. public returns (bytes4);
  24. }