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

padv9 source realm

Package pad is gnomemepad: a self-contained meme launchpad for gno.land.

Overview

Package pad is gnomemepad: a self-contained meme launchpad for gno.land.

Example
1Create → GRC20 + bonding curve → Graduate
2  → remaining tokens + raised GNOT seed liquidity
3  → auto Gnoswap CreatePool + full-range Mint when pad has WUGNOT inventory
4    (part of inventory swaps WUGNOT→GNS for CreatePool fee)
5  → else locked internal CPMM fallback (test / missing inventory)

Tokens are real GRC20 (mint on buy, burn on sell). Hybrid of Pump.fun + permanent LP lock.

Constants 1

const TotalSupply, CurveSupply, PoolSeed, VirtualUgnot0, VirtualToken0, GraduationThreshold, FeeBPS, CreatorFeeShareBPS, ProtocolFeeShareBPS, CreateBondUgnot, BondRefundBuyers, BondRefundMinRaised, BondRefundMaxHeights, AntiSnipeHeights, AntiSnipeMaxBuyBPS, StatusCurve, StatusGraduated, MaxTradeHistory, TradeSideBuy, TradeSideSell, TradeSideOpen, DenomUgnot, GnoswapFeeTier, GnoswapTickSpacing, GnoswapMinTick, GnoswapMaxTick, GnoswapMaxFeeWugnot

 1const (
 2	// Token economics
 3	TotalSupply int64 = 1_000_000_000
 4	CurveSupply int64 = 800_000_000 // sold on bonding curve
 5	// PoolSeed is legacy: graduation seeds LP with ALL remaining tokens
 6	// (TotalSupply - RealSold), not a fixed 200M reserve.
 7	PoolSeed int64 = 200_000_000
 8
 9	// Virtual constant-product seed (Pump-style)
10	VirtualUgnot0 int64 = 30_000_000    // 30 GNOT virtual
11	VirtualToken0 int64 = 1_073_000_191 // virtual token side
12
13	// Graduation when net ugnot raised into the curve reaches this.
14	// Sapphire deploy patches to 100 GNOT.
15	// Keep below the ugnot needed to exhaust CurveSupply on the virtual CPMM.
16	GraduationThreshold int64 = 100_000_000
17
18	// Fees: 1.20% total. Of the fee: 40% creator, 40% protocol, 20% LP/k remainder.
19	FeeBPS              int64 = 120
20	CreatorFeeShareBPS  int64 = 4000
21	ProtocolFeeShareBPS int64 = 4000
22
23	// Fallback create bond for unit tests / if bond realm unavailable.
24	// Production pad uses createbond.CurrentBondUgnot() (see bond package).
25	// Sapphire normal bond = 2 GNOT; promo ≈ $20 in ugnot set on bond.StartPromo.
26	CreateBondUgnot      int64 = 2_000_000
27	BondRefundBuyers     int   = 5
28	BondRefundMinRaised  int64 = 10_000_000 // ≥5 GNOT raised
29	BondRefundMaxHeights int64 = 100_000
30
31	// Anti-snipe: first N heights, max cumulative tokens per address (BPS of TotalSupply).
32	AntiSnipeHeights   int64 = 30
33	AntiSnipeMaxBuyBPS int64 = 300 // 5% per address in window
34
35	// Status
36	StatusCurve     = 0
37	StatusGraduated = 1
38
39	// Trade history ring buffer.
40	MaxTradeHistory = 256
41	// Trade sides stored in history
42	TradeSideBuy  = 0
43	TradeSideSell = 1
44	TradeSideOpen = 2 // initial listing mark
45
46	DenomUgnot = "ugnot"
47
48	// --- Gnoswap auto-list (Sapphire) ---
49	// CreatePool fee is fixed in GNS (pool.GetPoolCreationFee, typically 100e6 = 100 GNS).
50	// GNOT cost of that fee MOVES with market (~10 GNOT/GNS on Sapphire probe → ~1000 GNOT/listing).
51	//
52	// Funding model (price-safe):
53	//   LP  = raised-sized WUGNOT (protected — never sold for fee)
54	//   Fee = pre-funded GNS on pad  OR  surplus WUGNOT above raised (ExactOut → GNS)
55	// wugnot.Deposit is EOA-only — protocol wraps off-pad and transfers inventory in.
56	GnoswapFeeTier     uint32 = 3000 // 0.3% meme tier
57	GnoswapTickSpacing int32  = 60
58	GnoswapMinTick     int32  = -887272
59	GnoswapMaxTick     int32  = 887272
60	// Max WUGNOT (ugnot units) allowed for ExactOut fee buy — price ceiling / slippage cap.
61	// Not tied to raised/2. At ~10 GNOT/GNS, 100 GNS needs ~1006 GNOT; 5000 leaves headroom
62	// if GNS becomes ~5× more expensive vs GNOT. Prefer pre-funding GNS to skip this path.
63	GnoswapMaxFeeWugnot int64 = 5_000_000_000 // 5000 GNOT
64)
source

Functions 46

func AdenaPathOf

Action
1func AdenaPathOf(id string) string
source

AdenaPathOf returns the grc20reg / Adena token key: packagePath.SYMBOL (Token.ID is packagePath.SYMBOL.seq — Adena rejects that form).

func AdminInfo

Action
1func AdminInfo() string
source

AdminInfo is a single-line dashboard snapshot for the ops UI:

Example
1protocolAddr|pendingFees|paidFees|reservedUgnot|launchCount|pointsOn|inited|padAddr

pointsOn/inited are 0|1.

func Approve

crossing Action
1func Approve(cur realm, id string, spender address, amount int64)
source

Approve sets GRC20 allowance so DEX/contracts can TransferFrom.

func Buy

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

Buy spends -send ugnot on the bonding curve; credits tokens to the caller. minTokensOut: slippage floor (0 = disabled). Auto-graduates at threshold. If the buy would exceed remaining curve supply, the last tokens are filled and excess ugnot is refunded (so users can "fill the curve" without exact amount).

func ClaimCreatorFees

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

ClaimCreatorFees withdraws accrued creator fees for a launch. Only the token creator may claim. Fees stay on pad until claimed.

func ClaimProtocolFees

crossing Action
1func ClaimProtocolFees(cur realm) int64
source

ClaimProtocolFees withdraws pending protocol fees to protocolAddr. Only the current protocol treasury key may call (same wallet that Init'd, unless TransferProtocol was used).

func Create

crossing Action
1func Create(cur realm, name, symbol, uri string) string
source

Create deploys a fair-launch meme. Bond amount from bond realm (or fallback const). No pre-mint; all tradeable float starts on the bonding curve.

func FeeInfo

Action
1func FeeInfo() string
source

FeeInfo returns protocolAddr|pendingUgnot|paidUgnot for UIs.

func GRC20Bank

Action
1func GRC20Bank(id string) *grc20.Token
source

GRC20Bank returns the underlying *grc20.Token for interop (metadata / external DEX). Does not expose PrivateLedger — mint/burn stay pad-only.

func Graduate

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

Graduate permissionlessly moves a ready curve into a permanently locked CPMM.

func Init

crossing Action
1func Init(cur realm)
source

Init sets the protocol treasury. First EOA caller becomes fee recipient (protocolAddr). Protocol trade fees accrue on-pad until ClaimProtocolFees (treasury only) or PushProtocolFees (anyone may push to treasury). Creator fees always need ClaimCreatorFees by the token creator.

Deploy note: call Init with the wallet that should receive protocol fees (or TransferProtocol later). Gnoswap CreatePool GNS fee is paid to Gnoswap, not to this treasury.

func IsProtocol

Action
1func IsProtocol(addr string) bool
source

IsProtocol reports whether addr is the current treasury (for UI gating).

func LaunchInfo

Action
1func LaunchInfo(id string) string
source

LaunchInfo returns a single-line pipe-delimited summary for UIs/indexers:

Example
1id|name|symbol|status|raised|sold|buyers|creatorFees|poolUgnot|poolToken|uri|creator|virtualUgnot|virtualToken|created|tokenID|gnoswapReady|gnoswapListed|gnoswapPoolPath

status: 0=curve 1=graduated; gnoswapReady/listed: 0|1

func ListBuyers

Action
1func ListBuyers(id string) string
source

ListBuyers returns unique buyer addresses (one per line), capped for query size. Only addresses that bought at least once on this pad (UniqueBuyers). Not full GRC20 holders who received tokens via transfer.

func ListIDs

Action
1func ListIDs() string
source

ListIDs returns newline-separated launch IDs (sorted by AVL key / creation order).

func PadAddress

Action
1func PadAddress() string
source

PadAddress returns this pad realm's bech32 package address (fund WUGNOT here).

func ParamsInfo

Action
1func ParamsInfo() string
source

ParamsInfo returns parameters for UI display. total|curve|poolSeed|gradThreshold|feeBps|createBond createBond is live from bond realm when not in unit-test mode.

func PointsEnabled

Action
1func PointsEnabled() bool
source

PointsEnabled reports whether pad notifies pointsv2 after trades/creates.

func PushProtocolFees

crossing Action
1func PushProtocolFees(cur realm) int64
source

PushProtocolFees sends pending protocol fees to protocolAddr. Permissionless: anyone may call so treasury can be paid without the protocol key signing (still only pays the configured protocolAddr).

func Render

1func Render(path string) string
source

Render provides on-chain discovery (gnoweb). Read-only by convention.

Paths:

Example
1""              — home / list
2token/{id}      — launch detail
3help            — API help

func Sell

crossing Action
1func Sell(cur realm, id string, tokensIn, minUgnotOut int64) int64
source

Sell burns curve tokens and pays ugnot (fee on output). minUgnotOut: slippage floor (0 = disabled).

func SetPointsEnabled

crossing Action
1func SetPointsEnabled(cur realm, on bool)
source

SetPointsEnabled toggles pointsv2 notifications (protocol admin only). pointsv2 must AllowPad(this package path) or OnTrade/OnCreate will panic and revert the trade.

func SwapBuy

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

SwapBuy buys tokens from the graduated pool with -send ugnot. minTokensOut: slippage floor (0 = disabled). Disabled when the launch was auto-listed on Gnoswap (trade there instead).

func SwapSell

crossing Action
1func SwapSell(cur realm, id string, tokensIn, minUgnotOut int64) int64
source

SwapSell sells tokens into the graduated pool for ugnot. minUgnotOut: slippage floor (0 = disabled).

func TokenIDOf

Action
1func TokenIDOf(id string) string
source

TokenIDOf returns the GRC20 Token.ID() for a launch.

func TradeCount

Action
1func TradeCount(id string) int
source

TradeCount returns number of stored chart samples for a launch.

func TradeHistory

Action
1func TradeHistory(id string) string
source

TradeHistory returns newline-separated chart points:

Example
1height|side|ugnot|tokens|priceScaled

side: 0=buy 1=sell 2=open/graduate. Ordered oldest → newest.

func Transfer

crossing Action
1func Transfer(cur realm, id string, to address, amount int64)
source

Transfer moves GRC20 tokens between addresses (user-initiated).

func TransferFrom

crossing Action
1func TransferFrom(cur realm, id string, from, to address, amount int64)
source

TransferFrom spends allowance: spender = MsgCall EOA caller. Enables DEX / routers that hold allowance from Approve.

func TransferProtocol

crossing Action
1func TransferProtocol(cur realm, newAddr address)
source

TransferProtocol rotates the protocol fee recipient (current protocol only). Pending protocolFees stay on pad until claimed/pushed to the *new* address.

func WithdrawProtocolUgnot

crossing Action
1func WithdrawProtocolUgnot(cur realm, amount int64) int64
source

WithdrawProtocolUgnot lets the treasury pull free ugnot from the pad bank (e.g. raised backlog after Gnoswap list, to re-wrap as WUGNOT inventory). Capped by free balance; panics if amount > free.

Types 2

type Launch

struct
 1type Launch struct {
 2	ID      string
 3	Name    string
 4	Symbol  string
 5	URI     string
 6	Creator address
 7	Status  int
 8	Created int64 // block height
 9
10	// GRC20 (mint/burn only via pad-owned private ledger)
11	token   *grc20.Token
12	ledger  *grc20.PrivateLedger
13	TokenID string // Token.ID() — registry / Gnoswap identity
14
15	// Virtual curve reserves
16	VirtualUgnot int64
17	VirtualToken int64
18	RealSold     int64 // tokens sold on curve (≤ CurveSupply)
19	RaisedUgnot  int64 // net ugnot collateral in curve (excl. fee vaults)
20
21	// Real pool (post-grad); LP permanently locked — no remove path
22	// PoolToken is pad-internal reserve (not the same as GRC20 total supply).
23	PoolUgnot int64
24	PoolToken int64
25
26	CreatorFees  int64
27	BondUgnot    int64
28	BondRefunded bool
29	UniqueBuyers avl.Tree // address -> true
30	BuyerCount   int
31	// snipeBought: address -> cumulative tokens bought during anti-snipe window
32	snipeBought avl.Tree
33
34	// Gnoswap listing state
35	GnoswapReady      bool   // graduated; token is listable / listed
36	GnoswapListed     bool   // true when CreatePool+Mint succeeded on Gnoswap
37	GnoswapNote       string // human status / failure reason
38	GnoswapPoolPath   string
39	GnoswapPositionID uint64
40	// FeeWugnotSpent / LiqWugnotUsed: inventory spent at graduate (1:1 vs raised ugnot notionally)
41	FeeWugnotSpent int64
42	LiqWugnotUsed  int64
43
44	// Chart history (ordered AVL keys)
45	Trades    avl.Tree // tradeKey -> *Trade
46	NextTrade int64
47}
source

Launch is one meme market: curve phase then locked pool phase. token/ledger are unexported so external packages cannot Mint/Burn via field access.

type Trade

struct
1type Trade struct {
2	Height int64
3	Side   int // TradeSideBuy | TradeSideSell | TradeSideOpen
4	Ugnot  int64
5	Tokens int64
6	Price  int64 // ugnot per token * 1e6 after the trade
7}
source

Trade is one price sample for charts (capped history per launch).

Imports 22

Source Files 5