Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

vs source realm

Package vs is Mimir's VS (duel) market, settled by an AI oracle: the gno.land port of contracts/MimirV3Erc20.sol. Sta...

Overview

Package vs is Mimir's VS (duel) market, settled by an AI oracle: the gno.land port of contracts/MimirV3Erc20.sol. Stakes are mUSD.

A creator opens a claim with a stake on their position. Challengers take the other side, each once, up to the claim's maxChallengers (at most 100):

  • pool odds: challengers share the creator's stake pro rata, and together may stake at most MaxPoolMultiple times the creator's stake;
  • fixed odds: each challenger is paid challengerPayoutBps of their stake (2x by default, at most 10x), and the creator's unreserved stake must cover every challenger's profit when they join.

After the deadline the oracle proposes CREATOR, CHALLENGERS, DRAW or UNRESOLVABLE with a confidence and the hash of its evidence. A participant may dispute within the dispute window by posting DisputeBond; the arbiter rules. An undisputed proposal is finalized by anyone. Settlement pays every participant in the same transaction. Draws, unresolvable questions and claims nobody challenged before the cutoff refund every stake.

Fees: an entry fee on every stake that opens or joins a claim (fees.EntryBps, 0.5% by default), kept on refunds. No fee on winnings, except copy trades: ReferrerFeeBps of the profit to the referrer and CopyFeeBps to the platform.

Private claims: only wallets the creator invites may challenge. Market data and transactions stay public.

Differences from the EVM contract come from the transport, as in the pool realm: mUSD with an approve in the same transaction (no permit variants), payouts sent directly (mUSD cannot refuse or re-enter), block-time seconds. SetInvited takes a comma-separated address list.

Constants 4

const MaxChallengers, MaxPoolMultiple, MinStake, DisputeBond, DefaultPayoutBps, MaxPayoutBps, MaxDeadlineAhead, MaxEntryBps, ChallengeLockSeconds, ReferrerFeeBps, CopyFeeBps, ResolutionGraceSeconds, MinLiveDisputeWindow, TestnetDisputeWindow

 1const (
 2	MaxChallengers  = 100
 3	MaxPoolMultiple = int64(5)
 4	// MinStake is the smallest gross stake that opens or joins a claim: 0.1 mUSD.
 5	MinStake         = int64(100_000)
 6	DisputeBond      = int64(2_000_000)
 7	DefaultPayoutBps = int64(20_000) // 2x
 8	// Fixed odds pay at most 10x.
 9	MaxPayoutBps     = int64(100_000)
10	MaxDeadlineAhead = int64(365 * 24 * 60 * 60)
11	MaxEntryBps      = int64(100)
12	// Anti-sniping: no new challenges in the final seconds before the deadline.
13	ChallengeLockSeconds   = int64(60)
14	ReferrerFeeBps         = int64(100)
15	CopyFeeBps             = int64(100)
16	ResolutionGraceSeconds = int64(7 * 24 * 60 * 60)
17	MinLiveDisputeWindow   = int64(24 * 60 * 60)
18	TestnetDisputeWindow   = int64(10 * 60)
19)
source

const Deployer, InitialOracle, InitialArbiter

1const (
2	Deployer       = address("g12dcsmwccgdxasqde2eumua88tlrkw83kqf6tcz")
3	InitialOracle  = address("g18pnec3atge4msr5hhanm790tljtdyd87s0wguh")
4	InitialArbiter = address("g1af78r3tuv84mf3cd0kxrssmw6g2v2mvvc6phpv")
5)
source

Functions 43

func CancelClaim

crossing Action
1func CancelClaim(cur realm, claimID int64)
source

CancelClaim refunds the creator of a claim nobody has challenged yet.

func ChallengeClaim

crossing Action
1func ChallengeClaim(cur realm, claimID, stakeAmount int64, referrer string)
source

ChallengeClaim takes the counter position with `stakeAmount` mUSD (less the entry fee).

func ChallengersJSON

Action
1func ChallengersJSON(id int64) string
source

ChallengersJSON lists a claim's challengers in the order they joined.

func ClaimFees

crossing Action
1func ClaimFees(cur realm)
source

ClaimFees pays the caller's accrued fees (entry fees, copy fees, forfeited bonds).

func ClaimsJSON

Action
1func ClaimsJSON(offset, limit int) string
source

ClaimsJSON lists claims newest first: `offset` skips that many from the newest.

func CreateClaim

crossing Action
1func CreateClaim(cur realm,
2	question, creatorPosition, counterPosition, resolutionURL string,
3	deadline, stakeAmount int64,
4	category string, parentID int64,
5	marketType, oddsMode string, challengerPayoutBps int64,
6	handicapLine, settlementRule string, maxChallengers int,
7	isPrivate bool, referrer string) int64
source

CreateClaim opens a claim with `stakeAmount` mUSD (less the entry fee) on the creator's position. oddsMode is "pool" or "fixed"; challengerPayoutBps applies to fixed odds (below 10000 means the 2x default). maxChallengers 0 means the maximum. referrer is the copied basket's creator, or "".

func CreateRematch

crossing Action
1func CreateRematch(cur realm, parentID, deadline, stakeAmount int64) int64
source

CreateRematch opens a new claim inheriting its terms from a parent. The caller is the creator and pays the stake. The parent's referrer carries over only to the parent's own creator.

func DisputeResolution

crossing Action
1func DisputeResolution(cur realm, claimID int64)
source

DisputeResolution escalates a proposed verdict to the arbiter by posting DisputeBond. The bond comes back if the arbiter changes the verdict and is forfeited otherwise. Open to the creator, challengers, the audit agent and the arbiter.

func EligibleTotals

Action
1func EligibleTotals(claimID int64) (int64, int64)
source

EligibleTotals are the creator's and the challengers' stakes that compete under the settlement cutoff.

func FeeStats

Action
1func FeeStats() (int64, int64, int64)
source

FeeStats: accrued, claimed and outstanding fees. Outstanding is always covered by the realm's balance.

func FinalizeResolution

crossing Action
1func FinalizeResolution(cur realm, claimID int64)
source

FinalizeResolution settles an undisputed proposal once its window has closed. Anyone may call it.

func RefundExpired

crossing Action
1func RefundExpired(cur realm, claimID int64)
source

RefundExpired is the escape hatch, open to anyone once the grace has passed:

  • an active claim the oracle never resolved refunds every stake;
  • a disputed claim the arbiter never ruled on settles to the proposal and the bond is forfeited, unless the owner vetoed it or the realm is paused: then every stake is refunded and the bond goes back;
  • a paused, undisputed proposal refunds after the grace from its proposal.

func ResolveClaimWithCutoff

crossing Action
1func ResolveClaimWithCutoff(cur realm, claimID int64, winnerSide int, summary string,
2	confidence int, evidenceHash string, cutoff int64)
source

ResolveClaimWithCutoff is the oracle's verdict on an active claim. With a dispute window it is a proposal; only stakes made strictly before `cutoff` (0 = all) compete, later ones are refunded.

func ResolveDisputeWithCutoff

crossing Action
1func ResolveDisputeWithCutoff(cur realm, claimID int64, winnerSide int, summary string,
2	confidence int, evidenceHash string, cutoff int64)
source

ResolveDisputeWithCutoff is the arbiter's final word on a disputed claim.

func SetAuditAgent

crossing Action
1func SetAuditAgent(cur realm, next string)
source

SetAuditAgent appoints the reviewer that may dispute with a bond; "" disables it.

func SetInvited

crossing Action
1func SetInvited(cur realm, claimID int64, accounts string, allowed bool)
source

SetInvited grants or revokes wallets on a private claim, up to MaxChallengers per call, as a comma-separated list. Revocation only blocks future entry. Rematches have their own empty list.

func SetLockAt

crossing Action
1func SetLockAt(cur realm, claimID, at int64)
source

SetLockAt closes a claim to new challengers early, by its creator or the owner. Only ever earlier.

func VetoProposal

crossing Action
1func VetoProposal(cur realm, claimID int64)
source

VetoProposal sends a proposal the owner believes wrong to the arbiter, inside the window. No bond; if the arbiter never rules, RefundExpired refunds.

Types 3

type Challenger

struct
1type Challenger struct {
2	Addr     address
3	Stake    int64 // net
4	At       int64
5	Referrer address
6}
source

type Claim

struct
 1type Claim struct {
 2	ID                       int64
 3	Creator                  address
 4	Question                 string
 5	CreatorPosition          string
 6	CounterPosition          string
 7	ResolutionURL            string
 8	CreatorStake             int64
 9	TotalChallengerStake     int64
10	ReservedCreatorLiability int64
11	Deadline                 int64
12	State                    int
13	WinnerSide               int
14	ResolutionSummary        string
15	Confidence               int
16	Category                 string
17	ParentID                 int64
18	CreatedAt                int64
19	MarketType               string // binary | moneyline | spread | total | prop | custom
20	OddsMode                 string // pool | fixed
21	ChallengerPayoutBps      int64  // fixed odds, e.g. 20000 = 2x
22	HandicapLine             string
23	SettlementRule           string
24	MaxChallengers           int
25	IsPrivate                bool
26	EvidenceHash             string
27	Referrer                 address // the creator's referrer
28	EntryFees                int64
29	SettlementCutoff         int64
30	LockAt                   int64
31	Proposal                 Proposal
32
33	challengers []*Challenger
34	joined      avl.Tree // address -> true
35	invited     avl.Tree // address -> bool
36}
source

type Proposal

struct
 1type Proposal struct {
 2	WinnerSide   int
 3	Confidence   int
 4	ProposedAt   int64
 5	DisputedAt   int64
 6	Disputer     address
 7	Bond         int64
 8	EvidenceHash string
 9	Summary      string
10}
source

Dependencies

Source Files 8