Lens

Lodestar's lens into the blockchain.

Introduction

Lodestar 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 and PriceOracleProxy 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.

A user can find the address for Lodestar Lens on the Deployed Contracts page if they wish to interact with the contract directly.

lTokenMetadataAll

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

The Lodestar 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, Lodestar also retrieves the current balances for an account of the lTokens across the available money markets.

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

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

  • lTokenAddress

  • lTokenWalletBalanceResult

  • underlyingBorrowBalanceResult

  • underlyingSupplyBalanceResult

  • tokenBalanceResult

  • tokenAllowanceResult

getAccountLimits

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

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

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

  • customerAddress

  • liquidity

  • shortfall

  • markets

  • trxCount

  • closeFactorMantissa

  • liquidationIncentiveMantissa

  • blockNumber

lTokenUnderlyingPriceAll

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

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

The Lodestar 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