ERC721Basic.sol 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. pragma solidity ^0.4.24;
  2. import "../../introspection/ERC165.sol";
  3. /**
  4. * @title ERC721 Non-Fungible Token Standard basic interface
  5. * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
  6. */
  7. contract ERC721Basic is ERC165 {
  8. bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd;
  9. /*
  10. * 0x80ac58cd ===
  11. * bytes4(keccak256('balanceOf(address)')) ^
  12. * bytes4(keccak256('ownerOf(uint256)')) ^
  13. * bytes4(keccak256('approve(address,uint256)')) ^
  14. * bytes4(keccak256('getApproved(uint256)')) ^
  15. * bytes4(keccak256('setApprovalForAll(address,bool)')) ^
  16. * bytes4(keccak256('isApprovedForAll(address,address)')) ^
  17. * bytes4(keccak256('transferFrom(address,address,uint256)')) ^
  18. * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^
  19. * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)'))
  20. */
  21. bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79;
  22. /*
  23. * 0x4f558e79 ===
  24. * bytes4(keccak256('exists(uint256)'))
  25. */
  26. bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63;
  27. /**
  28. * 0x780e9d63 ===
  29. * bytes4(keccak256('totalSupply()')) ^
  30. * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^
  31. * bytes4(keccak256('tokenByIndex(uint256)'))
  32. */
  33. bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f;
  34. /**
  35. * 0x5b5e139f ===
  36. * bytes4(keccak256('name()')) ^
  37. * bytes4(keccak256('symbol()')) ^
  38. * bytes4(keccak256('tokenURI(uint256)'))
  39. */
  40. event Transfer(
  41. address indexed _from,
  42. address indexed _to,
  43. uint256 indexed _tokenId
  44. );
  45. event Approval(
  46. address indexed _owner,
  47. address indexed _approved,
  48. uint256 indexed _tokenId
  49. );
  50. event ApprovalForAll(
  51. address indexed _owner,
  52. address indexed _operator,
  53. bool _approved
  54. );
  55. function balanceOf(address _owner) public view returns (uint256 _balance);
  56. function ownerOf(uint256 _tokenId) public view returns (address _owner);
  57. function exists(uint256 _tokenId) public view returns (bool _exists);
  58. function approve(address _to, uint256 _tokenId) public;
  59. function getApproved(uint256 _tokenId)
  60. public view returns (address _operator);
  61. function setApprovalForAll(address _operator, bool _approved) public;
  62. function isApprovedForAll(address _owner, address _operator)
  63. public view returns (bool);
  64. function transferFrom(address _from, address _to, uint256 _tokenId) public;
  65. function safeTransferFrom(address _from, address _to, uint256 _tokenId)
  66. public;
  67. function safeTransferFrom(
  68. address _from,
  69. address _to,
  70. uint256 _tokenId,
  71. bytes _data
  72. )
  73. public;
  74. }