IERC721Receiver.sol 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. pragma solidity ^0.4.24;
  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 `safeTransfer`. 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(keccak256("onERC721Received(address,address,uint256,bytes)"))`
  21. */
  22. function onERC721Received(
  23. address operator,
  24. address from,
  25. uint256 tokenId,
  26. bytes data
  27. )
  28. public
  29. returns(bytes4);
  30. }