pub struct PoolSync {
pub fetchers: HashMap<PoolType, Arc<dyn PoolFetcher>>,
pub chain: Chain,
pub rate_limit: u64,
pub start_block: Option<u64>,
pub end_block: Option<u64>,
}Expand description
The main struct for pool synchronization
Fields§
§fetchers: HashMap<PoolType, Arc<dyn PoolFetcher>>Map of pool types to their fetcher implementations
chain: ChainThe chain to sync on
rate_limit: u64The rate limit of the rpc
start_block: Option<u64>Optional starting block for synchronization (overrides cache)
end_block: Option<u64>Optional ending block for synchronization (overrides latest block)
Implementations§
Source§impl PoolSync
impl PoolSync
Sourcepub fn builder() -> PoolSyncBuilder
pub fn builder() -> PoolSyncBuilder
Construct a new builder to configure sync parameters
Examples found in repository?
examples/mantle_integration_test.rs (line 12)
10async fn main() -> Result<()> {
11 // Configure and build the PoolSync instance for Mantle
12 let pool_sync = PoolSync::builder()
13 .add_pool(PoolType::UniswapV3) // Uniswap V3 on Mantle
14 .chain(Chain::Mantle) // Target Mantle chain
15 .build()?;
16
17 // Synchronize pools
18 let (pools, last_synced_block) = pool_sync.sync_pools().await?;
19
20 // Display results (same format as your example)
21 println!("=== Mantle Chain Pool Sync Results ===");
22 for pool in &pools {
23 println!(
24 "Pool Address {:?}, Token 0: {:?}, Token 1: {:?}",
25 pool.address(),
26 pool.token0_name(),
27 pool.token1_name()
28 );
29 }
30
31 println!("Synced {} pools on Mantle chain (Uniswap V3)!", pools.len());
32 println!("Last synced block: {}", last_synced_block);
33
34 Ok(())
35}Sourcepub async fn sync_pools(&self) -> Result<(Vec<Pool>, u64), PoolSyncError>
pub async fn sync_pools(&self) -> Result<(Vec<Pool>, u64), PoolSyncError>
Synchronizes all added pools for the specified chain
Examples found in repository?
examples/mantle_integration_test.rs (line 18)
10async fn main() -> Result<()> {
11 // Configure and build the PoolSync instance for Mantle
12 let pool_sync = PoolSync::builder()
13 .add_pool(PoolType::UniswapV3) // Uniswap V3 on Mantle
14 .chain(Chain::Mantle) // Target Mantle chain
15 .build()?;
16
17 // Synchronize pools
18 let (pools, last_synced_block) = pool_sync.sync_pools().await?;
19
20 // Display results (same format as your example)
21 println!("=== Mantle Chain Pool Sync Results ===");
22 for pool in &pools {
23 println!(
24 "Pool Address {:?}, Token 0: {:?}, Token 1: {:?}",
25 pool.address(),
26 pool.token0_name(),
27 pool.token1_name()
28 );
29 }
30
31 println!("Synced {} pools on Mantle chain (Uniswap V3)!", pools.len());
32 println!("Last synced block: {}", last_synced_block);
33
34 Ok(())
35}Auto Trait Implementations§
impl Freeze for PoolSync
impl !RefUnwindSafe for PoolSync
impl Send for PoolSync
impl Sync for PoolSync
impl Unpin for PoolSync
impl !UnwindSafe for PoolSync
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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