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.

impl/v2 package

Overview

Package impl is the second rules engine for gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/shots: impl/v1's game, kicks and entropy unchanged, but a shootout that ends keeps only its summary on chain.

It owns the game state machine and pot rules; the state itself, and the coins, stay in the shots realm, reached through shots.Store.

SETTLING. Every kick is recorded in the session while it is played (its ten inputs, seed and result: about 3 KB, paid for by the player's storage deposit). When the shootout ends (won, lost or forfeited) the session is rewritten without its kicks, keeping player, entry fee, score, status and heights, and a won game keeps its pot (the prize it paid) and winner. The deposit for the bytes freed goes back to the account that made the final move: on the deciding kick, the player (on a chain whose ugnot is transfer-restricted, the storage fee collector instead). Each kick remains in the transaction that played it, as that call's return value and Kick event, so it can still be re-run from the chain's history; shots' VerifySession has nothing left to re-run for a settled shootout.

Game: open --join--> playing --player wins--> won (pot paid out, closed)

Example
1^                 |
2+----player loses-+ (entry fee stays in the pot)
3open --creator cancels, nobody played yet--> cancelled (pot refunded)

Session: each round the player shoots, then keeps. Every move is played out in the transaction that makes it, from 32 bytes derived from that block's timestamp (see entropy).

ENTROPY. The seed is SHA-256 of the block time (unix nanoseconds) and the kick's identity (game, session, kick number), so two kicks in one block still differ. The block time is not known when the player signs, but it is not secret either: the proposer chooses it within consensus bounds, and anything else running in the same transaction can read the result. In particular a transaction that makes a move and then, in a later message, reads the session and fails on a bad outcome reverts the whole kick, so a player can retry until they like the result (for the price of gas). Fine for play money; a commit-reveal or a VRF is needed before real stakes, and an upgraded implementation can switch without touching games or pots.

Function

Instance

func Instance() shots.Impl
Ask AI Claude ChatGPT

Instance returns the implementation, for a caller that registers it explicitly rather than relying on init.

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/shots/impl/v2.Instance()"

Result