- It’s easier for communication, more efficient when everyone has the same standard
- The ERC20 Token Standard allows wallets to provide token balances for hundreds of different tokens, exchanges can list many different tokens by only providing nothing more than the address
1
Standardization on ERC20 make these tokens simpler to deploy and very compatible with each other and within the blockchain it self for example any wallet on ERC20 can support all of ERC20 tokens because of standardization on ERC20.
2
totalSupply()
Gives how many token are in circulation
balanceOf(address account)
For getting the balance of an address ,you will get amount of token that address have
transfer()
Move tokens to recipient address
Homework on ERC20 token standard.
- What are the benefits of setting a token standard like ERC20?
- What functions are in the ERC20 Token Standard Interface and what do they do?
Answers:
1/ The benefits of setting a token like ERC-20 is that it Allows Wallets , Exchanges to be easily recognized as standard code from Ethereum Token.
2/ There are a multiple Functions in the ERC20 tokens standard for example
“balanceOf” Can gives balance of specific amount total supply or the coins as fungible token.
‘‘transfer()’’ Allows someone to transfer their ERC20 tokens to another public address.
''balanceOf ‘’ Gives available token balance for an account.
It makes easier to recognized a ERC20 by it Standard code build on Ethereum.
ERC20 Token standard- Homework
1- The main benefit is that all tokens built on that standard will have the same properties and features and so they will be interchangeable and fungible
2- “Total supply” will get the total supplyu of the token/currency in the market
“Balance Of” will get the balance of a coin in a wallet, exchange, address…
“Transfer” will set the amount to transfer in a transaction.
- What are the benefits of setting a token standard like ERC20?
It’s easier to build a collaborative network by using a standardised code to put projects on top of a platform
- What functions are in the ERC20 Token Standard Interface and what do they do?
“totalsupply()” shows the maximum supply of an asset.
“balanceOf()” displays a wallets balance and the “transfer()” function is to transfer assets from one wallet to another.
The “transfer()” is also a variable function with sub functions that can be applied to suit different conditions of transactions.
So can the transfer function be extended with something like “approve” “transferFrom” etc.
-
ERC20 defines a common interface for contracts implementing tokens. Any compatible token can be accessed and used in the same way. It’s a standard for fungible tokens meaning that different units of ERC20 token are interchangeable and have no difference. The main purpose of the standard is to promote interoperability. All wallets, exchanges and user interfaces can operate predictably with any contract that follows the specification.
-
Required ERC20 Interface functions that must be provided, brief descriptions are-
totalSupply - Returns the total units of this token that currently exist.
balanceOf - Returns the token balance of that address.
transfer - Transfer the amount of tokens to that address.
transferFrom - Transfer one account to the other.
approve - authorize the address to execute a transfer to a recipient.
allowance - returns the remaining amount that a spender is approved to withdraw from the owner.
This is a brief definition of ERC20 functions and excludes any call parameters.
- everyone talks the same language, way easier for all.
2.Alot of different functions like total supply, or balance, and that’s exactly what they do, get you the balance of an adress or the total supply for a token.
- All ERC20 tokens can integrate with exchange wallets when using the same standards making it simpler and improve scalability while reducing friction in the space.
- “total supply” = Gives number of tokens in circulation.
“balanceOf9addressaccount” = Provides balance of an individual account when given the account address.
“transfer()” = used to send tokens from one account/wallet to another.
-
It increases fluidity, ensuring that developers, exchanges, traders, and other currency owners are speaking the same ‘language’. If the standard of tokens did not exist then there would be a huge number of issues and friction, meaning, for example: because of an unusual protocol, wallets would struggle to show the owners how much of a particular token they had in their possession—slowing down trade and leading to confusion. The whole crypto space would suffer without a recognised and ubiquitous standard.
-
balanceOf () – provides the number of tokens held by a given address; transfer () – sends tokens from one user to another; approve () – enables the smart contract to transfer a certain number of tokens from the allowance as part of its operation; allowance () – provides the number of tokens allowed to be transferred from one address to another.
-
All exchanges and wallets can support any tokens in the ERC20 standard everything is interoperable.
-
function totalSupply() returns the number of tokens that exist, the total supply basically
function balanceOf() returns the balance of an account
function transfer() sends some amount of tokens to an address
function approve() gives an address an approval to transfer some amount of tokens
function allowance() returns which address has been given approval of using some amount of tokens
What are the benefits of setting a token standard like ERC20?
Having all the tokens under the same standard grants all wallets the possibility to store them under the same application. Since they are built on top of Ethereum, the network also can interpret them as the programing language is also the same.
What functions are in the ERC20 Token Standard Interface and what do they do?
Some of the functions that are the same are:
- totalsupply() - list all tokens in circulation
- transfer () - to transfer funds between wallets
- balanceOf () - to check the balance of a wallet
[quote=“filip, post:1, topic:8440”]
Homework on ERC20 token standard.
- What are the benefits of setting a token standard like ERC20?
If a token has been done by the ERC20 standard have the possibility to talk to other currencies or tokens. - What functions are in the ERC20 Token Standard Interface and what do they do?
Total Supply function: it tells you how many tokens are in circulation.
BalanceOf Function: it tells you the balance of a specified account
What are the benefits of setting a token standard like ERC20?
All tokens taht are made can be listed on exchanges instantly and they are standardized
What functions are in the ERC20 Token Standard Interface and what do they do?
Total Supply
Transfer of tokens
Burn tokens
Name of token
-
The benefits of using standard tokens are:
Creating new tokens becomes easier
Tokens will be able to interact with each other
Tokens will be accepted by wallets and exchanges by default -
totalsupply() defines the number of tokens available
balanceof() The number of tokens a specific address has
- When a programming standard is used, mass adoption by wallets and exchanges is possible from day one of the release. We also use the same naming convention in the code.
2.function totalsupply- this shows total supply of tokens
function balanceOf- this shows the balance of tokens in address
-
The benefits of setting such a token standards are that it allows for all wallets to interact with erc 20 tokens in the same way. This allows for a formality between all erc 20 tokens and even makes it possible for them to be interoperable as they are built with the same structure.
-
balanceOf() allows for you to check the balance of a particular address
transfer() allows for tokens to be transfered to another address
approve() this gives another account permission for allowance to be transferred
transferFrom() this is used to transfer allowance from another account to yours
doSomething() is used to perform a set of instructions
allowance() sets the amount of tokens to be allowed as allowance to another address
1)What are the benefits of setting a token standard like ERC20?
Increases efficiency in the market, as new token creators know their produce can be understood, deployed and built upon without obstacles arising from different standards. Speeds up progress and inspires confidence and creativity.
2)What functions are in the ERC20 Token Standard Interface and what do they do?
Total supply = enacted by each exchange to determine how many tokens are in circulation.
balanceOf = when an exchange, or your wallet wants to check the balance of an amount of tokens you have
Transfer () = Allowing the transfer of a Specified number of tokens directly from The token holders address to another address.
Approval () Can be set up by a token holder, to give authority toa particular address to withdraw certain funds
allowance () is an amount a token holder will allow a smart contract to release to another’s address.
Transfer from () allows the recipient to specify the token holders address as the account to transfer from
1. What are the benefits of setting a token standard like ERC20?
It allows any tokens on Ethereum to be re-used by other applications: from wallets to decentralized exchanges.
2. What functions are in the ERC20 Token Standard Interface and what do they do?
Functions allow users to find out the balances of accounts as well as to transfer them from one account to another under varying conditions.
name
Returns the name of the token - e.g. "MyToken"
.
OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.
function name() public view returns (string)
symbol
Returns the symbol of the token. E.g. “HIX”.
OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.
function symbol() public view returns (string)
decimals
Returns the number of decimals the token uses - e.g. 8
, means to divide the token amount by 100000000
to get its user representation.
OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.
function decimals() public view returns (uint8)
totalSupply
Returns the total token supply.
function totalSupply() public view returns (uint256)
balanceOf
Returns the account balance of another account with address _owner
.
function balanceOf(address _owner) public view returns (uint256 balance)
transfer
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.
Note Transfers of 0 values MUST be treated as normal transfers and fire the Transfer
event.
function transfer(address _to, uint256 _value) public returns (bool success)
transferFrom
Transfers _value
amount of tokens from address _from
to address _to
, and MUST fire the Transfer
event.
The transferFrom
method is used for a withdraw workflow, allowing contracts to transfer tokens on your behalf. This can be used for example to allow a contract to transfer tokens on your behalf and/or to charge fees in sub-currencies. The function SHOULD throw
unless the _from
account has deliberately authorized the sender of the message via some mechanism.
Note Transfers of 0 values MUST be treated as normal transfers and fire the Transfer
event.
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)
approve
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
.
NOTE : To prevent attack vectors like the one described here and discussed here, clients SHOULD make sure to create user interfaces in such a way that they set the allowance first to 0
before setting it to another value for the same spender. THOUGH The contract itself shouldn’t enforce it, to allow backwards compatibility with contracts deployed before
function approve(address _spender, uint256 _value) public returns (bool success)
allowance
Returns the amount which _spender
is still allowed to withdraw from _owner
.
function allowance(address _owner, address _spender) public view returns (uint256 remaining)
Events
Transfer
MUST trigger when tokens are transferred, including zero value transfers.
A token contract which creates new tokens SHOULD trigger a Transfer event with the _from
address set to 0x0
when tokens are created.
event Transfer(address indexed _from, address indexed _to, uint256 _value)
Approval
MUST trigger on any successful call to approve(address _spender, uint256 _value)
.
event Approval(address indexed _owner, address indexed _spender, uint256 _value)
What are the benefits of setting a token standard like ERC20?
Setting a token standard like ERC20 make the whole community be able to communicate in the same way because they are build using the same functions.
What functions are in the ERC20 Token Standard Interface and what do they do?
totalSupply() = give you how many token are in the circulation
balanceOf() = get to know the account balance on a particular address
- What are the benefits of setting a token standard like ERC20?
Standardization allows in place supports (such as wallets) to be able to instantly interface and transact with any ERC20 token without having to adopt or integrate new/different standards and functions. (they can all be native to the same applications).
- What functions are in the ERC20 Token Standard Interface and what do they do?
information about the token:
name
of the token contract is the long name by which the token contract should be known
symbol
of the token contract is the symbol by which the token contract should be known, it is usually 3 or 4 characters in length
decimals
value is the number of digits that come after the decimal place when displaying token values on-screen
totalsupply
equals the sum of all balances.
actions:
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 (without checks, commonly used in minting new tokens (from 0), and in burning tokens (to 0))
approve()
function provides an address (usually of a smart contract) approval to transfer up to a certain number of tokens (an allowance)
allowance()
function provides the number of tokens allowed to be transferred from a given address by another given address
transferFrom()
function to allow the smart contract to take up to the allowed number of tokens from a user’s allowance as part of the contract’s operation