Browse Source

rename canBuy to purchaseValid

Francisco Giordano 8 years ago
parent
commit
54d74b1c26
2 changed files with 5 additions and 5 deletions
  1. 3 3
      contracts/crowdsale/CappedCrowdsale.sol
  2. 2 2
      contracts/crowdsale/Crowdsale.sol

+ 3 - 3
contracts/crowdsale/CappedCrowdsale.sol

@@ -16,11 +16,11 @@ contract CappedCrowdsale is Crowdsale {
     cap = _cap;
     cap = _cap;
   }
   }
 
 
-  // overriding Crowdsale#canBuy to add extra cap logic
+  // overriding Crowdsale#purchaseValid to add extra cap logic
   // @return true if investors can buy at the moment
   // @return true if investors can buy at the moment
-  function canBuy() internal constant returns (bool) {
+  function purchaseValid() internal constant returns (bool) {
     bool withinCap = weiRaised.add(msg.value) <= cap;
     bool withinCap = weiRaised.add(msg.value) <= cap;
-    return super.canBuy() && withinCap;
+    return super.purchaseValid() && withinCap;
   }
   }
 
 
   // overriding Crowdsale#hasEnded to add cap logic
   // overriding Crowdsale#hasEnded to add cap logic

+ 2 - 2
contracts/crowdsale/Crowdsale.sol

@@ -67,7 +67,7 @@ contract Crowdsale {
 
 
   // low level token purchase function
   // low level token purchase function
   function buyTokens(address beneficiary) payable {
   function buyTokens(address beneficiary) payable {
-    require(canBuy());
+    require(purchaseValid());
 
 
     uint256 weiAmount = msg.value;
     uint256 weiAmount = msg.value;
     uint256 updatedWeiRaised = weiRaised.add(weiAmount);
     uint256 updatedWeiRaised = weiRaised.add(weiAmount);
@@ -91,7 +91,7 @@ contract Crowdsale {
   }
   }
 
 
   // @return true if the transaction can buy tokens
   // @return true if the transaction can buy tokens
-  function canBuy() internal constant returns (bool) {
+  function purchaseValid() internal constant returns (bool) {
     uint256 current = block.number;
     uint256 current = block.number;
     bool withinPeriod = current >= startBlock && current <= endBlock;
     bool withinPeriod = current >= startBlock && current <= endBlock;
     bool nonZeroPurchase = msg.value != 0;
     bool nonZeroPurchase = msg.value != 0;