Skip to content

dev 2.1 > dev 3.0 #521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 876 commits into from
Jan 28, 2019
Merged

dev 2.1 > dev 3.0 #521

merged 876 commits into from
Jan 28, 2019

Conversation

adamdossa
Copy link
Contributor

No description provided.

for (uint256 i = 0; i < tiers.length; i++) {
tokensMinted = tokensMinted.add(tiers[i].mintedTotal);
}
return tokensMinted;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Optimization Suggestion?
I could be wrong here but is there a logic to using tokensMinted instead of totalTokensSold? Are they not essentially the same thing? totalTokensSold only seems to be update after the STO is finaliszed. Instead there currently is an additional function that regularly calculates tokensMinted. If totalTokensSold was update as tokens were minted instead it would save the need for getTokensMinted(), which is called multiple times and recalculates each time. It could simply be replaced with totalTokensSold. This would then allow you to remove getTokensMinted() and also remove the getTokensSold() function as totalTokensSold already has a public getter.
So by adding totalTokensSold = totalTokensSold.add(tierPurchasedTokens) after tierData.mintedTotal = tierData.mintedTotal.add(tierPurchasedTokens) in the _calculateTier function I think it allows this optimization.
The finalize() function could then also be tidied up a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @F-OBrien - I've marked this as an issue to see where it can be cleaned up. The difference is meant to be the amount of tokens which were actually sold through the STO, vs. the number of tokens which have been minted (including minting back to the reserve wallet). As you say we could probably clean this up though. #535

@adamdossa adamdossa changed the title WIP: dev 2.1 > dev 3.0 dev 2.1 > dev 3.0 Jan 25, 2019
@coveralls
Copy link

coveralls commented Jan 25, 2019

Coverage Status

Coverage decreased (-1.3%) to 96.626% when pulling ea09123 on dev-3.0.0-clone into c339f52 on dev-3.0.0.

@adamdossa adamdossa requested a review from satyamakgec January 28, 2019 00:08
Copy link
Contributor

@satyamakgec satyamakgec left a comment

Choose a reason for hiding this comment

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

Everything is good.

@adamdossa adamdossa merged commit 40d5b38 into dev-3.0.0 Jan 28, 2019
@maxsam4 maxsam4 deleted the dev-3.0.0-clone branch April 9, 2019 07:07
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.