You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
43 lines
1.1 KiB
pragma solidity ^0.4.24;
|
|
|
|
import "../validation/TimedCrowdsale.sol";
|
|
import "../../token/ERC20/IERC20.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.
|
|
* @param _beneficiary Whose tokens will be withdrawn.
|
|
*/
|
|
function withdrawTokens(address _beneficiary) public {
|
|
require(hasClosed());
|
|
uint256 amount = balances[_beneficiary];
|
|
require(amount > 0);
|
|
balances[_beneficiary] = 0;
|
|
_deliverTokens(_beneficiary, 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);
|
|
}
|
|
|
|
}
|
|
|