Skip to content

System overview ​

The platform trades realized-variance perpetual contracts for MON and ETH. The order price is annualized variance. It is not the spot price of MON or ETH. Each market holds its own collateral and has its own book and funding state.

Components ​

PathResponsibility
contracts/src/Matching, collateral, funding, margin, and liquidation
packages/shared/src/ABIs, EIP-712 action definitions, and data validation
services/src/Relayer, event index, HTTP API, and SSE notices
web/src/Next.js terminal, portfolio page, wallet actions, and the demo page
scripts/Deployment, maker quotes, taker orders, observations, and shocks
simulation/Python accounting reference and economic research
text
                  +---------------------------------+
                  |  Web application (Next.js)      |
                  |  main wallet  +  session key    |
                  +---+-------------+-----------+---+
   wallet             |             | signed    | snapshots
   transactions       |             | actions   | and history
                      |             v           v
                      |        +---------+  +-----------------+
                      |        | Relayer |  | Indexer and API |
                      |        +----+----+  +--------^--------+
                      v             v                | events
   +----------------------------------------------------------+
   |  Chain                                                   |
   |  SessionRegistry     Market (ETH)      Market (MON)      |
   |  TestUSDC            TestOracle                          |
   +------------------------------^---------------------------+
                                  | quote + signed observation
                        +---------+----------+
                        |  Test operator     |
                        |  (quote loop)      |
                        +--------------------+

The service does not match orders. Contracts decide execution and enforce risk checks. The indexer supplies event history. The terminal polls API snapshots. The API also supports SSE notices. A production database is not present. The indexer stores its state in an atomic JSON file.

Contracts ​

ContractResponsibility
Market, one for each assetBook, maker ladders, collateral, accounts, funding index, and risk checks
QueuedMarketA Market with an on-chain FIFO queue of IOC requests and the combined call quoteAndTake
SessionRegistryMarket-scoped session authorization, expiry, and exposure limits
TestOracleThe owner of this contract is the oracle signer. It can also store price records.
TestUSDCTest collateral with a public mint function

The test oracle does not verify external price feeds. The MON market can use a synthetic price while native testnet MON pays transaction gas. These are different uses of the name MON.

See the contract reference for functions, events, and constants.

Data paths ​

ActionPathWallet prompt
Mint test USDC, approve, deposit, withdrawWeb application to the token and the marketYes
Authorize or revoke a sessionWeb application to SessionRegistryYes
Place or cancel an orderSession key signs EIP-712 data. POST /actions on the relayer. The relayer calls placeOrderWithSig or cancelWithSig.No
Read book, trades, account, and historyHTTP API. The API reads live state from the contract and history from the index.No
Move the maker quotes and submit an observationThe operator loop calls quote on each marketNo (script key)

Units ​

ValueRepresentation
Market quote, position size, cash, funding, and marginInteger with 18 decimals
TestUSDC transfer, deposit, and withdrawal amountInteger with 6 decimals
Oracle priceInteger with 18 decimals
Maker ladder sizeInteger in units of 0.01 contracts
TimestampUnix seconds
Large integer in JSONDecimal string

One contract has a multiplier of 100 USDC per annualized variance unit. The funding horizon is seven calendar days. The year basis is 365 days.

Time rules of a market ​

A market gets its observation interval at deployment. Two limits come from that interval:

ValueRule60-second market300-second market10-second market
Observation intervalConstructor input, at most 600 seconds60 s300 s10 s
Gap limit (maxGap)3 intervals180 s900 s30 s
Mark age limit (maxMarkAge)2 intervals120 s600 s20 s
Receipt delay limitFixed5 s5 s5 s

The local deployment uses 60 seconds by default. The Hedging demo uses 10 seconds. The Monad testnet script uses 300 seconds.

Market states ​

StateCauseEffect
Observation dueThe block time is at or after the next boundaryFills wait. Orders that do not cross can rest. Cancellation stays available.
Mark frozenMissing depth, one owner on a side, a wide spread, an old mark, or an oracle haltWithdrawals and liquidations wait. Matching continues. A fill that adds exposure must pass the margin check at the last mark and at its own price.
Oracle haltedNo accepted observation within the gap limit plus the receipt delayNew orders, withdrawals, and liquidations wait. Cancellation stays available. A new observation clears the halt.

Deployed on Monad testnet.