func ActivateGnomePass
crossing ActionActivateGnomePass buys durationDays (30..360, multiple of 30) of Gnome Pass. The tx must attach exactly passPrice × durationDays/30 ugnot (MsgCall send).
Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.
ActivateGnomePass buys durationDays (30..360, multiple of 30) of Gnome Pass. The tx must attach exactly passPrice × durationDays/30 ugnot (MsgCall send).
1func AddLiquidity(cur realm, coin string, coinMax uint64, grinMax uint64, minShares uint64, deadline int64) uint64AddLiquidity deposits up to coinMax of `coin` and grinMax grin. The first deposit sets the price (open economy: any ratio) and burns minLiquidity shares; later deposits take the current ratio (never more than either cap). Reverts unless at least minShares are minted.
AllMiners returns the leaderboard sorted by total mined (desc), paginated. (game28 returned it in address order.)
BanAddress bans a player address. durationSecs=0 means permanent.
1func BatchClaimAchievements(cur realm, idsJson string, nonce int64, expiry int64, sigHex string) intBatchClaimAchievements claims several ids (already-claimed / not-earned ids are skipped). idsJson must be exactly the voucher payload.
BookDepth lists asks for a taker who pays `pay` and gets `get`, best price first (≤ 50 rows; offset < maxSideOrders).
CancelOrder: the maker gets the remaining escrow back. Works while paused and for banned makers; only the maker can cancel.
CancelPvpLobby lets the creator close an open lobby nobody joined (refund). Works while paused: a refund of the player's own escrow is never blocked.
CasinoBet returns one player's bet and its on-chain result.
CasinoJackpots reports the real MAJOR / GRAND pools and how they pay.
CasinoOutcome maps a roll to what landed. For rps the outcome is "win" | "push" | "lose" (see rpsHouseMove for the move shown).
CasinoPool reports a coin's pool, reservation, max bets and daily counters.
CasinoRoll is the on-chain roll: uint32(sha256(s:c:roundId:game)[0:4]) % 100.
CasinoStats reports a coin's accounting: pool, reserved, jackpots, seeded, staked, paid, the conservation check and per-game rounds/staked/paid.
1func ClaimAchievement(cur realm, achievementId string, nonce int64, expiry int64, sigHex string)ClaimAchievement claims one allowlisted achievement and credits its fixed reward. Needs a server voucher of kind "ach" with payload = `["<id>"]`.
ClaimAllowance returns the current per-rarity allowance for addr.
1func ClaimAndMint(cur realm, coinsJson string, nonce int64, expiry int64, sigHex string) stringClaimAndMint credits mined coins to the caller's on-chain balance. coinsJson: [["coinId","amount"],...]. Requires a server voucher (see VoucherMessage) for exactly this coinsJson, plus the on-chain rate cap for the caller's best tool, the coin allowlist and the vein caps. Returns a JSON object of what was actually credited (after bonuses/veins).
ClaimMine (game27/28 two-step flow) is retired: pending mints are gone.
ClaimPvpTimeout resolves a stuck match after pvpTimeoutSec without action:
Any lobby member may call it. Escrow can never stay locked.
CommitCasinoSeed opens a round for one player with sha256(s). Operator only; a round id can be used once.
CommitPvpMove stores sha256(choice+":"+salt) for the caller. Members only, once per player per lobby, only while the lobby is joined.
CreatePool opens an empty COIN/GRIN pool (admin, per the launch schedule). It holds nothing until players deposit; the admin can't deposit for anyone, withdraw from it or close it.
CreatePvpLobby escrows the creator's wager and opens a lobby.
Tasks: game28 let anyone mark any task done. In game29 tasks are created and completed for a player only by the operator (server) — no free medals.
ExpireLobbies is a no-op kept for API compatibility (timeouts are per lobby).
1func FillOrders(cur realm, pay string, get string, payAmt uint64, minGet uint64, maxFills int, deadline int64) uint64FillOrders: spend at most payAmt of `pay` (taker fee included) on the best-priced orders that give `get`; receive at least minGet or revert. ≤ 10 fills and ≤ 20 scanned entries per call.
ForfeitCasinoBet settles a bet as a loss when s was revealed but the player's secret was not within 24 h (only the player could know the result). Anyone.
FreeSpinGrant reports a player's open free spins (null when none).
JackpotPool reports the GRAND jackpot pool (the casino bankroll is CasinoPool).
LastNonce returns the last voucher nonce used by addr (0 if none).
LpPosition shows one position and what it would withdraw right now.
LpPositions lists an address's positions (bounded: at most one per pool, paginated by pool order, ≤ 50 pools scanned per call).
── Migration (game27 / game28 → game29) ────────────────────────────────────
MigrateBatch(batchId, kind, rowsJson) imports one batch. rowsJson is a JSON array of string arrays. Kinds and row shapes:
1balance [addr, coinId, amount] → balances (SET, not add)
2lifetime [addr, coinId, amount] → lifetimeMined (SET) + miners total
3tools [addr, "t1,t2,..."] → ownedTools (SET, unknown ids dropped)
4toollife [addr, toolId, life] → toolLife (SET, clamped to max)
5skill [addr, skillId, rank] → skillRanks (SET, clamped to max)
6medal [addr, achievementId] → achievements (allowlisted ids only)
7pass [addr, expiryUnix] → gnomePasses (SET)
8guild [guildId, name, leader, "m1,m2,..."] → guilds + members
9ban [addr, reason, expiryUnix] → blacklist (expiry 0 = permanent)
A batchId that was already applied is skipped, and every write is a SET, so re-running a whole migration is a no-op. FinalizeMigration locks it forever.
Order shows one open order of `maker` (lookups are per maker by design).
OrdersOf lists an address's open orders (≤ 20 by construction).
PendingMints is kept for client compatibility; game29 has no pending step.
1func PlaceCasinoBet(cur realm, roundId string, game string, coinId string, betAmount string, choice string, clientHash string)PlaceCasinoBet escrows the player's bet with sha256(c): only the round's player, only before s is revealed, and only if the pool can pay its largest win.
PlaceCasinoFreeSpin uses one free spin of the caller's grant in a committed round (no stake). One free spin in flight at a time.
1func PlaceOrder(cur realm, give string, giveAmt uint64, want string, wantAmt uint64, expirySecs int64) uint64PlaceOrder escrows giveAmt of `give` and lists it for wantAmt of `want` (any pair). Costs 2 grin (protocol fee, not refunded). Returns the id. expirySecs 0 = 72 h; max 7 days.
PlayerXp returns the caller's cumulative rarity-weighted XP earned from ClaimAndMint calls as a plain decimal string (e.g. "12345"). Returns "0" for players who have not yet minted anything on this realm version.
Pools lists pools in coin order (paginated, ≤ 50 per call).
QuoteFill previews FillOrders for a budget (fee included): {"spent","got"}.
1func QuoteRoute(caller string, coinIn string, coinOut string, amountIn uint64, maxFills int) stringQuoteRoute previews SwapRoute: how much goes to the book vs the pools and the expected output (fees included).
QuoteSwap quotes a single-pool swap; "0" if the pool can't take it.
RefundCasinoBet returns the stake only if s was never revealed and 30 minutes have passed since the bet. Never after s is revealed. Works while paused.
RegisterVein is the game28 name for SetVeinMax.
1func RemoveLiquidity(cur realm, coin string, shares uint64, minCoin uint64, minGrin uint64, deadline int64) (uint64, uint64)RemoveLiquidity is instant and ALWAYS available: it works while the exchange or the pool is paused, before or after a ban, and needs no tool. Nobody but the position owner can call it for that position.
RevealCasinoSecret publishes the player's secret c (anyone may relay it: it must hash to the bet's hash) and settles the bet on chain. Works while paused.
RevealCasinoSeed publishes s (it must hash to the commit). It settles nothing: the bet settles when the player's secret is revealed.
RevealPvpMove reveals a committed move. The tx fails unless sha256(choice+":"+salt) equals the stored commit. A matching reveal of an invalid choice forfeits the match. When both have revealed, it settles.
Rewarded returns what rewards (medals etc.) credited, per coin. Separate from LifetimeMined.
SeedCasinoJackpot adds the ADMIN'S OWN coins to a jackpot pool (never withdrawable).
SeedCasinoPool moves the ADMIN'S OWN on-chain coins into a casino pool. Only ever the admin's own balance; nobody can withdraw a pool back.
SetCasinoJackpotRefBet sets the bet that wins a full jackpot (smaller bets win the same share of the pool as their share of this bet).
SetCasinoJackpotSeed sets the level a jackpot is topped back up to after a hit.
SetClaimSigner registers the ed25519 public key (64 hex chars) of the server's claim signer. Pass "" to disable all vouchered calls (kill switch).
SetExchangePaused stops NEW swaps, deposits, orders and fills. It can't stop RemoveLiquidity, CancelOrder, SweepExpiredOrders or fee withdrawals.
SetOperator lets the admin name the server account that commits and reveals casino seeds. It must be its own key, never the admin/treasury key. The operator can't move anyone's coins.
SetPassPrice sets the ugnot price per 30-day period.
SetPoolPaused stops new swaps and deposits on one pool. Withdrawals stay open.
SetVeinMax overrides a coin's vein size. It can't go below what was minted.
1func SwapExactIn(cur realm, coinIn string, coinOut string, amountIn uint64, minOut uint64, deadline int64) uint64SwapExactIn swaps amountIn of coinIn for at least minOut of coinOut through one pool (one side must be grin). For X→Y via grin use SwapRoute.
1func SwapRoute(cur realm, coinIn string, coinOut string, amountIn uint64, minOut uint64, maxFills int, deadline int64) uint64SwapRoute swaps up to amountIn of coinIn for at least minOut of coinOut, using the order book (direct pair) while it beats the pools and the grin pools for the rest. Coins not needed are never debited.
SweepExpiredOrders closes up to maxScanPerTx expired orders of one book side, refunding each maker. Anyone may call it (also while paused).
Transfer sends coins to another player. It is a player's own money, so the admin can't stop it: it works while the game is paused and for banned addresses (bans only stop earning). It needs a finalized migration (MigrateBatch SETs balances). There is no receive cap: any coin can be sent to any player, whatever tools they own.
TransferAdmin hands the admin role to another address.
TreasuryBalance returns the ugnot held by this realm (pass revenue not yet withdrawn).
UpdateConfig is kept for game27/28 API compatibility (= TransferAdmin).
VoucherMessage builds the canonical message that the server signs and the realm verifies. Format: gnomoji-voucher-v2|chainId|kind|player|nonce|expiry|compactPayload
v2 changes from v1: realmPkgPath removed; payload is now compact (not raw JSON). For kind="claim": compactPayload = coinId:amount pairs sorted by coinId, comma-joined.
1e.g. [["grin","100"],["joy","50"]] → "grin:100,joy:50"
For kind="ach": compactPayload = achievement IDs sorted, comma-joined.
1e.g. ["blocks_1","g.grin.10"] → "blocks_1,g.grin.10"
WithdrawFunds sends GNOT the admin is OWED — Gnome Pass revenue not yet withdrawn — to `to`. It can never touch other ugnot the realm holds (donations, anything a future feature would hold for players).
WithdrawProtocolFees moves the admin's OWN accrued fees for `coin` into the admin's balance. It reads only adminFees (never reserves, escrow, the casino pool or anyone's balance) and works while paused.
WithdrawableFunds = pass revenue the admin may still withdraw (ugnot).