* Change import path from zos-lib to upgrades in all contracts * Update readme with new naming * Update package and deps names * Change path to initializable in AST of networks.jsons * Migrate manifest version * Use new oz file locations * Rename in ERC20Migrator comments * Update SDK install instructions in README * Update gitignore to use new session file name * trigger CI * Fixes to readme and package version * Use 2.5.0 release of OpenZeppelin SDK
51 lines
1.3 KiB
Solidity
51 lines
1.3 KiB
Solidity
pragma solidity ^0.5.2;
|
|
|
|
import "@openzeppelin/upgrades/contracts/Initializable.sol";
|
|
import "../../math/SafeMath.sol";
|
|
import "../validation/TimedCrowdsale.sol";
|
|
|
|
/**
|
|
* @title FinalizableCrowdsale
|
|
* @dev Extension of TimedCrowdsale with a one-off finalization action, where one
|
|
* can do extra work after finishing.
|
|
*/
|
|
contract FinalizableCrowdsale is Initializable, TimedCrowdsale {
|
|
using SafeMath for uint256;
|
|
|
|
bool private _finalized;
|
|
|
|
event CrowdsaleFinalized();
|
|
|
|
/**
|
|
* @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());
|
|
|
|
_finalized = true;
|
|
|
|
_finalization();
|
|
emit CrowdsaleFinalized();
|
|
}
|
|
|
|
/**
|
|
* @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 {
|
|
// solhint-disable-previous-line no-empty-blocks
|
|
}
|
|
|
|
uint256[50] private ______gap;
|
|
}
|