const StOpen, StProposed, StDisputed, StResolved
Market states.
Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.
Package pool is Mimir's two-sided pool prediction market, settled by an AI oracle: the gno.land port of contracts/Mim...
Package pool is Mimir's two-sided pool prediction market, settled by an AI oracle: the gno.land port of contracts/MimirPoolErc20.sol. Stakes are mUSD (gno.land/r/.../musd, 6 decimals).
Model
Differences from the EVM contract, all from the transport:
Market states.
Sides and outcomes.
1const (
2 // MinStake is the smallest gross stake: 0.1 mUSD.
3 MinStake = int64(100_000)
4 // DisputeBond is 2 mUSD, independent of the stake minimum so disputes stay costly to spam.
5 DisputeBond = int64(2_000_000)
6 // No new stakes in the final LockSeconds before the deadline (anti-sniping).
7 LockSeconds = int64(60)
8 MaxDeadlineAhead = int64(365 * 24 * 60 * 60)
9 // Entry fees above 1% are refused, whatever the fee realm answers.
10 MaxEntryBps = int64(100)
11 ReferrerFeeBps = int64(100)
12 CopyFeeBps = int64(100)
13 ResolutionGraceSeconds = int64(7 * 24 * 60 * 60)
14 MaxDisputeWindow = int64(7 * 24 * 60 * 60)
15 // On mainnet a proposal stays disputable at least this long.
16 MinLiveDisputeWindow = int64(24 * 60 * 60)
17 // TestnetDisputeWindow lets a testnet show the whole flow in minutes.
18 TestnetDisputeWindow = int64(10 * 60)
19)Initial roles. The owner can change each one afterwards.
Claim collects the caller's own payout.
ClaimFees pays the caller's accrued fees (entry fees, copy fees, forfeited bonds).
ClaimFor lets anyone push a user's payout to them. The money only ever goes to `user`.
Claimable is what ClaimFor would pay `user` now (net) and the copy fees it would take. 0 if unresolved, already claimed or nothing owed.
CreateMarket opens a market with `amount` mUSD (pulled from the caller, less the entry fee) staked on `side` (SideA or SideB). `referrer` is the copied basket's creator, or "" for none. Returns the new market's id.
Dispute escalates the proposal to the arbiter, pulling DisputeBond mUSD. Open to the market's participants, the audit agent and the arbiter.
EligibleTotals are the side totals that compete under the settlement cutoff.
Finalize settles an undisputed proposal once the window has closed. Anyone may call it.
MarketsJSON lists markets newest first: `offset` skips that many from the newest.
PositionJSON is one user's stake, claim state and claimable amount in a market.
RefundExpired is the escape hatch, open to anyone once the grace has passed. A market the oracle never resolved is refunded in full; a dispute the arbiter never ruled on settles to the oracle's proposal and the bond is forfeited, so a cheap dispute cannot turn a loss into a free refund. A vetoed proposal, or any proposal while paused, refunds instead.
Resolve is the oracle's verdict: final at once with no dispute window, else a proposal.
ResolveDispute is the arbiter's final word on a disputed market.
1func ResolveWithCutoff(cur realm, id int64, outcome int, summary, evidenceHash string, cutoff int64)ResolveWithCutoff also sets the settlement cutoff: only deposits strictly before it compete; later ones get their net principal back.
SetAuditAgent appoints the reviewer that may dispute with a bond; "" disables it.
SetCaps sets guarded launch caps in net mUSD units (0 = none). They only gate new stakes.
SetLockAt closes a market to new stakes early (kickoff), by its creator or the owner. Only ever earlier.
SideTotals are the pool sizes: the implied probability of A is totalA / (totalA + totalB).
Stake puts `amount` mUSD (less the entry fee) on `side`. Repeated stakes add up.
VetoProposal lets the owner send a proposal it believes wrong to the arbiter, inside the window. No bond; if the arbiter never rules, RefundExpired refunds every stake rather than honouring the vetoed proposal.
1type Market struct {
2 ID int64
3 Creator address
4 Deadline int64
5 CreatedAt int64
6 State int
7 Outcome int // final, once resolved
8 Proposed int // the oracle's proposal
9 ProposedAt int64
10 DisputedAt int64
11 Disputer address
12 Bond int64
13 TotalA int64
14 TotalB int64
15 EvidenceHash string // hex sha256 of the oracle's evidence
16 Question string
17 LabelA string
18 LabelB string
19 ResolutionURL string
20 Category string
21 Summary string
22 // 0 includes all deposits; otherwise only deposits strictly before it compete.
23 SettlementCutoff int64
24 // Optional early close: stakes stop at LockAt instead of LockSeconds before the deadline.
25 LockAt int64
26 EntryFees int64
27
28 history mimir.History // market totals over time
29 positions avl.Tree // address -> *Position
30}