Reputation: 2103
this https://theethereum.wiki/w/index.php/ERC20_Token_Standard eth wiki describes erc20 standard as a set of functions and attributes a token needs to have implemented. some of them are pretty self explanatory like
function transfer(address to, uint tokens) public returns (bool success);
which takes coins from your wallet and transfers it to somebody elses. But on the other hand
function approve(address spender, uint tokens) public returns (bool success);
or
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
How am I supposed to know what is the logic behind these methods? are there any extra docs describing it? and last but not least: what are upsides of tokens being ERC20 compliant?
Upvotes: 1
Views: 133
Reputation: 1540
ERC20 standard contains a set of functions that were proposed EIP-20 which were reviewed and voted on by community. As per abstract states the following:
This standard provides basic functionality to transfer tokens, as well as allow tokens to be approved so they can be spent by another on-chain third party.
See here for more some analogous examples on what approve
and allowance
do, but basically these are functions that allow an account owner to approve moving a fixed amount of tokens from their account to another account. approve
allows you to authorize an address to move a fixed amount, while allowance
simply returns this amount.
Looking at the EIP and ERC20 documentation can be a bit daunting at once, but one you start playing with the functions it makes a lot more sense. For quickest way to start testing I'd suggest using Ethereum's remix.
Upvotes: 2
Reputation: 10971
If you think the documentation on that wiki is not enough, you can look at the original EIP and look at all of the discussions involved that led to the final version, along with links to additional documentation and code examples to further explain the intention of each function. Note that all of the ERCs have a corresponding EIP, so you can refer to those for all of the other token standards.
what are upsides of tokens being ERC20 compliant?
The upside is that others will know how to work with your token.
Upvotes: 0