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.

v1 source realm

Package impl is the first rules engine for gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/shots.

Overview

Package impl is the first rules engine for gno.land/r/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/shots.

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

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.

Constants 1

Functions 1

func Instance

Action
1func Instance() shots.Impl
source

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

Dependencies

Source Files 2