Health Check
Overview
The Health Check function evaluates account solvency by calculating risk-adjusted values of assets and debts. It handles multiple asset types including collateral, Fixed Tokens, Loan Tokens, and limit orders, each with specific risk adjustment mechanisms.
Collateral Assets
Collateral assets such as WETH, wstETH, WBTC are risk adjusted using the following formula:
Implementation:
function getCollateralRiskAdjustedValue(
MarketContext memory context,
address oracle,
uint256 lltv,
AccountState memory accountState
) internal view returns (uint256)
The following variables are inherited from the reference Morpho market:
- Oracle price
- LLTV (Liquidation Loan-to-Value) factor
Fixed Tokens
To adjust Fixed Tokens, the protocol uses the following method:
This adjustment ensures that Fixed Tokens are always discounted at a minimum exchange rate of 1.01. This constraint serves to limit the value of Fixed Tokens for their collateral purpose as they approach maturity.
Lend Limit Orders
A user can hold lend limit orders as collateral in their account on the Tenor protocol. Limit orders can have a claim on Loan Tokens and Fixed Tokens. The risk adjusted value of limit orders increases monotonically over time. Moreover adding a limit order as collateral will always decrease the user's collateral versus holding the initial balance of tokens directly at the moment the user's executes the transaction. These two properties are important to ensure that an account's health never decreases due to a discrete change in the limit order's balances.
Borrow Limit Orders
A user can hold borrow limit orders as collateral in their account on the Tenor Protocol. Borrow limit orders can have a claim on Loan Tokens and Fixed Tokens. The protocol performs the following adjustment:
The adjustment above values the limit order's Fixed Tokens as if they were converted to Loan Tokens at the tick's exchange rate. It the adds the Loan Tokens to the actual Loan Token claims converted to their value in the market's underlying asset.
Fixed Rate Debts
The protocol values Fixed Debts at their face value during the healthCheck calculation process.
Risk Parameters
Parameter | Description | Usage |
---|---|---|
FIXED_TOKEN_RISK_ADJUSTMENT_EXCHANGE_RATE | Minimum exchange rate | Floor for risk calculations |
MAX_ACCOUNT_ACTIVE_MATURITIES | Maximum active maturities | Account state limit |