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.

v1 source pure

Package cinar is a Sinopia engine and its first living one: a tree that grows with the token's age, turns with the ch...

Overview

Package cinar is a Sinopia engine and its first living one: a tree that grows with the token's age, turns with the chain's seasons and keeps its owners in its bark and roots.

The tree's shape, species, setting and rare marks come from the seed. How much of the tree exists, and what it looks like today, comes from the chain inputs core passes in engine.Input (Living = true):

  • Height - MintHeight (age): growth (a square-root curve over three chain years) and the Stage trait;
  • Height alone: the chain season (a 365-day chain year of 24,000-block days, anchored so that gnoland-1 height 1,480,355 = 11 Nov 2026 = day 236 after the spring equinox), the sun's height, and the daily sky (clouds, birds, snowfall) drawn from a per-day stream;
  • Height - LastMoveHeight (holding time): the current owner's roots, moss after 180 days and a nest after 365 days; the tree's lifetime roots stay as a faint ghost below them;
  • Moves (transfers): one notch carved in the bark per transfer, or the first owner's seal while it has never moved; a Wish Tree gets more ribbons with every owner.

CollectionID and TokenID are not read. Inputs are clamped to 0..2^32-1 (core stores them as uint32) and MintHeight <= LastMoveHeight <= Height is enforced, so any RenderWithInput call renders.

Pure integer maths: no floats. frontend/src/engines/cinar.ts is the byte-identical TypeScript twin; cinar_test.gno and cinar.test.ts assert the same golden vectors.

Constants 5

const DefaultParams

1const DefaultParams = `{"species":"Seeded","setting":"Seeded"}`
source

DefaultParams is the canonical form of the defaults; it renders exactly like "".

const Fingerprint

1const Fingerprint = "95d4922c9f9cdb02ab96e88c1628deb179ebb8d327054ab64d12040b38c00e83"
source

Fingerprint is sha256(Render(engine.SampleInput())): a sapling on the steppe in late summer at height 1. The integration step reserves it in core (r/core config.gno reservedFingerprints).

const MaxSVGBytes

1const MaxSVGBytes = 28672
source

MaxSVGBytes: the largest output measured is ~22 KB (full-grown crown, many transfers); the cap leaves headroom under the 28 KB budget.

const ParamsSchema

1const ParamsSchema = `{"type":"object","properties":{` +
2	`"species":{"type":"string","title":"Species","enum":["Seeded","Oriental Plane","Olive","Judas Tree","Cypress"],` +
3	`"default":"Seeded"},` +
4	`"setting":{"type":"string","title":"Setting","enum":["Seeded","Hill","Courtyard","Shore","Steppe"],` +
5	`"default":"Seeded"}}}`
source

ParamsSchema is the Studio form. Studio sends JSON.stringify of the values in this property order; ValidateParams accepts exactly that or "".

Functions 9

func Manifest

1func Manifest() engine.Manifest
source

Manifest describes the engine. Author and FeeBps are set by the adapter.

func Render

1func Render(in engine.Input) string
source

Render returns the raw SVG for in.

func SVG

1func SVG(in engine.Input, cfg Config) string
source

SVG renders the artwork for in under cfg.

func Traits

1func Traits(in engine.Input) []engine.Trait
source

Traits returns the eight traits of in in TraitTypes order. It never renders: three table draws and the clock.

func ValidateParams

1func ValidateParams(params string) error
source

ValidateParams accepts "" (the showcase defaults) and the canonical JSON.

func ClockOf

1func ClockOf(in engine.Input) Clock
source

ClockOf reads the living fields of in.

func Defaults

1func Defaults() Config
source

Defaults is the showcase look (params "").

func ParseParams

1func ParseParams(params string) (Config, error)
source

ParseParams accepts "" or the canonical JSON Studio produces, nothing else.

func TraitsOf

1func TraitsOf(in engine.Input, cfg Config) TraitSet
source

TraitsOf returns the traits for in under cfg. Species, Setting, Mark and Rarity come from the seed; Season, Stage, Roots and Notches from chain time.

Types 3

type Clock

struct
1type Clock struct {
2	Height, MintHeight, LastMoveHeight, Moves int
3	AgeDays, HoldDays                         int
4	Season                                    int // 0 spring .. 3 winter
5	Progress                                  int // 0..999 within the season
6	YearAngle                                 int // 0..255, spring equinox = 0
7	Day                                       int // chain day number
8}
source

Clock is everything the art reads from chain time, after clamping.

type Config

struct
1type Config struct {
2	Species int // -1: drawn from the seed
3	Setting int // -1: drawn from the seed
4}
source

Config is a parsed params string.

type TraitSet

struct
1type TraitSet struct {
2	Species, Setting, Season, Stage, Roots, Notches, Mark string
3	Score                                                 int
4	Rarity                                                string
5}
source

TraitSet is the decoded properties of an input.

Dependencies

Source Files 2