Homework: ERC20

  1. What are the benefits of setting a token standard like ERC20?
    Token standardization provides interoperability between applications interacting with tokens.

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

  • function totalSupply() public view returns (uint256)
    Returns the total token supply.

  • function balanceOf(address _owner) public view returns (uint256 balance)
    Returns the account balance of another account with address _owner.

  • function transfer(address _to, uint256 _value) public returns (bool success)
    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.

  • function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)
    Transfers _value amount of tokens from address _from to address _to , and MUST fire the Transfer event.

  • function approve(address _spender, uint256 _value) public returns (bool success)
    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 .

  • function allowance(address _owner, address _spender) public view returns (uint256 remaining)
    Returns the amount which _spender is still allowed to withdraw from _owner.

1 Like
  1. Standards allow developers to have their applications interact with others’ coded structures and tokens efficiently as they don’t require changing the code to address the same function such as fetching the number of tokens at an address or knowing exactly how the function of the supply of tokens is stated for any one token. Standards add value to the growing industry as all who are invested can build upon the same fundamentals and cooperate and create based on the same rules. There are three standards for Ethereum tokens and they are ERC20, the basic coin standard for fungible coinage, ERC721 and ERC5511 which have their own standards and are used for coding tokens used in gaming that have custom attributes related to the games for which they are designed. The standard gas-use for operations are stated as numbers used as proportions of the cost of development which is paid in Ether) and these are stated for the purpose establishing proportion as opposed to any absolute value or range since Ether has a market value that fluctuates. This is an ingenious means of solving the problem of charging the developer per coding action and it is deemed necessary to charge the developer working in the Ethereum space as the breadeth of possibilities of adding code is enormous and storage to mining energy is limited for processing and dealing with all that code not to mention any codes added that are essentially spam. Standards for writing code make for an environment in which developers can keep creating rather than revisiting foundation points already established. This is a necessity as efficiency is of paramount concern. This is why commonly used functions are written in the same exact code and same naming conventions.
  2. Functions included in ERC20 include function totalsupply( ) which answers the query as to how many tokens are in circulation. Another function is balanceOf( address account ) which answers the query as to how many tokens exist at a given address or how many tokens someone possesses. Wallets use this function to find out how much of a given coin or token one has.
1 Like
  1. The benefits of setting a token standard like ERC20 is that everyone uses the same program language so they can integrate to each other and not have everyone do their own contract. And wallets and exchanges will be able to support the tokens.
  2. Total supply: provides total supply of tokens; balance of: balance of wallet; transfer: contract owner send an amount of token to another address; approve: contract owner authorizes a given address to transact a certain amount.
1 Like
  • What are the benefits of setting a token standard like ERC20?
    This creates the ability to for all tokens to accept new tokens in the system, for all to work in sync and enable an open source system to grow and innovate using a set standard.

  • What functions are in the ERC20 Token Standard Interface and what do they do?
    There are many functions in the ERC20 for example balanceOf(address account) allows a wallet to check the balance of a particular address. All tokens will have this code.

1 Like
  1. A token standard like ERC20 makes the tokens fungible across all wallets

  2. The functions of the ERC20 token standard interface are
    -total supply() = ax number in circulation
    -balance)f(address account) = shares the public address of the account holder
    -transfer() =allows for transferring tokens to another address

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    All the smart contracts can interact with each other and make it easy to build on top of other smart contracts that are made if it is all standardized.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    Allows everybody to know how many tokens are created and gives a balance of specific accounts, it is a Fungible token standard.

  1. Stetting standards like ERC20 Tokens helps different projects/ Smart contracts/applications to be able to communicate with each others, this boosting up the efficiency/use cases/ and adoption of blockchain.
  2. The function totalSupply returns the max supply on the token- The function balanceof() gives the current balance of the designated wallet.
1 Like
  1. What are the benefits of setting a token standard like ERC 20?
    The benefits of setting a token standard such as ERC20 is that it allows wallets to be programmed to support all the tokens using this standard. This stakes out all the friction, than if all the tokens structure was programmed differently.
  1. It is easy to deploy and integrate new tokens within the existent framework. Wallets and exchanges can easily integrate new tokens of the same standard by their contract address.
  2. balanceOf() - Provides de balance of a given address.
    transfer() - transfers balance from the message sender to a new address.
    approve() - gives permission to another address to withdraw up to a certain balance (allowance).
    transferFrom() - takes balance from an address up to the given allowance.
1 Like

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

Indeed sir, but could you please describe which are those functions and what do they do?

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

Carlos Z.

1 Like

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

I guess you forgot to type the answer to this question. :nerd_face:

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

Carlos Z.

Interoperability.

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. Two examples noted in the lecture are: “totalsupply” or “balanceOf”. These functions tell you things such as total units of a token or balance of a public wallet.

1 Like

A. Total Supply () : How many tokens there are, you have to set a finite suppoly unless the token is mineable

B. Transfer () : Enables the transfer of the tokens to a user from whoever calls the tranfer function

C. Alloance () : Here you can query the amount of approved tokens

D. Approve () : Approve other users to spend your toekns. This “approved” amount is stored in Allowance.

E. Balance of () : Permits the querying of token holder balances

F. Transfer from ()n : The function associated with transfering from Allowances, essentially how other users will spend the tokens you have approved them to, these funds are taken from Allowance.

I had to take a deeper dive.

Is this better?

1 Like
  1. Instant exchange listing because they recognise and can read the code - much more scalable than having it’s own personalised code.
  2. balanceOf(), transfer(), transferFrom(), doSomething(), approve()
  1. What are the benefits of setting a token standard like ERC20?

Having this standard, ERC20, allows wallets and exchanges to be programmed to support any token using that standard. This is much simpler and scalable than each token having its own personalized code.

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

balanceOf()

transfer()

approve()

transferFrom()

doSomething()

allowance()

All exchanges and all wallets will be able to support the ERC20 token.

balanceOf() : provides the number of tokens held by a given address
transfer(): transfers a number of tokens from the message sender to another address.
approve():a token holder gives another address approval to transfer up to a certain number of tokens,
known as an allowance and uses approve() to provide this info.
transferFrom() : allows to take tokens from an account.
allowance() :provides the number of tokens allowed to be transferred from a given address by another
given address.
totalSupply(): the total amount of circulating tokens
Events :

  • Transfer() emits details of the movement of tokens from one address to another address
  • Approval() emits details of approval of tokens from one address to another address
1 Like
  1. Standars are highly important when programming a Smart contract, because there are many smart contracts whose objective are the same (for example when creating a new token). The fact that there will be standars, will make way this system way more efficient, and will also make easier the communication between dapps and smart contracts.

  2. -function totalSuplly : when you create a new token, it will determine how many maximum tokens can exist.

  • function balanceOf: determine the number of tokens by a given address
    -function transfer: to send token from one address to other. An approval from the receiver is not needed.
    -functio approve:to ask for permission to send tokens from one address to other.
1 Like
  1. So that Smart Contracts wont have different structures which will make it difficult to be read.

2 totalSupply() function is used to determine the total suplly of the token that has been made.

balanceOf function is used to check the remaining balance of a certain account address.

2 Likes

1.The benefits of setting a token standard:
Programmability
Use of same code
Fungibility (all tokens are made and look the
same)
2. Functions in the ERC20 token standard and what the do:
Total Supply function tells how much is in the account, totally
Balance O - give address to see what the
balance is in the account
Transfer - naming and parameters
Inter operate to keep from having friction

1 Like

It’s much easier and scalable to work according to a standard.

Some of the ERC20 Standard functions;

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

2 Likes