SampleCrowdsale.sol 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. pragma solidity ^0.4.18;
  2. import "../crowdsale/validation/CappedCrowdsale.sol";
  3. import "../crowdsale/distribution/RefundableCrowdsale.sol";
  4. import "../crowdsale/emission/MintedCrowdsale.sol";
  5. import "../token/ERC20/MintableToken.sol";
  6. /**
  7. * @title SampleCrowdsaleToken
  8. * @dev Very simple ERC20 Token that can be minted.
  9. * It is meant to be used in a crowdsale contract.
  10. */
  11. contract SampleCrowdsaleToken is MintableToken {
  12. string public constant name = "Sample Crowdsale Token"; // solium-disable-line uppercase
  13. string public constant symbol = "SCT"; // solium-disable-line uppercase
  14. uint8 public constant decimals = 18; // solium-disable-line uppercase
  15. }
  16. /**
  17. * @title SampleCrowdsale
  18. * @dev This is an example of a fully fledged crowdsale.
  19. * The way to add new features to a base crowdsale is by multiple inheritance.
  20. * In this example we are providing following extensions:
  21. * CappedCrowdsale - sets a max boundary for raised funds
  22. * RefundableCrowdsale - set a min goal to be reached and returns funds if it's not met
  23. *
  24. * After adding multiple features it's good practice to run integration tests
  25. * to ensure that subcontracts works together as intended.
  26. */
  27. contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale {
  28. function SampleCrowdsale(
  29. uint256 _openingTime,
  30. uint256 _closingTime,
  31. uint256 _rate,
  32. address _wallet,
  33. uint256 _cap,
  34. MintableToken _token,
  35. uint256 _goal
  36. )
  37. public
  38. Crowdsale(_rate, _wallet, _token)
  39. CappedCrowdsale(_cap)
  40. TimedCrowdsale(_openingTime, _closingTime)
  41. RefundableCrowdsale(_goal)
  42. {
  43. //As goal needs to be met for a successful crowdsale
  44. //the value needs to less or equal than a cap which is limit for accepted funds
  45. require(_goal <= _cap);
  46. }
  47. }