use short circuit (#654)
This commit is contained in:
committed by
Francisco Giordano
parent
6979e3c83a
commit
9cc55ef2a5
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user