Homework: ERC20

  1. ERC20 is the standard that defines how we program the token, it allows efficiency in interacting with the smart contract. Easier.
    2.Looking at code: “functions” are important 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.
1 Like

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

  • Uniformity of tech and protocol standard.
  • Reduced complexity of understanding each type of token implementation.
  • Enhanced liquidity of ERC20 tokens.
  • Reduced risk of breaking contracts.

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

Allowance

The Allowance function allows for two address to create repeated unidirectional transfer; a wallet address tokenOwner & a second wallet spender are the defined as the two wallets that will engage in repeated transactions. Specifically, the wallet spender will withdraw some amount from the wallet tokenOwner at some interval – both of these are variables that’ll be determined later on.

Approve

For the Approve function, refer back to our Allowance function: the function allows for two addresses to repeatedly withdraw unidirectionally. The Approve function, aptly named, is a simple standard function that calls for the wallet owner to “approve” a transaction that’s about to made on his/her behalf in context of an Allowance. This function requires two inputs, the address of the spender & the amount of tokens being sent. The output returns a public boolean that dictates whether approval was provided or rejected.

BalanceOf

BalanceOf is an intuitive function that accepts a single address input parameter (address tokenOwner) & returns a single public constant (uint balance). The returned uint constant, balance, represents the amount of tokens the queried address holds — remember, transactions on a blockchain are usually public, Ethereum is no different.

TotalSupply

The totalSupply function, as you can probably guess from the name, is an anonymous constructor function that’s ran only once in the very first moment of deployment to the live Ethereum network. The function returns a public constant totalSupply unassigned integer (uint) that acts as that tokens total supply for the remainder of the contracts life. This totalSupply constant is usually defined one of two ways: hardcoding a variable or funding from an origin wallet.

Transfer

The Transfer function is the core function of any ERC20 token; it defines & implements direct wallet-owner-to-peer token transferring. Since wallet owners make this call, only two parameters are required: the receiver address & the amount of tokens being sent. These two parameters are usually initialized as (address to) & (uint tokens). The Transfer return value is simply a boolean that confirms whether the receiver (the “to” address) received the tokens sent.

TransferFrom

The TransferFrom function allows for a smart contract to execute a transfer with the parameters passed on behalf of the wallet owner. Carefully make the distinction with the previous Transfe r function. The previous function allowed for the wallet owner to directly send tokens to an address; this TransferFrom allows for a smart contract to send tokens on the wallet owners’ behalf, such as filling an order on an exchange, releasing funds in a timely manner, or paying our winnings in a game of luck.

The TransferFrom function has three input parameters, the address of the wallet owner, the address of the receiver wallet, & the amount of tokens sent. They’re often initialized in the following syntax: (address from, address to, unit tokens). The function output is exactly the same as the Transfer output: a single public boolean that details the success or failure of the transaction.

2 Likes
  1. Every programmer familiar w standard will be able to more easily understand ERC20 token or expect what base functionality it will have. Allows inter-token interaction via common functions. rpomotes best-practice.
  2. totalSupply(), balanceOf(), transfer(), approve() etc.
1 Like
  1. If the tokens are laid out in the same way, all exchanges and all wallets will be able to support the tokens from day one. Having a token standard on the Ethereum smart contract platform has been extremely beneficial for the entire space and makes the token fungible.

a. balanceOf – returns integer, balance of the account
b. transfer – takes two parameters, the to and from addresses
c. transferFrom- (delegated transfer)
d. approve- call approve address
e. allowance- returns integer - how many tokens permission to use
f. totalSupply – value of tokens in circulation

1 Like
  1. it is a standard that all wallets know, the token will get accepted and included very easily.

totalSupply function will get the information of how many tokens or coins are available
BalanceOf (adrress) function will check the other ones balance, if there are enough coins to pay?
address funtion, where you want to send your coins to

1 Like
  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?

1 Any exchanges and wallets that accept ERC20 will let you store or trade those tokens right away since the first day of their creations.
2 totalSupply how many tokens are in circulations
balanceOf How much balance that address have

1 Like
  1. you get a standardized token that anyone would be able to code for and interact with that utilizes the Eth blockchain.

  2. totalSupply() - gets total supply of token.
    balanceOf() - gets the balance of a account.
    transfer() - sends funds to another account.
    allowance() - checks how much tokens can be spent in a acoount.
    _mint() - creates new tokens to the totolSupply.

1 Like

Hello,

  1. ERC20 token standard is a standard with which the tokens are made fungible, meaning 1= any other 1 due to the account model. Being standardized, it is both easier to program with certain features and easier for third parties, for instance trading platforms, to integrate.

  2. Totalsupply allows the contract to view the total supply of tokens, balanceOf (etc address) gives the specific number of tokens of one address.

Best

1 Like
  1. The benefits of setting a token standard like ERC20 is that

  2. The 6 mandatory functions that are in the ERC20 Token Standard Interface are as follows:
    a) totalSupply() - how many tokens in circulation
    b) balanceOf()- balance of tokens in that account
    c) transfer() - moves tokens from the total supply to a person
    d) allowance() - checks that an address has enough balance to send to another address
    e) approve() - checks that a smart contract can distribute tokens based on the remaining supply
    f) transferFrom() - transfers tokens from one person to another

1 Like
  1. All new tokens that use the ERC20 token standard can easily integrate with wallets and exchanges as they have common naming conventions in their code.

name - token name
symbol - token symbol
decimals - how divisible it is
balanceOf - number of tokens in a particular address
totalsupply - total supply of the token

1 Like

The benefit is being able to have your token be identicall with many other tokens so that your token can be acsessed by wallets from the very start.

These are function defintions.
1. Function totalSupply is used to keep track of how much of the token you have.
2. Function balanceOf is used to find the specific balance of an address.
3. Function transfer is simple, you use it to transfer.

1 Like
  1. Make easy for wallets and exchabges to include new token with this standard, and allors interaction between applications. As a results, communication it’s easier and the whole system more efficient.

  2. balanceOf() -check account balance-, transfer() -to send money-, and totalSupply().

1 Like

Wallets always know how to interact with every new created token, letting the network work very efficent

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.

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    It makes dapps interoprable and enhances efficiency, especially in repeating use cases.
  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    balanceOf(): check the balance of a particular address
    transfer(): send tokens
    totalSupply(): how many tokens are in circulation
  1. By having standards, this makes smart contact(s) easily acceptable by exchanges and wallets. Because functions are set as a standard.

  2. Basic token behaviours or: total supple, balance enquiry, token ownership.

1 Like
  1. Token standards unify the way how developers are creating the tokens. By having those standards, different tokens if the same standard can be easily handled by exchanges and wallets.
  2. ERC2- Token Standard have functions like balanceOf (chancking the banalnce of the given address), totalSupply (returns the total supply of a token) and other functions that allow interaction with a smart contract controlling the token.
1 Like
  1. What are the benefits of setting a token standard like ERC20?

The exchanges and wallets will be able to support any ERC-20 token easily from day one since all look the same.

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

totalsupply() -> It tells you how many tokens there are in circulation.

balanceOf(address account)-> You get the exact balance of an address.

transfer() -> transfers a number of tokens directly from the message sender to another address.

approve() -> gives another address approval to transfer up to a certain number of tokens. The token holder uses approve() to provide this information.

transferFrom() -> transfers X tokens from A to B.

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

1 Like
  1. Token standard like ERC-20 allows for an efficient economy.
  2. An example of a function in the ERC-20 Standard Interface is “totalSupply()” - this provides uniformity and clarity.
1 Like
  1. What are the benefits of setting a token standard like ERC20?
    By following one standard, it allows exchanges and wallets to support the ERC20 tokens from day 1.
  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    Found the answer in: https://yos.io/2019/04/14/erc-standards-you-should-know-about/
    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- it allows tokens to operate in different platforms and wallets without the need for these platforms to create the infra structure for them
2- totalSupply = how many tokens are in circulation
balanceOf = address of the acc you wanna get the balance
transfer = to transfer an amount to an address

1 Like