A token contract is a smart contract that contains a map of account addresses and their balances. The balance represents a value that is defined by the contract creator: one token contract might use balances to represent physical objects, another monetary value, and a third the holder’s reputation. The unit of this balance is commonly called a token.
Ethereum does not deal with decimal numbers, representing all numeric values as integers. Consider the following two examples:
The first example uses License Token, a token contract that represents software license assignment for a given software product; users holding a License Token have access to the software. It makes no sense for a user to hold a fraction of a license, so the token creator sets decimals to 0.
The second example uses Gold Token, a token contract that represents ownership of physical gold. The token creator wants the unit of to represent 1 kilogram of gold, but also wants to allow users to hold and trade amounts of gold down to the gram level (but no lower).
ERC-20 token contracts come with a number of functions to allow users to find out the balances of accounts as well as to transfer them from one account to another under varying conditions.
Comment Below :
Viewers are always welcomed to comment below. We will respond to you as soon as possible.