evm-dex-pool 1.2.2

Reusable EVM DEX pool implementations (UniswapV2, UniswapV3, ERC4626) with traits and math
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use alloy::primitives::TxHash;

/// Trait for recording collector-level metrics.
///
/// Consumers implement this for their own metrics infrastructure.
/// Pass as `Option<Arc<dyn CollectorMetrics>>` to `EventProcessor` / `UnifiedPoolUpdater`.
pub trait CollectorMetrics: Send + Sync {
    /// Record that a new opportunity was received from a swap event.
    fn add_opportunity(&self, tx_hash: TxHash, log_index: u64, received_at: u64);

    /// Record the timestamp at which the event was processed.
    fn set_processed_at(&self, tx_hash: TxHash, log_index: u64, processed_at: u64);
}