diff --git a/crates/core/component/dex/src/component/router/route_and_fill.rs b/crates/core/component/dex/src/component/router/route_and_fill.rs index 39fdde2164..19671b4edd 100644 --- a/crates/core/component/dex/src/component/router/route_and_fill.rs +++ b/crates/core/component/dex/src/component/router/route_and_fill.rs @@ -274,7 +274,7 @@ pub trait RouteAndFill: StateWrite + Sized { } // Ensure that we've actually executed, or else bail out. - let Some(accurate_max_price) = execution.max_price()? else { + let Some(accurate_max_price) = execution.max_price() else { tracing::debug!("no traces in execution, exiting route_and_fill"); break; }; diff --git a/crates/core/component/dex/src/swap_execution.rs b/crates/core/component/dex/src/swap_execution.rs index 15d2007a76..c14daa213c 100644 --- a/crates/core/component/dex/src/swap_execution.rs +++ b/crates/core/component/dex/src/swap_execution.rs @@ -15,17 +15,17 @@ pub struct SwapExecution { impl SwapExecution { /// Returns the price of the latest execution trace. - pub fn max_price(&self) -> Result> { + pub fn max_price(&self) -> Option { let Some((input, output)) = self.traces.last().and_then(|trace| { let input = trace.first()?; let output = trace.last()?; Some((input, output)) }) else { - return Ok(None); + return None; }; - let price = U128x128::ratio(input.amount, output.amount)?; - Ok(Some(price)) + let price = U128x128::ratio(input.amount, output.amount).ok()?; + Some(price) } }