Skip to content

Contracts

Contract What it does Holds Admin
Market One market: the UP and DOWN pots, the ticket queue, the reader for its relayed feed, mints, redemptions, epochs, freezes and payouts. Each market is its own minimal clone of the Market router, with its feed, side tokens and settings fixed at listing; the router sends each call to one of four facets, which run on the market’s own storage (details) All of its own users’ HYPE: pots, escrowed mints, owed balances and accrued fees None. No function checks a role, and the router and its facets are fixed
SideToken A side’s ERC-20 share. Only its market mints, burns and moves it Nothing None
MarketFactory Version 1. Applies the listing rules for a feed, deploys the market and its side tokens, seeds the pots and registers the market Nothing between calls None
Registry Versions, the listing count per feed, pauses, the feed list and the feed owner every feed must have, and the bounded settings Nothing The timelock; the signer set, as its guardian, can pause. The launch settings were applied once, at deployment, before any market existed, by its bootstrap, which sealed it in the same call
SignerSet The price signers and their threshold. Checks each relayed round’s signatures, deploys each source’s relayed feed and owns it, and lets the guardian or the sentinel remove a signer or pause new mints Nothing The timelock adds signers, sets the threshold and names the guardian and the sentinel; the guardian and the sentinel can only remove a signer and pause
RelayedFeed One per price source, and one more for HYPE in US dollars, which no market reads (details). Takes rounds signed by the signer set, each observed after the last and landing within 60 seconds of its observation, keeps every one for good, and answers the reads a market makes of a Chainlink feed (details) Nothing None. Its owner, the signer set, has no call on it
BurnVault Receives every market’s burn share, and spends it buying $SAGITTA and burning it, at a capped rate, at most once per window, in the first 10 seconds of each 10 minutes; pays each proven price a burn uses a fixed fee, the grid fee, once, to whoever posted it The burn share, and the grid fees it owes those posters until claimed Its token, price source, burner and spending cap were set once by its bootstrap at deployment, which sealed the vault in the same call; since then the timelock sets the price source, the burner and the cap, and the token, set once, never changes. HYPE leaves only through buyAndBurn(), at the capped rate, and through claim(to), by a poster collecting its fees. The fee is fixed at deploy and the timelock is never paid one. Fees unclaimed for 90 days after an account’s latest credit go back to the burn through expire(account), which anyone may call
V4StateRoots Checks the block headers and the PoolManager’s account proof of each grid reading, and stores that second’s storage root; deploys the $SAGITTA pool’s oracle Nothing None
V4PoolOracle The $SAGITTA pool’s price oracle. Checks a grid reading’s proof against a stored root and stores that second’s price with its poster Nothing None
V4BurnPrice The burn vault’s price source for $SAGITTA: the price floor from four proven grid readings Nothing None; the timelock chooses which price source the vault uses
V4Burner Buys $SAGITTA with a burn’s spend in its Montra pool, within the move cap, and sends it to the dead address. Only the vault can call it Nothing between calls None; the timelock chooses which burner the vault uses
SagittaTimelock OpenZeppelin’s TimelockController, with a delay that can’t go below 72 hours on Elysium, and a 14 days window after the delay in which an operation can be executed Nothing Itself; a 1-of-1 Safe proposes and cancels, and anyone may execute an operation during its window

A market reads its own relayed feed and nothing else. It never calls another market, and nothing grows with the number of markets on one feed. Only commitMint and donate ask the Registry whether mints are open, and only retire() asks whether the market is retired. Redemptions, executions and claims never call the Registry or the burn vault.

Call Who What it does
commitMint(side, recipient, referrer, refundTo) Anyone Queues a mint of the HYPE sent (details)
commitRedeem(side, shares, recipient, refundTo) A holder Queues a redemption of current-epoch tokens
commitRedeemEpoch(side, epochId, shares, recipient, refundTo) A holder Queues a redemption of any epoch’s tokens (epochs)
poke() Anyone Applies the readings that are ready and fills up to 16 matured tickets; the caller earns their bounties
execute(maxTickets, beneficiary) Anyone The same, up to 64 tickets, with the bounty to beneficiary
convert(side, epochId, amount) A holder Converts old-epoch tokens to the current epoch
claim(to), claimFor(account) The account; anyone Pays out HYPE owed: bounties, referral fees, payouts and refunds that couldn’t be sent
donate(side) Anyone Adds HYPE to a live side’s pot, a tip with no tokens in return
retire() Anyone Retires a market the Registry reports retired. It then freezes at a reading taken after the call (details)
collectFees() Anyone Sends the accrued burn share to the burn vault
reclaim(id) Anyone Returns a set-aside redemption’s tokens to its refundTo

Views include state(), pots(), nav(side), previewMint, previewRedeem, ticket(id), matured(id), owed(account), epoch(side), epochInfo(side, epochId), config(), params(), needsWork() and the keepers’ work list. Every view that reads storage reverts while a call into the market is in progress, so no contract can price anything from a market halfway through a trade.

The main events: Committed, Executed, Refunded, Rebalanced (every applied reading, with the move and what it paid), ReadingSkipped, FeesAccrued, Credited, Claimed, Retired, Frozen and EpochRolled. The factory emits MarketCreated and the Registry MarketRegistered for every listing, so the Registry’s events list every market. Each relayed feed emits Posted for every round, with its answer, observation time, reference, flags and poster, and the signer set emits FeedDeployed for every feed and SignerAdded and SignerRemoved for every change to its list.

The listing call is on the Chainlink markets page, and stock tokens list the same way.

The contracts ship with unit, fuzz, invariant, attack and fork suites. Among the properties they check after every call:

  • Solvency. Each market’s HYPE balance covers its pots, escrowed mints, owed balances and accrued fees, on its own.
  • No admin path to funds. No call the timelock, the guardian or the Registry can make changes a pot, an escrow, an owed balance or the accrued fees. The signer set and the relayed feeds hold no HYPE and call no market.
  • Exits always work. Redemptions, executions and claims succeed with the Registry and the burn vault replaced by code that reverts; a market whose feed reverts reaches its frozen price within 7 days.
  • Caller independence. For the same rounds, every schedule of pokes and executes gives a ticket the same fill, or the same refund.
  • The rounds’ rules. A feed refuses a round that isn’t signed by enough listed keys, one observed before its newest round or in the future, and one that lands more than 60 seconds after its observation.
  • One market, five contracts. Every suite runs its markets through the router and its facets. A facet called directly is no market, a call the router doesn’t know is refused, and one lock covers all four facets.
  • No ticket blocks the queue. Each ticket fills, is refunded or is set aside; none can stop the ones behind it.
  • Immutable. Market, side-token, relayed-feed and price-reader code never changes once deployed. The core contracts sit behind no upgradeable proxies: the Market’s router and facets are fixed at deployment, with no admin.
  • Versioned. A bug means a new factory version. The old version is sunset, its markets are retired and freeze, and their pots stay redeemable forever.
  • Set up once, then sealed. The launch settings were applied once, at deployment, before any market existed, by the deployer, in two one-time setups. The burn vault’s bootstrap set its token, price source, burner and spending cap and sealed the vault in the same call; the deployer or the timelock can also seal a vault that was never set up. The Registry was deployed with the signer set as the feed owner every feed must have; its bootstrap applied the factory version, the bounded settings, the signer set as the Registry’s guardian, and the feeds, and sealed the Registry in the same call. The Registry accepts no market before that seal. Neither seal can be undone, and after both the deployer has no power. Every change since goes through the 72-hour timelock.
  • Governed by a timelock. Tunable settings sit behind a 72-hour OpenZeppelin TimelockController. A 1-of-1 Safe, whose single signer is a hardware wallet, is the only account that can schedule or cancel an operation; the Safe is also the treasury. Once an operation’s 72 hours have passed, anyone may execute it, exactly as the Safe scheduled it, for 14 days; after that it can’t be executed, only cancelled or scheduled again. So each change needs one signature, and an operation that should not run is cancelled by the Safe within its delay. The timelock also adds feeds and price signers.
  • A guardian and a sentinel. Two keys can act at once, each through the signer set: the guardian, the hardware wallet’s own key, and the sentinel, which Sagitta’s watchdog fires on a mismatched round. Either can pause new mints and tips and remove a price signer. Neither can touch redemptions, a committed ticket, a stored round or any HYPE.
  • Hands off the HYPE. No admin path can touch the HYPE in pots, in waiting tickets, owed to accounts or accrued as fees.
  • Markets stand alone. A stock token or a feed can have any number of markets, in one version or across versions, each its own contract with its own pots. Nothing one market does reaches another market’s HYPE.
  • Built for this chain. Solidity for the Cancun EVM without blob opcodes, Solady for the building blocks and OpenZeppelin only for the timelock. Every clock is block.timestamp, since block.number and blockhash() return parent-chain values here, so the burn’s proofs take block hashes from the ArbSys precompile and the EIP-2935 history instead. Every contract, the Market’s router and each facet included, fits Elysium’s limit of 24,576 bytes of code.

Sagitta on Elysium (chain 99901), from packages/config. Markets are found through the Registry's MarketRegistered events, and every relayed feed through the signer set'sFeedDeployed events.

ContractAddressWhat it does
Registry—Versions, pauses, the feed list, the bounded settings and every market (MarketRegistered)
MarketFactory (version 1)—Lists a market on any feed the timelock has added
Market—The router every market is a clone of: it sends each call to the facet that holds it
MarketExec—The Market's facet for execute and poke
MarketCommit—The Market's facet for commits and tips
MarketSettle—The Market's facet for settlement and the views
MarketMisc—The Market's facet for the rest: conversions, claims, retirement and fee collection
SideToken implementation—The code every side token is a clone of
SignerSet—The price signers and their threshold; deploys and owns every relayed feed
HYPE / USD feed—The relayed feed of HYPE in US dollars, for the site's dollar figures; no market reads it
BurnVault—Receives every market's burn share and buys and burns $SAGITTA with it
V4StateRoots—Checks block headers and stores each proven second's root, for the burn's grid readings
SagittaTimelock—Every tunable setting, behind a 72-hour delay
$SAGITTA—The house token the burn vault buys and burns
$SAGITTA pool oracle—Stores each proven grid reading of $SAGITTA's Montra pool
V4BurnPrice—The burn vault's price source: the price floor from four proven grid readings
V4Burner—Buys $SAGITTA for the burn vault in its Montra pool, within the move cap
Treasury Safe—Proposes and cancels on the timelock
Guardian—Can pause new mints and tips, and remove a price signer
Sentinel—Can pause new mints and tips, and remove a price signer; Sagitta's watchdog fires it

The price signers: —. The feeds the deployment listed: —.

Every address comes from packages/config, the one place Sagitta keeps chain addresses, and links to the explorer.

ContractAddressUsed for
WHYPE0xbA876237B0F021A6c6D852d6c26E107997cC5E81Wrapped HYPE; never a payee
Montra registry0xF1E2FA75422F889e565F3142bdbf60B28dce2aa7Lists Montra's launch hook and the PoolManager its pools live in
Uniswap v4 PoolManager0xE2e105d3F7209A9DA11f83cCf3E7398a753823F1Holds $SAGITTA's Montra pool: the burn buys there, and its grid readings are proofs of this contract's storage
ArbSys precompile0x0000000000000000000000000000000000000064L2 block numbers and recent block hashes
EIP-2935 block-hash history0x0000F90827F1C53a10cb7A02335B175320002935The last 393,168 L2 block hashes
Multicall30xcA11bde05977b3631167028862bE2a173976CA11Batched reads; never a payee
CreateX0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5EdDeterministic deployments: every core address, the Market's facets included, is known before it is deployed
Safe 1.4.1 SafeL20x29fcB43b46531BcA003ddC8FCB67FFE91900C762The implementation behind the treasury Safe
Safe 1.4.1 proxy factory0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67Creates the treasury Safe

The source code, with the tests above, is public at github.com/bryceweiner/sagitta.broker.