contract oCurveLiquidate is ReentrancyGuard, Ownable {
  using SafeERC20 for IERC20;
  using Address for address;
  using SafeMath for uint256;

  address constant public oyCurve = address(0x4BA8C6Ce0e855C051e65DfC37883360efAf7c82B);

  function liquidate(address payable _vault, address payable _oToken) public {

    OptionsContract oToken = OptionsContract(_oToken);
    require(oToken.isUnsafe(_vault), 'safe');

    uint256 maxToLiquidate = oToken.maxOTokensLiquidatable(_vault); //100 * 1e15

    IERC20(_oToken).transferFrom(msg.sender, address(this), maxToLiquidate);

    oToken.liquidate(_vault, maxToLiquidate);
  }

  // incase of half-way error
  function inCaseTokenGetsStuck(IERC20 _TokenAddress) onlyOwner public {
      uint qty = _TokenAddress.balanceOf(address(this));
      _TokenAddress.safeTransfer(msg.sender, qty);
  }

  // incase of half-way error
  function inCaseETHGetsStuck() onlyOwner public{
      (bool result, ) = msg.sender.call.value(address(this).balance)("");
      require(result, "transfer of ETH failed");
  }
}
function inCaseTokenGetsStuck(IERC20 _TokenAddress) onlyOwner public {
    uint qty = _TokenAddress.balanceOf(address(this));
    _TokenAddress.safeTransfer(msg.sender, qty);
}

// incase of half-way error