Skip to content

Commit

Permalink
use short circuit (OpenZeppelin#654)
Browse files Browse the repository at this point in the history
  • Loading branch information
4000D authored and frangio committed Jan 19, 2018
1 parent 6979e3c commit 9cc55ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contracts/crowdsale/CappedCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ contract CappedCrowdsale is Crowdsale {
// @return true if crowdsale event has ended
function hasEnded() public view returns (bool) {
bool capReached = weiRaised >= cap;
return super.hasEnded() || capReached;
return capReached || super.hasEnded();
}

// overriding Crowdsale#validPurchase to add extra cap logic
// @return true if investors can buy at the moment
function validPurchase() internal view returns (bool) {
bool withinCap = weiRaised.add(msg.value) <= cap;
return super.validPurchase() && withinCap;
return withinCap && super.validPurchase();
}

}

0 comments on commit 9cc55ef

Please sign in to comment.