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

untrusted-render: successor is the only stored string Render echoes, and Retire validates it with assertPkgPath befor...

Readme View source

gno.land/r/moul/x/upgrade/lock/v0

Version 0 of the retire the predecessor upgrade pattern (pattern B). Writable until the owner calls Retire(successor), which is one-way: from then on it is a read-only archive that names where callers should go.

See the pattern and the exploration.


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/upgrade/lock/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

untrusted-render: successor is the only stored string Render echoes, and Retire validates it with assertPkgPath before storing it.

Package lock is version 0 of the "retire the predecessor" upgrade pattern (pattern B of the exploration; see ../README.md).

Unlike pattern A, this version knows it can be superseded. Retire() freezes it and names its successor, and the freeze is one-way: once a successor has absorbed this version's total, re-opening it here would double-count.

Variables 1

var Ownable, counter, successor

1var (
2	Ownable = ownable.NewWithAddress(owner)
3
4	counter   int
5	successor string // pkgpath that replaced this one; "" while this version is live
6)
source

Functions 5

func Get

Action
1func Get() int
source

Get returns this version's final (or current) total.

func Inc

crossing Action
1func Inc(cur realm, n int)
source

Inc adds n. It aborts once a successor has been declared.

func Retire

crossing Action
1func Retire(cur realm, pkgPath string)
source

Retire freezes this version and names its replacement. Owner-gated, one-way.

func Successor

Action
1func Successor() string
source

Successor is the path callers should move to, or "" while this version is live.

Imports 3

Source Files 4