Trait ChainLogHandler

Source
pub trait ChainLogHandler {
    // Required methods
    fn contract_addresses(&self) -> Vec<Address>;
    fn contract_addresses_map(&self) -> Arc<ContractAddresses>;
    fn contract_address_topics(&self, contract: Address) -> Vec<B256> ;
    fn safe_address(&self) -> Address;
    fn collect_log_event<'life0, 'async_trait>(
        &'life0 self,
        log: SerializableLog,
        is_synced: bool,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SignificantChainEvent>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn contract_addresses(&self) -> Vec<Address>

Source

fn contract_addresses_map(&self) -> Arc<ContractAddresses>

Returns the mapping of contract types to their deployed addresses.

This method provides access to the configuration that maps logical contract roles (token, channels, registry, etc.) to their actual deployed Ethereum addresses.

§Returns
  • &ContractAddresses - Reference to the contract addresses configuration
Source

fn contract_address_topics(&self, contract: Address) -> Vec<B256>

Returns the event signature topics for efficient log filtering.

This method provides the event signatures (topics) that should be monitored for a given contract address, enabling efficient blockchain log filtering by combining address and topic filters.

§Arguments
  • contract - The contract address to get event topics for
§Returns
  • Vec<B256> - Vector of event signature hashes (topics) for the contract
Source

fn safe_address(&self) -> Address

Returns the safe address for this HOPR node.

The safe address is the Ethereum address that holds the node’s tokens and is used for filtering events that are relevant to this specific node.

§Returns
  • Address - The safe contract address for this node
Source

fn collect_log_event<'life0, 'async_trait>( &'life0 self, log: SerializableLog, is_synced: bool, ) -> Pin<Box<dyn Future<Output = Result<Option<SignificantChainEvent>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Processes a single blockchain log and extracts significant events.

This method processes individual blockchain logs, replacing the previous batch processing approach for better error isolation and granular control.

§Arguments
  • log - The blockchain log to process
  • is_synced - Whether the indexer has completed initial synchronization
§Returns
  • Result<Option<SignificantChainEvent>> - Extracted event or None if not significant

Implementors§

Source§

impl<T, Db> ChainLogHandler for ContractEventHandlers<T, Db>
where T: HoprIndexerRpcOperations + Clone + Send + Sync + 'static, Db: HoprDbAllOperations + Clone + Debug + Send + Sync + 'static,