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.

tpengine.gno

1.66 Kb · 37 lines
 1// Package tpengine is a rehearsal probe (R3, J-3 flow): a tiny third-party engine "Tessera Probe".
 2// tpengine (third-party author) reserves its fingerprint first; tpcopy (squatter) registers the
 3// same art in between; tpengine's reservation-backed Register must supersede the copy.
 4package tpengine
 5
 6import (
 7	"gno.land/p/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia4/engine/v2"
 8	"gno.land/r/g1jz6j9hj6rdf5ltl2kcrpa4jwtdh3w30z0yul06/sinopia4/core"
 9)
10
11const author = address("g1nelq24z8gwzmusc82fhacxpe9s785s68l8l2ap")
12
13type impl struct{}
14
15func (impl) Manifest() engine.Manifest {
16	return engine.Manifest{
17		Name: "Tessera Probe", Version: "1.0.0", Description: "Rehearsal probe engine (Onyx test data).",
18		License: "CC0-1.0", Author: author, TraitTypes: []string{"Tone"},
19		MaxSVGBytes: 2048, FeeBps: 100, Kind: engine.KindSVG,
20	}
21}
22func (impl) ValidateParams(params string) error {
23	if params != "" {
24		panic("no params")
25	}
26	return nil
27}
28func (impl) TraitTypes(params string) []string                     { return []string{"Tone"} }
29func (impl) CheckLaunch(cid, params string, maxSupply int64) error { return nil }
30func (impl) Traits(in engine.Input) []engine.Trait                 { return []engine.Trait{{Type: "Tone", Value: in.Seed[:6]}} }
31func (impl) Render(in engine.Input) string {
32	return "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\"><rect width=\"64\" height=\"64\" fill=\"#" + in.Seed[:6] +
33		"\"/><circle cx=\"32\" cy=\"32\" r=\"20\" fill=\"#" + in.Seed[6:12] + "\"/></svg>"
34}
35func (impl) Media(in engine.Input) engine.Media { return engine.Media{} }
36
37func Register(cur realm, salt string) string { return core.RegisterEngine(cross(cur), impl{}, salt) }