diff --git a/contracts/strategies/G3MStrategyLib.sol b/contracts/strategies/G3MStrategyLib.sol index 040b79a8..ab87873f 100644 --- a/contracts/strategies/G3MStrategyLib.sol +++ b/contracts/strategies/G3MStrategyLib.sol @@ -60,4 +60,15 @@ library G3MStrategyLib { reserveIn.divWadDown(weightIn) ); } + + function computeAmountInGivenExactLiquidity( + uint256 liquidity, + uint256 deltaLiquidity, + uint256 reserveIn + ) internal pure returns (uint256 amountIn) { + amountIn = ( + (liquidity + deltaLiquidity).divWadDown(liquidity) + - FixedPointMathLib.WAD + ).mulWadUp(reserveIn); + } }