Skip to main content
The core program exposes five views.

view_sqrt_price_at_tick_x128

Returns the canonical Q128.128 square-root price for a tick.

view_swap_iteration

Runs one initialized-tick walk step from a SwapIterCfg, tick hint, target price, Tick, and SwapIterState. It returns the next state and tick value.

view_mul_div

Runs the shared full-width u256 multiply-divide helper. The caller selects floor or ceiling rounding.

resolve_stored_tick

Resolves the stored tick after the crossing loop and bounded partial fill. It preserves the half-open range convention when execution rests at an initialized tick.

view_bounded_partial

Consumes remaining input only up to the nearer next initialized tick or price limit. It returns the next square-root price, remainder, output, fee growth, protocol fee, and estimated tick. The function returns all input when fee-adjusted input floors to zero. It also avoids an uncrossed upward rest exactly at an initialized tick, which would desynchronize stored liquidity and price. Views share contract arithmetic. They do not bypass bounds, rounding, or overflow checks. Bind any off-chain simulation to a specific state snapshot.