简体   繁体   中英

In Ethereum blockchain does smart contract can have token balance

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?

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; PS format is the same, but the way they are calculated is different! ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM