BlocksPerDay
untyped bigintBlocksPerDay is the length of a check-in window, in blocks. Chosen so a window is a meaningful stretch of chain activity while keeping tests and demos quick to reason about.
Value
(1000 <untyped> bigint)
maxLeaderboard
untyped bigintmaxLeaderboard caps how many entries Render lists.
Value
(10 <untyped> bigint)
record
typerecord is one address's streak state.
Value
streak.record
users
*v0.Treeusers maps address string -> \*record.
- OID
- 063383…cee0:4
users details
today
func() int64today returns the current day index: block height divided into fixed windows.
- OID
- 063383…cee0:6
today details
CheckIn
func() intCheckIn records a check-in for the caller and returns the resulting streak. Checking in twice in the same window is rejected — the streak only moves when the window does. A gap of exactly one window continues the streak; any larger gap restarts it at 1.
- OID
- 063383…cee0:8
CheckIn details
get
func(addr .uverse.address) *streak.recordget returns the caller's record, or nil. avl/v0's Get returns a single \`any\` (not the value, ok pair Go maps use), so a missing key surfaces as a nil interface rather than a second return value.
- OID
- 063383…cee0:9
get details
Current
func(addr .uverse.address) intCurrent returns addr's live streak — 0 once a window has been missed, even though the stored value only updates on the next check-in.
- OID
- 063383…cee0:10
Current details
Best
func(addr .uverse.address) intBest returns addr's record streak, which is never lowered.
- OID
- 063383…cee0:11
Best details
Day
func() int64Day returns the current day index.
- OID
- 063383…cee0:12
Day details
entry
typeentry is a flattened record for rendering.
Value
streak.entry
byBest
typebyBest ranks entries by best streak descending, then by address so equal scores always come out in the same order (Render must be deterministic).
Value
streak.byBest
Render
func(path string) stringRender renders the streak board for gnoweb. Render("") / Render("/") -> leaderboard by best streak Render("/<address>") -> that address's standing
- OID
- 063383…cee0:13
Render details
renderOne
func(q string) stringrenderOne renders a single address's standing.
- OID
- 063383…cee0:14
renderOne details
all
func() []streak.entryall flattens the tree into a slice.
- OID
- 063383…cee0:15
all details
parseArg
func(path string) stringparseArg extracts the first path segment.
- OID
- 063383…cee0:16