JavPriceAggregator
General Description
The JavPriceAggregator contract used for manage and query price data for LeverageX. It allows initialization of price aggregators, updates to collateral price feeds, management of price lifetimes, and retrieval of pricing details for various assets. The functions are divided into management setters for configuration and getters for querying price-related data.
Core Functionalities
initializePriceAggregator
initializePriceAggregatorInitializes the price aggregator with the provided oracle, alternative oracle, reward token USD feed, collateral indices, and their respective USD price feeds.
Parameters:
_oracle: Primary oracle for price data._alternativeOracle: Backup oracle for price data._rewardsTokenUsdFeed: Feed identifier for the rewards token in USD._collateralIndices: Array of indices representing collateral types._collateralUsdPriceFeeds: Array of feed identifiers for collateral prices in USD.
updateCollateralUsdPriceFeed
updateCollateralUsdPriceFeedUpdates the USD price feed associated with a specific collateral index.
Parameters:
_collateralIndex: Index of the collateral._value: New feed identifier for the collateral price in USD.
Access Control:
onlyRole(Role.GOV).
setPriceLifetime
setPriceLifetimeSets the lifetime duration for price data.
Parameters:
_lifetime: New lifetime value in seconds.
Access Control:
onlyRole(Role.GOV).
getPriceLifetime
getPriceLifetimeRetrieves the configured price lifetime.
Returns: The price lifetime in seconds.
getPrice
getPriceRetrieves the price for a specific pair index.
Parameters:
_pairIndex: Index of the price pair.
Returns: Price of the pair.
updatePrices
updatePricesUpdates price data based on a multi-dimensional array input.
Parameters:
_priceUpdate: Array of price update data._user: Address initiating the price update.
Access Control:
onlySelf.
getCollateralPriceUsd
getCollateralPriceUsdRetrieves the USD price for a specific collateral index.
Parameters:
_collateralIndex: Index of the collateral.
Returns: USD price of the collateral.
getCollateralFeed
getCollateralFeedRetrieves the feed identifier for a specific collateral index.
Parameters:
_collateralIndex: Index of the collateral.
Returns: Feed identifier.
getRewardsTokenUsdFeed
getRewardsTokenUsdFeedRetrieves the USD feed identifier for the rewards token.
Returns: Feed identifier for the rewards token price in USD.
getUsdNormalizedValue
getUsdNormalizedValueConverts collateral value to its normalized USD equivalent.
Parameters:
_collateralIndex: Index of the collateral._collateralValue: Collateral value to normalize.
Returns: Normalized USD value.
getCollateralFromUsdNormalizedValue
getCollateralFromUsdNormalizedValueConverts a normalized USD value back to its collateral equivalent.
Parameters:
_collateralIndex: Index of the collateral._normalizedValue: Normalized USD value.
Returns: Collateral equivalent value.
getRewardsTokenPriceUsd
getRewardsTokenPriceUsdRetrieves the USD price of the rewards token.
Returns: USD price of the rewards token.
Last updated
Was this helpful?