get_reserves

This on-chain view returns reserves (token A and token B) 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 reserves_req_t     is token_id_t

list(reserves_req_t)

Return type

type token_id_t         is nat

type reserves_t         is [@layout:comb] record [
  token_a_pool            : nat;
  token_b_pool            : nat;
]

type reserves_req_t     is token_id_t

type reserves_res_t     is [@layout:comb] record [
  request                 : reserves_req_t;
  reserves                : reserves_t;
]

list(reserves_res_t)

reserves_t

reserves_res_t

Usage

const dexCoreAddress = "KT1...";
const params = [0, 1, 15];
const viewCaller = "tz1...";
const dexCore = await tezos.contract.at(dexCoreAddress);
const reserves = await dexCore.contract.contractViews.get_reserves(params).executeView({ viewCaller: viewCaller });

Errors

  • 108 - pair (pool) with the specified token_id not listed.

Last updated