This might be a very general question, though I'd like if someone could clarify on how to within a crowdsale contract use an already deployed token contract with a fixed supply. I know how to create a mintable token internally from the crowdsale contract but I've never played around with an existing token though. Thank you
solidity – Crowdsale with Existing Token
contract-designcontract-developmentsolidity
Best Answer
On your crowd sale contract, import the ERC20 interface and then code your smart contract to allow an ERC20 token to be set.
Now your crowd sale contract can call
_myToken.balanceOf(this);
to get the number of tokens it owns, and_mytoken.transfer(address, count);
to distribute tokens according to whatever your desired crowdsale logic is.So now all you need to do is transfer some or all of your minted tokens to the crowdsale contract address and you're ready to go.