Homework: ERC20

  1. The benefits of using a standard such as ERC20 is that all nodes understand this and can communicate.

  2. balanceOf( ) will provide the number of tokens held by a particular address.
    transfer( ) will send a number of tokens from one address to another.
    doSomething( ) requires 50 do tokens to operate.
    approve( ) and transferFrom( ) set up the transfer of tokens.
    allowance( ) provides the number of tokens available to be transfered.

1 Like

Hello Abuga,

ERC20 Standard functions mentioned in the lecture:

Total Supply

Balance Of

Transfer

Are there more standard functions?

2 Likes

Homework: ERC20 token standard

  1. Marketplace efficiency and scalability. It’s important that everyone is working together in order to increase adoption and usability.
  2. balanceOf(address account) gives a public address’ balance of ERC20 tokens, totalSupply() gives maximum number of tokens that exist, transfer() allows someone to transfer their ERC20 tokens to another public address
2 Likes
  1. What are the benefits of setting a token standard like ERC20?

Have a uniform set of rules allows tokens to seamlessly interact with one another.

A set standard allows tokens to be listed on exchanges with minimal technical work as it’s been done so many times before.

Reduces risk as developers and users already know the token behaviour during transactions so there is less chance of the smart contract being broken

  1. 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 from token owner’s account to another account

Approve : a token holder 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 be 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

2 Likes
  1. What are the benefits of setting a token standard like ERC20?
    By setting a token standard like ERC20 it will make it much more easy to everyone to learn and understand.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    total supply() give the opportunity to check the circulating amount of tokens
    balanceof() checks how many tokens in a particular account
    transfer() transfer tokens from one account to another

I know only these for now :(((

1 Like

1 having the standard ERC20 allow all the exchanges and wallets to add ERC20 token immediately as it is created because the tokens had common manning codes
2 Function Total Supply =# of total fungible tokens/ Function Balance of = balance of an specific account / function for transfer=transfer tokens to another account

1 Like

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

  • 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.

  • transferFrom() : transfers a number of tokens directly from an account to another address. Used with approve() function.

  • approve() : approval to transfer up to a certain number of tokens, known as an allowance.

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

Hope this gives you a clear view of the subject, keep learning! :slight_smile:

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

Carlos Z.

  1. Universal interoperability, known and understood by all. Reduces bugs
  2. balanceOf for requesting wallet bal. totalsupply for total supply of tokens, transfer for sending btw addesses
1 Like
  1. What are the benefits of setting a token standard like ERC20?

It allows tokens that are based on that are based on that standard to easily interoperate.

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

name: Returns the name of the token - e.g. “MyToken”.
symbol: Returns the symbol of the token. E.g. “HIX”.
decimals: Returns the number of decimals the token uses - e.g. 8, means to divide the token amount by 100000000 to get its user representation.
totalSupply: Returns the total token supply.
balanceOf: Returns the account balance of another account with address _owner.
transfer: Transfers _value amount of tokens to address _to, and MUST fire the Transfer event. The function SHOULD throw if the message caller’s account balance does not have enough tokens to spend.
transferFrom: Transfers _value amount of tokens from address _from to address _to, and MUST fire the Transfer event.
approve: Allows _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.
allowance: Returns the amount which _spender is still allowed to withdraw from _owner.

1 Like
  1. It makes it much easier for programs and networks to communicate with each other when using the same commands for communication

  2. BalanceOf - gives the total balance of a particular address
    totalSupply - gives maximum of the tokens that are currently in existence

1 Like
  1. The benefits of the ERC20 standard decrease friction among users, interoperability, Used code remains the same and language structure maintains integrity.
  2. balanceof () provides the balance of any given address/account, transfer () function transfers a number of tokens directly from the message sender to another address, doSomething() requires 10 Do tokens to operate, approve() and transferFrom() are two functions that allow the doSomething to occur in two steps, The allowance() function provides the number of tokens allowed to be transferred from a given address by another given address
1 Like

Homework on ERC20 token standard - Questions

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

Tokens can theoretically be programmed in many different ways, so standards have been developed to make it easier for exchanges and wallets to integrate new tokens. ERC20 is such a standard.

Smart contracts can not only be used to automate the flow of ETH, but also to create new money, new economies and new market models. It’s important to have standards (like ERC20) for efficient technical communication and development in these emerging areas.

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

balanceOf() : Query for the number of tokens in a given address.

transfer() : Send tokens from one address to another.

approve() : Gives another address (usually a smart contract address) approval to transfer up to a certain number of tokens.

transferFrom() : Used by the approved address (within in the smart contract) to “do something” with the tokens.

allowance() : Query for the number of tokens allowed to be transferred from a given address, by a given (approved) address.

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    Standards allow for a framework where developers that wish to introduce new tokens can do so quickly and easily and integrate with exchanges and wallets in a well documented and common way.
  2. What functions are in the ERC20 Token Standard Interface and what do they do?
  • balanceOf: Provides the number of tokens held by a given address.
  • rransfer: Transfer tokens directly from the message sender to another address.
  • totalSupply: Identifies the total number of tokens that exist.
  • transferFrom: Makes a third party able to carry out a transfer.
  • approve: Makes the token holder give another address (usually a smart contract) approval to transfer up to a certain number of tokens
  • allowance: Provides the number of tokens allowed to be transferred from a given approved address by another given address
1 Like

What are the benefits of setting a token standard like ERC20?
Everything can interact with the tokens in the same way, so no need to update all infrastructure when adding new tokens.

What functions are in the ERC20 Token Standard Interface and what do they do?
totalSupply()
Allows an instance of the contract to calculate and return the total amount of the token that exists in circulation.

balanceOf()
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.

transfer()
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.
It doesn’t work so well when tokens are being used to pay for a function in a smart contract.
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.

approve()
Owner of the contract authorizes, or approves, the given address to withdraw instances of the token from the owner’s address.

transferFrom()
Allows a smart contract to automate the transfer process and send a given amount of the token on behalf of the owner.
With this function, a contract can send a certain amount of the token to another address on your behalf, without your intervention.

allowance()
Returns the amount of tokens approved by the owner that can transferred to the spender’s account.

1 Like

1 Interoperability among contracts, exchanges and wallets. Use of best programming practices

2 Main ones: totalSupply(): overall number of tokens; BalanceOf(): available tokens in an account; transfer(): transfer funds to a specified address

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    benefits of ERC20 is the STANDARD for smart contracts to interact with one another. We do not need to reinvent the wheel everytime someone wants to build a new token. All wallets know how to talk to a ERC20 makes it easier eliminates friction and problems when using different standards.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    Functions include: balanceOf (address account) = which is the balance of accounts - for example used by exchange when they want to check your account balance before executing a function. The exchange can check how many tokens you own in your wallet.
    Another one is totalSupply = how many coins are in circulation when checking coinmarketcap this function is applied to calculate all coins held in wallets by holders.

1 Like
  1. It has standard functions that make it easy to integrate into different platforms.
  2. totalSupply, balanceOf, transfer, transferFrom, approve, allowance
2 Likes
  1. What are the benefits of setting a token standard like ERC20?
    R: It is beneficial because any wallet and exchange will support any tokens using ERC20 standard.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    R:
    balanceOf() - provides the balance of tokens by a given address
    transfer() - Transfers a number of tokens from the sender address to another address
    approve() - approve the transfer of the tokens
    doSomething() - instructions
    allowance() - tells which address is given what amount of tokens to spend
    transferFrom() - automated transfer by the smart contract on behalf of the owner
    totalSupply()- returns the total amount of tokens in circulation

1 Like
  1. when every programmer has a standard to follow best practice is encouraged so that exchanges, wallets etc can interact with it easily
  2. totalSupply() the total supply of a token, balanceOf() gives you the balance of an account
1 Like
  1. Using a token standard like ERC20 are that wallets/exchanges can communicate using the same code; otherwise if each program had it’s own tokens, it would greatly reduce efficiency and speed of transactions.

  2. The ERC20 functions are:
    *balanceOf() - transfers tokens between addresses
    *totalSupply() - provides the total supply of a particular token
    *transfer() - enables the transferring of ERC20 tokens to another address

1 Like