Homework: ERC20

Homework on ERC20 token standard.

  1. What are the benefits of setting a token standard like ERC20?
  2. What functions are in the ERC20 Token Standard Interface and what do they do?

If you need help with the last question, you can read more about the functions here: https://medium.com/@jgm.orinoco/understanding-erc-20-token-contracts-a809a7310aa5

image

1 Like
  1. Having standards allows wallets, exchanges etc to easily add all ERC 20 tokens as they have common naming in their code.

  2. balanceOf() Gives balance of a specific account, totalsupply the number total fungible tokens.

1 Like

1. What are the benefits of setting a token standard like ERC20?
Having a standard like ERC20 allows wallets and exchanges to be programmed to support any token using that standard. This is much simpler and scalable than each token having its own personalized code.

2. What functions are in the ERC20 Token Standard Interface and what do they do?
totalSupply() gives maximum number of tokens that exist
balanceOf(address account) gives a public addresses’ balance of ERC20 tokens
transfer() allows someone to transfer their ERC20 tokens to another public address

1 Like
  1. Standards ensure all apps are interoperable and brings consistency to community by increasing efficiency.
  2. totalsupply, balanceOf(account), transfer, approve are few functions which are part of erc 20. Totalsupply gives number of tokens, balanceOf gives available token balance for an account, transfer is used to send to other account whereas approve allows user to approve the transfer to a function.
1 Like
  1. The benefit is that all tokens based on the same standards will be able to communicate in a known and expected way, meaning interoperability between the tokens is possible.

  2. totalSupply returns a uint of the total supply of that token
    balanceOf - given an address it returns their account balanceOf
    transfer - transfers an amount to a specified address from the owner of the contract (return bool success)
    transferFrom - specifies a from address, to address and a value to transfer (return bool success)
    approve - When called the owner of the contract authorises the address to withdraw tokens from the owners address
    allowance - returns the amount remaining (I think)

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

    Efficiency. Making the different tokens exchange easily, allowing wallets to provide token balances for different tokens.

  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. But it doesn’t work well when tokens are being used to pay for a function in a smart contract.

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

    transferFrom(): take certain tokes from sender’s account and carry on its work.

    doSomething(): to operate instructions.

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

1 Like
  1. Setting the ERC20 standard for token design, it alows inter-operability and efficiency in interacting with the smart contract. Because of this, deplyment of wallets and creation of new tokens become easier.

  2. totalSupply(): gives maximum number of tokens that exist
    balanceOf(address): gives a public addresses’ balance of ERC20 tokens
    transfer(): allows transfer of their ERC20 tokens to another public address
    doSomething(): operates instructions.
    allowance(): provides the number of tokens allowed to be transferred from a given address by another.

1 Like
  1. The benefits of setting a token standard like ERC20 is that it increases efficiency and allows tokens to operate on platforms and wallets seamlessly.

  2. The functions that are in the ERC20 are:

  • totalSupply() which gives a number as an output. This number is the total supply of the token
  • balanceOf() which takes the address of an owner as the input and gives the balance of the users as output
  • allowance() function takes in the address of the tokenOwner and the spender and gives as output, the number of tokens allowed to be transferred from a given address by another given address.
  • transfer() function simply takes in the address of the receiver and the funds which are to be sent to the account
  • approve() function. You can approve someone to spend from your account.
  • transferFrom() function. It takes in three inputs — the address of the sender, the address of the receiver, as well as the number of tokens to be transferred. And gives an output of the success or failure of the transfer.
1 Like
  1. Benefits of having a standard like ERC 20 are: Increase of efficiency- all wallets, exchanges, platforms can add the token very easily. Also it is easy to read. Programmers don´t have to learn/program every token from scratch, with a standard you just have to change a few lines.

  • balanceOf() --> gives back the balance of a specific address
  • transfer() --> transfer tokens from the sender address to another address
  • allowance() --> shows how many tokens are allowed to be transfered
  • doSomething() --> instruction
  • approve() --> part of a 2step transfer: authorizes to transfer an amount of tokes to another
    given address