MintedCrowdsale.sol 752 B

12345678910111213141516171819202122232425262728
  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. /**
  11. * @dev Overrides delivery by minting tokens upon purchase.
  12. * @param _beneficiary Token purchaser
  13. * @param _tokenAmount Number of tokens to be minted
  14. */
  15. function _deliverTokens(
  16. address _beneficiary,
  17. uint256 _tokenAmount
  18. )
  19. internal
  20. {
  21. // Potentially dangerous assumption about the type of the token.
  22. require(ERC20Mintable(address(token)).mint(_beneficiary, _tokenAmount));
  23. }
  24. }