SampleCrowdsale.sol 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. pragma solidity ^0.4.24;
  2. import "../crowdsale/validation/CappedCrowdsale.sol";
  3. import "../crowdsale/distribution/RefundableCrowdsale.sol";
  4. import "../crowdsale/emission/MintedCrowdsale.sol";
  5. import "../token/ERC20/ERC20Mintable.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 ERC20Mintable {
  12. string public constant name = "Sample Crowdsale Token";
  13. string public constant symbol = "SCT";
  14. uint8 public constant decimals = 18;
  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. // XXX There doesn't seem to be a way to split this line that keeps solium
  28. // happy. See:
  29. // https://github.com/duaraghav8/Solium/issues/205
  30. // --elopio - 2018-05-10
  31. // solium-disable-next-line max-len
  32. contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale {
  33. constructor(
  34. uint256 openingTime,
  35. uint256 closingTime,
  36. uint256 rate,
  37. address wallet,
  38. uint256 cap,
  39. ERC20Mintable token,
  40. uint256 goal
  41. )
  42. public
  43. Crowdsale(rate, wallet, token)
  44. CappedCrowdsale(cap)
  45. TimedCrowdsale(openingTime, closingTime)
  46. RefundableCrowdsale(goal)
  47. {
  48. //As goal needs to be met for a successful crowdsale
  49. //the value needs to less or equal than a cap which is limit for accepted funds
  50. require(goal <= cap);
  51. }
  52. }