Skip to content

Remove token.finishMinting() from default finalization#364

Merged
frangio merged 2 commits into
OpenZeppelin:masterfrom
frangio:remove-crowdsale-finish-minting
Aug 14, 2017
Merged

Remove token.finishMinting() from default finalization#364
frangio merged 2 commits into
OpenZeppelin:masterfrom
frangio:remove-crowdsale-finish-minting

Conversation

@frangio

@frangio frangio commented Aug 13, 2017

Copy link
Copy Markdown
Contributor

The default finalization implementation in FinalizableCrowdsale calls token.finishMinting(). This is orthogonal to having finalization logic. If one wants to be able to mint further tokens in the future, the default finalization function cannot be called. See decentraland/mana and how they worked around this:

cannot call super.finalization() here because it would finish minting and the continuous sale would not be able to proceed

Since we want to make sure that all contracts deriving from FinalizableCrowdsale call super.finalization(), to ensure all of the finalization logic is executed, we have to remove the call to finishMinting.

The caveat here is that if a custom finalization transfers ownership of the token to an address, that address will be able to mint tokens unless the custom logic also calls finishMinting. This is something that will come up in an audit, however.

@frangio frangio requested a review from maraoz August 13, 2017 00:47
@frangio frangio force-pushed the remove-crowdsale-finish-minting branch from bfba316 to 4fc6bb7 Compare August 13, 2017 01:02

@maraoz maraoz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, with one small question for you to consider before merging.

*/
function finalization() internal {
token.finishMinting();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't finalization be abstract now that it's empty?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it. If it's left abstract you can't call super.finalization() in the deriving contract, which we want everyone to do to make sure the whole finalization chain runs.

@frangio frangio merged commit 84a68e0 into OpenZeppelin:master Aug 14, 2017
@frangio frangio deleted the remove-crowdsale-finish-minting branch August 14, 2017 17:57
SylTi pushed a commit to SylTi/zeppelin-solidity that referenced this pull request Aug 24, 2017
pash7ka pushed a commit to pash7ka/zeppelin-solidity that referenced this pull request Aug 28, 2017
ProphetDaniel pushed a commit to classicdelta/Smart-Contracts that referenced this pull request Mar 9, 2018
…ish-minting

Remove token.finishMinting() from default finalization
ProphetDaniel pushed a commit to classicdelta/Smart-Contracts that referenced this pull request Mar 9, 2018
jinliman added a commit to jinliman/solidity that referenced this pull request Mar 27, 2018
ninjacrypto added a commit to ninjacrypto/openzeppelin-solidity that referenced this pull request Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants