MorpheusPerpetual Prediction Markets
Docs

Oracles on every chain

What the oracle does, the interface every chain shares, the rules every print must follow, and recommended sources.

Each market has one oracle account that may do exactly two things: publish a price with updatePrice(id, price, ts, conf), and propose the final outcome with proposeResolution(id, R). The interface is identical on every chain (update_price(price, ts, conf) on Solana), so an oracle can be anything from a multisig to an on-chain adapter contract that reads another oracle network.

Rules every print follows

  • Timestamps: ts is when the price was observed. It must be newer than the last print's, not in the future, and at most max_oracle_lag (30 s in this app, never above 60 s) older than the moment it is published. A relayer can't pick among old observations.
  • One print per instant, and only after the previous print's batch is fully processed.
  • Confidence: conf (at most 10¢) widens the spread, and above max_conf it stops new opens. Oracles should report the dispersion of their sources here; see Confidence & close-only.
  • Staleness: fills and liquidations need a print younger than max_price_age; after that, queued orders can be cancelled.
  • Price band: no new positions near certainty (outside 2¢–98¢).
  • Dispute window + guardian veto on resolutions; cancel is impossible after the window.

Recommended sources

SolanaEVM (Ethereum, Base, Arbitrum…)
Probability price feedSwitchboard On-Demand job aggregating Polymarket/Kalshi midpoints; or a signer committee (Squads multisig)QuorumOracle (below); Chainlink Functions / Data Streams job; Pyth or RedStone custom feed
Asset-linked markets (e.g. "BTC > $150k")Pyth pull oracle for the underlying + an adapter that maps to a probability (Pyth's confidence maps to conf)Chainlink Data Feeds for the underlying + adapter
ResolutionSquads multisig with a long dispute window, or a Switchboard function that reads an outcome APIUMA Optimistic Oracle v3 adapter (the model Polymarket uses), QuorumOracle, or a Safe multisig

Writing an oracle adapter

An adapter is any contract or program set as the market's oracle:

// EVM: an adapter that relays a feed, processes the batch, and resolves via an optimistic oracle
contract PpmOracleAdapter {
  PPM public immutable ppm; uint256 public immutable id;
  function push(uint64 price, uint64 ts, uint64 conf) external onlyReporter {
    ppm.updatePrice(id, price, ts, conf);
    ppm.processBatch(id, type(uint256).max); // the next print waits for this batch anyway
  }
  function resolve() external { (bool ok, uint64 R) = uma.settled(assertionId); require(ok); ppm.proposeResolution(id, R); }
}

On Solana the market's oracle is a public key: a keypair, a multisig vault, or a PDA of an adapter program that signs the update_price CPI after verifying a Pyth or Switchboard account. Put process_batch in the same transaction.

Ready-made: QuorumOracle (EVM)

evm/src/adapters/QuorumOracle.sol is an M-of-N reporter relay with no admin key. The reporters are an immutable majority quorum signing EIP-712 messages. It publishes the median of their observations, so fewer than M faulty reporters can't move it outside the honest range. A resolution needs M identical signatures. Anyone can relay a signature bundle, and the same call publishes the price and processes the queued requests.

Trust today

In this release the oracle is trusted, and the admin can rotate it. Production deployments should put both behind a multisig and a timelock, and should use a long dispute window for resolutions.