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 source realm

Package leaderboard is an on-chain score leaderboard realm.

Readme View source

🏆 Leaderboard

⚠️ Experimental — generated with no human supervision. This realm was produced automatically by an MCP-driven agent to exercise the gno MCP server and tooling, and to generate test content for gno compilers, linters and formatters. Not audited. Not for production. Full context & folder README: r/moul/x/daily


An on-chain score leaderboard realm for gno.land (sapphire / gno 0.9). Any account can accumulate points with AddPoints(n) and optionally attach a display name with SetName(name). Render returns a Markdown table ranked by points descending — gold/silver/bronze medals for the top three — plus the total player count. State is kept in an avl.Tree so rendering is deterministic across nodes.

Realm path: gno.land/r/REPLACE_ADDR/leaderboard

Public API

Function Kind Description
AddPoints(cur realm, n int) crossing (tx) Add n (> 0) points to the caller's total.
SetName(cur realm, name string) crossing (tx) Set the caller's display name (≤ 32 bytes; empty clears it).
Render(path string) string view Ranked Markdown leaderboard.

Example calls

 1# Add 10 points to your total
 2gnokey maketx call \
 3  -pkgpath "gno.land/r/REPLACE_ADDR/leaderboard" \
 4  -func AddPoints -args 10 \
 5  -gas-fee 1000000ugnot -gas-wanted 2000000 \
 6  -broadcast -chainid sapphire-1 -remote <rpc> <keyname>
 7
 8# Set your display name
 9gnokey maketx call \
10  -pkgpath "gno.land/r/REPLACE_ADDR/leaderboard" \
11  -func SetName -args "Alice" \
12  -gas-fee 1000000ugnot -gas-wanted 2000000 \
13  -broadcast -chainid sapphire-1 -remote <rpc> <keyname>

View the rendered leaderboard in gnoweb at /r/REPLACE_ADDR/leaderboard, or query it:

1gnokey query "vm/qrender" -data "gno.land/r/REPLACE_ADDR/leaderboard:" -remote <rpc>

Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

Dependency graph:

gno.land/r/moul/x/daily/leaderboard/v0 dependency graph

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.

Overview

Package leaderboard is an on-chain score leaderboard realm.

Any account can accumulate points via AddPoints and (optionally) attach a display name with SetName. Render produces a ranked Markdown table sorted by points descending, with medals for the top three players.

Functions 3

func AddPoints

crossing Action
1func AddPoints(cur realm, n int)
source

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.

func Render

1func Render(path string) string
source

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

func SetName

crossing Action
1func SetName(cur realm, name string)
source

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.

Imports 4

Source Files 3