Transaction
34CF52FB6D7978…91873A82CF14
Block 26,094 · index 0 · indexed
Summary
- Hash
- 34CF52FB6D7978FCD9E013F91E1A82A9742B471E070E739F8C5791873A82CF14
- Block
- 26,094
- Size
- 4202 bytes
- Gas used
- 8,547,903 / 10,257,543
- Fee
- 1000000 ugnot
- Memo
- gnopublish
- Status
- success
Messages
Arguments · 9
- #1orderedmapdemo
- #2README.md
- #3# Ordered Map > ⚠️ **Experimental — generated with no human supervision** by the daily MCP pipeline to exercise gno tooling. Not audited. See [r/moul/x/daily](https://github.com/moul/gno-contracts/blob/main/r/moul/x/daily/README.md). --- Inserts four keys out of alphabetical order, then shows that the order survives an update and changes correctly after a delete-and-re-add. Demo of the [`p/moul/x/daily/orderedmap`](https://github.com/moul/gno-contracts/tree/main/p/moul/x/daily/orderedmap/v0) library — no map logic lives here. Stateless, so `Render` is deterministic, which is exactly the property the library exists to provide. The three tables are the whole argument: keys stay in insertion order, an update does **not** move a key, and a re-insertion after a delete goes last. Built for gno 0.9. <!-- 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. **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](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md). <!-- END GNOCONTRACTS FOOTER -->
- #4gnomod.toml
- #5module = "gno.land/r/moul/x/daily/orderedmapdemo/v0" gno = "0.9"
- #6orderedmapdemo.gno
- #7// Package orderedmapdemo is a small gnoweb demo of the insertion-ordered map // provided by the [p/moul/x/daily/orderedmap](/p/moul/x/daily/orderedmap/v0) // library: it shows that order survives updates and deletes. // // It contains no map logic of its own. Stateless, so Render is deterministic — // which is precisely what the library is for. package orderedmapdemo import ( "strconv" "strings" "gno.land/p/moul/x/daily/orderedmap/v0" ) // Render renders the demo for gnoweb. func Render(path string) string { var b strings.Builder b.WriteString("# Ordered Map\n\n") b.WriteString("A map that remembers insertion order, demoing the ") b.WriteString("[`p/moul/x/daily/orderedmap`](/p/moul/x/daily/orderedmap/v0) library.\n\n") o := orderedmap.New() for _, kv := range [][2]string{{"delta", "4"}, {"alpha", "1"}, {"charlie", "3"}, {"bravo", "2"}} { o.Set(kv[0], kv[1]) } b.WriteString("## Inserted\n\n") b.WriteString("`delta, alpha, charlie, bravo` → order kept as inserted, **not** sorted:\n\n") b.WriteString(table(o)) o.Set("alpha", "99") b.WriteString("\n## After `Set(\"alpha\", \"99\")`\n\n") b.WriteString("Updating keeps the original position — insertion order means *first* insertion:\n\n") b.WriteString(table(o)) o.Delete("charlie") o.Set("charlie", "new") b.WriteString("\n## After deleting and re-adding `charlie`\n\n") b.WriteString("Re-inserting is a **new** insertion, so it goes last:\n\n") b.WriteString(table(o)) b.WriteString("\n> gno map iteration order is unspecified. A realm that ranges over a ") b.WriteString("built-in map to build its page can emit a different page every call — ") b.WriteString("a consensus bug, not a cosmetic one. This is the fix.\n") return b.String() } func table(o *orderedmap.OrderedMap) string { var b strings.Builder b.WriteString("| # | key | value |\n|---|---|---|\n") i := 0 o.Iterate(func(k, v string) bool { i++ b.WriteString("| ") b.WriteString(strconv.Itoa(i)) b.WriteString(" | `") b.WriteString(k) b.WriteString("` | `") b.WriteString(v) b.WriteString("` |\n") return false }) return b.String() }
- #8/gno.MemPackageType
- #9 MPUserProd
Result log
msg:0,success:true,log:,events:[]