Skip to content

Commit

Permalink
Remove rationale section and fix walidator error
Browse files Browse the repository at this point in the history
  • Loading branch information
Pandapip1 authored Apr 12, 2023
1 parent 23e1006 commit 9bfa57f
Showing 1 changed file with 14 additions and 24 deletions.
38 changes: 14 additions & 24 deletions EIPS/eip-20.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ A standard interface allows any tokens on Ethereum to be re-used by other applic

## Specification

## Token
### Token

### Methods
#### Methods

**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
##### name

Returns the name of the token - e.g. `"MyToken"`.

Expand All @@ -41,7 +41,7 @@ but interfaces and other contracts MUST NOT expect these values to be present.
function name() public view returns (string)
```

#### symbol
##### symbol

Returns the symbol of the token. E.g. "HIX".

Expand All @@ -52,7 +52,7 @@ but interfaces and other contracts MUST NOT expect these values to be present.
function symbol() public view returns (string)
```

#### decimals
##### decimals

Returns the number of decimals the token uses - e.g. `8`, means to divide the token amount by `100000000` to get its user representation.

Expand All @@ -63,23 +63,23 @@ but interfaces and other contracts MUST NOT expect these values to be present.
function decimals() public view returns (uint8)
```

#### totalSupply
##### totalSupply

Returns the total token supply.

``` js
function totalSupply() public view returns (uint256)
```

#### balanceOf
##### balanceOf

Returns the account balance of another account with address `_owner`.

``` js
function balanceOf(address _owner) public view returns (uint256 balance)
```

#### transfer
##### transfer

Transfers `_value` amount of tokens to address `_to`, and MUST fire the `Transfer` event.
The function SHOULD `throw` if the message caller's account balance does not have enough tokens to spend.
Expand All @@ -90,7 +90,7 @@ The function SHOULD `throw` if the message caller's account balance does not hav
function transfer(address _to, uint256 _value) public returns (bool success)
```

#### transferFrom
##### transferFrom

Transfers `_value` amount of tokens from address `_from` to address `_to`, and MUST fire the `Transfer` event.

Expand All @@ -104,7 +104,7 @@ The function SHOULD `throw` unless the `_from` account has deliberately authoriz
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)
```

#### approve
##### approve

Allows `_spender` to withdraw from your account multiple times, up to the `_value` amount. If this function is called again it overwrites the current allowance with `_value`.

Expand All @@ -117,17 +117,17 @@ THOUGH The contract itself shouldn't enforce it, to allow backwards compatibilit
function approve(address _spender, uint256 _value) public returns (bool success)
```

#### allowance
##### allowance

Returns the amount which `_spender` is still allowed to withdraw from `_owner`.

``` js
function allowance(address _owner, address _spender) public view returns (uint256 remaining)
```

### Events
#### Events

#### Transfer
##### Transfer

MUST trigger when tokens are transferred, including zero value transfers.

Expand All @@ -137,24 +137,14 @@ A token contract which creates new tokens SHOULD trigger a Transfer event with t
event Transfer(address indexed _from, address indexed _to, uint256 _value)
```

#### Approval
##### Approval

MUST trigger on any successful call to `approve(address _spender, uint256 _value)`.

``` js
event Approval(address indexed _owner, address indexed _spender, uint256 _value)
```

## Rationale

### The approve and transferFrom flow

`approve` and `transferFrom` can be used in conjunction with one another to allow smart contracts to take an action if and only if a transfer succeeds. This enables use cases such as decentralized exchanges, which can trustlessly swap one token for another.

### Decimals is optional

Some tokens might wish to use a base unit other than $10^{-18}$, and sometimes it doesn't make sense to have a fraction of a token. However, not every token might reasonably need to specify `decimals`. Thus, `decimals` is optional.
## Backwards Compatibility

Many existing tokens deployed on the Ethereum network already support this EIP.
Expand Down

0 comments on commit 9bfa57f

Please sign in to comment.