For the complete documentation index, see llms.txt. This page is also available as Markdown.

Prime lens

PrimeLens

PrimeLens is a read-only helper contract for off-chain APR queries against PrimeV2. It is kept separate from PrimeV2 to stay within the EVM contract-size limit. It holds an immutable reference to a PrimeV2 instance and derives values from PrimeV2 and PrimeLiquidityProvider state.

Solidity API

primeV2

The PrimeV2 instance this lens reads from (set in the constructor)

contract IPrimeV2WithStorage primeV2

constructor

constructor(address primeV2_)

Parameters

Name
Type
Description

primeV2_

address

Address of the PrimeV2 contract

❌ Errors

  • Throw InvalidAddress if primeV2_ is the zero address


calculateAPR

Returns supply and borrow APR for a user in a given market, based on current state.

Parameters

Name
Type
Description

market

address

The market for which to fetch the APR

user

address

The account for which to get the APR

Return Values

Name
Type
Description

aprInfo

struct IPrimeV2.APRInfo

APR information for the user in the given market

The APRInfo struct contains:


estimateAPR

Returns supply and borrow APR for a user in a given market based on hypothetical supply, borrow and XVS staked amounts. The user's score is recomputed from the supplied inputs (subtracting their existing market score and re-adding the estimated one), so the result reflects what the APR would be under the provided position.

Parameters

Name
Type
Description

market

address

The market for which to fetch the APR

user

address

The account for which to get the APR

borrow

uint256

Hypothetical borrow amount

supply

uint256

Hypothetical supply amount

xvsStaked

uint256

Hypothetical staked XVS amount

Return Values

Name
Type
Description

aprInfo

struct IPrimeV2.APRInfo

APR information for the user in the given market (same APRInfo struct as calculateAPR)


incomeDistributionYearly

The total income that will be distributed to Prime token holders for a market over a year. Computed as the PrimeLiquidityProvider effective distribution speed for the market's underlying multiplied by blocksOrSecondsPerYear.

Parameters

Name
Type
Description

vToken

address

The market for which to fetch the total income

Return Values

Name
Type
Description

amount

uint256

The annualized distribution income


Last updated