Skip to content

Stork Oracle

Stork is a decentralized oracle that provides signed price data on-chain. Quasdaq uses Stork to:

  1. Display live prices on the frontend via the REST API
  2. Resolve markets by submitting signed oracle data to the contract

Each asset has a feed ID string (e.g. "BTCUSD") that is hashed with keccak256 to produce the bytes32 value stored on-chain.

import { keccak256, toUtf8Bytes } from "quais";
// The feed ID must match exactly — case-sensitive
const feedIdHash = keccak256(toUtf8Bytes("BTCUSD"));

Not all assets in the catalog have a live Stork subscription. Query the Feed API with ?storkOnly=true to see only resolvable feeds:

Terminal window
curl "https://quasdaq.com/api/feeds?storkOnly=true"

Assets with hasStorkFeed: true include: BTC, ETH, SOL, BNB, SPY, and others.

const res = await fetch(
`https://quasdaq.com/api/stork?feedId=BTCUSD`
);
const storkData = await res.json();
const storkContract = new Contract(storkAddress, [
"function getUpdateFeeV1(tuple(tuple(uint64,int192),bytes32,bytes32,bytes32,bytes32,bytes32,uint8)[]) view returns (uint256)"
], provider);
const fee = await storkContract.getUpdateFeeV1(updateData);
const market = new Contract(marketAddress, [
"function resolve(tuple(tuple(uint64,int192),bytes32,bytes32,bytes32,bytes32,bytes32,uint8)[]) payable"
], signer);
await market.resolve(updateData, { value: fee, gasLimit: 500000n });

The Stork API returns data nested under:

stork_signed_price
├── timestamped_signature
│ └── signature
│ ├── r (bytes32)
│ ├── s (bytes32)
│ └── v (uint8)
├── timestamp (uint64, nanoseconds)
└── price (quantized int192)

The on-chain struct ordering matters:

struct TemporalNumericValueInput {
TemporalNumericValue temporalNumericValue; // MUST be first
bytes32 id;
bytes32 publisherMerkleRoot;
bytes32 valueComputeAlgHash;
bytes32 r;
bytes32 s;
uint8 v;
}