Oracle Usage


Astrolend Oracle Model

Astrolend primarily relies on oracle price feeds to obtain accurate and secure token market prices, using Pyth oracles(which is our official partner) for supported assets. Pyth’s extensive safety features ensure a reliable understanding of token price activity and risk management. For assets not supported by Pyth, Astrolend employs Switchboard oracles, which adhere to a similar set of best practices.

Key Components of Price Protection

Astrolend incorporates several mechanisms to protect against price inaccuracies, ensuring a safer and more reliable user experience:

  1. Price Staleness Checks:

    • Definition: Price staleness occurs when an oracle provides outdated price data.

    • Astrolend’s Approach: The protocol implements strict staleness checks, more rigorous than those of both Pyth and Switchboard, with a maximum valid price staleness defined at 60 seconds. This ensures that all prices used within the platform are up-to-date and accurate.

  2. Confidence Intervals:

    • Overview: Pyth and Switchboard oracles publish confidence intervals alongside each price feed. These intervals represent a range of possible prices, providing a probability distribution over the price.

    • Astrolend’s Conservative Approach:

      • Assets: For asset valuation, Astrolend uses the lower bound of the 95% confidence interval to ensure a conservative estimate.

      • Liabilities: For liabilities, the protocol uses the upper bound of the 95% confidence interval, providing a cautious approach that protects against potential overvaluation.

  3. Exponential Moving Average (EMA) Application:

    • Purpose: To reduce the impact of price volatility, Astrolend utilizes the Exponential Moving Average (EMA) price provided by Pyth oracles.

    • How it Works: The EMA is a weighted moving average that gives more importance to recent price data. In Astrolend’s case, the EMA is calculated using a slot-weighted, inverse confidence-weighted method. It considers a window of 5921 slots (approximately 1 hour on the Eclipse Mainnet), where more recent slots and those with tighter confidence intervals are given more weight. The EMA formula is as follows:

  • Explanation: In this formula, price_i, slot_i, and confidence_i represent the price, slot number, and confidence interval at each slot within the considered window. This approach ensures that the most accurate and recent data influence the final price.

  • Switchboard Oracles: Unlike Pyth, Switchboard does not natively provide EMA pricing. For assets using Switchboard oracles, live prices are used instead, with the same confidence interval strategy applied as with Pyth.

These protective measures allow Astrolend to maintain accurate and conservative token pricing, reducing the impact of volatility and minimizing the risk of price manipulation. By utilizing both Pyth and Switchboard oracles, Astrolend ensures that the token prices used within the platform are reliable and secure, ultimately supporting a safer and smoother lending experience for all users on the Eclipse blockchain.

Last updated