Skip to content

Commit

Permalink
Get rid of unwraps
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinquaXD committed Dec 8, 2023
1 parent 96c6609 commit 4e79635
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions crates/shared/src/price_estimation/competition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use {
future::FusedFuture,
stream::{FuturesUnordered, StreamExt},
FutureExt as _,
TryFutureExt,
},
gas_estimation::{GasPrice1559, GasPriceEstimating},
model::order::OrderKind,
Expand Down Expand Up @@ -382,11 +383,15 @@ impl PriceRanking {
let gas = gas.clone();
let native = native.clone();
async move {
let (native, gas) =
futures::join!(native.estimate_native_price(token), gas.estimate());
let gas = gas
.estimate()
.map_err(PriceEstimationError::ProtocolInternal);
let (native_price, gas_price) =
futures::try_join!(native.estimate_native_price(token), gas)?;

Ok(RankingContext {
native_price: native.unwrap(),
gas_price: gas.unwrap(),
native_price,
gas_price,
})
}
.boxed()
Expand Down

0 comments on commit 4e79635

Please sign in to comment.