ChainZilla

Submit a ticket My Tickets
Welcome
Login  Sign up

ERC20 Functions

ERC20 code outlines six specific functions for tokens, which are


1- Getting the total supply of tokens via the “totalSupply” function.


2- Retrieving the token balance of another account associated with the _owner” address via the ” balanceOf(address _owner) constant returns (uint256 balance)” function.


3- Sending a specific amount of tokens _value” to a given address via the  transfer(address _to, uint256 _value) returns (bool success)” function.


4- Sending a specific amount of tokens _value”  from one token (contract) address to another token (contract) address via the “transferFrom(address _from, address _to, uint256 _value) returns (bool success)” function.


5- Enabling a specific account to withdraw tokens from one’s account repeatedly, while predefining the upper limit for the amount of tokens to be withdrawn with the “_value” parameter. This can be achieved via the “approve(address _spender, uint256 _value) returns (bool success)“. The upper limit for withdrawal, i.e. the _value” parameter, can be overwritten when the function is recalled.


6- Returning the residual amount of tokens, within the preset amount defined by the upper limit allowed to be spent by the “_spender to withdraw from the account of the _owner“. This can be executed via the “allowance(address *_owner*, address *_spender*) constant returns (uint256 remaining)” function.


These six functions defined by the ERC20 code represent cornerstone functionality issues, which include how these tokens will be transferred between different accounts, and how users can retrieve data associated with a given ERC20 token. These group of functions are prescribed to ensure that Ethereum based tokens will function similarly within any part of Ethereum’s platform. As such, all crypto wallets that are compliant with the ether coin will also support tokens based on the ERC20 standard.



Source: https://www.cointelligence.com/content/comparison-erc20-erc223-new-ethereum-erc777-token-standard/

S
St3rling is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.