Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/driver/example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ max-order-age = "1m"

# [[liquidity.balancer-v2]] # Balancer V2 configuration
# preset = "balancer-v2"
# graph-url = "http://localhost:1234" # which subgraph url to fetch the data from
# indexer-url = "http://localhost:7777" # pool-indexer base URL to fetch pool data from
# pool-deny-list = [] # optional

# [[liquidity.balancer-v2]] # Custom Balancer V2 configuration
# vault = "0xBA12222222228d8Ba445958a75a0704d566BF2C8"
# weighted = [] # weighted pool factory addresses
# stable = [] # stable pool factory addresses
# liquidity-bootstrapping = [] # liquidity bootstrapping pool factory addresses
# indexer-url = "http://localhost:7777" # pool-indexer base URL to fetch pool data from
# pool-deny-list = [] # which pools to ignore

# [[liquidity.uniswap-v3]] # Uniswap V3 configuration (pool-indexer as data source)
Expand Down
8 changes: 6 additions & 2 deletions crates/driver/src/boundary/liquidity/balancer/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use {
liquidity_sources::balancer_v2::{
BalancerPoolFetcher,
pool_fetching::{BalancerContracts, BalancerFactoryInstance},
pool_indexer::BalancerIndexerClient,
},
shared::http_solver::model::TokenAmount,
solver::{
Expand Down Expand Up @@ -171,12 +172,15 @@ async fn init_liquidity(

let balancer_pool_fetcher = Arc::new(
BalancerPoolFetcher::new(
&config.graph_url,
Box::new(BalancerIndexerClient::new(
config.indexer_url.clone(),
eth.chain(),
boundary::liquidity::http_client(),
)),
block_retriever.clone(),
token_info_fetcher.clone(),
boundary::liquidity::cache_config(),
block_stream.clone(),
boundary::liquidity::http_client(),
web3.clone(),
&contracts,
config.pool_deny_list.to_vec(),
Expand Down
8 changes: 4 additions & 4 deletions crates/driver/src/infra/config/file/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,14 @@ pub async fn load(chain: Chain, path: &Path) -> infra::Config {
file::BalancerV2Config::Preset {
preset,
pool_deny_list,
graph_url,
indexer_url,
reinit_interval,
} => liquidity::config::BalancerV2 {
pool_deny_list: pool_deny_list.clone(),
reinit_interval,
..match preset {
file::BalancerV2Preset::BalancerV2 => {
liquidity::config::BalancerV2::balancer_v2(&graph_url, chain)
liquidity::config::BalancerV2::balancer_v2(&indexer_url, chain)
}
}
.expect("no Balancer V2 preset for current network")
Expand All @@ -285,7 +285,7 @@ pub async fn load(chain: Chain, path: &Path) -> infra::Config {
liquidity_bootstrapping,
composable_stable,
pool_deny_list,
graph_url,
indexer_url,
reinit_interval,
} => liquidity::config::BalancerV2 {
vault: vault.into(),
Expand All @@ -295,7 +295,7 @@ pub async fn load(chain: Chain, path: &Path) -> infra::Config {
liquidity_bootstrapping,
composable_stable,
pool_deny_list: pool_deny_list.clone(),
graph_url,
indexer_url,
reinit_interval,
},
})
Expand Down
8 changes: 4 additions & 4 deletions crates/driver/src/infra/config/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,8 @@ enum BalancerV2Config {
#[serde(default)]
pool_deny_list: Vec<eth::B256>,

/// The URL used to connect to balancer v2 subgraph client.
graph_url: Url,
/// Base URL of the pool-indexer that seeds the pool registry.
indexer_url: Url,

/// How often the liquidity source should be reinitialized to get
/// access to new pools.
Expand Down Expand Up @@ -677,8 +677,8 @@ enum BalancerV2Config {
#[serde(default)]
pool_deny_list: Vec<eth::B256>,

/// The URL used to connect to balancer v2 subgraph client.
graph_url: Url,
/// Base URL of the pool-indexer that seeds the pool registry.
indexer_url: Url,

/// How often the liquidity source should be reinitialized to get
/// access to new pools.
Expand Down
8 changes: 4 additions & 4 deletions crates/driver/src/infra/liquidity/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ pub struct BalancerV2 {
/// ignored.
pub pool_deny_list: Vec<eth::B256>,

/// The base URL used to connect to balancer v2 subgraph client.
pub graph_url: Url,
/// Base URL of the pool-indexer that seeds the pool registry.
pub indexer_url: Url,

/// How often the liquidty source should be re-initialized to become
/// aware of new pools.
Expand All @@ -235,7 +235,7 @@ pub struct BalancerV2 {
impl BalancerV2 {
/// Returns the liquidity configuration for Balancer V2.
#[expect(clippy::self_named_constructors)]
pub fn balancer_v2(graph_url: &Url, chain: Chain) -> Option<Self> {
pub fn balancer_v2(indexer_url: &Url, chain: Chain) -> Option<Self> {
macro_rules! address_for {
( $chain:expr, [ $( $($p:ident)::+ ),* $(,)? ] ) => {{
let arr = [ $({
Expand Down Expand Up @@ -282,7 +282,7 @@ impl BalancerV2 {
]
),
pool_deny_list: Vec::new(),
graph_url: graph_url.clone(),
indexer_url: indexer_url.clone(),
reinit_interval: None,
})
}
Expand Down
Loading
Loading