Skip to content

Commit

Permalink
Store contracts in struct
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinquaXD committed Oct 18, 2023
1 parent a04a58a commit f4a4b88
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions crates/solvers/src/domain/solver/dex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ impl Dex {
dex,
simulator: infra::dex::Simulator::new(
&config.node_url,
config.settlement,
config.authenticator,
config.contracts.settlement,
config.contracts.authenticator,
),
slippage: config.slippage,
concurrent_requests: config.concurrent_requests,
Expand Down
2 changes: 1 addition & 1 deletion crates/solvers/src/infra/config/dex/balancer/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub async fn load(path: &Path) -> super::Config {
.vault
.map(eth::ContractAddress)
.unwrap_or(contracts.balancer_vault),
settlement: base.settlement,
settlement: base.contracts.settlement,
},
base,
}
Expand Down
6 changes: 4 additions & 2 deletions crates/solvers/src/infra/config/dex/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ pub async fn load<T: DeserializeOwned>(path: &Path) -> (super::Config, T) {

let config = super::Config {
node_url: config.node_url,
settlement,
authenticator,
contracts: super::Contracts {
settlement,
authenticator,
},
slippage: slippage::Limits::new(
config.relative_slippage,
config.absolute_slippage.map(eth::Ether),
Expand Down
8 changes: 6 additions & 2 deletions crates/solvers/src/infra/config/dex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ use {
std::num::NonZeroUsize,
};

pub struct Config {
pub node_url: reqwest::Url,
pub struct Contracts {
pub settlement: eth::ContractAddress,
pub authenticator: eth::ContractAddress,
}

pub struct Config {
pub node_url: reqwest::Url,
pub contracts: Contracts,
pub slippage: slippage::Limits,
pub concurrent_requests: NonZeroUsize,
pub smallest_partial_fill: eth::Ether,
Expand Down

0 comments on commit f4a4b88

Please sign in to comment.