poanetwork / token-wizard

(Discontinued) TokenWizard is an DApp to create and manage crowdsale and token contracts using a simple UI
MIT License
386 stars 215 forks source link

(Fix) Replace getCurrentTierInfo with getCrowdsaleTier for minted capped strategy #1012

Closed vbaranov closed 6 years ago

vbaranov commented 6 years ago

Problem: getCurrentTierInfo(...) function for minted capped crowdsale strategy strongly depends on block.timestamp, so, it changes not continuously. This leads returning of incorrect data for a tier until new block will be issued.

Solution: Instead, the suggestion is to add a function, that will calculate the current tier index (by iterating through getTierStartAndEndDates data for every tier) and then will call getCrowdsaleTier function with this index

Note: The number of tiers can be retieved with getTiersLength function