Homework: ERC20

  1. same naming conventions, same standards
  2. balanceOf = how many tokens that balance has
  1. Standards allow exchanges and wallets to support any of the ERC20 token and developers can have a common guidelines for creating tokens on the ETH platform.
  2. They standardize the programming of the following functions Total supply of tokens, Contract Addresses, shows balance and what was transferred and from were.
  1. The benefits of setting the ERC20 standard for tokens is that it allows easy integrations to exchanges and existing ethereum wallets and to add standardization to the creation of new tokens.

The functions that are in the ERC20 Standard Interface are:

  • allowance()
  • approve()
  • balanceOf()
  • totalSupply()
  • transfer()
  • transferFrom()

Excellent answer sir! really well documented! keep it like that please! :muscle:

Carlos Z.

1 Like

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

Correct! Can you briefly explain us what the other functions do?

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

Carlos Z.

Hi! Honestly I am new to all of this, but from what research I can find, here is my summary of the commands. Feel free to correct me if I am incorrect.

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

  • approve() You can approve spending from your account.

  • balanceOf() gives the balance of the users as output

  • totalSupply() The number of total supply for the token

  • transfer() transfer funds that are to be sent to an account

  • transferFrom() transfer from one address to another

2 Likes
  1. A token standard like ERC20 ensures that all tokens built using it behave in the same way and in particular, exchanges and other applications can easily support new ERC20 tokens because they already know how to deal with them.

  2. Functions in the ERC20 standard:

balanceOf - query the balance of any address, it is public on the blockchain and anyone can see the balance of any address

totalSupply - query the total number of tokens in existence.

transfer - transfer tokens from one address to another.

burn - remove tokens from the total supply, you could instead send them to a zero address which no one has access to but they would still show up in the total supply if this was done.

2 Likes
  1. What are the benefits of setting a token standard like ERC20?
    Create a standard ensure all tokens share the same format easy to communicate, such as wallet, exchange,etc
  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    totalSupply given maximum number of tokens that exist
    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
    allowance() provides the number of tokens allowed to be transferred from a given address by another given address
1 Like
  1. It allows interoperability. Exchanges and wallets can list new ERC20 tokens without taking care of the language they are programmed with, as they have all the same.
  2. totalSupply() : gives the total amount supply of a specific token
    balanceOf() : gives the balance of a specific account
    transfer(): to allow token transfer
1 Like
  1. What are the benefits of setting a token standard like ERC20?
    the benefit is that every token that is created, will be able to interact with the wallets etc.
  2. What functions are in the ERC20 Token Standard Interface and what do they do?
  • totalSupply - gives how many tokens are in circulation
  • balanceOf - gives the address of the account you want to get the balance of
  • transfer - for trasnferring
1 Like

1. What are the benefits of setting a token standard like ERC20?
The main benefit is that it creates an efficient and frictionless economy ecosistem where its possible to interact with different tokens and all are based on the same standard.

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

  • totalsupply() function provides the sum of all ballances
  • 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
  • doSomething() function to use for instructions
  • allowance() function provides the number of tokens allowed to be transferred from a given address by another given address.
  • approve() part of a 2step transfer: authorizes to transfer an amount of tokes to another
    given address
1 Like
  1. What are the benefits of setting a token standard like ERC20?

It’s much easier for developers, contracts and programs to interact if they use such a standard. For example, a new ERC20 token can immediately be handled by an Ethereum wallet.

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

This functions shows the total supply of an ERC-20 token (i.e. “Tell me how many of these tokens do exist in total in the world.”)

  • balanceOf(address tokenOwner)

Shows the balance of tokens in a specified account ( i.e. “Tell me how many tokens are in account X.”)

  • transfer(address to, uint tokens) public returns (bool success)

Directly sends a specified amount of tokens to a specified address (i.e. “Send X amount of tokens to address Y, then tell me if it worked.”)

  • approve(address spender, uint tokens) public returns (bool success);

Gives permission to a specified address (often a smart contracts) to use up to a specified amount of tokens from a specified address (i.e. “Address X is allowed to take Y amounts of tokens from address Z, which I control, then tell me if this worked.”)

  • allowance(address tokenOwner, address spender) public view returns (uint remaining)

Shows how many tokens are still available and allowed to be used in a specified account for another specified address (i.e. “Tell me how many tokens address X still owns AND has made available for address Z to use.”)

  • function transferFrom(address from, address to, uint tokens) public returns (bool success);

Is a more complex way of sending funds, specifying the sender and recipient addresses, the amount to be transferred and also queries a response about the success (i.e. “send X amount of tokens from address Y to address Z and tell me if it worked.”)

As far as I understand, this last function also checks for example if the entered recipient address is actually valid, and cancels the transaction if not - while the simpler function “transfer” does not check and might effectively destroy funds, if the recipient address was misspelled and does not exist, for example.

Correction: the transferFrom function only works if the involved sending address has legitimized the transfer of the funds beforehand, using the approve function. This creates additional security.

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

    Defines how we program these tokens on the Ethereum block chain utilizing a standard format.

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

    totalSupply()function- returns total number of tokens are circulating
    transfer()function - provides the ability of making transfers
    balanceOf()function- generates a balance of tokens within a certain address

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    all the infrastructure is there to support contracts, wallets, exchange listings, and web servers,

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

they manage basic token behavior: the supply of tokens, burn, token balance, how many decimal places.

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    A: Efficiency interoperability and reduced friction. Having a widely-used standard like ERC-20 makes it easier for a token to be listed on an exchange, to be compatible with an ERC-20 wallet like MEW, allows interaction with other smart contracts, etc.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    A: See below:
    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

Hi @Farid
Great answer :+1:
Regarding the transferFrom method it is mainly used to allow a third party to transfer your token (An other smart contract usually) to be able to transfert your token you have to give them the permission first with the approve method.
It could also be useful for someone else to pay for the gas fees to transfer token.
You will often find this call in Dex smart contract. You are approving the smart contract to move your funds, then you are placing an order on the decentralized exchange orderbook, when the order is fill the smart contract is able to swap the token without your interaction.

It is also a bit dangerous because some smart contract are setting a really high value during the approve call to avoid calling the approve method multiples times (and to limit the fees) but in this case the exchange is able to do whatever she wants with your tokens.

It’s not really the case (there is no check on the address validity) but by making it mandatory to approve the address first indeed the address will have to be valid .

2 Likes
  1. What are the benefits of setting a token standard like ERC20?
    Token standard allows more contracts and existing wallet and exchanges can support from the day one if they use the standard. It makes network efficient.

  2. What functions are in the ERC20 Token Standard Interface and what do they
    ERC 20 is used to know the balance and transfer coins.
    totalSupplzy() gives the Toal token supply
    balanceOf() gives back the balance of a specific address
    transfer() send tokens from the sender address to another address
    allowance() shows how many tokens are allowed to be transfered
    doSomething() --> instruction
    approve() when calling this instruction, the owner of the contract authorized to transfer tokens to another given address

1 Like
  1. Standards benefits are allowing all tokens to be easily supported in all other platforms. Example: exchanges, wallet and etc.
  2. Total supply of tokens:
    function totalSupply()
  1. Using a standard allows wallets, exchanges, explorers and other software to immediately use or add it.

  2. balanceOf(): shows the balance of any address
    transfer(): sends a number of tokens to another address
    approve(): gives a smart contract access over a certain amount of tokens to perform a function
    transferFrom(): is used by the above mentioned smart contract, that has access to a certain amount of tokens, to actually transfer funds.
    allowance(): is the number of tokens that is allowed to be sent in the above described transfer.

1 Like
  1. ERC20 token standard it is common set of features and interfaces that allows programmers to scale different tokens inside the platform without having different language standards. Besides that, also enable Wallets to provide any and combined token balances
  2. ERC20 Token Standard Important Functions are balanceOf(), transfer(), approve(), transferFrom(), and allowance().
  • a. balanceOf() provides the number of tokens in a given address.
  • b. transfer() transfer a specified number of tokens from one address to another.
  • c. approve() provides another layer of confirmation, by having another address approval to transfer a certain amount of funds from the given address.
  • d. allowance() works together with approve() function. It is the maximum amount that agreed to be transferred by another address via the approve() function.
  • e. transferFrom() is the function that is actually invoked to perform the transferring of funds by another address.
1 Like