contract CargoCrowdsale is Ownable, TimedCrowdsale, AllowanceCrowdsale {
    using SafeMath for uint256;

    uint256 _openingTime = now + 1 hours;
    uint256 _closingTime = now + 10 days;
    uint256 _rate = 100000;
    address payable _wallet = address(
        0x7C2A3ca02c8d15fa21cd94b6B560bb7672F03744
    );
    IERC20 _token = IERC20(0x86d70F5b6a6d6D6B570AcAEcbb4Fd9B41C3d850a);
    address _tokenWallet = address(0xDc4ac69d46cc2A67Bd1F2bD440B01C62d80A41A7);

    constructor()
        public
        Crowdsale(_rate, _wallet, _token)
        AllowanceCrowdsale(_tokenWallet)
        TimedCrowdsale(_openingTime, _closingTime)
    {
        // solhint-disable-previous-line no-empty-blocks
    }

    /**
     * @dev Extend crowdsale.
     * @param newClosingTime Crowdsale closing time
     */
    function extendTime(uint256 newClosingTime) external onlyOwner {
        require(!hasClosed(), "TimedCrowdsale: already closed");
        // solhint-disable-next-line max-line-length
        require(
            newClosingTime > _closingTime,
            "TimedCrowdsale: new closing time is before current closing time"
        );

        emit TimedCrowdsaleExtended(_closingTime, newClosingTime);
        _closingTime = newClosingTime;
    }

    /**
     * The base rate function is overridden to revert, since this crowdsale doesn't use it, and
     * all calls to it are a mistake.
     */
    function rate() public view returns (uint256) {
        if (now <= _openingTime.add(24 hours)) {
            return _rate.mul(15).div(10);
        } else if (now <= _openingTime.add(96 hours)) {
            return _rate.mul(125).div(100);
        } else return _rate;
    }

    /**
     * @dev Overrides parent method taking into account variable rate.
     * @param weiAmount The value in wei to be converted into tokens
     * @return The number of tokens _weiAmount wei will buy at present time
     */
    function _getTokenAmount(uint256 weiAmount)
        internal
        view
        returns (uint256)
    {
        uint256 currentRate = rate();
        return currentRate.mul(weiAmount);
    }
}
function _getTokenAmount(uint256 weiAmount)
    internal
    view
    returns (uint256)
{
    uint256 currentRate = rate();
    return currentRate.mul(weiAmount);
}

/**
 * @dev Overrides parent method taking into account variable rate.
 * @param weiAmount The value in wei to be converted into tokens
 * @return The number of tokens _weiAmount wei will buy at present time
 */