|
| 1 | +// Jest Snapshot v1, https://goo.gl/fbAQLP |
| 2 | + |
| 3 | +exports[`SampleCrowdsale.sol 1`] = ` |
| 4 | +pragma solidity ^0.4.18; |
| 5 | +
|
| 6 | +import "../crowdsale/CappedCrowdsale.sol"; |
| 7 | +import "../crowdsale/RefundableCrowdsale.sol"; |
| 8 | +import "../token/MintableToken.sol"; |
| 9 | +
|
| 10 | +/** |
| 11 | + * @title SampleCrowdsaleToken |
| 12 | + * @dev Very simple ERC20 Token that can be minted. |
| 13 | + * It is meant to be used in a crowdsale contract. |
| 14 | + */ |
| 15 | +contract SampleCrowdsaleToken is MintableToken { |
| 16 | +
|
| 17 | + string public constant name = "Sample Crowdsale Token"; |
| 18 | + string public constant symbol = "SCT"; |
| 19 | + uint8 public constant decimals = 18; |
| 20 | +
|
| 21 | +} |
| 22 | +
|
| 23 | +/** |
| 24 | + * @title SampleCrowdsale |
| 25 | + * @dev This is an example of a fully fledged crowdsale. |
| 26 | + * The way to add new features to a base crowdsale is by multiple inheritance. |
| 27 | + * In this example we are providing following extensions: |
| 28 | + * CappedCrowdsale - sets a max boundary for raised funds |
| 29 | + * RefundableCrowdsale - set a min goal to be reached and returns funds if it's not met |
| 30 | + * |
| 31 | + * After adding multiple features it's good practice to run integration tests |
| 32 | + * to ensure that subcontracts works together as intended. |
| 33 | + */ |
| 34 | +contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale { |
| 35 | +
|
| 36 | + function SampleCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, uint256 _goal, uint256 _cap, address _wallet) public |
| 37 | + CappedCrowdsale(_cap) |
| 38 | + FinalizableCrowdsale() |
| 39 | + RefundableCrowdsale(_goal) |
| 40 | + Crowdsale(_startTime, _endTime, _rate, _wallet) |
| 41 | + { |
| 42 | + //As goal needs to be met for a successful crowdsale |
| 43 | + //the value needs to less or equal than a cap which is limit for accepted funds |
| 44 | + require(_goal <= _cap); |
| 45 | + } |
| 46 | +
|
| 47 | + function createTokenContract() internal returns (MintableToken) { |
| 48 | + return new SampleCrowdsaleToken(); |
| 49 | + } |
| 50 | +
|
| 51 | +} |
| 52 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 53 | +pragma solidity ^0.4.18; |
| 54 | +
|
| 55 | +import "../crowdsale/CappedCrowdsale.sol"; |
| 56 | +import "../crowdsale/RefundableCrowdsale.sol"; |
| 57 | +import "../token/MintableToken.sol"; |
| 58 | +
|
| 59 | +/** |
| 60 | + * @title SampleCrowdsaleToken |
| 61 | + * @dev Very simple ERC20 Token that can be minted. |
| 62 | + * It is meant to be used in a crowdsale contract. |
| 63 | + */ |
| 64 | +contract SampleCrowdsaleToken is MintableToken { |
| 65 | + string public constant name = "Sample Crowdsale Token"; |
| 66 | + string public constant symbol = "SCT"; |
| 67 | + uint8 public constant decimals = 18; |
| 68 | +
|
| 69 | +} |
| 70 | +
|
| 71 | +
|
| 72 | +/** |
| 73 | + * @title SampleCrowdsale |
| 74 | + * @dev This is an example of a fully fledged crowdsale. |
| 75 | + * The way to add new features to a base crowdsale is by multiple inheritance. |
| 76 | + * In this example we are providing following extensions: |
| 77 | + * CappedCrowdsale - sets a max boundary for raised funds |
| 78 | + * RefundableCrowdsale - set a min goal to be reached and returns funds if it's not met |
| 79 | + * |
| 80 | + * After adding multiple features it's good practice to run integration tests |
| 81 | + * to ensure that subcontracts works together as intended. |
| 82 | + */ |
| 83 | +contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale { |
| 84 | + function SampleCrowdsale( |
| 85 | + uint256 _startTime, |
| 86 | + uint256 _endTime, |
| 87 | + uint256 _rate, |
| 88 | + uint256 _goal, |
| 89 | + uint256 _cap, |
| 90 | + address _wallet |
| 91 | + ) public CappedCrowdsale(_cap) FinalizableCrowdsale RefundableCrowdsale(_goal) Crowdsale(_startTime, _endTime, _rate, _wallet) { |
| 92 | + //As goal needs to be met for a successful crowdsale |
| 93 | + //the value needs to less or equal than a cap which is limit for accepted funds |
| 94 | + require(_goal <= _cap); |
| 95 | + } |
| 96 | +
|
| 97 | + function createTokenContract() internal returns(MintableToken) { |
| 98 | + return new SampleCrowdsaleToken(); |
| 99 | + } |
| 100 | +
|
| 101 | +} |
| 102 | +
|
| 103 | +`; |
0 commit comments