Skip to content

Commit

Permalink
Address review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
shuhuiluo committed May 26, 2024
1 parent 02cc19f commit 72be6c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libraries/SwapMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ library SwapMath {
uint24 feePips
) internal pure returns (uint160 sqrtPriceNextX96, uint256 amountIn, uint256 amountOut, uint256 feeAmount) {
unchecked {
uint256 _feePips = feePips; // cast once and cache
uint256 _feePips = feePips; // upcast once and cache
bool zeroForOne = sqrtPriceCurrentX96 >= sqrtPriceTargetX96;
bool exactIn = amountRemaining < 0;

Expand Down Expand Up @@ -91,7 +91,7 @@ library SwapMath {
// cap the output amount to not exceed the remaining output amount
amountOut = uint256(amountRemaining);
sqrtPriceNextX96 = SqrtPriceMath.getNextSqrtPriceFromOutput(
sqrtPriceCurrentX96, liquidity, uint256(amountRemaining), zeroForOne
sqrtPriceCurrentX96, liquidity, amountOut, zeroForOne
);
}
amountIn = zeroForOne
Expand Down

0 comments on commit 72be6c5

Please sign in to comment.