Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

game/v0 package

Overview

v0 - Unaudited: This is an initial version that has not yet been formally audited. Use in production at your own risk.

Package game is the on-chain part of gnofly, a multiplayer plane game. It is the source of truth for everything an admin can tune: the game parameters, the roles and the treasury. It also keeps what the referee attests and what has lasting value: the kills, on the kill leaderboard. Skins and planes are tokens of their own realms, gnofly/nfts/skins and gnofly/nfts/planes, which ask this one who the admins are and where the treasury is.

Three kinds of callers write to it:

  • the owner and the admins tune the game (SetParam, ...). Every such write bumps Version, which is how the game server knows it has to read StateJSON again;
  • referees, the game servers, record kills (SubmitKills).

Challenge runs never reach the chain: the game server defines the challenges, scores the runs and keeps the session boards.

Reads are plain functions meant for vm/qeval. The ones ending in JSON return a single string holding a JSON document. Render exposes the same data as markdown for gnoweb.

Function

AddReferee

func AddReferee(cur realm, addr address)

AddReferee allows addr to submit kills. Admin only.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd/gnofly/game/v0" -func "AddReferee" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd/gnofly/game/v0" -func "AddReferee" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx