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.

v1 source realm

Package mint is the platform's first minter (design §2.5.3): sale phases, fixed price or Dutch auction, live and merk...

Overview

Package mint is the platform's first minter (design §2.5.3): sale phases, fixed price or Dutch auction, live and merkle allowlists, lifetime wallet caps, and payment settlement. It is replaceable: core binds each collection to the minter that created it, so a future mint/v2 serves new collections without touching sales in progress.

Creator flow (one multi-message transaction from the frontend; safety does not depend on atomicity because nobody can mint a Draft):

Example
1Create -> AddPhase x1..3 -> Launch

Collector flow: Mint, with Price / Phases / Eligible as the read side.

Constants 2

const MaxSetLen, MaxSetTerms

1const (
2	MaxSetLen   = 512
3	MaxSetTerms = 4
4)
source

Allowlist sets (design §4.6). A phase's set is a comma-separated union of terms; an address is eligible if any term admits it:

Example
1users             registered in r/sys/users (live check)
2validators        in the active validator set (live check)
3holders:<cid>     holds a token of collection <cid>
4merkle:<root>     in a sha256 merkle tree; the minter passes the proof

A term may carry "|"-separated provenance notes for humans, e.g. "merkle:<root>|src:<git-sha>|data:<sha256>"; notes never affect logic.

Functions 11

func Abort

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

Abort returns a launched collection with no mints to Draft (core rules).

func AddPhase

crossing Action
1func AddPhase(cur realm, cid, kind, set string,
2	startHeight, endHeight, startPrice, floorPrice, stepBlocks, stepAmount, walletCap int64,
3)
source

AddPhase appends a sale phase. Phases are ordered and do not overlap. kind is "allow" (set required) or "public" (set empty); a fixed price has startPrice == floorPrice and zero steps; walletCap 0 means no cap.

func ClearPhases

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

ClearPhases removes every phase of a Draft.

func Create

crossing Action
1func Create(cur realm, name, symbol, description, engineID, params string,
2	maxSupply, royaltyBps int64, primaryPayees, royaltyPayees, expectedCID string,
3) string
source

Create opens a Draft collection for the calling wallet and pays the protocol's create fee from the attached ugnot (excess refunded). Empty payee strings default to "creator:10000". expectedCID, when set, makes the transaction fail instead of creating a different id than the frontend showed (OA B2).

func Eligible

Action
1func Eligible(cid string, addr address, proof string) string
source

Eligible answers "can addr mint now, and how many?" with the same checks Mint runs, so the UI never disagrees with the chain (OA B3). JSON: {phase, kind, eligible, reason, remainingCap (-1 = no cap), price}.

func Launch

crossing Action
1func Launch(cur realm, cid, creatorCommit string, revealWindow int64, useBeacon bool)
source

Launch freezes the sale. creatorCommit is safe.Commit(chainID, cid, "creator", secret), computed off-chain — never send the secret to a node before reveal.

func Mint

crossing Action
1func Mint(cur realm, cid string, count, maxUnitPrice int64, proof string) string
source

Mint buys count tokens in the phase open at this block, at that block's unit price, never above maxUnitPrice (a Dutch step cannot surprise the buyer). proof is the merkle proof for merkle sets, otherwise "". Returns "first-last". Every attached unit is paid out or refunded (I-3, I-4).

func Price

Action
1func Price(cid string, h int64) int64
source

Price is the unit price at height h, or -1 when no phase covers h.

func Reserve

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

Reserve mints the creator's reserve to the creator before the sale.

Dependencies

Source Files 4