Homework: ERC20

Answers on “ERC20 token standard”. Questions:

  1. Makes things more efficient. Easier to interact with because of the same rules.
  • name - returns name of the token
  • symbol - returns symbol of the token
  • decimals - Returns the number of decimals the token uses
  • totalSupply - Returns the total token supply
  • balanceOf - Returns the account balance of another account with address
  • transfer - Transfer amount of token to an address
  • transferFrom - transferFrom method is used for a withdraw workflow
  • approve - Allows to withdraw from your account
  • allowance - Returns the amount allowed to withdraw
1 Like

Obviously that tokens are better to have one standard. In this case all wallets and exchanges can communicate with them fast. Other wise we will need different wallets for different tokens.
ERC 20 smart contract includes following functions: totalSupply(), balance0f, transfer, transferFrom, approve, allowance, constant name, constant symbol and constant decimals.

I am going to touch here only on function approve (address_spender, unit 256_value) returns( bool success). It allows Spender to take money from the User’s account up to definite value. User initiates this function

1 Like
  1. Everyone who programs on it uses and knows the same rules. It prevents confusion and failure in code.
  2. totalsupply() shows the maximum number of tokens available.
    balanceOf() shows the balance of a given address
    transfer() moves tokens to an address
1 Like
  1. Having a standard like 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.
  2. totalSupply() gives maximum number of tokens that exist
    balanceOf(address account) gives a public addresses’ balance of ERC20 tokens
    transfer() allows someone to transfer their ERC20 tokens to another public address
1 Like

1

It is supported right away by the different exchanges and wallets.

2

name()
Returns the name of the token

symbol()
Returns the symbol of the token.

decimals()
Returns the number of decimals the token uses

totalSupply()
Returns the total token supply.

balanceOf(address _owner)
Returns the account balance of another account with address _owner

transfer(address _to, uint256 _value)
Transfers _value amount of tokens to address _to

transferFrom(address _from, address _to, uint256 _value)
Transfers _value amount of tokens from address _from to address _to

approve(address _spender, uint256 _value)
Allows _spender to withdraw from your account multiple times, up to the _value amount.

allowance(address _owner, address _spender)
Returns the amount which _spender is still allowed to withdraw from _owner .

1 Like
  1. Benefits are that Erc20 defines the standard of how you can program different tokens in the way that all exchanges, wallets will be able to understand, it tells how the code should be laid for different tokens, that removes friction from the financial system and makes it more efficient.

  2. Functions:

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 - approval to transfer up to a certain number of tokens, known as an allowance.
totalsupply - tells how many tokens are in circulation

1 Like
  1. ERC20 provide means for Exchanges to list more tokens and also allows Wallets to provide total token balance for different tokens.
    ERC20 provides a common set of rules for smart contracts on the Ethereum network.

  2. The balanceOf() function provides the number of tokens in a given address.
    The tranfer() functions to send tokens from one address to another.

1 Like
  1. Setting a standard improves the programmer and users (wallets and exchanges) operability.
  2. Some of ERC20
  • totalSupply: returns the total amount of the token that exists in circulation.
  • balanceOf: return the balance of the provided address.
  • allowance: number of tokens allowed to be transferred from a given address by another given address.
  • transfer: send a given amount of the token to another address just like a conventional cryptocurrency transaction.
  • approve: authorizes, or approves , the given address to withdraw instances of the token from the owner’s address.
  • transferFrom: automate the transfer process and send a given amount of the token on behalf of the owner.
1 Like

1: Having one standart exchanges and wallets are able to reconize new ERC20 tokens
2: ```
function totalSupply() public view returns (uint256);
function balanceOf(address tokenOwner) public view returns (uint);
function allowance(address tokenOwner, address spender)
public view returns (uint);
function transfer(address to, uint tokens) public returns (bool);
function approve(address spender, uint tokens) public returns (bool);
function transferFrom(address from, address to, uint tokens) public returns (bool)

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

It increases efficiency and allows tokens to operate on platforms and wallets seamlessly.

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

balanceOf() number of tokens at an address
transfer() move tokens from one address to another
allowance() number of tokens that are allowed to be transferred to another address
Approval() allows a contract to withdraw multiple times from an account up to a given amount

1 Like
  1. A token standard like ERC20 allows interoperability which leads to fast and mass adoption. With a universal standard, new tokens can be put on an exchange or transferred to a wallet once they are created.

  2. totalSupply() - equals the sum of all balances.
    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.

1 Like
  1. A standard like ERC 20 is necessary so that we can interoperate with one another.
  2. totalSupply() gives total number of tokens.
    balanceOf() shows # of tokens held by a given address
    transfer() transfers tokens from sender to recipient address
    transferFrom()- Specifies from which address
    approve() allows users to approve the transfer
    allowance() provides tokens that are allowed to be transferred from one address to another
    doSomething() preforms instructions
1 Like

1.) they are all interchangeable. Existing wallets will work with them. Fungible.

2.) Total Supply & Balance (gets the account balance).

1 Like

[quote=“filip, post:1, topic:8440, full:true”]
Homework on ERC20 token standard.

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

ERC20 is

  • compatible with fungible tokens, tokens are issued on the Ethereum network.
  • it is used for all smart contracts on the Ethereum blockchain for token implementation and provides a list of rules that all Ethereum-based tokens must follow.
  1. What functions are in the ERC20 Token Standard Interface and what do they do?
    ERC20 defines the functions:

BalanceOf: allows a SC to store and return the balance of the provided address. The function accepts an address as a parameter, so it should be known that the balance of any address is public.

TotalSupply : allows an instance of the contract to calculate and return the total amount of the token that exists in circulation.

Transfer: lets the owner of the contract send a given amount of the token to another address just like a conventional cryptocurrency transaction.

TransferFrom: allows a smart contract to automate the transfer process and send a given amount of the token on behalf of the owner.

Approve: the owner of the contract authorizes, or approves , the given address to withdraw instances of the token from the owner’s address.

1 Like
  1. easy to communicate / interact with each other, as well as it leads to a faster adoption since for platforms, etc. it is easier to implement these

  2. total supply - calculate the total supply of the token
    balance - check the balance of the account

1 Like
  1. It simplifies reading proccess of all tokens (in wallets, exchanges etc). It is smooth, well known and usefull that way.
  2. balanceOf() - function that gives token ballance for an account
    transfer() - sending tokens to another address, not usefull when paying for smart contracts to run
    approve() - it gives another address permition to use approved tokens for example in SC
    transferFrom() - takes approved tokens to run SC
1 Like

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

All tokens looks the same , if they all function the same , the code is layout the same way it means all exchanges and all wallets will be able to support the tokens from day 1 . So if theres new token it can be supported by all wallet and exchanges from day 1.

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.
1 Like
  1. Because everything is written in the same ‘language’. This means that fe. wallets can read all ERC20 written application if they know the ERC20 ‘language’.

  2. totalSupply() returns the total amount of the token that exists

    balanceOf() returns number of tokens held by a given adress.

    transfer() send a number of tokens directly from the message sender to an other adress. Note: there are no checks made on this adress, so it’s up to the sender to make sure it’s right.

    approve() used when an operation has a certain cost. with this a user can approve this cost. So called allowance.

transferFrom() takes this allowance so that smart contract can run

allowance() returns the number of tokens allowed to be transferred from a given address by another given address

1 Like

1, As it is written in a 100% standard way, it creates efficiency and allows wallets and exchanges to support the new tokens
2,
totalSupply function= Returns the total circulating amount of tokens.
balanceOf function= Returns how many tokens exist in an account.
transfer function= Transfer an amount of tokens from one token owner’s account to another account.
approve function= A token owner can approve for spender to transferFrom tokens from the token owner’s account.
allowance function= Returns the amount of tokens approved by the owner that can be transferred to the spender’s account.
transferFrom function= 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?
    The standard increases efficiency and a better communication of the token with wallets and exchanges.
  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    function totalSupply(): total amount of tokens circulating
    function balanceOf: how many tokens in the address account
    function transfer(): send tokens to a recipient
    function approve (): the sender pays for the cost of a smart contract, this cost is called an allowance
    function TransferFrom: a smart contract can transfer automatically a given amount of the token on behalf of the owner.
1 Like