Homework: ERC20

Homework on ERC20 token standard.

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

Using a standard enables all developers to code under the same rules. This allows all participants of the network to create fully compatible tokens so that exchanges can easily add and give support to.

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

  • totalSupply() gives the total supply of the token.

  • balanceOf() gives the balance of a specific address as output

  • allowance() gives as output, the number of tokens allowed to be transferred from a given address

  • transfer() 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 the address of the sender, the address of the receiver, as well as the number of tokens to be transferred. Also gives an output of the success or failure of the transfer.

1 Like
  1. The benefits of setting a token standard like ERC20 is that programming becomes more efficient and easily readable by programmers and software.

  2. The functions that are in the ERC20 Token Standard Interface and what do they do are:

function totalSupply() public view returns (uint256);
The number is total supply of the token.

function balanceOf(address tokenOwner) public view returns (uint);
Takes the address of the owner as the input and gives the balance of the owners account as output.

function allowance(address tokenOwner, address spender) public view returns (uint);
Takes in the address of the token owner and the spender, gives it as output, the number of tokens allowed to be transferred from a given address by another given address.

function transfer(address to, uint tokens) public returns (bool);
Takes in the address of the receiver and the funds which are to be sent to the account

function approve(address spender, uint tokens) public returns (bool);
You can approve another to spend from your account.

function transferFrom(address from, address to, uint tokens) public returns (bool);
Takes in three inputs: The address of the sender, the address of the receiver and the number of tokens that will be transferred, then gives an output of success or failure of the transfer.

1 Like

1-> example of benefits to setting a token standard like ERC20 are;

  • that exchanges and wallets can support token standards like ERC20 from day one
  • clearity or guideline (standard) for developers to develope tokens

2-> Some of the following Functions in the ERC20 Token Standard Interface are;

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

You can build on top of it and don’t have to worry about it’s implementation again when creating a new token, which is a smart contract. Also you can expect it, when trying to communicate with the token allowing interoperability.

Standardized operations such as checking an accounts balance, sending money, allowing another contract to initiate a transactions for an account.

  1. What are the benefits of setting a token standard like ERC20?
    The benefits of ERC20 that it’s a standard we can all build application on it, and they can talk to each other.

  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    Functions are:
    totalSupply indicate how many tokens are in circulation.
    balanceOf () indicate how many tokens are available in a balance of a given address.
    transfer () to send tokens from one address to another.
    allowence () provide the number of tokens allowed to be transferred to a given address by another address.

1 Like

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

Yes sir, but could you please describe what those functions do?

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

Carlos Z.

ok…
BalanceOf() : Argument: address; gives the balance in of an account followed by the smart contract.
totalSupply(): No argument, gives the total Supply of the token. May or may not be immutable (I don’t know how this is set for a token)
transfer(): orders smart contract to transfer from the account of the caller to another account
allowence(): Allows smart contract to transfer funds from callers account using another function for example transferfrom()

1 Like
  1. What are the benefits of setting a token standard like ERC20?
    Code reusability, can interact with every token that adheres to the standard in exactly the same way.
  2. What functions are in the ERC20 Token Standard Interface and what do they do?
    transfer() - moves the number of tokens from function caller to recipient
    transferFrom() - moves the number of tokens from sender to recipient, using the allowance mechanism
    balanceOf() - returns number of tokens owned by the address
    approve() - set the amount the sender is allowed to transfer
    totalSupply() - returns the total number of tokens of this type
    allowance() - returns the number of tokens that the spender will be allowed to spend on behalf of owner
1 Like
  1. Having a Token standard like ERC20 promotes interoperability between the tokens in the network, and that compatibility results in a more efficient economy in which new tokens are fully integrated right after deployment

  2. Some examples of functions that are part of the ERC20 token standard are: totalSupply, where the total circulating supply of the deployed token is defined; balanceOf, a function that returns the balance of a given address; transfer; etc

1 Like
  1. Setting a token standard makes it easier for exchanges and wallets to support them.
  2. ‘balanceOf’ states the number of tokens held by a given address.

‘totalsupply’ states the sum of all balances in the smart contract.

‘transfer’ enables token(s) to be transferred from one address to another.

For transfer of token(s) to operate a function in a contract, the functions ‘approve’ (which allows withdrawal from address for a specific amount) and ‘transferFrom’ are being used.

1 Like

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

The benefits of setting a token standard such as ERC20 are (a) instant wallet and exchange compatibility where this standard is supported and (b) harmonization across development standards, where for example standard functions can be invoked using the same vocabulary. The other benefit is the ERC20 provides fungibility where tokens need to be treated identically e.g. as cryptocurrency units for the purposed of value transfer and calculation of the value of one’s balance.

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

The functions in the ERC20 Token Standard Interface include:

function totalSupply() - which can be called just to give you the number of tokens in circulation for that particular ERC20
function balancOf(address account) - which can be used (e.g. by wallets) to check the balance of how many of these particular ERC20 tokens is held by a particular address

Others include function transfer() and function allowance (), among yet several others, which are not covered in any further detail here in this particular course.

(Which is fine because I will have to learn them in the Solidity sections of the developer Bootcamp anyway!)

1 Like

1.Compatibility across wallets and exchanges from the start, fungibility.
2. Examples are totalSupply (total number of tokens) and balanceOf (checking balance of particular address).

2 Likes
  1. All ERC20 tokens conform to a single standard e.g. total supply, balance etc… This enables interoperability within the Ethereum ecosystem, enables wallets to show balances of any ERC20 standard token and provides ease for exchanges to list the tokens as they only need to provide the address of the token’s contract.

  2. balanceof() takes an address and returns the balance of that particular address. totalsupply() sums the total number of tokens held by all wallets. approve() is used to provide a cap on the balance of how many funds a smart contract is allowed to take from the holder’s wallet when accessing a function. transfer() is for sending funds from one address to another etc…

1 Like
  1. For efficiency. To have a common base/guidelines for launching an ERC20 token. Like a common foundation to build on.
  2. balanceOf(account address) - returns the account balance of that address
    totalSupply() - returns the total token supply.
    transfer() - send tokens to another address.
2 Likes
  1. Creating a standard like ERC20 build a friction-less environment which everyone can take part in easily.

  • allowance() takes in both addresses and gives out the amount available to be transferred between them.

  • approve() approve fund to be spent

  • balanceOf() gives the balance of the input address

  • totalSupply() total supply of the token

  • transfer() sends funds from one address to another.

2 Likes

Standards make it possible for the whole space to communicate to each other. Communication is frictionless and things are more efficient. If a wallet can handle one ERC20 token, it can handle all ERC20 tokens. This has propelled the industry further.

Some functions: The function totalSupply tells how many tokens there are in circulation.
balanceOf is used to get the balance of a particular address-
function transfer is used for transferring tokens.

2 Likes
  1. It makes it easier for wallets, exchanges and other companies to interact with it because er is a standard that they.
    can calculate on. When everyone does there own kind of token everyone it will be unnecessary complicated

Name: This one is for the name of the token
Symbol: This one is for the tikker
Decimals: how many numbers after the dot
Total supply: How much coins there are.
BallanceOf: How much tokens in a given address
Transfer: This function send tokens from 1 address to a other
Dosomething: The function that a smart contract most do
Approve: is for the token holder to approve the action for do something
transferfrom: is to transfer the tokens to do(pay) the action
allownece: function 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?

Due to standards new applications/tokens can easily be implemented in a way that the can interact.

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

e.G. functions like “totalSupply()” gives maximum number of existing tokens or “balanceOf(address of account)”, which returns the balance of a certain account

1 Like
  1. Makes everything standardize allowing function with same names and standards.
  2. Total Supply, Balance of addresss, transfer and allowance.
  • What are the benefits of setting a token standard like ERC20?

Increases the efficiency of the Ethereum ecosystem by facilitating interaction with and between smart contracts. Since all ERC-20 smart contracts use the same definitions for their basic functions, we can create more generalized systems that can interact with all ERC-20 compliant tokens, instead of having to tailor interactions on a token to token basis. This allows, for example, for exchanges to list any ERC-20 token by providing nothing more than the token’s contract address, wallets to display balances of all ERC-20 tokens, etc. It also increases transparency and fosters cooperation - as all Solidity devs are familiar with the ERC-20 standard, they can get an overview of the basic properties of a token at a glance instead of having to dive into unfamiliar code. This can be useful when auditing a smart contract, joining an existing ERC-20 project, etc.

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

balanceOf() - Returns the number of tokens held by an address.

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

transferfrom() - Transfers a number of tokens from address a to address b

approve() - Approves smart contract to transfer x amount of tokens from the message sender.

allowance() - Returns how many tokens the ownerAddress has allowed the spenderAddress to spend.

2 Likes