Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
070bcbcd
Commit
070bcbcd
authored
Jul 02, 2017
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename purchaseValid to validPurchase
parent
46fe7ee7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
CappedCrowdsale.sol
contracts/crowdsale/CappedCrowdsale.sol
+3
-3
Crowdsale.sol
contracts/crowdsale/Crowdsale.sol
+2
-2
No files found.
contracts/crowdsale/CappedCrowdsale.sol
View file @
070bcbcd
...
@@ -16,11 +16,11 @@ contract CappedCrowdsale is Crowdsale {
...
@@ -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
...
...
contracts/crowdsale/Crowdsale.sol
View file @
070bcbcd
...
@@ -68,7 +68,7 @@ contract Crowdsale {
...
@@ -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 {
...
@@ -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;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment