Skip to content

Commit

Permalink
router multi pair swap return type
Browse files Browse the repository at this point in the history
  • Loading branch information
psorinionut committed Nov 15, 2023
1 parent 452cfb0 commit a59a6f4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 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,10 @@ 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 +64,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 a59a6f4

Please sign in to comment.