Skip to main content
Read RiskLens with viem. Do not send a transaction to learn an account’s borrowing power. Addresses: Addresses. ABI: RiskLens.json.
snapshot is the call the app should cache. health is WAD. 1e18 is the line. amountUi uses uiMultiplier for display only. Book ids follow creation order on testnet. Confirm on Books and tiers.

What can go wrong

  • RPC timeout. Retry reads. Do not retry writes from this page.
  • UnknownBook if you later call liquidationPrice with a missing id.
  • Mixing amountUi into risk math. Use raw amount.
  • Assuming 18 decimals on mainnet USDG.
Next: Read borrowing power, Open a loan. This getting-started page is the shortest path into the protocol from a script. The Stockline app uses the same RiskLens surface for borrowing power, the line, and per-book debt. Once this read works, every other guide is a write on top of it. Install viem, copy the address snippet from Addresses, and load RiskLens.json from /abis. Do not construct ABIs from memory. Book ids on testnet follow createBook order. Confirm NVDA and SPY against Books and tiers before you hardcode an id. snapshot returns health in WAD, max borrow in USDG wei, and an array of books the account is listed on. amount is the raw ERC-20 amount. amountUi applies uiMultiplier when the stock token exposes it. Display amountUi. Risk math must use amount. Robinhood Chain testnet is chain id 46630. Mainnet, when the file exists, is listed on Addresses. Testnet USDG is 18 decimals. Do not assume the same on mainnet.