Lens

Ursa's lens into the blockchain.

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

For more information about lTokens, please see the lToken page.

For more information about Oracles, please see the Oracles page.

Last updated