IButtonswapERC20
Inherits: IButtonswapERC20Errors, IButtonswapERC20Events
Functions
name
Returns the name of the token.
function name() external view returns (string memory _name);
Returns
| Name | Type | Description |
|---|---|---|
_name | string | The token name |
symbol
Returns the symbol of the token, usually a shorter version of the name.
function symbol() external view returns (string memory _symbol);
Returns
| Name | Type | Description |
|---|---|---|
_symbol | string | The token symbol |
decimals
Returns the number of decimals used to get its user representation.
For example, if decimals equals 2, a balance of 505 tokens should be displayed to a user as 5.05 (505 / 10 ** 2).
This information is only used for display purposes: it in no way affects any of the arithmetic of the contract.
function decimals() external pure returns (uint8 decimals);
Returns
| Name | Type | Description |
|---|---|---|
decimals | uint8 | The number of decimals |
totalSupply
Returns the amount of tokens in existence.
function totalSupply() external view returns (uint256 totalSupply);
Returns
| Name | Type | Description |
|---|---|---|
totalSupply | uint256 | The amount of tokens in existence |
balanceOf
Returns the amount of tokens owned by account.
function balanceOf(address owner) external view returns (uint256 balance);
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | The account the balance is being checked for |
Returns
| Name | Type | Description |
|---|---|---|
balance | uint256 | The amount of tokens owned by owner |
allowance
Returns the remaining number of tokens that spender will be allowed to spend on behalf of owner through {transferFrom}.
This is zero by default.
This value changes when {approve} or {transferFrom} are called.
function allowance(address owner, address spender) external view returns (uint256 allowance);
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | The account that owns the tokens |
spender | address | The account that can spend the tokens |
Returns
| Name | Type | Description |
|---|---|---|
allowance | uint256 | The amount of tokens owned by owner that the spender can transfer |
approve
Sets value as the allowance of spender over the caller's tokens.
IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {IButtonswapERC20Events-Approval} event.
function approve(address spender, uint256 value) external returns (bool success);
Parameters
| Name | Type | Description |
|---|---|---|
spender | address | The account that is granted permission to spend the tokens |
value | uint256 | The amount of tokens that can be spent |
Returns
| Name | Type | Description |
|---|---|---|
success | bool | Whether the operation succeeded |
transfer
Moves value tokens from the caller's account to to.
Emits a {IButtonswapERC20Events-Transfer} event.
function transfer(address to, uint256 value) external returns (bool success);
Parameters
| Name | Type | Description |
|---|---|---|
to | address | The account that is receiving the tokens |
value | uint256 | The amount of tokens being sent |
Returns
| Name | Type | Description |
|---|---|---|
success | bool | Whether the operation succeeded |
transferFrom
Moves value tokens from from to to using the allowance mechanism.
value is then deducted from the caller's allowance.
Emits a {IButtonswapERC20Events-Transfer} event.
function transferFrom(address from, address to, uint256 value) external returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
from | address | The account that is sending the tokens |
to | address | The account that is receiving the tokens |
value | uint256 | The amount of tokens being sent |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | success Whether the operation succeeded |
DOMAIN_SEPARATOR
Returns the domain separator used in the encoding of the signature for {permit}, as defined by EIP712.
function DOMAIN_SEPARATOR() external view returns (bytes32 DOMAIN_SEPARATOR);
Returns
| Name | Type | Description |
|---|---|---|
DOMAIN_SEPARATOR | bytes32 | The DOMAIN_SEPARATOR value |
PERMIT_TYPEHASH
Returns the typehash used in the encoding of the signature for {permit}, as defined by EIP712.
function PERMIT_TYPEHASH() external pure returns (bytes32 PERMIT_TYPEHASH);
Returns
| Name | Type | Description |
|---|---|---|
PERMIT_TYPEHASH | bytes32 | The PERMIT_TYPEHASH value |
nonces
Returns the current nonce for owner.
This value must be included whenever a signature is generated for {permit}.
Every successful call to {permit} increases owner's nonce by one.
This prevents a signature from being used multiple times.
function nonces(address owner) external view returns (uint256 nonce);
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | The account to get the nonce for |
Returns
| Name | Type | Description |
|---|---|---|
nonce | uint256 | The current nonce for the given owner |
permit
Sets value as the allowance of spender over owner's tokens, given owner's signed approval.
*IMPORTANT: The same issues {approve} has related to transaction ordering also apply here. Emits an {IButtonswapERC20Events-Approval} event. Requirements:
spendercannot be the zero address.deadlinemust be a timestamp in the future.v,randsmust be a validsecp256k1signature fromownerover the EIP712-formatted function arguments.- the signature must use
owner's current nonce (see {nonces}). For more information on the signature format, see the relevant EIP section.*
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
external;
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | The account that owns the tokens |
spender | address | The account that can spend the tokens |
value | uint256 | The amount of owner's tokens that spender can transfer |
deadline | uint256 | The future time after which the permit is no longer valid |
v | uint8 | Part of the signature |
r | bytes32 | Part of the signature |
s | bytes32 | Part of the signature |