Skip to main content
RiskLens is a read-only helper for the app. It wraps Stockline’s health, max borrow, and liquidation price views and adds a display multiplier read from the stock token’s optional uiMultiplier(). The multiplier is display only and never enters risk math. snapshot returns an account’s full picture in one call. RiskLens lets you:
  • Read health, max borrow, and liquidation price
  • Read collateral in share-equivalent display units
  • Fetch a full account snapshot in one call
Addresses per network. Every address is also on Addresses. The source code is src/periphery/RiskLens.sol on GitHub. The ABI is /abis/RiskLens.json.

Read methods

health

Returns Stockline.health(account): collateral at the liquidation threshold divided by debt, in WAD. Input parameters Return values

maxBorrow

Returns Stockline.maxBorrow(account). Input parameters Return values

liquidationPrice

Returns Stockline.liquidationPrice(account, bookId). Input parameters Return values

collateralUi

Returns the account’s collateral in a book multiplied by the token’s uiMultiplier and divided by 1e18, for display. Input parameters Return values

uiMultiplier

Reads uiMultiplier() from a token with a static call. Returns 1e18 if the call fails, returns nothing, or returns 0.
SPEC: read token.uiMultiplier() when present. Missing or zero means 1e18 (1:1).
Input parameters Return values

snapshot

Returns health, max borrow, and one BookSnapshot per book the account holds. Each snapshot has the book id, collateral token, raw and display amounts, current debt, and liquidation price.
Reads every held book’s oracle price. Reverts with PriceUnavailable when any held book cannot be priced.
Input parameters Return values

Errors

ZeroAddress

The core was zero at deployment.