Add complex crowdsale example #331

pull/342/head
Jakub Wojciechowski 8 years ago
parent de0e6ba222
commit 2403508e1b
  1. 27
      contracts/examples/crowdsale/SampleCrowdsale.sol
  2. 18
      contracts/examples/crowdsale/SampleCrowdsaleToken.sol

@ -0,0 +1,27 @@
pragma solidity ^0.4.11;
import "../../crowdsale/CappedCrowdsale.sol";
import "../../crowdsale/RefundableCrowdsale.sol";
import "./SampleCrowdsaleToken.sol";
/**
* @title SampleCrowdsale
* @dev This is an example of a fully fledged crowdsale that incorporates
* ability to finalize sale and checks for both cap and goal.
*/
contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale {
function SampleCrowdsale(uint256 _startBlock, uint256 _endBlock, uint256 _rate, uint256 _goal, uint256 _cap, address _wallet)
CappedCrowdsale(_cap)
FinalizableCrowdsale()
RefundableCrowdsale(_goal)
Crowdsale(_startBlock, _endBlock, _rate, _wallet)
{
require(_goal <= _cap);
}
function createTokenContract() internal returns (MintableToken) {
return new SampleCrowdsaleToken();
}
}

@ -0,0 +1,18 @@
pragma solidity ^0.4.11;
import "../../token/MintableToken.sol";
/**
* @title SampleCrowdsaleToken
* @dev Very simple ERC20 Token that can be minted.
* It is meant to be used in a crowdsale contract.
*/
contract SampleCrowdsaleToken is MintableToken {
string public constant name = "Sample Crowdsale Token";
string public constant symbol = "SCT";
uint256 public constant decimals = 18;
}
Loading…
Cancel
Save