Skip to content

Commit af0431e

Browse files
committed
code cleanup
1 parent 99289de commit af0431e

File tree

12 files changed

+46
-41
lines changed

12 files changed

+46
-41
lines changed

crates/contracts/build.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,6 @@ fn main() {
13241324
)
13251325
});
13261326

1327-
13281327
generate_contract("BalancerV3WeightedPool");
13291328
generate_contract("BalancerV3StablePool");
13301329
generate_contract("BalancerV3GyroECLPPool");

crates/driver/src/boundary/liquidity/balancer/v3/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ use {
1111
chain::Chain,
1212
contracts::{
1313
BalancerV3BatchRouter,
14+
BalancerV3GyroECLPPoolFactory,
1415
BalancerV3StablePoolFactory,
1516
BalancerV3StablePoolFactoryV2,
1617
BalancerV3Vault,
1718
BalancerV3WeightedPoolFactory,
18-
BalancerV3GyroECLPPoolFactory,
1919
GPv2Settlement,
2020
},
2121
ethrpc::block_stream::{BlockRetrieving, CurrentBlockWatcher},
@@ -37,9 +37,9 @@ use {
3737
std::sync::Arc,
3838
};
3939

40+
pub mod gyro_e;
4041
pub mod stable;
4142
pub mod weighted;
42-
pub mod gyro_e;
4343

4444
/// Maps a Chain to the corresponding GqlChain for Balancer V3 API.
4545
fn chain_to_gql_chain(chain: &Chain) -> GqlChain {
@@ -172,7 +172,9 @@ async fn init_liquidity(
172172
.gyro_e
173173
.iter()
174174
.map(|&factory| {
175-
(BalancerFactoryKind::GyroE, BalancerV3GyroECLPPoolFactory::at(&web3, factory.into())
175+
(
176+
BalancerFactoryKind::GyroE,
177+
BalancerV3GyroECLPPoolFactory::at(&web3, factory.into())
176178
.raw_instance()
177179
.clone(),
178180
)

crates/driver/src/domain/liquidity/balancer/v3/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use {
33
derive_more::{From, Into},
44
};
55

6+
pub mod gyro_e;
67
pub mod stable;
78
pub mod weighted;
8-
pub mod gyro_e;
99

1010
/// A Balancer V3 pool ID.
1111
///

crates/driver/src/infra/liquidity/config.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,7 @@ impl BalancerV3 {
331331
stable_v2: factory_addresses(&[
332332
contracts::BalancerV3StablePoolFactoryV2::raw_contract(),
333333
]),
334-
gyro_e: factory_addresses(&[
335-
contracts::BalancerV3GyroECLPPoolFactory::raw_contract(),
336-
]),
334+
gyro_e: factory_addresses(&[contracts::BalancerV3GyroECLPPoolFactory::raw_contract()]),
337335
pool_deny_list: Vec::new(),
338336
graph_url: graph_url.clone(),
339337
reinit_interval: None,

crates/driver/src/infra/solver/dto/auction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ pub fn new(
393393
.reserves
394394
.iter()
395395
.map(|r| {
396-
(
396+
(
397397
r.asset.token.into(),
398398
solvers_dto::auction::GyroEReserve {
399399
balance: r.asset.amount.into(),

crates/shared/src/sources/balancer_v2/pools/common.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,10 @@ impl<Factory> PoolInfoFetcher<Factory> {
165165

166166
let (token_addresses, balances, _) = balances;
167167
{
168-
let graph_set: std::collections::BTreeSet<_> = pool.tokens.iter().copied().collect();
169-
let vault_set: std::collections::BTreeSet<_> = token_addresses.iter().copied().collect();
168+
let graph_set: std::collections::BTreeSet<_> =
169+
pool.tokens.iter().copied().collect();
170+
let vault_set: std::collections::BTreeSet<_> =
171+
token_addresses.iter().copied().collect();
170172
ensure!(graph_set == vault_set, "pool token mismatch");
171173
}
172174

@@ -183,7 +185,9 @@ impl<Factory> PoolInfoFetcher<Factory> {
183185

184186
let tokens = itertools::izip!(&token_addresses, balances)
185187
.map(|(&address, balance)| {
186-
let scaling_factor = *scaling_by_addr.get(&address).expect("missing scaling factor");
188+
let scaling_factor = *scaling_by_addr
189+
.get(&address)
190+
.expect("missing scaling factor");
187191
let rate = *rate_by_addr.get(&address).expect("missing rate");
188192
(
189193
address,

crates/shared/src/sources/balancer_v3/pool_fetching/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ use {
3535
clap::ValueEnum,
3636
contracts::{
3737
BalancerV3BatchRouter,
38+
BalancerV3GyroECLPPoolFactory,
3839
BalancerV3StablePoolFactory,
3940
BalancerV3StablePoolFactoryV2,
40-
BalancerV3GyroECLPPoolFactory,
4141
BalancerV3Vault,
4242
BalancerV3WeightedPoolFactory,
4343
},
@@ -52,12 +52,12 @@ use {
5252
};
5353
pub use {
5454
common::TokenState,
55+
gyro_e::Version as GyroEPoolVersion,
5556
stable::{
5657
AmplificationParameter,
5758
TokenState as StableTokenState,
5859
Version as StablePoolVersion,
5960
},
60-
gyro_e::Version as GyroEPoolVersion,
6161
weighted::{TokenState as WeightedTokenState, Version as WeightedPoolVersion},
6262
};
6363

crates/shared/src/sources/balancer_v3/pools/common.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -175,21 +175,21 @@ impl<Factory> PoolInfoFetcher<Factory> {
175175
.map(|(&addr, &sf)| (addr, sf))
176176
.collect();
177177

178-
let tokens = itertools::izip!(&tokens, balances, token_rates)
179-
.map(|(&address, balance, rate)| {
180-
let scaling_factor = *scaling_by_addr
181-
.get(&address)
182-
.expect("missing scaling factor for address");
183-
(
184-
address,
185-
TokenState {
186-
balance,
187-
scaling_factor,
188-
rate,
189-
},
190-
)
191-
})
192-
.collect();
178+
let tokens = itertools::izip!(&tokens, balances, token_rates)
179+
.map(|(&address, balance, rate)| {
180+
let scaling_factor = *scaling_by_addr
181+
.get(&address)
182+
.expect("missing scaling factor for address");
183+
(
184+
address,
185+
TokenState {
186+
balance,
187+
scaling_factor,
188+
rate,
189+
},
190+
)
191+
})
192+
.collect();
193193

194194
Ok(PoolState {
195195
paused,

crates/shared/src/sources/balancer_v3/pools/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
//! pool types by just implementing the required `BalancerV3Factory` trait.
99
1010
pub mod common;
11+
pub mod gyro_e;
1112
pub mod stable;
1213
pub mod weighted;
13-
pub mod gyro_e;
1414

1515
use {
1616
super::graph_api::PoolData,

crates/shared/src/sources/balancer_v3/swap/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@ use {
66
conversions::U256Ext,
77
sources::balancer_v3::pool_fetching::{
88
AmplificationParameter,
9+
GyroEPool,
10+
GyroEPoolVersion,
911
StablePool,
1012
TokenState,
1113
WeightedPool,
1214
WeightedPoolVersion,
1315
WeightedTokenState,
14-
GyroEPool,
15-
GyroEPoolVersion
1616
},
1717
},
1818
error::Error,
1919
ethcontract::{H160, U256},
20-
num::BigInt,
2120
fixed_point::Bfp,
21+
num::BigInt,
2222
std::collections::BTreeMap,
2323
};
2424

2525
mod error;
2626
pub mod fixed_point;
2727
pub mod gyro_e_math;
28-
pub mod signed_fixed_point;
2928
mod math;
29+
pub mod signed_fixed_point;
3030
mod stable_math;
3131
mod weighted_math;
3232

0 commit comments

Comments
 (0)