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 primeV2constructor
constructor(address primeV2_)Parameters
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
market
address
The market for which to fetch the APR
user
address
The account for which to get the APR
Return Values
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
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
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
vToken
address
The market for which to fetch the total income
Return Values
amount
uint256
The annualized distribution income
Last updated

