Docs/Smart contracts/Smart contracts
Smart contracts
A high-level map of markets, outcome tokens, fee vault, liquidity distributor, registry, and verified state implementations.
Contract map#
| Contract | Responsibility |
|---|---|
EventEmitter | Authenticates registered protocol sources and emits the single canonical domain-event stream. |
StateImplementationRegistry | Maps verified template IDs to approved, clone-compatible state implementations. |
StateMarketFactory | Clones verified or unverified state, deploys markets, configures fees, and mirrors canonical events. |
StateMarket | Custodies collateral, manages outcome tokens and orders, resolves, and pays winners. |
FeeVault | Holds creation bonds and trading fees, tracks categorized claimable earnings, and finalizes resolver rewards. |
LiquidityRewardsDistributor | Optional treasury-funded Merkle claims for scored two-sided liquidity campaigns. |
StateMarketToken | Market-controlled ERC-20 representation of one YES or NO claim. |
IState implementation | Returns the boolean condition consumed by market resolution. Official families cover Uniswap spot price and FDV, ERC20 supply and balance, plus authenticated Aave V3 and Morpho Blue liquidation state. |
Trust boundaries#
- Market resolution trusts its immutable state implementation and the external contracts it reads, whether verified or unverified.
- The protocol owner controls registry selection, current treasury, and economics defaults for newly created markets.
- The EventEmitter owner manages registry, factory, FeeVault, and liquidity-distributor source-role allowlists; historical factories can remain live across upgrades.
- The registry does not gate permissionless creation. It determines whether the supplied implementation receives a verified nonzero template ID.
- Every market snapshots its fee rate, split, bond, and bounty; later default changes do not alter it.
- The market creator can update metadata before resolution, but cannot change resolver, deadline, collateral, or outcome tokens.
- Manipulation resistance belongs in the state template; restricting
check()callers is not a price-security mechanism.