Concepts

How it works

Moxie turns an event on a prediction market into a perpetual contract you can trade continuously, with fully collateralized risk and permissionless upkeep.

The big picture#

Three prices#

Each market has three related prices. They usually sit within a cent or two of each other.

PriceWhat it isUsed for
Source indexThe latest price from the source market, as posted by the oracle.Anchoring the mark, and funding.
Protected markThe source index plus a time-averaged premium. It moves gradually, so one sudden quote or trade can’t trigger liquidations. This is the “Price” shown across the site and the main line on the chart.Margin, estimated PnL, and closing positions at hard-flat.
Moxie priceWhere you actually trade: the liquidity provider’s quote around the mark, adjusted for spread, order size and inventory. Order flow moves it.Your fill. The order ticket shows it as Est. fill price.

Trading against the liquidity provider#

Moxie has no order book. When you trade, the Percolator engine calls the Moxie matcher, which prices your order for the liquidity provider’s portfolio and the trade settles immediately between the two portfolios. The matcher’s price depends on:

  • Base spread: a small fixed distance from the mark.
  • Size: bigger orders get a slightly wider price.
  • Inventory: if the LP already holds a lot of one side, prices lean to encourage trades that rebalance it.
  • Limits: a maximum size per fill and a maximum total LP position. Orders beyond them are refused, and the ticket asks you to trade smaller.

Your order carries a limit price, so the transaction fails rather than fill worse than you agreed to.

Collateral and margin#

Your portfolio is an on-chain account owned by the Percolator program. It records your USDC collateral, realized PnL, funding paid and received, and your position in each market. Before any trade that adds risk, the engine checks that your equity covers the margin of every position you hold.

Prices can jump to $0 or $1 on news, so margin covers the worst case: a long needs its price plus $0.05 per contract, a short needs $1 minus the price plus $0.05 (or the price, if larger). As a result no position can lose more than the collateral behind it.

Funding#

Funding keeps Moxie anchored to the source market. The gap between the two is measured in absolute price terms and averaged over time; longs pay shorts when Moxie is above the source, shorts pay longs when it is below. Payments accrue every slot and are applied whenever the market is cranked, so they show up in your portfolio balance without any action from you.

Keepers and cranks#

Percolator updates markets lazily. A crank is a transaction that brings a market up to date: it accrues funding, refreshes prices and runs any lifecycle step that is due. Anyone can send one, and Moxie runs a keeper that cranks continuously. If a market falls behind, trades that add risk wait until it catches up — that’s the “market data is updating” message you may occasionally see.

Lifecycle and settlement#

Each market is listed with a schedule tied to the source event’s close time:

PhaseDefault timingEffect
ActiveListing → close − 30 minNormal trading.
RestrictedClose − 30 minThe matcher lowers its per-fill and inventory limits.
Reduce onlyClose − 10 minOnly trades that reduce a position are accepted.
Hard-flatClose − 1 minKeepers close every remaining position at the protected mark.
ResolvedAfter the source resolvesThe market is closed; remaining accounting is finalized.

Why close before the outcome?

A perpetual has no expiry, but the event behind it does. Closing everyone at the protected mark just before the event closes means no one is exposed to the final jump to $0 or $1, and the LP and traders settle at a fair, manipulation-resistant price.

On-chain programs (devnet)#

ProgramAddress
Percolator engine9GnPynrGbmQqQw8715neTB6xqeEw7ZcpRTHCT3AEDM4e
Moxie matcherH6z6Z5KSQtXj7sYvqX7oCwskBuhWvUDDB8KGNqeuNWXS
Moxie oracledLAPcvtkqAtYHh6QFogmm8E3ovCeZtoWvtsWJFP8AQ3
Market groupAihBkr17D9hSSyWRLK5cetZC2P5xMVbft112bHjZWgc2
Test USDC mint5yV4TPjnwvAGTmqJdjeM7rFZUVcrxSfPVVK87YNK3NRS
NextTypeScript SDKBuild Moxie transactions and size orders in your own code.