#Clmm Math
Functions marked with Clmm Math, grouped from the generated Determica catalog for fast scanning across related workflows.
- clmm_amount0_delta_x96(UINT256, UINT256, UINT256, BOOLEAN) Computes the Uniswap v4 SqrtPriceMath currency0 delta between two Q64.96 boundaries. Determica requires non-zero uint128 liquidity; arithmetic is deterministic and NULL propagates.Scalar · Fixed-point and AMM math
- clmm_amount1_delta_x96(UINT256, UINT256, UINT256, BOOLEAN) Computes the Uniswap v4 SqrtPriceMath currency1 delta between two Q64.96 boundaries. Determica requires non-zero uint128 liquidity; arithmetic is deterministic and NULL propagates.Scalar · Fixed-point and AMM math
- clmm_amounts_for_liquidity_x96(UINT256, UINT256, UINT256, UINT256) Position token amounts at a price from liquidity and range, as Uniswap v3-periphery LiquidityAmounts.getAmountsForLiquidity. Integer math only; NULL propagates.Scalar · Fixed-point and AMM math
- clmm_bitmap_next_initialized_tick(INTEGER, INTEGER, UINT256, BOOLEAN) Scans exactly one Uniswap v4-style compressed tick bitmap word. Compression rounds negative non-multiples toward negative infinity. It is deterministic, propagates NULL, and does not fetch adjacent words.Scalar · Fixed-point and AMM math
- clmm_liquidity_for_amounts_x96(UINT256, UINT256, UINT256, UINT256, UINT256) Liquidity two token amounts buy in a price range, as Uniswap v3-periphery LiquidityAmounts.getLiquidityForAmounts. Integer math only; NULL propagates.Scalar · Fixed-point and AMM math
- clmm_next_sqrt_price_from_input_x96(UINT256, UINT256, UINT256, BOOLEAN) Computes the Uniswap v4 SqrtPriceMath next Q64.96 price for exact input. It is deterministic and propagates NULL.Scalar · Fixed-point and AMM math
- clmm_next_sqrt_price_from_output_x96(UINT256, UINT256, UINT256, BOOLEAN) Computes the Uniswap v4 SqrtPriceMath next Q64.96 price for exact output. It is deterministic and propagates NULL.Scalar · Fixed-point and AMM math
- clmm_sqrt_price_x96_to_tick(UINT256) Inverts a Q64.96 sqrt(currency1/currency0) using Uniswap v4 TickMath floor semantics. It is deterministic and propagates NULL.Scalar · Fixed-point and AMM math
- clmm_swap_step_x96(UINT256, UINT256, UINT256, INT256, UBIGINT) Computes one Uniswap v4 SwapMath-compatible price-range step. Negative amount_remaining means exact input; non-negative means exact output. Direction is inferred from current versus target. Hooks, dynamic fee resolution, tick-crossing liquidity changes, multi-word iteration, slippage, routing, and calldata are outside this deterministic helper. The five-argument overload uses Uniswap v4's 1,000,000 fee denominator.Scalar · Fixed-point and AMM math
- clmm_swap_x96(UINT256, INTEGER, INTEGER, UINT256, STRUCT(tick INTEGER, liquidity_net HUGEINT)[], INT256, UBIGINT, BOOLEAN) Exact swap across initialized ticks, as the Uniswap v3 and v4 swap loop: each step ends at the next listed tick or the tick-bitmap word edge (256 x tick_spacing), whichever is first, with clmm_swap_step_x96 math; crossing adds liquidity_net moving up, subtracts it moving down. Stops at the amount, price limit or list end; never assumes liquidity past listed ticks. Offline: caller reads state and ticks. No hooks, dynamic fees or protocol fee split. List sorted once per call.Scalar · Fixed-point and AMM math
- clmm_tick_to_sqrt_price_x96(INTEGER) Converts a Uniswap-compatible tick to Q64.96 sqrt(currency1/currency0) with TickMath's bit-decomposed constants and final upward rounding. It is deterministic and propagates NULL.Scalar · Fixed-point and AMM math