From c6c045d5b184da2b7b3db6b7b7baec2602b80255 Mon Sep 17 00:00:00 2001 From: Sorin Petreasca Date: Mon, 14 Oct 2024 17:57:35 +0300 Subject: [PATCH] small router fixes --- dex/router/src/events.rs | 4 ++++ dex/router/src/multi_pair_swap.rs | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dex/router/src/events.rs b/dex/router/src/events.rs index fc83ce973..b80888e5a 100644 --- a/dex/router/src/events.rs +++ b/dex/router/src/events.rs @@ -107,7 +107,9 @@ pub trait EventsModule { self.multi_pair_swap_event( caller.clone(), token_in.clone(), + amount_in.clone(), token_out.token_identifier.clone(), + token_out.amount.clone(), epoch, MultiPairSwapEvent { caller, @@ -148,7 +150,9 @@ pub trait EventsModule { &self, #[indexed] caller: ManagedAddress, #[indexed] token_in: TokenIdentifier, + #[indexed] amount_in: BigUint, #[indexed] token_out: TokenIdentifier, + #[indexed] amount_out: BigUint, #[indexed] epoch: u64, multi_pair_swap_event: MultiPairSwapEvent, ); diff --git a/dex/router/src/multi_pair_swap.rs b/dex/router/src/multi_pair_swap.rs index bb9bf703f..8a09bfb9f 100644 --- a/dex/router/src/multi_pair_swap.rs +++ b/dex/router/src/multi_pair_swap.rs @@ -64,7 +64,10 @@ pub trait MultiPairSwap: ); last_payment = payment; - payments.push(residuum); + + if residuum.amount > 0 { + payments.push(residuum); + } } else { sc_panic!("Invalid function to call"); }