1

I know we can create a token contract and also we can create a ico contract. Is it possible to create a contract include ICO and Token itself? any idea or example?

1

You can do this, but best practices suggest that you keep these two contracts independent of each other.

OpenZeppelin recommends splitting the contracts(see the first recommendation under the Medium Severity section).

The idea is that you will use the token for more than just the ICO, so you want a pure token contract, rather than one that is associated with an ICO.

  • 1
    if I split them how can investers transfer tokens from ICO to main contract? – m3hdi Nov 27 '18 at 15:38
  • So you will have a token contract that creates the tokens and distributed them to the ICO contract. From there, investors would put money into the ICO contract and receive the tokens (from that contract) in return. They are now free to transfer them to other contracts. I am not sure what you mean by "main" contract. – shane Nov 27 '18 at 15:40
  • 1
    Senario: I have a main contract (token contract) that is my token (for example just like BinanceCoin), users could send/recieve, exchange it. I also want to start an ICO that offer my own token (BinanceCoin), so investors buy it at limited time with Ether. If I make these two contracts, they are seperated right? I mean someone bought BinanceCoin in ICO can not spend it in main token chain? or I am wrong!? – m3hdi Nov 27 '18 at 15:49
  • Both contracts are on the main chain. You can think of them as independent. You create the token and now the token (and it's contract) are live on the main network. If you want to do an ICO, you can create the ICO contract and send tokens into it so that people can invest Ether and receive your token. The token contract still exists on the main chain and the token can still be used with more contracts than just the ICO. – shane Nov 27 '18 at 16:51
  • but contract addresses are not same – m3hdi Nov 27 '18 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.