#pool #blockchain #sync #chain #different #across #synchronizing

bin+lib pool-sync

A library for synchronizing and managing various types of liquidity pools across different blockchains

27 releases (14 stable)

2.0.1 Aug 19, 2024
2.0.0 Aug 17, 2024
1.0.11 Aug 6, 2024
1.0.3 Jul 31, 2024
0.1.0 Jun 30, 2024

#58 in #across

Download history 410/week @ 2024-06-27 45/week @ 2024-07-04 1032/week @ 2024-07-18 516/week @ 2024-07-25 964/week @ 2024-08-01 143/week @ 2024-08-08 330/week @ 2024-08-15 19/week @ 2024-08-22 1/week @ 2024-08-29 44/week @ 2024-09-12 83/week @ 2024-09-19 10/week @ 2024-09-26 3/week @ 2024-10-03

140 downloads per month
Used in gweiyser

MIT/Apache and GPL-3.0-only

1MB
23K SLoC

Solidity 20K SLoC // 0.1% comments Rust 2.5K SLoC // 0.0% comments Python 494 SLoC // 0.0% comments

PoolSync

PoolSync is a utility crate for efficiently synchronizing DeFi pools from various protocols on EVM-compatible blockchains. This crate streamlines the process of pool synchronization, eliminating the need for repetitive boilerplate code in DeFi projects.

Installation

Add this to your Cargo.toml:

[dependencies]
pool-sync = "2.0.1"

Configure your .env with a full node and a archive node. Archive must be an archive node. The full node can be either.

FULL = "full node endpoint"
ARCHIVE = "archive node endpoint"

Supported Protocols

ETH

  • UniswapV2/V3
  • SushiswapV2/V2
  • PancakeswapV2/V3
  • MaverickV1/V2

Base

  • UniswapV2/V3
  • SushiswapV2/V3
  • PancakeswapV2/V3
  • BaseswapV2/V3
  • MaverickV1/V2
  • Aerodrome/Slipstream
  • AlienBase

Example Usage

use pool_sync::{PoolSync, PoolType, Chain, PoolInfo};

#[tokio::main]
async fn main() -> Result<()> {
    // Configure and build the PoolSync instance
    let pool_sync = PoolSync::builder()
        .add_pool(PoolType::UniswapV2)
        .chain(Chain::Ethereum)
        .build()?;

    // Synchronize pools
    let (pools, last_synced_block) = pool_sync.sync_pools().await?;

    // Common Info
    for pool in &pools {
        println!("Pool Address {:?}, Token 0: {:?}, Token 1: {:?}", pool.address(), pool.token0(), pool.token1());
    }

    println!("Synced {} pools!", pools.len());
    Ok(())
}

Dependencies

~63MB
~1.5M SLoC