Skip to content Search Apps Documentation Source Content 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.

core source realm

Package core is the platform's immutable ledger (design §2.5.2): every collection, its official grc721 token and roya...

Overview

Package core is the platform's immutable ledger (design §2.5.2): every collection, its official grc721 token and royalty, its provenance (commit–reveal v2), the engine registry, fees and the admin timelock.

What core guarantees, whoever holds the admin key:

  • I-1 admin cannot move, approve or burn a token, and holds no funds; the op list is a closed set of parameters (admin.gno).
  • I-2 pause only gates create, mint and trade. Transfer, burn, finalize, distribute and every cancel stay open, and a pause expires by itself after MaxPauseBlocks.
  • I-5 supply only grows through the collection's bound minter, never past maxSupply, and a token id is never minted twice.
  • I-6 after Launch the engine, params, supply, payees, sale window and commitments are frozen.
  • I-10/11 a collection becomes Final at most once, only with both reveals or after revealDeadline, and that deadline is bounded, so the pre-reveal transfer lock always ends.
  • I-12 engine code never runs on a state-changing path, except the creator's own CreateCollection (ValidateParams) and the engine's own RegisterEngine (one sample render). Every exported non-crossing function is read-only, so an engine cannot call back into a mutator.
  • I-13 every stored string passed safe.AssertText.

core imports no mutable realm: minters and engines are known only by package path and interface value.

Constants 3

const OpFeeCreate, OpFeePrimary, OpFeeSecondary, OpTreasury, OpBeacon, OpMinterAdd, OpMinterDeprecate, OpEngineReview, OpAdminTransfer

 1const (
 2	OpFeeCreate       = "fee.create"       // ugnot, <= CreateFeeCap
 3	OpFeePrimary      = "fee.primary"      // bps, <= ProtocolFeeCapBps
 4	OpFeeSecondary    = "fee.secondary"    // bps, <= ProtocolFeeCapBps
 5	OpTreasury        = "treasury"         // address
 6	OpBeacon          = "beacon"           // address, or "" to disable new beacon launches
 7	OpMinterAdd       = "minter.add"       // realm pkgpath
 8	OpMinterDeprecate = "minter.deprecate" // realm pkgpath: no new collections
 9	OpEngineReview    = "engine.review"    // engine id: reviewed badge (UI only)
10	OpAdminTransfer   = "admin.transfer"   // address; the new admin must AcceptAdmin
11)
source

Ops and their argument formats.

const ProtocolFeeCapBps, RoyaltyCapBps, CreateFeeCap, MaxPayees, MaxSupplyCap, MaxMintPerTx, MaxReserveBps, MaxSaleBlocks, RevealWindowMin, RevealWindowMax, BeaconGraceBlocks, TimelockBlocks, MaxPauseBlocks, MaxNameLen, MaxDescriptionLen, MaxParamsLen, MinSecretLen, MaxSecretLen, MaxPageSize

 1const (
 2	ProtocolFeeCapBps = 500           // 5% of any sale
 3	RoyaltyCapBps     = 1000          // 10% (RA M-3)
 4	CreateFeeCap      = 1_000_000_000 // 1,000 GNOT in ugnot
 5	MaxPayees         = 4
 6	MaxSupplyCap      = 10_000
 7	MaxMintPerTx      = 10      // hypothesis: measure n=10 gas/deposit on Onyx
 8	MaxReserveBps     = 1000    // creator reserve <= 10% of supply
 9	MaxSaleBlocks     = 732_000 // ~30 days
10	RevealWindowMin   = 1_017   // ~1 hour
11	RevealWindowMax   = 170_000 // ~7 days
12	BeaconGraceBlocks = 254     // beacon may reveal first in the window's last ~15 min (< RevealWindowMin, so the creator always gets to go first)
13	TimelockBlocks    = 48_800  // ~48 hours
14	MaxPauseBlocks    = 195_000 // ~8 days
15
16	MaxNameLen        = 64
17	MaxDescriptionLen = 1024
18	MaxParamsLen      = 1024
19	MinSecretLen      = 32
20	MaxSecretLen      = 256
21	MaxPageSize       = 50
22)
source

Hard limits. They are constants on purpose: nobody, admin included, can raise them after deploy (block counts assume ~3.54 s blocks, RA M-1).

Functions 61

func AbortLaunch

crossing Action
1func AbortLaunch(cur realm, cid string)
source

AbortLaunch returns a launched collection to Draft while nothing has been minted — the way out when a beacon never commits. Used commitments stay used.

func BeaconCommit

crossing Action
1func BeaconCommit(cur realm, cid, commitHex string)
source

BeaconCommit is the beacon's commitment, before any token exists.

func Burn

crossing Action
1func Burn(cur realm, cid, tid string)
source

Burn is owner-only. The supply gate uses nextTID, so a burn never reopens a slot (I-5).

func ClaimEngine

crossing Action
1func ClaimEngine(cur realm, id string)
source

ClaimEngine proves the manifest author controls that address. Unclaimed engines cannot back a collection.

func CloseMint

crossing Action
1func CloseMint(cur realm, cid string)
source

CloseMint materializes Closed once the sale window has passed. Anyone may call it; reveals and Finalize work without it.

func CreateCollection

crossing Action
1func CreateCollection(cur realm, creator address, spec types.CollectionSpec) string
source

CreateCollection stores a Draft collection and returns its id. Nobody can mint a Draft, so a creator can configure phases across several messages without a race (OA B2).

func DeprecateEngine

crossing Action
1func DeprecateEngine(cur realm, id string)
source

DeprecateEngine stops new collections; existing ones keep rendering.

func DistributeRoyalties

crossing Action
1func DistributeRoyalties(cur realm, cid string) int64
source

DistributeRoyalties pushes the whole sub-treasury balance to the royalty payees. Permissionless and never paused (I-2); market/v1 calls it after every sale. Returns the amount distributed. The sub-realm banker spend is verified by spike/subtoken, core and market tests on gno v1.7.0.

func EngineManifest

Action
1func EngineManifest(id string) engine.Manifest
source

EngineManifest is the typed read for other realms (gallery).

func EngineStatus

Action
1func EngineStatus(id string) string
source

EngineStatus is "unclaimed", "unverified", "reviewed" or "deprecated".

func EngineTraits

Action
1func EngineTraits(id, params, seed string) []engine.Trait
source

EngineTraits returns a core-owned copy of the engine's traits for seed.

func ExecuteOp

crossing Action
1func ExecuteOp(cur realm, opID string)
source

ExecuteOp applies a proposed op once its timelock has passed. The delay is judged at execution, so an op proposed during bootstrap still waits the full timelock if a collection appeared in the meantime.

func FeeConfig

Action
1func FeeConfig() types.Fees
source

FeeConfig is the typed fee view minters and markets settle with.

func Fees

Action
1func Fees() string
source

Fees is the fee configuration and its hard caps as JSON.

func Finalize

crossing Action
1func Finalize(cur realm, cid string)
source

Finalize is permissionless and never paused (I-2): immediately once every expected secret is revealed, otherwise after revealDeadline (fallback).

func Info

Action
1func Info(cid string) types.CollectionInfo
source

Info is the typed collection view for other realms.

func Launch

crossing Action
1func Launch(cur realm, cid string, l types.LaunchSpec)
source

Launch freezes the configuration (I-6): sale window, reveal window and the creator's commitment. The sale must start in the future so a beacon can commit before the first mint.

func MintTo

crossing Action
1func MintTo(cur realm, cid string, to address, n int64) (first, last int64)
source

MintTo mints n tokens during the sale. The minter has already checked phase, price, allowlist and wallet cap; core re-checks only what it owns: state, supply, beacon commitment, and the lifetime counter (I-5, I-9).

func MintedBy

Action
1func MintedBy(cid string, addr address) int64
source

MintedBy is the lifetime mint counter of addr in cid (OA B3, I-9).

func MintedTotal

Action
1func MintedTotal(cid string) int64
source

MintedTotal counts every token ever minted, burned ones included (OA B4).

func Pause

crossing Action
1func Pause(cur realm, scope string)
source

Pause stops new activity in one scope for at most MaxPauseBlocks. It never blocks exits (I-2).

func Paused

Action
1func Paused(scope string) bool
source

Paused reports whether scope ("create", "mint", "trade") is paused now.

func PrimaryPayees

Action
1func PrimaryPayees(cid string) []types.Payee
source

PrimaryPayees returns a copy of the frozen primary-sale split.

func Provenance

Action
1func Provenance(cid string) string
source

Provenance is the whole record as JSON; secrets and salt stay "" until revealed / final.

func RegisterEngine

crossing Action
1func RegisterEngine(cur realm, e engine.Engine) string
source

RegisterEngine stores the calling realm's engine (I-12 exception: one sample render in the engine's own registration transaction). The record is immutable afterwards except for the claim/deprecate/review flags.

func Render

1func Render(path string) string
source

Render stays minimal in the immutable realm; the browsable gallery is the private, re-deployable gallery realm (design §2.5.7).

func RenderWith

Action
1func RenderWith(id, params, seed string) string
source

RenderWith renders any registered engine for arbitrary params and seed as a data URI — Studio previews and the Verify button.

func ReserveTo

crossing Action
1func ReserveTo(cur realm, cid string, to address, n int64) (first, last int64)
source

ReserveTo mints the creator's reserve before the sale starts. Reserve mints feed the entropy like any mint, appear in Provenance, and do not count toward wallet caps.

func Royalty

Action
1func Royalty(cid string) *royalty.Royalty
source

Royalty publishes the read-only royalty view (EIP-2981 RoyaltyInfo).

func SetPayees

crossing Action
1func SetPayees(cur realm, cid, payees string)
source

SetPayees changes the royalty split after Final. The primary-sale split is frozen with the sale (I-6); the royalty receiver stays the collection's sub-treasury, so third-party markets are unaffected.

func Token

Action
1func Token(cid string) *grc721.Token
source

Token publishes the collection's official *grc721.Token. Its exported methods are reads or teller factories that need the caller's live realm; the ledger itself is never published.

func TokenMoves

Action
1func TokenMoves(cid, tid string) int64
source

TokenMoves is the transfer counter market/v1 pins in a listing (H-2).

func TokenSeed

Action
1func TokenSeed(cid, tid string) string
source

TokenSeed is "" until the collection is Final: no read path can leak the rarity map early.

func TokenState

Action
1func TokenState(cid, tid string) string
source

TokenState is {mintHeight, lastMoveHeight, moves} as JSON.

func TokenTraitList

Action
1func TokenTraitList(cid, tid string) []engine.Trait
source

TokenTraitList is the typed form of TokenTraits for other realms (a copy).

func TokenTraits

Action
1func TokenTraits(cid, tid string) string
source

TokenTraits is [{"trait_type":…,"value":…}] JSON.

func TokenURI

Action
1func TokenURI(cid, tid string) (string, error)
source

TokenURI is a base64 SVG data URI. Before Final every token shows core's neutral placeholder, never engine output (design §4.2).

func TransferCreator

crossing Action
1func TransferCreator(cur realm, cid string, to address)
source

TransferCreator starts a two-step handover (RA M-11).

func VerifyEngine

Action
1func VerifyEngine(id string) bool
source

VerifyEngine re-renders the sample and compares it with the fingerprint stored at registration.

func VerifyProvenance

Action
1func VerifyProvenance(cid string) bool
source

VerifyProvenance recomputes every commitment and the salt from public data. True only for a Final collection whose record is consistent.

Dependencies

Source Files 9