Skip to content

Commit 0fb2bde

Browse files
committed
chore - upgrade to alloy 0.11.0 (removes transport dep)
1 parent ffd25b2 commit 0fb2bde

31 files changed

Lines changed: 3360 additions & 508 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ exclude = ["target/*", ".github/*", ".gitignore"]
1313
[dependencies]
1414
tokio = { version = "1.40.0", features = ["full"] }
1515
uniswap_v3_math = { git = "https://github.com/0xKitsune/uniswap-v3-math.git" }
16-
alloy = { version = "0.9.2", features = ["full"] }
16+
alloy = { version = "0.11.0", features = ["full"] }
1717
alloy-chains = "0.1.57"
1818
tracing = "0.1.37"
1919
async-recursion = "1.0.5"
@@ -41,7 +41,7 @@ artemis = []
4141
[dev-dependencies]
4242
dotenv = "0.15.0"
4343
provider = { path = "../provider" }
44-
rand = "0.8.5"
44+
rand = "0.9.0"
4545
tracing-subscriber = "0.3"
4646
criterion = "0.5"
4747
tokio = { version = "1.40.0", default-features = false, features = [

src/amm/camelot_v3/batch_request.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use alloy::{
55
network::Network,
66
primitives::aliases::I24,
77
providers::Provider,
8-
transports::Transport,
98
};
109
use tracing::instrument;
1110

@@ -39,15 +38,14 @@ fn populate_pool_data_from_tokens(
3938
Some(pool)
4039
}
4140

42-
pub async fn get_camelot_v3_pool_data_batch_request<T, N, P>(
41+
pub async fn get_camelot_v3_pool_data_batch_request<N, P>(
4342
pool: &mut CamelotV3Pool,
4443
block_number: Option<u64>,
4544
provider: Arc<P>,
4645
) -> Result<(), AMMError>
4746
where
48-
T: Transport + Clone,
4947
N: Network,
50-
P: Provider<T, N>,
48+
P: Provider<N>,
5149
{
5250
let deployer = GetCamelotV3PoolDataBatchRequest::deploy_builder(provider, vec![pool.address]);
5351
let res = if let Some(block_number) = block_number {
@@ -90,7 +88,7 @@ pub struct UniswapV3TickData {
9088
pub liquidity_net: i128,
9189
}
9290

93-
pub async fn get_camelot_v3_tick_data_batch_request<T, N, P>(
91+
pub async fn get_camelot_v3_tick_data_batch_request<N, P>(
9492
pool: &CamelotV3Pool,
9593
tick_start: i32,
9694
zero_for_one: bool,
@@ -99,9 +97,8 @@ pub async fn get_camelot_v3_tick_data_batch_request<T, N, P>(
9997
provider: Arc<P>,
10098
) -> Result<(Vec<UniswapV3TickData>, u64), AMMError>
10199
where
102-
T: Transport + Clone,
103100
N: Network,
104-
P: Provider<T, N>,
101+
P: Provider<N>,
105102
{
106103
let deployer = GetCamelotV3TickDataBatchRequest::deploy_builder(
107104
provider,
@@ -172,14 +169,13 @@ where
172169
Ok((tick_data, block_number))
173170
}
174171

175-
pub async fn sync_camelot_v3_pool_batch_request<T, N, P>(
172+
pub async fn sync_camelot_v3_pool_batch_request<N, P>(
176173
pool: &mut CamelotV3Pool,
177174
provider: Arc<P>,
178175
) -> Result<(), AMMError>
179176
where
180-
T: Transport + Clone,
181177
N: Network,
182-
P: Provider<T, N>,
178+
P: Provider<N>,
183179
{
184180
let deployer = SyncCamelotV3PoolBatchRequest::deploy_builder(provider, vec![pool.address]);
185181
let res = deployer.call_raw().await?;
@@ -231,15 +227,14 @@ where
231227
}
232228

233229
#[instrument(skip(provider) level = "debug")]
234-
pub async fn get_amm_data_batch_request<T, N, P>(
230+
pub async fn get_amm_data_batch_request<N, P>(
235231
amms: &mut [AMM],
236232
block_number: u64,
237233
provider: Arc<P>,
238234
) -> Result<(), AMMError>
239235
where
240-
T: Transport + Clone,
241236
N: Network,
242-
P: Provider<T, N>,
237+
P: Provider<N>,
243238
{
244239
let mut target_addresses = vec![];
245240

src/amm/camelot_v3/factory.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use alloy::{
1010
rpc::types::eth::{Filter, Log},
1111
sol,
1212
sol_types::SolEvent,
13-
transports::Transport,
1413
};
1514
use alloy_chains::NamedChain;
1615
use async_trait::async_trait;
@@ -91,11 +90,10 @@ impl AutomatedMarketMakerFactory for CamelotV3Factory {
9190
ICamelotV3Factory::Pool::SIGNATURE_HASH
9291
}
9392

94-
async fn new_amm_from_log<T, N, P>(&self, log: Log, provider: Arc<P>) -> Result<AMM, AMMError>
93+
async fn new_amm_from_log<N, P>(&self, log: Log, provider: Arc<P>) -> Result<AMM, AMMError>
9594
where
96-
T: Transport + Clone,
9795
N: Network,
98-
P: Provider<T, N>,
96+
P: Provider<N>,
9997
{
10098
if let Some(block_number) = log.block_number {
10199
let pool_created_filter = ICamelotV3Factory::Pool::decode_log(&log.inner, true)?;
@@ -108,16 +106,15 @@ impl AutomatedMarketMakerFactory for CamelotV3Factory {
108106
}
109107
}
110108

111-
async fn get_all_amms<T, N, P>(
109+
async fn get_all_amms<N, P>(
112110
&self,
113111
to_block: Option<u64>,
114112
provider: Arc<P>,
115113
step: u64,
116114
) -> Result<Vec<AMM>, AMMError>
117115
where
118-
T: Transport + Clone,
119116
N: Network,
120-
P: Provider<T, N>,
117+
P: Provider<N>,
121118
{
122119
if let Some(block) = to_block {
123120
self.get_all_pools_from_logs(block, step, provider).await
@@ -127,16 +124,15 @@ impl AutomatedMarketMakerFactory for CamelotV3Factory {
127124
}
128125

129126
#[instrument(skip(self, amms, provider) level = "debug")]
130-
async fn populate_amm_data<T, N, P>(
127+
async fn populate_amm_data<N, P>(
131128
&self,
132129
amms: &mut [AMM],
133130
block_number: Option<u64>,
134131
provider: Arc<P>,
135132
) -> Result<(), AMMError>
136133
where
137-
T: Transport + Clone,
138134
N: Network,
139-
P: Provider<T, N>,
135+
P: Provider<N>,
140136
{
141137
if let Some(block_number) = block_number {
142138
// Max batch size for call
@@ -189,16 +185,15 @@ impl CamelotV3Factory {
189185
}
190186
}
191187

192-
pub async fn get_all_pools_from_logs<T, N, P>(
188+
pub async fn get_all_pools_from_logs<N, P>(
193189
self,
194190
to_block: u64,
195191
step: u64,
196192
provider: Arc<P>,
197193
) -> Result<Vec<AMM>, AMMError>
198194
where
199-
T: Transport + Clone,
200195
N: Network,
201-
P: Provider<T, N>,
196+
P: Provider<N>,
202197
{
203198
// Unwrap can be used here because the creation block was verified within `Dex::new()`
204199
let mut from_block = self.creation_block;
@@ -280,17 +275,16 @@ impl CamelotV3Factory {
280275
}
281276

282277
// Function to get all pair created events for a given Dex factory address and sync pool data
283-
pub async fn get_pools_from_logs<T, N, P>(
278+
pub async fn get_pools_from_logs<N, P>(
284279
self,
285280
start_block: u64,
286281
to_block: u64,
287282
step: u64,
288283
provider: Arc<P>,
289284
) -> Result<Vec<AMM>, AMMError>
290285
where
291-
T: Transport + Clone,
292286
N: Network,
293-
P: Provider<T, N>,
287+
P: Provider<N>,
294288
{
295289
// Unwrap can be used here because the creation block was verified within `Dex::new()`
296290
let mut aggregated_amms: HashMap<Address, AMM> = HashMap::new();

0 commit comments

Comments
 (0)