Homework: ERC20

Having standard codes allows wallets, exchange, nodes to speak and operate compatibly.

balanceOf - shows account balanve
totalSupply - supply of tokens

3 Likes
  1. So everyone can be cross platform.
  2. There’s a bunch … get total supply, check balance, all that.

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

One beneift is that you can have the same code performing the same functions in all the tokens smart contracts so they are easily used across different platform like wallets, exchanges etc.

*** What functions are in the ERC20 Token Standard Interface and what do they do?**
Transfer funds, approve transfers, check account balances …

2 Likes

transfer designates number of tokens to be sent balanceOf details wallet balance. I dont know what totalsupply does.

1 Like
  1. It increases efficiency of operation for network players such as exchanges and wallets who can adhere to a simple base protocol of ie ERC20 standard as of day 1 of creation of a new token with no need to learn standard parameters for every different new token.
  2. to get information on certain parameters of a ERC20 token such as the accounts’ address, its balance, information regarding transfers, the total supply of the currency, etc.
  1. Using ERC20 standard defines how we program tokens on the etherium network. All ERC20 tokens have the same functions in the code, so they can communicate no matter what the application used.

balanceOf - balance of given address
totalSupply - Total number of tokens

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    To easily interoperate with each other and streamline the process. This way there is a more efficient platform to work on.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    totalsupply() - to set a total supply of tokens, the sum of all balances
    balanceOf() - retrieve account information such as account and balance.
    transferFrom() - gives approval for another address to transfer a certain number of tokens.
    approve() - the token uses this function to provide information to allow for the transfer of tokens.

1 Like

1- Increase of efficiency .It can be used by all wallets, exchanges, platforms 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.
2- Functions are :
totalSupply() The total supply of the token.

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.

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

  1. What are the benefits of setting a token standard like ERC20?
    That there are set functions and rules that the community must follow so that there’s minimum friction and interoperability with other tokens.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    totalSupply(): sets the total amount of tokens that can be minted.
    balanceOf(): retieves the balance of the address provided.
    mint()/burn(): creates/destroys tokens.
    transfer(): transfer tokens to a given address.

1 Like

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

Yes sir(s), but could you please describe what those functions do?

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

Carlos Z

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

Yes miss, but could you please describe what those functions do?

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

Carlos Z

The totalsupply function will return the amount of tokens that are currently on demand, or the total amount of tokens that exist in the market.

Carlos Z.

  1. The benefits or setting a token standard like ERC20 is that there will be consistency all around, allowing for interoperability and efficiency.
  2. The functions in the ERC20 Token Standard Interface include:
  • balanceOf() function provides the number of tokens held by a given address.
  • transfer() function transfers a number of tokens directly from the message sender to another address.
  • allowance() function provides the number of tokens allowed to be transferred from a given address by another given address.
  • tokenSupply() function provides the total supply of tokens available.
2 Likes
2 Likes

Hello Carlos,
Thanks for commenting :).
I don’t quite understand your point ? the functions do what it says: get an account’s address, check the amount of a balance, enquire about transfer information, check the total balance of a token’s supply -
or am I missing something?

  1. More efficient to handle different tokens and program
  2. copy & paste of the reference article:

The balanceOf() function provides the number of tokens held by a given address. Note that anyone can query any address’ balance, as all data on the blockchain is public.

There are two ways to send tokens from one address to another. The transfer() function transfers a number of tokens directly from the message sender to another address. Note that there are no checks made on the recipient address, so it is incumbent on the sender to ensure that the recipient is as intended.

Although transfer() is fine for sending tokens from one user to another it doesn’t work so well when tokens are being used to pay for a function in a smart contract. This is because at the time the smart contract runs it has no access to details of which addresses transferred funds where and so cannot assert that the user calling the contract has paid the required amount of funds to operate the contract.

Imagine that there is a contract Doer deployed on the network. Doer has a function doSomething() that requires 10 Do tokens to operate. Joe wants to call doSomething() and has 50 Do tokens in his account. How can Joe pay Doer so that it can run doSomething() successfully?

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. Note that anyone can query any address’ allowance, as all data on the blockchain is public. It is important to understand that allowances are “soft”, in that both individual and cumulative allowances can exceed an address’ balance. In the approval table shown above, for example, the holder 0x2299…3ab7 has approved a transfer of up to 500 tokens but their balance as seen previously is only 90 tokens. Any contract using allowance() must additionally consider the balance of the holder when calculating the number of tokens available to it.

1 Like
  1. The benefits of setting a token standard like ERC20 is that everything can easily integrate creating a more efficient environment with no friction and economies/interactions can perform better.

  2. Functions that are in the ERC20 Token Standard interface perform crucial roles that allow users to carry out a number of different uses. There are multiple functions for example;

total supply() to know the total supply of tokens in circulation,

balanceOf() provides the number of tokens held by an address,

transfer() how you send tokens,

approve()/ transferFrom() are used in a two step process,

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

2 Likes

totalsupply() = Gives the total number of tokens in circulation.

balanceOf() = Gives balance of a specific account

Hope this answers your question properly ? :slight_smile:

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    Answer: This refers to tokens on the Etherum platform. Tokens can be created by smart contracts. The ERC20 standard has been created to provide a guideline for how this is done. This enables exchanges and wallet providers to easily adopt new tokens without development effort
  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    Answer: There are (optional) functuons for names, symbols, decimals, and (mandatory) functions (methods) for TotalSupply, BalanceOf, tranfer, transferFrom, Approve, Allowance
1 Like
  1. makes common operations callable in the same way for all tokens

  2. balanceOf(address) get balance of given address. totalSupply() gets total circulating supply of token.