Homework: ERC20

Homework on ERC20 token standard.

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

It enables communication between tokens and wallets by setting standards.

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

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, not used in paying for functions within the smart contract. To pay for these functions we have to use approve() to allow SC use tokens defined as “allowance” and when any function is called SC is using transferFrom() to take tokens from allowance as a payment.

The allowance() is providing info about how many tokens are in the allowance.

6 Likes
  1. One of the major benefits of setting a token standard is it increases the interoperability of these tokens because they share the same syntax meaning there is no resistance when integrating them to currently established systems like wallets and exchanges. It also allows programmers from different projects to more easily read each other’s code which makes further development easier. It should also make it easier for new developers to transition into the space and create smart contracts because many of these standards will apply to most tokens meaning there isn’t a steep learning curve to enter.

  2. The core functions outlined by the article in the ERC20 Token Standard Interface are balanceOf(), transfer(), approve(), transferFrom(), and allowance().

  • The function balanceOf() will return the number of tokens in a given address.

  • The function transfer() will transfer a specified number of tokens from one address to another.

  • The function approve() gives another address approval to transfer a certain amount of funds from the given address. This is usually how smart contracts are give permission to take the necessary funds needed to perform requested operations .

  • The function allowance() is the maximum amount that’s allowed to be transferred by another address via the approve() function.

  • And transferFrom() is the function that is actually invoked to perform the transferring of funds by another address.

11 Likes
  1. Standard ERC20 tokens enables wallets and exchanges to easily implement a new token, built on a standard that is common knowledge and true for all ERC20 tokens.

function totalSupply() = Get the total token supply
function balanceOf() = Get the account balance of another account with address owner
function allowance() = Send value amount of tokens to address to
function transfer() = Send value amount of tokens from address from to address to
function approve() = Allow spender to withdraw from your account, multiple times, up to the value amount. If this function is called again it overwrites the current allowance with value
function transferFrom() = Returns the amount which spender is still allowed to withdraw from owner

2 Likes
  1. All participants in the ecosystem will be able to speak the same language.

The specific wording of the function is followed by a clarification of what it does, in square brackets.

  • totalSupply() public view returns (uint256 totalSupply) [Get the total token supply]
  • balanceOf(address _owner) public view returns (uint256 balance) [Get the account balance of another account with address _owner ]
  • transfer(address _to, uint256 _value) public returns (bool success) [Send _value amount of tokens to address _to ]
  • transferFrom(address _from, address _to, uint256 _value) public returns (bool success) [Send _value amount of tokens from address _from to address _to ]
  • approve(address _spender, uint256 _value) public returns (bool success) [Allow _spender to withdraw from your account, multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value ]
  • allowance(address _owner, address _spender) public view returns (uint256 remaining) [Returns the amount which _spender is still allowed to withdraw from _owner ]

Events format:

  • Transfer(address indexed _from, address indexed _to, uint256 _value) . [Triggered when tokens are transferred.]
  • Approval(address indexed _owner, address indexed _spender, uint256 _value) [Triggered whenever approve(address _spender, uint256 _value) is called.]

(SOURCE: https://en.wikipedia.org/wiki/ERC-20)

3 Likes
  1. What are the benefits of setting a token standard like ERC20?
    ERC20 Standardisation creates commonality of design and interaction which in turn leads to efficiency and predictability and greater adoption within the industry.

  2. What functions are in the ERC20 Token Standard Interface and what do they do? The key standardised functions in an ERC20 token are: Contract Address, Total Supply of tokens, the name, symbol & number of decimal places. In addition the standard protocol allows for transfer of tokens by way of transfer(), approve() & transferfrom().

2 Likes
  1. Token standards allow applications and exchanges to be completable with all tokens using a particular standard.

balanceOf - “This function allows a smart contract to store and return the balance of the provided address”
totalSupply - “this function allows an instance of the contract to calculate and return the total amount of the token that exists in circulation.”
transfer - “This function lets the owner of the contract send a given amount of the token to another address just like a conventional cryptocurrency transaction.”
transferFrom - “This function allows a smart contract to automate the transfer process and send a given amount of the token on behalf of the owner.”
approve - " When calling this function, the owner of the contract authorizes, or approves , the given address to withdraw instances of the token from the owner’s address."
(Source: https://medium.com/blockchannel/the-anatomy-of-erc20-c9e5c5ff1d02)
allowance - " Returns the amount which _spender is still allowed to withdraw from _owner"
(Source: https://en.wikipedia.org/wiki/ERC-20#Technical_standard )

2 Likes
  1. Token standards allow all wallets and exchanges which are set up to support a token standard to accept all tokens which respect the token standard
  2. totalSupply function returns total supply of token
    balanceOf function returns token balance of wallet address
    transfer function transfers tokens from token owner account to account
    allowance function returns the amount of tokens approved by the owner that can be
    transferred to the spender’s account
    approve function allows the token owner to approve for spender to transferFrom tokens
    from the token owner’s account
    transferFrom transfers tokens from account to account
1 Like

1- One update on Etherium is reflected to all tockens, tockens and understand each others
2- allow users to find out the balances of accounts as well as to transfer them from one account to another under varying conditions

1 Like
  1. It will be supported by all the wallets and exchanges, because they function in the same way.
  2. totalSupply() gives you how many tokens in circulation
    balance0f(adrress) you get the balance of wallet you want to check
    allowance() function shows how many tokens can be send from given address by another given address
2 Likes
  1. The ease of compatibility and interoperatibility between diferent smart contratcs
  2. balanceOf() provides the number of tokens held by a given address.
    transfer() transfer tokes from the message sender to another address
    approve() gives another address aproval to transfer up to a certain number of tokens.
    transferFrom() tranfer token from a given address that previous had given approval for that
3 Likes
  1. Many applications can be built that can communicate easily with each other. One wallet can accommodate different applications. Efficiency can be attained in a frictionless environment because all contracts are stuctured in one standard way.

  2. totalsupply function shows the amount of tokens in circulation
    balanceof shows the balance of a particular address
    transfer shows what has been transferred and where

1 Like
  1. Big benefit for all crypto space is standard ERC20 tokens witch use the same programming language
    and functions, because it easy to communicate between.
    2 TotalSupply() gives maximum number of tokens that exist
    balanceOf() gives a public addresses balance of ERC 20 tokens
    transfer () allows someone to transfer their ERC20 tokens to another public address
1 Like

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

dApps can easily communicate with the ETH ecosystem and everything that interacts with it.

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

[Not functions, but these are helpful to know. Functions below]
Name: name of the token
Symbol: akin to stock ticker symbol
Decimals: how divisible a token can be. Defines how balances are displayed.
Totalsupply: the sum of all balances

Functions
balanceOf(): # of tokens @ an address
transfer(): move tokens from one address to another
approve(): approval to transfer tokens
allowance(): # allowed to be transferred to another address

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    -> Different applications can be built on one standard, which ensure that all parts / constituents of the network are able to communicate and interact.
  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    -> totalSupply() - Get the total token supply
    -> `balanceOf() - Get the account balance of another account
    -> transfer() - transfers a number of tokens directly from the message sender to another address
    -> approve() - approval to transfer up to a certain number of tokens
    -> transferFrom() - Send value amount of tokens from address to another address
    -> allowance() - provides the number of tokens allowed to be transferred from a given address by another given address
1 Like
  1. One of the benefits of setting a token standard include interoperability between wallets and applications for all tokens that abide by the standard. The advantage of the interoperability include less confusion and more speed in developing programs that deal with these tokens.
  2. a) balanceOf() is a function that gets the balance of the number of tokens on an address.
    b) transfer() is a function to transfer tokens from one address to another.
    c) totalSupply() is a function that notes the total supply of the tokens.
1 Like
  1. Thal all wallets and exchanges will support the token
  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, not used in paying for functions within the smart contract.
    To pay for these functions we have to use approve() to allow SC use tokens defined as “allowance” and when any function is called SC is using transferFrom() to take tokens from allowance as a payment.
    The allowance() is providing info about how many tokens are in the allowance.
1 Like
  1. What are the benefits of setting a token standard like ERC20?
    ERC20 is one of the most important standards for Ethereum: It defines how we call all program tokens. It’s good that all developers program in the same way. It means that all exchanges and wallets will support these tokes from day 1, it’s beneficial for the entire space.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    balanceOf() - gives the number of tokens held by someone.
    transfer() - moves funds from one address to another
    aprove() and transferFrom() are 2 functions that work together in case that the tokens to be transfered are being used as payment in a smart contract
    The items in the token contract are:
    name - is the name of the token contract is the long name by which the token contract should be known
    symbol - is the symbol by which the token contract should be known
    decimals - because Ethereum does no support support decimals. If the token contract represent an indivisible entity then decimals should be 0.
    totalsupply - is the sum of all balances

1 Like

Can interact with other contracts, wallets and exchanges and its becomes easier for programmers to work if everything has a standard to follow.

totalSupply - total token supply.
balanceOf - account balance of another account.
transfer- transfers a number of tokens directly from the message sender to another.
approve - allows spenders to withdraw from your account multiple times.
transferFrom - transfers value amount of tokens from address to address.
allowance - returns the amount which spender is still allowed to withdraw from.

1 Like

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

Having a standard (ERC20) all tokens speak the same language this helps programmers to understand and provide improvements, as well as exchange and wallets can support the token from day 1.

2-What functions are in the standard interface of the ERC20 token and what do they do?

For ERC20 tokens we have many functions among which we can mention:

  • Transfer () this function is used when sending tokens from one address to another.
  • Allowance () this function gives us the number of tokens allowed to be transferred from one address to another address.
1 Like
  1. each wallet can support erc20 tokens from the beginning of supply. there are defined several standard functionalities, which would be supportet from each token and each wallet
  2. balaceOf() returns balance of a specific axxount
    totalSupply() returns the number of tokens which exists
    transfer() transfers a number ob tokens from A to B
1 Like