IERC721.sol 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. pragma solidity ^0.5.0;
  2. import "../../introspection/IERC165.sol";
  3. /**
  4. * @dev Required interface of an ERC721 compliant contract.
  5. */
  6. contract IERC721 is IERC165 {
  7. event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
  8. event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
  9. event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
  10. /**
  11. * @dev Returns the number of NFTs in `owner`'s account.
  12. */
  13. function balanceOf(address owner) public view returns (uint256 balance);
  14. /**
  15. * @dev Returns the owner of the NFT specified by `tokenId`.
  16. */
  17. function ownerOf(uint256 tokenId) public view returns (address owner);
  18. /**
  19. * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
  20. * another (`to`).
  21. *
  22. *
  23. *
  24. * Requirements:
  25. * - `from`, `to` cannot be zero.
  26. * - `tokenId` must be owned by `from`.
  27. * - If the caller is not `from`, it must be have been allowed to move this
  28. * NFT by either `approve` or `setApproveForAll`.
  29. */
  30. function safeTransferFrom(address from, address to, uint256 tokenId) public;
  31. /**
  32. * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
  33. * another (`to`).
  34. *
  35. * Requirements:
  36. * - If the caller is not `from`, it must be approved to move this NFT by
  37. * either `approve` or `setApproveForAll`.
  38. */
  39. function transferFrom(address from, address to, uint256 tokenId) public;
  40. function approve(address to, uint256 tokenId) public;
  41. function getApproved(uint256 tokenId) public view returns (address operator);
  42. function setApprovalForAll(address operator, bool _approved) public;
  43. function isApprovedForAll(address owner, address operator) public view returns (bool);
  44. function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public;
  45. }