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

v0 state

Back to all declarations

player

type

player holds the accumulated state for a single address.

Value

v0.player

players

v0.Tree

players maps address string -> \*player. An avl.Tree gives deterministic iteration (unlike a Go map) so Render output is stable across nodes.

Open
OID
0bceed…8c54:4
players details

Inspect ref

get

func(addr .uverse.address) *v0.player

get returns the stored \*player for addr, creating one if absent.

Open
OID
0bceed…8c54:5
get details

Inspect func

AddPoints

func(n int)

AddPoints adds n points to the caller's total. n must be positive. Crossing function: MsgCall dispatches only to crossing functions, and the cur.IsCurrent() check authenticates the live call frame before we trust the caller identity derived from it.

Open
OID
0bceed…8c54:8
AddPoints details

Inspect func

SetName

func(name string)

SetName attaches a display name (max 32 bytes) to the caller. Passing an empty string clears the name and falls back to the address in Render.

Open
OID
0bceed…8c54:9
SetName details

Inspect func

byRank

type

byRank implements sort.Interface, ranking players by points descending with ties broken by address so the order is deterministic across nodes. The gno sort package exposes Sort/Stable over an Interface — there is no sort.Slice.

Value

v0.byRank

snapshot

func() []*v0.player

snapshot collects all players into a slice ranked by points descending.

Open
OID
0bceed…8c54:10
snapshot details

Inspect func

medal

func(rank int) string

medal returns the emoji for a given zero-based rank, or "" past the podium.

Open
OID
0bceed…8c54:11
medal details

Inspect func

Render

func(path string) string

Render produces the Markdown leaderboard. It is NOT a crossing function (read-only view, no cur realm parameter).

Open
OID
0bceed…8c54:12
Render details

Inspect func
player : type =v0.player
players : v0.Tree Inspect
get : func(addr .uverse.address) *v0.player Inspect
caller : func() .uverse.address Inspect
AddPoints : func(n int) Inspect
SetName : func(name string) Inspect
byRank : type =v0.byRank
snapshot : func() []*v0.player Inspect
medal : func(rank int) string Inspect
Render : func(path string) string Inspect