MintedCrowdsale.sol 782 B

1234567891011121314151617181920212223242526272829
  1. pragma solidity ^0.4.24;
  2. import "../Crowdsale.sol";
  3. import "../../token/ERC20/ERC20Mintable.sol";
  4. /**
  5. * @title MintedCrowdsale
  6. * @dev Extension of Crowdsale contract whose tokens are minted in each purchase.
  7. * Token ownership should be transferred to MintedCrowdsale for minting.
  8. */
  9. contract MintedCrowdsale is Crowdsale {
  10. constructor() internal {}
  11. /**
  12. * @dev Overrides delivery by minting tokens upon purchase.
  13. * @param beneficiary Token purchaser
  14. * @param tokenAmount Number of tokens to be minted
  15. */
  16. function _deliverTokens(
  17. address beneficiary,
  18. uint256 tokenAmount
  19. )
  20. internal
  21. {
  22. // Potentially dangerous assumption about the type of the token.
  23. require(
  24. ERC20Mintable(address(token())).mint(beneficiary, tokenAmount));
  25. }
  26. }