Browse Source

use short circuit (#654)

JU HYEONG PARK 7 years ago
parent
commit
9cc55ef2a5
1 changed files with 2 additions and 2 deletions
  1. 2 2
      contracts/crowdsale/CappedCrowdsale.sol

+ 2 - 2
contracts/crowdsale/CappedCrowdsale.sol

@@ -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();
   }
 
 }