o The functions defined as standard in ERC20 will be available in all tokens using it. Applications interacting with functions in one ERC20 token, will be able to interact with another ERC20 based token as well, using the functions defined in the standard.
o ERC20 standard functions:
- The
balanceOf()
function provides the number of tokens held by a given address. - The
transfer()
function transfers a number of tokens directly from the message sender to another address with no check of the recipient address. -
approve()
andtransferFrom()
are two functions that does the the transfer using a two-step process.
approve()
is the first step: A token holder gives another address (usually of a smart contract) approval to transfer up to a certain number of tokens, known as an allowance. The token holder usesapprove()
to provide this information.
The contract can usetransferFrom()
to for instance transfer the fee for some execution done by the user of the contract. - name() - Returns the name of the token
- symbol() - Returns the symbol of the token. E.g. âHIXâ.
-
decimals() - Returns the number of decimals the token uses - e.g.
8
, means to divide the token amount by100000000
to get its user representation. - totalSupply() - Returns the total token supply.
-
balanceOf(address _owner) - Returns the account balance of another account with address
_owner
.` -
allowance(address _owner, address _spender) - Returns the amount which
_spender
is still allowed to withdraw from_owner
.