Skip to content

Commit

Permalink
Merge pull request #783 from multiversx/router-multi-pair-swap-return…
Browse files Browse the repository at this point in the history
…-payments

Router multi pair swap return payments
  • Loading branch information
psorinionut authored Apr 8, 2024
2 parents 816d30a + 0469d5e commit dc28963
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dex/router/src/multi_pair_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub const SWAP_TOKENS_FIXED_OUTPUT_FUNC_NAME: &[u8] = b"swapTokensFixedOutput";
pub trait MultiPairSwap: factory::FactoryModule + token_send::TokenSendModule {
#[payable("*")]
#[endpoint(multiPairSwap)]
fn multi_pair_swap(&self, swap_operations: MultiValueEncoded<SwapOperationType<Self::Api>>) {
fn multi_pair_swap(&self, swap_operations: MultiValueEncoded<SwapOperationType<Self::Api>>) -> ManagedVec<EsdtTokenPayment> {
let (token_id, nonce, amount) = self.call_value().single_esdt().into_tuple();
require!(nonce == 0, "Invalid nonce. Should be zero");
require!(amount > 0u64, "Invalid amount. Should not be zero");
Expand Down Expand Up @@ -61,6 +61,8 @@ pub trait MultiPairSwap: factory::FactoryModule + token_send::TokenSendModule {

payments.push(last_payment);
self.send().direct_multi(&caller, &payments);

payments
}

fn actual_swap_fixed_input(
Expand Down

0 comments on commit dc28963

Please sign in to comment.