Skip to content

Commit

Permalink
feat: add computeAmountInGivenExactLiquidity
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlak committed Nov 16, 2023
1 parent 465021a commit e629088
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions contracts/strategies/G3MStrategyLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit e629088

Please sign in to comment.