Reputation: 61
In Ethereum we have 2 different types of account Externally owned accounts (EOAs) and Contract accounts . EOA's can have balance of ether and tokens . smart contract can have balance of ether, but can they have balance of tokens? I have created ERC 20 token , can i send this tokens to other smart contract?
Upvotes: 0
Views: 1123
Reputation: 1008
Yes, smart contracts can receive and send tokens as a normal accounts.
There is mapping which is usually called balances
in token smart contract (ERC20). It looks like address => uint balance
where address
has the same format both for account and smart contract addresses (basicaly address
is just a sequence of 20 bytes in hexadecimal; P.S. format is the same, but the way they are calculated is different!).
Upvotes: 1