Homework: ERC20

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

The ERC-20 commands vital importance, because it defines a common list of rules that all Ethereum tokens must adhere to. Consequently, this particular token empowers developers of all types to accurately predict how new tokens will function within the larger Ethereum system. This simplifies and eases developers’ tasks, because they can proceed with their work, knowing that each and every new project won’t need to be redone every time a new token is released, as long as the token follows the rules.

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

The functions are:

a) totalSupply : Returns the total circulating amount of tokens.
b) balance Of : Returns how many tokens exist in an account.
c) transfer : Transfer an amount of tokens from token owner’s account to another account.
d) approve : A token owner can approve for “spender” to “transferFrom tokens” from the token owner’s account.
e) allowance : Returns the amount of tokens approved by the owner that can transferred to the spender’s account.
f) transferFrom : Allows a spender account to transfer an amount of tokens on behalf of the token owner to another account.

1 Like
  1. A common use case can be precisely scaled if we create a standard for the use case. Meaning: if someone has figured some scalable way of doing something, they can now describe how they did it, and the other people will now be able to start from something, as opposed to be required to re-invent a wheel.
  2. // Returns the total token supply
    function totalSupply() public constant returns (uint);

    // Returns the account balance of another account with address tokenOwner
    function balanceOf(address tokenOwner) public constant returns (uint balance);

    // Returns the amount which spender is still allowed to withdraw from tokenOwner
    function allowance(address tokenOwner, address spender) public constant returns (uint remaining);

    // Transfer the balance from owner’s account to another account
    function transfer(address to, uint tokens) public returns (bool success);

    // Allow spender to withdraw from your account, multiple times, up to the tokens amount.
    function approve(address spender, uint tokens) public returns (bool success);

    // Send tokens amount of tokens from address from to address to
    function transferFrom(address from, address to, uint tokens) public returns (bool success);

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    Integration and interoperation is possible with less friction. Everyone agrees to play by the same rules and so new participators will also get easily supported.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    balanceOf(): provides the number of tokens of a given address
    transfer(): transfers a number of tokens from the message sender to another address
    transferForm(): executes the instruction resulting in the balance being comprised in
    “doSomething”(): the instruction of the contract deployer so this can be labelled at choice
    allowance(): provides the number of tokens allowed to be transferred
    approve(): the approval by the token owner for transferring the number or allowance

1 Like
  1. Having a Token standard Like ERC20 is a benefit because there is more efficiency through interacting and inter-operates between other tokens, wallets platforms and exchanges more effectively.
    2.There are plenty of functions, the ones we went over with professor Ivan are * totalsupply() which calculates maximum number of existing tokens. * transfer() which allows the transfer ERC20 to other public addresses. *balanceOf() which gives public addresses the balance of ERC20
1 Like
  1. makes dealing with all tokens easier
  2. makes development consistent between different projects
  1. Tokens can be quickly accepted by wallets and exchanges, leading to a faster adoption.
  2. totalSupply() defines how big is the maximum supply of tokens
    balanceOf(address account) defines how many tokens this account has
    transfer() allows a transfer between accounts
1 Like

What are the benefits of setting a token standard like ERC20?
Without the ERC20 standard everyone will be creating their own standard of code and they will not be able to communicate with each other, standards are very important and it allows wallets, exchanges and other applications to communicate with the range of tokens they manage.

What functions are in the ERC20 Token Standard Interface and what do they do?
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.
approve() - emits details of approvals of tokens from one address to another.
totalSupply() - equals the sum of all balances.
allowance() - how many tokens are in the allowance.

1 Like

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

Hello sir, yes that is true, but could you please describe a little bit what those functions do?

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

Carlos Z.

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?

  3. The benefits of the ERC20 standards are the Dapps built on top of it can interact with one another seamlessly. For example, if we have two tokens, say Token Alpha and Token Beta, and both of them have different smart contract structures, this doesn’t really bode well for scalability. If there are 100 different tokens with 100 different contracts, then to narrow down on all the qualifications and conditions required to make sure that transfers can go through between all these tokens will need an incredible amount of complex calculations. Which is not ideal.

ERC” stands for to Ethereum Request for Comment, while the number ’20’ is the number assigned to this request.

ERC20 standard consists of 3 optional rules and 6 mandatory rules.

The mandatory rules:

  • totalSupply: # tokens in circulation
  • balanceOf: # of tokens that a particular address, has in their account.
  • Transfer: Now that all the checking has been done and the contract knows that the user has the required amount of tokens needed to fulfill the transaction, the contract owner can send them tokens using this function.
  • transferFrom: It helps you automate payment transfers to a specific account.
  • Approve: Once the balance has been checked, the contract owner can give their approval to the user to collect the required number of tokens from the contract’s address. The approve function also checks the transaction against the total supply of tokens to make sure that there are none missing or extra.-it makes sure that counterfeiting is impossible.
  • Allowance: In order to carry out a transaction one of the most important data that the contract should know is the balance of the user. The user must have the minimum amount of tokens required to do the transaction, If not, the function cancels the transaction.

The optional rules are:

  • Token Name
  • Symbol - important for “branding”
  • Decimal (up to 18)
1 Like

Answer 1:
The interface of the token SC is known and results in a consistent method to implement in applications.

Answer 2:

  • totalSupply() -> Number of tokens in circulation.
  • balanceOf() -> Token balance of a given address.
  • transfer() -> Transfer tokens from sender to a given address.
  • approve() -> Allow a given address to withdraw a given amount of tokens from the sender - known as allowance.
  • transferFrom() -> Transfer up to the allowance amount of tokens from a given address, if it has enough balance.
1 Like
  1. The benefits are all ERC20 will be supported by ethereum and can use ethereum blockchain.

  2. some functions are:

BalanceOf - check the address balance
transfer - Transfer funds
totalSupply - calculate the total amount of the token that exists in circulation

1 Like
  1. Fungibility, meaning that the token is indistinguishable from Ethereum and most of the listed tokens within the crypto sphere as they are all based on standardized functions. The advantage is approval of listing and transfer of tokens between entities such as exchanges as this standard is already known and in place. Also, the programming capability options are limitless.
  • Name, The name of the token contract
  • Symbol, the token abbreviation
  • Decimals, how divisible a token can be
  • Total Supply, the sum of all balances
  • BalanceOf, the number of tokens held by a given address
  • Transfer, the transfer of x number of tokens directly from the message sender to another address
  • doSomething, compliance of a request based on the smart contract
  • Approve, approval of doSomething
  • TransferFrom, Transfer From in accordance with doSomething
  • Allowance, provides the number of tokens allowed to be transferred from a given address by another given address
1 Like
  1. Increased efficiency, ease of use, interoperability
  2. BalanceOf()- provides number of tokens held by a given address.
    transfer () allows transfer of tokens from message sender to another address
    approve () approves a token transfer
    allowance () number of tokens allowed to be transferred
1 Like
  1. All projects running on the Ethereum network can communicate easily so i.e. all tokens can run on all exchanges and wallets supporting the same standard.

  2. There are different functions like i.e. totalSupply() and balanceOf(address account), transfer() functions and more. They make sure different contracts and programs can interact with each other in the same way like i.e. reading the balance of a wallet…

1 Like
  1. The benefits of setting a token standard is that it doesn’t cause any friction on the network. People are able to build there codes and exchanges & wallets are automatically integrated with the design of the erc20 token. therefore no need to update your wallet
  2. some functions within the erc20 token are balance, total & transfer fungible tokens. Total supply gives you the maximum number of tokens that can exits. balance gives you the public address & trans allow you to transfer your tokens
1 Like
  1. It provides programming consistency for developing fungible tokens.

  2. totalSupply : Returns the total circulating amount of tokens.

  • balanceOf : Returns how many tokens exist in an account.
  • transfer : Transfer an amount of tokens from token owner’s account to another account.
  • approve : A token owner can approve for spender to transferFrom tokens from the token owner’s account.
  • allowance : Returns the amount of tokens approved by the owner that can transferred to the spender’s account.
  • transferFrom : Allows a spender account to transfer an amount of tokens on behalf of the token owner to another account.
1 Like

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

  • efficient - accepted instantly in exchanges and wallets
  • less risk - the standard reduces the risk of contract breaking.

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

  • totalSupply : Returns the total circulating amount of tokens.
  • balanceOf : Returns how many tokens exist in an account.
  • transfer : Transfer an amount of tokens from token owner’s account to another account.
  • approve : A token owner can approve for spender to transferFrom tokens from the token owner’s account.
  • allowance : Returns the amount of tokens approved by the owner that can transferred to the spender’s account.
  • transferFrom : Allows a spender account to transfer an amount of tokens on behalf of the token owner to another account.

Useful Sources:

  1. https://medium.com/aqwire/advantages-of-the-erc-token-9236407623c9
  2. https://yos.io/2019/04/14/erc-standards-you-should-know-about/
2 Likes
  1. Benefits of ERC20: One systems can be created to handle different tokens, that use the same ERC20 interface. Many tokens can interoparate betwen themselves and on the same exchanges.

  2. ERC20 standard functions:

  • balanceOf(address) - return token amount for address,
  • transfer(receiver, value) - transfer token from the sender to receiver,
  • totalSupply() - total supply of contract’s token,
  • approve(spender, value) - how much value spender can spend
  • allowance(owner, spender) - how much owner allowed to sped to the spender address,
  • event Transfer(from, to, value) - event when value is transfered between accounts,
  • event Approval(spender, value) - approval for spender to spend amount of token,
1 Like

1- having the same standard would mean that all platforms which are attempting to read the code will have no trouble doing so as long as the platform was built to understand that standard for example erc20 wallets and decentrilised exchange.
2- totalsupply- fetches total supply of ehereum
balanceof- fetches balance of a paticular address

1 Like

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

Yes sir, 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.