pub struct DefiDataSubscriptionManager { /* private fields */ }
Expand description
Manages subscriptions to DeFi protocol events (swaps, mints, burns) across different DEXs.
This manager tracks which pool addresses are subscribed for each event type and maintains the event signature encodings for efficient filtering.
Implementations§
Source§impl DefiDataSubscriptionManager
impl DefiDataSubscriptionManager
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new DefiDataSubscriptionManager
instance.
Sourcepub fn get_subscribed_dex_contract_addresses(
&self,
dex: &DexType,
) -> Vec<Address>
pub fn get_subscribed_dex_contract_addresses( &self, dex: &DexType, ) -> Vec<Address>
Gets all unique contract addresses subscribed for any event type for a given DEX.
Sourcepub fn get_subscribed_dex_event_signatures(&self, dex: &DexType) -> Vec<String>
pub fn get_subscribed_dex_event_signatures(&self, dex: &DexType) -> Vec<String>
Gets all event signatures (keccak256 hashes) registered for a given DEX.
Sourcepub fn get_dex_pool_swap_event_signature(&self, dex: &DexType) -> Option<String>
pub fn get_dex_pool_swap_event_signature(&self, dex: &DexType) -> Option<String>
Gets the swap event signature for a specific DEX.
Sourcepub fn get_dex_pool_mint_event_signature(&self, dex: &DexType) -> Option<String>
pub fn get_dex_pool_mint_event_signature(&self, dex: &DexType) -> Option<String>
Gets the mint event signature for a specific DEX.
Sourcepub fn get_dex_pool_burn_event_signature(&self, dex: &DexType) -> Option<String>
pub fn get_dex_pool_burn_event_signature(&self, dex: &DexType) -> Option<String>
Gets the burn event signature for a specific DEX.
Sourcepub fn register_dex_for_subscriptions(
&mut self,
dex: DexType,
swap_event_signature: &str,
mint_event_signature: &str,
burn_event_signature: &str,
)
pub fn register_dex_for_subscriptions( &mut self, dex: DexType, swap_event_signature: &str, mint_event_signature: &str, burn_event_signature: &str, )
Registers a DEX with its event signatures for subscription management.
This must be called before subscribing to any events for a DEX. Event signatures can be either raw signatures or pre-encoded keccak256 hashes.
Sourcepub fn subscribe_swaps(&mut self, dex: DexType, address: Address)
pub fn subscribe_swaps(&mut self, dex: DexType, address: Address)
Subscribes to swap events for a specific pool address on a DEX.
Sourcepub fn subscribe_mints(&mut self, dex: DexType, address: Address)
pub fn subscribe_mints(&mut self, dex: DexType, address: Address)
Subscribes to mint events for a specific pool address on a DEX.
Sourcepub fn subscribe_burns(&mut self, dex: DexType, address: Address)
pub fn subscribe_burns(&mut self, dex: DexType, address: Address)
Subscribes to burn events for a specific pool address on a DEX.
Sourcepub fn unsubscribe_swaps(&mut self, dex: DexType, address: Address)
pub fn unsubscribe_swaps(&mut self, dex: DexType, address: Address)
Unsubscribes from swap events for a specific pool address on a DEX.
Sourcepub fn unsubscribe_mints(&mut self, dex: DexType, address: Address)
pub fn unsubscribe_mints(&mut self, dex: DexType, address: Address)
Unsubscribes from mint events for a specific pool address on a DEX.
Sourcepub fn unsubscribe_burns(&mut self, dex: DexType, address: Address)
pub fn unsubscribe_burns(&mut self, dex: DexType, address: Address)
Unsubscribes from burn events for a specific pool address on a DEX.
Trait Implementations§
Source§impl Debug for DefiDataSubscriptionManager
impl Debug for DefiDataSubscriptionManager
Auto Trait Implementations§
impl Freeze for DefiDataSubscriptionManager
impl RefUnwindSafe for DefiDataSubscriptionManager
impl Send for DefiDataSubscriptionManager
impl Sync for DefiDataSubscriptionManager
impl Unpin for DefiDataSubscriptionManager
impl UnwindSafe for DefiDataSubscriptionManager
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
§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> 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