What are the benefits of setting a token standard like ERC20?
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. Moreover 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.
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.