documentation

Exchange Logic

Hybrid CLOB architecture: fast off-chain order matching paired with non-custodial on-chain settlement on a single immutable contract.

Trader Wallet EIP-712 Order or 1-Click Session Non-custodial HTTP/WS Matching Engine Off-chain CLOB Append-only tape Holds zero funds settleFill Exchange Contract USDC Vault ERC-1155 Yes/No 2-sig verification Immutable Chainlink Oracle
Signed orders match off chain at sub-millisecond speed; custody, ERC-1155 shares, and Chainlink settlement live on chain.

The exchange at app.arizal.xyz communicates solely via HTTP and WebSocket under /v1, using the EIP-712 domain name Arizal. Markets span three contract kinds — Hit, Above, and Between — across five timeframes. Markets are listed off chain and created on chain lazily on their first fill. Each winning share redeems for $1.00; on resolution, the book locks and all resting orders cancel. See Markets for grid rules and IDs.

Order book & matching

The order book consists of two bid lists: Yes and No. A Yes bid at p crosses a No bid at q whenever p + q >= 1000. The trade executes at the maker’s price and the taker pays the complement so the two sides together fund $1.00 per share. Prices are quoted in decicents (600 = 60.0¢) from 0.1¢ to 99.9¢ with FIFO priority at each level, and sizes use 6 decimals (1 share = 1000000). See Order Book.

Buy orders can rest (GTC/GTD) or take immediately (FOK/FAK); post-only orders rest with a signed gas fee of 0. Sell orders never rest — they take directly against same-side bids, with the resting bidder acting as maker and receiving the shares. See Orders for full rules.

Orders that would cross your own resting orders stop and cancel the remainder (Self-trade), preserving prior fills. Resting buys soft-reserve deposited USDC per market and side. The matching engine holds neither private keys nor USDC; it records matches to an append-only tape, and the trade admin submits settled fills on chain.

Settlement math & fees

Both counterparties must hold sufficient deposited USDC. The Yes buyer pays size × yesPrice / 1000 and the No buyer pays the remainder of the $1.00 bundle. Whenever limit prices sum to more than 1000, price improvement goes entirely to the taker.

Makers pay zero trading fee and zero gas. Takers pay a quadratic trading fee computed by the node and passed into settleFill:

fee = shares × (trading_fee_factor / 1e18) × p × (1 − p)

Here p is the execution price in dollars, so the fee is symmetric around 50¢ (identical at 30¢ and 70¢, peaking at 50¢). The base tier uses a 0.07 factor and steps down to 0.04 with 30-day taker volume — see Fees. A published USDC gas fee is charged to the taker on top. Trading fees accrue to feeAccount and gas fees to tradeAdmin (both withdraw via standard withdraw).

Share lifecycle

See Balances for user flows across the four share operations:

1-click session keys

Enabling 1-click trading prompts your main wallet to sign (no on-chain transaction) an EIP-712 ApproveAgent authorization for a local browser key (1–180 days, default 30; contract maximum 6 months). That authorization travels with each placement as agent_auth and is verified on chain during settleFill, while order.trader stays your main wallet. Withdrawals, splits, merges, and redemptions always require your main wallet. Revoking sends an on-chain revokeAgent transaction and wipes the browser key.

Role permissions

Role Permitted actions
Any wallet deposit, withdraw, split, merge, redeem, settle, voidMarket, safeTransferFrom (cancels sender’s open sells for that position), and applyOracle after timelock.
Trade admin createMarket, settleFill. Every fill — open or close — requires two valid user or session-key signatures.
Operator setTradeAdmin, setFeeAccount, disableFeeAccountChanges, setOperator, setURI, and proposeOracle / cancelOracle (7-day public timelock).