Skip to main content

participant_health_for_company

Schema: lib_lending

Description

This function calculates the health for each borrower/lender within a lending protocol for a given company.

Usage

Signature

lib_lending.participant_health_for_company(company text, include_lending_pool_as_participant boolean, include_zero_balances boolean)

Parameters

NameTypeDescription
companytextThe name of the company; participant health will be calculated for all participants in any of the company's lending pools
include_lending_pool_as_participantbooleanShould the lending pool contract be considered a participant if it holds a balance of LP token? Defaults to false
include_zero_balancesbooleanShould zero balances (no current borrows or lends) be included in the results? Defaults to false?

Results

Column NameDescription
participantThe address of the participant
usd_lend_balanceThe total USD value the participant has lent across all pools
usd_collateral_valueThe total USD value of the participant's collateral, taking into account the latest collateral factor
usd_borrow_balanceThe total USD value the participant has borrowed across all pools
lend_symbolsAn array of all token symbols the participant is currently lending
borrow_symbolsAn array of all token symbols the participant is currently borrowing

Examples

Get participant health for all participants in company XYZ's pools
select *
from lib_lending.participant_health_for_company('XYZ');
Get participant health for all participants in company XYZ's pools including zero-balances and lending contracts
select *
from lib_lending.participant_health_for_company(
'XYZ',
include_lending_pool_as_participant=>true,
include_zero_balances=>true
);