Quipuswap
Searchโ€ฆ
get_swap_min_res
This on-chain view returns a minimum result (output) of a swap.

Call parameters

type token_id_t is nat
โ€‹
type swap_direction_t is
| A_to_b
| B_to_a
โ€‹
type swap_slice_t is [@layout:comb] record [
direction : swap_direction_t;
pair_id : token_id_t;
]
โ€‹
type get_swap_min_res_t is [@layout:comb] record [
swaps : list(swap_slice_t);
amount_in : nat;
]

swap_slice_t

Field
Type
Description
direction
swap_direction_t
Swap direction: A->B or B->A
pair_id
token_id_t (nat)
ID of a pair in which swap will be executed

get_swap_min_res_t

Field
Type
Description
swaps
A route of a swap
amount_in
nat
Amount of tokens to swap from

Return type

nat

Usage

๐ŸŒฎ Taquito
const dexCoreAddress = "KT1...";
const params = {
swaps: [
{
direction: {
a_to_b: undefinded,
},
pair_id: 1,
},
...
],
amount_in: 1000,
};
const viewCaller = "tz1...";
const dexCore = await tezos.contract.at(dexCoreAddress);
const swapMinRes = await dexCore.contract.contractViews.get_swap_min_res(params).executeView({ viewCaller: viewCaller });

Errors

  • 108 - pair (pool) with the specified token_id not listed.
  • 109 - pair doesn't have a liquidity.
  • 113 - a Bucket contract not found (not TOK/TEZ LP pair).
  • 117 - empty route of swaps.
  • 118 - zero amount in was passed as the parameter.
  • 119 - wrong route of a swap.
Copy link
On this page
Call parameters
Return type
Usage
Errors