-
Notifications
You must be signed in to change notification settings - Fork 131
/
Copy pathsync-amms.rs
43 lines (37 loc) · 1.15 KB
/
sync-amms.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use alloy::{primitives::address, providers::ProviderBuilder};
use amms::{
amm::{
factory::Factory, uniswap_v2::factory::UniswapV2Factory,
uniswap_v3::factory::UniswapV3Factory,
},
sync,
};
#[tokio::main]
async fn main() -> eyre::Result<()> {
tracing_subscriber::fmt::init();
// Add rpc endpoint here:
let rpc_endpoint = std::env::var("ETHEREUM_RPC_ENDPOINT")?;
let provider = ProviderBuilder::new().on_http(rpc_endpoint.parse()?);
let factories = vec![
// Add UniswapV2
Factory::UniswapV2Factory(UniswapV2Factory::new(
address!("5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f"),
2638438,
300,
)),
// Add Sushiswap
Factory::UniswapV2Factory(UniswapV2Factory::new(
address!("C0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac"),
10794229,
300,
)),
// Add UniswapV3
Factory::UniswapV3Factory(UniswapV3Factory::new(
address!("1F98431c8aD98523631AE4a59f267346ea31F984"),
185,
)),
];
// Sync pairs
sync::sync_amms(factories, provider, None, 500).await?;
Ok(())
}