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.

fairdrop state

Back to all declarations

RealmPath

untyped string

Value

"gno.land/r/g1k6cl2huxpps9fxls8tqyxknvl7fgq9hua3f2yt/fairdrop"

PackagePath

untyped string

Value

"gno.land/p/g1k6cl2huxpps9fxls8tqyxknvl7fgq9hua3f2yt/fairness"

PhaseOpen

untyped string

// entries are being sealed

Value

"open"

PhaseReveal

untyped string

// entries closed, secrets being revealed

Value

"reveal"

PhaseDrawable

untyped string

// reveal window over, waiting for Draw

Value

"drawable"

PhaseDrawn

untyped string

// winners recorded

Value

"drawn"

PhaseCancelled

untyped string

// voided by the organizer before entries closed

Value

"cancelled"

MaxSlots

untyped bigint

Value

(100 <untyped> bigint)

MaxWeightCap

untyped bigint

Value

(100 <untyped> bigint)

MinWindowSeconds

untyped bigint

Value

(30 <untyped> bigint)

MaxWindowSeconds

untyped bigint

Value

(2592000 <untyped> bigint)

MaxTitleLen

untyped bigint

Value

(80 <untyped> bigint)

MaxPrizeLen

untyped bigint

Value

(240 <untyped> bigint)

Event

type

Event is one draw.

Value

fairdrop.Event

nextID

uint64

Value

0

Create

func(title string, prize string, slots int, maxWeight int, regSeconds int, revealSeconds int) uint64

Create opens a draw and returns its id. The organizer pays nothing: FairDrop never holds funds, it only records the draw.

Open
OID
0d87f6…e18e:8
Create details

Inspect func

Vouch

func(eventID uint64, who string, weight int)

Vouch grants an address extra ticket weight before it seals its ticket. One ticket per address is the floor; a vouch is how an organizer recognises a member who should carry more weight (a role holder, an allowlisted guest). Weight cannot be granted after the address has sealed, because the sealed digest commits to the weight.

Open
OID
0d87f6…e18e:10
Vouch details

Inspect func

Register

func(eventID uint64, commit string, weight int)

Register seals a ticket: commit is the hex SHA-256 of the entrant's secret bound to their address, this event and their weight. Weight must be 1 unless the organizer vouched for more.

Open
OID
0d87f6…e18e:11
Register details

Inspect func

Reveal

func(eventID uint64, secret string)

Reveal opens a seal. It is accepted only inside the reveal window and only when the secret re-hashes to the seal already on chain.

Open
OID
0d87f6…e18e:12
Reveal details

Inspect func

Draw

func(eventID uint64)

Draw records the winners. It is permissionless on purpose: once the reveal window is over the result is already determined by public data, so anyone — entrant, organizer or passer-by — may pay the gas to write it down.

Open
OID
0d87f6…e18e:13
Draw details

Inspect func

Cancel

func(eventID uint64)

Cancel voids a draw before entries close. After close the entries are committed and only the draw can settle them.

Open
OID
0d87f6…e18e:14
Cancel details

Inspect func

EventCount

func() int

EventCount is the number of events ever opened.

Open
OID
0d87f6…e18e:15
EventCount details

Inspect func

Winner

type

Winner is one recorded winner, resolved from the roster at render time.

Value

fairdrop.Winner

Proof

func(id uint64) string

Proof returns the draw's verifiable inputs as a JSON object, so an off-chain checker can recompute the seed and the winners from chain state without trusting this realm's pages. Every value is an address, a hex digest or a printable-ASCII secret, so the JSON needs no escaping.

Open
OID
0d87f6…e18e:16
Proof details

Inspect func

GetEvent

func(id uint64) *fairdrop.Event

GetEvent looks an event up by id, or nil.

Open
OID
0d87f6…e18e:17
GetEvent details

Inspect func

revealedCount

func(e *fairdrop.Event) int
Open
OID
0d87f6…e18e:18
revealedCount details

Inspect func

mustEvent

func(id uint64) *fairdrop.Event
Open
OID
0d87f6…e18e:19
mustEvent details

Inspect func

require

func(ok bool, msg string)
Open
OID
0d87f6…e18e:21
require details

Inspect func

errString

func(err .uverse.error) string
Open
OID
0d87f6…e18e:22
errString details

Inspect func

trimSpace

func(s string) string
Open
OID
0d87f6…e18e:24
trimSpace details

Inspect func

normalizeAddress

func(s string) string

normalizeAddress accepts the shape of a bech32 gno address (g1 + 38 lower-case alphanumerics) as typed. It deliberately does not convert through the address type: a bad checksum would panic, and vouching for an address nobody holds is harmless — the vouch just never matches a ticket.

Open
OID
0d87f6…e18e:25
normalizeAddress details

Inspect func

gnowebURL

func(pkgPath string) string

gnowebURL turns a package path into the path part of its gnoweb URL by dropping the chain domain: gno.land/r/x/y -> /r/x/y.

Open
OID
0d87f6…e18e:26
gnowebURL details

Inspect func

Render

func(path string) string

Render dispatches gnoweb paths: "" board home: open and past draws "event/<id>" one draw, with the actions it accepts right now "event/<id>/verify" the seed's inputs and how to recompute it "event/<id>/receipt/<rank>" "create" how to open a draw

Open
OID
0d87f6…e18e:28
Render details

Inspect func

renderEvent

func(id uint64) string
Open
OID
0d87f6…e18e:30
renderEvent details

Inspect func

renderActions

func(b *strings.Builder, e *fairdrop.Event, ph string)
Open
OID
0d87f6…e18e:31
renderActions details

Inspect func

renderRoster

func(b *strings.Builder, e *fairdrop.Event, ph string)
Open
OID
0d87f6…e18e:32
renderRoster details

Inspect func

renderResult

func(b *strings.Builder, e *fairdrop.Event)
Open
OID
0d87f6…e18e:33
renderResult details

Inspect func

renderVerify

func(id uint64) string
Open
OID
0d87f6…e18e:34
renderVerify details

Inspect func

renderReceipt

func(id uint64, rank int) string
Open
OID
0d87f6…e18e:35
renderReceipt details

Inspect func

renderNotFound

func(path string) string
Open
OID
0d87f6…e18e:37
renderNotFound details

Inspect func

phaseBadge

func(ph string) string
Open
OID
0d87f6…e18e:38
phaseBadge details

Inspect func

phaseTick

func(active bool) string
Open
OID
0d87f6…e18e:39
phaseTick details

Inspect func

closeLine

func(e *fairdrop.Event, now int64) string
Open
OID
0d87f6…e18e:40
closeLine details

Inspect func

left

func(until int64, from int64) string

left renders a positive duration in seconds as "2d 3h", "4h 12m", "3m 40s".

Open
OID
0d87f6…e18e:41
left details

Inspect func

stamp

func(unix int64) string

stamp renders a unix second in both UTC and KST, the two clocks this board's audience reads.

Open
OID
0d87f6…e18e:42
stamp details

Inspect func

cell

func(s string) string

cell keeps a free-text field from breaking a markdown table.

Open
OID
0d87f6…e18e:44
cell details

Inspect func

quoteList

func(items []string) string
Open
OID
0d87f6…e18e:45
quoteList details

Inspect func

parseUint

func(s string) (uint64, bool)
Open
OID
0d87f6…e18e:46
parseUint details

Inspect func
RealmPath : untyped string ="gno.land/r/g1k6cl2huxpps9fxls8tqyxknvl7fgq9hua3f2yt/fairdrop"
PackagePath : untyped string ="gno.land/p/g1k6cl2huxpps9fxls8tqyxknvl7fgq9hua3f2yt/fairness"
PhaseOpen : untyped string ="open"
PhaseReveal : untyped string ="reveal"
PhaseDrawable : untyped string ="drawable"
PhaseDrawn : untyped string ="drawn"
PhaseCancelled : untyped string ="cancelled"
MaxSlots : untyped bigint =(100 <untyped> bigint)
MaxWeightCap : untyped bigint =(100 <untyped> bigint)
MinWindowSeconds : untyped bigint =(30 <untyped> bigint)
MaxWindowSeconds : untyped bigint =(2592000 <untyped> bigint)
MaxTitleLen : untyped bigint =(80 <untyped> bigint)
MaxPrizeLen : untyped bigint =(240 <untyped> bigint)
Event : type =fairdrop.Event
events : []*fairdrop.Event
byID : map[uint64]*fairdrop.Event Inspect
nextID : uint64 =0
Create : func(title string, prize string, slots int, maxWeight int, regSeconds int, revealSeconds int) uint64 Inspect
Vouch : func(eventID uint64, who string, weight int) Inspect
Register : func(eventID uint64, commit string, weight int) Inspect
Reveal : func(eventID uint64, secret string) Inspect
Draw : func(eventID uint64) Inspect
Cancel : func(eventID uint64) Inspect
EventCount : func() int Inspect
Winner : type =fairdrop.Winner
Proof : func(id uint64) string Inspect
GetEvent : func(id uint64) *fairdrop.Event Inspect
revealedCount : func(e *fairdrop.Event) int Inspect
mustEvent : func(id uint64) *fairdrop.Event Inspect
nowUnix : func() int64 Inspect
require : func(ok bool, msg string) Inspect
errString : func(err .uverse.error) string Inspect
uitoa : func(u uint64) string Inspect
trimSpace : func(s string) string Inspect
normalizeAddress : func(s string) string Inspect
gnowebURL : func(pkgPath string) string Inspect
Render : func(path string) string Inspect
renderHome : func() string Inspect
renderEvent : func(id uint64) string Inspect
renderActions : func(b *strings.Builder, e *fairdrop.Event, ph string) Inspect
renderRoster : func(b *strings.Builder, e *fairdrop.Event, ph string) Inspect
renderResult : func(b *strings.Builder, e *fairdrop.Event) Inspect
renderVerify : func(id uint64) string Inspect
renderReceipt : func(id uint64, rank int) string Inspect
renderCreate : func() string Inspect
renderNotFound : func(path string) string Inspect
phaseBadge : func(ph string) string Inspect
phaseTick : func(active bool) string Inspect
closeLine : func(e *fairdrop.Event, now int64) string Inspect
left : func(until int64, from int64) string Inspect
stamp : func(unix int64) string Inspect
short : func(s string) string Inspect
cell : func(s string) string Inspect
quoteList : func(items []string) string Inspect
parseUint : func(s string) (uint64, bool) Inspect