mirror of https://github.com/status-im/EIPs.git
Avoid shadowing existing declarations (improvements to EIP20) (#1437)
* Avoid shadowing existing declarations About optional methods, Solidity compiler currently throws this warning: "This declaration shadows an existing declaration.". I suggest to remove names from return parameters of the optional methods to avoid shadowing existing declarations. * More improvements - Fixed warning about visibility - Links to examples are now permanent links - Added note about Solidity version used in the specifications
This commit is contained in:
parent
5d2adde7d1
commit
617ab2d0c3
|
@ -29,7 +29,9 @@ A standard interface allows any tokens on Ethereum to be re-used by other applic
|
|||
## Token
|
||||
### Methods
|
||||
|
||||
**NOTE**: Callers MUST handle `false` from `returns (bool success)`. Callers MUST NOT assume that `false` is never returned!
|
||||
**NOTES**:
|
||||
- The following specifications use syntax from Solidity `0.4.17` (or above)
|
||||
- Callers MUST handle `false` from `returns (bool success)`. Callers MUST NOT assume that `false` is never returned!
|
||||
|
||||
|
||||
#### name
|
||||
|
@ -41,7 +43,7 @@ but interfaces and other contracts MUST NOT expect these values to be present.
|
|||
|
||||
|
||||
``` js
|
||||
function name() view returns (string name)
|
||||
function name() public view returns (string)
|
||||
```
|
||||
|
||||
|
||||
|
@ -53,7 +55,7 @@ OPTIONAL - This method can be used to improve usability,
|
|||
but interfaces and other contracts MUST NOT expect these values to be present.
|
||||
|
||||
``` js
|
||||
function symbol() view returns (string symbol)
|
||||
function symbol() public view returns (string)
|
||||
```
|
||||
|
||||
|
||||
|
@ -66,7 +68,7 @@ OPTIONAL - This method can be used to improve usability,
|
|||
but interfaces and other contracts MUST NOT expect these values to be present.
|
||||
|
||||
``` js
|
||||
function decimals() view returns (uint8 decimals)
|
||||
function decimals() public view returns (uint8)
|
||||
```
|
||||
|
||||
|
||||
|
@ -75,7 +77,7 @@ function decimals() view returns (uint8 decimals)
|
|||
Returns the total token supply.
|
||||
|
||||
``` js
|
||||
function totalSupply() view returns (uint256 totalSupply)
|
||||
function totalSupply() public view returns (uint256)
|
||||
```
|
||||
|
||||
|
||||
|
@ -85,7 +87,7 @@ function totalSupply() view returns (uint256 totalSupply)
|
|||
Returns the account balance of another account with address `_owner`.
|
||||
|
||||
``` js
|
||||
function balanceOf(address _owner) view returns (uint256 balance)
|
||||
function balanceOf(address _owner) public view returns (uint256 balance)
|
||||
```
|
||||
|
||||
|
||||
|
@ -98,7 +100,7 @@ The function SHOULD `throw` if the `_from` account balance does not have enough
|
|||
*Note* Transfers of 0 values MUST be treated as normal transfers and fire the `Transfer` event.
|
||||
|
||||
``` js
|
||||
function transfer(address _to, uint256 _value) returns (bool success)
|
||||
function transfer(address _to, uint256 _value) public returns (bool success)
|
||||
```
|
||||
|
||||
|
||||
|
@ -114,7 +116,7 @@ The function SHOULD `throw` unless the `_from` account has deliberately authoriz
|
|||
*Note* Transfers of 0 values MUST be treated as normal transfers and fire the `Transfer` event.
|
||||
|
||||
``` js
|
||||
function transferFrom(address _from, address _to, uint256 _value) returns (bool success)
|
||||
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)
|
||||
```
|
||||
|
||||
|
||||
|
@ -128,7 +130,7 @@ clients SHOULD make sure to create user interfaces in such a way that they set t
|
|||
THOUGH The contract itself shouldn't enforce it, to allow backwards compatibility with contracts deployed before
|
||||
|
||||
``` js
|
||||
function approve(address _spender, uint256 _value) returns (bool success)
|
||||
function approve(address _spender, uint256 _value) public returns (bool success)
|
||||
```
|
||||
|
||||
|
||||
|
@ -137,7 +139,7 @@ function approve(address _spender, uint256 _value) returns (bool success)
|
|||
Returns the amount which `_spender` is still allowed to withdraw from `_owner`.
|
||||
|
||||
``` js
|
||||
function allowance(address _owner, address _spender) view returns (uint256 remaining)
|
||||
function allowance(address _owner, address _spender) public view returns (uint256 remaining)
|
||||
```
|
||||
|
||||
|
||||
|
@ -177,7 +179,6 @@ Different implementations have been written by various teams that have different
|
|||
- [ConsenSys implementation](https://github.com/ConsenSys/Tokens/blob/fdf687c69d998266a95f15216b1955a4965a0a6d/contracts/eip20/EIP20.sol)
|
||||
|
||||
|
||||
|
||||
## History
|
||||
|
||||
Historical links related to this standard:
|
||||
|
|
Loading…
Reference in New Issue