Quipuswap
Searchโ€ฆ
get_toks_per_share
This on-chain view returns amount of token A and token B for the specified amount of LP tokens in a specific liquidity pool (pair). Also can return a list of responses for a list of requests.

Call parameters

type token_id_t is nat
โ€‹
type toks_per_shr_req_t is [@layout:comb] record [
pair_id : token_id_t;
shares_amt : nat;
]
โ€‹
list(toks_per_shr_req_t)
Field
Type
Description
pair_id
token_id_t (nat)
Pair ID for which you need to get tokens amount per shares
shares_amt
nat
Amount of shares to get info about tokens

Return type

type token_id_t is nat
โ€‹
type toks_per_shr_t is [@layout:comb] record [
token_a_amt : nat;
token_b_amt : nat;
]
โ€‹
type toks_per_shr_req_t is [@layout:comb] record [
pair_id : token_id_t;
shares_amt : nat;
]
โ€‹
type toks_per_shr_res_t is [@layout:comb] record [
request : toks_per_shr_req_t;
tokens_per_share : toks_per_shr_t;
]
โ€‹
list(toks_per_shr_res_t)

toks_per_shr_req_t

Field
Type
Description
pair_id
token_id_t (nat)
Pair ID for which you need to get tokens amount per shares
shares_amt
nat
Amount of shares to get info about tokens

toks_per_shr_t

Field
Type
Description
token_a_amt
nat
Amount of tokens A per shares
token_b_amt
nat
Amount of tokens B per shares

toks_per_shr_res_t

Field
Type
Description
request
โ€‹toks_per_shr_req_tโ€‹
Tokens per shares request
tokens_per_share
โ€‹toks_per_shr_tโ€‹
Tokens per shares response

Usage

๐ŸŒฎ Taquito
const dexCoreAddress = "KT1...";
const params = [
{
pair_id: 1,
shares_amt: 100,
},
...
];
const viewCaller = "tz1...";
const dexCore = await tezos.contract.at(dexCoreAddress);
const tokensPerShares = await dexCore.contract.contractViews.get_toks_per_share(params).executeView({ viewCaller: viewCaller });

Errors

  • 108 - pair (pool) with the specified token_id not listed.
  • 109 - pair doesn't have a liquidity.
Copy link
On this page
Call parameters
Return type
Usage
Errors