pub struct DexExtended {
pub dex: SharedDex,
pub parse_pool_created_event_fn: Option<fn(Log) -> Result<PoolCreatedEvent>>,
pub parse_swap_event_fn: Option<fn(Log) -> Result<SwapEvent>>,
pub parse_mint_event_fn: Option<fn(Log) -> Result<MintEvent>>,
pub parse_burn_event_fn: Option<fn(Log) -> Result<BurnEvent>>,
pub convert_to_trade_data_fn: Option<fn(&Token, &Token, &SwapEvent) -> Result<(OrderSide, Quantity, Price)>>,
}
Expand description
Extended DEX wrapper that adds provider-specific event parsing capabilities to the domain Dex
model.
Fields§
§dex: SharedDex
The core domain Dex object being extended
parse_pool_created_event_fn: Option<fn(Log) -> Result<PoolCreatedEvent>>
Function to parse pool creation events
parse_swap_event_fn: Option<fn(Log) -> Result<SwapEvent>>
Function to parse swap events
parse_mint_event_fn: Option<fn(Log) -> Result<MintEvent>>
Function to parse mint events
parse_burn_event_fn: Option<fn(Log) -> Result<BurnEvent>>
Function to parse burn events
convert_to_trade_data_fn: Option<fn(&Token, &Token, &SwapEvent) -> Result<(OrderSide, Quantity, Price)>>
Function to convert to trade data
Implementations§
Source§impl DexExtended
impl DexExtended
Sourcepub fn new(dex: Dex) -> Self
pub fn new(dex: Dex) -> Self
Creates a new DexExtended
wrapper around a domain Dex
object.
Sourcepub fn set_pool_created_event_parsing(
&mut self,
parse_pool_created_event: fn(Log) -> Result<PoolCreatedEvent>,
)
pub fn set_pool_created_event_parsing( &mut self, parse_pool_created_event: fn(Log) -> Result<PoolCreatedEvent>, )
Sets the function used to parse pool creation events for this Dex.
Sourcepub fn set_swap_event_parsing(
&mut self,
parse_swap_event: fn(Log) -> Result<SwapEvent>,
)
pub fn set_swap_event_parsing( &mut self, parse_swap_event: fn(Log) -> Result<SwapEvent>, )
Sets the function used to parse swap events for this Dex.
Sourcepub fn set_mint_event_parsing(
&mut self,
parse_mint_event: fn(Log) -> Result<MintEvent>,
)
pub fn set_mint_event_parsing( &mut self, parse_mint_event: fn(Log) -> Result<MintEvent>, )
Sets the function used to parse mint events for this Dex.
Sourcepub fn set_burn_event_parsing(
&mut self,
parse_burn_event: fn(Log) -> Result<BurnEvent>,
)
pub fn set_burn_event_parsing( &mut self, parse_burn_event: fn(Log) -> Result<BurnEvent>, )
Sets the function used to parse burn events for this Dex.
Sourcepub fn set_convert_trade_data(
&mut self,
convert_trade_data: fn(&Token, &Token, &SwapEvent) -> Result<(OrderSide, Quantity, Price)>,
)
pub fn set_convert_trade_data( &mut self, convert_trade_data: fn(&Token, &Token, &SwapEvent) -> Result<(OrderSide, Quantity, Price)>, )
Sets the function used to convert trade data for this Dex.
Sourcepub fn parse_pool_created_event(&self, log: Log) -> Result<PoolCreatedEvent>
pub fn parse_pool_created_event(&self, log: Log) -> Result<PoolCreatedEvent>
Parses a pool creation event log using this DEX’s specific parsing function.
Sourcepub fn parse_swap_event(&self, log: Log) -> Result<SwapEvent>
pub fn parse_swap_event(&self, log: Log) -> Result<SwapEvent>
Parses a swap event log using this DEX’s specific parsing function.
Sourcepub fn convert_to_trade_data(
&self,
token0: &Token,
token1: &Token,
swap_event: &SwapEvent,
) -> Result<(OrderSide, Quantity, Price)>
pub fn convert_to_trade_data( &self, token0: &Token, token1: &Token, swap_event: &SwapEvent, ) -> Result<(OrderSide, Quantity, Price)>
Convert to trade data from a log using this DEX’s specific parsing function.
Sourcepub fn parse_mint_event(&self, log: Log) -> Result<MintEvent>
pub fn parse_mint_event(&self, log: Log) -> Result<MintEvent>
Parses a mint event log using this DEX’s specific parsing function.
Sourcepub fn parse_burn_event(&self, log: Log) -> Result<BurnEvent>
pub fn parse_burn_event(&self, log: Log) -> Result<BurnEvent>
Parses a burn event log using this DEX’s specific parsing function.
Trait Implementations§
Source§impl Clone for DexExtended
impl Clone for DexExtended
Source§fn clone(&self) -> DexExtended
fn clone(&self) -> DexExtended
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DexExtended
impl Debug for DexExtended
Auto Trait Implementations§
impl Freeze for DexExtended
impl RefUnwindSafe for DexExtended
impl Send for DexExtended
impl Sync for DexExtended
impl Unpin for DexExtended
impl UnwindSafe for DexExtended
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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