# Requiem

The price your protocol wants, signed by a network. Requiem computes the price a protocol acts on (TWAP, VWAP, a depth-weighted mid, the size a market can absorb inside a band) from Hyperliquid's books and candles and Elysium's HYPE/USDC pools. Every bonded reporter runs the same recipe and signs the result (EIP-712); anyone relays a batch with at least 2 signatures to Feeds on Elysium (chain 99901). The contract takes the median, holds it for a challenge window, and only then serves it as final.

## Recipes (values scaled 1e18)
- 7 `hype-twap-1h`: HYPE TWAP, 1 h (USD; one round per hour, challenge window 10 min). The time-weighted average price of the hour that just closed: the mean of its sixty 1-minute closes. A minute without a trade carries the previous close.
- 8 `hype-vwap-1h`: HYPE VWAP, 1 h (USD; one round per hour, challenge window 10 min). The volume-weighted average price of the hour that just closed: each minute's typical price, (high + low + close) / 3, weighted by the volume traded in it.
- 9 `hype-dwm-100k`: HYPE depth-weighted mid, $100k (USD; 1% move or 1 h heartbeat, challenge window 5 min). The midpoint between the average fill of a $100,000 market buy and of a $100,000 market sell against Hyperliquid's HYPE book, so the price reflects size, not the top tick.
- 10 `hype-depth-2pct`: HYPE sell depth, 2% (USD; 25% move or 2 h heartbeat, challenge window 10 min). The USD a seller of HYPE receives before the price is 2% below the mid: every bid on Hyperliquid's book inside that band, plus what Elysium's HYPE/USDC pools pay to move down to the same price.

## Raw reads (the inputs, as feeds of their own)
- 0 `hype-mid`: HYPE/USD mid (USD; 1% move or 1 h heartbeat, challenge window 5 min)
- 1 `btc-mid`: BTC/USD mid (USD; 1% move or 1 h heartbeat, challenge window 5 min)
- 2 `eth-mid`: ETH/USD mid (USD; 1% move or 1 h heartbeat, challenge window 5 min)
- 3 `hype-funding`: HYPE funding, hourly (per hour; one round per hour, challenge window 10 min)
- 4 `btc-funding`: BTC funding, hourly (per hour; one round per hour, challenge window 10 min)
- 5 `eth-funding`: ETH funding, hourly (per hour; one round per hour, challenge window 10 min)
- 6 `hlp-equity`: HLP vault equity (USD; 0.5% move or 1 h heartbeat, challenge window 10 min)

## Compose any recipe
GET https://www.requiem.network/api/request?kind=twap|vwap|dwm|depth|fundingAvg&coin=<market>&window=<min>|size=<usd>|band=<bps>|hours=<h>: the value computed now by the reporters' code, its inputs, the rule a feed would run under and its cost.

## Read a final value from a contract
`IRequiemFeeds.latest(feedId) -> (int256 value, uint64 observedAt, uint64 round, bool flagged)`; `valueAt(feedId, round)`; `roundAt(feedId, timestamp)`; `pending(feedId)` for the newest round before its window ends. Check `observedAt` against your own freshness limit and `flagged` (a newer round was disputed).

## Read (keyless JSON, CORS open)
- GET https://www.requiem.network/api/recipes (every recipe: definition, inputs, value now with its inputs, last round, signers, final value)
- GET https://www.requiem.network/api/network (contracts, rules, cadence)
- GET https://www.requiem.network/api/feeds (every feed: Hyperliquid now vs final value, round, age, signers) and ?key=hype-mid
- GET https://www.requiem.network/api/feeds/history?key=hype-mid&range=24h
- GET https://www.requiem.network/api/rounds?feed=hype-mid&n=24
- GET https://www.requiem.network/api/reporters
- GET https://www.requiem.network/api/reporters/a (a launch reporter's signed observations now; also /b and /c)
- GET https://www.requiem.network/api/disputes?truth=1
- GET https://www.requiem.network/api/quote?feed=hype-mid&days=30

## Act
- MCP (Streamable HTTP, keyless): POST https://www.requiem.network/mcp. Tools: recipes, compose_recipe, network, feeds, feed, rounds, history, reporters, observe, disputes, quote_subscription, consumer_interface, fund_calldata, withdraw_calldata, bond_calldata, unbond_calldata, dispute_calldata, vote_calldata, watcher_calldata. Reads and calldata only.
- SDK: https://www.requiem.network/sdk/requiem.js
- Reporter node: `curl -sO https://www.requiem.network/node/requiem-reporter.mjs && npm i viem && node requiem-reporter.mjs observe` (modes: observe, serve, relay, watch, bond, unbond, withdraw, claim, status).
- Subscribe: approve USDC (0xb47c4C8F73F009CC0C0d3f92B388d13E293F0B65, 6 decimals) to Feeds, then `fund(feedId, amount)`; each final round pays its fixed fee, 80% to the reporters who signed it and 20% to $REQUIEM stakers. `withdraw(feedId, shares, to)` returns what is left at any time.
- Report: `bond(amount, endpoint)` on Bonds with at least 0.1 HYPE (cap 250 HYPE), serve signed observations, earn USDC per final round signed.
- Dispute a pending round inside its window: `Court.dispute(feedId, round)` with 0.05 HYPE (active reporters that did not sign it, or registered watchers). Votes are weighted by bond; two thirds decide.

## Contracts
- Feeds: 0xc5Af8B2E15583eBdfb6aa6fEe68F60E6a8F647a9
- Bonds: 0x3B5B9494D514Dc5655F3c08f4C0cFE8D0bd388AA
- Court: 0x7f9B7543E62ad2314Fe9680B0D259A021556516e
