CloneERC20
Inherits: Clone, IERC20
Authors: Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol), Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
Modern and gas efficient ERC20 implementation.
Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
State Variables
totalSupply
Returns the amount of tokens in existence.
uint256 public totalSupply;
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
balanceOf
Returns the amount of tokens owned by account.
mapping(address => uint256) public balanceOf;
Parameters
| Name | Type | Description |
|---|---|---|
| <none> | address |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
allowance
Returns the remaining number of tokens that spender is allowed
to spend on behalf of owner
mapping(address => mapping(address => uint256)) public allowance;
Parameters
| Name | Type | Description |
|---|---|---|
| <none> | address | |
| <none> | address |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
Functions
name
Returns the name of the token.
function name() external pure returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
| <none> | string |
symbol
Returns the symbol of the token.
function symbol() external pure returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
| <none> | string |
decimals
Returns the decimals places of the token.
function decimals() external pure returns (uint8);
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint8 |
approve
Sets amount as the allowance of spender over the caller's tokens.
Be aware of front-running risks: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
function approve(address spender, uint256 amount) public virtual returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
| spender | address | |
| amount | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
increaseAllowance
function increaseAllowance(address spender, uint256 amount) public virtual returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
| spender | address | |
| amount | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
decreaseAllowance
function decreaseAllowance(address spender, uint256 amount) public virtual returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
| spender | address | |
| amount | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
transfer
Moves amount tokens from the caller's account to to.
function transfer(address to, uint256 amount) public virtual returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
| to | address | |
| amount | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
transferFrom
Moves amount tokens from from to to using the allowance mechanism.
amount is then deducted from the caller's allowance.
function transferFrom(address from, address to, uint256 amount) public virtual returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
| from | address | |
| to | address | |
| amount | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
_mint
function _mint(address to, uint256 amount) internal virtual;
Parameters
| Name | Type | Description |
|---|---|---|
| to | address | |
| amount | uint256 |
_burn
function _burn(address from, uint256 amount) internal virtual;
Parameters
| Name | Type | Description |
|---|---|---|
| from | address | |
| amount | uint256 |