rename purchaseValid to validPurchase

This commit is contained in:
Francisco Giordano
2017-07-02 17:05:06 -03:00
parent 46fe7ee76d
commit 070bcbcdbd
2 changed files with 5 additions and 5 deletions

View File

@ -16,11 +16,11 @@ contract CappedCrowdsale is Crowdsale {
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
function purchaseValid() internal constant returns (bool) {
function validPurchase() internal constant returns (bool) {
bool withinCap = weiRaised.add(msg.value) <= cap;
return super.purchaseValid() && withinCap;
return super.validPurchase() && withinCap;
}
// overriding Crowdsale#hasEnded to add cap logic

View File

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