Homework: ERC20

  1. The creation of a token standard allows for consistent interoperability between wallets, tokens, and dApps. The standardization of functions within the ERC-20 token code means that all developers writing code to interact with these tokens are using the same language (i.e. all using “totalSupply()” as opposed to some using “totalSupply” and some using “maxSupply” or “getTotalSupply”).

  2. According to the Ethereum development wiki, these are the functions an ERC-20 must implement:

  • totalSupply() determines the maximum number of this ERC-20 tokens that will exist
  • balanceOf() is used to query the amount of this ERC-20 token on any given Ethereum wallet address
  • allowance() dictates the amount of a token that the smart contract is allowed to transfer from one address (address owner) to another (address spender). This means the smart contract will never remove more than the designated amount from the wallet of the address owner
  • transfer(address recipient, uint256 amount) transfers the designated amount of tokens from the message sender to the designated address. No checks are made on the recipient address, so sender must ensure correct address.
    • For some reason the SC doesn’t have access to the senders address @ time of execution, so the need for the following two functions arises
  • approve() is the first part of a two-step process (incl. transferFrom() that allows a token holder to approve a certain number of tokens to be removed from their address (usually to be sent to a SC)
  • transferFrom() is used to send the approve() amount of tokens from a given address to another given address

Oh heck yeah, that was a lot of work but dang I know more about this ERC-20 business. I used these pages as reference:

2 Likes

Setting a standard like ERC20 increases the efficiency since all the programmers are using the same language and it can be interchanged very easily.

There is a lot of diff. Functions such as totalsupply, balanceOf(account), transfer, approve etc.

1 Like
  1. Makes all tokens, wallets, exchanges all work to the same standard instead of having different programs.
  2. BalanceOf - to check someones balance (used by exchanges)
    TotalSupply - to check the total amount of tokens in existence
2 Likes
  1. Having standards like the ERC20 token standard allows applications (like wallets and exchanges) to communicate with each other like show balances of different tokens or add these tokens to exchanges (given that the tokens follow the ERC20 standard) since the tokens use the same naming conventions and same parameter conventions.

  2. Examples of a function in the ERC20 token standards given in the lecture are:

balanceOf() - which gives the balance of the address of the account feed inside the parenthesis - this is actually a Getter Function (does not modify the state of the Smart Contract, from the links in @Hudson quote below)

totalSupply() - indicates how many tokens are in circulation

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

The benefit of having standards it’s that simplify the interaction between exchanges, wallets, applications and tokens. This impulse the growth of the ecosystem more faster and eficient.

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

There are differents types of functions in the ERC-20 token standar an some of them are the following:

  • totalsupply () It’s one of the primary functions that have to have a smart contract. This function show total amount of token available

  • thebalanceof() It’s allow to check the number of tokens that are held by one address

  • transfer() It allow to transfer “x” number of tokens from one address to another

  • allowance() provide the number of tokens that are allowed to be transfer from one account to another

  • approval() It send details of approvals of tokes to one account to another

  • approve() It approve the amount of tokens that will be sent to another address

  • transferform() it transfer an amount of tokens from one account to another and give the number of tokens that are allowed to be transfer

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

It’s easier to program, because you already have useful standard functions made for you, so you don’t need to make these functions all over again and because of that you also spend less time to develop your smart contract. Other benefit is that everybody works in the same way so it’s easier to communicate with each other if you need same help to solve a problem for instance. And because most of all wallets, applications, and exchanges kows the standard ERC20 your token will be recognized and easily integrated in these systems.

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

You have many functions but the following functions are used for everybody:

  • function total Supply() - This function gives you the total tokens that are in circulation;
  • function balanceOf(adress account) - This function gives you how many tokens that “adress account” as.
1 Like

1 - We can have many fungible tokens running on it

2 - Functions denote balances , total supply , balance etc for tokens and thus provide a platforms for all the exchanges and wallets to get the same info at a time

1 Like
  1. the main benefit is that anyone who creates a token have the same script (rules to follow) like the others and can be set up wallets , exchanges , lending , borrowing etc.
  2. Balance of() function - the amount of tokens held by a specific adress.
    transfer () function - transfer of tokens from the message sender to another adress.
    totalsupply() function - the sum of all balances
1 Like
  1. It make it easy for token to be launch on wallet and exchange and allow to the token to talk to each other easily.

  2. BalanceOf : it will get you the total number of token in the chosen address.
    totalSupply: Make your contract calculate the total supply of token in circulation and return it to your wallet.
    transfer: Send a token amount to a address.
    transferFrom: Send automatically fund to a address.
    approve: Give approval of a address to withdraw fund from your smart contract.
    allowance: it tells which address is given a certain amount of tokens to be used for sending money.

1 Like
  1. It gives a few rules as to how the tokens on top of Ethereum should be programmed which makes for an easier life for both the CPUs and the EVMs to translate, calculate and execute smart contracts and probably cheaper since different commands would take up more CPU power and thus would probably increase the fees too. An additional benefit is also for developers to understand the basic functions of different coins when they go through the code to see what each token is about and how it was programmed.

balanceof() it shows the balance of money or of tokens a specific address has.
transfer() sending money to one address to another
approve() giving approval to a certain address to take a number of funds from your address - the number of funds or tokens or money is determined in the function
transferfrom () the function the “certain address” needs to use in order to take the approved number of funds from the address that approved the “certain address” to take a predetermined by them number of funds from their address.
allowance() allows to determine the number of funds to be transferred from address A to B using the approve() and transferfrom() commands

1 Like
  1. Setting a token standard like ERC20 helps achieving efficiency. It provides an uniform way for creating and solving things, and allows easier integration and inter-operation.

  • balanceOf() function provides the number of tokens that a particular address has.
  • totalSupply() function provides the total number of tokens in circulation.
  • transfer() function transfers a quantity of tokens from the sender to another address.
  • allowance() function provides the quantity of tokens allowed for transfer from one address to another address.
  • approve() function provides approval given by the token holder to transfer allowed quantity of tokens.
  • transfersFrom() function provides the transfer of allowed quantity from a specified address.
1 Like
  1. What are the benefits of setting a token standard like ERC20?

It allows the tokens to use the same coding language meaning all wallets can recognise this means nothing has to be changed and will all round be a more fluid process.

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

The balance of 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.

The transfer function transfers a number of tokens directly from the message sender to another address.

In the first step a token holder gives another address (usually a smart contract) approved to transfer up to a certain number of tokens, know as an allowance. The token holder uses approve to provide information.

The allowance function provides the number of tokens to be transferred from a given address by another given address.

1 Like
  1. Having a standard like ERC20 brings consistency and standardization to the community and ensures that all applications are interoperable.

balanceOf(address account) gives a public address’ ERC20 tokens balance
totalSupply() gives the maximum number of tokens that exists
transfer() allows ERC20 tokens to transfer from one public account to another

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

Standards allow wallets and exchanges to easily be programmed to support any ERC20 token.

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

1)TotalSupply, gives maximum number of tokens that exist
2)balanceOf(address account), gives a public addresses’ balance of ERC20 tokens
3)transfer, allows someone to transfer their ERC20 tokens to another public address

1 Like
  1. A standard token give ease of creating the tokens, and making all the tokens under the same standard (ERC20) interoperable within its network (Ethereum). All the tokens under the standard applies to the same rules.

  2. a) balanceOf() provides the number of tokens held by the given address
    b) transfer() transfers a number of token directly from the sender to another address
    c) totalSupply() provides the total number of tokens that exists

1 Like
  1. Main benefit is that all tokens on this standard can communicate with each other.
  2. Function totalSupply() shows total amont of tokens generally
    Function balanceOf(adress) shows amont of tokens on specific adress
1 Like

IF all tokens are using the same standards they are able to make full use of all other programs on the network, they are easily understood by everyone and have interoperability with all other wallets exchanges and other infrastructre built on the eth network…

What functions in ERC20 -
balanceOf( )
totalSupply()
transfer()
transferFrom()
approve ()
allowance()

totalSupply() = Get the total token supply
balanceOf() = Get the account balance of another account with address owner
allowance() = Send value amount of tokens to address to
transfer() = Send value amount of tokens from address from to address to
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
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?**

ERC-20 standardizes the core functionality of each token, meaning that all tokens created using this framework are interoperable with each other as well as all ERC-20 compatible services like MyEtherWallet and MetaMask.

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

ERC20 contains several functions that a compliant token must be able to implement.

  • TotalSupply: provides information about the total token supply
  • BalanceOf: provides account balance of the owner’s account
  • Transfer: executes transfers of a specified number of tokens to a specified address
  • TransferFrom: executes transfers of a specified number of tokens from a specified address
  • Approve: allow a spender to withdraw a set number of tokens from a specified account
  • Allowance: returns a set number of tokens from a spender to the owner
2 Likes
  1. What are the benefits of setting a token standard like ERC20?

To reduce friction between wallets, exchanges to be programmed to support the tokens

  1. 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 the ’ balance of ERC20 tokens of that address

transfer() gives instructions to transfer ERC20 tokens to another public address

1 Like

Benefits to setting a token standard like ERC20 include:
Tokens that are constructed using the same standard are treated the same meaning exchanges and wallets that support the standard are able also to support all the tokens that fall into the same standard.
Having a standard has catapulted crypto industry.
Creation of new tokens is easier.

The functions are pretty much self explanatory:
balanceOf() shows token balance of an account
transfer() transfers tokens from one account to another
doSomething() gives a certain task
approve()used to approve transaction

2 Likes