Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
m-lord-renkse committed Dec 12, 2024
1 parent d445982 commit 8ff6825
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions crates/driver/src/domain/competition/bad_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ impl Detector {
}

async fn determine_sell_token_quality(&self, order: &Order, now: Instant) -> Option<Quality> {
let Some(detector) = self.simulation_detector.as_ref() else {
return None;
};
let detector = self.simulation_detector.as_ref()?;

if let Some(quality) = self.cache.get_quality(order.sell.token, now) {
return Some(quality);
Expand Down
6 changes: 3 additions & 3 deletions crates/driver/src/infra/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl Api {
let router = routes::reveal(router);
let router = routes::settle(router);

let bad_tokens = solver.bad_token_detector().and_then(|bad_token_detector| {
let bad_tokens = solver.bad_token_detector().map(|bad_token_detector| {
// maybe make this as part of the bad token builder?
let config = bad_token_detector
.unsupported_tokens
Expand All @@ -96,13 +96,13 @@ impl Api {
)
.collect::<HashMap<_, _>>();

Some(Arc::new(
Arc::new(
// maybe do proper builder pattern here?
bad_tokens::Detector::default()
.with_simulation_detector(&self.eth.clone())
.with_config(config)
.with_cache(trace_detector.clone()),
))
)
});

let router = router.with_state(State(Arc::new(Inner {
Expand Down
1 change: 1 addition & 0 deletions crates/driver/src/infra/config/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct Config {
archive_node_url: Option<Url>,

/// Cache configuration for the bad tokend detection
#[serde(default)]
bad_token_detection_cache: BadTokenDetectionCache,
}

Expand Down

0 comments on commit 8ff6825

Please sign in to comment.