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.

rack source realm

Package rack is a Cellar challenge about who may write an object, and why a read-only view of a /p/ type is not read-...

Overview

Package rack is a Cellar challenge about who may write an object, and why a read-only view of a /p/ type is not read-only.

Constants 1

const Prize

1const Prize = "1811 Château d'Yquem"
source

Prize is the bottle nobody has ever been promised.

Variables 1

var Ledger

1var Ledger = &Rack{
2	Keeper:   address("g15c02s5hhdny9uvr9za3xsyn9sw8p0klptrh6kf"),
3	Reserved: avl.NewTree(),
4}
source

Ledger is posted on the door for every realm to read. Other realms can import it but cannot change it: Gno makes their view of it read-only.

Functions 4

func Collect

crossing Action
1func Collect(cur realm)
source

Collect hands over the bottle reserved in your name. If it is the Prize, the flag is yours.

func Render

1func Render(_ string) string
source

Render shows the rack.

func Reserve

crossing Action
1func Reserve(cur realm, guest address, bottle string)
source

Reserve sets a bottle aside for guest. Only the keeper reserves, and the keeper never reserves the Prize.

Types 1

type Rack

struct
1type Rack struct {
2	Keeper   address
3	Reserved *avl.Tree // guest address -> bottle
4}
source

Rack is the reserve rack: which bottle is set aside for which guest.

Dependencies

Source Files 6