Struct Pool

Source
pub struct Pool {
    pub chain: SharedChain,
    pub dex: Dex,
    pub address: Address,
    pub creation_block: u64,
    pub token0: Token,
    pub token1: Token,
    pub fee: u32,
    pub tick_spacing: u32,
    pub ts_init: UnixNanos,
}
Expand description

Represents a liquidity pool in a decentralized exchange.

Fields§

§chain: SharedChain

The blockchain network where this pool exists.

§dex: Dex

The decentralized exchange protocol that created and manages this pool.

§address: Address

The blockchain address of the pool smart contract.

§creation_block: u64

The block number when this pool was created on the blockchain.

§token0: Token

The first token in the trading pair.

§token1: Token

The second token in the trading pair.

§fee: u32

The trading fee tier used by the pool expressed in hundred-thousandths (1e-6) of one unit – identical to Uniswap-V3’s fee representation.

Examples: • 500 → 0.05 % (5 bps) • 3_000 → 0.30 % (30 bps) • 10_000→ 1.00 %

§tick_spacing: u32

The minimum tick spacing for positions in concentrated liquidity AMMs.

§ts_init: UnixNanos

UNIX timestamp (nanoseconds) when the instance was created.

Implementations§

Source§

impl Pool

Source

pub fn new( chain: SharedChain, dex: Dex, address: Address, creation_block: u64, token0: Token, token1: Token, fee: u32, tick_spacing: u32, ts_init: UnixNanos, ) -> Self

Creates a new Pool instance with the specified properties.

Source

pub fn ticker(&self) -> String

Returns the ticker symbol for this pool as a formatted string.

Source

pub fn instrument_id(&self) -> InstrumentId

Returns the instrument ID for this pool.

Trait Implementations§

Source§

impl Clone for Pool

Source§

fn clone(&self) -> Pool

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Pool

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Pool

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Pool

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Pool> for CurrencyPair

Source§

fn from(p: Pool) -> Self

Converts to this type from the input type.
Source§

impl From<Pool> for DefiData

Source§

fn from(value: Pool) -> Self

Converts to this type from the input type.
Source§

impl From<Pool> for InstrumentAny

Source§

fn from(p: Pool) -> Self

Converts to this type from the input type.
Source§

impl HasTsInit for Pool

Source§

fn ts_init(&self) -> UnixNanos

Returns the UNIX timestamp (nanoseconds) when the instance was created.
Source§

impl PartialEq for Pool

Source§

fn eq(&self, other: &Pool) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Pool

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Pool

Auto Trait Implementations§

§

impl Freeze for Pool

§

impl RefUnwindSafe for Pool

§

impl Send for Pool

§

impl Sync for Pool

§

impl Unpin for Pool

§

impl UnwindSafe for Pool

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Separable for T
where T: Display,

Source§

fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String

Adds separators according to the given SeparatorPolicy. Read more
Source§

fn separate_with_commas(&self) -> String

Inserts a comma every three digits from the right. Read more
Source§

fn separate_with_spaces(&self) -> String

Inserts a space every three digits from the right. Read more
Source§

fn separate_with_dots(&self) -> String

Inserts a period every three digits from the right. Read more
Source§

fn separate_with_underscores(&self) -> String

Inserts an underscore every three digits from the right. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Ungil for T
where T: Send,