@gangfun/cli 0.16.1 → 0.16.3

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
@@ -227,4 +227,4 @@ gang agents --window 30d --sort follow
227
227
 
228
228
  ## Version
229
229
 
230
- `0.16.1` · repo [gangfun/cli](https://github.com/gangfun/cli) · published to [npm](https://www.npmjs.com/package/@gangfun/cli) on push to `main`
230
+ `0.16.3` · repo [gangfun/cli](https://github.com/gangfun/cli) · published to [npm](https://www.npmjs.com/package/@gangfun/cli) on push to `main`
package/README.zh-CN.md CHANGED
@@ -200,4 +200,4 @@ gang agents --window 30d --sort follow
200
200
 
201
201
  ## 版本
202
202
 
203
- `0.16.1` · [gangfun/cli](https://github.com/gangfun/cli) · push 到 `main` 自动发布到 [npm](https://www.npmjs.com/package/@gangfun/cli)
203
+ `0.16.3` · [gangfun/cli](https://github.com/gangfun/cli) · push 到 `main` 自动发布到 [npm](https://www.npmjs.com/package/@gangfun/cli)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gangfun/cli",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
4
4
  "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.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/bond.js CHANGED
@@ -18,9 +18,10 @@ import { bawAddress } from './baw.js'
18
18
  // script/DeployGangBond.s.sol. Testnet: 2026-10-29, block 139463214, over the set-10 pad — the audited version (two-step
19
19
  // settle, one buy-back chunk per 4 minutes; earlier testnet versions: 0x587f…5d7E after the pair only, 0x5a99…d716
20
20
  // without the refund notice, 0xB034…EBE3 before the audit; docs/TESTNET-GANG-BOND-2026-10-28.md). Mainnet: 2026-10-29,
21
- // block 130335965, over the live pad 0x15CF…4365, same code (docs/MAINNET-GANG-BOND-2026-10-29.md). GANG_BOND /
22
- // GANG_TESTNET_BOND override either
23
- export const MAINNET_BOND = '0xf26F33432E33FcE615abf3801ca0c91D1C62C817'
21
+ // block 130407146, over the live pad 0x15CF…4365, with the re-review L-1 fix (a buy-back chunk is priced on what the
22
+ // pair received); it replaces 0xf26F…C817 (block 130335965, never used; CLI 0.15.1–0.16.1)
23
+ // (docs/MAINNET-GANG-BOND-2026-10-29.md). GANG_BOND / GANG_TESTNET_BOND override either
24
+ export const MAINNET_BOND = '0xe92dC940CB23Dc328639A7334e69F9CCdf3a14E4'
24
25
  export const TESTNET_BOND = '0xd6a8dd5d1E6641a34A255f25Db2B3ED397CB1086'
25
26
 
26
27
  export const BOND_ABI = parseAbi([
package/src/index.js CHANGED
@@ -289,7 +289,8 @@ graduated tokens only).
289
289
  pool and burned (0xdead), the rest to you (or --buyback-to <addr>; changeable later
290
290
  with gang buyback set-payee). Steps: clone your buy-back splitter
291
291
  (GangBuybackSplitterFactory; listed as a recipient in the same tx) → create with it as
292
- the recipient → bind → the rest of the launch. Without --buyback the tax goes to you
292
+ the recipient → bind → the rest of the launch. Without --buyback the tax goes to you.
293
+ Quote: WBNB (default), GANG or one listed in the pad's QuoteRegistry only
293
294
  gang create --fair … [--shares <n>] --bond <quote> [--bond-hold …] --bond-days <7-90>
294
295
  打新: create (the dev's --shares are bought in it) → bond. Progress is read from the
295
296
  chain (a token this wallet created with this symbol since the plan); a run that finds
package/src/launch.js CHANGED
@@ -40,6 +40,33 @@ const PAD_ABI = parseAbi([
40
40
  ])
41
41
  const ERC20_ABI = parseAbi(['function balanceOf(address) view returns (uint256)', 'function symbol() view returns (string)'])
42
42
  /** Flags only the chain reads; everything else goes to the step's own command. */
43
+ /** GANG on BSC mainnet: a quote gang.fun trusts besides WBNB and the pad's QuoteRegistry. */
44
+ const MAINNET_GANG_TOKEN = '0x0c6302401aa5325c2e36f170f52c00b1d220b405'
45
+ const REGISTRY_ABI = parseAbi(['function quoteRegistry() view returns (address)', 'function isQuoted(address quote) view returns (bool)'])
46
+
47
+ /**
48
+ * --buyback only over a quote gang.fun trusts (WBNB, GANG, or listed in the pad's QuoteRegistry): a splitter prices each
49
+ * buy-back chunk on what it sends, so a quote that taxes transfers into pairs fails the pair's K check on every chunk
50
+ * and the buy-back part is stuck for good (GangBond re-review L-1, 2026-10-29; splitter v3 has the same pricing).
51
+ * null when trusted; otherwise the failure to report.
52
+ */
53
+ async function untrustedBuybackQuote(read, net, quote) {
54
+ if (!isAddress(quote ?? '')) return { error: '--quote must be a 0x address', got: quote ?? null }
55
+ const q = quote.toLowerCase()
56
+ if (q === String(net.wbnb).toLowerCase() || (String(net.chainId) === '56' && q === MAINNET_GANG_TOKEN)) return null
57
+ const registry = await read(net.pad, REGISTRY_ABI, 'quoteRegistry').catch(() => null)
58
+ const listed = registry === null ? null
59
+ : registry === zeroAddress ? false
60
+ : await read(registry, REGISTRY_ABI, 'isQuoted', [quote]).catch(() => null)
61
+ if (listed) return null
62
+ return {
63
+ error: listed === null
64
+ ? 'could not read the pad\'s QuoteRegistry to check the --buyback quote: try again'
65
+ : '--buyback needs WBNB, GANG or a quote listed in the pad\'s QuoteRegistry: the buy-back splitter cannot buy back with a quote that taxes transfers into the pair, and an unlisted quote may do that',
66
+ quote, hint: 'drop --quote (WBNB), use a listed quote, or launch without --buyback',
67
+ }
68
+ }
69
+
43
70
  export const LAUNCH_FLAGS = ['dev-buy', 'bond', 'bond-hold', 'bond-days', 'buyback', 'buyback-to', 'restart']
44
71
  const NOTE_FLAGS = ['note', 'conf', 'reveal-after']
45
72
  /** `gang fair create --dev-buy`, with or without --bond (index.js stops the lone flag, runLaunch the chained one). */
@@ -152,6 +179,11 @@ export async function runLaunch(kind, { io, runV3, runFair, runBond, padNotes })
152
179
  // ---- buy-back splitter: cloned for the dev before the create, at predict(dev, plan.salt)
153
180
  if (buyback && !created) {
154
181
  if (!plan?.salt) {
182
+ const refused = await untrustedBuybackQuote(read, net, flag('quote') ? opt('quote') : net.wbnb)
183
+ if (refused) {
184
+ const { error, ...extra } = refused
185
+ return fail(error, extra)
186
+ }
155
187
  const salt = `0x${randomBytes(32).toString('hex')}`
156
188
  const at = await read(buyback.factory, FACTORY_ABI, 'predict', [me, salt])
157
189
  const args = [buyback.bps, salt, buyback.payee ?? zeroAddress]