What is ERC-777?

This article will be discussing, What is ERC-777? Definition Of ERC-777. What occurs if I use ERC-20? Creating An ERC-777 Token Contract. ERC-777 Token Contract Stipulations. Reason. The Backwards Compatibility (ERC-20 Token). Issues associated with ERC-20 Token.

Definition Of ERC-777

ERC-777 is a tradable token standard created out of ERC-20. It is made for fungible tokens and is fully compatible with existing decentralized exchanges. It is an Ethereum blockchain protocol that states the type of tokens compatible with ETH.

ERC-777 allows for complex token trade interactions and aids the removal of vagueness around decimals, minting and burning. It makes use of a distinctively effective attribute called a ‘Hook’. The hook mechanism activates when tokens provide a computer-based analytical contract. The hook mechanism establishes how accounts and contracts interact during the acceptance of tokens. Unlike ERC-20 which faces the problem of attachment in a contract, ERC-777 are less likely to experience this.

Like ERC-20, ERC-777 is a standard for creating tokens on the Ethereum blockchain. With hooks programs into the standard, whenever ETH is assigning a smart contract, an alert comes through the hooks. This hook feature is absent in the ERC-20. Some of the benefits of the ERC-777 standard include:

Read On

  • ERC-777 allows anyone to add additional functionalities to tokens like a mixer contract for better transaction confidentiality or the addition of an emergency recovery feature to help if private keys are not available.
  • Its tokens transmit through the function send (value and data). This method is similar to Ether.
  • Also, ERC-777 makes use of the new ERC-820 standard which permits the registration of meta-data for contracts to allow for a basic form of introspection. The use of this standard allows for backward compatibility and additional functionality expansions. ERC-777 contracts interact the same way as ERC-20 contracts.
  • Unlike ERC-20 tokens, ERC-777, which receives tokens code states in a contract or ordinary addresses. For instance, ERC-20 transfers from one contract to another with only the owner of the ERC-20 token changed in the smart contract. This owner is the ERC-20 issuer. This duplicate call is not permissible in ERC-777
  • It introduces a new transfer function that includes a field called ‘Bytes’. In this field, you can add any identification information to the transfer which the recipient contract will be notified.
  • Introduction of updated versions like ERC-820 due to the security problems experienced in ERC-777. Although these problems are no more.

More Info

Tokens are sometimes locked during transmission to contracts that don’t support them because tokens transmit to any Ethereum address. The problem arises if the token is manually released, it is difficult to determine the origin of the token and send it back to them.
ERC-777 like ERC-20 is a standard for fungible tokens. It concentrates on permitting more complex interactions when trading of tokens occurs. Generally, it brings tokens and Ether closer by providing the equivalent of a msg. value for tokens. ERC-777 also gets rid of confusion around decimals, minting and burning. Its most outstanding feature is the ‘Receive Hooks’. Hooks merely function in a contract that is called when tokens are sent to it. It means that accounts and contracts can react when tokens are obtained.

This added feature of hooks allows for exciting use cases like atomic purchases using tokens, rejecting the receipt of tokens by reverting the hook call, redirecting the received tokens to other addresses etc. This feature is similar to how PaymentSplitter works.
In addition, the issue of attachment in contracts is absent in ERC-777 because contracts require implementing these hooks to receive tokens.

What Occurs If I Use ERC-20?

There’s no problem if this is the case as ERC-777 is backwards compatible with ERC-20. This means that you can interact with the tokens as if they were ERC-20 while still enjoying the special features including hooks that are on the ERC-777 standard. You can check out the EIP’s Backwards Compatibility section to know more.

Creating An ERC-777 Token Contract

The GLD example uses the ERC-20 guide and will replicate using ERC-777. Here, we’ll be extending from the ERC-777 contract that provides an implementation that is compatible with ERC-20. Employment of the mint to assign the initial supply to the deployer account. But unlike ERC-20’s mint, this one has extra parameters.
Name and symbol are appointed but not decimals. This is because the ERC-777 specification makes it compulsory to include them, unlike ERC-20 where it is optional and requires that decimals always return a fixed value of 18. You can refer back to the ERC-20 guide for more information
Finally, the default operators need to be set up. The default operators are special accounts that will allow the transfer of tokens on behalf of their holders. If there’s no plan to use operators in the token this can pass for an empty array. The balance removes using a balance of method to query the deployer’s balance.

GLDToken.balanceOf(deployerAddress) 1000

The ERC-20 transfer and ERC-777 send method can be used to move tokens from one account to another.
Sending Tokens to Contracts
A major difference when using send as opposed to transferring ERC-20 is that other contacts may revert to the message below:
ERC777: token recipient contract has no implementer for ERC777TokensRecipient
This message is good as it signifies that the recipient contract has not registered itself as aware of the ERC-777 protocol. As a result, transfers to it arent available to avoid tokens from locking. For example, the Golem contract currently holds over 350k GNT tokens, worth billions of dollars and is devoid of methods to get them out of there. This has happened to almost every ERC-20 backed project, mostly due to some user error.
Furthermore, the ERC-777 employs the new standard ERC-820, a pseudo-introspection using a registry contract that permits the registration of meta-data for contracts to provide basic introspection. Depending on the token Recipient returned by an EIP-820 lookup on the address and the functions implemented by the target contract, the new standard allows for backwards compatibility and other functionality extensions. ERC-777 includes new learnings from using the ERC-20 token. Learnings like white-listed operators, providing Ether compliant interfaces, using the ERC-820 to override and adapt to new functionalities for backwards compatibility.

More Info

Some benefits of this standard include:

  • A token receives a specific in any contract and in any usual address in a way that the code warns during token acceptance. This feature avoids the double call required in the ERC-20 standard.
  • It employs the same principle as Ether in the sense that tokens transmit with send(dest, value, data)
  • Management and denial of token acceptance by both contracts and regular addresses by registering a token received function which helps to refuse the reception of tokens
  • By registering a token to send function that blocks send, both contracts and common addresses can control and reject which token they send
  • ERC-777 can use in backwards compatibility with wallets that don’t have the tokens received function
  • In the case of an operator transaction, every token transaction contains a user data bytes field and a similar operator data has access to freely by the user and the operator respectively to pass data to the recipient.
  • Token holders have the authorization to dismiss operators to manage their tokens. These operators have usually verified contracts like an exchange or an automatic charging system.

ERC-777 Token Contract Stipulations

Interface ERC777Token {function name() public constant returns (string);function symbol() public constant returns (string); totalSupply() constant returns (uint256); 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); Minted(address indexed operator, address indexed to, uint256 amount, bytes operatorData);Burned(address indexed operator, address indexed from, uint256 amount, bytes userData, bytes operatorData); AuthorizedOperator(address indexed operator, address indexed tokenHolder);event RevokedOperator(address indexed operator, address indexed tokenHolder);}
The ERC-777 token interface registration must be by the token contract via the ERC-820 with the basic token unit of 1018

Reason

The ERC-777 standard proffers a solution to some of the issues of the EIP-223 and even goes further to permit operators that can manage the tokens in the same way that the ERC-20 with complete approval for authorization. Also, the use of ERC-820 permits backward compatibility with wallets and representative contracts without having to move.

The Backwards Compatibility (ERC-20 Token)

This EIP has no backward incompatibilities and can work with the older ERC-20 token standard. It also doesn’t use ‘transfer’ and ‘transfer form’ but rather uses ‘send’ and ‘operatorSend’ to prevent mistakes when it comes to determining which interface. The standard also permits the implementation of ERC-20 functions like ‘transfer’, ‘transfer from’, ‘approve’, and ‘allowance’ to make a token work effectively with ERC-20. For backward compatibility, the token can implement ‘decimals’ which must always return 18.

A token contract can therefore implement both ERC-20 and ERC-777 parallelly. Overlap problems in terms of read-only functions (like name, symbol, balance, total supply) and internal data without problems. However, note that functions like name and symbol are compulsory and must be implemented in the ERC-777.
The writing methods from both standards are down and operations can be individual without each other. The citation that ERC-20 functions must be specific to only old contracts. The token contract must register the ERC-20Token interface through the ERC-820 if the token contract implements ERC-20.

If a contract includes a switch to enable or disable ERC-20 methods, every time a switch is in place. A token contract must register or unregister the ERC-20 Token interface through ERC-820.
New contracts implementing ERC-20 should register ERC-777 TokenSender and ERC-777 TokenRecipient through the ERC-820 and this must take precedence over ERC-20. It means that even on an ERC-20 transfer, the token contract must first confirm through the ERC-820 if the from/to address employs token to send/token received and call it if available. Note that when calling ERC-20 transfer on a contract, if it doesn’t use the token received.

More Info

Benefits of ERC-777

  • The standard is well thought out and has an evolved interface for tokens and learnings from ERC-20 usage
  • Its white-listed operators are very relevant and more necessary than approve/allowance, which has mostly been lefty infinite
  • It uses the new standard request ERC-820 for introspection which permits additional functionality.

Disadvantages

⦁ It’s a new complex construction with dependent contract calls

⦁ Its dependencies raise the likelihood of security problems.

Issues associated with ERC-20 Token

Issues arise from transferring tokens to contracts

⦁ Tokens can be sent to any Ethereum address even to those that don’t support them. This might cause them to be locked forever.

⦁ Also, even if they could be removed manually, it is difficult to determine the origin of the token which makes sending them back difficult.

Probable solutions

The approve function in the ERC-20 permits the user to transfer to a contract and a second transaction design to let the contractor be aware of the endorsement. ERC-777 permits an off-chain signing to transfer without requiring Ether or private transfers that use ring signatures for added privacy.

Some qualities of ERC-777 include:

⦁ Backwards Compatible: this feature makes it work effectively well with more important functions of ERC-20

⦁ Simpler Contracts: this standard introduces a new transfer function that includes a field called ‘bytes. This field can add any distinguishable information to the transfer and it automatically informs the receiving contract of the transfer.

⦁ Its decimal is by default 18

⦁ It adds approved operators.

What is ERC-777? Definition Of ERC-777. What occurs if I use ERC-20? Creating An ERC-777 Token Contract. ERC-777 Token Contract Stipulations. Reason. The Backwards Compatibility (ERC-20 Token). Issues associated with ERC-20 Token.

Here is a list of related topics you might find interesting:

  1. Blockchain Technology
  2. Defi
  3. NFTs
  4. DAOs
  5. Crypto
  6. Web 3.0
  7. Altcoin Tokenomics
  8. Metaverse
  9. Smart Contracts

Leave a Comment