Skip to main content
The CollateralDebtData struct contains all debt and collateral information for a credit account, used during collateral checks and liquidations.

Struct Definition

struct CollateralDebtData {
    uint256 debt;
    uint256 cumulativeIndexNow;
    uint256 cumulativeIndexLastUpdate;
    uint128 cumulativeQuotaInterest;
    uint256 accruedInterest;
    uint256 accruedFees;
    uint256 totalDebtUSD;
    uint256 totalValue;
    uint256 totalValueUSD;
    uint256 twvUSD;
    uint256 enabledTokensMask;
    uint256 quotedTokensMask;
    address[] quotedTokens;
    address _poolQuotaKeeper;
}

Fields

debt
uint256
Current debt principal amount
cumulativeIndexNow
uint256
Current cumulative base interest index in ray units
cumulativeIndexLastUpdate
uint256
Cumulative base interest index at last debt update in ray units
cumulativeQuotaInterest
uint128
Cumulative quota interest accrued by the account
accruedInterest
uint256
Total accrued interest (base + quota)
accruedFees
uint256
Total accrued fees (base + quota)
totalDebtUSD
uint256
Total debt value in USD (debt + interest + fees)
totalValue
uint256
Total value of account assets in underlying token units
totalValueUSD
uint256
Total value of account assets in USD
twvUSD
uint256
Total weighted value (TWV) in USD, calculated as sum of (collateral value * liquidation threshold)
enabledTokensMask
uint256
Bitmask of tokens enabled as collateral on the account
quotedTokensMask
uint256
Bitmask of tokens that have active quotas on the account
quotedTokens
address[]
Array of token addresses with active quotas
_poolQuotaKeeper
address
Address of the pool quota keeper (internal field)

Usage

This struct is returned by ICreditManagerV3.calcDebtAndCollateral() and is used to:
  • Perform full collateral checks
  • Determine if an account is liquidatable
  • Calculate health factors
  • Process liquidations
The health factor can be calculated as: healthFactor = (twvUSD * 10000) / totalDebtUSD

Build docs developers (and LLMs) love