mirror of
https://github.com/autistic-symposium/blockchains-security-toolkit.git
synced 2025-05-17 22:20:29 -04:00
🍙 create erc721
This commit is contained in:
parent
ada28b9b84
commit
cdf36c080b
1 changed files with 41 additions and 0 deletions
41
Solidity-Expert/Token-standards/erc721.md
Normal file
41
Solidity-Expert/Token-standards/erc721.md
Normal file
|
@ -0,0 +1,41 @@
|
|||
## ERC721
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
To see the difference between ERC20 and ERC721, look at the internal data structure used in ERC721:
|
||||
|
||||
|
||||
```
|
||||
mapping (uint256 => address) private deedOwner;
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
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.
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
### 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);
|
||||
}
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue