Conversation
* Initial optimization * Tests fixed * comments removed * Make some functions external
| } | ||
| return tokensMinted; | ||
| } | ||
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
No description provided.