@gangfun/cli 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,6 +22,8 @@ Operate [gang.fun](https://gang.fun) from a Binance **Agentic Wallet**. Curve bu
22
22
 
23
23
  **Floor module (0.39.0+, BSC mainnet and testnet):** `--floor` on a taxed launch makes a V3 token's tax recipient one GangFloorModule (`floor-v1`): `gang create … --buy-tax 3 --sell-tax 3 --floor [--redeem-fee 2] [--tax-cap 20 --tax-cap-share 50 --split self:70,0x…:30]`. The recipient's part of the pool tax is kept as a treasury — nothing is bought back or added. After graduation any holder can give up tokens for their share of it (`gang floor redeem`: the tokens go to 0xdead, for good), less `--redeem-fee` % (0–5, default 2) that stays for the holders who remain. With `--tax-cap` the `--split` payees take `--tax-cap-share` % until they have been credited the cap, as a capped recipient pays them; without it nobody takes a share. The floor is not a price promise: it starts at 0, grows only with pool volume and is usually far below the market price — `gang floor redeem` shows what selling the same tokens in the pool would pay and warns when that is more. The module is cloned for the one address its token will have, so the launch fixes the token's name, symbol, tax rates and metadata at its first step, and checks with the pad that the create lands at that address before building it. `gang floor status` says whether GangFloorModuleFactory made the module and whether it was cloned for this token; if not, the token has no floor and no `gang floor` call is built.
24
24
 
25
+ **Opening base (0.40.0+, BSC testnet; on mainnet the pad is upgraded and the base opens with an owner (Safe) call — until then `--base` stops with "closed"):** `gang create … --base <5|10> --base-vest <30|90|180> [--grad 6|9|12|15]` creates a GangLaunchpad 3.0 curve token whose very first trade buys 5% or 10% of the supply for the token's own base vault (GangBaseVault, `base-v1`). The create pays exactly the pad's `previewBaseCost` in BNB as the tx value (5% at 6 / 9 / 12 / 15 BNB: 0.0994 / 0.1490 / 0.1987 / 0.2484 BNB; 10%: 0.2090 / 0.3135 / 0.4180 / 0.5225; the 1% fee included, 70% of it back as your creator fee). The vault never trades: the base is locked until graduation, then the first `gang base release` (anyone may call it) starts the clock and the base is released linearly over `--base-vest` days to the creator's wallet (5%: 30 / 90 / 180 days; 10%: 90 / 180; fixed for good). **If the token never graduates, the base and its cost stay locked for good.** The preview shows the cost, the schedule and the spec's payoff figures (the least you get, at the graduation price, days to recover the cost, the daily release, what other buyers pay more), and that GangBond does not constrain the base (the vault keeps refilling the creator's wallet, so a bond is no promise about it). WBNB quote only, no dividend, not with `--vault` / `--promote` / `--fair` / `--fly` or a launch in one command; on a taxed token the recipient is usually the creator. With abcd on, the create goes through `createWithSalt` with the BNB. The CLI asks the pad (`baseVaultImpl`) and refuses `--base` where it is not live. `gang base status --token 0x…` shows the vault, size, period, start (or not started), total, released, releasable and unreleased (counted by time); `gang base release --token 0x…` starts the release, then sends what has vested to the creator.
26
+
25
27
  **Call bond and follow binding (0.37.0+):** an agent can back its own call — a buy note on a GangLaunchpad 3.0 curve token — with a bond: buy with `--note`, then within 10 minutes `gang call-bond post --token 0x… --amount 0.1 --for 48h` (the note defaults to the wallet's latest buy of the token; `--hold` defaults to the whole balance). Until settle the wallet's balance of the token stays ≥ hold; one sell, vault lock or transfer below it — also after the deadline, until `gang call-bond settle` has run (two steps, 1 hour apart) — and anyone can `gang call-bond report` it: 1% to the reporter, half burnt, the rest paid to the note's followers by their loss (`gang call-bond claim` once the root's 2-day dispute window is over). Nothing of a broken bond comes back to the caller. Quotes: WBNB, USDT, USDC, USD1. A caller's `gang v3 sell` below its hold is refused unless `--break-call-bond`. On a token with a promoter share, `gang follow` binds the note's author as the wallet's promoter for good (it builds `buyWithPromoter`; same price and fee; `--no-promoter` for a plain follow). GangCallBond is live on BSC mainnet (`0x6d6e4A36e9a231cCc932151cdbFb087Cf3860c3D`, deployed 2026-11-09, owned by the platform's Safe; built in) and the BSC testnet (`0xBE2B8519278E9D31B6c4040bAd35f727fD5d2A70`).
26
28
 
27
29
  **GangLaunchpad 2.0, the creator fee and the graduation target (0.23.0+):** 2.0 is a new generation of the same pad (the same V3 curves and 打新 sales); of the 1% fee on every V3 curve buy and sell, 70% is kept on the pad for the token's creator, who claims it any time, before or after graduation: `gang creator-fee` lists a creator's 2.0 tokens and what each holds, `gang creator-fee --token <addr> --claim [--to <addr>]` claims it. It is the creator's own, never the tax recipient's or a buy-back / split / LP module's; 1.0 tokens and 打新 sales have none. 2.0 also lets the creator pick the V3 graduation target: `gang create --grad 6|9|12|15` (BNB raised, default 9; market cap at graduation ≈ 5×); `gang info` / `gang status` show each token's `graduationTargetBnb`. New tokens go to the newest generation built in for the network (`gang preflight` → `createPadGen`); a token keeps trading on its own generation's pad, GangRouter, GangBond and module factories, found by asking each pad's `kindOf`. On the BSC testnet 2.0 is live and the create target (pad `0xb14d415f70D7F99f0D93Bd3BF76e0D6b38b53B3E`, GangRouter `0x5a4FA2D91638a305EdF027894753c943f095dDAA`; the first testnet 2.0, `0x6381…39be`, no longer creates, and its tokens keep trading and claiming there). On BSC mainnet 2.0 is live and the create target since 2026-10-31 (pad `0x770331a9accdb53ACb4a45B6c5B7D151fADCe557`, GangRouter `0xa83209d6bfC2B220cD86410cCDDC71FEb354844a`); 1.0 tokens keep trading on 1.0 (pad `0x15CF…4365`).
@@ -146,6 +148,8 @@ gang create … --buy-tax 3 --sell-tax 3 --tax-cap 20 [--tax-cap-share 50] [--sp
146
148
  gang capped status|distribute|release|set-payee|bind|chunk --token 0x… [--asset 0x…] [--index <i>] [--to 0x…] [--slippage 1] # the capped recipient: cap, paid / left / progress, ratios, payees, set aside, owed, the next chunk; other assets go to 0xdead
147
149
  gang create … --buy-tax 3 --sell-tax 3 --floor [--redeem-fee 2] [--tax-cap 20 [--tax-cap-share 50] [--split self:70,0x…:30]] # V3, floor module: the recipient's part of the tax is kept as a treasury holders can redeem; with --tax-cap the payees take their share until the cap
148
150
  gang floor status|redeem|distribute|release|set-payee|bind --token 0x… [--amount <tokens>|all] [--to 0x…] [--asset 0x…] [--index <i>] [--break-bond] [--break-call-bond] [--settle-first] # the floor module: treasury, what a token redeems for, fee, cap and payees; redeem burns the tokens (0xdead) for their share of the treasury
151
+ gang create … --base 5|10 --base-vest 30|90|180 [--grad 6|9|12|15] # 3.0 opening base: the create also buys 5% / 10% for a base vault, paid in BNB; locked until graduation (for good if it never graduates), then released linearly to you
152
+ gang base status|release --token 0x… # the base vault: size, period, start, released, releasable, unreleased; release starts the clock, then sends what has vested to the creator
149
153
  gang create --fair … [--shares <n>] --bond <quote> [--bond-hold …] --bond-days <7-90> # 打新: create (dev shares) → bond
150
154
  gang execute --request-id <id>
151
155
  gang tx --pending # trades approved in the Binance App: found by the exact call previewed, then as below
package/README.zh-CN.md CHANGED
@@ -22,6 +22,8 @@
22
22
 
23
23
  **底价赎回(0.39.0+,BSC 主网和测试网):** 有税发射时给 `--floor`,V3 币的税收接收地址就是一个底价模块(GangFloorModule,`floor-v1`):`gang create … --buy-tax 3 --sell-tax 3 --floor [--redeem-fee 2] [--tax-cap 20 --tax-cap-share 50 --split self:70,0x…:30]`。接收地址那一份池子税不回购、不加池,留在模块里当金库。毕业后任何持有人都可以把代币交出去,按比例取走金库里的报价币(`gang floor redeem`,代币进 0xdead,不可逆),扣掉 `--redeem-fee` %(0–5,默认 2),这部分留给还持有的人。带 `--tax-cap` 时,`--split` 里的收款人先拿 `--tax-cap-share` %,累计拿满上限为止,规则和税收封顶一样;不带则没有人分走。底价不是价格承诺:它从 0 开始,只随池子成交增长,通常远低于市价——`gang floor redeem` 会显示同样的代币在池子里卖出能拿多少,卖出更多时给出警告。模块是为代币将来的那一个地址克隆的,所以发射的第一步就把代币的名称、符号、税率和元数据定死,建币前还会向 pad 核对这笔建币确实落在那个地址上。`gang floor status` 会说明这个模块是不是 GangFloorModuleFactory 创建的、是不是为这个币克隆的;不是的话这个币没有底价,CLI 也不会生成任何 `gang floor` 调用。
24
24
 
25
+ **开盘底仓(0.40.0+,BSC 测试网;主网 pad 已升级,等多签开放后可用,开放前 `--base` 会提示未开放):** `gang create … --base <5|10> --base-vest <30|90|180> [--grad 6|9|12|15]` 在 GangLaunchpad 3.0 上建一个曲线币,它的第一笔成交就是给这个币专属的底仓金库(GangBaseVault,`base-v1`)买入总量的 5% 或 10%。建币交易按 pad 的 `previewBaseCost` 正好付这么多 BNB(5% 在 6 / 9 / 12 / 15 BNB 档:0.0994 / 0.1490 / 0.1987 / 0.2484 BNB;10%:0.2090 / 0.3135 / 0.4180 / 0.5225;含 1% 手续费,其中 70% 作为创建人手续费返还给你)。金库不交易:毕业前底仓锁住;毕业后第一次有人调 `gang base release`(谁都可以调)开始计时,之后在 `--base-vest` 天里匀速释放到创建人的钱包(5%:30 / 90 / 180 天;10%:90 / 180 天;写死不能改)。**如果代币永远不毕业,底仓和为它付的钱永远锁着,收不回来。** 预览里有花费、释放节奏和规格里的收益表(最少能拿多少、按毕业价算多少、几天收回成本、每天释放量、其他买家多付多少),并说明保证金约束不了底仓(金库一直往创建人钱包里补币,保证金不代表对底仓的任何承诺)。只支持 WBNB 计价,不能带分红,不能和 `--vault` / `--promote` / `--fair` / `--fly` 或一条命令发射一起用;带税时收款人通常就是创建人自己。开启 abcd 时建币经 `createWithSalt` 带上 BNB 发出。CLI 会先问 pad(`baseVaultImpl`),没开放的地方直接拒绝 `--base`。`gang base status --token 0x…` 显示金库、底仓大小、释放期、开始时间(或未开始)、总量、已释放、可释放和未释放(按时间算);`gang base release --token 0x…` 第一次调用开始计时,之后把已经到期的部分转给创建人。
26
+
25
27
  **喊单保证金和跟单绑定(0.37.0+):** agent 可以给自己的喊单(GangLaunchpad 3.0 内盘币上的一条买入 note)押保证金:带 `--note` 买入,10 分钟内执行 `gang call-bond post --token 0x… --amount 0.1 --for 48h`(note 默认取这个钱包最近一次买这个币的交易;`--hold` 默认是全部余额)。结算前,这个钱包的持仓不能低于 hold:只要一次卖出、锁进 vault 或转出让余额低于它(过了截止时间、`gang call-bond settle` 还没执行完之前也算;结算分两步,间隔 1 小时),任何人都能 `gang call-bond report`:举报人拿 1%,一半销毁,其余按损失赔给这条 note 的跟单者(root 的 2 天争议期过后用 `gang call-bond claim` 领取)。违约的保证金一分都不会回到喊单者。报价币:WBNB、USDT、USDC、USD1。喊单者用 `gang v3 sell` 卖到低于 hold 会被拒,除非加 `--break-call-bond`。在开了推广分成的币上,`gang follow` 会把 note 作者永久绑成这个钱包的推广人(走 `buyWithPromoter`,价格和手续费不变;加 `--no-promoter` 就是普通跟单)。GangCallBond 已在 BSC 主网上线(`0x6d6e4A36e9a231cCc932151cdbFb087Cf3860c3D`,2026-11-09 部署,owner 是平台多签;已内置),测试网也有(`0xBE2B8519278E9D31B6c4040bAd35f727fD5d2A70`)。
26
28
 
27
29
  **GangLaunchpad 2.0、creator 分成和毕业目标(0.23.0+):** 2.0 是同一个内盘的新一代(V3 曲线和打新都一样)。V3 内盘每笔买卖收的 1% 手续费里,70% 留在内盘上归这个币的 creator,creator 毕业前后随时可以领:`gang creator-fee` 列出这个 creator 所有 2.0 币各自可领多少,`gang creator-fee --token <addr> --claim [--to <addr>]` 领取。这笔钱只归 creator 本人,不给税收接收地址,也不经过回购 / 分账 / 加池模块;1.0 的币和打新没有这项。2.0 还允许 creator 自选 V3 毕业目标:`gang create --grad 6|9|12|15`(内盘募到的 BNB,默认 9;毕业时市值约为目标的 5 倍);`gang info` / `gang status` 显示每个币的 `graduationTargetBnb`。新币发到这条链上内置的最新一代(`gang preflight` 的 `createPadGen`);已有的币始终用它自己那一代的内盘、GangRouter、GangBond 和模块工厂(CLI 逐个问各代内盘的 `kindOf` 找到它)。BSC 测试网上 2.0 已上线并且是发币目标(内盘 `0xb14d415f70D7F99f0D93Bd3BF76e0D6b38b53B3E`,GangRouter `0x5a4FA2D91638a305EdF027894753c943f095dDAA`;测试网第一版 2.0 `0x6381…39be` 不再发新币,上面的币照常交易和领取)。BSC 主网 2026-10-31 起 2.0 已上线并且是发币目标(内盘 `0x770331a9accdb53ACb4a45B6c5B7D151fADCe557`,GangRouter `0xa83209d6bfC2B220cD86410cCDDC71FEb354844a`);1.0 的币照常在 1.0(内盘 `0x15CF…4365`)上交易。
@@ -125,6 +127,8 @@ gang create … --buy-tax 3 --sell-tax 3 --tax-cap 20 [--tax-cap-share 50] [--sp
125
127
  gang capped status|distribute|release|set-payee|bind|chunk --token 0x… [--asset 0x…] [--index <i>] [--to 0x…] [--slippage 1] # 封顶合约:上限、已付 / 剩余 / 进度、比例、收款人、待回购 / 待加池、欠款、下一块;其他资产打进 0xdead
126
128
  gang create … --buy-tax 3 --sell-tax 3 --floor [--redeem-fee 2] [--tax-cap 20 [--tax-cap-share 50] [--split self:70,0x…:30]] # V3 底价赎回:接收地址那一份税留作金库,持有人可以赎回;带 --tax-cap 时收款人先拿到上限为止
127
129
  gang floor status|redeem|distribute|release|set-payee|bind --token 0x… [--amount <数量>|all] [--to 0x…] [--asset 0x…] [--index <i>] [--break-bond] [--break-call-bond] [--settle-first] # 底价模块:金库、每枚能赎回多少、手续费、上限和收款人;redeem 把代币打进 0xdead,换回金库里按比例的一份
130
+ gang create … --base 5|10 --base-vest 30|90|180 [--grad 6|9|12|15] # 3.0 开盘底仓:建币时用 BNB 给底仓金库买 5% / 10%;毕业前锁住(不毕业就永远锁着),毕业后匀速释放给你
131
+ gang base status|release --token 0x… # 底仓金库:大小、释放期、开始时间、已释放、可释放、未释放;release 第一次开始计时,之后把到期的部分转给创建人
128
132
  gang create --fair … [--shares <n>] --bond <数量> [--bond-hold …] --bond-days <7-90> # 打新:发币(含 dev 份额)→ 押金
129
133
  gang execute --request-id <id>
130
134
  gang tx --pending # 在 Binance App 里批准过的交易:按预览时的调用自动找到交易,再按下面这条处理
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gangfun/cli",
3
- "version": "0.39.0",
3
+ "version": "0.40.0",
4
4
  "mcpName": "io.github.gangfun/gang",
5
5
  "description": "Gang launchpad CLI for Binance Agentic Wallet agents: create on GangLaunchpad (untaxed or tax tokens), 打新 fair mint, PancakeSwap pool trades, LaunchpadV2 and legacy Soft/U/S trade.",
6
6
  "type": "module",
package/src/base.js ADDED
@@ -0,0 +1,272 @@
1
+ import { createPublicClient, encodeFunctionData, formatUnits, hexToString, isAddress, parseAbi, zeroAddress } from 'viem'
2
+ import { walletFor } from './fair.js'
3
+ import { atTokenPad, KIND_UNREAD, NOT_ON_MAINNET, PAD3_GEN, padNets, rpcTransport } from './gangpad.js'
4
+ import { revertOf as revertIn, step } from './steps.js'
5
+
6
+ /**
7
+ * The opening base of a GangLaunchpad 3.0 curve token (base-v1, docs/SPEC-BASE-VAULT-V2-2026-11-12.md): at create the
8
+ * creator pays exactly previewBaseCost(gradBnb, baseBps) in BNB and the pad buys 5% or 10% of the supply as the curve's
9
+ * first trade, for a per-token GangBaseVault. The vault never trades; after graduation anyone's first release() starts
10
+ * the clock, then it releases linearly to the creator (fixed). A token that never graduates keeps its base locked.
11
+ *
12
+ * `gang create … --base <5|10> --base-vest <30|90|180>` (v3.js builds it with the pieces here) and `gang base
13
+ * status|release`. The pad says whether it has the base (baseVaultImpl); an older pad (mainnet before its upgrade) has
14
+ * no such function and the CLI refuses the flag.
15
+ */
16
+
17
+ export const BASE_TYPE = 'base-v1'
18
+ const TAX = '(uint16 buyTaxBps, uint16 sellTaxBps, uint16 dividendBps, address recipient)'
19
+ export const BASE_PAD_ABI = parseAbi([
20
+ `function createWithBase(string name, string symbol, string logoURI, string metaURI, ${TAX} tax, uint256 gradBnb, (uint16 baseBps, uint32 vestDays) base) payable returns (address token)`,
21
+ 'function baseVaultImpl() view returns (address)',
22
+ 'function baseVaultOf(address token) view returns (address)',
23
+ 'function baseOf(address token) view returns (uint256)',
24
+ 'function previewBaseCost(uint256 gradBnb, uint16 baseBps) view returns (uint256)',
25
+ 'error BaseNotOpen()', 'error BadBaseConfig()', 'error WrongBaseVaultImpl()', 'error BaseBuyRefused()', 'error BadMsgValue()',
26
+ 'event BaseVaultImplSet(address indexed impl)',
27
+ 'event BaseCreated(address indexed token, address indexed vault, uint256 tokens, uint256 cost, uint16 baseBps, uint32 vestDays)',
28
+ ])
29
+ export const BASE_VAULT_ABI = parseAbi([
30
+ 'function pad() view returns (address)',
31
+ 'function token() view returns (address)',
32
+ 'function creator() view returns (address)',
33
+ 'function startAt() view returns (uint64)',
34
+ 'function duration() view returns (uint64)',
35
+ 'function total() view returns (uint256)',
36
+ 'function released() view returns (uint256)',
37
+ 'function releasable() view returns (uint256)',
38
+ 'function moduleType() view returns (bytes32)',
39
+ 'function release() returns (uint256 amount)',
40
+ 'error NotPad()', 'error AlreadyInitialized()', 'error BadInit()', 'error NotGraduated()', 'error NothingToRelease()', 'error Reentered()',
41
+ 'event Initialized(address indexed token, address indexed creator, uint32 vestDays)',
42
+ 'event Began(uint64 startAt, uint256 total)',
43
+ 'event Released(address indexed creator, uint256 amount, uint256 releasedTotal)',
44
+ ])
45
+ /** What `gang tx` decodes a base create's and a base vault's logs with. */
46
+ export const BASE_EVENT_ABIS = [BASE_PAD_ABI, BASE_VAULT_ABI]
47
+ const ERC20_ABI = parseAbi([
48
+ 'function balanceOf(address) view returns (uint256)',
49
+ 'function locked() view returns (bool)',
50
+ 'function symbol() view returns (string)',
51
+ ])
52
+
53
+ export const HINTS = {
54
+ BaseNotOpen: 'this pad has the opening base but it is closed (no vault implementation set): drop --base',
55
+ BadBaseConfig: '--base 5 takes --base-vest 30 / 90 / 180, --base 10 only 90 / 180; a dividend token takes no base',
56
+ BadMsgValue: 'the BNB sent is not exactly the base cost the pad asks (previewBaseCost): build the create again',
57
+ BaseBuyRefused: 'the pad refused the base buy (never expected from a create): report it to gang',
58
+ NotGraduated: 'the token has not graduated: the base stays locked until it does (and for good if it never does)',
59
+ NothingToRelease: 'nothing has vested since the last release: try again later (gang base status shows when)',
60
+ }
61
+ export const revertOf = (e) => revertIn(e, [BASE_PAD_ABI, BASE_VAULT_ABI], HINTS)
62
+
63
+ /** Base size (bps of the supply) → the release periods offered (spec §4.2; Pad3Module._baseOffered). */
64
+ export const BASE_OFFERED = { 500: [30, 90, 180], 1000: [90, 180] }
65
+ const TOTAL_SUPPLY = 1_000_000_000n * 10n ** 18n
66
+ const POOL_TOKENS = 200_000_000 // what graduation puts in the pair beside the graduation amount
67
+ const VIRTUAL_TOKEN = 1_066_666_666.666_666_7 // CurveLogic3.VIRTUAL_TOKEN, in whole tokens
68
+ const CURVE_SUPPLY = 800_000_000
69
+
70
+ export const BASE_USAGE = '--base <5|10> --base-vest <30|90|180>: the % of the supply bought for your base vault at create (5 or 10) and the days it is released over after graduation (5%: 30 / 90 / 180; 10%: 90 / 180)'
71
+ export const BASE_NO_BOND = 'GangBond does not constrain the base: a bond checks only the creator wallet\'s balance, and the vault keeps refilling that wallet as it releases, so a bond on a base token says nothing about what you do with the base (and a bond lasts 90 days at most). Do not present a bond as a promise about the base'
72
+ export const BASE_LOST = 'If the token never graduates, the base stays locked in the vault for good and the BNB you paid for it stays in the curve: there is no refund, cancel or early release'
73
+
74
+ /** { baseBps, vestDays } from --base / --base-vest, or { error }. */
75
+ export function parseBase(base, vest) {
76
+ if (base == null || !/^(5|10)%?$/.test(String(base).trim())) return { error: BASE_USAGE, got: base ?? null }
77
+ const baseBps = Number(String(base).trim().replace('%', '')) * 100
78
+ if (vest == null) return { error: `--base needs --base-vest <days>: ${baseBps === 500 ? '30, 90 or 180' : '90 or 180'} (the release period after graduation, fixed for good)` }
79
+ const vestDays = Number(String(vest).trim())
80
+ if (!BASE_OFFERED[baseBps].includes(vestDays)) {
81
+ return { error: baseBps === 1000 && vestDays === 30 ? 'a 10% base is released over 90 or 180 days, not 30 (30 days is for a 5% base)' : `--base-vest for a ${baseBps / 100}% base must be ${BASE_OFFERED[baseBps].join(', ')} (days)`, got: vest }
82
+ }
83
+ return { baseBps, vestDays }
84
+ }
85
+
86
+ /**
87
+ * Whether `ctx.pad` has the opening base: { open: true, impl } / { open: false, why } / { unread } (RPC error). An older
88
+ * pad has no baseVaultImpl (a revert without data); 0 = closed.
89
+ */
90
+ export async function baseSupport(ctx) {
91
+ if (ctx.gen !== PAD3_GEN) return { open: false, why: `GangLaunchpad ${ctx.gen ?? ctx.pad} has no opening base (3.0 only)` }
92
+ let impl
93
+ try { impl = await ctx.read(ctx.pad, BASE_PAD_ABI, 'baseVaultImpl') } catch (e) {
94
+ if (missingRead(e)) return { open: false, why: `GangLaunchpad 3.0 on ${ctx.chainId === '97' ? 'the BSC testnet' : 'BSC mainnet'} has no opening base yet (the pad is not upgraded for it)` }
95
+ return { unread: e.shortMessage || e.message.split('\n')[0] }
96
+ }
97
+ if (impl.toLowerCase() === zeroAddress) return { open: false, why: 'the opening base is closed on this pad (no vault implementation set)' }
98
+ return { open: true, impl }
99
+ }
100
+
101
+ /** A call that hit a contract without the function (no data back), never a node's internal error (-32603). */
102
+ export function missingRead(e) {
103
+ if (e?.walk?.((x) => x?.code === -32603)) return false
104
+ if (e?.walk?.((x) => x?.name === 'ContractFunctionZeroDataError')) return true
105
+ const r = e?.walk?.((x) => x?.name === 'ContractFunctionRevertedError')
106
+ return !!r && !r.data && (!r.raw || r.raw === '0x')
107
+ }
108
+
109
+ const r = (x, d = 2) => Math.round(x * 10 ** d) / 10 ** d
110
+
111
+ /**
112
+ * The numbers of spec §2 for one base, from the graduation target `gradBnb` (BNB), the size and period and the cost
113
+ * the pad asks (wei). Pool figures are the constant-product pair graduation makes (200M tokens + gradBnb), before the
114
+ * PancakeSwap fee and any tax.
115
+ */
116
+ export function basePayoff({ gradBnb, baseBps, vestDays, cost, creatorFeeShareBps = 7000 }) {
117
+ const g = Number(gradBnb)
118
+ const b = (baseBps / 10_000) * 1e9 // tokens
119
+ const costBnb = Number(formatUnits(cost, 18))
120
+ const gradPrice = g / POOL_TOKENS
121
+ const atGradPrice = b * gradPrice
122
+ const minimum = (g * b) / (POOL_TOKENS + b) // released and sold into the pair with no other buyer
123
+ const endPrice = (POOL_TOKENS / (POOL_TOKENS + b)) ** 2
124
+ const vq = g / 3
125
+ const baseNet = (vq * b) / (VIRTUAL_TOKEN - b)
126
+ const fee = costBnb / 100
127
+ return {
128
+ costBnb: formatUnits(cost, 18),
129
+ tokens: `${b / 1e6}M (${baseBps / 100}% of the supply)`,
130
+ feeIncluded: `1% curve fee included (${r(fee, 6)} BNB); ${creatorFeeShareBps / 100}% of it is credited back to you as the creator fee (gang creator-fee --claim), so you pay about ${r((fee * (10_000 - creatorFeeShareBps)) / 10_000, 6)} BNB of fee`,
131
+ averagePrice: `about 1/${r(atGradPrice / costBnb, 1)} of the graduation price`,
132
+ worthAtGraduation: `${r(atGradPrice, 4)} BNB at the graduation price (${r(atGradPrice / g, 2)} × the ${g} BNB target)`,
133
+ poolShare: `${r((b / POOL_TOKENS) * 100, 1)}% of the tokens the PancakeSwap pair gets at graduation`,
134
+ youGet: {
135
+ minimum: `about ${r(minimum, 3)} BNB: every release sold at once and no other buyer in the pool (the price then ends at ${Math.round(endPrice * 100)}% of the graduation price). The worst case for holders and the least you get, not a cap`,
136
+ atGraduationPrice: `${r(atGradPrice, 4)} BNB if the price stays at the graduation price`,
137
+ higher: 'more if the price is higher, with no upper limit',
138
+ daysToRecoverCost: `about ${r((costBnb * vestDays) / atGradPrice, 1)} days of release, sold at the graduation price, pay back the cost; after that the base carries no risk for you`,
139
+ releasedPerDay: `${r((b / vestDays / POOL_TOKENS) * 100, 2)}% of the pair's tokens a day (${r(b / vestDays / 1e6, 3)}M tokens)`,
140
+ },
141
+ othersPay: {
142
+ startPrice: `the curve starts ${r((VIRTUAL_TOKEN / (VIRTUAL_TOKEN - b)) ** 2, 2)}× higher than without a base`,
143
+ averageToGraduation: `buyers who take the curve to graduation pay ${r(((1 - baseNet / g) / ((CURVE_SUPPLY - b) / CURVE_SUPPLY) - 1) * 100, 1)}% more on average`,
144
+ },
145
+ figures: 'computed from the curve and the pair graduation makes, before the PancakeSwap fee and any tax',
146
+ }
147
+ }
148
+
149
+ /** The release schedule in words. */
150
+ export const scheduleLine = (vestDays) => `after graduation, the first gang base release (anyone may call it) starts the clock; from then on the base is released linearly over ${vestDays} days to the creator's wallet — fixed for good, nobody can change the period or the wallet. The time between graduation and that first call does not count: calling it late only delays your own release`
151
+
152
+ /** The tax line of a base create: the creator is usually its own tax recipient (a base token takes no dividend). */
153
+ export function baseTaxLine({ taxed, sellTaxPct, platformTaxPct, selfRecipient }) {
154
+ if (!taxed) return null
155
+ return selfRecipient
156
+ ? `you are this token's tax recipient: of the ${sellTaxPct}% sell tax you pay selling released base in the pool, all but the platform's ${platformTaxPct}% of volume comes back to you (a base token has no dividend), so you keep the figures above less about ${platformTaxPct}% of what you sell, and less the PancakeSwap fee (0.25%) and slippage, which none of these figures include`
157
+ : `the ${sellTaxPct}% sell tax on what you sell of the base goes to the recipient (${platformTaxPct}% of volume to the platform), not to you: the figures above are before it, and before the PancakeSwap fee (0.25%) and slippage`
158
+ }
159
+
160
+ function baseCtx(testnet) {
161
+ const net = padNets('v3')[testnet ? 'testnet' : 'mainnet']
162
+ if (!net.pad) throw new Error(NOT_ON_MAINNET)
163
+ const client = createPublicClient({ chain: net.chain, transport: rpcTransport(net.rpcs) })
164
+ return { ...net, client, read: (address, abi, functionName, args = []) => client.readContract({ address, abi, functionName, args }) }
165
+ }
166
+
167
+ const tok = (x) => formatUnits(x, 18)
168
+ const pctOf = (x) => Number((x * 1_000_000n) / TOTAL_SUPPLY) / 10_000
169
+ const iso = (s) => (Number(s) > 0 ? new Date(Number(s) * 1000).toISOString() : null)
170
+
171
+ /**
172
+ * The token's base vault as the pad and the vault say, at one block: null when the token has none, { error } when it
173
+ * cannot be read. `now` (seconds) is that block's time. Unreleased is by time (total − what has vested), not the
174
+ * vault's balance: anyone can push a release out (spec §10).
175
+ */
176
+ export async function baseOf(ctx, token) {
177
+ if (ctx.gen !== PAD3_GEN) return null
178
+ let vault
179
+ try { vault = await ctx.read(ctx.pad, BASE_PAD_ABI, 'baseVaultOf', [token]) } catch (e) {
180
+ if (missingRead(e)) return null // a pad before the base: no token of it has one
181
+ throw e
182
+ }
183
+ if (vault.toLowerCase() === zeroAddress) return null
184
+ // written once at create: the rest is read at one block, so the time and the vault's numbers agree
185
+ const block = await ctx.client.getBlock()
186
+ const at = { blockNumber: block.number }
187
+ const read = (address, abi, functionName, args = []) => ctx.client.readContract({ address, abi, functionName, args, ...at })
188
+ const [bought, vPad, vToken, creator, startAt, duration, total, released, releasable, type, balance, locked] = await Promise.all([
189
+ read(ctx.pad, BASE_PAD_ABI, 'baseOf', [token]),
190
+ ...['pad', 'token', 'creator', 'startAt', 'duration', 'total', 'released', 'releasable', 'moduleType'].map((f) => read(vault, BASE_VAULT_ABI, f)),
191
+ read(token, ERC20_ABI, 'balanceOf', [vault]), read(token, ERC20_ABI, 'locked'),
192
+ ])
193
+ const now = block.timestamp
194
+ const kind = (() => { try { return hexToString(type, { size: 32 }).replace(/\0+$/, '') } catch { return null } })()
195
+ const ours = vPad.toLowerCase() === ctx.pad.toLowerCase() && vToken.toLowerCase() === token.toLowerCase() && kind === BASE_TYPE
196
+ const started = startAt > 0n
197
+ const vested = !started ? 0n : now - startAt >= duration ? total : (total * (now - startAt)) / duration
198
+ // by time (spec §10): before the start, the whole base bought at create (tokens sent in later are not the base)
199
+ const unreleased = started ? (total > vested ? total - vested : 0n) : bought
200
+ const days = Number(duration / 86_400n)
201
+ return {
202
+ vault, claims: kind, ...(ours ? {} : { warning: 'the vault the pad names does not say it is this token\'s base-v1 vault of this pad: report it to gang' }),
203
+ creator, recipient: creator, baseTokens: tok(bought), basePct: pctOf(bought), vestDays: days,
204
+ graduated: !locked, started,
205
+ startAt: started ? iso(startAt) : 'not started',
206
+ ...(started && { endsAt: iso(startAt + duration), elapsedDays: Math.min(days, Number((now - startAt) / 864n) / 100) }),
207
+ total: started ? tok(total) : null,
208
+ released: tok(released), releasable: tok(releasable),
209
+ vestedSoFar: tok(vested), unreleased: tok(unreleased), unreleasedPct: pctOf(unreleased), inVault: tok(balance),
210
+ note: !started
211
+ ? locked
212
+ ? `locked until graduation. Then the first gang base release starts a ${days}-day linear release to the creator. ${BASE_LOST.replace('you paid', 'the creator paid')}`
213
+ : `graduated, release not started: the first gang base release (anyone may call it) starts the clock; nothing moves in that call`
214
+ : vested >= total && now - startAt >= duration
215
+ ? balance === 0n
216
+ ? 'fully released: the vault is empty (gang base release has nothing to send)'
217
+ : 'the release period is over: gang base release sends the vault\'s whole balance to the creator'
218
+ : `releasing linearly to the creator until ${iso(startAt + duration)}; unreleased is counted by time (total − vested so far), not from the vault's balance`,
219
+ bond: BASE_NO_BOND,
220
+ raw: { bought, startAt, duration, total, released, releasable, balance, locked, now },
221
+ }
222
+ }
223
+
224
+ const SUBS = ['status', 'release']
225
+ const USAGE = 'usage: gang base <status|release> --token <addr> [--testnet] [--calldata] [--from <addr>] — see gang help'
226
+
227
+ /** `gang base <sub>`: a 3.0 curve token's opening base vault. */
228
+ export async function runBase(sub, { opt, flag, out, fail, summarize }) {
229
+ if (!SUBS.includes(sub)) return fail(USAGE, { got: sub ?? null })
230
+ const testnet = flag('testnet')
231
+ let ctx
232
+ try { ctx = baseCtx(testnet) } catch (e) { return fail(e.message) }
233
+ const chainId = Number(ctx.chainId)
234
+ const tn = testnet ? ' --testnet' : ''
235
+ const token = opt('token')
236
+ if (!isAddress(token ?? '')) return fail('--token must be a 3.0 curve token address (0x…)', { got: token ?? null })
237
+ const kind = await atTokenPad(ctx, token)
238
+ if (kind === null) return fail(KIND_UNREAD.error, { token, retry: KIND_UNREAD.retry })
239
+ if (kind !== 'v3') return fail(`not a V3 curve token on a GangLaunchpad (${testnet ? 'BSC testnet' : 'BSC mainnet; add --testnet for a testnet token'})`, { token, chainId, ...(kind && kind !== 'none' && { kind }) })
240
+ let s
241
+ try { s = await baseOf(ctx, token) } catch (e) {
242
+ return fail('could not read the token\'s base vault (RPC error)', { token, detail: e.shortMessage || e.message.split('\n')[0], retry: 'same command again' })
243
+ }
244
+ if (!s) return fail('this token has no opening base (it was not created with --base)', { token, pad: ctx.pad, padGen: ctx.gen })
245
+ const { raw, ...shown } = s
246
+ if (sub === 'status') {
247
+ return out({
248
+ success: true, chainId, token, pad: ctx.pad, ...shown,
249
+ ...(raw.locked ? {} : !s.started ? { next: `gang base release --token ${token}${tn}` } : raw.releasable > 0n ? { next: `gang base release --token ${token}${tn}` } : {}),
250
+ })
251
+ }
252
+
253
+ // release: anyone; the tokens always go to the creator
254
+ if (s.warning) return fail(s.warning, { vault: s.vault })
255
+ if (raw.locked) return fail(HINTS.NotGraduated, { token, vault: s.vault })
256
+ if (s.started && raw.releasable === 0n) return fail(HINTS.NothingToRelease, { token, vault: s.vault, releasedSoFar: s.released, ...(s.endsAt && { endsAt: s.endsAt }) })
257
+ const me = walletFor(ctx, opt('from'))
258
+ let sim
259
+ try { await ctx.client.simulateContract({ account: me, address: s.vault, abi: BASE_VAULT_ABI, functionName: 'release' }) } catch (e) {
260
+ const rv = revertOf(e)
261
+ sim = rv ? { reverted: true, ...rv } : { reverted: false, error: e.shortMessage || e.message.split('\n')[0] }
262
+ }
263
+ if (sim) return out({ success: false, step: 'base-release', ...sim })
264
+ const data = encodeFunctionData({ abi: BASE_VAULT_ABI, functionName: 'release' })
265
+ const mine = String(me).toLowerCase() === s.creator.toLowerCase()
266
+ return out(step(ctx, { from: me, to: s.vault, data }, {
267
+ step: 'base-release', chainId, token, vault: s.vault, creator: s.creator,
268
+ ...(s.started
269
+ ? { amount: s.releasable, note: `sends what has vested and was not sent yet (about ${s.releasable} tokens now; a little more by the time it lands) to the creator ${s.creator}${mine ? ' (you)' : ', not to the wallet that calls'}` }
270
+ : { amount: '0', starts: true, note: `starts the ${s.vestDays}-day release now: the vault records its balance (${s.inVault} tokens) as the total and sends nothing in this call; from then on the creator ${s.creator}${mine ? ' (you)' : ''} can release what has vested` }),
271
+ }, flag('calldata'), summarize))
272
+ }
@@ -64,6 +64,7 @@ export const COMMANDS = [
64
64
  c('creator-fee --claim --to', 'preview', 'high', '0.23.0', 'Creator only: claim the creator fee to another address'),
65
65
  c('upload-logo', 'publish', 'medium', '0.2.0', 'Publish a local image or a URL on gang.fun, at once: only a file the user named', { needsUserConfirmation: true }),
66
66
  c('create', 'preview', 'high', '0.1.0', 'Launch a token. Its name, tax, logo and links never change; a launch in one command also buys, bonds or binds modules'),
67
+ c('create --base', 'preview', 'high', '0.40.0', 'Create a 3.0 curve token that buys 5% or 10% of its supply for a base vault in the same tx, paid in BNB: locked until graduation (for good if it never graduates), then released linearly to the creator'),
67
68
  c('mint', 'preview', 'medium', '0.12.0', 'Buy shares of a 打新 or Mint Flywheel sale'),
68
69
  c('withdraw', 'preview', 'medium', '0.12.0', 'Sell shares back at the mint price, less the exit fee, before the sale fills', { riskIf: { 'break-bond': { risk: 'high', why: '打新 only: gives up the whole bond' } } }),
69
70
  c('claim', 'preview', 'low', '0.12.0', 'Claim my dividend or holder reward'),
@@ -99,6 +100,8 @@ export const COMMANDS = [
99
100
  c('floor redeem', 'preview', 'high', '0.39.0', 'Holder: give up tokens (to 0xdead, for good) for their share of the floor treasury, less the fee'),
100
101
  c('floor distribute', 'preview', 'low', '0.39.0', 'Anyone: split the bound quote and push the payees their part, or send another asset to 0xdead'),
101
102
  ]),
103
+ c('base status', 'read', 'none', '0.40.0', "A 3.0 token's opening base: its vault, size, release period, start, released, releasable and unreleased (by time)"),
104
+ c('base release', 'preview', 'low', '0.40.0', "Anyone, after graduation: start the base's linear release (first call), then send what has vested to the creator"),
102
105
  c('promote buy', 'preview', 'medium', '0.34.0', "Buy naming a promoter: a wallet's first trade of the token binds it for good, on the curve"),
103
106
  c('promote status', 'read', 'none', '0.34.0', "A token's promoter terms, a wallet's binding and what it can claim"),
104
107
  c('promote earnings', 'read', 'none', '0.34.0', 'A promoter wallet: shares to claim on the curve and in the pool'),
package/src/flags.js CHANGED
@@ -13,7 +13,7 @@ export const FAIR_CREATE_FLAGS = ['raise', 'cap', 'hold', 'mint-fee', 'exit-fee'
13
13
 
14
14
  export const CREATE_ACCEPTS = new Set([
15
15
  'name', 'symbol', 'logo', 'logo-file', 'file-logo', 'logo-uri', 'keep-logo-uri', ...LINK_FLAGS, 'description',
16
- 'quote', 'ref-pool', 'grad', 'vault', 'testnet', 'calldata', 'from', 'note', 'conf', 'reveal-after',
16
+ 'quote', 'ref-pool', 'grad', 'vault', 'base', 'base-vest', 'testnet', 'calldata', 'from', 'note', 'conf', 'reveal-after',
17
17
  'fair', 'fly', ...V3_CREATE_FLAGS, ...FAIR_CREATE_FLAGS, ...FLY_CREATE_FLAGS,
18
18
  // a launch in one command: its dev buy reads --slippage like gang buy, its bond --use-wbnb like gang bond post
19
19
  ...LAUNCH_FLAGS, 'slippage', 'use-wbnb',
package/src/index.js CHANGED
@@ -28,6 +28,7 @@ import { runLp, LP_EVENT_ABIS } from './lp.js'
28
28
  import { runCombo, COMBO_EVENT_ABIS } from './combo.js'
29
29
  import { runCapped, CAPPED_EVENT_ABIS } from './capped.js'
30
30
  import { runFloor, FLOOR_ABI, FLOOR_EVENT_ABIS } from './floor.js'
31
+ import { runBase, BASE_EVENT_ABIS } from './base.js'
31
32
  import { runWeekly } from './weekly.js'
32
33
  import { runFly, flyCtx, isFlyToken, FLY_EVENT_ABIS, FLY_CREATE_FLAGS } from './fly.js'
33
34
  import { FAIR_DEV_BUY, isLaunch, LAUNCH_FLAGS, REDEEM_FEE_ALONE, runLaunch, TAX_CAP_ALONE } from './launch.js'
@@ -602,6 +603,28 @@ PROMOTER SHARE (GangLaunchpad 3.0, 0.34.0+; GANG_PROMOTE_POOL_FACTORY / GANG_TES
602
603
  the dev: reclaim what no root allocated, after 30 days of settler silence once the token
603
604
  has graduated, which closes the module FOR GOOD / send what a failed push left
604
605
 
606
+ OPENING BASE (GangLaunchpad 3.0, base-v1, 0.40.0+; the pad says whether it is open: BSC testnet now; mainnet once the Safe opens it):
607
+ gang create … --base <5|10> --base-vest <30|90|180> [--grad 6|9|12|15] [--buy-tax <1-5> --sell-tax <1-5>]
608
+ the create also buys 5% or 10% of the supply on the curve, as its first trade, for
609
+ the token's own base vault (GangBaseVault). The tx pays exactly the pad's
610
+ previewBaseCost in BNB (e.g. 5% at 9 BNB: 0.149 BNB; 1% fee included, 70% of it back
611
+ as your creator fee). The vault never trades: the base is locked until graduation;
612
+ then the first gang base release (anyone's) starts the clock and it is released
613
+ linearly over --base-vest days to your wallet (5%: 30 / 90 / 180; 10%: 90 / 180;
614
+ fixed for good). If the token never graduates, the base and its cost stay locked FOR
615
+ GOOD. The preview shows the cost, the schedule, what you can get (spec table: least,
616
+ at the graduation price, days to recover the cost) and what others pay more.
617
+ GangBond does not constrain the base (the vault refills your wallet), so a bond is no
618
+ promise about it. WBNB quote only (no --quote / --ref-pool), no --dividend, not with
619
+ --vault / --promote / --fair / --fly or a launch in one command (--dev-buy, --bond,
620
+ --buyback, --split, --lp, --tax-cap, --floor); taxed, the recipient is usually you.
621
+ abcd on: sent through createWithSalt with the BNB
622
+ gang base status --token <addr> the vault, base size, period, start (or not started), total, released, releasable,
623
+ vested so far and unreleased (counted by time, not from the vault's balance)
624
+ gang base release --token <addr> anyone, after graduation: the first call starts the release (sends nothing); later
625
+ ones send what has vested to the creator (never to the caller). --testnet,
626
+ --calldata, --from as elsewhere
627
+
605
628
  BOND (押金承诺, GangBond; any GangLaunchpad token, from create on; GANG_BOND / GANG_TESTNET_BOND = its address):
606
629
  gang bond post --token <addr> --hold <tokens|N%> --days <7-90> (--amount <quote> | --cover <coverage %>) [--use-wbnb]
607
630
  creator only, any time after create (V3: buy on the curve first): bond in the token's
@@ -1355,6 +1378,7 @@ function checkFlyCreate() {
1355
1378
  : `--${wrong} is a V3 tax setting; a 铸币飞轮 token's tax goes to holders, the platform and the creator in fixed parts`)
1356
1379
  }
1357
1380
  }
1381
+ const BASE_ALONE = 'a --base create stands alone in this CLI: no chained dev buy, GangBond or buy-back / split / LP / combined / floor / capped recipient. A GangBond would not constrain the base anyway (the vault refills your wallet); a dev buy is its own gang buy after the create lands (your wallet can still hold 1%)'
1358
1382
  const VAULT_ALONE = 'a --vault create stands alone: no chained dev buy, GangBond or buy-back / split / LP / combined / floor / capped recipient (the 2.0 金库版 pad has none of them); a dev buy is its own gang buy after the create lands'
1359
1383
  // --grad picks a V3 curve's graduation target (2.0 / 3.0); a 打新 / 铸币飞轮 sale ends at its own --raise
1360
1384
  const GRAD_ONLY_V3 = (what) => `--grad is a V3 curve setting (the graduation target, 2.0 / 3.0): ${what} fills at its --raise instead, so leave --grad out`
@@ -1389,9 +1413,9 @@ const PREFLIGHT_NEXT = [
1389
1413
  // commands whose JSON result carries `update`; `watch` streams NDJSON and help is plain text
1390
1414
  const UPDATE_CHECKED = new Set(['version', '--version', '-v', 'preflight', 'list', 'trending', 'invite', 'weekly', 'hot', 'new', 'near-grad', 'notes', 'agents', 'token', 'info', 'status', 'portfolio', 'quote',
1391
1415
  'buy', 'follow', 'sell', 'claim', 'mint', 'withdraw', 'release', 'upload-logo', 'create', 'execute', 'tx', 'fair', 'v3', 'bond',
1392
- 'buyback', 'split', 'lp', 'combo', 'capped', 'floor', 'fly', 'creator-fee', 'promote', 'call-bond'])
1416
+ 'buyback', 'split', 'lp', 'combo', 'capped', 'floor', 'base', 'fly', 'creator-fee', 'promote', 'call-bond'])
1393
1417
  // gang tx decodes these beside the V2 / Soft / U / S pads' events (GangLaunchpad: both kinds; the tax router; the vaults)
1394
- const GANG_EVENT_ABIS = [...V3_EVENT_ABIS, ...FAIR_EVENT_ABIS, ...FLY_EVENT_ABIS, ...SPLIT_EVENT_ABIS, ...LP_EVENT_ABIS, ...COMBO_EVENT_ABIS, ...CAPPED_EVENT_ABIS, ...FLOOR_EVENT_ABIS, ...PROMOTE_EVENT_ABIS, CALL_BOND_ABI]
1418
+ const GANG_EVENT_ABIS = [...V3_EVENT_ABIS, ...FAIR_EVENT_ABIS, ...FLY_EVENT_ABIS, ...SPLIT_EVENT_ABIS, ...LP_EVENT_ABIS, ...COMBO_EVENT_ABIS, ...CAPPED_EVENT_ABIS, ...FLOOR_EVENT_ABIS, ...BASE_EVENT_ABIS, ...PROMOTE_EVENT_ABIS, CALL_BOND_ABI]
1395
1419
  // Split with three amounts is the event of four module kinds, and the amounts mean different things in each (a buy-back
1396
1420
  // splitter's toBuyback / toDev, an LP splitter's toLp / toDev, a promoter pool's toEscrow / toDev, a floor module's
1397
1421
  // toTreasury / toPayees): gang tx asks the
@@ -1496,6 +1520,16 @@ async function main() {
1496
1520
  const launch = LAUNCH_FLAGS.find((f) => flag(f))
1497
1521
  if (launch) fail(`--${launch}: ${VAULT_ALONE}`)
1498
1522
  }
1523
+ // --base (3.0 opening base): a V3 create paid in BNB, alone: no 打新 / 铸币飞轮, no chained launch
1524
+ if (tokenCreate && (flag('base') || flag('base-vest'))) {
1525
+ if (!flag('base')) fail('--base-vest needs --base 5 or --base 10 (the opening base size)')
1526
+ if (flyCreate || flag('fair') || cmd === 'fair') fail(`--base buys an opening base on a V3 curve token: leave --${flyCreate ? 'fly' : 'fair'} out`)
1527
+ // --promote / --vault first: a taxed --promote alone starts a launch in one command (a promoter pool module clone)
1528
+ const other = ['promote', 'promote-days', 'vault'].find((f) => flag(f))
1529
+ if (other) fail(other === 'vault' ? '--base and --vault can\'t go together: a token with an opening base is not bound to a vault' : `--${other}: --base and --promote can't go together (not offered with the opening base)`)
1530
+ const launch = LAUNCH_FLAGS.find((f) => flag(f))
1531
+ if (launch) fail(`--${launch}: ${BASE_ALONE}`)
1532
+ }
1499
1533
  // gang weekly apply takes the same --description / --website / --twitter as a create (they describe the token to come)
1500
1534
  const weeklyApply = cmd === 'weekly' && args[1] === 'apply'
1501
1535
  for (const name of LINK_FLAGS) {
@@ -1566,6 +1600,8 @@ async function main() {
1566
1600
  case 'floor':
1567
1601
  await refuseFly('a floor module')
1568
1602
  return runFloor(args[1], { opt, flag, out, fail, summarize: summarizePreview })
1603
+ case 'base':
1604
+ return runBase(args[1], { opt, flag, out, fail, summarize: summarizePreview })
1569
1605
  case 'weekly':
1570
1606
  return runWeekly(args[1], { opt, flag, out, fail, resolveLogo: resolveLogoUri })
1571
1607
  case 'capabilities':
package/src/mcp.js CHANGED
@@ -188,7 +188,7 @@ export const TOOLS = [
188
188
  { hash: HASH, pending: { type: 'boolean', description: 'Find the txs of trades approved in the Binance App (no hash needed)' }, testnet: TESTNET },
189
189
  (a) => (a.pending ? ['tx', '--pending'] : ['tx', '--hash', a.hash, ...bool('testnet', a.testnet)]), PREVIEW),
190
190
  tool('gang_cli', 'Other gang commands',
191
- 'Every other gang command, its flags as separate items (gang_help lists them all): create (V3; create --fair = fair mint; create --fly = Mint Flywheel; launch in one command with --dev-buy / --bond / --buyback / --split / --lp, several of the last three = one combined recipient, or --tax-cap <amount> = a capped recipient), mint (--ref <inviter> on a Mint Flywheel token), promote buy|status|earnings|claim|claim-pool|activate|work|sweep|bind|reclaim|release-dev (create --promote; gang_buy promoter), withdraw, claim, release, fly open-early|launch|invite, quote, list, upload-logo, bond post|topup|raise-hold|extend|status|start|report|settle|refund|burn|tx, call-bond post|status|report|settle|claim|burn|tx (bond your own buy note: gang buy, then call-bond post within 10 minutes), buyback status|set|set-payee|apply|bind|release|split|sweep, split status|distribute|release|set-payee|bind, lp status|set|set-payee|apply|bind|release|split|sweep|add, combo status|distribute|release|set-payee|bind|chunk, capped status|distribute|release|set-payee|bind|chunk, floor status|redeem|distribute|release|set-payee|bind (a token whose tax is kept as a treasury holders can redeem; redeem burns the tokens for good), creator-fee [--token] [--claim [--to]] (GangLaunchpad 2.0 / 3.0: 70% of the curve fee, kept for the creator), weekly [apply|withdraw] (the Gang weekly launch event; apply / withdraw preview, --yes on the user OK signs and submits), v3 income, version, capabilities; the flags no other tool takes (--calldata, --from, …) too. E.g. ["create","--name","My Token","--symbol","MYT","--logo","/Users/me/avatar.png"], ["bond","status","--token","0x…"]. Local files are read by this server: absolute paths, or --logo-uri <image URL>. Writes only preview, as above. execute / watch / help have their own tools.',
191
+ 'Every other gang command, its flags as separate items (gang_help lists them all): create (V3; create --fair = fair mint; create --fly = Mint Flywheel; launch in one command with --dev-buy / --bond / --buyback / --split / --lp, several of the last three = one combined recipient, or --tax-cap <amount> = a capped recipient), mint (--ref <inviter> on a Mint Flywheel token), promote buy|status|earnings|claim|claim-pool|activate|work|sweep|bind|reclaim|release-dev (create --promote; gang_buy promoter), withdraw, claim, release, fly open-early|launch|invite, quote, list, upload-logo, bond post|topup|raise-hold|extend|status|start|report|settle|refund|burn|tx, call-bond post|status|report|settle|claim|burn|tx (bond your own buy note: gang buy, then call-bond post within 10 minutes), buyback status|set|set-payee|apply|bind|release|split|sweep, split status|distribute|release|set-payee|bind, lp status|set|set-payee|apply|bind|release|split|sweep|add, combo status|distribute|release|set-payee|bind|chunk, capped status|distribute|release|set-payee|bind|chunk, floor status|redeem|distribute|release|set-payee|bind (a token whose tax is kept as a treasury holders can redeem; redeem burns the tokens for good), base status|release (create --base 5|10 --base-vest 30|90|180 on GangLaunchpad 3.0 buys an opening base paid in BNB, locked until graduation, then released linearly to the creator; lost for good if it never graduates), creator-fee [--token] [--claim [--to]] (GangLaunchpad 2.0 / 3.0: 70% of the curve fee, kept for the creator), weekly [apply|withdraw] (the Gang weekly launch event; apply / withdraw preview, --yes on the user OK signs and submits), v3 income, version, capabilities; the flags no other tool takes (--calldata, --from, …) too. E.g. ["create","--name","My Token","--symbol","MYT","--logo","/Users/me/avatar.png"], ["bond","status","--token","0x…"]. Local files are read by this server: absolute paths, or --logo-uri <image URL>. Writes only preview, as above. execute / watch / help have their own tools.',
192
192
  { args: { type: 'array', items: { type: 'string' }, minItems: 1 } }, (a) => a.args, { readOnlyHint: false, destructiveHint: false, openWorldHint: true }, ['args']),
193
193
  ]
194
194
  const BY_NAME = new Map(TOOLS.map((t) => [t.name, t]))
package/src/v3.js CHANGED
@@ -3,7 +3,7 @@ import { decimalsOf, defaultRefPool, dividendOf, VAULT_ABI, fundingStep as fund,
3
3
  import { API } from './discover.js'
4
4
  import { UA } from './version.js'
5
5
  import { walletFor } from './fair.js'
6
- import { atTokenPad, CREATOR_FEE_ABI, genFields, GRAD_TARGET_ABI, gradTargetBnbOf, gradTiersOf, KIND_UNREAD, MERGED_ERRORS_ABI, MERGED_HINTS, NOT_ON_MAINNET, notThisKind, PAD3_GEN, padNets, rpcTransport, tokenVaultOf, VAULT_GEN, VAULT_NO_BOND, vaultGenOf, vaultModeOf } from './gangpad.js'
6
+ import { atTokenPad, CREATOR_FEE_ABI, creatorFeeShareOf, genFields, GRAD_TARGET_ABI, gradTargetBnbOf, gradTiersOf, KIND_UNREAD, MERGED_ERRORS_ABI, MERGED_HINTS, NOT_ON_MAINNET, notThisKind, PAD3_GEN, padNets, rpcTransport, tokenVaultOf, VAULT_GEN, VAULT_NO_BOND, vaultGenOf, vaultModeOf } from './gangpad.js'
7
7
  import { createNote, curveCreatorFee } from './creatorfee.js'
8
8
  import { checkPromoter, DEFAULT_WINDOW_DAYS, firstBuyWarning, followPromoter, isMissingRead, HINTS as PROMOTE_HINTS, parsePromote, poolFactoryAddress, poolOf, promoteField, promoteLine, PROMOTE_PAD_ABI } from './promote.js'
9
9
  import { poolPayBnb, poolTrade } from './pool.js'
@@ -16,6 +16,7 @@ import { comboOf, decoyWarning } from './combo.js'
16
16
  import { cappedOf, decoyWarning as cappedDecoyWarning } from './capped.js'
17
17
  import { floorFactoryAddress, floorOf, floorShown, treasuryShare, typedFloorModule } from './floor.js'
18
18
  import { VANITY_ABI, vanityCreate, vanityDeployer } from './vanity.js'
19
+ import { BASE_LOST, BASE_NO_BOND, BASE_PAD_ABI, baseOf as baseVaultView, basePayoff, baseSupport, baseTaxLine, HINTS as BASE_HINTS, parseBase, scheduleLine } from './base.js'
19
20
 
20
21
  /**
21
22
  * `gang v3 …` — LaunchpadV3 (tax recipient): a token with its own buy / sell tax (1–5% each), a dividend share and a
@@ -162,7 +163,7 @@ const VIRTUAL_TOKEN = 1_066_666_666_666_666_666_666_666_667n
162
163
  const ceilDiv = (a, b) => (a + b - 1n) / b
163
164
 
164
165
  /** Revert name (+ BadTaxConfig reason) of a failed call, or null when it was the RPC. */
165
- const revertOf = (e) => revertIn(e, [PAD_ABI, VANITY_ABI, PROMOTE_PAD_ABI, CREATOR_FEE_ABI, GRAD_TARGET_ABI, TAX_ROUTER_ABI, GANG_ROUTER_ABI, MERGED_ERRORS_ABI], { BadPromoteTerms: PROMOTE_HINTS.BadPromoteTerms, TraderNotOrigin: PROMOTE_HINTS.TraderNotOrigin, ...MERGED_HINTS, ...ROUTER_HINTS, ...HINTS })
166
+ const revertOf = (e) => revertIn(e, [PAD_ABI, VANITY_ABI, BASE_PAD_ABI, PROMOTE_PAD_ABI, CREATOR_FEE_ABI, GRAD_TARGET_ABI, TAX_ROUTER_ABI, GANG_ROUTER_ABI, MERGED_ERRORS_ABI], { BadPromoteTerms: PROMOTE_HINTS.BadPromoteTerms, TraderNotOrigin: PROMOTE_HINTS.TraderNotOrigin, ...MERGED_HINTS, ...ROUTER_HINTS, ...BASE_HINTS, ...HINTS })
166
167
 
167
168
  /** eth_call `data` from `from`: { result } when it passes, { failed } with the revert (or RPC error) otherwise. */
168
169
  async function simulate(ctx, from, to, abi, functionName, args, value = 0n) {
@@ -397,13 +398,16 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
397
398
  const gen = await curveCreatorFee(ctx, token, c, net)
398
399
  const vault = await vaultView(ctx, token, c, net)
399
400
  const promote = await promoteField(ctx, token, { recipient: c.recipient, dividendPct: c.dividendPct, testnet })
401
+ // 3.0: the opening base (gang create --base): the vault, its size, period and progress
402
+ const baseSeen = await baseVaultView(ctx, token).catch((e) => ({ raw: null, error: `could not read the token's base vault (${e.shortMessage || e.message.split('\n')[0]})`, retry: `gang base status --token ${token}${net}` }))
403
+ const { raw: _baseRaw, ...baseField } = baseSeen ?? {}
400
404
  // 3.0: the rule set the token was created under (fixed for good; an upgrade adds rules for new tokens only)
401
405
  const tokenVersion = ctx.gen === PAD3_GEN ? await ctx.read(ctx.pad, PAD_ABI, 'tokenVersionOf', [token]).then(Number).catch(() => null) : null
402
406
  const nonWbnb = c.quote.toLowerCase() !== String(ctx.wbnb).toLowerCase()
403
407
  const graduationNote = c.graduationTargetBnb != null && !c.graduated
404
408
  ? gradLine(c.graduationTargetBnb, nonWbnb ? `${c.graduationAt} ${c.quoteSymbol || 'of the quote'}` : null) : null
405
409
  return out({
406
- success: true, chainId: Number(ctx.chainId), ...fees, ...pub, ...gen, ...(promote && { promote }), ...(tokenVersion != null && { tokenVersion }), ...(vault && { vault }), ...(graduationNote && { graduationNote }), taxNote, ...(swapBack && { swapBack }), ...(buyback && { buyback }),
410
+ success: true, chainId: Number(ctx.chainId), ...fees, ...pub, ...gen, ...(promote && { promote }), ...(baseSeen && { base: { ...baseField, ...(!baseField.error && { more: `gang base status --token ${token}${net}` }) } }), ...(tokenVersion != null && { tokenVersion }), ...(vault && { vault }), ...(graduationNote && { graduationNote }), taxNote, ...(swapBack && { swapBack }), ...(buyback && { buyback }),
407
411
  ...(split && { split: { ...split, ...splitWarn } }), ...(lp && { lp: { ...lp, ...lpWarn } }),
408
412
  ...(combo && { combo: { ...combo, ...(comboWarning && { warning: comboWarning }) } }),
409
413
  ...(capped && { capped: { ...capped, ...(cappedWarning && { warning: cappedWarning }) } }),
@@ -495,6 +499,22 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
495
499
  fail(error, extra)
496
500
  }
497
501
  if (promote && vault) fail('--promote and --vault can\'t go together: a token is made with one or the other')
502
+ // --base: the opening base (createWithBase, 3.0 once upgraded): 5% / 10% of the supply bought for the token's base
503
+ // vault in the create, paid in BNB, released to the creator after graduation. WBNB quote, no dividend, alone
504
+ if (flag('base-vest') && !flag('base')) fail('--base-vest goes with --base <5|10>')
505
+ const base = flag('base') ? parseBase(opt('base'), opt('base-vest')) : null
506
+ if (base?.error) {
507
+ const { error, ...extra } = base
508
+ fail(error, extra)
509
+ }
510
+ if (base) {
511
+ if (vault) fail('--base and --vault can\'t go together: a token with an opening base is not bound to a vault')
512
+ if (promote) fail('--base and --promote can\'t go together (not offered with the opening base)')
513
+ if (launchFloor || launchPoolModule) fail('--base goes on a plain create only: no chained launch')
514
+ if (flag('quote') && String(opt('quote')).toLowerCase() !== String(ctx.wbnb).toLowerCase()) fail('--base is for WBNB-quoted tokens only: leave --quote out', { got: opt('quote') })
515
+ if (flag('ref-pool')) fail('--base is for WBNB-quoted tokens only: leave --ref-pool out')
516
+ if (flag('dividend') && !/^0+(\.0+)?$/.test(opt('dividend') ?? '')) fail('--base can\'t go with a dividend: a base token takes --dividend 0 (the vault would take a share of the holders\' dividend)', { got: opt('dividend') })
517
+ }
498
518
  if (grad !== null && !(grad > 0)) fail('--grad must be the graduation target in BNB raised: 6, 9, 12 or 15', { got: opt('grad') ?? null })
499
519
  const buyTax = taxed ? taxOf('buy-tax') : 0
500
520
  const sellTax = taxed ? taxOf('sell-tax') : 0
@@ -545,6 +565,12 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
545
565
  fail(`--grad: this GangLaunchpad${ctx.gen ? ` (${ctx.gen})` : ''} has no graduation target to pick; every curve graduates at ${bnbOf(await ctx.read(ctx.pad, GRAD_TARGET_ABI, 'TARGET_GRAD_BNB'))} BNB raised: leave --grad out`)
546
566
  }
547
567
  if (grad !== null && !tiers.includes(grad)) fail(`--grad must be one of ${tiers.join(' / ')} (BNB raised)`, { got: opt('grad') })
568
+ // --base: asked of the pad before anything else is checked (mainnet before its upgrade has no opening base)
569
+ if (base) {
570
+ const support = await baseSupport(ctx)
571
+ if (support.unread) fail('could not check the pad for the opening base (RPC error)', { pad: ctx.pad, detail: support.unread, retry: 'same command again' })
572
+ if (!support.open) fail(`${support.why}: drop --base${testnet ? '' : ' (it is on the BSC testnet: --testnet)'}`, { pad: ctx.pad })
573
+ }
548
574
  // the recipient may be the creator itself: checkTaxConfigFor knows who creates (a pad without it: checkTaxConfig)
549
575
  const [ok, reason] = await ctx.read(ctx.pad, PAD_ABI, 'checkTaxConfigFor', [me, tax]).catch((e) => {
550
576
  if (!noSuchFunction(e)) throw e
@@ -584,11 +610,25 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
584
610
  fail(`GangLaunchpad ${ctx.gen ?? ctx.pad} has no promoter share yet: drop --promote`, { pad: ctx.pad })
585
611
  }
586
612
  }
587
- // createWithVault and createWithPromote always take the target (the pad's default when --grad is left out)
588
- const fn = vault ? 'createWithVault' : promote ? 'createWithPromote' : grad !== null ? 'createWithGradTarget' : 'create'
589
- const argsOf = (logoURI, metaURI) => [name, symbol, logoURI, metaURI, quote, refPool, tax,
590
- ...(vault ? [parseUnits(String(targetBnb), 18), vault] : promote ? [parseUnits(String(targetBnb), 18), promote.shareBps, promote.window] : grad !== null ? [parseUnits(String(grad), 18)] : [])]
591
- const createData = (logoURI, metaURI) => encodeFunctionData({ abi: PAD_ABI, functionName: fn, args: argsOf(logoURI, metaURI) })
613
+ // --base: the pad must have it (mainnet before its upgrade has not), and it names the exact BNB the create takes
614
+ let baseCost = 0n
615
+ if (base) {
616
+ try { baseCost = await ctx.read(ctx.pad, BASE_PAD_ABI, 'previewBaseCost', [parseUnits(String(targetBnb), 18), base.baseBps]) } catch (e) {
617
+ return fail('could not read the base cost from the pad (previewBaseCost)', revertOf(e) || { detail: e.shortMessage || e.message.split('\n')[0], retry: 'same command again' })
618
+ }
619
+ const native = await ctx.client.getBalance({ address: me })
620
+ if (native < baseCost) {
621
+ fail(`not enough BNB for the base: the create pays exactly ${formatUnits(baseCost, 18)} BNB, plus gas`, { wallet: me, haveBnb: formatUnits(native, 18), needBnb: formatUnits(baseCost, 18) })
622
+ }
623
+ }
624
+ // createWithVault, createWithPromote and createWithBase always take the target (the pad's default when --grad is left out)
625
+ const fn = base ? 'createWithBase' : vault ? 'createWithVault' : promote ? 'createWithPromote' : grad !== null ? 'createWithGradTarget' : 'create'
626
+ const argsOf = (logoURI, metaURI) => (base
627
+ ? [name, symbol, logoURI, metaURI, tax, parseUnits(String(targetBnb), 18), { baseBps: base.baseBps, vestDays: base.vestDays }]
628
+ : [name, symbol, logoURI, metaURI, quote, refPool, tax,
629
+ ...(vault ? [parseUnits(String(targetBnb), 18), vault] : promote ? [parseUnits(String(targetBnb), 18), promote.shareBps, promote.window] : grad !== null ? [parseUnits(String(grad), 18)] : [])])
630
+ const createAbi = base ? BASE_PAD_ABI : PAD_ABI
631
+ const createData = (logoURI, metaURI) => encodeFunctionData({ abi: createAbi, functionName: fn, args: argsOf(logoURI, metaURI) })
592
632
  const vanity = await vanityDeployer(ctx)
593
633
  const handler = vanity && taxed ? (await taxContracts(ctx)).handler : zeroAddress
594
634
  const prepareCreate = (logoURI, metaURI, fixed = null) => vanityCreate(ctx, me, createData(logoURI, metaURI), {
@@ -596,8 +636,9 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
596
636
  })
597
637
  // the logo / metadata strings never decide a revert: dry-run without them, so a create that would fail uploads nothing
598
638
  const probe = await prepareCreate('', '')
599
- const dry = await simulate(ctx, me, ctx.pad, probe.salt ? VANITY_ABI : PAD_ABI,
600
- probe.salt ? 'createWithSalt' : fn, probe.salt ? [probe.salt, createData('', '')] : argsOf('', ''))
639
+ // createWithSalt (abcd) or the entry itself; a base create sends exactly its cost either way
640
+ const dry = await simulate(ctx, me, ctx.pad, probe.salt ? VANITY_ABI : createAbi,
641
+ probe.salt ? 'createWithSalt' : fn, probe.salt ? [probe.salt, createData('', '')] : argsOf('', ''), baseCost)
601
642
  if (dry.failed) return out({ success: false, step: 'create', ...dry.failed })
602
643
  // a floor launch: the module was cloned for one token address, so the create reuses the metadata and the salt that
603
644
  // give it, and is refused when anything that decides the address (name, symbol, tax rates) changed since
@@ -629,7 +670,18 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
629
670
  const baseCreatorFee = await createNote(ctx, net)
630
671
  const creatorFee = baseCreatorFee && promote ? `${baseCreatorFee} Less the ${promote.shareBps / 100}% of it you give promoters on their bound wallets' trades.` : baseCreatorFee
631
672
  const poolModule = promote && !!launchPoolModule
632
- return out(notes.step(ctx, { from: me, to: ctx.pad, data: launch.data }, {
673
+ const baseView = base && {
674
+ sizePct: base.baseBps / 100, vestDays: base.vestDays, costBnb: formatUnits(baseCost, 18), payWithThisTx: `${formatUnits(baseCost, 18)} BNB (the tx's value: exactly what the pad's previewBaseCost asks for a ${base.baseBps / 100}% base at the ${targetBnb} BNB target)`,
675
+ what: `the pad buys ${base.baseBps / 100}% of the supply on the curve as the token's very first trade, for this token's own base vault (GangBaseVault, base-v1). The vault never trades and approves no one: the base cannot move before graduation`,
676
+ schedule: scheduleLine(base.vestDays),
677
+ payoff: basePayoff({ gradBnb: targetBnb, baseBps: base.baseBps, vestDays: base.vestDays, cost: baseCost, creatorFeeShareBps: (await creatorFeeShareOf(ctx).catch(() => null)) ?? undefined }),
678
+ ...(taxed && { tax: baseTaxLine({ taxed, sellTaxPct: sellTax, platformTaxPct: fees.platformTaxPct, selfRecipient }) }),
679
+ neverGraduates: BASE_LOST,
680
+ bond: BASE_NO_BOND,
681
+ wallet: 'the release always goes to the wallet that creates (this one), for good: if it is lost, the base goes there anyway. That wallet can still buy up to 1% on the curve on its own',
682
+ warning: `PERMANENT: ${formatUnits(baseCost, 18)} BNB is spent in this create; if the token never graduates, it and the base are locked for good. The size, the period and the recipient never change`,
683
+ }
684
+ return out(notes.step(ctx, { from: me, to: ctx.pad, data: launch.data, ...(base && { value: baseCost }) }, {
633
685
  step: 'create', chainId: Number(ctx.chainId), name, symbol, logoURI: logo.logoURI, ...(logo.uploaded && { uploaded: true }),
634
686
  metaURI: meta.metaURI, metadata: meta.metadata,
635
687
  quote: (await symbolOf(ctx, quote)) || quote, graduationTargetBnb: targetBnb, graduationAt: await units(ctx, quote, gradAmt),
@@ -652,6 +704,7 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
652
704
  note: promoteLine({ shareBps: promote.shareBps, windowDays: promote.windowDays, pool: poolModule, taxed, dividendPct: dividend }),
653
705
  },
654
706
  }),
707
+ ...(base && { base: baseView }),
655
708
  ...(vault && {
656
709
  padGen: ctx.gen, pad: ctx.pad, vault,
657
710
  vaultNote: 'the token is bound to this vault for good. Until graduation the token moves only through the pad: the vault locks a holder\'s tokens (counted in that holder\'s 1% cap) and releases them through the pad, for the holder that sends the tx and holds an Agent ID; after graduation it is a plain token. This create uses up the wallet\'s naming for the vault: one token per naming. A vault-bound token takes no GangBond (gang bond post refuses it): a lock moves tokens out of the creator\'s wallet, which would forfeit a bond',
package/src/vanity.js CHANGED
@@ -4,7 +4,8 @@ import { PAD3_GEN } from './gangpad.js'
4
4
 
5
5
  export const VANITY_ABI = parseAbi([
6
6
  'function vanityDeployer() view returns (address)',
7
- 'function createWithSalt(bytes32 salt, bytes data) returns (address token)',
7
+ // payable since the opening base (createWithBase takes BNB through it); every other entry it reaches takes none
8
+ 'function createWithSalt(bytes32 salt, bytes data) payable returns (address token)',
8
9
  'function tokenInitCodeHash(string name, string symbol, string uri, address handler, uint16 buyTaxBps, uint16 sellTaxBps, bool reclaimable) view returns (bytes32)',
9
10
  'function mintInitCodeHash(string name, string symbol, string uri, address handler, uint16 buyTaxBps, uint16 sellTaxBps, uint256 startSupply, uint256 maxSupply) view returns (bytes32)',
10
11
  'error InvalidSuffix()', 'error VanityContextRequired()', 'error BadVanityCall()',