Transaction
AA0919F4D8A0A1…DC7C3FEDA83D
Block 26,373 · index 0 · indexed
Summary
- Hash
- AA0919F4D8A0A10086268F489FEC7EA30D109BAB7F723553D4DBDC7C3FEDA83D
- Block
- 26,373
- Size
- 6552 bytes
- Gas used
- 11,169,364 / 13,403,296
- Fee
- 1000000ugnot
- Memo
- gnopublish
- Status
- success
Messages
Arguments · 9
- #1moodstone
- #2README.md
- #3# 🪨 Moodstone > ⚠️ **Experimental — generated with no human supervision.** This realm was > produced automatically by an MCP-driven agent to exercise the gno MCP server > and tooling, and to generate test content for gno compilers, linters and > formatters. **Not audited. Not for production.** Full context & folder README: > [r/moul/x/daily](https://github.com/moul/gno-contracts/blob/main/r/moul/x/daily/README.md) --- An on-chain mood tracker for the Gno ecosystem. Users log how they're feeling with a short note, and the realm shows live community sentiment stats — all stored immutably on gno.land. **Realm path:** `gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/moodstone` ## Moods `happy` · `sad` · `excited` · `calm` · `anxious` · `angry` · `neutral` ## Example Calls ```bash # Log a mood gnokey maketx call \ -pkgpath gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/moodstone \ -func LogMood \ -args 'happy' -args 'Just deployed my first realm!' \ -gas-fee 1000000ugnot -gas-wanted 2000000 \ -broadcast -chainid test5 \ test5.gno.land:443 # Query total entries (read-only) gnokey query vm/qeval \ -remote test5.gno.land:443 \ -data 'gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/moodstone.TotalEntries()' # Query dominant mood gnokey query vm/qeval \ -remote test5.gno.land:443 \ -data 'gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/moodstone.DominantMood()' ``` <!-- BEGIN GNOCONTRACTS FOOTER (generated by `make readmes`; do not edit below) --> --- Part of **[moul/gno-contracts](https://github.com/moul/gno-contracts)** — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage. > 🧪 **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](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md). <!-- END GNOCONTRACTS FOOTER -->
- #4gnomod.toml
- #5module = "gno.land/r/moul/x/daily/moodstone/v0" gno = "0.9"
- #6moodstone.gno
- #7package moodstone import ( "chain/runtime" "chain/runtime/unsafe" "strconv" "strings" ) // Entry holds a single mood log. type Entry struct { Author address Mood string Note string Block int64 } var entries []Entry var validMoods = []string{"happy", "sad", "excited", "calm", "anxious", "angry", "neutral"} func isValid(mood string) bool { for _, m := range validMoods { if m == mood { return true } } return false } func emoji(mood string) string { switch mood { case "happy": return "😊" case "sad": return "😢" case "excited": return "🎉" case "calm": return "😌" case "anxious": return "😰" case "angry": return "😠" case "neutral": return "😐" } return "❓" } func shortAddr(addr address) string { s := addr.String() if len(s) <= 12 { return s } return s[:6] + "…" + s[len(s)-4:] } func bar(count, total int) string { if total == 0 { return strings.Repeat("░", 20) } filled := (count * 20) / total return strings.Repeat("▓", filled) + strings.Repeat("░", 20-filled) } // LogMood records the caller's current mood with an optional note. // mood must be one of: happy sad excited calm anxious angry neutral func LogMood(_ realm, mood, note string) { mood = strings.ToLower(strings.TrimSpace(mood)) if !isValid(mood) { panic("invalid mood; choose from: " + strings.Join(validMoods, ", ")) } entries = append(entries, Entry{ Author: unsafe.OriginCaller(), Mood: mood, Note: strings.TrimSpace(note), Block: runtime.ChainHeight(), }) } // TotalEntries returns the total number of mood logs on record. func TotalEntries() int { return len(entries) } // MoodCount returns how many times the given mood has been logged. func MoodCount(mood string) int { mood = strings.ToLower(strings.TrimSpace(mood)) n := 0 for _, e := range entries { if e.Mood == mood { n++ } } return n } // DominantMood returns the most-logged mood, or "none" if no entries. func DominantMood() string { if len(entries) == 0 { return "none" } counts := make(map[string]int) for _, e := range entries { counts[e.Mood]++ } best := "" bestN := 0 for _, m := range validMoods { if counts[m] > bestN { bestN = counts[m] best = m } } return best } func Render(path string) string { out := "# 🪨 Moodstone — On-chain Mood Tracker\n\n" out += "> Log how you feel. Watch how the community feels. Immutably, on Gno.\n\n" total := len(entries) // Community stats table out += "## 📊 Community Vibes\n\n" if total == 0 { out += "*No moods logged yet — be the first!*\n\n" } else { counts := make(map[string]int) for _, e := range entries { counts[e.Mood]++ } out += "| Mood | Count | Distribution |\n" out += "|------|-------|--------------|\n" for _, m := range validMoods { c := counts[m] pct := 0 if total > 0 { pct = (c * 100) / total } out += "| " + emoji(m) + " " + m + " | " + strconv.Itoa(c) + " | `" + bar(c, total) + "` " + strconv.Itoa(pct) + "% |\n" } dom := DominantMood() out += "\n**Total entries:** " + strconv.Itoa(total) + " · **Dominant mood:** " + emoji(dom) + " " + dom + "\n\n" } // Recent entries (newest first, max 10) out += "## 📝 Recent Entries\n\n" if total == 0 { out += "*Nothing here yet.*\n\n" } else { start := total - 10 if start < 0 { start = 0 } for i := total - 1; i >= start; i-- { e := entries[i] line := "- " + emoji(e.Mood) + " **" + e.Mood + "**" if e.Note != "" { line += ": *" + e.Note + "*" } line += " — `" + shortAddr(e.Author) + "` at block " + strconv.FormatInt(e.Block, 10) out += line + "\n" } out += "\n" } // How to use out += "## 🚀 How to Use\n\n" out += "```bash\n" out += "gnokey maketx call \\\n" out += " -pkgpath gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/moodstone \\\n" out += " -func LogMood \\\n" out += " -args 'happy' -args 'Just shipped something awesome!'\n" out += "```\n\n" out += "**Valid moods:** " + strings.Join(validMoods, " · ") + "\n" return out }
- #8/gno.MemPackageType
- #9 MPUserProd
Result log
msg:0,success:true,log:,events:[]