1

When ICO is finalized, I call finishMinting() to prevent from adding new tokens to totalSupply.

contract MyTokenCrowdsale is Crowdsale, MintedCrowdsale, CappedCrowdsale, TimedCrowdsale, WhitelistedCrowdsale, RefundableCrowdsale {

...

 function finalization() internal {
    if(goalReached()) {

   MintableToken _mintableToken = MintableToken(token);
   _mintableToken.finishMinting();
 }
}

However, if I want to deploy another crowdsale as a second round of ICO, I'm not sure how to set mintingFinished back to false again so people can buyToken again.

  function finishMinting() public onlyOwner canMint returns (bool) {
    mintingFinished = true;
    emit MintFinished();
    return true;
  }
  • You could just write a function unFinishMinting() that does mintingFinished = false. But I think that defeats the purpose of finishMinting. :-) – user19510 Jun 4 '19 at 2:46
  • @smarx ok. Does that mean I should block people from buying tokens from UI level as soon as the first ICO is completed and should not call finishMinting? – bbusdriver Jun 5 '19 at 4:21
  • 1
    You're the one writing the contract. I'm not sure how I'm supposed to know what you want to do, and without seeing the code for the contract, I don't even know what the current code does. But I can tell you that blocking functionality in some UI has no effect on what people can do with your contract. – user19510 Jun 5 '19 at 4:23
  • You're right, blocking it from UI would have no effect. So yeah.. I am the one writing the contract, but at the same time I am using open-zeppelin as people claim that it's the industry standard. That's why I am curious to know the reason they didn't implement a function such as unFinishMinting() as you mentioned in the comment. Because there are actually certain cases where some companies are launching a couple of ICOs with their token. Any idea how they are dealing with this case with open-zeppelin? – bbusdriver Jun 5 '19 at 4:42
  • I have no idea. If you've seen smart contracts that do that, try reading their code. – user19510 Jun 5 '19 at 4:48
1

You appear to be using an older version of OpenZeppelin. OpenZeppelin moved to a more granular system of roles in OpenZeppelin 2.0

I would suggest that you use the latest version, OpenZeppelin 2.3

Using MinterRoles gives you more flexibility e.g. you could assign your first and second crowdsales a MinterRole and then each crowdsale could renounce their MinterRole when they have finished.

The OpenZeppelin documentation on Crowdsales is a good place to start to look at some of the different options, along with documentation on Role Based Access Control

If you have more questions about OpenZeppelin you can always ask in the community forum

| improve this answer | |

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.