# Lens

## Introduction

Ursa Lens is a relatively straightforward contract and does not contain any business logic. It is called by the dApp to fetch and display requisite information from the Unitroller, PriceOracleProxy, Staking, and Voting contracts.

This includes but is not limited to:

* The assets an account is in.
* The amount of supplied assets.
* The amount of borrowed assets.
* The exchange rate of all assets.
* The price of all assets.
* The health of the account.

## lTokenMetadataAll

When a user accesses Ursa, the dApp calls the Ursa Lens method lTokenMetadataAll and passes in a list of the currently supported lTokens.

The Ursa Lens contract then returns a series of market parameters:

* lTokenAddress
* exchangeRateResult
* supplyRateResult
* borrowRateResult
* reserveFactorResult
* totalBorrowsResult
* totalReservesResult
* totalSupplyResult
* totalCashResult
* isListedResult
* collateralFactorMantissaResult
* underlyingAssetAddress
* lTokenDecimals
* underlyingDecimals
* borrowCapResult

## lTokenBalancesAll

Along with pulling the metadata for lTokens, Ursa also retrieves the current balances for an account of the lTokens across the available money markets.

The dApp calls the Ursa Lens method lTokenBalancesAll and passes in the list of lTokens and the user's address.

The Ursa Lens then returns a series of account specific parameters:

* lTokenAddress
* lTokenWalletBalanceResult
* underlyingBorrowBalanceResult
* underlyingSupplyBalanceResult
* tokenBalanceResult
* tokenAllowanceResult

## getAccountLimits

Ursa also needs to check the user's account limits to display on the front-end.

The dApp calls the Ursa Lens method getAccountLimits and passes in the Unitroller address and the user's address.

The Ursa Lens then returns a series of account health related parameters:

* customerAddress
* liquidity
* shortfall
* markets
* trxCount
* closeFactorMantissa
* liquidationIncentiveMantissa
* blockNumber

## lTokenUnderlyingPriceAll

Finally, Ursa also needs to check the prices of the underlying tokens to show accurate prices to end users.

The dApp calls the Ursa Lens method lTokenUnderlyingPriceAll and passes in a list of the currently supported lTokens.

The Ursa Lens contract then returns a series of price parameters:

* underlyingAssetsAddress
* value
* blockNumber

{% hint style="info" %}
For more information about lTokens, please see the [lToken](/ursa/documentation/contracts/ltokens.md) page.

For more information about Oracles, please see the [Oracles](/ursa/documentation/contracts/oracles.md) page.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ursa.finance/ursa/documentation/contracts/lens.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
