Skip to main content
Use views.read* helpers for most UI and backend reads, and pair them with chain-aware addresses from @varla/sdk/addresses or getVarlaContracts. These helpers return normalized shapes (WAD/RAY fields, decoded structs) so you don’t have to hand-roll multicalls.

Borrower: account snapshot

const a = await views.readAccountSnapshot({ client, core, user });
// a: { portfolioValue, collateralValue, debt, healthFactor, maxBorrow, ... }
Notes: portfolioValue is the sum of priced collateral (pre-LTV) and collateralValue is post-LTV. If a price is unavailable, the protocol treats it as 0 for accounting.

Borrower: liquidation guards (oracle safety)

const g = await views.readOracleGuardsStatus({ client, core, user });
// g: { ok, badPid, until }
Interpretation: ok=false means a liquidation would be blocked right now even if HF < 1.0. If until != 0, you’re in an oracle recovery grace window.

Lender: current value + withdrawable

const l = await views.readLenderSnapshot({ client, pool, user });
// l: { shares, assets, maxWithdrawAssets, maxRedeemShares }
Important: assets is your current underlying value and maxWithdrawAssets is what you can actually withdraw right now (liquidity-limited).

Pool: rates

const r = await views.readPoolRates({ client, pool });
// r: { utilizationWad, borrowRateRay, supplyApyRay }