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

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

rubricav2.gno

2.43 Kb · 57 lines
 1// Package rubricav2 is the thin adapter that registers the Rubrica v2
 2// "Living Language" engine (p/…/sinopia/art/rubrica/v2) with core: core knows
 3// it only as this realm's package path plus an interface value.
 4//
 5// The adapter is stateless and has no admin: what it renders is fixed by
 6// the p/ package it imports, which can never change. Never mark this realm
 7// private (design §5.4: a re-deployable adapter could swap the art).
 8// Per-chain values (author key, fee) live in config.gno.
 9package rubricav2
10
11import (
12	art "gno.land/p/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia4/art/rubrica/v2"
13	"gno.land/p/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia4/engine/v2"
14	"gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia4/core"
15)
16
17// Author is the engine-author key that registers, claims and may deprecate
18// this engine in core.
19func Author() address { return author }
20
21// impl is zero-size and declared here, so core runs it with this realm's
22// authority (interrealm v2 borrow rule #1).
23type impl struct{}
24
25func (impl) Manifest() engine.Manifest {
26	m := art.Manifest()
27	m.Author = author
28	m.FeeBps = AuthorFeeBps
29	return m
30}
31
32func (impl) ValidateParams(params string) error { return art.ValidateParams(params) }
33
34// TraitTypes: a static engine, every collection uses the manifest's list.
35func (impl) TraitTypes(params string) []string { return art.Manifest().TraitTypes }
36
37// CheckLaunch: a generative engine has no launch precondition.
38func (impl) CheckLaunch(cid, params string, maxSupply int64) error { return nil }
39
40func (impl) Traits(in engine.Input) []engine.Trait { return art.Traits(in) }
41
42// Render: the leaf for in.Seed under in.Params; in.TokenID is its folio
43// number (core passes the token id on TokenURI, "0" on RenderWith).
44func (impl) Render(in engine.Input) string { return art.Render(in) }
45
46// Media: an svg engine; Render is the art.
47func (impl) Media(in engine.Input) engine.Media { return engine.Media{} }
48
49// Register is an explicit call, not init: under the inert package policy
50// init runs inside the approver's transaction (RA B-1). It registers this
51// realm, once. Core accepts it only when the transaction is signed by the
52// manifest author (I-14). The salt is "": the fingerprint is meant to join
53// core's in-source reserved table (docs/engines/rubrica-v2.md,
54// "Integration"); without that, publish p/ + adapter + Register in one go.
55func Register(cur realm) string {
56	return core.RegisterEngine(cross(cur), impl{}, "")
57}