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?
1 Answer
Simple Answer:
Yes. Smart contract can have a balance of ethers as well as tokens. Tokens balances are just mapping of address to balance and hence any valid ethereum address can have ethers as well as tokens.
But do keep in mind that to spend Ethers/Token you need private keys associated with address in which your ethers/tokens exist. But contract addresses (unlike EOAs) do not have private keys associated with them. The contract code is responsible for all the executions. So do keep a method by which you may retrieve tokens from smart contract.
-
Hello. Could you please clarify, do you mean method in token smart contract or method in contract that holds token?– OroffeApr 8, 2020 at 22:56