// look up token index by mint public key
mangoGroup.getTokenIndex(token: PublicKey): number
// fetch total deposits/borrows, deposit and borrow interest rates, as well as percent utilization of each token in the group
const rootBanks = await mangoGroup.loadRootBanks(connection);
const tokensInfo = groupConfig.tokens.map((token) => {
const rootBank = rootBanks.find((bank) => {
return bank.publicKey.toBase58() == token.rootKey.toBase58();
throw new Error("rootBanks is undefined");
totalDeposits: totalDeposits.toFixed(
tokenPrecision[token.symbol] || 2
totalBorrows: totalBorrows.toFixed(
tokenPrecision[token.symbol] || 2
.getDepositRate(mangoGroup)
.mul(I80F48.fromNumber(100)),
.getBorrowRate(mangoGroup)
.mul(I80F48.fromNumber(100)),
utilization: totalDeposits.gt(I80F48.fromNumber(0))
? totalBorrows.div(totalDeposits)