callerOf
func(int, rlm .uverse.realm) .uverse.address- OID
- 051142…d347:3
callerOf details
assertOwner
func(int, rlm .uverse.realm) .uverse.address- OID
- 051142…d347:5
assertOwner details
assertAdmin
func(int, rlm .uverse.realm) .uverse.address- OID
- 051142…d347:6
assertAdmin details
assertReferee
func(int, rlm .uverse.realm) .uverse.address- OID
- 051142…d347:7
assertReferee details
TransferOwnership
func(newOwner .uverse.address)TransferOwnership hands the realm over to newOwner. Owner only. The previous owner keeps no privilege, unless it was also added to the admin or referee lists.
- OID
- 051142…d347:8
TransferOwnership details
AddAdmin
func(addr .uverse.address)AddAdmin adds addr to the admin list. Owner only.
- OID
- 051142…d347:9
AddAdmin details
RemoveAdmin
func(addr .uverse.address)RemoveAdmin removes addr from the admin list. Owner only. The owner is an admin by definition and cannot be demoted this way, use TransferOwnership.
- OID
- 051142…d347:10
RemoveAdmin details
SetTreasury
func(addr .uverse.address)SetTreasury sets the address the sales of skins and planes are forwarded to. Owner only.
- OID
- 051142…d347:11
SetTreasury details
AddReferee
func(addr .uverse.address)AddReferee allows addr to submit kills. Admin only.
- OID
- 051142…d347:12
AddReferee details
RemoveReferee
func(addr .uverse.address)RemoveReferee stops addr from submitting kills. Admin only.
- OID
- 051142…d347:13
RemoveReferee details
Owner
func() .uverse.address- OID
- 051142…d347:14
Owner details
Treasury
func() .uverse.address- OID
- 051142…d347:15
Treasury details
IsAdmin
func(addr .uverse.address) boolIsAdmin reports whether addr is an admin. The owner always is.
- OID
- 051142…d347:16
IsAdmin details
IsReferee
func(addr .uverse.address) boolIsReferee reports whether addr may submit kills.
- OID
- 051142…d347:17
IsReferee details
errSpoofedRealm
*errors.errorString- OID
- 051142…d347:19
errSpoofedRealm details
errNotOwner
*errors.errorString- OID
- 051142…d347:22
errNotOwner details
errNotAdmin
*errors.errorString- OID
- 051142…d347:25
errNotAdmin details
errNotReferee
*errors.errorString- OID
- 051142…d347:28
errNotReferee details
errInvalidAddress
*errors.errorString- OID
- 051142…d347:31
errInvalidAddress details
errAlreadyAdmin
*errors.errorString- OID
- 051142…d347:34
errAlreadyAdmin details
errNoSuchAdmin
*errors.errorString- OID
- 051142…d347:37
errNoSuchAdmin details
errAlreadyReferee
*errors.errorString- OID
- 051142…d347:40
errAlreadyReferee details
errNoSuchReferee
*errors.errorString- OID
- 051142…d347:43
errNoSuchReferee details
errTreasurySelf
*errors.errorString- OID
- 051142…d347:46
errTreasurySelf details
errUnknownParam
*errors.errorString- OID
- 051142…d347:49
errUnknownParam details
errInvalidBounds
*errors.errorString- OID
- 051142…d347:52
errInvalidBounds details
errValueOutOfBounds
*errors.errorString- OID
- 051142…d347:55
errValueOutOfBounds details
errLeaderboardMin
*errors.errorString- OID
- 051142…d347:58
errLeaderboardMin details
owner
*v0.Ownable// the single owner, always an admin
- OID
- 051142…d347:121
owner details
admins
v0.BPTree// extra admins, managed by the owner: address -> nil
- OID
- 051142…d347:123
admins details
referees
v0.BPTree// game servers allowed to submit kills: address -> nil
- OID
- 051142…d347:124
referees details
treasury
.uverse.address// where the sales of the skins and planes realms go
Value
<gnolang.StringValue>
version
int64// bumps on every admin write, see Version
Value
2
params
[]*v0.param// fixed registry, in display order
- OID
- 051142…d347:130
params details
pilots
v0.BPTree// player address -> int64 kills, allocated at the first kill
- OID
- 051142…d347:167
pilots details
killers
v0.ranking// the top players by kills recorded on-chain, see rankings.gno
- OID
- 051142…d347:353
killers details
webPath
string// "/r/g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd/gnofly/game/v0", used to build links in Render
Value
"/r/g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd/gnofly/game/v0"
init.37
func()- OID
- 051142…d347:73
init.37 details
bootstrap
func(deployer .uverse.address, pkgPath string)bootstrap (re)creates the initial state: roles and params.
- OID
- 051142…d347:75
bootstrap details
Version
func() int64Version returns a counter that bumps on every admin write: params, treasury and roles. Referee actions (kills) do not bump it. A reader that cached StateJSON only has to read it again when Version changed.
- OID
- 051142…d347:76
Version details
bump
func()bump marks the admin-tunable state as changed.
- OID
- 051142…d347:77
bump details
webPathOf
func(pkgPath string) stringwebPathOf turns "gno.land/r/g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd/gnofly/game/v0" into "/r/g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd/gnofly/game/v0".
- OID
- 051142…d347:78
webPathOf details
itoa
func(n int64) string- OID
- 051142…d347:79
itoa details
StateJSON
func() stringStateJSON returns everything the game needs from the chain, as one JSON object: { "version": 12, "treasury": "g1...", "params": { "plane_speed": 70, "boost_speed": 130 } } The output has no whitespace. It only changes when Version does. The skins are in their own realm, gnofly/nfts/skins.
- OID
- 051142…d347:80
StateJSON details
PlayerJSON
func(addr .uverse.address) stringPlayerJSON returns one player as a JSON object: { "address": "g1...", "kills": 17 } The output has no whitespace. An unknown address has zero kills. The skins and planes a player owns are read from their realms (SkinsOf, PlanesOf).
- OID
- 051142…d347:82
PlayerJSON details
KillLeaderboardJSON
func() stringKillLeaderboardJSON returns the top players by kills recorded on-chain as a JSON array, best first, at most leaderboard\_size entries: [ { "address": "g1...", "kills": 17 } ] The output has no whitespace. With equal kills, the player who got there first stays ahead.
- OID
- 051142…d347:83
KillLeaderboardJSON details
quote
func(s string) stringquote returns s as a JSON string literal, quotes included. It is for the strings the realm did not validate. Quotes and backslashes are escaped and anything outside printable ASCII is replaced by "?", so the result is valid JSON whatever s holds.
- OID
- 051142…d347:84
quote details
maxKillEntries
untyped bigint// players per SubmitKills call
Value
(32 <untyped> bigint)
maxKillCount
untyped bigint// kills per player per call
Value
(1000 <untyped> bigint)
maxKillsLen
untyped bigintValue
(2048 <untyped> bigint)
errKillsFormat
*errors.errorString- OID
- 051142…d347:86
errKillsFormat details
SubmitKills
func(kills string)SubmitKills adds kills to players' on-chain counts. Referee only. kills is 1 to 32 entries "address:count" separated by ";", for example g1abc...:3;g1def...:1 Each address must be valid and listed once, each count from 1 to 1000. Anything else aborts the transaction and nothing is recorded. The counts are added to what the players already have, and the kill leaderboard is updated. Kills are player actions: Version does not move.
- OID
- 051142…d347:88
SubmitKills details
parseKills
func(s string) ([].uverse.address, []int64, .uverse.error)- OID
- 051142…d347:90
parseKills details
killsEntryError
func(index int, reason string) .uverse.error- OID
- 051142…d347:91
killsEntryError details
param
typeparam is one tunable number of the game, with the bounds an admin has to stay within.
Value
v0.param
paramLeaderboardSize
untyped stringparamLeaderboardSize is the one param the realm itself consumes. Every other param is only stored here and applied by the game server.
Value
"leaderboard_size"
defaultParams
func() []*v0.paramdefaultParams returns the registry with its default values. The order is the display order, in StateJSON as well as in Render.
- OID
- 051142…d347:92
defaultParams details
findParam
func(key string) *v0.paramfindParam returns the param registered under key, or nil. The registry is a dozen entries, a linear scan is cheaper than any index.
- OID
- 051142…d347:94
findParam details
SetParam
func(key string, value int64)SetParam changes a game parameter. Admin only. The key must exist and the value must be within the bounds of that key, see Render("params"). Lowering leaderboard\_size truncates the kill leaderboard right away. Raising it does not bring back the lines that were dropped: the list fills up again as kills come in.
- OID
- 051142…d347:95
SetParam details
SetParamBounds
func(key string, min int64, max int64)SetParamBounds changes the range SetParam accepts for a key. Owner only. The bounds are the guard rail between the owner and the admins: admins tune values within them, the owner decides how far tuning may go. The current value has to fit the new bounds, so that the registry never holds a value SetParam would refuse.
- OID
- 051142…d347:96
SetParamBounds details
Param
func(key string) int64Param returns the value of a game parameter. It panics on an unknown key.
- OID
- 051142…d347:97
Param details
indexFrom
func(s string, i int, c uint8) intindexFrom returns the index of the first c in s at or after i, or len(s) when there is none.
- OID
- 051142…d347:98
indexFrom details
digits
func(s string) (int64, bool)digits parses a non-empty string of decimal digits. Kill counts are never negative, so there is no sign to read.
- OID
- 051142…d347:100
digits details
recordedKills
func(addr .uverse.address) int64killsOf returns the kills recorded for addr.
- OID
- 051142…d347:101
recordedKills details
ranking
typeranking is a leaderboard on a single number that only goes up, the count of kills: the top players, best first, at most leaderboard\_size lines and one line per player. With equal scores, the player who got there first stays ahead. It is kept sorted at write time, so reading it never has to look at every player. Scores only going up is what makes that exact: a player outside the list can only enter it through raise. The two slices are parallel: slices of plain values are one stored object each, where a slice of structs would be one object per line. Measured on gnodev, a line costs about 190 bytes this way.
Value
v0.ranking
leaderboardSize
func() intleaderboardSize returns how many lines a leaderboard may hold.
- OID
- 051142…d347:103
leaderboardSize details
spliceAddrs
func(list [].uverse.address, from int, to int, v .uverse.address, size int) [].uverse.address- OID
- 051142…d347:105
spliceAddrs details
spliceInts
func(list []int64, from int, to int, v int64, size int) []int64spliceInts is spliceAddrs for a column of numbers.
- OID
- 051142…d347:106
spliceInts details
trimRankings
func()trimRankings cuts the kill leaderboard down to leaderboard\_size.
- OID
- 051142…d347:107
trimRankings details
writeRanking
func(b *strings.Builder, r v0.ranking, key string)writeRanking writes a ranking as a JSON array of {"address":"g1...","\<key>":\<score>} objects, best first.
- OID
- 051142…d347:108
writeRanking details
Render
func(path string) stringRender returns the state of the game as markdown, for gnoweb: "" overview "leaderboard" the top players by kills "params" the game parameters and their bounds "player/<addr>" one player Everything printed here was validated against a narrow charset when it was written (see validate.gno), and the only caller-supplied value, the address of a player page, is printed only if it is a valid address. Nothing needs markdown escaping.
- OID
- 051142…d347:109
Render details
link
func(path string) stringlink returns the gnoweb URL of a Render path of this realm.
- OID
- 051142…d347:111
link details
renderHome
func() string- OID
- 051142…d347:112
renderHome details
renderLeaderboard
func() string- OID
- 051142…d347:113
renderLeaderboard details
pilotLink
func(addr .uverse.address) stringpilotLink returns a markdown link to the page of a player.
- OID
- 051142…d347:114
pilotLink details
renderParams
func() string- OID
- 051142…d347:115
renderParams details
renderPlayer
func(addr .uverse.address) string- OID
- 051142…d347:116
renderPlayer details
validAddress
func(addr .uverse.address) boolvalidAddress reports whether addr is a valid address in its canonical, lowercase form. Bech32 can also be written in all capitals, and address.IsValid accepts that. To this realm the capitals would be a second key for the same account: a second player record, a second line on a leaderboard, an admin who can never be matched to a caller. Bech32 does not allow mixing cases, so looking at the first character is enough.
- OID
- 051142…d347:117