So I am removing some liquidity from a ERC20>ETH pool but I want to store the ETH amount that I get when removing the liquidity.
function removeETHLiquidityFromToken() public {
// approve token
IERC20(tokenAddressLP).approve(UNISWAP_ROUTER_ADDRESS, IERC20(tokenAddressLP).balanceOf(address(this)));
// remove liquidity
uniswapRouter.removeLiquidityETH(tokenAddress, IERC20(tokenAddressLP).balanceOf(address(this)), 0, 0, address(this), now + 20);
// I want to use the ETH value later in this function
}
This works perfectly fine, it removes the liquidity.
But how can I get that amount of ETH so I can use it after?
https://uniswap.org/docs/v2/smart-contracts/router02/#removeliquidityeth