const Admin
Admin may accept, roll back or freeze an implementation. The value is the standard test1 account so the tests run unedited; set your own address before deploying (TransferAuthority moves it afterwards).
Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.
Package shots is a pay-to-play penalty shootout against the chain.
Package shots is a pay-to-play penalty shootout against the chain.
A creator opens a game by choosing its keeper and ball constants and seeding the pot. A challenger joins an open game by paying its entry fee into the pot, then plays a shootout: in every round they take a kick (TakeShot) and then keep against the chain's kick (SubmitKeeperPlan). Five kicks each, finishing early when one side cannot be caught, then sudden death. Win, and the whole pot is paid out; lose, and the entry fee stays in the pot for the next challenger.
Every kick is played out in the transaction that makes it: the player's choices are completed by 32 bytes derived from the block's timestamp (the chain's move and the mishit), and the outcome is penalty.SimulateShot of the ten inputs, recorded so anyone can re-run it. See impl/v1 for what that entropy does and does not guarantee.
This realm's path and entry points are permanent. The rules engine is an implementation realm behind an upgradeable proxy (gno.land/p/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/upgradeable/v0); the games and their pots live here and survive every upgrade.
Accept makes the candidate at pkgPath live. Authority only.
AddExtension lets another realm act as this one. Authority only.
CancelGame refunds the pot to the creator of a game nobody has played yet.
CreateGame opens a game. Send the initial pot with the call (ugnot). config overrides the default constants as "key=value,..." ("" for the defaults; see penalty.ParseConfig). timeoutBlocks 0 picks the default. Returns the game id.
DropExtension revokes one. Authority only.
Forfeit ends the current shootout as a loss: the player may resign at any time, anyone else once the player has been idle for the game's timeout.
Forget drops the rollback history. Authority only.
Freeze ends upgradeability permanently. Authority only.
GameCount returns how many games have been created.
GameJSON returns game id as JSON ("" if it does not exist).
JoinGame starts a shootout in an open game. Send exactly its entry fee.
ListGames returns up to limit games as a JSON array, newest first, optionally filtered by status ("open", "playing", "won", "cancelled"; "" for all).
Register records the calling realm as a candidate implementation; an implementation calls it from its own init. Nothing serves until Accept.
Render shows the games list, one game ("game/<id>") or one shootout ("game/<id>/<session>").
Rollback restores the previous implementation. Authority only.
SessionJSON returns session no of a game, kicks included, as JSON.
SimulateShot runs the live outcome function on ten inputs, without touching any state: the taker's aim, contact, power and 48-hex-char mishit seed, and the keeper's four uint16, under config ("" for the defaults). Returns JSON.
1func SubmitKeeperPlan(cur realm, gameID uint64, direction, speed, jump, reaction uint16) stringSubmitKeeperPlan plays the player's keeper plan against the chain's kick for the current round: four uint16 (see penalty.DecodePlan). Returns the kick as JSON.
TakeShot plays the player's kick for the current round against the chain's keeper: aim point on the goal plane (mm), contact offset on the ball (milli-radii) and power (per-mille). Returns the kick as JSON.
TopUp adds the coins sent to a game's pot.
TransferAuthority hands the power to upgrade to another address.
TransferAuthorityToRealms hands it to governance realms (comma-separated).
VerifySession re-runs every recorded kick of a shootout through the live outcome function and reports whether all of them reproduce, so anyone can check a result from the ten recorded inputs alone.
Withdraw drops a candidate. Authority only, or the candidate itself.
Store hands a StateRef to the live implementation, or to a registered extension. Any other realm presents its own cur and is refused.
1type Impl interface {
2 CreateGame(_ int, rlm realm, creator address, deposit, entryFee, timeoutBlocks int64, config string) uint64
3 JoinGame(_ int, rlm realm, player address, gameID uint64, paid int64)
4 TopUp(_ int, rlm realm, from address, gameID uint64, paid int64)
5 TakeShot(_ int, rlm realm, player address, gameID uint64, shot penalty.ShotInput) shootout.Kick
6 SubmitKeeperPlan(_ int, rlm realm, player address, gameID uint64, plan penalty.KeeperPlan) shootout.Kick
7 Forfeit(_ int, rlm realm, caller address, gameID uint64)
8 CancelGame(_ int, rlm realm, caller address, gameID uint64)
9
10 // SimulateShot is the pure outcome function: six taker inputs (in shot,
11 // mishit seed included) and four keeper inputs, under cfg.
12 SimulateShot(shot penalty.ShotParams, plan penalty.KeeperPlan, cfg penalty.Config) penalty.Result
13
14 // Describe names the implementation for Render.
15 Describe() string
16}Impl is the rules engine. Declared here so every version agrees on one type identity. The methods are non-crossing: this realm threads its own cur in, so an implementation reaching Store is seen as this realm.
The caller's address and the coins received are established by the entry points below and passed in; an implementation cannot be invoked with forged ones from elsewhere, because without this realm's live cur it cannot reach the state at all.
StateRef is a permission to read and write the game state, handed to code running on this realm's cur. It carries the caller's realm value and re-checks it on every operation, so it cannot be stashed (the VM refuses to persist a realm value) or replayed after its frame returns.
Game returns a copy of game id.
NewGameID allocates the next game id.
Pay sends amount ugnot from this realm's balance to to.
PutGame stores g (by value) under g.ID.
PutSession stores s (by value, kicks copied).
Session returns a copy of session no of game id, kicks included.