From cdf36c080bb0c138fae5fb3547804545ef1a3406 Mon Sep 17 00:00:00 2001 From: bt3gl <1130416+bt3gl@users.noreply.github.com> Date: Wed, 21 Sep 2022 18:57:49 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=99=20create=20erc721?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Solidity-Expert/Token-standards/erc721.md | 41 +++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Solidity-Expert/Token-standards/erc721.md 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); +} +```