* make _tokenId indexed in Transfer and Approval events via: https://github.com/ethereum/EIPs/pull/1124/files * fix: make name() and symbol() external instead of public * feat: implement ERC721's ERC165 * feat: erc165 tests * fix: don't use chai-as-promised in direct await * fix: reorganize to /introspection * feat: abstract all erc165 tests to a behavior * feat: disallow registering 0xffffffff
71 lines
1.8 KiB
Solidity
71 lines
1.8 KiB
Solidity
pragma solidity ^0.4.23;
|
|
|
|
import "./ERC721Basic.sol";
|
|
|
|
|
|
/**
|
|
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
|
|
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
|
|
*/
|
|
contract ERC721Enumerable is ERC721Basic {
|
|
|
|
bytes4 private constant InterfaceId_ERC721Enumerable = 0x780e9d63;
|
|
/**
|
|
* 0x780e9d63 ===
|
|
* bytes4(keccak256('totalSupply()')) ^
|
|
* bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^
|
|
* bytes4(keccak256('tokenByIndex(uint256)'))
|
|
*/
|
|
|
|
constructor()
|
|
public
|
|
{
|
|
_registerInterface(InterfaceId_ERC721Enumerable);
|
|
}
|
|
|
|
function totalSupply() public view returns (uint256);
|
|
function tokenOfOwnerByIndex(
|
|
address _owner,
|
|
uint256 _index
|
|
)
|
|
public
|
|
view
|
|
returns (uint256 _tokenId);
|
|
|
|
function tokenByIndex(uint256 _index) public view returns (uint256);
|
|
}
|
|
|
|
|
|
/**
|
|
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
|
|
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
|
|
*/
|
|
contract ERC721Metadata is ERC721Basic {
|
|
|
|
bytes4 private constant InterfaceId_ERC721Metadata = 0x5b5e139f;
|
|
/**
|
|
* 0x5b5e139f ===
|
|
* bytes4(keccak256('name()')) ^
|
|
* bytes4(keccak256('symbol()')) ^
|
|
* bytes4(keccak256('tokenURI(uint256)'))
|
|
*/
|
|
|
|
constructor()
|
|
public
|
|
{
|
|
_registerInterface(InterfaceId_ERC721Metadata);
|
|
}
|
|
|
|
function name() external view returns (string _name);
|
|
function symbol() external view returns (string _symbol);
|
|
function tokenURI(uint256 _tokenId) public view returns (string);
|
|
}
|
|
|
|
|
|
/**
|
|
* @title ERC-721 Non-Fungible Token Standard, full implementation interface
|
|
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
|
|
*/
|
|
contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata {
|
|
}
|