Docs
Developers

Contracts

Addresses, key functions, events and deployment facts for every MEZONK contract, and how to confirm them on-chain.

MEZONK's on-chain part is one deployment of MezonkExchange, which creates MezonkResolution, MezonkMarketFactory and MezonkIncentives in its constructor. All four are Solidity 0.8.24 (via-IR, London EVM, OpenZeppelin), live on Mezo Mainnet since 2026-11-18, and not upgradeable. MezonkBtcRounds (BTC up/down rounds staked in native BTC) is live too. MezonkPriceResolver is live at 0xc58D8A13B1e6f1614508ca20124A9d0F60520354. Source: github.com/prajalsharma/mezonk, contracts/src.

Live addresses

These come from the app's configuration, so they're the contracts this site is using right now.

Mezo Testnet · chain 31611
ContractAddressHolds or does
MezonkExchange0x4555…49B9Shares, orders, collateral, graduation
MezonkMarketFactory0x3d59…D689Roles, curator approvals, opening markets
MezonkResolution0x6Da5…b944Proposals, challenges, rulings, bonds
MezonkIncentives0xF1a0…f06BSeeder rebates and referral credit
MezonkPriceResolverNot deployed yetSettles BTC price markets from Mezo's PriceFeed
MezonkBtcRoundsNot deployed yetBTC up/down rounds, paid in BTC
MUSD (collateral)0x1189…c503Mezo's bitcoin-backed dollar

On Mezo Mainnet (chain 31612), deployed at block 13301975:

The owner of the exchange, factory, rounds and price resolver contracts is 0x017FF5FB886E90f9e5ADb405D8eFddffC1162dD2.

How it works exactly

Derived addresses at nonces 1 to 3

The exchange constructor runs, in this order:

MezonkExchange.sol
resolution = new MezonkResolution(collateral_);   // exchange nonce 1
factory    = new MezonkMarketFactory(owner_, config_); // nonce 2
incentives = new MezonkIncentives(collateral_);   // nonce 3

So the other three addresses are the CREATE addresses of the exchange at nonces 1, 2 and 3. The app derives them instead of configuring them (protocolAddresses in lib/chain/config.ts), and each one is also a public immutable on the exchange. Check both ways:

EX=0x102C908dCA719742f1958D18021B7C1c0092Ddf0
RPC=https://mezo-mainnet.boar.network
cast compute-address $EX --nonce 1   # 0xaB7d8e1F4b2fF15a23dE463B041F98483B73b28f
cast compute-address $EX --nonce 2   # 0x056F302D8AA87A4a1F4062a6c53EFe6425A6Bbc8
cast compute-address $EX --nonce 3   # 0x506F1FD8F0418beEdcFD5bDE7b1d8Dd56481d8A5
cast call $EX "resolution()(address)" --rpc-url $RPC
cast call $EX "factory()(address)" --rpc-url $RPC
cast call $EX "incentives()(address)" --rpc-url $RPC

Because they're created by the exchange, the exchange accepts openMarket only from that factory and settle only from that resolution contract, and neither can ever be swapped.

Size and gas

  • Deploying the exchange (which creates the other three) uses about 9.05M gas. Mezo blocks allow 10M, so deploy with --gas-estimate-multiplier 105; Foundry's default 30% buffer would exceed the block limit. Re-measure after any contract change.
  • MezonkExchange must stay under the 24,576-byte runtime and 49,152-byte init code limits. Check with forge build --sizes.
  • MezonkPriceResolver deploys on its own; the deployment simulated against the live exchange used 1.68M gas.

Units

  • MUSD has 18 decimals. Share quantities also use 18 decimals and must be multiples of LOT = 1e16 (0.01 share).
  • Prices are whole cents, 1 to 99. Cost of q shares at p cents is q × p / 100, exact at lot granularity, so nothing rounds.
  • Outcomes: None 0, Yes 1, No 2, Invalid 3. Share index: 0 Yes, 1 No. Side: 0 Buy, 1 Sell.

MezonkExchange

Holds all trading collateral. Ownable2Step, Pausable, ReentrancyGuard, EIP-712 domain ("MEZONK Exchange", "1").

FunctionWhoDoes
split(marketId, amount)anyone, live marketsLock amount MUSD, receive amount Yes + amount No
merge(marketId, amount)holder, after launch until finalBurn one Yes + one No per MUSD returned
placeOrder(marketId, outcome, side, price, qty)anyone, seeding or liveEscrowed resting order; seeding allows buys only; can't cross the book
cancelOrder(orderId)makerRefund the unfilled part; seed orders locked for minRest after placing and again after launch
take(params, sources)taker, liveFill against given resting ids and signed orders, best first, within limit and minFill
cancelSignedOrders(orders), raiseMinNonce(n)makerInvalidate signed orders
transferShares(marketId, outcome, to, amount)holderMove free shares
graduate(marketId)anyoneMove seeding to live if the escrowed book meets the policy
redeem(marketId)holder, finalBurn all your shares; Yes/No pay 1 if they won, Invalid pays 0.5 each
settle(marketId, outcome)resolution contract onlyRecord the final outcome once
openMarket(...)factory onlyOpen a market in seeding
addPolicy, setPolicyActive, pause, unpause, withdrawProtocolFees(to)ownerPolicies for new markets, pause, fee withdrawal

Key views: getMarket, getPolicy, getResting, stageOf, bestPrices, graduationCheck, orderHash, sharesOf(marketId, index, account), depthAt, filledOf, seedWeight, totalCollateral, escrowedCollateral, protocolFees, plus rebateWeight(marketId, seeder) and totalRebateWeight(marketId).

Pause blocks openMarket, graduate, split, placeOrder and take. It never blocks cancelling, merging, transferring shares, resolution or redeeming.

EventWhen
MarketCreated(marketId, creator, resolver, policyId, seedingDeadline, closeTime, metadataHash, metadata)Market published
Graduated(marketId, bestBid, bestAsk, bidDepth, askDepth, seeders)Seeding met the policy
OrderPlaced(orderId, marketId, maker, outcome, side, price, quantity, seed)Resting order escrowed
OrderCancelled(orderId, marketId, maker, remaining)Resting order refunded
Fill(marketId, orderRef, taker, maker, resting, makerOutcome, makerSide, makerPrice, quantity, complement, takerFee)One maker filled
TakeSettled(marketId, taker, outcome, side, filled, notional, fee, rebatePart, referralPart)One take finished
Split, Merged, SharesTransferred, RedeemedShare movements
MarketSettled(marketId, outcome)Outcome recorded
SignedOrderCancelled, MinNonceRaisedSigned orders invalidated
PolicyAdded, PolicyActiveSet, ProtocolFeesWithdrawnOwner actions

Signed orders use the type Order(address maker,address taker,uint256 marketId,uint8 outcome,uint8 side,uint8 price,uint128 quantity,uint64 expiry,uint256 nonce,uint256 salt). A non-zero taker restricts who may fill it.

MezonkMarketFactory

Publication authority. Ownable2Step, EIP-712 domain ("MEZONK Markets", "2").

FunctionWhoDoes
createMarket(params, approval, curator, sig)approved creatorVerify the curator's approval and open the market
cancelApproval(nonce)curator or ownerVoid an approval before use
setCreator, setCurator, setResolverownerRole lists
setConfig(config)ownerWindows, bonds and arbitrator for markets published afterwards
config(), approvalDigest(approval), isCreator, isCurator, isResolver, approvalUsedview

createMarket reverts unless: metadata is 1 to 8,192 bytes, the resolver is allowlisted, the caller is a creator, the curator is a curator and isn't the caller, the approval hasn't expired or been used, and the approval's metadata hash, creator, resolver, close time and policy all match. Signatures may come from an EOA or an ERC-1271 contract. Config bounds: challenge window 1 hour to 30 days, other windows up to 30 days, dispute bond above zero, arbitrator set.

Events: MarketApprovalUsed(marketId, curator, nonce), MarketApprovalCancelled, ConfigUpdated, ResolverUpdated, CreatorUpdated, CuratorUpdated.

MezonkResolution

Holds bonds only.

FunctionWhoDoes
proposeOutcome(marketId, outcome, evidenceHash, uri)the market's resolver; anyone after half the proposal window; before the window endsPost the proposer bond and propose
dispute(marketId, evidenceHash, uri)anyone except the proposer, resolver and arbitrator, inside the challenge windowPost the dispute bond
arbitrate(marketId, outcome, rationaleHash, uri)the market's arbitrator, inside the arbitration windowRule on a dispute
finalize(marketId)anyone, after a deadlineUndisputed → proposed outcome; no proposal or no ruling → Invalid
withdrawBond()anyone with creditWithdraw credited bonds
sweepSlashed(to)the exchange ownerMove slashed half-bonds out
stageOf(marketId)viewNotClosed, AwaitingProposal, Proposed, Disputed, Finalized

An upheld proposal credits both bonds to the proposer. An overturned one credits the dispute bond plus half the proposer bond to the disputer, and the other half goes to slashedBonds, so disputing your own false proposal from a second wallet costs money. Timeouts refund both.

Events: OutcomeProposed(marketId, resolver, outcome, evidenceHash, evidenceURI, challengeDeadline), OutcomeDisputed, DisputeArbitrated, MarketFinalized(marketId, outcome, reason), BondCredited, BondWithdrawn, BondSlashed, SlashedSwept.

MezonkIncentives

Holds only the rebate and referral share of taker fees the exchange actually collected.

FunctionWhoDoes
accrue(...)exchange only, inside takeSplit a fee into rebate and referral parts within the policy caps
claimRebate(marketId)seederClaim a pro-rata share of the market's rebate pool, capped per wallet
sweepRebates(marketId)anyone, after the claim windowReturn unclaimed rebates to the exchange as protocol fees
setReferrer(referrer)anyone, once, before their first tradeLink a referrer; no self or two-way referral
claimReferral()referrerClaim referral credit

Rebate weight is the seeder's seed escrow inside the price band graduation measured; far-off orders count for nothing.

Events: ReferrerSet, RebateAccrued, ReferralAccrued, RebateClaimed, RebatesSwept, ReferralClaimed.

MezonkPriceResolver

FunctionWhoDoes
setRule(marketId, strike, direction)owner, once, before closeRecord the strike and direction
settle(marketId)anyone, inside the capture windowRead Mezo's PriceFeed and propose
proposeManual(marketId, outcome, evidenceHash, uri)owner, after the windowFallback proposal
withdrawBonds() / sweep(to, amount)anyone / ownerBond housekeeping

Events: RuleSet, PriceCaptured, ManualProposal, Swept. Details: BTC price markets.

MezonkBtcRounds

Live on Mezo Mainnet at 0xc27f434195e4aF70782817A280A5D3Cb5de2ECa8: one-hour rounds, 10-minute capture window, 1% fee, stakes worth $8 to $125.

Standalone: it needs nothing from the exchange and holds nothing but native BTC stakes. Timing (genesis, interval, captureWindow) and the PriceFeed are immutable.

FunctionWhoDoes
bet(round, side) payableanyone, during the open round's betting windowStake BTC on Up or Down; msg.value must be worth minStakeUsd..maxStakeUsd at fetchPrice() now; one side per wallet per round
roll(round)anyone, from lockTime(round) for captureWindow secondsCapture one price: locks round and settles round − 1; takes the fee on a decided round
claim(roundIds)anyone with a stakePay winnings or refunds in BTC for settled or void rounds; never expires
result(round), claimable(round, account), btcForUsd(usd), getRound, getBet, currentRound, betStart, lockTime, closeTimeviewWhat the page reads
setStakeLimits, setFee (≤ 500 bps), setPausedownerLimits for new bets; pause stops bets only
sweep(to)ownerMove accrued fees out; stakes can't be swept

Events: BetPlaced(round, account, side, amount, usd, price), Rolled(round, price, updatedAt, settledRound, settledResult), Claimed(account, round, amount), StakeLimitsSet, FeeSet, PausedSet, FeesSwept. Details: BTC up or down, with BTC.

ABIs

The app's ABIs are generated from the Foundry build into apps/web/src/lib/contracts/abi.ts (exchangeAbi, factoryAbi, resolutionAbi, incentivesAbi, priceResolverAbi, btcRoundsAbi). After changing a contract: forge build && node scripts/export-abi.mjs.

Next