2
if (
            _zeroForOne
                ? _sqrtPriceLimitX96 > _slot0.sqrtPriceX96 ||
                    _sqrtPriceLimitX96 < TickMath.MIN_SQRT_RATIO
                : _sqrtPriceLimitX96 < _slot0.sqrtPriceX96 &&
                    _sqrtPriceLimitX96 > TickMath.MAX_SQRT_RATIO
        ) {
            revert InvalidPriceLimit();
        }

In this code - it is saying that if _zeroForOne is true then keep it beetween _slot0.sqrtPriceX96 and TickMath.MIN_SQRT_RATIO and if false then keep it between _slot0.sqrtPriceX96 and TickMath.MAX_SQRT_RATIO, but what the if condition is saying over it?

1 Answer 1

0

It is checking if the given _sqrtPriceLimitX96 value is valid for the given swap transaction based on the _zeroForOne value.

And if the value is not within the range, the function will revert with an error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.