Querying Pool Data
Use ScallopQuery to read market data such as pool APYs, utilization, collateral factors, flash loan fees and total value locked. These methods do not need a secretKey.
import { ScallopQuery } from '@scallop-io/sui-scallop-sdk';
const scallopQuery = new ScallopQuery({
addressId: '695fcdc084f790c04eb068dc',
network: 'mainnet',
fullnodeUrl: 'https://fullnode.mainnet.sui.io:443',
walletAddress: '0x...',
});
await scallopQuery.init();Get Market Pools
Returns the lending pools and the collaterals of the given coins, keyed by coin name. If no coin is given, all whitelisted lending pools are returned.
const { pools, collaterals } = await scallopQuery.getMarketPools();
const sui = pools.sui;
console.log(sui?.supplyApy); // supply APY
console.log(sui?.borrowApy); // borrow APY
console.log(sui?.utilizationRate);
console.log(sui?.supplyCoin); // total supplied, in coin unit
console.log(sui?.borrowCoin); // total borrowed, in coin unit
console.log(sui?.coinPrice);To get a single pool:
Main Fields of MarketPool
supplyApr / supplyApy
Current supply rate
borrowApr / borrowApy
Current borrow rate
utilizationRate
Borrowed amount divided by supplied amount
supplyCoin / borrowCoin
Total supplied / borrowed, in coin unit
maxSupplyCoin / maxBorrowCoin
Pool supply / borrow limit, in coin unit
conversionRate
Exchange rate between the sCoin and the underlying coin
borrowFee
Fee charged when borrowing
minBorrowAmount
Minimum amount of one borrow
isIsolated
Whether the asset is an isolated asset
Get Market Collaterals
Returns the collateral parameters of the given coins. If no coin is given, all whitelisted collaterals are returned.
Get Pool Limits
Get Flash Loan Fees
Returns the fee rate of each asset as a decimal (e.g. 0.0005 is 0.05%).
Get Isolated Assets
Isolated assets have extra restrictions when used as collateral or borrowed.
Get Total Value Locked
Get Coin Prices
Get Borrow Incentive Pools
Was this helpful?