> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mystockline.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# RiskLens

> RiskLens is a read-only helper for the app.

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](/resources/addresses).

| Network                 | Address                                                                                                                                       |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Robinhood Chain testnet | [0x6081a034Dbb2d10Cd6C71Fb3A5c451171f9cc8c4](https://explorer.testnet.chain.robinhood.com/address/0x6081a034Dbb2d10Cd6C71Fb3A5c451171f9cc8c4) |

The source code is [`src/periphery/RiskLens.sol`](https://github.com/stockline-xyz/contracts/blob/main/src/periphery/RiskLens.sol) on GitHub. The ABI is [`/abis/RiskLens.json`](/abis/RiskLens.json).

## Read methods

### health

```solidity theme={"system"}
function health(address account) external view returns (uint256)
```

Returns `Stockline.health(account)`: collateral at the liquidation threshold divided by debt, in WAD.

**Input parameters**

| Name    | Type      | Description           |
| ------- | --------- | --------------------- |
| account | `address` | The account to check. |

**Return values**

| Type      | Description                                                |
| --------- | ---------------------------------------------------------- |
| `uint256` | Health factor in WAD, or the maximum uint256 with no debt. |

### maxBorrow

```solidity theme={"system"}
function maxBorrow(address account) external view returns (uint256)
```

Returns `Stockline.maxBorrow(account)`.

**Input parameters**

| Name    | Type      | Description           |
| ------- | --------- | --------------------- |
| account | `address` | The account to check. |

**Return values**

| Type      | Description                             |
| --------- | --------------------------------------- |
| `uint256` | Additional USDG the account can borrow. |

### liquidationPrice

```solidity theme={"system"}
function liquidationPrice(address account, uint16 bookId) external view returns (uint256)
```

Returns `Stockline.liquidationPrice(account, bookId)`.

**Input parameters**

| Name    | Type      | Description            |
| ------- | --------- | ---------------------- |
| account | `address` | The account to check.  |
| bookId  | `uint16`  | The book to solve for. |

**Return values**

| Type      | Description                 |
| --------- | --------------------------- |
| `uint256` | Price scaled by 1e36, or 0. |

### collateralUi

```solidity theme={"system"}
function collateralUi(address account, uint16 bookId) external view returns (uint256)
```

Returns the account's collateral in a book multiplied by the token's `uiMultiplier` and divided by 1e18, for display.

**Input parameters**

| Name    | Type      | Description           |
| ------- | --------- | --------------------- |
| account | `address` | The account to check. |
| bookId  | `uint16`  | The book to check.    |

**Return values**

| Type      | Description     |
| --------- | --------------- |
| `uint256` | Display amount. |

### uiMultiplier

```solidity theme={"system"}
function uiMultiplier(address token) public view returns (uint256)
```

Reads `uiMultiplier()` from a token with a static call. Returns 1e18 if the call fails, returns nothing, or returns 0.

<Note>
  SPEC: read token.uiMultiplier() when present. Missing or zero means 1e18 (1:1).
</Note>

**Input parameters**

| Name  | Type      | Description         |
| ----- | --------- | ------------------- |
| token | `address` | The token to query. |

**Return values**

| Type      | Description                        |
| --------- | ---------------------------------- |
| `uint256` | Multiplier in WAD. 1e18 means 1:1. |

### snapshot

```solidity theme={"system"}
function snapshot(address account) external view returns (AccountSnapshot memory out)
```

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.

<Note>
  Reads every held book's oracle price. Reverts with PriceUnavailable when any held book cannot be priced.
</Note>

**Input parameters**

| Name    | Type      | Description           |
| ------- | --------- | --------------------- |
| account | `address` | The account to check. |

**Return values**

| Type              | Description                                                                                                                 |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `AccountSnapshot` | out: AccountSnapshot: `health`, `maxBorrow`, `books[]` of `{bookId, collateral, amount, amountUi, debt, liquidationPrice}`. |

## Errors

### ZeroAddress

```solidity theme={"system"}
error ZeroAddress()
```

The core was zero at deployment.
