Appearance
Solidity API
IERC20
_Interface of the ERC20 standard as defined in EIP-20. This interface defines the standard functions that an ERC20 token contract should implement. All functions must revert on failure rather than return false. See https://eips.ethereum.org/EIPS/eip-20_
totalSupply
solidity
function totalSupply() external view returns (uint256)Returns the total number of tokens in existence
This value includes all minted tokens minus all burned tokens. The returned value may change due to minting or burning events.
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The total supply of tokens |
balanceOf
solidity
function balanceOf(address account) external view returns (uint256)Returns the token balance of a given account
The balance can change due to transfers, mints, or burns. Zero address query should return 0.
Parameters
| Name | Type | Description |
|---|---|---|
| account | address | The address for which to query the balance |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The number of tokens owned by the account |
allowance
solidity
function allowance(address holder, address spender) external view returns (uint256)Returns the remaining number of tokens that spender is allowed to spend on behalf of holder
Zero address queries should return 0. If no approval exists, should return 0. Value may change due to spend or additional approve calls.
Parameters
| Name | Type | Description |
|---|---|---|
| holder | address | The address which owns the tokens |
| spender | address | The address which is approved to spend the tokens |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The number of tokens still available for the spender to spend |
approve
solidity
function approve(address spender, uint256 amount) external returns (bool)Sets the amount of tokens that spender is allowed to spend on behalf of the caller
_IMPORTANT: Beware of race conditions - subsequent calls to this function override the current allowance. Use increaseAllowance/decreaseAllowance from ERC20Extended instead. Must emit Approval event. Should revert if:
- spender is zero address
- insufficient balance_
Parameters
| Name | Type | Description |
|---|---|---|
| spender | address | The address which will be approved to spend tokens |
| amount | uint256 | The number of tokens to be approved for spending |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | Always returns true (function should revert on failure) |
transfer
solidity
function transfer(address recipient, uint256 amount) external returns (bool)Moves tokens from caller's account to the recipient
_Must emit Transfer event. Should revert if:
- recipient is zero address
- sender has insufficient balance
- transfer amount exceeds sender's balance_
Parameters
| Name | Type | Description |
|---|---|---|
| recipient | address | The address which will receive the tokens |
| amount | uint256 | The number of tokens to transfer |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | Always returns true (function should revert on failure) |
transferFrom
solidity
function transferFrom(address holder, address recipient, uint256 amount) external returns (bool)Moves tokens from holder's account to recipient using the allowance mechanism
_Must emit Transfer event. Must emit Approval event if allowance is updated. Should revert if:
- holder or recipient is zero address
- holder has insufficient balance
- spender has insufficient allowance
- transfer amount exceeds holder's balance or spender's allowance_
Parameters
| Name | Type | Description |
|---|---|---|
| holder | address | The address which owns the tokens to be transferred |
| recipient | address | The address which will receive the tokens |
| amount | uint256 | The number of tokens to transfer |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | Always returns true (function should revert on failure) |