diff --git a/Solidity-Expert/Token-standards/erc721.md b/Solidity-Expert/Token-standards/erc721.md new file mode 100644 index 0000000..4fef101 --- /dev/null +++ b/Solidity-Expert/Token-standards/erc721.md @@ -0,0 +1,41 @@ +## ERC721 + +
+ + +To see the difference between ERC20 and ERC721, look at the internal data structure used in ERC721: + + +``` +mapping (uint256 => address) private deedOwner; +``` + +
+ +Whereas ERC20 tracks the balances that belong to each owner, with the owner being the primary key of the mapping, +ERC721 tracks each deed ID and who owns it, with the deed ID being the primary key of the mapping. + +
+ + +### The ERC721 contract interface specification + + +``` +interface ERC721 /* is ERC165 */ { + event Transfer(address indexed _from, address indexed _to, uint256 _deedId); + event Approval(address indexed _owner, address indexed _approved, + uint256 _deedId); + event ApprovalForAll(address indexed _owner, address indexed _operator, + bool _approved); + + function balanceOf(address _owner) external view returns (uint256 _balance); + function ownerOf(uint256 _deedId) external view returns (address _owner); + function transfer(address _to, uint256 _deedId) external payable; + function transferFrom(address _from, address _to, uint256 _deedId) + external payable; + function approve(address _approved, uint256 _deedId) external payable; + function setApprovalForAll(address _operator, boolean _approved) payable; + function supportsInterface(bytes4 interfaceID) external view returns (bool); +} +```