Homework: ERC20

Homework on ERC20 token standard.

  1. What are the benefits of setting a token standard like ERC20?
    By setting ERC20 as a standard allows communication in the same language so all tokens are compatible and can be used by all wallets and exchanges

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    balance Of(): queries the account balance of an address for a specific ERC20 token
    transfer(): allows users to transact with each by transferring tokens from the message sender to the address
    approve() and transfer From(): are used to transfer funds using a smart contract
    -approve(): a token holder gives another address(usually a smart contract) approval to access a certain number of tokens (an allowance)
    -transfer From(): the token holder calls this function to have the smart contract take the allowance from his account if the allowance is available
    allowance(): sets the total number of tokens that can be taken
    total Supply(): total number of tokens that exist
    decimals(): how many decimal points the token should be accounted
    name(): what the token is called
    symbol(): sets the ticker sign

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

Having standards makes it easier for tokens to communicate with exchanges, wallets, and communicate with the entire ecosystem.

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

totalsupply() - the total number of supply of that particular token.

balanceof(): the number of tokens held by the address.

transfer(): to transfer tokens.

approve(): a token holder gives another address approval to transfer up to a certain number of tokens.

allowance(): provides the number of tokens allowed to be transferred from address A to address B.

1 Like
  1. Some benefits will be to improve interoperability, remove friction during implementation, allow for easier integration.
  2. The functions in ERC20 Token Standard Interface are as follows:
  • name() returns the name of the token
  • symbol() returns the symbol of the token (e.g. ETH)
  • decimals() returns the number of decimals the token uses
  • totalSupply() returns the total token supply
  • balanceOf(_owner) returns the balance of an account with address _owner
  • transfer(_to, _value) xfers an amount _value to address _to
  • transferFrom(_from, _to, value) xfers number of tokens from one address to another
  • approve(_spender, _value) allows _spender to withdraw from your account multiple times up to _value amount
1 Like
  1. Having a standard allow everyone to easily write and under the coding in every contract

2 . Functions allow users to find out the balances of accounts as well as to transfer from one account to another under

  1. What are the benefits of setting a token standard like ERC20?
    With standards, you can achieve better efficiencies. Agreeing on a standard like ERC20 opens better interaction with wallets or exchanges.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    total supply- how many toke
    total supply- how many tokens will be there
    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.
    token holder uses approve() to provide this information.

  • doSomething () instruction for depployment of contract
1 Like
  1. What are the benefits of setting a token standard like ERC20?
    Exchanges and Wallets that support the ERC20 standard, will be able to support a token from day 1. Also your code will be easily understood and read.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    There are a lot of functions supported by the ERC20 standard. Some of the functions are:

  • balanceOf - which returns the balance of a certain address
  • totalSupply - which returns the total number of tokens in circulation
  • transfer - which transfers tokens from one address to another
  • approve - which allows another address to withdraw tokens of that type from your address
1 Like

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

Indeed, those are some of the functions, but what about the others? could you please describe them a little bit?

If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

from : franzmoro

  1. All wallets can talk to all tokens adopting this standard in the same way. This massively decreases the development effort needed for the players in the ecosystem to communicate with each other, compared to everybody having their own different “standards”.
  2. The methods of the ERC20 standard are:
  • required:
    • totalSupply : Output: total amount of tokens
    • balanceOf : Inputs: address, owner | Output: account balance
    • transfer : Inputs: recipient’s address, transaction value | Output: transaction success/failure status. The method transfers funds.
    • transferFrom : Inputs: to+from addresses, transaction amount | Output: success/failure status. Used for withdrawals, such that a smart contract can move funds on your behalf.
    • approve : Inputs: spender’s address, value | Output: success/failure status. Allows the spender to withdraw from your account multiple times up to the value (input).
    • allowance : Inputs: owner address, spender address | Output: how much the spender is still allowed to withdraw from owner.
  • Optional:
    • name : returns the name of the token
    • symbol : returns the token’s symbol
    • decimals : returns how many decimals are used by the token

Uniformity is time saving :slight_smile: it lets more for creativity on duty

1 Like

The code is laid out in the same way all exchanges & wallets can support it from day dot. Everything operates fluidly because the language is the same.

    1. What functions are in the ERC20 Token Standard Interface and what do they do?
      Functions :
      total supply - shows how many tokens are in circulating supply
      balance Of (address account ) used by wallets and exchanges to ensure sufficient funds for transaction is available
      transfer (address account ) allows wallet to transfer to another public address
      transfers from inputs both a to & from wallet address
      allowance inputs receiver & sender addresses outputs how much the sender can withdraw /send
1 Like

He only went over a couple in this lecture simply to describe the protocol standard.
TotalSupply, Balance Of, and Transfer were the ones touched upon in the leasson

  1. What are the benefits of setting a token standard like ERC20?
    Unique interaction with each token and such tokens can be used in wallets and exchanges right out of box

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    name() - returns name of the token
    symbol() - returns symbol name
    decimals() - Returns the number of decimals the token uses
    totalSupply() - Returns the total token supply
    balanceOf() - Returns the account balance of another account
    transfer() - Transfers x amount of tokens to address aaa, and MUST fire the Transfer event
    transferFrom() - Transfers x amount of tokens from address a to address b
    approve() - Allows _spender to withdraw from your account multiple times
    allowance() - Returns the amount which _spender is still allowed to withdraw from _owner

1 Like
  1. All tokens abide by the same coding rules, which makes things work much easier.

  2. TotalSupply() gives maximum number of tokens to be in existance
    balanceOf(adress account) gives a public addresses’ balance of ERC20 tokens
    transfer() allows someone to transfer their ERC20 tokens to another public address

1 Like
  1. having stardards like ERC20 makes sure that all the smart contracts are understandable for the network and is easy to execute.

  2. totalsupply gives the total number of tokens in the turnover. Balanceof(account) gives the information how much tokens specific account has

1 Like
  1. it is important to have a standard like erc20 so all the developers are using the same diameters in there code so everyone can read and understand it.
  2. 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. approve and transferFrom are two functions that allow the above scenario to work using a two-step process. In 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 uses approve to provide this information. The allowance function provides the number of tokens allowed to be transferred from a given address by another given address.
1 Like
  1. Setting a token standard allows many people and company to build and interact with all tokens on that standard without customizing for each one.
  • balanceOf() - returns the number of tokens owned by an address
  • totalSupply() - returns the total number of tokens that exist for a contract
  • transfer() - moves tokens from one address to another
1 Like

It enables wallets and nodes to easily communicate with all erc tokens. It makes it easier to make new tokens as there is a standard template to follow.

total supply total number of tokens available
balance is the token balance for a specific account
transfer is for sending tokens to another account
approve approve the transfer of tokens
allowance sets the number of tokens to transfer

1 Like
  1. What are the benefits of setting a token standard like ERC20?
  • Interacts with other currencies
  • Used on compatible platforms, projects, exchanges.
  • Ensures operation with decentralized applications (Dapps)
  • Secure and easy transaction
  • Makes assets interchangeable
  1. What functions are in the ERC20 Token Standard Interface and what do they do?

ERC20 is a standard interface for tokens, meaning ERC20 tokens are simply a subset of Ethereum tokens. The ERC-20 Standard outlines a set of common rules that all tokens can follow on the Ethereum network to produce expected results. In order to be fully ERC20 compliant, a developer needs to incorporate a specific set of functions into their smart contract that at a high level will allow it to perform the following actions:

  1. get the total token supply
  2. get the account balance
  3. transfer the token
  4. approve spending the token
1 Like
  1. The benefits of a token standard like ERC20 are that wallets and exchange can manage a lot of tokens from a single token address.

  2. Functions in the ERC-20 Interface:

-balanceOf() : number of tokens held by a given address

-totalSupply() : total number of tokens that exist

-transfer() : send to tokens directly from sender’s address to another address

-approve() : give another address permission to transfer tokens

-allowance() : number of tokens allowed to be transferred from a given address by another given address

-transferFrom() : send tokens from a given address to another given address

1 Like
  1. Setting a token standar allows have same convections in all wallets to know about what we are talking. It means , that on platform is possible interoperate, integrate between apps and increase the efficeny.

  2. function totalSupply() public constant returns (uint);
    function balanceOf(address tokenOwner) public constant returns (uint balance);
    function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
    function transfer(address to, uint tokens) public returns (bool success);
    function approve(address spender, uint tokens) public returns (bool success);
    function transferFrom(address from, address to, uint tokens) public returns (bool success)

1 Like

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

  • balanceOf() : provides the number of tokens held by a given address.

  • transfer() : transfers a number of tokens directly from the message sender to another address.

  • transferFrom() : transfers a number of tokens directly from an account to another address. Used with approve() function.

  • approve() : approval to transfer up to a certain number of tokens, known as an allowance.

  • allowance() : provides the number of tokens allowed to be transferred from a given address by another given address.

Hope this gives you a clear view of the subject, keep learning! :slight_smile:

If you have any doubt, please let us know so we can help you!

Carlos Z.