Skip to content Search Apps Documentation Source Content 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.

game29 source realm

Functions 119

func ActivateGnomePass

crossing Action
1func ActivateGnomePass(cur realm, durationDays int64)
source

ActivateGnomePass buys durationDays (30..360, multiple of 30) of Gnome Pass. The tx must attach exactly passPrice × durationDays/30 ugnot (MsgCall send).

func AddLiquidity

crossing Action
1func AddLiquidity(cur realm, coin string, coinMax uint64, grinMax uint64, minShares uint64, deadline int64) uint64
source

AddLiquidity 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.

func AllMiners

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

AllMiners returns the leaderboard sorted by total mined (desc), paginated. (game28 returned it in address order.)

func BanAddress

crossing Action
1func BanAddress(cur realm, targetAddr string, reason string, durationSecs int64)
source

BanAddress bans a player address. durationSecs=0 means permanent.

func BatchClaimAchievements

crossing Action
1func BatchClaimAchievements(cur realm, idsJson string, nonce int64, expiry int64, sigHex string) int
source

BatchClaimAchievements claims several ids (already-claimed / not-earned ids are skipped). idsJson must be exactly the voucher payload.

func BookDepth

Action
1func BookDepth(pay string, get string, limit int, offset int) string
source

BookDepth lists asks for a taker who pays `pay` and gets `get`, best price first (≤ 50 rows; offset < maxSideOrders).

func CancelOrder

crossing Action
1func CancelOrder(cur realm, id uint64)
source

CancelOrder: the maker gets the remaining escrow back. Works while paused and for banned makers; only the maker can cancel.

func CancelPvpLobby

crossing Action
1func CancelPvpLobby(cur realm, lobbyId string)
source

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.

func CasinoBet

Action
1func CasinoBet(roundId string, addr string) string
source

CasinoBet returns one player's bet and its on-chain result.

func CasinoJackpots

Action
1func CasinoJackpots(coinId string) string
source

CasinoJackpots reports the real MAJOR / GRAND pools and how they pay.

func CasinoOutcome

Action
1func CasinoOutcome(game string, roll uint64) string
source

CasinoOutcome maps a roll to what landed. For rps the outcome is "win" | "push" | "lose" (see rpsHouseMove for the move shown).

func CasinoPool

Action
1func CasinoPool(coinId string) string
source

CasinoPool reports a coin's pool, reservation, max bets and daily counters.

func CasinoRoll

Action
1func CasinoRoll(serverSeed, clientSecret, roundId, game string) uint64
source

CasinoRoll is the on-chain roll: uint32(sha256(s:c:roundId:game)[0:4]) % 100.

func CasinoStats

Action
1func CasinoStats(coinId string) string
source

CasinoStats reports a coin's accounting: pool, reserved, jackpots, seeded, staked, paid, the conservation check and per-game rounds/staked/paid.

func ClaimAchievement

crossing Action
1func ClaimAchievement(cur realm, achievementId string, nonce int64, expiry int64, sigHex string)
source

ClaimAchievement claims one allowlisted achievement and credits its fixed reward. Needs a server voucher of kind "ach" with payload = `["<id>"]`.

func ClaimAllowance

Action
1func ClaimAllowance(playerAddr string) string
source

ClaimAllowance returns the current per-rarity allowance for addr.

func ClaimAndMint

crossing Action
1func ClaimAndMint(cur realm, coinsJson string, nonce int64, expiry int64, sigHex string) string
source

ClaimAndMint 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).

func ClaimMine

crossing Action
1func ClaimMine(cur realm, coinsJson string)
source

ClaimMine (game27/28 two-step flow) is retired: pending mints are gone.

func ClaimPvpTimeout

crossing Action
1func ClaimPvpTimeout(cur realm, lobbyId string)
source

ClaimPvpTimeout resolves a stuck match after pvpTimeoutSec without action:

  • only one player committed → that player wins;
  • both committed, only one revealed → the revealer wins;
  • otherwise → both refunded.

Any lobby member may call it. Escrow can never stay locked.

func CommitCasinoSeed

crossing Action
1func CommitCasinoSeed(cur realm, roundId string, player string, seedHash string)
source

CommitCasinoSeed opens a round for one player with sha256(s). Operator only; a round id can be used once.

func CommitPvpMove

crossing Action
1func CommitPvpMove(cur realm, lobbyId string, moveHash string)
source

CommitPvpMove stores sha256(choice+":"+salt) for the caller. Members only, once per player per lobby, only while the lobby is joined.

func CreatePool

crossing Action
1func CreatePool(cur realm, coin string)
source

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.

func CreatePvpLobby

crossing Action
1func CreatePvpLobby(cur realm, game string, coinId string, betAmount string) string
source

CreatePvpLobby escrows the creator's wager and opens a lobby.

func CreateTask

crossing Action
1func CreateTask(cur realm, taskId string, desc string)
source

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.

func ExpireLobbies

crossing Action
1func ExpireLobbies(cur realm)
source

ExpireLobbies is a no-op kept for API compatibility (timeouts are per lobby).

func FillOrders

crossing Action
1func FillOrders(cur realm, pay string, get string, payAmt uint64, minGet uint64, maxFills int, deadline int64) uint64
source

FillOrders: 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.

func ForfeitCasinoBet

crossing Action
1func ForfeitCasinoBet(cur realm, roundId string)
source

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.

func FreeSpinGrant

Action
1func FreeSpinGrant(addr string) string
source

FreeSpinGrant reports a player's open free spins (null when none).

func JackpotPool

Action
1func JackpotPool(coinId string) string
source

JackpotPool reports the GRAND jackpot pool (the casino bankroll is CasinoPool).

func LastNonce

Action
1func LastNonce(addr string) int64
source

LastNonce returns the last voucher nonce used by addr (0 if none).

func LpPosition

Action
1func LpPosition(coin string, addr string) string
source

LpPosition shows one position and what it would withdraw right now.

func LpPositions

Action
1func LpPositions(addr string, limit int, offset int) string
source

LpPositions lists an address's positions (bounded: at most one per pool, paginated by pool order, ≤ 50 pools scanned per call).

func MigrateBatch

crossing Action
1func MigrateBatch(cur realm, batchId string, kind string, rowsJson string) int
source

── Migration (game27 / game28 → game29) ────────────────────────────────────

MigrateBatch(batchId, kind, rowsJson) imports one batch. rowsJson is a JSON array of string arrays. Kinds and row shapes:

Example
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.

func Order

Action
1func Order(maker string, id uint64) string
source

Order shows one open order of `maker` (lookups are per maker by design).

func OrdersOf

Action
1func OrdersOf(addr string) string
source

OrdersOf lists an address's open orders (≤ 20 by construction).

func PendingMints

Action
1func PendingMints(playerAddr string) string
source

PendingMints is kept for client compatibility; game29 has no pending step.

func PlaceCasinoBet

crossing Action
1func PlaceCasinoBet(cur realm, roundId string, game string, coinId string, betAmount string, choice string, clientHash string)
source

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.

func PlaceCasinoFreeSpin

crossing Action
1func PlaceCasinoFreeSpin(cur realm, roundId string, clientHash string)
source

PlaceCasinoFreeSpin uses one free spin of the caller's grant in a committed round (no stake). One free spin in flight at a time.

func PlaceOrder

crossing Action
1func PlaceOrder(cur realm, give string, giveAmt uint64, want string, wantAmt uint64, expirySecs int64) uint64
source

PlaceOrder 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.

func PlayerXp

Action
1func PlayerXp(playerAddr string) string
source

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.

func Pools

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

Pools lists pools in coin order (paginated, ≤ 50 per call).

func QuoteFill

Action
1func QuoteFill(caller string, pay string, get string, payAmt uint64, maxFills int) string
source

QuoteFill previews FillOrders for a budget (fee included): {"spent","got"}.

func QuoteRoute

Action
1func QuoteRoute(caller string, coinIn string, coinOut string, amountIn uint64, maxFills int) string
source

QuoteRoute previews SwapRoute: how much goes to the book vs the pools and the expected output (fees included).

func QuoteSwap

Action
1func QuoteSwap(coinIn string, coinOut string, amountIn uint64) string
source

QuoteSwap quotes a single-pool swap; "0" if the pool can't take it.

func RefundCasinoBet

crossing Action
1func RefundCasinoBet(cur realm, roundId string)
source

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.

func RegisterVein

crossing Action
1func RegisterVein(cur realm, coinId string, maxSupply string)
source

RegisterVein is the game28 name for SetVeinMax.

func RemoveLiquidity

crossing Action
1func RemoveLiquidity(cur realm, coin string, shares uint64, minCoin uint64, minGrin uint64, deadline int64) (uint64, uint64)
source

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.

func RevealCasinoSecret

crossing Action
1func RevealCasinoSecret(cur realm, roundId string, clientSecret string)
source

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.

func RevealCasinoSeed

crossing Action
1func RevealCasinoSeed(cur realm, roundId string, serverSeed string)
source

RevealCasinoSeed publishes s (it must hash to the commit). It settles nothing: the bet settles when the player's secret is revealed.

func RevealPvpMove

crossing Action
1func RevealPvpMove(cur realm, lobbyId string, choice string, salt string)
source

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.

func Rewarded

Action
1func Rewarded(playerAddr string) string
source

Rewarded returns what rewards (medals etc.) credited, per coin. Separate from LifetimeMined.

func SeedCasinoJackpot

crossing Action
1func SeedCasinoJackpot(cur realm, coinId, tier, amount string)
source

SeedCasinoJackpot adds the ADMIN'S OWN coins to a jackpot pool (never withdrawable).

func SeedCasinoPool

crossing Action
1func SeedCasinoPool(cur realm, coinId string, amount string)
source

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.

func SetCasinoJackpotRefBet

crossing Action
1func SetCasinoJackpotRefBet(cur realm, coinId, amount string)
source

SetCasinoJackpotRefBet sets the bet that wins a full jackpot (smaller bets win the same share of the pool as their share of this bet).

func SetCasinoJackpotSeed

crossing Action
1func SetCasinoJackpotSeed(cur realm, coinId, tier, amount string)
source

SetCasinoJackpotSeed sets the level a jackpot is topped back up to after a hit.

func SetClaimSigner

crossing Action
1func SetClaimSigner(cur realm, pubKeyHex string)
source

SetClaimSigner registers the ed25519 public key (64 hex chars) of the server's claim signer. Pass "" to disable all vouchered calls (kill switch).

func SetExchangePaused

crossing Action
1func SetExchangePaused(cur realm, p bool)
source

SetExchangePaused stops NEW swaps, deposits, orders and fills. It can't stop RemoveLiquidity, CancelOrder, SweepExpiredOrders or fee withdrawals.

func SetOperator

crossing Action
1func SetOperator(cur realm, addr string)
source

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.

func SetPassPrice

crossing Action
1func SetPassPrice(cur realm, ugnotPer30Days int64)
source

SetPassPrice sets the ugnot price per 30-day period.

func SetPoolPaused

crossing Action
1func SetPoolPaused(cur realm, coin string, p bool)
source

SetPoolPaused stops new swaps and deposits on one pool. Withdrawals stay open.

func SetVeinMax

crossing Action
1func SetVeinMax(cur realm, coinId string, maxSupply string)
source

SetVeinMax overrides a coin's vein size. It can't go below what was minted.

func SwapExactIn

crossing Action
1func SwapExactIn(cur realm, coinIn string, coinOut string, amountIn uint64, minOut uint64, deadline int64) uint64
source

SwapExactIn 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.

func SwapRoute

crossing Action
1func SwapRoute(cur realm, coinIn string, coinOut string, amountIn uint64, minOut uint64, maxFills int, deadline int64) uint64
source

SwapRoute 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.

func SweepExpiredOrders

crossing Action
1func SweepExpiredOrders(cur realm, pay string, get string) int
source

SweepExpiredOrders closes up to maxScanPerTx expired orders of one book side, refunding each maker. Anyone may call it (also while paused).

func Transfer

crossing Action
1func Transfer(cur realm, coinId string, toAddr string, amountStr string)
source

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.

func TransferAdmin

crossing Action
1func TransferAdmin(cur realm, newAdmin string)
source

TransferAdmin hands the admin role to another address.

func TreasuryBalance

Action
1func TreasuryBalance() int64
source

TreasuryBalance returns the ugnot held by this realm (pass revenue not yet withdrawn).

func UpdateConfig

crossing Action
1func UpdateConfig(cur realm, newAdmin string)
source

UpdateConfig is kept for game27/28 API compatibility (= TransferAdmin).

func VoucherMessage

Action
1func VoucherMessage(kind, player string, nonce, expiry int64, payload string) string
source

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.

Example
1e.g. [["grin","100"],["joy","50"]] → "grin:100,joy:50"

For kind="ach": compactPayload = achievement IDs sorted, comma-joined.

Example
1e.g. ["blocks_1","g.grin.10"] → "blocks_1,g.grin.10"

func WithdrawFunds

crossing Action
1func WithdrawFunds(cur realm, to string, amountUgnot int64)
source

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).

func WithdrawProtocolFees

crossing Action
1func WithdrawProtocolFees(cur realm, coin string) uint64
source

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.

Dependencies

Source Files 20