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: EIPS/eip-1.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,7 +118,7 @@ EIPs should be written in [markdown](https://github.com/adam-p/markdown-here/wik
118
118
119
119
Each EIP must begin with an [RFC 822](https://www.ietf.org/rfc/rfc822.txt) style header preamble, preceded and followed by three hyphens (`---`). This header is also termed ["front matter" by Jekyll](https://jekyllrb.com/docs/front-matter/). The headers must appear in the following order.
120
120
121
-
`eip`: *EIP number* (this is determined by the EIP editor)
121
+
`eip`: *EIP number*
122
122
123
123
`title`: *The EIP title is a few words, not a complete sentence*
124
124
@@ -451,7 +451,7 @@ If the EIP isn't ready, the editor will send it back to the author for revision,
451
451
452
452
Once the EIP is ready for the repository, the EIP editor will:
453
453
454
-
- Assign an EIP number (generally the PR number, but the decision is with the editors)
454
+
- Assign an EIP number (generally incremental; editors can reassign if number sniping is suspected)
455
455
- Merge the corresponding [pull request](https://github.com/ethereum/EIPs/pulls)
456
456
- Send a message back to the EIP author with the next step.
Copy file name to clipboardExpand all lines: EIPS/eip-1271.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ This function should be implemented by contracts which desire to sign messages (
57
57
## Rationale
58
58
We believe the name of the proposed function to be appropriate considering that an *authorized* signers providing proper signatures for a given data would see their signature as "valid" by the signing contract. Hence, a signed action message is only valid when the signer is authorized to perform a given action on the behalf of a smart wallet.
59
59
60
-
Two arguments are provided for simplicity of separating the hash signed from the signature. A bytes32 hash is used instead of the unhashed message for simplicy, since contracts could expect a certain hashing function that is not standard, such as with [EIP-712](./eip-712.md).
60
+
Two arguments are provided for simplicity of separating the hash signed from the signature. A bytes32 hash is used instead of the unhashed message for simplicity, since contracts could expect a certain hashing function that is not standard, such as with [EIP-712](./eip-712.md).
61
61
62
62
`isValidSignature()` should not be able to modify states in order to prevent `GasToken` minting or similar attack vectors. Again, this is to simplify the implementation surface of the function for better standardization and to allow off-chain contract queries.
The following describes an interface for fungible tokens that supports a `tokenReceived` callback to notify contract recipients when tokens are received.
16
+
The following describes an interface and logic for fungible tokens that supports a `tokenReceived` callback to notify contract recipients when tokens are received. This makes tokens behave identical to ether.
16
17
17
18
## Motivation
18
19
@@ -38,25 +39,25 @@ Token transfers to contracts not implementing `tokenReceived` as described below
38
39
function totalSupply() view returns (uint256 totalSupply)
39
40
```
40
41
41
-
Gets the total supply of the token. The functionality of this method is identical to that of ERC-20.
42
+
Returns the total supply of the token. The functionality of this method is identical to that of ERC-20.
42
43
43
44
##### `name`
44
45
45
46
```solidity
46
47
function name() view returns (string _name)
47
48
```
48
49
49
-
Gets the name of the token. The functionality of this method is identical to that of ERC-20.
50
+
Returns the name of the token. The functionality of this method is identical to that of ERC-20.
50
51
51
52
OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.
52
53
53
54
##### `symbol`
54
55
55
56
```solidity
56
-
function symbol() view returns (bytes32 _symbol)
57
+
function symbol() view returns (string _symbol)
57
58
```
58
59
59
-
Gets the symbol of the token. The functionality of this method is identical to that of ERC-20.
60
+
Returns the symbol of the token. The functionality of this method is identical to that of ERC-20.
60
61
61
62
OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.
62
63
@@ -66,7 +67,17 @@ OPTIONAL - This method can be used to improve usability, but interfaces and othe
66
67
function decimals() view returns (uint8 _decimals)
67
68
```
68
69
69
-
Gets the number of decimals of the token. The functionality of this method is identical to that of ERC-20.
70
+
Returns the number of decimals of the token. The functionality of this method is identical to that of ERC-20.
71
+
72
+
OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.
73
+
74
+
##### `standard`
75
+
76
+
```solidity
77
+
function standard() view returns (string memory)
78
+
```
79
+
80
+
Returns the identifier of the standard. If the token is [ERC-223](./eip-20.md) then it must return `"223"`.
70
81
71
82
OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.
72
83
@@ -76,7 +87,7 @@ OPTIONAL - This method can be used to improve usability, but interfaces and othe
76
87
function balanceOf(address _owner) view returns (uint256 balance)
77
88
```
78
89
79
-
Gets the account balance of another account with address `_owner`. The functionality of this method is identical to that of ERC-20.
90
+
Returns the account balance of another account with address `_owner`. The functionality of this method is identical to that of ERC-20.
This function must transfer tokens, and if `_to` is a contract, it must call the `tokenReceived(address, uint256, bytes calldata)` function of `_to`. If the `tokenReceived` function is not implemented in `_to` (recipient contract), then the transaction must fail and the transfer of tokens must be reverted.
88
99
If `_to` is an externally owned address, then the transaction must be sent without executing `tokenReceived` in `_to`.
89
100
`_data` can be attached to this token transaction, but it requires more gas. `_data` can be empty.
101
+
102
+
The `tokenReceived` function of `_to` MUST be called after all other operations to avoid re-entrancy attacks.
90
103
91
104
##### `transfer(address, uint, bytes)`
92
105
@@ -98,7 +111,9 @@ This function must transfer tokens and invoke the function `tokenReceived (addre
98
111
If `_to` is an externally owned address (determined by the code size being zero), then the transaction must be sent without executing `tokenReceived` in `_to`.
99
112
`_data` can be attached to this token transaction, but it requires more gas. `_data` can be empty.
100
113
101
-
NOTE: A possible way to check whether the `_to` is a contract or an address is to assemble the code of `_to`. If there is no code in `_to`, then this is an externally owned address, otherwise it's a contract.116
114
+
NOTE: A possible way to check whether the `_to` is a contract or an address is to assemble the code of `_to`. If there is no code in `_to`, then this is an externally owned address, otherwise it's a contract.
115
+
116
+
The `tokenReceived` function of `_to` MUST be called after all other operations to avoid re-entrancy attacks.
102
117
103
118
#### Events
104
119
@@ -216,13 +231,13 @@ library Address {
216
231
217
232
abstract contract IERC223Recipient {
218
233
/**
219
-
* @dev Standard ERC223 function that will handle incoming token transfers.
234
+
* @dev Standard ERC-223 receiving function that will handle incoming token transfers.
220
235
*
221
236
* @param _from Token sender address.
222
237
* @param _value Amount of tokens.
223
238
* @param _data Transaction metadata.
224
239
*/
225
-
function tokenReceived(address _from, uint _value, bytes memory _data) public virtual;
240
+
function tokenReceived(address _from, uint _value, bytes memory _data) public virtual returns (bytes4);
226
241
}
227
242
228
243
/**
@@ -240,7 +255,7 @@ contract ERC223Token {
240
255
uint8 private _decimals;
241
256
uint256 private _totalSupply;
242
257
243
-
mapping(address => uint256) public balances; // List of user balances.
258
+
mapping(address => uint256) private balances; // List of user balances.
244
259
245
260
/**
246
261
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
@@ -302,6 +317,14 @@ contract ERC223Token {
302
317
return _totalSupply;
303
318
}
304
319
320
+
/**
321
+
* @dev See {IERC223-standard}.
322
+
*/
323
+
function standard() public view returns (string memory)
0 commit comments