Add TimedCrowdsale::_extendTime (#1636)
* Add TimedCrowdsale::_extendTime * Add tests for TimedCrowdsale extending method * Reverse event arguments order * Rename method argument * Refactor TimedCrowdsale test * Simplify TimedCrowdsaleImpl * Fix extendTime method behaviour to deny TimedCrowdsale re-opening after it was ended * Append chengelog * Update CHANGELOG.md Co-Authored-By: k06a <k06aaa@gmail.com> * Update contracts/crowdsale/validation/TimedCrowdsale.sol Co-Authored-By: k06a <k06aaa@gmail.com> * Improve tests
This commit is contained in:
committed by
Nicolás Venturo
parent
3772233cf5
commit
352ec94579
@ -13,6 +13,13 @@ contract TimedCrowdsale is Crowdsale {
|
||||
uint256 private _openingTime;
|
||||
uint256 private _closingTime;
|
||||
|
||||
/**
|
||||
* Event for crowdsale extending
|
||||
* @param newClosingTime new closing time
|
||||
* @param prevClosingTime old closing time
|
||||
*/
|
||||
event TimedCrowdsaleExtended(uint256 prevClosingTime, uint256 newClosingTime);
|
||||
|
||||
/**
|
||||
* @dev Reverts if not in crowdsale time range.
|
||||
*/
|
||||
@ -74,4 +81,16 @@ contract TimedCrowdsale is Crowdsale {
|
||||
function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal onlyWhileOpen view {
|
||||
super._preValidatePurchase(beneficiary, weiAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Extend crowdsale
|
||||
* @param newClosingTime Crowdsale closing time
|
||||
*/
|
||||
function _extendTime(uint256 newClosingTime) internal {
|
||||
require(!hasClosed());
|
||||
require(newClosingTime > _closingTime);
|
||||
|
||||
emit TimedCrowdsaleExtended(_closingTime, newClosingTime);
|
||||
_closingTime = newClosingTime;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user