From 54d74b1c265ce29c35a19b81c13dd6f6f3587cdd Mon Sep 17 00:00:00 2001 From: Francisco Giordano Date: Fri, 30 Jun 2017 17:54:26 -0300 Subject: [PATCH] rename canBuy to purchaseValid --- contracts/crowdsale/CappedCrowdsale.sol | 6 +++--- contracts/crowdsale/Crowdsale.sol | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts/crowdsale/CappedCrowdsale.sol b/contracts/crowdsale/CappedCrowdsale.sol index 8e9f58b8f..8b8ed82f8 100644 --- a/contracts/crowdsale/CappedCrowdsale.sol +++ b/contracts/crowdsale/CappedCrowdsale.sol @@ -16,11 +16,11 @@ contract CappedCrowdsale is Crowdsale { 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 - function canBuy() internal constant returns (bool) { + function purchaseValid() internal constant returns (bool) { bool withinCap = weiRaised.add(msg.value) <= cap; - return super.canBuy() && withinCap; + return super.purchaseValid() && withinCap; } // overriding Crowdsale#hasEnded to add cap logic diff --git a/contracts/crowdsale/Crowdsale.sol b/contracts/crowdsale/Crowdsale.sol index 84548951b..7e071f11e 100644 --- a/contracts/crowdsale/Crowdsale.sol +++ b/contracts/crowdsale/Crowdsale.sol @@ -67,7 +67,7 @@ contract Crowdsale { // low level token purchase function function buyTokens(address beneficiary) payable { - require(canBuy()); + require(purchaseValid()); uint256 weiAmount = msg.value; uint256 updatedWeiRaised = weiRaised.add(weiAmount); @@ -91,7 +91,7 @@ contract Crowdsale { } // @return true if the transaction can buy tokens - function canBuy() internal constant returns (bool) { + function purchaseValid() internal constant returns (bool) { uint256 current = block.number; bool withinPeriod = current >= startBlock && current <= endBlock; bool nonZeroPurchase = msg.value != 0;