* Update to ganache-cli v6.1.0 and truffle v4.1.0 * Update to stable version of ganache-cli * fix: update event emission warning - Fix event emission warnings for solidity 4.21 after truffle has been updated to use this version * fix pr review comments * update to truffle v4.1.5 * update package-lock * add additional emit keywords * update solidity-coverage to 0.4.15 * update to solium 1.1.6 * fix MerkleProof coverage analysis by testing through wrapper * change version pragma to ^0.4.21 * fix solium linting errors
38 lines
1002 B
Solidity
38 lines
1002 B
Solidity
pragma solidity ^0.4.21;
|
|
|
|
import "../validation/TimedCrowdsale.sol";
|
|
import "../../token/ERC20/ERC20.sol";
|
|
import "../../math/SafeMath.sol";
|
|
|
|
|
|
/**
|
|
* @title PostDeliveryCrowdsale
|
|
* @dev Crowdsale that locks tokens from withdrawal until it ends.
|
|
*/
|
|
contract PostDeliveryCrowdsale is TimedCrowdsale {
|
|
using SafeMath for uint256;
|
|
|
|
mapping(address => uint256) public balances;
|
|
|
|
/**
|
|
* @dev Withdraw tokens only after crowdsale ends.
|
|
*/
|
|
function withdrawTokens() public {
|
|
require(hasClosed());
|
|
uint256 amount = balances[msg.sender];
|
|
require(amount > 0);
|
|
balances[msg.sender] = 0;
|
|
_deliverTokens(msg.sender, amount);
|
|
}
|
|
|
|
/**
|
|
* @dev Overrides parent by storing balances instead of issuing tokens right away.
|
|
* @param _beneficiary Token purchaser
|
|
* @param _tokenAmount Amount of tokens purchased
|
|
*/
|
|
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
|
|
balances[_beneficiary] = balances[_beneficiary].add(_tokenAmount);
|
|
}
|
|
|
|
}
|