Homework: ERC20

  1. A standard allows the tokens to be programmed in the same way. As a result, wallets can communicate easily.

totalSupply - the total possible amount of tokens
balanceOf - number of tokens held by the given address
transfer - transfer a number of tokens to another address
approve - authorize the transfer of a number of tokens
transferFrom - invoked to perform the transferring of funds
allowance - output the amount of total possible tokens to transfer

1 Like
  1. What are the benefits of setting a token standard like ERC20? - It puts everyone on the same page so that each token would be able to operate on different platforms, wallets, etc…

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    " * totalSupply() - Total supply of the token

  • balanceOf() - Takes the address of the owner as input and gives the balance of the users as output
  • allowance() function - Takes in the address of the tokenOwner and the spender then gives as output,
  • transfer() function - Takes in the address of the receiver and the funds which are to be sent to the account
  • approve() function - Approve someone to spend from your account.
  • transferFrom() function - 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. Can build applications that can talk to each other. Increases efficiency, reduces friction.
  2. totalSupply - sets the total supply, balanceOf - gets the balance of a specific account, transfer - transfer funds between accounts
1 Like

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

ERC20 provides a uniform language that all wallets, exchanges and platforms can use. Additionally, programmers can easily read each others code, which facilitates development. It also makes it easier for new developers to get started creating smart contracts.

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

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

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    The benefits of standards is the ability to communicate in the same way and more efficiently. It makes all the tokens easily supported by all wallets and exchanges.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    function (total Supply); function balance Of(address). They set a standard. The total supply will always calculate the total supply of tokens in circulation. Balance Of gets balance of tokens in account. Transfer allows transfer of ERC20 tokens.

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    If everybody would use their own functions it would be very deifficult to comunicate beetwen the wallets, so usinf the standard functions makes more easily writing and understanding the smart contract among community. With standard exchanges can support the tokens easily.
  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    ERC-20 token contracts come with a number of functions to allow users to find out the balances of accounts as well as to transfer them from one account to another under varying conditions. These functions are described below.

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.

Once an allowance has been created the smart contract can take up to the allowed number of tokens from a user’s allowance as part of the contract’s operation. Continuing the example, Joe can now call doSomething() and doSomething() can use transferFrom() to take 10 Do tokens from Joe’s account and carry on its work. If Joe doesn’t have 10 tokens in their account, or their allowance is less than 10 tokens, doSomething() will fail.

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…3ab70x2299…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. What are the benefits of setting a token standard like ERC20?

Standards take away friction inside an economy. Thanks to the standardized structure of common use cases everybody speaks “the same language”.

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

totalSupply() - returns the total supply of tokens a contract can access
balanceOf() - returns the balance of tokens for a given address
transfer() - used to transfer tokens directly from sender to recipient, also returns bool success
approve() - used to give approval to an address to transfer tokens up to a max amount
transferFrom() - used to take the needed amount of tokens from the approved amount of tokens and continues with the code. Also reports if transaction was successful (returns bool)
allowance() - returns the amount of tokens cleared by the tokenOwner to be transacted to a given adress
doSomething() - used to execute operations

1 Like
  1. Tokens that conform to the ERC20 standard can be easily integrated in the entire Ethereum platform ecosystem with minimal effort.

  2. The functions mentioned in the lecture are totalSupply(), which returns total supply of a token in the market and balanceOf(address account), which returns a balance for a given address.

1 Like
  1. The benefits of having a token standard like ERC20 is that they have common features and interfaces, and work well with all wallets and exchanges.

  2. ERC20 functions:
    balanceOf() - Number of tokens held by a given address
    transfer() - Transfer a number of tokens to another address
    approve() - Give approval to another address to transfer of a number of tokens
    transferFrom() - Performs the actual transfer of funds
    allowance() - Provides the number of tokens allowed to be transferred from one address to another
    totalSupply() - The sum of all balances

1 Like

The benefits of setting a token standard like ERC20 are to reach efficiency and reduce friction.

Functions in the ERC20 Token Standard Interface execute programmable code such as basic math operations.

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

Setting a standard like ERC20 enables developers to build on the ETH protocol, thus incorporating hard coded functions already built in ETH to communicate with the network. (Interoperability)

  1. What functions are in the ERC20 Token Standard Interface and what do they do?
  • totalSupply() equals the sum of all balances
  • balanceOf: provides the number of tokens held by a given address.
  • allowance(): provides the number of tokens allowed to be transferred from a given address by another given address.
2 Likes
  1. Having standards allows wallet and exchanges to easily add all ERC20 tokens as they are common in code

  2. balanceOf() - gives balance of a specific account, total supply and the number of fungible tokens

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    Makes communication easier and standardized for all included parties, such as exchange sites, wallets etc.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    You think I can remember that just from one really quick video lecture!? I can’t, but I’ll go back, check it and write it down in my notes

1 Like
  1. The ERC20 standards creates efficiency between wallets making it easy to show balances between different tokens

  2. It is able to give the available balance of fungible tokens

1 Like
  1. The benefits of setting a standard while using a smart contract is so we can communicate using the same language for all users.

  2. The functions in ERC20:
    totalsupply-# of total fungible tokens
    balanceOf()- notes balance(tokens remaining) of a specific acct
    transfer()-transfers tokens from senders to another address
    allowance()-indicates how many tokens are allowed to be transferred

1 Like

[quote=“filip, post:1, topic:8440”]

  • What are the benefits of setting a token standard like ERC20?
    it. helps anyone to. create a token and easily be. listen on wallets and. exchange since they have the same underlying code standard

  • What functions are in the ERC20 Token Standard Interface and what do they do?
    they have the function of determine total supply, transfer value, balance that can be integrated in apps that wanna read balance of token in contract

1 Like
  1. Having a standard like ERC 20 allows wallets and exchanges to communicate with all ERC 20 tokens in a known and expected way.
  2. The functions on the ERC 20 token standard are as follows:
  1. totalsupply()- amount of tokens in circulation
  2. balanceOf ()- provides the number of tokens on a given adress.
  3. transfer ()- transfers a given number ot tokens from the sender to another adress.
  4. approve()- allows spender to withdraw from ones account
  5. allowance()- function provides the number of tokens allowed to be transferred from a given address by another given address.
1 Like
  1. The benefits of using a token standard is that all tokens speak the same language, thus they easily communicate.
  2. The functions are:
  • balanceOf(), provides the number of tokens a specific address has
  • transfer(), transfers tokes from an address to a different address
  • approve(), approves a transfer
  • transferFrom(), transfers from an address
  • allowance(), provides the numbers of tokens allowed to be transfered
1 Like
  1. Anyone creating a sub community on the Ethereum blockchain will have their applications possess ease of communications as they will be talking in the same language when they want to create or command for the same purpose or idea. In this manner, wallets exchanges and contracts can interact with each other.

  2. Finding how much a user currently possesses is through balanceOf( ). Sending a token from one address to another is transfer( ). Other functions are also possible.

1 Like
  1. Wallets & exchanges are able to support all the tokens thanks to the standard way of programming.
  2. balanceOf() - number of tokens of a specific address
    transfer() - transfers tokens from one address to another
    approve() - approves a transfer
    transferFrom() - transfer tokens from an address
    allowance() - provides the number of tokens allowed to be transferred from one address by another address
1 Like