Skip to content

Commit

Permalink
Linearized time and state determination in invest to make it more ele…
Browse files Browse the repository at this point in the history
…gant and robust.
  • Loading branch information
miohtama committed May 15, 2017
1 parent b6a2f6d commit 880ad81
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions contracts/Crowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,18 @@ contract Crowdsale is Haltable {
*/
function investInternal(address receiver, uint128 customerId) stopInEmergency private {

// Are we whitelisted for early deposit
if(!earlyParticipantWhitelist[receiver]) {
if(getState() != State.Funding) {
// Retail participants can only come in when the crowdsale is running
// Determine if it's a good time to accept investment from this participant
if(getState() == State.PreFunding) {
// Are we whitelisted for early deposit
if(!earlyParticipantWhitelist[receiver]) {
throw;
}
} else if(getState() == State.Funding) {
// Retail participants can only come in when the crowdsale is running
// pass
} else {
// Unwanted state
throw;
}

uint weiAmount = msg.value;
Expand Down

0 comments on commit 880ad81

Please sign in to comment.