Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

hall source realm

Package hall is the scoreboard of Cellar, a capture-the-flag wargame played on gno.land.

Overview

Package hall is the scoreboard of Cellar, a capture-the-flag wargame played on gno.land.

Challenge realms enlist themselves here from their init. Players break a challenge in its own realm, then Claim it here: the hall asks the challenge whether the player captured it, records the solve, awards a badge and updates the standings. Points follow the dynamic curve in package flag, so a challenge is worth less as more players solve it.

Everything a player sees is in Render, so gnoweb is a complete client.

Constants 1

const Pending, Listed, Retired

1const (
2	Pending Status = iota // enlisted by a community realm, awaiting review
3	Listed                // open for claims
4	Retired               // closed for claims; past solves still score
5)
source

Challenge statuses.

Variables 1

var ErrNotCurator, ErrBadAddress, ErrNotRealm, ErrNilChallenge, ErrAlreadyEnlisted, ErrSlugTaken, ErrUnknownChallenge, ErrNotListed, ErrNotPending, ErrAlreadyClaimed, ErrNotCaptured, ErrNotUser, ErrBadHandle, ErrHandleTaken, ErrBadSeasonName

 1var (
 2	ErrNotCurator       = errors.New("hall: only the curator may do this")
 3	ErrBadAddress       = errors.New("hall: invalid address")
 4	ErrNotRealm         = errors.New("hall: a challenge must enlist itself from its own realm")
 5	ErrNilChallenge     = errors.New("hall: nil challenge")
 6	ErrAlreadyEnlisted  = errors.New("hall: this realm already enlisted a challenge")
 7	ErrSlugTaken        = errors.New("hall: slug already taken")
 8	ErrUnknownChallenge = errors.New("hall: no such challenge")
 9	ErrNotListed        = errors.New("hall: challenge is not open for claims")
10	ErrNotPending       = errors.New("hall: challenge is not awaiting review")
11	ErrAlreadyClaimed   = errors.New("hall: you already claimed this challenge")
12	ErrNotCaptured      = errors.New("hall: the cellar has no record of your capture; break the challenge first")
13	ErrNotUser          = errors.New("hall: handles belong to people; call SetHandle directly from your wallet")
14	ErrBadHandle        = errors.New("hall: a handle is 3-20 chars of [a-z0-9_], starting with a letter")
15	ErrHandleTaken      = errors.New("hall: handle already taken")
16	ErrBadSeasonName    = errors.New("hall: a season name is 1-40 printable characters")
17)
source

Errors returned (as panics) by the hall's public functions.

Functions 11

func Approve

crossing Action
1func Approve(cur realm, slug string)
source

Approve opens a pending community challenge for claims.

func BadgeURI

Action
1func BadgeURI(tid string) string
source

BadgeURI returns the artwork URI of badge tid, or "" if it was never minted.

func Badges

Action
1func Badges() grc721.Teller
source

Badges returns a read-only view of the badge collection (GRC721). Badges cannot be transferred: the hall exposes no transfer.

Token ids:

Example
1solve:<slug>:<address>  broke a challenge
2blood:<slug>            broke it first (replaces the solve badge)
3season:<n>:<rank>       finished a season on the podium

func Claim

crossing Action
1func Claim(cur realm, slug string) int
source

Claim records that the caller broke the challenge slug and returns the points it is now worth. The challenge realm is asked whether the player captured it; the hall never takes the player's word for it.

Call it from your wallet, or from your solution realm right after the exploit: a realm at gno.land/r/<your-address>/... is credited to you.

func DisplayName

Action
1func DisplayName(addr address) string
source

DisplayName returns the hall handle of addr, else its gno.land username, else a shortened address.

func Enlist

crossing Action
1func Enlist(cur realm, ch flag.Challenge)
source

Enlist registers the challenge ch for the realm that calls it. Call it from your challenge realm's init:

Example
1func init(cur realm) { hall.Enlist(cross(cur), challenge{}) }

Official challenges are listed at once; community ones wait for review.

func OpenSeason

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

OpenSeason closes the current season, decorates its podium with season badges, and opens the next one under name.

func Render

1func Render(path string) string
source

Render serves the hall's pages to gnoweb, and JSON under api/ for the Cellar web client.

func Retire

crossing Action
1func Retire(cur realm, slug string)
source

Retire closes a challenge for new claims. Existing solves keep scoring.

func SetHandle

crossing Action
1func SetHandle(cur realm, handle string)
source

SetHandle sets the caller's display name in the hall. Handles are unique; setting a new one releases the old one.

func TransferCuration

crossing Action
1func TransferCuration(cur realm, to address)
source

TransferCuration hands the curator role to another address.

Types 3

type Solve

struct
1type Solve struct {
2	Player     address
3	Slug       string
4	Height     int64
5	Season     int
6	FirstBlood bool
7}
source

Solve is one claimed capture.

type Standing

struct
1type Standing struct {
2	Player address
3	Points int
4	Solves int
5	Last   int64 // height of the latest counted solve, for tie-breaks
6}
source

Standing is a row of a leaderboard.

type Status

ident
1type Status int
source

Status is where a challenge stands in the hall.

Methods on Status

func String

method on Status
1func (s Status) String() string
source

String returns the human name of s.

Dependencies

Source Files 12