#[repr(C)]pub struct PoolAmm {}Expand description
Raw AMM state for a single pool. Slot i corresponds to PoolBooks.metas[i].
Strategies use this to compute swap output from the pricing function directly rather than relying on pre-computed synthetic L2Books.
- V2 pools: use
reserve0(),reserve1(),fee_ppm - V3/CLMM pools: use
sqrt_price_x64,tick,liquidity,fee_ppm,tick_spacing
Fields§
§reserve0_lo: u64Lower 64 bits of reserve0.
reserve0_hi: u64Upper 64 bits of reserve0 (usually 0 for practical pools).
reserve1_lo: u64Lower 64 bits of reserve1.
reserve1_hi: u64Upper 64 bits of reserve1.
sqrt_price_x64: u128sqrt(price) in Q64.64 fixed-point (converted from Q64.96 by CC).
To get price: (sqrt_price_x64 as f64 / 2^64)^2.
liquidity: u128Active liquidity at the current tick.
tick: i32Current tick index. Price at tick t ≈ 1.0001^t.
tick_spacing: i32Tick spacing (V3 only: 1, 10, 60, 200).
fee_ppm: u32Swap fee in parts-per-million (3000 = 0.3%).
pool_type: u8Pool type: 0=V2, 1=V3/CLMM, 2=stableswap.
_pad0: [u8; 3]§last_block: u64Block/slot number when this state was observed.
last_update_ns: u64Nanosecond timestamp of last update.
Implementations§
Trait Implementations§
impl Copy for PoolAmm
Auto Trait Implementations§
impl Freeze for PoolAmm
impl RefUnwindSafe for PoolAmm
impl Send for PoolAmm
impl Sync for PoolAmm
impl Unpin for PoolAmm
impl UnsafeUnpin for PoolAmm
impl UnwindSafe for PoolAmm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more