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

padv5 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.

Direction A — factory IS the market (no external AMM required for MVP):

Example
1Create → GRC20 token + bonding curve → Graduate (atomic locked CPMM)
2→ GRC20 is listable on Gnoswap (external DEX); pad keeps locked pool too

Tokens are real GRC20 (mint on buy, burn on sell) so holders can transfer and later provide liquidity on Gnoswap. 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

 1const (
 2	// Token economics
 3	TotalSupply int64 = 1_000_000_000
 4	CurveSupply int64 = 800_000_000 // sold on bonding curve
 5	PoolSeed    int64 = 200_000_000 // locked into CPMM at graduation
 6
 7	// Virtual constant-product seed (Pump-style)
 8	VirtualUgnot0 int64 = 30_000_000    // 30 GNOT virtual
 9	VirtualToken0 int64 = 1_073_000_191 // virtual token side
10
11	// Graduation when net ugnot raised into the curve reaches this.
12	// padv4 testnet default: 50 GNOT. padv5 deploy script patches to 100 GNOT.
13	// Keep below the ugnot needed to exhaust CurveSupply on the virtual CPMM.
14	GraduationThreshold int64 = 100_000_000
15
16	// Fees: 1.20% total. Of the fee: 40% creator, 40% protocol, 20% LP/k remainder.
17	FeeBPS              int64 = 120
18	CreatorFeeShareBPS  int64 = 4000
19	ProtocolFeeShareBPS int64 = 4000
20
21	// Anti-spam create bond (1 GNOT padv4). padv5 deploy patches to 2 GNOT.
22	CreateBondUgnot      int64 = 2_000_000
23	BondRefundBuyers     int   = 5
24	BondRefundMinRaised  int64 = 10_000_000 // ≥5 GNOT raised
25	BondRefundMaxHeights int64 = 100_000
26
27	// Anti-snipe: first N heights, max cumulative tokens per address (BPS of TotalSupply).
28	AntiSnipeHeights   int64 = 30
29	AntiSnipeMaxBuyBPS int64 = 300 // 5% per address in window
30
31	// Status
32	StatusCurve     = 0
33	StatusGraduated = 1
34
35	// Trade history ring buffer (padv4: 128; padv5 deploy patches to 256).
36	MaxTradeHistory = 256
37	// Trade sides stored in history
38	TradeSideBuy  = 0
39	TradeSideSell = 1
40	TradeSideOpen = 2 // initial listing mark
41
42	DenomUgnot = "ugnot"
43)
source

Functions 31

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 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. Oversized buys that would exceed remaining curve supply panic (no silent dust).

func ClaimCreatorFees

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

ClaimCreatorFees withdraws accrued creator fees for a launch.

func Create

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

Create deploys a fair-launch meme. Requires CreateBondUgnot via -send. No pre-mint; all tradeable float starts on the bonding curve.

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.

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

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

func ListIDs

Action
1func ListIDs() string
source

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

func ParamsInfo

Action
1func ParamsInfo() string
source

ParamsInfo returns fixed MVP parameters for UI display. total|curve|poolSeed|gradThreshold|feeBps|createBond

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 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).

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).

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 readiness (GRC20 exists from Create; pool on Gnoswap is external)
35	GnoswapReady bool // true after graduate — token may be paired on Gnoswap
36	GnoswapNote  string
37
38	// Chart history (ordered AVL keys)
39	Trades    avl.Tree // tradeKey -> *Trade
40	NextTrade int64
41}
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 12

Source Files 4