Skip to content

Oracle

What is an Oracle?

Oracles are smart contracts that provide external data, particularly price information, to blockchain applications. In lending protocols like Morpho, oracles provide price data needed to determine what one token is worth relative to another. For example, the oracle of a market is supposedly answering the question: "How many USDC is 1 BTC worth right now?”

Oracles in Lending Markets

Traditional lending protocols rely on oracles to:

  • Determine the value of collateral assets
  • Calculate borrowing capacity
  • Trigger liquidations when positions become undercollateralized
  • Enable accurate interest rate calculations

Oracle Implementation in Morpho

Morpho takes an oracle-agnostic approach, allowing market creators to select the most appropriate price feed mechanisms based on specific market requirements. Each Morpho market specifies its oracle in the market parameters, ensuring that oracle implementations can be tailored to specific asset pairs.

All oracles used in Morpho markets implement the IOracle interface, which has a single, standardized function:

function price() external view returns (uint256);

This function returns the price of 1 unit of collateral token quoted in the loan token, with appropriate scaling to account for decimal differences between tokens.

Types of Oracles Compatible with Morpho

Various oracle implementations can be used with Morpho markets:

  1. Price Feed Oracles: Utilize external price feeds (like Chainlink, Redstone, API3, Pyth, Chronicle) to calculate asset exchange rates.
  2. Exchange Rate Oracles: Specialized for wrapped tokens or rebasing tokens where the exchange rate is deterministic (like wstETH/stETH).
  3. Fixed-Price Oracles: Used for assets with known or predefined exchange rates, such as stablecoins pegged to the same value.

MorphoChainlinkOracleV2: A Reference Implementation

One reference implementation available is MorphoChainlinkOracleV2, which leverages Chainlink-compliant price feeds while supporting multiple routing configurations:

  • Direct feeds (e.g., stETH/ETH)
  • Inverse feeds (e.g., ETH/USDC → USDC/ETH)
  • Multiple feed routes (e.g., stETH/USD and USDC/USD)
  • Complex routing with multiple hops

This implementation demonstrates the flexibility of the oracle system within Morpho, allowing markets to maintain accurate pricing even when direct price feeds aren't available.

Deploy an Oracle

Key Oracle Characteristics in Morpho Markets

  • Purpose-Built: Each oracle returns the specific exchange rate between a collateral asset and a loan asset
  • Immutable: Once a market is deployed, its oracle address cannot be modified
  • Independent: Each oracle operates autonomously and can use different pricing sources
  • Flexible Implementation: Curators can leverage various data sources while maintaining a consistent interface

Oracle Selection by Market Curators

Market curators (not Morpho) are responsible for selecting and implementing appropriate oracles for their markets. Each Morpho market specifies its oracle in the market parameters:

CollateralAsset/LoanAsset (LLTV%, OracleAddress, IRMAddress)

Oracle Security Considerations

The security of an oracle is critical to the safety of a Morpho Market. Users should:

  • Verify the oracle implementation for any market they interact with
  • Understand the price sources being used
  • Consider potential manipulation vectors or failure modes

The immutable nature of Morpho Markets means oracle selection is a permanent decision that defines the market's risk profile