mirror of
https://github.com/autistic-symposium/blockchains-security-toolkit.git
synced 2025-05-19 15:10:26 -04:00
🥓 create erc777
This commit is contained in:
parent
87e9267458
commit
afb9a04d03
1 changed files with 67 additions and 0 deletions
67
Solidity-Expert/Token-standards/erc777.md
Normal file
67
Solidity-Expert/Token-standards/erc777.md
Normal file
|
@ -0,0 +1,67 @@
|
|||
## ERC777
|
||||
|
||||
<br>
|
||||
|
||||
* an ERC20-compatible interface
|
||||
|
||||
* transfer tokens using a send function, similar to ether transfers
|
||||
|
||||
* compatible with ERC820 for token contract registration
|
||||
|
||||
* allow contracts and addresses to control which tokens they send through a tokensToSend function that is called prior to sending
|
||||
|
||||
* enable contracts and addresses to be notified of the tokens' receipt by calling a tokensReceived function in the recipient, and to reduce the probability of tokens being locked into contracts by requiring contracts to provide a tokensReceived function
|
||||
|
||||
* allow existing contracts to use proxy contracts for the `tokensToSend and `tokensReceived` functions
|
||||
|
||||
* operate in the same way whether sending to a contract or an EOA
|
||||
|
||||
* provide specific events for the minting and burning of tokens
|
||||
|
||||
* enable operators (trusted third parties, intended to be verified contracts) to move tokens on behalf of a token holder
|
||||
|
||||
* provide metadata on token transfer transactions in userData and operatorData fields
|
||||
|
||||
<br>
|
||||
|
||||
---
|
||||
|
||||
<br>
|
||||
|
||||
### ERC777 contract interface specification
|
||||
|
||||
|
||||
```
|
||||
interface ERC777Token {
|
||||
function name() public constant returns (string);
|
||||
function symbol() public constant returns (string);
|
||||
function totalSupply() public constant returns (uint256);
|
||||
function granularity() public constant returns (uint256);
|
||||
function balanceOf(address owner) public constant returns (uint256);
|
||||
|
||||
function send(address to, uint256 amount, bytes userData) public;
|
||||
|
||||
function authorizeOperator(address operator) public;
|
||||
function revokeOperator(address operator) public;
|
||||
function isOperatorFor(address operator, address tokenHolder)
|
||||
public constant returns (bool);
|
||||
function operatorSend(address from, address to, uint256 amount,
|
||||
bytes userData,bytes operatorData) public;
|
||||
|
||||
event Sent(address indexed operator, address indexed from,
|
||||
address indexed to, uint256 amount, bytes userData,
|
||||
bytes operatorData);
|
||||
event Minted(address indexed operator, address indexed to,
|
||||
uint256 amount, bytes operatorData);
|
||||
event Burned(address indexed operator, address indexed from,
|
||||
uint256 amount, bytes userData, bytes operatorData);
|
||||
event AuthorizedOperator(address indexed operator,
|
||||
address indexed tokenHolder);
|
||||
event RevokedOperator(address indexed operator, address indexed tokenHolder);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue