pub struct PoolState {
pub token0: Address,
pub token1: Address,
pub fee: u32,
pub tick_spacing: i32,
pub sqrt_price_x96: Uint<256, 4>,
pub liquidity: u128,
pub tick: i32,
pub ticks: Vec<TickInfo>,
}Expand description
Snapshot of a v3 pool’s on-chain state at some block.
Hydrated by hydrate::pool_state. Consumed by quote::* and plan::*.
Fields§
§token0: Address§token1: Address§fee: u32§tick_spacing: i32§sqrt_price_x96: Uint<256, 4>§liquidity: u128§tick: i32Current tick as reported by the pool’s slot0() at hydration time.
Informational only. Quote functions derive tick_current from
sqrt_price_x96 via the SDK’s tick math; this field is not consumed
by quote::* or plan::*. Stored for display and debugging.
ticks: Vec<TickInfo>Initialized ticks within a window around the current tick. The window size is determined at hydrate time.
Sorted ascending by tick. Callers must populate via
wp-evm-v3-provider::populate_ticks (or equivalent) before passing
the PoolState to quote::*. The native swap loop
(crate::swap::swap) relies on this ordering for O(log n) tick
search.
Trait Implementations§
impl Eq for PoolState
impl StructuralPartialEq for PoolState
Source§impl TickStateSink for PoolState
impl TickStateSink for PoolState
fn tick_spacing(&self) -> i32
fn set_ticks(&mut self, ticks: Vec<NormalizedTickInfo>)
Auto Trait Implementations§
impl Freeze for PoolState
impl RefUnwindSafe for PoolState
impl Send for PoolState
impl Sync for PoolState
impl Unpin for PoolState
impl UnsafeUnpin for PoolState
impl UnwindSafe for PoolState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more