Oracle Gateway

The Oracle Gateway exposes Solana-native price feeds (Pyth Network, Switchboard V3) through Chainlink's AggregatorV3Interface. Ethereum protocols porting to Rome can use their existing oracle integration code unchanged.

The Problem

Ethereum DeFi protocols expect Chainlink's AggregatorV3Interface:

(, int256 price,,,) = priceFeed.latestRoundData();

Solana has different oracle providers (Pyth, Switchboard) with different data formats. Without adaptation, every Ethereum protocol would need custom oracle integration.

The Solution

Oracle Gateway V2 deploys lightweight adapter contracts that:

  1. Read price data from Pyth or Switchboard accounts on Solana via CPI

  2. Parse the on-chain Borsh-encoded data

  3. Normalize prices to 8 decimal places

  4. Expose the standard Chainlink AggregatorV3Interface

import {IAggregatorV3Interface} from "@rome-protocol/solidity-sdk/contracts/oracle/IAggregatorV3Interface.sol";

// Same interface as Chainlink on Ethereum
IAggregatorV3 priceFeed = IAggregatorV3(ORACLE_ADAPTER_ADDRESS);
(, int256 price,,,) = priceFeed.latestRoundData();
// price = SOL/USD at 8 decimals (e.g., 15000000000 = $150.00)

Architecture

OracleAdapterFactory

Deploys and manages oracle adapters:

The factory validates that the account is actually owned by the Pyth/Switchboard program before deploying.

Adapter Types

PythPullAdapter — Reads Pyth PriceUpdateV2 accounts. Supports price, confidence interval, EMA price, and publish time.

SwitchboardV3Adapter — Reads Switchboard AggregatorAccountData accounts. Supports price and timestamp. EMA not available.

Both adapters use EIP-1167 minimal proxy clones for gas-efficient deployment.

Interfaces

Extended Interface

Batch Reader

Read multiple feeds in one call:

Staleness Protection

Adapters enforce a maxStaleness parameter. If block.timestamp - publishTime > maxStaleness, the call reverts with StalePriceFeed(). Default: 60 seconds.

The factory owner can adjust staleness per adapter or globally:

Deployed Addresses (Devnet)

Contract
Address

OracleAdapterFactory

0xa4647955a16b72d15f13b51b5277036755d297be

PythPullAdapter (impl)

0x4fd11aed44ee5f71df22fb804cfcbb4c50535db9

SwitchboardV3Adapter (impl)

0xb57e3589b880aa3f6b66ce2df6aa42cd9c36925e

BatchReader

0x70da375e5680f84032f5b15d35ba0e6f9871d3fd

SOL/USD (Switchboard)

0xF0864572019c295407CF2ed46e6FD3615e10E19d

See Contract Addresses for the full list.

Constraints

  • No historical round datagetRoundData(roundId) reverts with HistoricalRoundsNotSupported()

  • Switchboard EMA not supportedlatestEMAData() reverts on Switchboard adapters

  • Parser offsets empirically validated — must re-validate with validation scripts before redeployment against new Pyth/Switchboard versions

  • Price normalization — Pyth prices normalized as price * 10^(expo - (-8)); Switchboard as (mantissa * 10^8) / 10^scale

Status

V1 Shipped (2026-04-01) — V2 in progress with staleness protection, batch reads, Switchboard adapter, EIP-1167 clones.

What's Next

Last updated

Was this helpful?