rename purchaseValid to validPurchase
This commit is contained in:
@ -16,11 +16,11 @@ contract CappedCrowdsale is Crowdsale {
|
|||||||
cap = _cap;
|
cap = _cap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// overriding Crowdsale#purchaseValid 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 purchaseValid() internal constant returns (bool) {
|
function validPurchase() internal constant returns (bool) {
|
||||||
bool withinCap = weiRaised.add(msg.value) <= cap;
|
bool withinCap = weiRaised.add(msg.value) <= cap;
|
||||||
return super.purchaseValid() && withinCap;
|
return super.validPurchase() && withinCap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// overriding Crowdsale#hasEnded to add cap logic
|
// overriding Crowdsale#hasEnded to add cap logic
|
||||||
|
|||||||
@ -68,7 +68,7 @@ contract Crowdsale {
|
|||||||
// low level token purchase function
|
// low level token purchase function
|
||||||
function buyTokens(address beneficiary) payable {
|
function buyTokens(address beneficiary) payable {
|
||||||
require(beneficiary != 0x0);
|
require(beneficiary != 0x0);
|
||||||
require(purchaseValid());
|
require(validPurchase());
|
||||||
|
|
||||||
uint256 weiAmount = msg.value;
|
uint256 weiAmount = msg.value;
|
||||||
uint256 updatedWeiRaised = weiRaised.add(weiAmount);
|
uint256 updatedWeiRaised = weiRaised.add(weiAmount);
|
||||||
@ -92,7 +92,7 @@ contract Crowdsale {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @return true if the transaction can buy tokens
|
// @return true if the transaction can buy tokens
|
||||||
function purchaseValid() internal constant returns (bool) {
|
function validPurchase() 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;
|
||||||
|
|||||||
Reference in New Issue
Block a user