Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the content of ERC777 specification?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what is the content of the ERC777 specification". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the content of the ERC777 specification".

1. Use ERC820 for contract registration

Different from the free and loose of ERC20, ERC777 uses the centralized intelligent contract registry and contract interface provided by the new ERC820 standard to realize the query function to achieve some degree of introspection. The centralized registration mechanism contributes to backward compatibility and better functional extension. A DApp or smart contract that expects to call ERC777 can use the ITokenReceipt interface returned by EIP-820 to determine whether the target contract has implemented the desired interface.

2. Overview of ERC777

ERC777 improves many shortcomings in ERC20 tokens, for example, ERC777 supports operator whitelist, provides Ethernet currency compatible send () interface, and uses ERC20 to achieve backward compatibility. The following figure shows the transfer process of ERC777 tokens:

To quickly grasp the application development of block chain in Taifang, Huizhi.com 's online interactive tutorial is recommended:

Introduction to etherfang DApp development | etherfang e-commerce DApp practice | ERC721 ethernet pass actual battle Web3j ethernet development detail | Php ethernet development detail | Python ethernet development detail | C# ethernet development detail | Flutter ethernet development detail description |

Compared with ERC20, ERC777 has the following advantages:

The philosophy of sending tokens is consistent with the etheric coin, that is, using the interface send (dest,value,data).

Any contract can define the tokensReceived event that is triggered when the token is received, which avoids the double invocation problem in the ERC20 token.

Both contracts and regular addresses can control or reject sent or received tokens by registering a tokensToSend or tokensReceivedFunction function to avoid the problem of token jam in ERC20 tokens.

Token holders can authorize or reclaim the operator authority to manage their tokens. These operators are usually payment processors in exchange contracts or automatic toll collection systems.

Each token transaction contains a userData data field, and there is a similar operatorData field when the operator operates, so that the data can be freely passed to the receiver.

It is backward compatible with wallets that do not support the tokensReceived function.

3. ERC777 specification

The following is the content of the ERC777 specification. A complete description can be found on the official website:

Interface ERC777Token {function name () external view returns (string memory); function symbol () external view returns (string memory); function totalSupply () external view returns (uint256); function balanceOf (address holder) external view returns (uint256); function granularity () external view returns (uint256); function defaultOperators () external view returns (address [] memory); function isOperatorFor (address operator, address holder) external view returns (bool); function authorizeOperator (address operator) external Function revokeOperator (address operator) external; function send (address to, uint256 amount, bytes calldata data) external; function operatorSend (address from, address to, uint256 amount, bytes calldata data, bytes calldata operatorData) external; function burn (uint256 amount, bytes calldata data) external; function operatorBurn (address from, uint256 amount, bytes calldata data, bytes calldata operatorData) external Event Sent (address indexed operator, address indexed from, address indexed to, uint256 amount, bytes data, bytes operatorData); event Minted (address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData) Event Burned (address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData); event AuthorizedOperator (address indexed operator, address indexed holder); event RevokedOperator (address indexed operator, address indexed holder);}

ERC777 token contracts must register the ERC777Token interface through the ERC820 standard. The base unit must be 10.

Logo

ERC777 token logo is licensed by Creative Commons Attribution-ShareAlike 4.0 and may not be used in advertising, promotion, or any other technology that is not compatible with ERC777.

Backward compatibility

ERC777 does not introduce backward incompatibility issues, so it is compatible with previous ERC20 token standards.

In this RIP, instead of using transfer and transferFrom for token transfers, send and operatorSend are used to avoid confusion and potential errors. At the same time, ERC777 allows you to implement transfer, transferFrom, approve and allowance in ERC20 to be compatible with ERC20.

So a token contract can implement both ERC20 and ERC777. Read-only functions such as name, symbol, balanceOf, tokenSupply and internal data such as balance mapping tables can overlap without problems. It is important to note, however, that the following functions are mandatory by the ERC777 specification: name, symbol, but decimal is not required in the ERC777 standard.

The write operation functions in both standards are decoupled and can operate independently of each other. Note that the ERC20 function should be limited to calls to existing contracts.

If the token contract implements ERC20, it must register the ERC20Token interface through ERC820. If the contract supports switching to enable or disable ERC20, the token contract must be registered through ERC820 or unregistered with the RC20Token interface each time the switch is made.

The only difference for a new contract to implement ERC20 is that the registration of ERC777TokensSender and ERC777TokensRecipient through ERC820 must be earlier than the registration of ERC20. This means that even if you call the transfer method of ERC20, the token contract must check through ERC820 to see if from or to implements the tokensToSend/tokensReceived interface and call it when available. Note that when calling the transfer method of the contract's ERC20, if the contract does not implement the tokensReceived interface, then the transfer should also be accepted, which means that the token may be locked.

Thank you for your reading, the above is the content of "what is the content of ERC777 specification", after the study of this article, I believe you have a deeper understanding of what the content of ERC777 specification is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report