CollateralDebtData struct contains all debt and collateral information for a credit account, used during collateral checks and liquidations.
Struct Definition
Fields
Current debt principal amount
Current cumulative base interest index in ray units
Cumulative base interest index at last debt update in ray units
Cumulative quota interest accrued by the account
Total accrued interest (base + quota)
Total accrued fees (base + quota)
Total debt value in USD (debt + interest + fees)
Total value of account assets in underlying token units
Total value of account assets in USD
Total weighted value (TWV) in USD, calculated as sum of (collateral value * liquidation threshold)
Bitmask of tokens enabled as collateral on the account
Bitmask of tokens that have active quotas on the account
Array of token addresses with active quotas
Address of the pool quota keeper (internal field)
Usage
This struct is returned byICreditManagerV3.calcDebtAndCollateral() and is used to:
- Perform full collateral checks
- Determine if an account is liquidatable
- Calculate health factors
- Process liquidations
healthFactor = (twvUSD * 10000) / totalDebtUSD