Can smart contract have token balance?

0 votes

There are two accounts in ethererum: The 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?

May 31, 2018 in Blockchain by Perry
• 17,020 points
68 views

1 answer to this question.

0 votes

Smart contracts can receive and send tokens just like 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!). in ERC20 basic token there already is function balanceOf(address _owner). It returns balances[_owner]

answered May 31, 2018 by Shashank
• 10,350 points

Related Questions In Blockchain

0 votes
1 answer

Can I swap an ERC-20 token with a Neo NEP5 token using a smart contract?

Every Blockchain has a separate administration. So, it ...READ MORE

answered Jun 4, 2018 in Blockchain by Perry
• 17,020 points
92 views
+1 vote
1 answer

Can we copy a smart contract?

While the contract is open-source, if you ...READ MORE

answered Apr 6, 2018 in Blockchain by Christine
• 15,790 points
70 views
+1 vote
2 answers

Can I include real world data in a smart contract? If so, how?

You cant access/embed real world data using ...READ MORE

answered Jul 17, 2018 in Blockchain by sapan
71 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
169 views
0 votes
1 answer
0 votes
1 answer

Can a hacker change data of a smart sontract without call contract function?

A contract's content cannot be changed internally. ...READ MORE

answered Apr 7, 2018 in Blockchain by Shashank
• 10,350 points
33 views
0 votes
1 answer