ERC-223: ERC-20 tokens with some extras

One of the best features of the Ethereum network is that anybody can create an individual cryptocurrency due to smart contracts. Though it…

ERC-223: ERC-20 tokens with some extras

One of the best features of the Ethereum network is that anybody can create an individual cryptocurrency due to smart contracts. Though it is true due to the ERC-20 standard, the created tokens are not equivalent currencies with Ether, the native currency.

Designed by Yanalya / Freepik

Ether has advantages. Transaction costs have to be paid in ETH. Paying ETH to a smart contract is an easy process, meanwhile paying crypto tokens is more complex. What does it mean? Eg.: In case of an ICO, we want to receive ETH, the amount of the transferred ETH is available in the parameters of the transaction. Meanwhile, if an ERC-20 token is transferred to a contract, the contract gets no info about the transaction. It is very complicated if we want to run an ICO collecting other tokens than ETH. First, we have to let the ICO contract allow to transfer the given amount of tokens from our account to itself, then we call the method of the contract. This is the process the contract gets the necessary amount. When the transaction is done successfully, ICO contract will be sure to have the right amount of token transferred to. It is like paying the bill with direct debit order instead of the transfer order.

For ENVIENTA this is important, as the ENV token will be used to support projects, too. The type of it is a so-called project ICO, where ERC-1155 project specific tokens will be emitted. According to decisions of the project, tokens might be utility tokens, or used for discounts or valid to get business shares. It is important that these project specific ICO contracts become able to receive ENV tokens.

The ERC-223 tokens are 100% compatible with standard ERC-20. They have some extras which might make them able to handle the above-mentioned method. When we transfer an ERC-223 token to a contract, the transfer method calls the tokenFallback method of the contract, reporting to the receiver about the incoming token.

This way transferring ERC-223 token eg. to an ICO contract is as simple as transferring ETH. For further understanding let’s see how is it implemented:

The transfer(address _to, uint _value) method is interesting for us, as it is easily used from a normal ERC-20 wallet. The method checks, whether the receiver is a user or a contract, (this control is made by isContract as well, as it can see in the codes it uses a bit of black magic in the assembly block).

When the target of the transfer is a contract, the method transferToContract will be called. This calls the tokenFallback method of the receiver contract. The transfer will only be completed if this method is finished successfully. It has two pros. On one hand, the contract is informed about the arrival of the token. On the other hand, if the contract does not have a receiver method like that, the transfer will not be completed. It is very useful, as there is no chance to transfer a token to a contract which is not able to receive it.

Due to standard ERC-223, the ERC-20 token is easy to transfer to contracts, similar to ETH, which makes token based ICO available instead of normal ETH based ICO.


Follow the ENVIENTA project! Join us on: http://t.me/envienta