ERC721.sol 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. pragma solidity ^0.4.23;
  2. import "./ERC721Basic.sol";
  3. /**
  4. * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
  5. * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
  6. */
  7. contract ERC721Enumerable is ERC721Basic {
  8. bytes4 private constant InterfaceId_ERC721Enumerable = 0x780e9d63;
  9. /**
  10. * 0x780e9d63 ===
  11. * bytes4(keccak256('totalSupply()')) ^
  12. * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^
  13. * bytes4(keccak256('tokenByIndex(uint256)'))
  14. */
  15. constructor()
  16. public
  17. {
  18. _registerInterface(InterfaceId_ERC721Enumerable);
  19. }
  20. function totalSupply() public view returns (uint256);
  21. function tokenOfOwnerByIndex(
  22. address _owner,
  23. uint256 _index
  24. )
  25. public
  26. view
  27. returns (uint256 _tokenId);
  28. function tokenByIndex(uint256 _index) public view returns (uint256);
  29. }
  30. /**
  31. * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
  32. * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
  33. */
  34. contract ERC721Metadata is ERC721Basic {
  35. bytes4 private constant InterfaceId_ERC721Metadata = 0x5b5e139f;
  36. /**
  37. * 0x5b5e139f ===
  38. * bytes4(keccak256('name()')) ^
  39. * bytes4(keccak256('symbol()')) ^
  40. * bytes4(keccak256('tokenURI(uint256)'))
  41. */
  42. constructor()
  43. public
  44. {
  45. _registerInterface(InterfaceId_ERC721Metadata);
  46. }
  47. function name() external view returns (string _name);
  48. function symbol() external view returns (string _symbol);
  49. function tokenURI(uint256 _tokenId) public view returns (string);
  50. }
  51. /**
  52. * @title ERC-721 Non-Fungible Token Standard, full implementation interface
  53. * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
  54. */
  55. contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata {
  56. }