Homework: ERC20

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?

If you need help with the last question, you can read more about the functions here: https://medium.com/@jgm.orinoco/understanding-erc-20-token-contracts-a809a7310aa5

73 Likes

28 Likes
  1. Having standards allows wallets, exchanges etc to easily add all ERC 20 tokens as they have common naming in their code.

  2. balanceOf() Gives balance of a specific account, totalsupply the number total fungible tokens.

19 Likes

1. What are the benefits of setting a token standard like ERC20?
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. 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 a public addresses’ balance of ERC20 tokens
transfer() allows someone to transfer their ERC20 tokens to another public address

43 Likes
  1. Standards ensure all apps are interoperable and brings consistency to community by increasing efficiency.
  2. totalsupply, balanceOf(account), transfer, approve are few functions which are part of erc 20. Totalsupply gives number of tokens, balanceOf gives available token balance for an account, transfer is used to send to other account whereas approve allows user to approve the transfer to a function.
14 Likes
  1. The benefit is that all tokens based on the same standards will be able to communicate in a known and expected way, meaning interoperability between the tokens is possible.

  2. totalSupply returns a uint of the total supply of that token
    balanceOf - given an address it returns their account balanceOf
    transfer - transfers an amount to a specified address from the owner of the contract (return bool success)
    transferFrom - specifies a from address, to address and a value to transfer (return bool success)
    approve - When called the owner of the contract authorises the address to withdraw tokens from the owners address
    allowance - returns the amount remaining (I think)

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

    Efficiency. Making the different tokens exchange easily, allowing wallets to provide token balances for different tokens.

  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. But it doesn’t work well when tokens are being used to pay for a function in a smart contract.

    approve(): a token holder gives another address approval to transfer up to a certain number of tokens(allowance).

    transferFrom(): take certain tokes from sender’s account and carry on its work.

    doSomething(): to operate instructions.

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

18 Likes
  1. Setting the ERC20 standard for token design, it alows inter-operability and efficiency in interacting with the smart contract. Because of this, deplyment of wallets and creation of new tokens become easier.

  2. totalSupply(): gives maximum number of tokens that exist
    balanceOf(address): gives a public addresses’ balance of ERC20 tokens
    transfer(): allows transfer of their ERC20 tokens to another public address
    doSomething(): operates instructions.
    allowance(): provides the number of tokens allowed to be transferred from a given address by another.

3 Likes
  1. The benefits of setting a token standard like ERC20 is that it increases efficiency and allows tokens to operate on platforms and wallets seamlessly.

  2. The functions that are in the ERC20 are:

  • totalSupply() which gives a number as an output. This number is the total supply of the token
  • balanceOf() which takes the address of an owner as the input and gives the balance of the users as output
  • allowance() function takes in the address of the tokenOwner and the spender and gives as output, the number of tokens allowed to be transferred from a given address by another given address.
  • transfer() function simply takes in the address of the receiver and the funds which are to be sent to the account
  • approve() function. You can approve someone to spend from your account.
  • transferFrom() function. It takes in three inputs — the address of the sender, the address of the receiver, as well as the number of tokens to be transferred. And gives an output of the success or failure of the transfer.
9 Likes
  1. Benefits of having a standard like ERC 20 are: Increase of efficiency- all wallets, exchanges, platforms can add the token very easily. Also it is easy to read. Programmers don´t have to learn/program every token from scratch, with a standard you just have to change a few lines.

  • balanceOf() --> gives back the balance of a specific address
  • transfer() --> transfer tokens from the sender address to another address
  • allowance() --> shows how many tokens are allowed to be transfered
  • doSomething() --> instruction
  • approve() --> part of a 2step transfer: authorizes to transfer an amount of tokes to another
    given address
2 Likes
  • What are the benefits of setting a token standard like ERC20?
    Creates a common language for all users.

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

totalSupply() - returns - (uint);
balanceOf(address tokenOwner) - returns - (uint balance);
allowance(address tokenOwner, address spender) - returns - (uint remaining);
transfer(address to, uint tokens) -returns- (bool success);
approve(address spender, uint tokens) - returns - (bool success);
transferFrom(address from, address to, uint tokens) - returns - (bool success);

2 Likes

Homework on ERC20 token standard.

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

It enables communication between tokens and wallets by setting standards.

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

The balanceOf() function provides the number of tokens held by a given address
The transfer() function transfers a number of tokens directly from the message sender to another address, not used in paying for functions within the smart contract. To pay for these functions we have to use approve() to allow SC use tokens defined as “allowance” and when any function is called SC is using transferFrom() to take tokens from allowance as a payment.

The allowance() is providing info about how many tokens are in the allowance.

6 Likes
  1. One of the major benefits of setting a token standard is it increases the interoperability of these tokens because they share the same syntax meaning there is no resistance when integrating them to currently established systems like wallets and exchanges. It also allows programmers from different projects to more easily read each other’s code which makes further development easier. It should also make it easier for new developers to transition into the space and create smart contracts because many of these standards will apply to most tokens meaning there isn’t a steep learning curve to enter.

  2. The core functions outlined by the article in the ERC20 Token Standard Interface are balanceOf(), transfer(), approve(), transferFrom(), and allowance().

  • The function balanceOf() will return the number of tokens in a given address.

  • The function transfer() will transfer a specified number of tokens from one address to another.

  • The function approve() gives another address approval to transfer a certain amount of funds from the given address. This is usually how smart contracts are give permission to take the necessary funds needed to perform requested operations .

  • The function allowance() is the maximum amount that’s allowed to be transferred by another address via the approve() function.

  • And transferFrom() is the function that is actually invoked to perform the transferring of funds by another address.

11 Likes
  1. Standard ERC20 tokens enables wallets and exchanges to easily implement a new token, built on a standard that is common knowledge and true for all ERC20 tokens.

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
  1. All participants in the ecosystem will be able to speak the same language.

The specific wording of the function is followed by a clarification of what it does, in square brackets.

  • totalSupply() public view returns (uint256 totalSupply) [Get the total token supply]
  • balanceOf(address _owner) public view returns (uint256 balance) [Get the account balance of another account with address _owner ]
  • transfer(address _to, uint256 _value) public returns (bool success) [Send _value amount of tokens to address _to ]
  • transferFrom(address _from, address _to, uint256 _value) public returns (bool success) [Send _value amount of tokens from address _from to address _to ]
  • approve(address _spender, uint256 _value) public returns (bool success) [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 ]
  • allowance(address _owner, address _spender) public view returns (uint256 remaining) [Returns the amount which _spender is still allowed to withdraw from _owner ]

Events format:

  • Transfer(address indexed _from, address indexed _to, uint256 _value) . [Triggered when tokens are transferred.]
  • Approval(address indexed _owner, address indexed _spender, uint256 _value) [Triggered whenever approve(address _spender, uint256 _value) is called.]

(SOURCE: https://en.wikipedia.org/wiki/ERC-20)

3 Likes
  1. What are the benefits of setting a token standard like ERC20?
    ERC20 Standardisation creates commonality of design and interaction which in turn leads to efficiency and predictability and greater adoption within the industry.

  2. What functions are in the ERC20 Token Standard Interface and what do they do? The key standardised functions in an ERC20 token are: Contract Address, Total Supply of tokens, the name, symbol & number of decimal places. In addition the standard protocol allows for transfer of tokens by way of transfer(), approve() & transferfrom().

2 Likes
  1. Token standards allow applications and exchanges to be completable with all tokens using a particular standard.

balanceOf - “This function allows a smart contract to store and return the balance of the provided address”
totalSupply - “this function allows an instance of the contract to calculate and return the total amount of the token that exists in circulation.”
transfer - “This function lets the owner of the contract send a given amount of the token to another address just like a conventional cryptocurrency transaction.”
transferFrom - “This function allows a smart contract to automate the transfer process and send a given amount of the token on behalf of the owner.”
approve - " When calling this function, the owner of the contract authorizes, or approves , the given address to withdraw instances of the token from the owner’s address."
(Source: https://medium.com/blockchannel/the-anatomy-of-erc20-c9e5c5ff1d02)
allowance - " Returns the amount which _spender is still allowed to withdraw from _owner"
(Source: https://en.wikipedia.org/wiki/ERC-20#Technical_standard )

2 Likes
  1. Token standards allow all wallets and exchanges which are set up to support a token standard to accept all tokens which respect the token standard
  2. totalSupply function returns total supply of token
    balanceOf function returns token balance of wallet address
    transfer function transfers tokens from token owner account to account
    allowance function returns the amount of tokens approved by the owner that can be
    transferred to the spender’s account
    approve function allows the token owner to approve for spender to transferFrom tokens
    from the token owner’s account
    transferFrom transfers tokens from account to account
1 Like

1- One update on Etherium is reflected to all tockens, tockens and understand each others
2- allow users to find out the balances of accounts as well as to transfer them from one account to another under varying conditions

1 Like
  1. It will be supported by all the wallets and exchanges, because they function in the same way.
  2. totalSupply() gives you how many tokens in circulation
    balance0f(adrress) you get the balance of wallet you want to check
    allowance() function shows how many tokens can be send from given address by another given address
2 Likes