Commit 9cc55ef2 by JU HYEONG PARK Committed by Francisco Giordano

use short circuit (#654)

parent 6979e3c8
...@@ -22,14 +22,14 @@ contract CappedCrowdsale is Crowdsale { ...@@ -22,14 +22,14 @@ contract CappedCrowdsale is Crowdsale {
// @return true if crowdsale event has ended // @return true if crowdsale event has ended
function hasEnded() public view returns (bool) { function hasEnded() public view returns (bool) {
bool capReached = weiRaised >= cap; bool capReached = weiRaised >= cap;
return super.hasEnded() || capReached; return capReached || super.hasEnded();
} }
// overriding Crowdsale#validPurchase to add extra cap logic // overriding Crowdsale#validPurchase to add extra cap logic
// @return true if investors can buy at the moment // @return true if investors can buy at the moment
function validPurchase() internal view returns (bool) { function validPurchase() internal view returns (bool) {
bool withinCap = weiRaised.add(msg.value) <= cap; bool withinCap = weiRaised.add(msg.value) <= cap;
return super.validPurchase() && withinCap; return withinCap && super.validPurchase();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment