MintedCrowdsale.sol 755 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. /**
  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(
  23. ERC20Mintable(address(token())).mint(beneficiary, tokenAmount));
  24. }
  25. }