* Now compiling in a separate directory using truffle 5. * Ported to 0.5.1, now compiling using 0.5.1. * test now also compiles using the truffle 5 hack. * Downgraded to 0.5.0. * Sorted scripts. * Cleaned up the compile script a bit.
22 lines
749 B
Solidity
22 lines
749 B
Solidity
pragma solidity ^0.5.0;
|
|
|
|
import "../Crowdsale.sol";
|
|
import "../../token/ERC20/ERC20Mintable.sol";
|
|
|
|
/**
|
|
* @title MintedCrowdsale
|
|
* @dev Extension of Crowdsale contract whose tokens are minted in each purchase.
|
|
* Token ownership should be transferred to MintedCrowdsale for minting.
|
|
*/
|
|
contract MintedCrowdsale is Crowdsale {
|
|
/**
|
|
* @dev Overrides delivery by minting tokens upon purchase.
|
|
* @param beneficiary Token purchaser
|
|
* @param tokenAmount Number of tokens to be minted
|
|
*/
|
|
function _deliverTokens(address beneficiary, uint256 tokenAmount) internal {
|
|
// Potentially dangerous assumption about the type of the token.
|
|
require(ERC20Mintable(address(token())).mint(beneficiary, tokenAmount));
|
|
}
|
|
}
|