Skip to content

Commit

Permalink
Merge pull request #11 from OpenSTFoundation/benjaminbollen/ch112/cor…
Browse files Browse the repository at this point in the history
…rect-hassaleended

correct hasSaleEnded
  • Loading branch information
acote88 committed Nov 4, 2017
2 parents 819ae89 + e501989 commit ac1b56c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions contracts/TokenSale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,18 @@ contract TokenSale is OpsManaged, Pausable, TokenSaleConfig { // Pausable is als


function hasSaleEnded() private view returns (bool) {
if (totalTokensSold >= TOKENS_SALE || currentTime() >= endTime || finalized) {
// if sold out or finalized, sale has ended
if (totalTokensSold >= TOKENS_SALE || finalized) {
return true;
// else if sale is not paused (pausedTime = 0)
// and endtime has past, then sale has ended
} else if (pausedTime == 0 && currentTime() >= endTime) {
return true;
// otherwise it is not past and not paused; or paused
// and as such not ended
} else {
return false;
}

return false;
}


Expand All @@ -235,7 +242,7 @@ contract TokenSale is OpsManaged, Pausable, TokenSaleConfig { // Pausable is als
function updateWhitelist(address _account, uint8 _phase) external onlyOps returns (bool) {
require(_account != address(0));
require(_phase <= 2);
require(!finalized);
require(!hasSaleEnded());

whitelist[_account] = _phase;

Expand Down

0 comments on commit ac1b56c

Please sign in to comment.