Having standard codes allows wallets, exchange, nodes to speak and operate compatibly.
balanceOf - shows account balanve
totalSupply - supply of tokens
Having standard codes allows wallets, exchange, nodes to speak and operate compatibly.
balanceOf - shows account balanve
totalSupply - supply of tokens
*** What are the benefits of setting a token standard like ERC20?**
One beneift is that you can have the same code performing the same functions in all the tokens smart contracts so they are easily used across different platform like wallets, exchanges etc.
*** What functions are in the ERC20 Token Standard Interface and what do they do?**
Transfer funds, approve transfers, check account balances âŚ
transfer designates number of tokens to be sent balanceOf details wallet balance. I dont know what totalsupply does.
Using ERC20 standard defines how we program tokens on the etherium network. All ERC20 tokens have the same functions in the code, so they can communicate no matter what the application used.
balanceOf - balance of given address
totalSupply - Total number of tokens
What are the benefits of setting a token standard like ERC20?
To easily interoperate with each other and streamline the process. This way there is a more efficient platform to work on.
What functions are in the ERC20 Token Standard Interface and what do they do?
totalsupply() - to set a total supply of tokens, the sum of all balances
balanceOf() - retrieve account information such as account and balance.
transferFrom() - gives approval for another address to transfer a certain number of tokens.
approve() - the token uses this function to provide information to allow for the transfer of tokens.
1- Increase of efficiency .It can be used by all wallets, exchanges, platforms 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.
2- Functions are :
totalSupply() The total supply of the token.
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.
allowance() provides the number of tokens allowed to be transferred from a given address by another given address
What are the benefits of setting a token standard like ERC20?
That there are set functions and rules that the community must follow so that thereâs minimum friction and interoperability with other tokens.
What functions are in the ERC20 Token Standard Interface and what do they do?
totalSupply(): sets the total amount of tokens that can be minted.
balanceOf(): retieves the balance of the address provided.
mint()/burn(): creates/destroys tokens.
transfer(): transfer tokens to a given address.
2. What functions are in the ERC20 Token Standard Interface and what do they do?
Yes sir(s), but could you please describe what those functions do?
If you have any doubt, please let us know so we can help you!
Carlos Z
2. What functions are in the ERC20 Token Standard Interface and what do they do?
Yes miss, but could you please describe what those functions do?
If you have any doubt, please let us know so we can help you!
Carlos Z
The totalsupply function will return the amount of tokens that are currently on demand, or the total amount of tokens that exist in the market.
Carlos Z.
Hello Carlos,
Thanks for commenting :).
I donât quite understand your point ? the functions do what it says: get an accountâs address, check the amount of a balance, enquire about transfer information, check the total balance of a tokenâs supply -
or am I missing something?
The balanceOf()
function provides the number of tokens held by a given address. Note that anyone can query any addressâ balance, as all data on the blockchain is public.
There are two ways to send tokens from one address to another. The transfer()
function transfers a number of tokens directly from the message sender to another address. Note that there are no checks made on the recipient address, so it is incumbent on the sender to ensure that the recipient is as intended.
Although transfer()
is fine for sending tokens from one user to another it doesnât work so well when tokens are being used to pay for a function in a smart contract. This is because at the time the smart contract runs it has no access to details of which addresses transferred funds where and so cannot assert that the user calling the contract has paid the required amount of funds to operate the contract.
Imagine that there is a contract Doer
deployed on the network. Doer
has a function doSomething()
that requires 10 Do
tokens to operate. Joe wants to call doSomething()
and has 50 Do
tokens in his account. How can Joe pay Doer
so that it can run doSomething()
successfully?
approve()
and transferFrom()
are two functions that allow the above scenario to work using a two-step process. In the first step a token holder gives another address (usually of a smart contract) approval to transfer up to a certain number of tokens, known as an allowance. The token holder uses approve()
to provide this information.
The allowance()
function provides the number of tokens allowed to be transferred from a given address by another given address. Note that anyone can query any addressâ allowance, as all data on the blockchain is public. It is important to understand that allowances are âsoftâ, in that both individual and cumulative allowances can exceed an addressâ balance. In the approval table shown above, for example, the holder 0x2299âŚ3ab7 has approved a transfer of up to 500 tokens but their balance as seen previously is only 90 tokens. Any contract using allowance()
must additionally consider the balance of the holder when calculating the number of tokens available to it.
The benefits of setting a token standard like ERC20 is that everything can easily integrate creating a more efficient environment with no friction and economies/interactions can perform better.
Functions that are in the ERC20 Token Standard interface perform crucial roles that allow users to carry out a number of different uses. There are multiple functions for example;
total supply() to know the total supply of tokens in circulation,
balanceOf() provides the number of tokens held by an address,
transfer() how you send tokens,
approve()/ transferFrom() are used in a two step process,
allowance() the number of tokens allowed to be transferred from a given address by another given address.
totalsupply() = Gives the total number of tokens in circulation.
balanceOf() = Gives balance of a specific account
Hope this answers your question properly ?
makes common operations callable in the same way for all tokens
balanceOf(address) get balance of given address. totalSupply() gets total circulating supply of token.