abstract contract TimedCrowdsale is Crowdsale {
    using SafeMath for uint256;

    uint256 private _openingTime;
    uint256 private _closingTime;
    uint256 public _finalizedTime;
    bool public _isStopped = false;
    bool public isDepositedTokenSale = false;

    function start() public onlyOwner {
        require(!isOpen(), "TimedCrowdsale: opened");
        require(isDepositedTokenSale, "TimedCrowdsale: no token sale");
        _openingTime = block.timestamp;
    }

    function stop() public onlyOwner {
        require(isOpen(), "TimedCrowdsale: closed");
        _isStopped = true;
    }

    /**
     * @dev Reverts if not in crowdsale time range.
     */
    modifier onlyWhileOpen {
        require(isOpen() && !_isStopped, "TimedCrowdsale: not open");
        _;
    }

    modifier withdrawable {
        require(
            _finalizedTime > 0 &&
                block.timestamp > _finalizedTime.add(30 minutes)
        );
        _;
    }

    /**
     * @return the crowdsale opening time.
     */
    function openingTime() public view returns (uint256) {
        return _openingTime;
    }

    /**
     * @return true if the crowdsale is open, false otherwise.
     */
    function isOpen() public view returns (bool) {
        return _openingTime > 0 && block.timestamp >= _openingTime;
    }

    /**
     * @dev Checks whether the period in which the crowdsale is open has already elapsed.
     * @return Whether crowdsale period has elapsed
     */
    function hasClosed() public view returns (bool) {
        return _openingTime > 0 && _isStopped;
    }
}
/**
 * @title TimedCrowdsale
 * @dev Crowdsale accepting contributions only within a time frame.
 */
function openingTime() public view returns (uint256) {
        return _openingTime;
    }
/**
 * @return the crowdsale opening time.
 */