Homework: ERC20

@hupro check this one too please!

Hello sir(s), if you can, please describe the most known functions used in the ERC20 Token Standard.

2. What functions are in the ERC20 Token Standard Interface and what do they do?

If you have any doubt please let us know! :slightly_smiling_face:

Carlos Z.

Homwork on ERC20 token standard

  1. What are the benefits of setting a token standard like ERC20?

The benefits of setting a standard like ERC20 is that now that the standard has been adopted, the vast majority of contracts are created under that standard. This provides interoperability and fungibility and generally makes the coin exchange smooth.

  1. What functions are in the ERC20 standard interface and what do they do?

totalSupply()
Calculates the total number of tokens in existence
balanceOf()
Allows the return and storage of address provided. All address balances are public knowledge.
approve()
Owner of contract authorizes address given to withdraw tokens.
transfer()
Owner transfers to tokens to given address
transferFrom()
Owner transfers tokens from a different address than the owners to the given address
Token Name
Optional field for distinguishing popular wallets
Token Symbol
Optional field for abbreviation of tokens
Number of Decimals
Optional field to determine the amount of demical places to be calculated for the given token - typically 18

1 Like
  1. Having a token standard allows all tokens to be able to work with each other and allowing an economy of tokens to become more efficient over time. Wallets and exchanges can support all tokens meaning that they are scalable and simple.

  • balanceOf() - a function that provides the number of tokens held by a wallet address.
  • transfer() - Function that sends a given number of tokens from the message sender to the given address.
  • allowance() - A function that provides the number of tokens allowed to be given to an address.
  • approve() - a function that allows a token holder to give an address approval to transfer an allowed number of tokens.
  • transferFrom() - a function that takes away a certain amount of tokens from the senders’ address and carries on.
1 Like
  1. The benefits of having a token standard is that all smart contracts follow the same standard and can communicate with one another. It also means that any new token that follows that standard will be automatically supported on wallets.

totalSupply - displays the total number of fungible tokens in circulation.
balanceOf - gives the balance of the address.
transfer - determines the amount to transfer from said address

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    Each token smart contract is written in the same way. This allows any tokens to be easily re-used by other applications such as wallets and exchanges.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?

function name() public view returns (string)
Returns the name of the token.
function symbol() public view returns (string)
Returns the symbol of the token.
function decimals() public view returns (uint8)
Returns the number of decimals the token uses.
function totalSupply() public view returns (uint256)
Returns the total token supply.
function balanceOf(address _owner) public view returns (uint256 balance)
Returns the amount of tokens an address has.
function transfer(address _to, uint256 _value) public returns (bool success)
Transfers _value amount of tokens to address _to.
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)
Transfers _value amount of tokens from address _from to address _to.
function approve(address _spender, uint256 _value) public returns (bool success)
Allows _spender to withdraw from your account multiple times, up to the _value amount.
function allowance(address _owner, address _spender) public view returns (uint256 remaining)
Returns the amount which _spender is still allowed to withdraw from _owner.
2 Likes
  1. Using a standard like ERC20 is beneficial because it means everybody is using the same rule set and functions etc.
  2. totalSupply() Tells you how many tokens of the smart contract that are currently in circulation.
    balanceOf(address account) Gives balance of tokens at that address
    transfer(address, amount) A function to transfer tokens from one address to another.
1 Like
  • What are the benefits of setting a token standard like ERC20?
    Every tokens can be used using a standard way. Code is the same for alle tokens. It’s also easy for exchanges and wallets to add these tokens.

  • What functions are in the ERC20 Token Standard Interface and what do they do?
    balanceOf , totalSupply , transfer , transferFrom , approve , and allowance

1 Like

The benefits of setting a token standard like ERC20 is so that there is a norm to build off of. Some of the functions that are in ERC20 are
-totalSupply( ) provide information about the total token supply
-balanceOf( ) provide account balance of the owner’s account
-transfer( ) execute transfer of a specified number of tokens to a specified address
-transferFrom( ) execute transfer of a specified number of tokens from a specified address
-approve( ) allow a spender to withdraw a set number of tokens from a specified account
-allowance( ) return a set number of tokens from a spender to the owner

1 Like
  1. The whole ERC20 comunity is able to interoperate and using the set standard makes it easy to incorporate tokens into wallets and exchanges.

  2. Totalsupply-max# of tokens
    balanceof-gives balance of erc20 tokens
    transfer-allows you to send tokens to another address

1 Like
  1. Exchanges, wallets etc can easily communicate with the smart contracts using the ERC20 standard
  2. balanceOf() - returns the balance of a smart contract, totalSupply () - returns the total supply of a token
1 Like
  • All the tokens would be programmed the same way, therefore different wallets can communicate with each other easily.
  • Balance, transfer, increasing supply, decreasing supply
1 Like

1: Setting a standard, such as the ERC20 standard, allows for all ERC20 tokens to to communicate with wallets, nodes and exchanges in a universally understood manner,

2: totalSupply denotes the total supply of tokens. balanceOf gives the token balance of the token holder.

1 Like
  1. It means that everyone can communicate with each other using the same language. If there were no standards everyone would program and communicate in their own way.
  2. totalSupply(x): information about how many tokens are in circulation. balanceOf(adress account): information about how many tokens that balance has. transfer(x): transfer tokens to an adress
1 Like
  1. Setting a standard like ERC20 makes the projects have the same naming conventions for the functions
  2. There are, for example, these functions:
  • balanceOf() provides the number of token of an address
  • transfer() transfers token from one address to another
1 Like
  1. It is easier for wallets, exchanges etc. to have one standard token instead of each token having their own code.

  2. BalanceOf(), which gives back the balance in an adress. Transfer(), makes a transaction from adress A to adress B. Allowance(), this one decides how many tokens that are allowed to be sent. And more…

1 Like
  1. Developers across all platforms and langugages can develop easier since the commands look the same. Higher productivity overall. Mutual agreements via interoperability.

ERC20 Functions:
function totalSupply() constant returns (uint theTotalSupply);
function balanceOf(address _owner) constant returns (uint balance);
function transfer(address _to, uint _value) returns (bool success);
function transferFrom(address _from, address _to, uint _value) returns (bool success);
function approve(address _spender, uint _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint remaining);
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);

1 Like
  1. This allows wallets and exchanges to support all tokens using this standard.
  2. Check total supply, balance, allowance
1 Like
  1. It makes it easier to program token contracts and gives the network less friction.
  2. total supply() which sets the total number of tokens, account balance() which gives an address set number of tokens, transfer() which sends the tokens to an account.
1 Like
  1. the benefit of the standard ERC20 is that all token built on eth work with this ERC20 and therfor are compatable with each other. because all other crypto built on eth uses ERC20 there is very limited friction and higher efficiency
  2. ERC20 tokens come with function to check account balanceOf(), TotalSupply() and make Allowance() in order to transfers() to other accounts under all kind of conditions once Approve().
    when approved the funs are TransferFrom() the smart contract to the designated account.
1 Like
  1. The benefit is that it makes all tokens on the network have the same basic functionality
  2. BalanceOf() gives the balance
    Transfer() sends eth between addresses
    Allowance() shows the amount of tokens able to be sent
2 Likes