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.

upload source realm

Package upload is the engine/v1 adapter for uploaded collections (docs/uploaded-collections.md §5.3, §7–§10, §0a). Co...

Overview

Package upload is the engine/v1 adapter for uploaded collections (docs/uploaded-collections.md §5.3, §7–§10, §0a). Core knows it as one more engine; each collection's params name one sealed asset store ("store:<id>", r/…/assets/v1) and Bind locks that store to the collection while it is a Draft. After the reveal every token shows the artwork of the slot a salt-keyed permutation gives it.

What holds, and why:

  • art theft (T1): ValidateParams accepts a store only when its owner signs the Create tx; Bind needs caller == collection creator == store owner, from a wallet;
  • no swap after sale (T2): stores are sealed before Bind and never change; params are fixed by core; Bind and Unbind run only while core says Draft, i.e. before any token was ever minted;
  • one collection per store (T3); slots == maxSupply (T13);
  • snipe resistance (T4/T5): before Final core shows its placeholder and never calls Render/Traits; every read here checks Final too; the assignment needs the final salt; Render answers core's real call only (CollectionID, params and seed must match core's), so RenderWith (CollectionID "0") always gets the generic card;
  • SA-L5: this realm and assets/v1 may not be payees (Bind refuses);
  • I-12: Render, Traits and ValidateParams only read; Bind, Unbind and Settle are crossing functions; there is no exported non-crossing mutator.

The adapter is stateful by design (bindings and cached keys), declares Living false, takes no fee (D3) and holds no coins.

Constants 4

const TraitTier, TraitArtwork, TraitEdition, TraitStorage, TraitSlots

1const (
2	TraitTier    = "Creator tier"
3	TraitArtwork = "Artwork"
4	TraitEdition = "Edition"
5	TraitStorage = "Storage"
6	TraitSlots   = assets.MaxTraitTypes
7)
source

Core-path trait slots (engine/v1 manifests fix their trait types at registration, so creator trait types appear as "Trait k" = "<Type>: <Value>").

const MaxTraitsBatch, MaxTraitJSONLists, MaxTraitLists, MaxTraitCounts

1const (
2	MaxTraitsBatch    = 20  // JSON (was 50)
3	MaxTraitJSONLists = 20  // typed, JSON per token (reader.Cards)
4	MaxTraitLists     = 250 // typed (was 500)
5	MaxTraitCounts    = 200 // TraitCounts (reader.TraitCounts)
6)
source

MaxTraitsBatch bounds TraitsBatch (JSON); MaxTraitLists bounds the typed TraitLists the reader pages rarity counts with. Both compute the permutation key once per call (§0a), never per token. Sized so the worst store the asset limits allow stays <= 1B test gas per call (review UP-M1; r/reader/zz_worst_gas_test.gno).

const FeeBps

1const FeeBps = 0
source

FeeBps is the engine-author fee (D3: none; fixed forever at Register).

Functions 24

func Assignment

Action
1func Assignment(cid, tid string) (ready bool, slot, edition int64, a media.Artwork)
source

Assignment is the typed TokenArtwork for other realms (gallery): ready is false before Final or when the collection is not ready; a is a copy.

func Bind

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

Bind locks the collection's store (its params "store:<id>") to the collection. Caller == core creator == store owner, from a wallet; core state Draft; the collection uses this engine; the store is sealed and not bound elsewhere; maxSupply == the store's slots; no primary or royalty payee is this realm or assets/v1 (SA-L5). Event StoreBound{store, cid}.

func IsUpload

Action
1func IsUpload(cid string) bool
source

IsUpload reports whether cid's engine is this adapter.

func Readiness

Action
1func Readiness(cid string) (ready bool, reason, store, badge string)
source

Readiness is the typed Status for other realms.

func Register

crossing Action
1func Register(cur realm) string
source

Register is an explicit call (not init: under the inert package policy init runs in the approver's tx). Anyone may call it, once.

func Render

1func Render(path string) string
source

Render stays minimal; uploaded collections are browsed in the gallery.

func SelfPath

Action
1func SelfPath() string
source

SelfPath and AssetsPath are the engine id and the store realm it reads.

func SetComposition

Action
1func SetComposition(cid string) string
source

SetComposition is {collection, store, ready, reason, set}, set = assets.Composition of the collection's store: slots per tier and per trait value over the planned set (public and fixed before the sale, D8).

func Settle

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

Settle caches the permutation key once the collection is Final. Anyone may call it; it is deterministic (the salt is final) and idempotent, and it only saves read gas: the lazy path computes the same key. Event Settled{cid, key} (first call only).

func Status

Action
1func Status(cid string) string
source

Status is {cid, upload, state, store, bound, ready, reason, badge, settled, maxSupply, slots}. The frontend shows the mint UI only when ready (T14).

func StorageBadge

Action
1func StorageBadge(cid string) string
source

StorageBadge is "computed" (any other engine), "onchain", "ipfs", "mixed", or "unbound" for an upload collection that is not ready (§9).

func StoreOf

Action
1func StoreOf(cid string) string
source

StoreOf is the store named by cid's params ("" if none).

func TokenArtwork

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

TokenArtwork is the token's assignment as JSON: {collection, tid, revealed, ready, reason} and, once revealed and ready, {store, artwork, slot, edition, editions, assignment, kind, mime, mimeType, size, sha256, digest, cid, uri, tier, tierSource, title, traits}. uri is "ipfs://<cid>" for IPFS art and "" for on-chain art (read its bytes with TokenImage / TokenURI: base64 of up to 256 KiB is not free).

func TokenImage

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

TokenImage is the inline image: a data URI for on-chain art, "" for IPFS art (never a remote URL); core's placeholder before Final.

func TokenMetadata

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

TokenMetadata is the canonical metadata (§10.2). Before Final: core's placeholder image and [{Status: Unrevealed}].

func TokenTraitList

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

TokenTraitList is the typed real-name trait list of one token (a copy).

func TokenTraits

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

TokenTraits is TokenTraitList as [{"trait_type","value"}] JSON.

func TokenURI

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

TokenURI is the canonical art URI: "data:<mime>;base64,…" for on-chain art, "ipfs://<cidv1>" for IPFS art; core's placeholder before Final and core's TokenURI (the generic card) for a collection that is not ready.

func TraitCounts

Action
1func TraitCounts(cid string, offset, limit int64) string
source

TraitCounts is {"n": tokens counted, "counts": {type: {value: count}}} over tokens offset+1 … offset+limit (limit <= MaxTraitCounts, burned skipped), with the creator's real names: Tier, the creator's trait types (store order, values in dictionary order), Edition, Storage. Before Final every token counts as {"Status": "Unrevealed"}, Final but not ready as {"Status": "Not ready"}. One permutation key per call; the counting runs in assets/v1 over integer ids (review UP-M1).

func TraitJSONLists

Action
1func TraitJSONLists(cid string, offset, limit int64) ([]string, []string)
source

TraitJSONLists is TraitLists with each token's traits as a JSON array (the bytes TokenTraits returns), for pages that print them (reader.Cards). limit <= MaxTraitJSONLists.

func TraitLists

Action
1func TraitLists(cid string, offset, limit int64) ([]string, [][]engine.Trait)
source

TraitLists returns, for tokens offset+1 … offset+limit (limit <= MaxTraitLists, burned tokens skipped), the token ids and their real-name traits. The permutation key is computed once per call.

func TraitsBatch

Action
1func TraitsBatch(cid string, offset, limit int64) string
source

TraitsBatch is [{tid, traits:[{trait_type, value}]}] for tokens offset+1 … offset+limit (limit <= MaxTraitsBatch), burned tokens skipped.

func Unbind

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

Unbind releases the store while the collection is still a Draft. Creator only. Event StoreUnbound{store, cid}.

Dependencies

Source Files 4