Skip to content
AnnouncementSomnia Oracle settles event contracts onchain, in minutes, with receipts.

Index, mark and oracleprices, read onchain

Somnia Price Feeds supply the reference prices that markets and lending protocols on Somnia depend on. Validator subcommittees sit next to the sources, and Protofire and Stork publish feeds on mainnet too.

Read the docs

From source to contract

Providers live on mainnet

SourcesAggregatePublishConsumeSource 1Source 2Source 3Source 4Aggregation rulescontrols on outliersOnchain updatepublic, timestamped eventLending marketSettlement contractYour contractvalidator subcommittees, co-located with the sourcesProvider networksStork · Protofiredelivered on mainnet alongside
  • Source

    Many markets and providers

    Gathered from multiple sources

  • Aggregate

    Index and mark prices

    Controls against outliers and manipulation

  • Publish

    Written onchain

    Every update public and timestamped

  • Consume

    Read in the same environment

    Lenders and settlement contracts

Update interval for the Somnia index and mark prices
1 s
Validators that must report before each index update
2 of 3
Protocol fee to read a feed
0

Diagram is schematic; source and consumer names are illustrative. Figures from the Somnia Price Feeds page and the Protofire guide in the Somnia docs, read 29 Oct 2026.

Mark against the wider market, not one venue

  • Anchor to a fair reference

    Index and mark prices come from a weighted median across seven external trading venues, so the reference follows the wider market rather than one venue.

  • Cut the distance to the source

    Validator subcommittees sit next to the price sources, so a contract sees a price change sooner.

  • Choose the feed that fits

    Stork and Protofire publish price feeds on Somnia mainnet, so integrators can use the provider their risk policy already approves.

Use the feeds your risk policy approves

Addresses for Global testnet (chain ID 50312) and mainnet (chain ID 5031) are published in the Somnia docs.

  • Stork

    Price feeds on Somnia mainnet; contract address in Stork's docs.

  • Protofire

    Chainlink-compatible price feeds for USDC/USD, ETH/USD and BTC/USD, plus VRF v2.5.

Defensible prices for venues and lenders

Mark positions to a defensible price

The mark price is an exponential moving average of the index, published onchain. Aggregation limits how far any single source can move it. Anyone can check the price a position was marked at.

Feed policyIllustrative
Feed
SOMI / USD
Read
latestRoundData()
Max staleness
3,600 s
If stale
Pause settlement

Value collateral on a price you can check

Lending markets on Somnia value collateral using onchain price feeds. Choose the provider your risk policy approves, and set a maximum price age so a stale price cannot trigger or block a liquidation.

Feed policyIllustrative
Collateral
WETH
Feed
WETH / USD
Scale
decimals() = 8
Check
updatedAt within policy
Shared with
Other apps on Somnia

Read a feed, or fetch your own

  1. Choose a provider and feed

    Pick the asset and the provider your risk policy approves.

  2. Copy the address

    Take the feed or adapter address for testnet (chain ID 50312) and mainnet (chain ID 5031) from the docs.

  3. Read the price

    Call latestRoundData() on the AggregatorV3 interface.

  4. Check freshness and decimals

    Reject a price older than your limit and scale by the feed's decimals().

PriceConsumer.solsolidity
// Protofire Price Feeds guide, Somnia docs (condensed)
pragma solidity ^0.8.7;
import
"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
contract PriceConsumer {
AggregatorV3Interface internal priceFeed;
constructor(address _priceFeed) {
priceFeed = AggregatorV3Interface(_priceFeed);
}
function getLatestPrice() public view returns (int256) {
(, int256 price, , , ) = priceFeed.latestRoundData();
return price;
}
function getDecimals() public view returns (uint8) {
return priceFeed.decimals();
}
}
latestRoundData()Illustrative response
roundId
1042
answer
123125165
startedAt
1793276400
updatedAt
1793276400
answeredInRound
1042
decimals()
8
Normalised
answer / 10^8 = 1.23125165
Your policy

require(

block.timestamp - updatedAt <= maxAge

);

maxAge is set by your contract, not the feed.

Interface from the Somnia docs. Copy feed addresses from the docs.

Read a price in a few lines

Read prices from standard contracts

Protofire feeds are deployed on mainnet with published addresses and expose the AggregatorV3 interface. Call latestRoundData() and check the timestamp it returns before you use the price.

Fetch any price with an agent

For an asset no feed covers, a Somnia Agents JSON API agent fetches a value from any public API under validator consensus. Pair a price with Somnia Reactivity to run a handler in the same block an update lands.

What Somnia Price Feeds gives you

  • Price markets from more than one source

    The Somnia index takes a weighted median across seven external trading venues.

  • Audit every price update onchain

    Each update is a public, timestamped event, so you can see what was published and when.

  • Stop any one source from setting the price

    Aggregation rules limit the influence of any one source on the published price.

  • See price moves sooner

    Validator subcommittees sit close to the price sources they read.

  • Keep using Stork or Protofire

    Stork and Protofire publish feeds on Somnia mainnet, so if you already use one of them, you can keep it.

  • Run fair draws with verifiable randomness

    Protofire operates VRF v2.5 on Somnia for fair draws and allocation.

Read a price you can defend

Talk to the team about price data for a venue, a lending market or a structured product.

Talk to an expert