Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

seed.gno

1.85 Kb · 52 lines
 1package releases
 2
 3import (
 4	"chain/runtime"
 5
 6	rel "gno.land/p/moul/releases/v0"
 7)
 8
 9// moul is the owner of the seeded projects. The address is the one every
10// other r/moul realm names.
11const moul = address("g1manfred47kzduec920z88wfr64ylksmdcedlf5")
12
13// seed lists the r/moul realms that already ship more than one version, as
14// gnomod.lock records them. The old versions are on chain and immutable, so
15// they cannot import this realm: they are listed and labelled, and only the
16// stage page and the newer versions say they are old.
17func seed() {
18	h := runtime.ChainHeight()
19	type v struct{ version, path, notes string }
20	type project struct {
21		name, description string
22		old, cur          v
23		reason            string
24	}
25	for _, p := range []project{
26		{
27			"config", "moul's shared settings, pause switch and managers",
28			v{"v0", "gno.land/r/moul/config/v0", "first public version"},
29			v{"v1", "gno.land/r/moul/config/v1", "pause levels and the relay that lets later versions share this state"},
30			"superseded by v1",
31		},
32		{
33			"faucet", "a rate-limited GNOT faucet",
34			v{"v0", "gno.land/r/moul/faucet/v0", "first version, public by accident: deployed two minutes before private was set"},
35			v{"v1", "gno.land/r/moul/faucet/v1", "private, so it can be redeployed in place"},
36			"superseded by v1",
37		},
38		{
39			"render", "the Render basics demo",
40			v{"v0", "gno.land/r/moul/demo/render/v0", "first version"},
41			v{"v1", "gno.land/r/moul/demo/render/v1", "caller text escaped; asks this registry for its banner"},
42			"superseded by v1",
43		},
44	} {
45		pr, err := rel.NewProject(p.name, p.description)
46		check(err)
47		check(pr.Add(p.old.version, p.old.path, "", p.old.notes, rel.Supported, h))
48		check(pr.Add(p.cur.version, p.cur.path, "", p.cur.notes, rel.Supported, h))
49		check(pr.Deprecate(p.old.version, p.reason, 0))
50		projects.Set(p.name, &entry{project: pr, owner: moul})
51	}
52}