Skip to content

Commit

Permalink
feat: add computeDeltaXGivenDeltaY
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlak committed Nov 16, 2023
1 parent 8461737 commit 032d377
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions contracts/strategies/G3MStrategyLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,13 @@ library G3MStrategyLib {
deltaY = reserveY.divWadDown(reserveX).mulWadDown(reserveX + deltaX)
- reserveY;
}

function computeDeltaXGivenDeltaY(
uint256 reserveX,
uint256 reserveY,
uint256 deltaY
) internal pure returns (uint256 deltaX) {
deltaX = reserveX.divWadDown(reserveY).mulWadDown(reserveY + deltaY)
- reserveX;
}
}

0 comments on commit 032d377

Please sign in to comment.