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 source realm

Package streaks is an on-chain habit-streak tracker. Call CheckIn() again within graceBlocks of your last check-in an...

Readme View source

Streaks — on-chain habit-streak tracker

⚠️ Experimental — generated with no human supervision by the daily MCP pipeline to exercise gno tooling. Not audited. See r/moul/x/daily.


A tiny on-chain habit tracker: call CheckIn() and it builds a streak as long as you come back within 100 blocks of your last visit; wait longer and the streak resets to zero on your next check-in. It tracks current streak, longest streak ever, and total check-ins per address, with a sorted leaderboard and a per-address detail view in Render. Neat because it turns block height — the one clock Gno actually has — into a believable stand-in for 'don't break the chain' daily habit tracking, with no wall-clock hacks.

Built for sapphire (gno 0.9). Live demo (agent address): https://sapphire.testnets.gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/streaks


Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

Dependency graph:

gno.land/r/moul/x/daily/streaks/v0 dependency graph

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.

Overview

Package streaks is an on-chain habit-streak tracker. Call CheckIn() again within graceBlocks of your last check-in and the streak keeps growing; let the gap run past that and it resets to zero on your next check-in. Gno has no wall clock, so "again soon enough" is measured in blocks rather than calendar days — graceBlocks is the tunable stand-in for "before tomorrow".

Functions 4

func CheckIn

crossing Action
1func CheckIn(cur realm) string
source

CheckIn records a check-in for the caller at the current block height.

func CurrentStreak

Action
1func CurrentStreak(addr string) int64
source

CurrentStreak returns addr's live current streak, 0 if it has lapsed or addr has never checked in.

func LongestStreak

Action
1func LongestStreak(addr string) int64
source

LongestStreak returns addr's best streak ever, 0 if it has never checked in.

func Render

1func Render(path string) string
source

Render shows either the full leaderboard (path == "") or a single address's detail card when path is a bech32 address.

Imports 4

Source Files 3