giornatev2.gno
2.33 Kb · 56 lines
1// Package giornatev2 is the thin adapter that registers the Giornate II
2// engine (p/…/sinopia/art/giornate/v2, "Wall Scenes") with core: a fresco
3// wall with a real scene on it, caught mid-work, finished day-patches in
4// pigment over the red sinopia underdrawing.
5//
6// The adapter is stateless and has no admin: what it renders is fixed by
7// the p/ package it imports, which can never change. Never mark this realm
8// private (design §5.4: a re-deployable adapter could swap the art).
9// Per-chain values (author key, fee) live in config.gno.
10package giornatev2
11
12import (
13 art "gno.land/p/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia4/art/giornate/v2"
14 "gno.land/p/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia4/engine/v2"
15 "gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia4/core"
16)
17
18// Author is the engine-author key that registers, claims and may deprecate
19// this engine in core.
20func Author() address { return author }
21
22// impl is zero-size and declared here, so core runs it with this realm's
23// authority (interrealm v2 borrow rule #1).
24type impl struct{}
25
26func (impl) Manifest() engine.Manifest {
27 m := art.Manifest()
28 m.Author = author
29 m.FeeBps = AuthorFeeBps
30 return m
31}
32
33func (impl) ValidateParams(params string) error { return art.ValidateParams(params) }
34
35// TraitTypes: a static engine, every collection uses the manifest's list.
36func (impl) TraitTypes(params string) []string { return art.Manifest().TraitTypes }
37
38// CheckLaunch: a generative engine has no launch precondition.
39func (impl) CheckLaunch(cid, params string, maxSupply int64) error { return nil }
40
41func (impl) Traits(in engine.Input) []engine.Trait { return art.Traits(in) }
42
43func (impl) Render(in engine.Input) string { return art.Render(in) }
44
45// Media: an svg engine; Render is the art.
46func (impl) Media(in engine.Input) engine.Media { return engine.Media{} }
47
48// Register is an explicit call, not init: under the inert package policy
49// init runs inside the approver's transaction (RA B-1). It registers this
50// realm, once. Core accepts it only when the transaction is signed by the
51// manifest author (author, config.gno); with the fingerprint in core's
52// in-source reserved table (r/core config.gno) only that key can ever register this
53// art. No commit reservation, so the salt is "".
54func Register(cur realm) string {
55 return core.RegisterEngine(cross(cur), impl{}, "")
56}