Javsphere Docs
Open AppJoin Trading Competition
  • Open Javsphere App
  • Welcome to Javsphere
  • Javsphere Stats
  • Fundamentals
    • Javsphere Set Up
      • Base Chain
      • Connect Wallet
      • Add Tokens
      • New to Crypto
    • Buy & add JAV
  • Products
    • LeverageX
      • Assets
        • Cryptocurrencies
        • Stocks
        • Forex
        • Commodities
      • Fees & Spread
      • Trader
        • Open Trade
        • Edit & Close Trade
      • Earn LLP Pool
        • Buy LLP
        • LLP Price & APY
      • xJAV Vault
        • FAQ
      • Limitations
      • Testing
      • Trading Competitions
      • Referral
    • StakeX
    • CryoVault
  • Trading Competitions
    • Current Competition
      • Create Profile
      • Create Community
      • Old competitions
        • Competition Vol. 3
        • Competition Vol. 2
        • Competition Vol. 1
        • Tournament
    • Zealy Campaign
      • Old Airdrops
        • Infinity Pass
        • CFR
        • UPT
        • DTL
        • RNG
        • DPM & Baby Dana
        • GRWV
    • Become a Sponsor
  • JAV Token
    • Utility
    • Whitepaper
      • Javsphere and JAV Token
        • JAV Token
          • Javsphere Fee Structure
          • Tokenomics
        • Added Value for Holders
        • Javsphere Technology
          • StakeX
          • CryoVault
          • LeverageX
      • Disclaimer
    • Governance
      • Onchain Proposals
      • Migration to Base
      • Offchain Proposals
      • Submit a Proposal
    • Base Migration
    • JAV Burn
  • JAVLIS
    • The Ultimate AI Agent
      • Ecosystem
      • USPs
      • Boost for LeverageX
      • Business Model
      • Roadmap
      • Virtuals as Infrastructure
      • More than a hype
      • Hiring
    • Buy JAVLIS
  • Engineering
    • Oracle System
    • Smart Contracts
      • LeverageX
        • JavBorrowingFees
        • JavFeeTiers
        • JavPairsStorage
        • JavPriceAggregator
        • JavPriceImpact
        • JavReferrals
        • JavTradingInteractions
        • JavTradingProcessing
        • JavTradingStorage
        • JavBorrowingProvider
        • LLPToken
        • Feeds
      • JavPriceAggregator
      • JavFreezer
      • JavStakeX
    • Github
    • Bug Bounty Program
  • Community & More
    • Content Library
      • Logos
      • UI Mockups
    • Social Content
    • Socials
      • Telegram Guidelines
  • LEGAL
    • Privacy Policy
    • Terms of Use
      • Excluded Jurisdictions
    • Migration Terms
    • Cookie Policy
    • Trading Competition Terms
    • Bug Bounty Terms
Powered by GitBook
On this page
  • General Description
  • Core Functionalities
  • initializePriceAggregator
  • updateCollateralUsdPriceFeed
  • setPriceLifetime
  • getPriceLifetime
  • getPrice
  • updatePrices
  • getCollateralPriceUsd
  • getCollateralFeed
  • getRewardsTokenUsdFeed
  • getUsdNormalizedValue
  • getCollateralFromUsdNormalizedValue
  • getRewardsTokenPriceUsd

Was this helpful?

  1. Engineering
  2. Smart Contracts
  3. LeverageX

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

  • Initializes 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

  • Updates 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

  • Sets the lifetime duration for price data.

  • Parameters:

    • _lifetime: New lifetime value in seconds.

  • Access Control: onlyRole(Role.GOV).

getPriceLifetime

  • Retrieves the configured price lifetime.

  • Returns: The price lifetime in seconds.

getPrice

  • Retrieves the price for a specific pair index.

  • Parameters:

    • _pairIndex: Index of the price pair.

  • Returns: Price of the pair.

updatePrices

  • Updates 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

  • Retrieves the USD price for a specific collateral index.

  • Parameters:

    • _collateralIndex: Index of the collateral.

  • Returns: USD price of the collateral.

getCollateralFeed

  • Retrieves the feed identifier for a specific collateral index.

  • Parameters:

    • _collateralIndex: Index of the collateral.

  • Returns: Feed identifier.

getRewardsTokenUsdFeed

  • Retrieves the USD feed identifier for the rewards token.

  • Returns: Feed identifier for the rewards token price in USD.

getUsdNormalizedValue

  • Converts collateral value to its normalized USD equivalent.

  • Parameters:

    • _collateralIndex: Index of the collateral.

    • _collateralValue: Collateral value to normalize.

  • Returns: Normalized USD value.

getCollateralFromUsdNormalizedValue

  • Converts a normalized USD value back to its collateral equivalent.

  • Parameters:

    • _collateralIndex: Index of the collateral.

    • _normalizedValue: Normalized USD value.

  • Returns: Collateral equivalent value.

getRewardsTokenPriceUsd

  • Retrieves the USD price of the rewards token.

  • Returns: USD price of the rewards token.

Last updated 5 months ago

Was this helpful?