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.
51 lines
1.1 KiB
51 lines
1.1 KiB
pragma solidity ^0.4.24;
|
|
|
|
import "../../math/SafeMath.sol";
|
|
import "../validation/TimedCrowdsale.sol";
|
|
|
|
/**
|
|
* @title FinalizableCrowdsale
|
|
* @dev Extension of Crowdsale with a one-off finalization action, where one
|
|
* can do extra work after finishing.
|
|
*/
|
|
contract FinalizableCrowdsale is TimedCrowdsale {
|
|
using SafeMath for uint256;
|
|
|
|
bool private _finalized;
|
|
|
|
event CrowdsaleFinalized();
|
|
|
|
constructor() public {
|
|
_finalized = false;
|
|
}
|
|
|
|
/**
|
|
* @return true if the crowdsale is finalized, false otherwise.
|
|
*/
|
|
function finalized() public view returns (bool) {
|
|
return _finalized;
|
|
}
|
|
|
|
/**
|
|
* @dev Must be called after crowdsale ends, to do some extra finalization
|
|
* work. Calls the contract's finalization function.
|
|
*/
|
|
function finalize() public {
|
|
require(!_finalized);
|
|
require(hasClosed());
|
|
|
|
_finalization();
|
|
emit CrowdsaleFinalized();
|
|
|
|
_finalized = true;
|
|
}
|
|
|
|
/**
|
|
* @dev Can be overridden to add finalization logic. The overriding function
|
|
* should call super._finalization() to ensure the chain of finalization is
|
|
* executed entirely.
|
|
*/
|
|
function _finalization() internal {
|
|
}
|
|
|
|
}
|
|
|