Skip to content

Docs How it actually works

Architecture ​

Four contracts hold the money and the positions. One server prices, signs nothing on your behalf, and relays. The split is drawn so that anything that can be checked on chain is.

The pieces ​

PieceWhereWhat it does
VaultContractHolds the USDC and the ledger: balances, stakes held for open positions, the pool, the queue
FuseMarketContractFuses: open, close, settle, each one transaction at one price; points
PerpMarketContractPerps: open, close, liquidate; the win charge both products use
ParamsContractEvery setting, versioned; a loosening change waits before it applies
RecorderServerKeeps the Hyperliquid streams open and stores one mid a second
Vol engineServerWorks out the volatility fuses are priced on, once a minute
PricerLibraryThe pricing maths, shared by the server, the app, the tests and these docs
OperatorServerQuotes, relays signed orders with the price it read, liquidates perps, settles expiries, pays the queue
AppBrowserThe ticket, the chart, the positions list

One trade, end to end ​

  1. Quote. The app asks the server for a quote: for a fuse, how long it will last at this leverage and volatility. A quote is valid for 10 seconds.
  2. Sign. You sign the quote. Nothing has happened on chain yet.
  3. Price. The server waits for the first Hyperliquid mid at least one second after your click and pairs it with the oracle price.
  4. Open. The server sends open(quote, price, signature). The contract checks the signature, the parameter version, the price, the size and the caps. If every check passes, the stake moves from your balance to the held account and the position is open. If any fails, the transaction reverts and nothing is taken.
  5. End. A close (your signed intent), an expiry (the server settles at the first price at or after it) or a liquidation (perps) ends the position in one transaction that also pays it.

There is no pending state. A position is either open at a known price or it does not exist.

The contracts sit behind proxies ​

All four contracts are behind OpenZeppelin transparent proxies. A change ships as an upgrade: the addresses, positions, balances and parameter history stay. A storage layout guard runs before every upgrade and refuses a new version that moves, retypes or removes a stored variable.

Each proxy's admin is owned by the operator wallet, which is the only key that can upgrade. That is a trust assumption, listed in Risk.

The read model ​

The server keeps a SQLite copy of what the chain says (positions, balances, the queue) so pages load without reading the chain for every figure. It is rebuilt from chain events and is never the source of truth for money.

Units on chain ​

QuantityUnit
Dollar amountsInteger micro-USDC (1,000,000 = $1)
PricesFixed point, 8 decimals
Fractions and ratesParts per million
TimesUnix seconds
PointsMicro-points

Every payout is worked out in integers and rounded down to the micro-dollar.