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.

kilim.gno

2.23 Kb · 55 lines
 1// Package kilim is the thin adapter that registers the Kilim engine
 2// (p/…/sinopia/art/kilim/v1) with core. Core knows the engine only as this
 3// 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 kilim
10
11import (
12	art "gno.land/p/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia4/art/kilim/v1"
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
42func (impl) Render(in engine.Input) string { return art.Render(in) }
43
44// Media: an svg engine; Render is the art.
45func (impl) Media(in engine.Input) engine.Media { return engine.Media{} }
46
47// Register is an explicit call, not init: under the inert package policy
48// init runs inside the approver's transaction (RA B-1). It registers this
49// realm, once. The sample fingerprint is reserved in core's source (I-14),
50// so core accepts it only when the transaction is signed by the reserved
51// engine-author key, the same key as author (config.gno); no commit
52// reservation, so the salt is "".
53func Register(cur realm) string {
54	return core.RegisterEngine(cross(cur), impl{}, "")
55}