pub struct PoolSwap {Show 13 fields
pub chain: SharedChain,
pub dex: SharedDex,
pub pool: SharedPool,
pub block: u64,
pub transaction_hash: String,
pub transaction_index: u32,
pub log_index: u32,
pub sender: Address,
pub side: OrderSide,
pub size: Quantity,
pub price: Price,
pub timestamp: UnixNanos,
pub ts_init: UnixNanos,
}
Expand description
Represents a token swap transaction on a decentralized exchange (DEX).
Fields§
§chain: SharedChain
The blockchain network where the swap occurred.
dex: SharedDex
The decentralized exchange where the swap was executed.
pool: SharedPool
The DEX liquidity pool.
block: u64
The blockchain block number at which the swap was executed.
transaction_hash: String
The unique hash identifier of the blockchain transaction containing the swap.
transaction_index: u32
The index position of the transaction within the block.
log_index: u32
The index position of the swap event log within the transaction.
sender: Address
The blockchain address of the user or contract that initiated the swap.
side: OrderSide
The direction of the swap from the perspective of the base token.
size: Quantity
The amount of tokens swapped.
price: Price
The exchange rate at which the swap occurred.
timestamp: UnixNanos
UNIX timestamp (nanoseconds) when the swap occurred.
ts_init: UnixNanos
UNIX timestamp (nanoseconds) when the instance was initialized.
Implementations§
Source§impl PoolSwap
impl PoolSwap
Sourcepub fn new(
chain: SharedChain,
dex: SharedDex,
pool: SharedPool,
block: u64,
transaction_hash: String,
transaction_index: u32,
log_index: u32,
timestamp: UnixNanos,
sender: Address,
side: OrderSide,
size: Quantity,
price: Price,
) -> Self
pub fn new( chain: SharedChain, dex: SharedDex, pool: SharedPool, block: u64, transaction_hash: String, transaction_index: u32, log_index: u32, timestamp: UnixNanos, sender: Address, side: OrderSide, size: Quantity, price: Price, ) -> Self
Creates a new PoolSwap
instance with the specified properties.
Sourcepub fn instrument_id(&self) -> InstrumentId
pub fn instrument_id(&self) -> InstrumentId
Returns the instrument ID for this swap.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PoolSwap
impl<'de> Deserialize<'de> for PoolSwap
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for PoolSwap
Auto Trait Implementations§
impl Freeze for PoolSwap
impl RefUnwindSafe for PoolSwap
impl Send for PoolSwap
impl Sync for PoolSwap
impl Unpin for PoolSwap
impl UnwindSafe for PoolSwap
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
Source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
SeparatorPolicy
. Read more