Skip to main content

Price oracles

Introduction

On Euler, borrowers must remain over-collateralised at all times to ensure they are sufficiently incentivised to repay their loans. Price oracles provide real-time price data that is crucial for:

  • Determining collateralisation levels
  • Triggering liquidations
  • Maintaining overall system stability

Euler's oracle-agnostic and modular design allows it to integrate with any type of external price feed, providing flexibility in asset and risk management for vault creators and risk curators.

Pricing mechanisms

Price oracles can be categorised into different classes based on how they determine asset prices. The main types include:

  • Market oracles: Use trading activity and liquidity from decentralised and centralised exchanges to determine asset prices. They typically aggregate prices from multiple sources to provide real-time valuations.
  • Fundamental oracles: Price assets based on intrinsic factors rather than market trading. These are often fixed prices, such as hard-coding the value of a stablecoin to 1 USD or using a protocol-defined rate for an asset.
  • Exchange rate oracles: Establish prices based on an in-built exchange rate between a derivative asset and its underlying, using redemption values and protocol-defined calculations.

Choosing an appropriate pricing mechanism for a credit vault is the responsibility of vault creators and risk curators. There is no single "best" way to price an asset in a lending protocol—each approach has trade-offs that shift risk between lenders and borrowers.

For example, a fundamental price oracle that fixes an asset's price at 1 USD can protect borrowers from liquidation due to temporary price fluctuations in secondary markets. However, during sustained price movements, it may fail to reflect the asset’s true value, potentially overvaluing it and exposing lenders to bad debt. Conversely, a market-based oracle offers more accurate valuations based on real-time trading activity but may be vulnerable to price manipulation or trigger unnecessary liquidations due to short-term price swings.

Different oracle types come with distinct advantages and risks. Euler's modular oracle framework allows for seamless integration of multiple price feeds, ensuring flexibility across various use cases.

Oracle adapters

Euler is also vendor-agnostic, meaning it can integrate with a variety of external price feeds. The system uses a modular adapter architecture, allowing seamless interaction with multiple oracle sources. An adapter is a minimal, fully immutable contract that queries an external price feed. It is the atomic building block of the Euler Price Oracles library.

Currently, Euler supports oracle adapters for the following vendors:

  • Chainlink
  • Chronicle
  • Pyth
  • RedStone
  • Lido
  • Uniswap V3
  • Balancer Rate Provider

The system is extensible, allowing developers to integrate additional oracle sources by implementing new adapters that conform to the IPriceOracle interface. This modular approach ensures ongoing flexibility and compatibility with future price feed innovations.

Standardised pricing interface

To ensure consistency across different price sources, Euler provides an IPriceOracle interface as part of the Euler Price Oracles (EPO) module.

Euler's IPriceOracle is the reference implementation for the "Common Quote Oracle" outlined in ERC-7726, an Ethereum Improvement Proposal that defines a standard API for data feeds providing the relative value of assets.

The IPriceOracle interface standardises price querying in DeFi, offering:

  • Greater accuracy
  • Enhanced security
  • Improved interoperability across different oracle providers

By using a quote-based approach, IPriceOracle simplifies asset pricing and enhances the reliability of lending and liquidation mechanisms.

Oracle routers

In Euler’s system, an oracle router is a contract that implements the IPriceOracle interface and serves as a configurable dispatcher for price queries.

When a price quote is requested, the router determines the appropriate source—such as a specific adapter or another oracle provider—to handle the request. This flexible and modular design allows the system to dynamically integrate various pricing sources, making it adaptable to different assets and market conditions.

Governance privileges can reconfigure the router to update or change its mappings, ensuring adaptability over time. Transferring these privileges to address(0) renders the router immutable.

Pricing vault shares

In Euler's credit vault system, each collateral asset is configured as the address of another vault, rather than the underlying asset itself—unless the asset is specifically designed to also function as a collateral vault. As a result, the value of a user's collateral is determined by the value of the vault’s shares, rather than a direct 1:1 relationship with the underlying asset. A vault share may not always equal a unit of the underlying asset due to differences in the exchange rate. For vaults created using the Euler Vault Kit, the convertToAssets function from ERC-4626 provides a reliable way to price shares in terms of the underlying asset. This function includes built-in security mechanisms to prevent manipulation, such as internal balance tracking and virtual deposits to mitigate rounding-based exploits.

Conclusion

Euler's oracle-agnostic and modular design allows it to integrate with any type of external price feed, providing flexibility in asset and risk management for vault creators and risk curators. Developers and integrators can find more details in the Euler Price Oracle repository.