Sqrt Price Limit

Controlling Slippage in CLMM Swaps

In a Concentrated Liquidity Market Maker (CLMM), the sqrt_price_limit parameter is used to define a price boundary for a swap — effectively acting as a slippage protection mechanism. Depending on the direction of your trade (i.e., which token you're selling vs. buying), you must use either a min_sqrt_price_limit or max_sqrt_price_limit.

Determining Token Order

Each CLMM pool defines a token0 and a token1. You can identify the token order by using the get_pool_view function.


Swap Direction and Price Limits

Trade Direction
Use Limit
Description

token0 → token1

min_sqrt_price_limit

Sets a lower bound on the price to prevent excessive slippage when selling token0

token1 → token0

max_sqrt_price_limit

Sets an upper bound on the price to prevent excessive slippage when selling token1

Example:

If the pool consists of:

  • token0 = USDC

  • token1 = MOVE

Then:

  • Swapping USDC → MOVE: Use MIN_SQRT_PRICE

  • Swapping MOVE → USDC: Use MAX_SQRT_PRICE


Constants

export const MIN_SQRT_PRICE = "281480266797392";
export const MAX_SQRT_PRICE = "5192199275492655220258463701383891";

Use these constants to safely bound the swap and avoid undesired price execution due to rapid pool movement or low liquidity conditions.

Last updated