Transaction

FC994F98F80281…FCFFB4740BEC

Block 26,388 · index 0 · indexed

Summary

Hash
FC994F98F802817681E4A8A62EBAE503D06880730F9F0E91F7FDFCFFB4740BEC
Block
26,388
Size
5449 bytes
Gas used
9,375,023 / 11,250,087
Fee
1000000ugnot
Memo
gnopublish
Status
success

Messages

#1AddPackagegno.land/r/moul/x/daily/ringlog/v09 arguments

Arguments · 9

  1. #1ringlog
  2. #2README.md
  3. #3# RingLog > ⚠️ **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) --- A port of Go's `container/ring` onto gno.land — a fixed-capacity circular message board where new posts automatically evict the oldest once the buffer fills up. Holds the last 16 messages on-chain; no pagination, no clutter. **Realm:** `gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/ringlog` ## How it works The realm maintains a 16-slot ring buffer backed by a fixed-size array. `head` tracks the next write position; when it wraps past the end it overwrites the oldest slot. Classic O(1) insert, O(n) read — no allocations after init. ## Transactions ```bash # Post a message (up to 280 chars) gnokey maketx call -pkgpath "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/ringlog" \ -func Post -args "hello gno.land" \ -gas-fee 1000000ugnot -gas-wanted 2000000 \ -broadcast -chainid sapphire-1 \ -remote https://rpc.sapphire.testnets.gno.land:443 \ <keyname> ``` ## Queries ```bash # View via gnoweb # Get entries programmatically gnokey query vm/qeval \ -remote https://rpc.sapphire.testnets.gno.land:443 \ -data 'gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/ringlog.Len()' ``` ## Capacity The buffer holds exactly **16** messages (`Cap = 16`). Once full, the next `Post` silently drops the oldest. This mirrors `container/ring.Ring.Move` with overwrite semantics. <!-- 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 -->
  4. #4gnomod.toml
  5. #5module = "gno.land/r/moul/x/daily/ringlog/v0" gno = "0.9"
  6. #6ringlog.gno
  7. #7// Package ringlog is an on-chain port of Go's container/ring: a fixed-capacity // circular message board where new posts overwrite the oldest entries once full. package ringlog import ( "chain/runtime" "chain/runtime/unsafe" "strconv" "strings" ) // Cap is the maximum number of messages the ring buffer holds. const Cap = 16 // Entry is a single posted message. type Entry struct { Author address Message string Height int64 } var ( buf [Cap]Entry // the ring storage head int // index of the next write slot count int // number of entries currently stored (0 ≤ count ≤ Cap) ) // Post adds a message to the ring buffer. // Once Cap entries are stored, the oldest entry is overwritten. func Post(msg string) { msg = strings.TrimSpace(msg) if len(msg) == 0 { panic("message cannot be empty") } if len(msg) > 280 { panic("message too long (max 280 chars)") } buf[head] = Entry{ Author: unsafe.PreviousRealm().Address(), Message: msg, Height: runtime.ChainHeight(), } head = (head + 1) % Cap if count < Cap { count++ } } // Entries returns all stored messages in chronological order (oldest first). func Entries() []Entry { if count == 0 { return nil } result := make([]Entry, count) oldest := (head - count + Cap) % Cap for i := 0; i < count; i++ { result[i] = buf[(oldest+i)%Cap] } return result } // Len returns the number of messages currently stored. func Len() int { return count } // Render displays the ring buffer as a Markdown page. func Render(path string) string { var sb strings.Builder sb.WriteString("# RingLog\n\n") sb.WriteString("> A ring-buffer message board (capacity: **") sb.WriteString(strconv.Itoa(Cap)) sb.WriteString("**). New messages overwrite the oldest once the buffer is full.\n\n") if count == 0 { sb.WriteString("*No messages yet. Call `Post(msg)` to add one.*\n") return sb.String() } sb.WriteString("| # | Author | Block | Message |\n") sb.WriteString("|---|--------|-------|---------|\n") entries := Entries() for i, e := range entries { sb.WriteString("| ") sb.WriteString(strconv.Itoa(i + 1)) sb.WriteString(" | `") sb.WriteString(shorten(e.Author.String())) sb.WriteString("` | ") sb.WriteString(strconv.FormatInt(e.Height, 10)) sb.WriteString(" | ") sb.WriteString(e.Message) sb.WriteString(" |\n") } sb.WriteString("\n*Showing ") sb.WriteString(strconv.Itoa(count)) sb.WriteString(" of ") sb.WriteString(strconv.Itoa(Cap)) sb.WriteString(" slots used.*\n") return sb.String() } // shorten trims a long address for display. func shorten(s string) string { if len(s) <= 14 { return s } return s[:6] + "…" + s[len(s)-6:] }
  8. #8/gno.MemPackageType
  9. #9 MPUserProd

Result log

msg:0,success:true,log:,events:[]

← Back to block 26,388