Query data

Learn how to query data via the protocol

Query Contract Data

As a Lender, all of the important information regarding the vault can be called back from the contract.

When you call any read function from typescript using popular Ethereum libraries like ethers.js or web3.js, it will return a full list of fields available from the contract ABI.

Get Pool Overview State

To get the current state of the pool, you can call the function

  function getPoolDynamicOverviewState()

and it will return the Dynamic Pool Overview data in the following structure

struct IPoolOverviewStateDynamic {
  address poolAddr; // the contract address for the pool
  uint256 state; // the current state of the pool e.g. active or paused
  uint256 totalAssetsDeposited; // total assets deposited to date
  uint256 totalAssetsWithdrawn;  // total assets withdrawn to date
  uint256 totalAssets;  // the current amount of assets in the pool
  uint256 totalShares;  // the total amount of vault tokens outstanding
  uint256 exchangeRate; // the current share to assets exchange rate
  uint256 exchangeRateAtSetDay; // the exchange rate on the day it is set
  uint256 exchangeRateSetDay; // the day the exchange rate is set
  uint256 exchangeRateChangeRate; // the daily rate of change for the exchange rate (only relevant for linear and term methods)
  uint256 exchangeRateCompoundingRate;  // the daily rate of change for the exchange rate (only relevant for linear, compounding, and term methods)
  uint256 exchangeRateAtMaturity; // the exchange rate on the maturity date (term pools only)
  uint256 exchangeRateMaturityDay; // the maturity date of the loan (term pools only)
  uint256 interestRate; // the current APY in bps being earned by lenders (linear, compounding, term)
  uint256 indicativeInterestRate; // the current target APY for the pool 
  uint256 collateralRate; // the current collateral rate in APY for the pool (dynamic pools only)
  //
  IPoolWithdrawDynamic[] activeWithdraws;
}

Get Pool Configuration

To get the current parameters and configuration of the pool, you can call...

function getPoolDynamicConfigurationState()
        external
        view
        returns (IPoolConfigurationStateDynamic memory);

and it will return the following data

struct IPoolConfigurationStateDynamic {
  address poolAddr; // the contract address of the vault
  string name; // the name of the vault
  string symbol; // the symbol for vault token 
  address poolAccessControl; // the contract address of the access controller
  address poolControllerDynamic; // the contract address of the pool controller
  uint256 activatedAt; // the time the vault was activated
  // PoolControllerDynamic
  address serviceConfiguration; // the contract address of the service configuration
  address liquidityAssetAddr; // the contract address of for the liquidity asset e.g. USDC
  address poolAdmin; // the wallet address of the pool admin
  address borrowerManager; // the wallet address of the borrower manager
  address borrowerWalletAddr; // the wallet address of the borrower 
  address feeCollectorAddress; // the contract address of the fee collector
  uint256 closeOfDepositTime; // the cut-off time loans being treated as same-day
  uint256 closeOfWithdrawTime; // the cut-off time withdrawals being treated as same-day
  uint256 transferOutDays; // the withdrawal processing time 
  
  IPoolDynamicExchangeRateType exchangeRateType; // the exchange rate method used by the vault

Get Account Overview

To get data on a specific wallet address ("account"), you can call the following function...

    function getPoolAccountState(
        address accountAddr
    ) external view returns (IPoolAccountStateFlex memory)

and it will return the following data

struct IPoolAccountStateDynamic {
  address poolAddr; // the contract address of the pool
  address accountAddr;  // the wallet address for the account
  address liquidityAssetAddr;  // the contract address for the liquidity asset e.g. USDC
  uint256 tokenBalance; // the amount of vault tokens held by the account
  uint256 assetBalance; // the current account balance - vault tokens * current exchange rate
  uint256 maxWithdrawRequest; // the maximum withdrawal request the wallet can make, denominated in assets
  uint256 maxRedeemRequest; //the maximum withdrawal request the wallet can make, denominated in shares
  uint256 requestedSharesOf; // outstanding withdrawal requests for the account, in shares
  uint256 requestedAssetsOf; // outstanding withdrawal requests for the account, in assets
  uint256 acceptedShares; // accepted withdrawal requests for the account, in shares
  uint256 acceptedAssets; // accepted withdrawal requests for the account, in shares
  uint256 assetsDeposited; // total deposits made in the vault by the account to date
  uint256 assetsWithdrawn; // total withdrawals made from the vault by the account to date
}

Last updated