IncPriceCrowdsale consistently returns 0 outside of the crowdsale window. (#1442)

(cherry picked from commit 9155bfe27f)
This commit is contained in:
Nicolás Venturo
2018-10-18 16:36:27 -03:00
committed by Leo Arias
parent 6e055019d4
commit 2e848e12d1
2 changed files with 13 additions and 0 deletions

View File

@ -47,6 +47,10 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
* @return The number of tokens a buyer gets per wei at a given time
*/
function getCurrentRate() public view returns (uint256) {
if (!isOpen()) {
return 0;
}
// solium-disable-next-line security/no-block-members
uint256 elapsedTime = block.timestamp.sub(openingTime());
uint256 timeRange = closingTime().sub(openingTime());