Skip to content

Commit

Permalink
fix: remove gas for native
Browse files Browse the repository at this point in the history
  • Loading branch information
AmanRaj1608 committed Jul 16, 2024
1 parent 8f97b9b commit 9873fb9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/routing-engine/src/routing_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl RoutingEngine {
let y = self.estimates.y_value;
let mut assets_sorted_by_bridging_cost: Vec<(TokenWithBalance, f64)> =
stream::iter(assets.into_iter())
.then(|balance| async move {
.then(|mut balance| async move {
let balance_taken = cmp::min_by(to_value_usd, balance.amount_in_usd, |a, b| {
a.partial_cmp(b).unwrap_or_else(|| cmp::Ordering::Less)
});
Expand All @@ -174,6 +174,13 @@ impl RoutingEngine {
),
)
.await;

if balance.token == "ETH" {
balance.amount_in_usd -= 1.0;
}
if balance.amount_in_usd < 0.0 {
balance.amount_in_usd = 0.0;
}
(balance, fee_cost)
})
.collect::<Vec<_>>()
Expand Down

0 comments on commit 9873fb9

Please sign in to comment.