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,100 points
1,437 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,400 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,100 points
984 views
0 votes
0 answers
+1 vote
1 answer

Can we copy a smart contract?

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

answered Apr 7, 2018 in Blockchain by Christine
• 15,790 points
2,135 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 18, 2018 in Blockchain by sapan
1,163 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
1,923 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
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 8, 2018 in Blockchain by Shashank
• 10,400 points
683 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP