You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/developers/docs/standards/tokens/erc-223/index.md
+20-15Lines changed: 20 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,17 +6,17 @@ lang: en
6
6
7
7
## Introduction {#introduction}
8
8
9
-
**What is ERC-223?**
9
+
### What is ERC-223? {#what-is-erc223}
10
10
11
-
The ERC-223 is another standard for fungible tokens, like the ERC-20. The key difference is that ERC-223 defines not only the token API, but also the logic of how tokens should be transferred from sender to recipient and introduces a communication model that allows token transfers to be handled on the recipients side.
11
+
The ERC-223 is a standard for fungible tokens, similar to the ERC-20 standard. The key difference is that ERC-223 defines not only the token API but also the logic for transferring tokens from sender to recipient. It introduces a communication model that allows token transfers to be handled on the recipient's side.
12
12
13
-
**How is it different from ERC-20 and why we need another token standard?**
13
+
### Differences from ERC-20 {#erc20-differences}
14
14
15
-
ERC-223 addresses some limitations of ERC-20 and introduces a new method of interactions between token contract and a contract that may receive the tokens. There are few things that are possible with ERC-223 but not with ERC-20:
15
+
ERC-223 addresses some limitations of ERC-20 and introduces a new method of interaction between the token contract and a contract that may receive the tokens. There are few things that are possible with ERC-223 but not with ERC-20:
16
16
17
-
- Token transfer handling on the recipient's side. Recipient can detect that an ERC-223 token is being deposited.
18
-
- Rejection of improperly sent tokens. If a user sent ERC-223 tokens to a contract that is not supposed to receive tokens then the contract can reject the transaction and the tokens will not be lost.
19
-
-The transfer of ERC-223 tokens may contain metadata, which allows arbitrary information to be attached to the token transactions.
17
+
- Token transfer handling on the recipient's side: Recipients can detect that an ERC-223 token is being deposited.
18
+
- Rejection of improperly sent tokens: If a user sends ERC-223 tokens to a contract not supposed to receive tokens, the contract can reject the transaction, preventing token loss.
19
+
-Metadata in transfers: ERC-223 tokens can include metadata, allowing arbitrary information to be attached to token transactions.
20
20
21
21
## Prerequisites {#prerequisites}
22
22
@@ -27,8 +27,7 @@ ERC-223 addresses some limitations of ERC-20 and introduces a new method of inte
27
27
28
28
## Body {#body}
29
29
30
-
The ERC-223 (Ethereum Request for Comments 223), proposed by Dexaran in March 2017, is a token standard that
31
-
implements an API for tokens within smart contracts and declares API for a contract that is supposed to receive ERC-223 tokens. Any contract that does not support ERC-223 Receiver API can not receive ERC-223 tokens which prevents the most common user mistakes.
30
+
ERC-223 is a token standard that implements an API for tokens within smart contracts. It also declares an API for contracts that are supposed to receive ERC-223 tokens. Contracts that do not support the ERC-223 Receiver API cannot receive ERC-223 tokens, preventing user error.
32
31
33
32
If a smart contract implements the following methods and events it can be called an ERC-223 compatible token contract. Once deployed, it
34
33
will be responsible to keep track of the created tokens on Ethereum.
@@ -71,9 +70,7 @@ The API of ERC-223 token is similar to that of ERC-20, so from UI development po
71
70
72
71
### Solidity examples {#solidity-example}
73
72
74
-
The purpose of this example is to illustrate how a contract must work with ERC-223 tokens.
75
-
76
-
Assume that we have a very basic ERC-223 token:
73
+
The following example illustrates how a basic ERC-223 token contract operates:
77
74
78
75
```solidity
79
76
pragma solidity ^0.8.19;
@@ -146,15 +143,15 @@ contract RecipientContract is IERC223Recipient {
146
143
147
144
### What will happen if we send some tokenB to the contract? {#sending-tokens}
148
145
149
-
The transaction will fail and the transfer of tokens will simply not happen. The tokens will be returned to the sender's address.
146
+
The transaction will fail, and the transfer of tokens will not happen. The tokens will be returned to the sender's address.
150
147
151
148
### How can we make a deposit to this contract? {#contract-deposits}
152
149
153
-
We can simply call the `transfer(address,uint256)` or `transfer(address,uint256,bytes)` function of the ERC-223 token and tell it to transfer some tokens to the address of the `RecipientContract`. That's it.
150
+
Call the `transfer(address,uint256)` or `transfer(address,uint256,bytes)` function of the ERC-223 token, specifying the address of the `RecipientContract`.
154
151
155
152
### What will happen if we transfer an ERC-20 token to this contract? {#erc-20-transfers}
156
153
157
-
The ERC-20 standard supports two methods of transferring tokens: `transfer` function and `approve + transferFrom` pattern. This is not possible to make a deposit with `transferFrom` function as the `RecipientContract` does not have any functions that subsequently call `transferFrom`. If an ERC-20 token is sent with `transfer` function to the address of the `RecipientContract` then unfortunately the tokens will be transferred from the sender's address to the address of the `RecipientContract`but the transfer will not be recognized i.e.`Deposit()` event will not be fired and `deposits` value will not change. There is also no way to filter or prevent unwanted ERC-20 deposits that are made with the `transfer` function.
154
+
If an ERC-20 token is sent to the `RecipientContract`, the tokens will be transferred, but the transfer will not be recognized (no`Deposit()` event will be fired, and the deposits value will not change). Unwanted ERC-20 deposits cannot be filtered or prevented.
158
155
159
156
### What if we want to execute some function after the token deposit is completed? {#function-execution}
160
157
@@ -187,6 +184,14 @@ In the above example an ERC-223 token must be transferred to the address of the
187
184
188
185
Parameters can be encoded in the `data` of the token transfer as well, for example we can call the bar() function with 12345 value for `_someNumber`. In this case the `data` must be `0x0423a13200000000000000000000000000000000000000000000000000000000000004d2` where `0x0423a132` is the signature of the `bar(uint256)` function and `00000000000000000000000000000000000000000000000000000000000004d2` is 12345 as uint256.
189
186
187
+
## Limitations {#limitations}
188
+
189
+
While ERC-223 addresses several issues found in the ERC-20 standard, it is not without its own limitations:
190
+
191
+
- Adoption and Compatibility: ERC-223 is not yet widely adopted, which may limit its compatibility with existing tools and platforms.
192
+
- Backward Compatibility: ERC-223 is not backward compatible with ERC-20, meaning that existing ERC-20 contracts and tools will not work with ERC-223 tokens without modifications.
193
+
- Gas Costs: The additional checks and functionalities in ERC-223 transfers may result in higher gas costs compared to ERC-20 transactions.
0 commit comments