Skip to content

Commit

Permalink
Review updates
Browse files Browse the repository at this point in the history
  • Loading branch information
grod220 committed Mar 1, 2024
1 parent f2e360c commit fa6d6a2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/core/component/dex/src/component/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,15 @@ impl SimulationService for Server {
.map_err(|e| tonic::Status::internal(format!("error simulating trade: {:#}", e)))?;

let unfilled = Value {
amount: input.amount - swap_execution.input.amount,
amount: input
.amount
.checked_sub(&swap_execution.input.amount)
.ok_or_else(|| {
tonic::Status::failed_precondition(
"swap execution input amount is larger than request input amount"
.to_string(),
)
})?,
asset_id: input.asset_id,
};

Expand Down

0 comments on commit fa6d6a2

Please sign in to comment.