Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v1 source realm

Package sales owns launch token custody, direct-creation allocations, fair sales and airdrops. Quote that reaches it ...

Overview

Package sales owns launch token custody, direct-creation allocations, fair sales and airdrops. Quote that reaches it through its entry points is owed to someone on record: buyers (escrow and refunds), creators (settled proceeds) or the protocol (fees). Coins sent to it any other way are owed to no one and never leave. It has no admin and no emergency withdrawal path.

Functions 33

func CancelFairSale

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

CancelFairSale returns the entire unsold allocation to its creator while there are no contributions. It remains callable if the new-sale lane is paused or the quote currency has since been delisted. The creation fee is not returned.

func ClaimAirdrop

crossing Action
1func ClaimAirdrop(cur realm, id string, index int, beneficiary address, amount int64, proof string)
source

ClaimAirdrop remains available while the airdrop lane is paused. Anyone can submit a proof; the destination is always the leaf's beneficiary. A leaf whose beneficiary is not written as the chain writes a caller's address can never be claimed: the token ledger would credit a balance no caller can reach.

func ClaimFair

crossing Action
1func ClaimFair(cur realm, id string, buyer address)
source

ClaimFair lets anyone release a buyer's recorded tokens and quote refund to that buyer. Claims never expire and ignore current pause/listing.

func ClaimVested

crossing Action
1func ClaimVested(cur realm, id string, index int) int64
source

ClaimVested remains open even when the direct-launch lane is paused. Anyone may trigger release, but the destination is always the recorded beneficiary. This also permits a realm beneficiary to receive its vested tokens.

func ContributeFair

crossing Action
1func ContributeFair(cur realm, id string, lots, maxDeposit int64)
source

ContributeFair escrows exact quote atoms for whole token lots at this transaction's schedule price. The direct caller is both payer and buyer, and maxDeposit is the most the order may cost. A native order attaches exactly maxDeposit and gets maxDeposit minus the cost back in the same transaction; a token order pulls only the cost from the buyer's allowance.

func ContributeFairWithProof

crossing Action
1func ContributeFairWithProof(cur realm, id string, lots, maxDeposit int64, proof string)
source

ContributeFairWithProof verifies the recorded allowlist and holding gates against the direct buyer's live address and balances before collecting quote.

func CreateAirdrop

crossing Action
1func CreateAirdrop(cur realm, id, root string, total int64)
source

CreateAirdrop funds one immutable campaign for a token from its creator's allowance. Its Merkle leaves are sha256(0x00 || "launchpad-airdrop-v1|<token-id>|<index>|<beneficiary>|<amount>"). The token ID in every leaf prevents a proof from authorizing a claim on a different launch, even if two creators publish the same tree shape.

func CreateDirect

crossing Action
1func CreateDirect(cur realm, mode, name, ticker string, decimals int,
2	initialSupply, maxSupply int64, currencyKey string, expectedVersion int64,
3	description, image, website, xHandle, telegram, allocations string) string
source

CreateDirect creates a direct token without an initial airdrop. The allocation string is parsed and the whole amount partitioned before any payment. The caller, payer and initial mint's creator are the same live direct user.

func CreateDirectWithAirdrop

crossing Action
1func CreateDirectWithAirdrop(cur realm, mode, name, ticker string, decimals int,
2	initialSupply, maxSupply int64, currencyKey string, expectedVersion int64,
3	description, image, website, xHandle, telegram, allocations,
4	expectedID, airdropRoot string, airdropTotal int64) string
source

CreateDirectWithAirdrop reserves part of the initial mint for one Merkle campaign. The caller commits to the next token ID used in every leaf. If another launch takes that ID first, this transaction rejects before payment.

func CreateFairSale

crossing Action
1func CreateFairSale(cur realm, name, ticker string, decimals int,
2	initialSupply, saleAllocation, lotSize, hardLots, walletCapLots, softQuote int64,
3	quoteCurrency string, expectedVersion int64,
4	start, end, startPrice, floorPrice, decrement, intervalSeconds int64,
5	description, image, website, xHandle, telegram string) string
source

CreateFairSale mints a fixed-supply fair-sale token and encumbers its whole- lot allocation in sales custody. The creator receives the initial supply remainder.

func CreateFairSaleFromToken

crossing Action
1func CreateFairSaleFromToken(cur realm, id string,
2	saleAllocation, lotSize, hardLots, walletCapLots, softQuote int64,
3	quoteCurrency string, expectedVersion int64,
4	start, end, startPrice, floorPrice, decrement, intervalSeconds int64)
source

CreateFairSaleFromToken locks an existing direct token's exact creator-funded allocation. Other token liabilities remain encumbered in the same custody balance. One token can have at most one fair sale.

func CreateGatedFairSale

crossing Action
1func CreateGatedFairSale(cur realm, name, ticker string, decimals int,
2	initialSupply, saleAllocation, lotSize, hardLots, walletCapLots, softQuote int64,
3	quoteCurrency string, expectedVersion int64,
4	start, end, startPrice, floorPrice, decrement, intervalSeconds int64,
5	description, image, website, xHandle, telegram,
6	expectedID, allowlistRoot, holdingGates string) string
source

CreateGatedFairSale binds a precomputed token ID to a Merkle root and/or token-holding gates. The expected ID prevents an intervening creation from silently attaching the root to a different token.

func CreateGatedFairSaleFromToken

crossing Action
1func CreateGatedFairSaleFromToken(cur realm, id string,
2	saleAllocation, lotSize, hardLots, walletCapLots, softQuote int64,
3	quoteCurrency string, expectedVersion int64,
4	start, end, startPrice, floorPrice, decrement, intervalSeconds int64,
5	allowlistRoot, holdingGates string)
source

func FairBuyerJSON

Action
1func FairBuyerJSON(id string, buyer address) string
source

FairBuyerJSON is one buyer's record in a sale and, once the sale is settled and until the buyer is paid, what ClaimFair would send them. Before settlement both amounts are 0 and settled is false: settle first.

func LaunchJSON

Action
1func LaunchJSON(id string) string
source

LaunchJSON is a token's launch state: the ledger's record of the token, what sales still owes in it, how many vesting records it has, and its fair sale and airdrop campaign, each null when the token has none.

func MintCappedAllocated

crossing Action
1func MintCappedAllocated(cur realm, id string, amount int64, allocations string)
source

MintCappedAllocated requires the token's current mint authority to be the immediate user or realm caller. Every new unit is assigned to an immediate or vested allocation; there is no implicit receiver or unrecorded sales balance. No additional creation fee is charged, and attached native coins are rejected. Pausing the direct lane stops new mints without blocking claims.

func ProposeVestingBeneficiary

crossing Action
1func ProposeVestingBeneficiary(cur realm, id string, index int, next address)
source

ProposeVestingBeneficiary is callable by the current beneficiary, including a beneficiary realm. A pending move freezes claims until acceptance or cancellation, so the old beneficiary cannot drain accrued entitlement.

func ReleaseFairProceeds

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

ReleaseFairProceeds pays a succeeded sale's creator what settlement recorded for them, once, and returns the amount. Anyone can call it; the receiver is always the recorded creator. It stays open while the lane is paused or the currency delisted.

func RevokeVesting

crossing Action
1func RevokeVesting(cur realm, id string, index int) int64
source

RevokeVesting returns only unvested tokens to the original creator. The beneficiary retains its accrued vested entitlement and claim right.

func SettleFair

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

SettleFair closes a sale at its recorded hard-cap fill or scheduled end. It returns every unsold token to the creator and partitions deposits into buyer refunds, the creator's proceeds and the protocol's primary fee. The fee joins the bucket SweepFees pays; nothing is paid out here, so neither receiver can hold up settlement or buyer claims.

func SolvencyJSON

Action
1func SolvencyJSON(currencyKey string) string
source

SolvencyJSON is the realm's books in one currency: the balance it holds and what it owes, in total and by liability. fees is what SweepFees would pay now. Every movement of quote ends with balance >= owed, so a watcher that sees otherwise has found a fault; what the balance holds above owed was sent outside the entry points and is owed to no one. An empty key or one over 200 bytes panics "invalid currency"; a key that is neither ugnot nor a registered GRC20 aborts in the registry ("unknown token").

func SweepFees

crossing Action
1func SweepFees(cur realm, currencyKey string) int64
source

SweepFees pays every fee recorded in one currency, creation fees and fair-sale primary fees alike, to the treasury of the current config, and returns the amount. Anyone can call it; the caller chooses neither the receiver nor the amount. A fee is only ever recorded once a treasury is named, and config never lets the treasury be removed.

func TermsJSON

Action
1func TermsJSON(currencyKey string) string
source

TermsJSON is what launching a token in a currency costs under the current config version: the fee a direct creation and a fair-sale creation attach, exactly; the most one fair sale may raise; and the primary fee a new sale pins. A fee of -1 means the currency has no terms. A creation names this version, so if the terms change before it lands it fails with "config changed" and takes nothing. Whether a lane takes new launches now is config's ActionStatusJSON.

func VestingJSON

Action
1func VestingJSON(id string, index int) string
source

VestingJSON is one vesting record: its schedule, who holds the claim right and who has been proposed to take it.

Types 4

type AirdropRecord

struct
1type AirdropRecord struct {
2	Root    string
3	Total   int64
4	Claimed int64
5}
source

AirdropRecord keeps the whole funded allocation encumbered until recipients claim. Claims never expire, and nothing sweeps or returns an unclaimed remainder.

type FairSaleRecord

struct
 1type FairSaleRecord struct {
 2	Creator          address
 3	QuoteCurrency    string
 4	ConfigVersion    int64
 5	PrimaryFeeBPS    int64
 6	Allocation       int64
 7	LotSize          int64
 8	WalletCapLots    int64
 9	Caps             fairmath.Caps
10	Schedule         fairmath.Schedule
11	AllowlistRoot    string
12	HoldingGates     string
13	TotalLots        int64
14	TotalDeposits    int64
15	HardClosedAt     int64
16	Cancelled        bool
17	Settled          bool
18	Succeeded        bool
19	CloseAt          int64
20	ClosePrice       int64
21	SoldTokens       int64
22	GrossQuote       int64
23	CreatorQuote     int64
24	ProceedsReleased bool
25	RefundQuote      int64
26	UnsoldTokens     int64
27	RefundPaid       int64
28	TokensClaimed    int64
29}
source

FairSaleRecord fixes the sale terms and records funded whole-lot orders. Settlement splits GrossQuote into the primary fee, owed to the protocol, and CreatorQuote, owed to the creator: the fee is GrossQuote minus CreatorQuote. RefundPaid and TokensClaimed count what buyer claims have taken out of this sale, so no claim can pay more than the sale itself owes.

type VestingRecord

struct
 1type VestingRecord struct {
 2	Beneficiary        address
 3	PendingBeneficiary address
 4	Total              int64
 5	Claimed            int64
 6	Start              int64
 7	Cliff              int64
 8	Duration           int64
 9	Revocable          bool
10	Revoked            bool
11	RevokedVested      int64
12}
source

Imports 15

Source Files 8