gates.gno
1.93 Kb · 47 lines
1package engine
2
3// Optional gates (core-final round, 2026-11-12). Engine stays exactly as it
4// was, so every engine written against it keeps compiling; an engine value
5// that also implements CreateGate or LaunchGate gets the collection-level
6// facts its plain methods cannot see. Core finds them with a type
7// assertion on the registered value and runs them, like ValidateParams and
8// CheckLaunch, only in the creator's own transaction (I-16), never with
9// core's cur.
10
11// Launch modes as core passes them in Collection.Mode (the same values as
12// types.ModeReveal and types.ModeOpen).
13const (
14 ModeReveal = ""
15 ModeOpen = "open"
16)
17
18// Collection is what core tells an engine's gates about one collection.
19// Plain values only: an engine never gets a reference into core state.
20type Collection struct {
21 ID string // the collection id (bare, e.g. "12")
22 Creator address // the creator core records (a wallet or a realm, K-2)
23 Params string // already accepted by ValidateParams
24 MaxSupply int64
25 // Mode is the launch mode in GateLaunch (ModeReveal or ModeOpen); ""
26 // in GateCreate (a Draft has no mode yet).
27 Mode string
28 // Soulbound: the collection's tokens can never be transferred or
29 // approved (fixed at creation).
30 Soulbound bool
31}
32
33// CreateGate is the create-time check with the creator: core.CreateCollection
34// calls GateCreate after ValidateParams and TraitTypes accepted the params;
35// an error aborts the creation ("create refused by engine: …"). This is
36// where an engine checks who may use which params (e.g. that the creator
37// owns the asset store the params name) instead of reading OriginCaller.
38type CreateGate interface {
39 GateCreate(c Collection) error
40}
41
42// LaunchGate is the launch-time check with the launch mode: core.Launch
43// calls GateLaunch right after CheckLaunch passed, for both modes; an error
44// aborts the launch ("launch refused by engine: …").
45type LaunchGate interface {
46 GateLaunch(c Collection) error
47}