0

This question already has an answer here:

I have just discovered that you can do both a combined smart contract that includes both the token and the crowdsale OR have the token in a separate contract from the crowdsale contract.

Can anyone tell me what the advantages are to either of these methods please?

Many Thanks,

Phil.

marked as duplicate by Mikko Ohtamaa, Achala Dissanayake, mafrasi2, mirg, Ismael May 28 '18 at 17:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

I recommend separating the two. To me, the big advantage is that it makes it easier to read and verify the token contract. The crowdsale is relatively short-lived, but many people need to be able to trust the token contract after that. Keeping the crowdsale code separate means that the token contract is much simpler (and should look nearly identical to other token contracts).

  • in your opinion, what would be the ideal separation of concerns between these two? Any resources to understand big picture/context of these two? – Chim Jan 13 '18 at 12:46
  • I think the token contract should do the minimum: keep track of balances and handle transfers. – smarx Jan 13 '18 at 16:32
1

In addition to what smarx pointed out, I also like to keep them separate. The major advantages I see is:

  • The token contract is very simple and less prone to attack in comparison to the crowdsale with enormous conditions. Since crowdsale are for short period, why keep complex logic forever.
  • Gas consumed by a function depends (indirectly )on how much code is written in the contract. So the crowdsale functions become inactive after the sale ends. But each time you transfer token, you atre funding transfer function in abi will lot of unused functions
  • Simplicity and code management is other most imp reason.

There are n number of reasons to keep these separate but also m reasons to keep them in same contract.

  • Your users don't need to confuse which address to pay and which address to add to their metamask account.
  • Some users accidentally pay to token contract instead of ICO contract. You need to handle that manually.

So there is always a trade-off. which one to choose is you business call.

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