Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
zeppelin-crowdsales/contracts/PreSaleWithCapCrowdsale.sol
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
32 lines (27 sloc)
987 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.18; | |
import "zeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol"; | |
import "zeppelin-solidity/contracts/crowdsale/validation/WhitelistedCrowdsale.sol"; | |
import "zeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol"; | |
contract PreSaleWithCapCrowdsale is TimedCrowdsale, WhitelistedCrowdsale, CappedCrowdsale { | |
function PreSaleWithCapCrowdsale( | |
uint256 _rate, | |
address _wallet, | |
ERC20 _token, | |
uint256 _openingTime, | |
uint256 _closingTime, | |
uint256 _cap | |
) | |
public | |
Crowdsale(_rate, _wallet, _token) | |
TimedCrowdsale(_openingTime, _closingTime) | |
CappedCrowdsale(_cap) | |
{ | |
} | |
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { | |
require(_beneficiary != address(0)); | |
require(_weiAmount != 0); | |
require(block.timestamp >= openingTime || whitelist[_beneficiary]); | |
require(block.timestamp <= closingTime); | |
require(weiRaised.add(_weiAmount) <= cap); | |
} | |
} |