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

round

int

round is the current (open) round number, 1-based.

Value

1

entrants

v0.Tree

entrants holds the current round's players: key = address string, value = the address. Iteration is deterministic (sorted by key), which makes winner selection reproducible.

Open
OID
014529…ca78:5
entrants details

Inspect ref

winners

v0.Tree

winners records past rounds: key = zero-padded round number (for ordered iteration), value = \*winnerRecord.

Open
OID
014529…ca78:7
winners details

Inspect ref

winnerRecord

type

Value

v0.winnerRecord

winnerKey

func(r int) string

winnerKey zero-pads the round number so avl iteration yields chronological order for up to 10^9 rounds.

Open
OID
014529…ca78:8
winnerKey details

Inspect func

pickIndex

func(height int64, n int) int

pickIndex derives the winning entrant index from the block height. Panics if there are no entrants. Pure helper (deterministic, no state) — safe to test.

Open
OID
014529…ca78:10
pickIndex details

Inspect func

Enter

func()

Enter adds the caller to the current round's entrants. Each address may only enter a given round once; a duplicate entry panics.

Open
OID
014529…ca78:11
Enter details

Inspect func

DrawWinner

func() .uverse.address
Open
OID
014529…ca78:12
DrawWinner details

Inspect func

CurrentRound

func() int

CurrentRound returns the currently open round number.

Open
OID
014529…ca78:13
CurrentRound details

Inspect func

NumEntrants

func() int

NumEntrants returns how many players have entered the current round.

Open
OID
014529…ca78:14
NumEntrants details

Inspect func

HasEntered

func(addr .uverse.address) bool

HasEntered reports whether addr is in the current round.

Open
OID
014529…ca78:15
HasEntered details

Inspect func

Render

func(path string) string

Render shows the current round, its entrants, and the winners history.

Open
OID
014529…ca78:16
Render details

Inspect func
round : int =1
entrants : v0.Tree Inspect
winners : v0.Tree Inspect
winnerRecord : type =v0.winnerRecord
winnerKey : func(r int) string Inspect
pickIndex : func(height int64, n int) int Inspect
Enter : func() Inspect
DrawWinner : func() .uverse.address Inspect
CurrentRound : func() int Inspect
NumEntrants : func() int Inspect
HasEntered : func(addr .uverse.address) bool Inspect
Render : func(path string) string Inspect