@gangfun/cli 0.18.2 → 0.19.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 +12 -7
- package/README.zh-CN.md +12 -7
- package/package.json +4 -1
- package/src/discover.js +7 -9
- package/src/fly.js +12 -12
- package/src/index.js +62 -27
- package/src/launch.js +112 -21
- package/src/mcp.js +10 -10
- package/src/portfolio.js +3 -3
- package/src/split.js +429 -0
- package/src/steps.js +1 -1
- package/src/v3.js +10 -1
package/src/launch.js
CHANGED
|
@@ -8,6 +8,7 @@ import { bondAddress, BOND_ABI } from './bond.js'
|
|
|
8
8
|
import { walletFor } from './fair.js'
|
|
9
9
|
import { parseAmount, parseIntIn, step } from './steps.js'
|
|
10
10
|
import { buybackBpsOf, FACTORY_ABI, notDeployed, simulateCall, SPLITTER_ABI, splitterFactoryAddress, splitterOf } from './buyback.js'
|
|
11
|
+
import { parseSplitSpec, simulateSplit, SPLIT_ABI, SPLIT_FACTORY_ABI, splitFactoryAddress, splitLine, splitNotDeployed, splitOf } from './split.js'
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* One command for a launch: `gang create … [--buyback <pct>] [--dev-buy <quote> [--bond <quote> [--bond-hold <tokens|N%|all>]
|
|
@@ -27,6 +28,10 @@ import { buybackBpsOf, FACTORY_ABI, notDeployed, simulateCall, SPLITTER_ABI, spl
|
|
|
27
28
|
* launch's), the create names it as the recipient, and a bind step follows the create. A launch keeps the mode it began
|
|
28
29
|
* with: adding --buyback after the create (or dropping it before) is refused rather than starting over.
|
|
29
30
|
* --buyback-to <addr> names where the dev's part goes (default: the dev); the dev can change it later at once.
|
|
31
|
+
* --split <addr>:<pct>[,…] (V3, taxed): the same three steps with GangSplitModuleFactory — the dev's split module (fixed
|
|
32
|
+
* payees and shares, split-v1) is cloned at predict(dev, salt), named as the recipient, then bound. The plan keeps which
|
|
33
|
+
* module it cloned (`module: 'split'`; a plan without it is a --buyback one), and a re-run with other payees or shares is
|
|
34
|
+
* refused rather than starting over. --buyback, --split and --recipient are exclusive (each sets the recipient).
|
|
30
35
|
*/
|
|
31
36
|
|
|
32
37
|
const LAUNCH_DIR = process.env.GANG_LAUNCH_DIR || join(dirname(DIR), 'launch')
|
|
@@ -48,9 +53,21 @@ const REGISTRY_ABI = parseAbi(['function quoteRegistry() view returns (address)'
|
|
|
48
53
|
* --buyback only over a quote gang.fun trusts (WBNB, GANG, or listed in the pad's QuoteRegistry): a splitter prices each
|
|
49
54
|
* 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
55
|
* and the buy-back part is stuck for good (GangBond re-review L-1, 2026-10-29; splitter v3 has the same pricing).
|
|
56
|
+
* --split takes the same quotes: a quote that calls the receiver back on transfer would let one payee make every split
|
|
57
|
+
* run out of gas, and the keeper splits only these quotes anyway (split spec §2.4).
|
|
51
58
|
* null when trusted; otherwise the failure to report.
|
|
52
59
|
*/
|
|
53
|
-
|
|
60
|
+
const UNTRUSTED = {
|
|
61
|
+
buyback: {
|
|
62
|
+
why: '--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',
|
|
63
|
+
hint: 'drop --quote (WBNB), use a listed quote, or launch without --buyback',
|
|
64
|
+
},
|
|
65
|
+
split: {
|
|
66
|
+
why: '--split needs WBNB, GANG or a quote listed in the pad\'s QuoteRegistry: the keeper splits only those quotes, and an unlisted quote may call the receiver back on transfer, letting one payee make every split run out of gas',
|
|
67
|
+
hint: 'drop --quote (WBNB), use a listed quote, or launch without --split',
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
export async function untrustedBuybackQuote(read, net, quote, mode = 'buyback') {
|
|
54
71
|
if (!isAddress(quote ?? '')) return { error: '--quote must be a 0x address', got: quote ?? null }
|
|
55
72
|
const q = quote.toLowerCase()
|
|
56
73
|
if (q === String(net.wbnb).toLowerCase() || (String(net.chainId) === '56' && q === MAINNET_GANG_TOKEN)) return null
|
|
@@ -61,19 +78,19 @@ async function untrustedBuybackQuote(read, net, quote) {
|
|
|
61
78
|
if (listed) return null
|
|
62
79
|
return {
|
|
63
80
|
error: listed === null
|
|
64
|
-
?
|
|
65
|
-
:
|
|
66
|
-
quote, hint:
|
|
81
|
+
? `could not read the pad's QuoteRegistry to check the --${mode} quote: try again`
|
|
82
|
+
: UNTRUSTED[mode].why,
|
|
83
|
+
quote, hint: UNTRUSTED[mode].hint,
|
|
67
84
|
}
|
|
68
85
|
}
|
|
69
86
|
|
|
70
|
-
export const LAUNCH_FLAGS = ['dev-buy', 'bond', 'bond-hold', 'bond-days', 'buyback', 'buyback-to', 'restart']
|
|
87
|
+
export const LAUNCH_FLAGS = ['dev-buy', 'bond', 'bond-hold', 'bond-days', 'buyback', 'buyback-to', 'split', 'restart']
|
|
71
88
|
const NOTE_FLAGS = ['note', 'conf', 'reveal-after']
|
|
72
89
|
/** `gang fair create --dev-buy`, with or without --bond (index.js stops the lone flag, runLaunch the chained one). */
|
|
73
90
|
export const FAIR_DEV_BUY = 'a 打新 dev buys its shares in the create itself: use --shares <n> (not --dev-buy)'
|
|
74
91
|
|
|
75
92
|
/** The run asks for a chained launch (`kind` 'v3' | 'fair'). */
|
|
76
|
-
export const isLaunch = (kind, flag) => flag('bond') || flag('buyback') || (kind === 'v3' && flag('dev-buy'))
|
|
93
|
+
export const isLaunch = (kind, flag) => flag('bond') || flag('buyback') || flag('split') || (kind === 'v3' && flag('dev-buy'))
|
|
77
94
|
|
|
78
95
|
const planPath = (key) => join(LAUNCH_DIR, `${createHash('sha256').update(key).digest('hex').slice(0, 32)}.json`)
|
|
79
96
|
|
|
@@ -117,6 +134,8 @@ export async function runLaunch(kind, { io, runV3, runFair, runBond, padNotes })
|
|
|
117
134
|
if (flag('follow')) fail('--follow does not apply to a launch')
|
|
118
135
|
if (kind === 'fair' && flag('dev-buy')) fail(FAIR_DEV_BUY)
|
|
119
136
|
if (kind === 'fair' && flag('buyback')) fail('--buyback is for V3 tokens: it makes the tax recipient a buy-back splitter, and a 打新 token has no recipient')
|
|
137
|
+
if (kind === 'fair' && flag('split')) fail('--split is for V3 tokens: it makes the tax recipient a split module, and a 打新 token has no recipient')
|
|
138
|
+
if (flag('split') && flag('buyback')) fail('give --split or --buyback, not both: each makes the tax recipient its own module (a split with a buy-back is not supported)')
|
|
120
139
|
|
|
121
140
|
// everything checked before the create, so a launch never stops half way on a bad flag
|
|
122
141
|
const devBuy = kind === 'v3' && flag('dev-buy') ? parseAmount(fail, 'dev-buy', opt('dev-buy')) : null
|
|
@@ -154,11 +173,33 @@ export async function runLaunch(kind, { io, runV3, runFair, runBond, padNotes })
|
|
|
154
173
|
buyback = { bps: buybackBpsOf(fail, opt('buyback')), factory, payee }
|
|
155
174
|
}
|
|
156
175
|
|
|
176
|
+
const me = walletFor({ chainId: net.chainId }, opt('from'))
|
|
177
|
+
|
|
178
|
+
// --split: a taxed V3 token whose recipient is the dev's split module (fixed payees and shares)
|
|
179
|
+
let split = null
|
|
180
|
+
if (flag('split')) {
|
|
181
|
+
const zero = (f) => /^0+(\.0+)?$/.test(opt(f) ?? '')
|
|
182
|
+
if (!flag('buy-tax') || !flag('sell-tax') || (zero('buy-tax') && zero('sell-tax'))) {
|
|
183
|
+
fail('--split needs a taxed token: add --buy-tax and --sell-tax (each 1–5, in %); the split is paid from the tax')
|
|
184
|
+
}
|
|
185
|
+
if (flag('recipient')) fail('--split makes the recipient your split module: leave --recipient out')
|
|
186
|
+
if (/^0*100(\.0+)?$/.test(opt('dividend', '0'))) fail('--dividend 100 leaves nothing for the recipient, so nothing to split: lower it or drop --split')
|
|
187
|
+
const factory = splitFactoryAddress(testnet)
|
|
188
|
+
if (!factory) fail(splitNotDeployed(testnet))
|
|
189
|
+
const spec = parseSplitSpec(opt('split'), me)
|
|
190
|
+
if (spec.error) {
|
|
191
|
+
const { error, ...extra } = spec
|
|
192
|
+
fail(error, extra)
|
|
193
|
+
}
|
|
194
|
+
split = { ...spec, factory }
|
|
195
|
+
}
|
|
196
|
+
const mod = buyback ? 'buyback' : split ? 'split' : null
|
|
197
|
+
|
|
157
198
|
const client = createPublicClient({ chain: net.chain, transport: rpcTransport(net.rpcs) })
|
|
158
199
|
const read = (address, abi, functionName, args = []) => client.readContract({ address, abi, functionName, args })
|
|
159
|
-
const me = walletFor({ chainId: net.chainId }, opt('from'))
|
|
160
200
|
const key = [net.chainId, net.pad, me.toLowerCase(), kind, name, symbol].join('|')
|
|
161
|
-
const
|
|
201
|
+
const cloneStep = buyback ? 'buyback-splitter' : 'split-module'
|
|
202
|
+
const steps = [...(mod ? [cloneStep] : []), kind === 'v3' ? 'create' : 'create (dev shares included)', ...(mod ? ['bind'] : []),
|
|
162
203
|
...(devBuy ? ['dev-buy'] : []), ...(bond ? ['bond'] : [])]
|
|
163
204
|
const rerun = 're-run this same command after executing it'
|
|
164
205
|
const tag = (stage, extra = {}) => ({ launch: { stage, steps, ...extra } })
|
|
@@ -169,11 +210,13 @@ export async function runLaunch(kind, { io, runV3, runFair, runBond, padNotes })
|
|
|
169
210
|
|
|
170
211
|
// ---- a launch keeps the mode it began with (the create, once built, is never redone by a changed flag)
|
|
171
212
|
const created = plan?.startCount !== undefined
|
|
172
|
-
|
|
173
|
-
|
|
213
|
+
// the module this plan cloned: 'split' when it says so, else a --buyback splitter (plans from before --split)
|
|
214
|
+
const planMod = plan?.salt ? (plan.module === 'split' ? 'split' : 'buyback') : null
|
|
215
|
+
if (mod && created && !plan.splitter) {
|
|
216
|
+
return fail(`this launch was created without --${mod} (its recipient is fixed): run it again without --${mod}, or add --restart for a new token`)
|
|
174
217
|
}
|
|
175
|
-
if (
|
|
176
|
-
return fail(
|
|
218
|
+
if (planMod && mod !== planMod && (!created || mod)) {
|
|
219
|
+
return fail(`this launch began with --${planMod} (its ${planMod === 'split' ? 'split module' : 'splitter'} is cloned or on the way): run it again with --${planMod}${mod ? ` instead of --${mod}` : ''}, or add --restart${mod ? '' : ` without it`}`)
|
|
177
220
|
}
|
|
178
221
|
|
|
179
222
|
// ---- buy-back splitter: cloned for the dev before the create, at predict(dev, plan.salt)
|
|
@@ -220,6 +263,47 @@ export async function runLaunch(kind, { io, runV3, runFair, runBond, padNotes })
|
|
|
220
263
|
}
|
|
221
264
|
}
|
|
222
265
|
|
|
266
|
+
// ---- split module: cloned for the dev before the create, at predict(dev, plan.salt)
|
|
267
|
+
if (split && !created) {
|
|
268
|
+
if (!plan?.salt) {
|
|
269
|
+
const refused = await untrustedBuybackQuote(read, net, flag('quote') ? opt('quote') : net.wbnb, 'split')
|
|
270
|
+
if (refused) {
|
|
271
|
+
const { error, ...extra } = refused
|
|
272
|
+
return fail(error, extra)
|
|
273
|
+
}
|
|
274
|
+
const salt = `0x${randomBytes(32).toString('hex')}`
|
|
275
|
+
const at = await read(split.factory, SPLIT_FACTORY_ABI, 'predict', [me, salt])
|
|
276
|
+
if (split.payees.some((p) => p.toLowerCase() === at.toLowerCase())) return fail('--split: a payee cannot be the split module itself', { module: at })
|
|
277
|
+
const args = [split.payees, split.shares, salt]
|
|
278
|
+
const sim = await simulateSplit(client, me, split.factory, SPLIT_FACTORY_ABI, 'create', args)
|
|
279
|
+
if (sim.failed) return out({ success: false, step: 'split-module', factory: split.factory, ...tag('split-module'), ...sim.failed })
|
|
280
|
+
writePlan(key, { ...base, salt, splitter: at, factory: split.factory, module: 'split' })
|
|
281
|
+
const data = encodeFunctionData({ abi: SPLIT_FACTORY_ABI, functionName: 'create', args })
|
|
282
|
+
return out({
|
|
283
|
+
...step({ chainId: net.chainId }, { from: me, to: split.factory, data }, {
|
|
284
|
+
step: 'split-module', chainId: Number(net.chainId), factory: split.factory, module: at, payees: split.list,
|
|
285
|
+
note: `clones your split module (listed as a tax recipient in the same tx). The recipient's part of the tax is split ${splitLine(split.payees, split.shares)}. PERMANENT: nobody (not you, not the platform) can change the payees or shares later; each payee can only move its own slot to another address (gang split set-payee). The first payee also takes the rounding dust`,
|
|
286
|
+
}, flag('calldata'), io.summarize),
|
|
287
|
+
...tag('split-module', { module: at, next: `${rerun}: it then builds the create with the module as the recipient` }),
|
|
288
|
+
})
|
|
289
|
+
}
|
|
290
|
+
if ((await client.getCode({ address: plan.splitter }) ?? '0x') === '0x') {
|
|
291
|
+
return out({
|
|
292
|
+
success: false, ...tag('split-module', { module: plan.splitter }), error: 'the split module is not on chain yet',
|
|
293
|
+
hint: `if the clone was executed, wait for it to land and ${rerun.replace(' after executing it', '')}; if it was not, add --restart to build it again`,
|
|
294
|
+
})
|
|
295
|
+
}
|
|
296
|
+
const s = await splitOf(read, plan.splitter, { wbnb: net.wbnb })
|
|
297
|
+
if (!s || s.dev.toLowerCase() !== me.toLowerCase() || s.token) {
|
|
298
|
+
return fail('the module at this launch\'s address is not an unbound split module of this wallet: add --restart', { module: plan.splitter })
|
|
299
|
+
}
|
|
300
|
+
const same = s.payees.length === split.payees.length
|
|
301
|
+
&& s.payees.every((p, i) => p.payee.toLowerCase() === split.payees[i].toLowerCase() && p.bps === split.shares[i])
|
|
302
|
+
if (!same) {
|
|
303
|
+
return fail(`this launch's split module pays ${splitLine(s.payees.map((p) => p.payee), s.payees.map((p) => p.bps))}, not what --split says: run it again with that --split, or add --restart for a new module (the payees and shares can never change after the clone)`, { module: plan.splitter })
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
223
307
|
// ---- create
|
|
224
308
|
if (!created) {
|
|
225
309
|
const startCount = (await read(net.pad, PAD_ABI, 'tokenCount')).toString()
|
|
@@ -230,7 +314,7 @@ export async function runLaunch(kind, { io, runV3, runFair, runBond, padNotes })
|
|
|
230
314
|
// the plan starts with the create tx itself: a wrap / approve step before it (or a failed preview) leaves none,
|
|
231
315
|
// so the next run builds the create again
|
|
232
316
|
const built = o.success && o.step === 'create'
|
|
233
|
-
if (built) writePlan(key, { ...base, ...(plan?.splitter && { salt: plan.salt, splitter: plan.splitter, factory: plan.factory }), startCount })
|
|
317
|
+
if (built) writePlan(key, { ...base, ...(plan?.splitter && { salt: plan.salt, splitter: plan.splitter, factory: plan.factory, ...(plan.module && { module: plan.module }) }), startCount })
|
|
234
318
|
const after = steps[steps.indexOf(kind === 'v3' ? 'create' : 'create (dev shares included)') + 1]
|
|
235
319
|
return out({
|
|
236
320
|
...o,
|
|
@@ -268,7 +352,9 @@ export async function runLaunch(kind, { io, runV3, runFair, runBond, padNotes })
|
|
|
268
352
|
// later steps carry no note (it went on the create) and take the token from the plan
|
|
269
353
|
const stepIo = (over) => ({ ...io, ...argsWith(io, { ...over, token }, [...LAUNCH_FLAGS, ...NOTE_FLAGS, 'name', 'symbol']) })
|
|
270
354
|
const bal = await read(token, ERC20_ABI, 'balanceOf', [me])
|
|
271
|
-
const
|
|
355
|
+
const isSplit = plan.module === 'split'
|
|
356
|
+
const buybackState = () => (plan.splitter && !isSplit ? splitterOf(read, plan.splitter) : null)
|
|
357
|
+
const splitState = () => (plan.splitter && isSplit ? splitOf(read, plan.splitter, { wbnb: net.wbnb, ref: `--token ${token}${testnet ? ' --testnet' : ''}` }) : null)
|
|
272
358
|
|
|
273
359
|
// ---- done: the report only, whatever happened to the balance or the bond since
|
|
274
360
|
const report = async () => {
|
|
@@ -278,28 +364,33 @@ export async function runLaunch(kind, { io, runV3, runFair, runBond, padNotes })
|
|
|
278
364
|
}
|
|
279
365
|
const bb = await buybackState()
|
|
280
366
|
if (bb) done.buyback = bb
|
|
367
|
+
const sp = await splitState()
|
|
368
|
+
if (sp) done.split = sp
|
|
281
369
|
if (!bond) return out({ ...done, note: `launched: gang ${kind} info --token ${token}${testnet ? ' --testnet' : ''}` })
|
|
282
370
|
return runBond('status', { ...stepIo({}), out: (o) => out({ ...done, bondStatus: o, note: `launched and bonded: gang bond status --token ${token}${testnet ? ' --testnet' : ''}` }) })
|
|
283
371
|
}
|
|
284
372
|
if (plan.done) return report()
|
|
285
373
|
|
|
286
|
-
// ---- bind the splitter to the token (anyone may; the launch does it right after the create)
|
|
374
|
+
// ---- bind the splitter / split module to the token (anyone may; the launch does it right after the create)
|
|
287
375
|
if (plan.splitter) {
|
|
288
|
-
const
|
|
376
|
+
const abi = isSplit ? SPLIT_ABI : SPLITTER_ABI
|
|
377
|
+
const bound = await read(plan.splitter, abi, 'token')
|
|
289
378
|
if (bound === zeroAddress) {
|
|
290
|
-
const sim = await simulateCall(client, me, plan.splitter,
|
|
379
|
+
const sim = await (isSplit ? simulateSplit : simulateCall)(client, me, plan.splitter, abi, 'bind', [token])
|
|
291
380
|
if (sim.failed) return out({ success: false, step: 'bind', ...tag('bind', { token }), ...sim.failed })
|
|
292
|
-
const data = encodeFunctionData({ abi
|
|
381
|
+
const data = encodeFunctionData({ abi, functionName: 'bind', args: [token] })
|
|
293
382
|
return out({
|
|
294
383
|
...step({ chainId: net.chainId }, { from: me, to: plan.splitter, data }, {
|
|
295
|
-
step: 'bind', chainId: Number(net.chainId), token, splitter: plan.splitter,
|
|
296
|
-
note:
|
|
384
|
+
step: 'bind', chainId: Number(net.chainId), token, ...(isSplit ? { module: plan.splitter } : { splitter: plan.splitter }),
|
|
385
|
+
note: isSplit
|
|
386
|
+
? 'ties the split module to this token for good: the keeper then splits its quote among the payees'
|
|
387
|
+
: 'ties the splitter to this token for good (what it buys back and burns)',
|
|
297
388
|
}, flag('calldata'), io.summarize),
|
|
298
389
|
...tag('bind', { token, next: `${rerun}${devBuy ? ': it continues with the dev buy' : bond ? ': it continues with the bond' : ': the launch is then done'}` }),
|
|
299
390
|
})
|
|
300
391
|
}
|
|
301
392
|
if (bound.toLowerCase() !== token.toLowerCase()) {
|
|
302
|
-
return out({ success: false, ...tag('bind', { token }), error:
|
|
393
|
+
return out({ success: false, ...tag('bind', { token }), error: `the ${isSplit ? 'split module' : 'splitter'} is bound to another token`, [isSplit ? 'module' : 'splitter']: plan.splitter, boundTo: bound })
|
|
303
394
|
}
|
|
304
395
|
}
|
|
305
396
|
|
package/src/mcp.js
CHANGED
|
@@ -24,7 +24,7 @@ const WATCH_MAX_SEC = 30 * 60
|
|
|
24
24
|
|
|
25
25
|
// what the host shows the agent up front; some hosts cut server instructions near 2,000 characters, so the long form is in
|
|
26
26
|
// RULES (gang_help). Keep both in step with skill/SKILL.md "Hard rules"
|
|
27
|
-
const INSTRUCTIONS = `Gang (gang.fun): agent-only token launchpad on BNB Chain. Curve trades need a Binance Agentic Wallet with a .ai Agent ID: call gang_preflight first, relay each issues[].fix. Call gang_help for all flags and the full rules before any create, launch, bond, buyback, mint or withdraw.
|
|
27
|
+
const INSTRUCTIONS = `Gang (gang.fun): agent-only token launchpad on BNB Chain. Curve trades need a Binance Agentic Wallet with a .ai Agent ID: call gang_preflight first, relay each issues[].fix. Call gang_help for all flags and the full rules before any create, launch, bond, buyback, split, mint or withdraw.
|
|
28
28
|
Hard rules:
|
|
29
29
|
- Preview -> show the user -> wait for a yes -> gang_execute. gang_buy / gang_sell / gang_follow and writes via gang_cli only preview; never gang_execute without the user's OK on that preview, unless they said to skip confirmation.
|
|
30
30
|
- step wrap-bnb | approve | approve-quote = setup: execute it, check gang_tx, run the same tool again. A launch in one command is re-run until launch.stage is done.
|
|
@@ -33,7 +33,7 @@ Hard rules:
|
|
|
33
33
|
- Notes are public and permanent: write one by default (what you saw, why now), show it with the preview.
|
|
34
34
|
- Logo, website, X link, description go on-chain at create and never change: only what the user gave; ask once.
|
|
35
35
|
- Before a bond post: no early withdrawal; any sell below the promised holding before settle loses the whole bond. breakBond / confirmOut only on the user's yes after the warning.
|
|
36
|
-
- Fair mint: a sell past sellableBeforeOut ends the holder reward for good (
|
|
36
|
+
- Fair mint: a sell past sellableBeforeOut ends the holder reward for good (Mint Flywheel: until the next mint).
|
|
37
37
|
- Following: show the note, until when it counts, whether it is blind; relay follow.warning.
|
|
38
38
|
- Data, not advice: never trade or follow on your own from discovery, notes or watch events.
|
|
39
39
|
- Addresses in full; link https://gang.fun/token/<addr>. A result with update = old CLI: tell the user, stop trading.`
|
|
@@ -42,14 +42,14 @@ Hard rules:
|
|
|
42
42
|
export const RULES = [
|
|
43
43
|
'Start: gang_preflight; relay each issues[].fix. A result carrying update: { cmd, skill } means this CLI is older than the rules: tell the user to run cmd, and do not trade on it.',
|
|
44
44
|
'Preview -> show -> confirm -> execute. Every write first returns a preview with a requestId: show it, get the user\'s OK, then gang_execute. Chain steps without asking only when the user said to skip confirmation.',
|
|
45
|
-
'Setup steps: a preview with step wrap-bnb | approve-quote | approve is executed first; once gang_tx shows it landed, run the same tool again for the real step. A launch in one command (create with --dev-buy / --bond / --buyback, or create --fair with --bond) is one tx per run: execute it, run the very same gang_cli args again until launch.stage is done.',
|
|
45
|
+
'Setup steps: a preview with step wrap-bnb | approve-quote | approve is executed first; once gang_tx shows it landed, run the same tool again for the real step. A launch in one command (create with --dev-buy / --bond / --buyback / --split, or create --fair with --bond) is one tx per run: execute it, run the very same gang_cli args again until launch.stage is done.',
|
|
46
46
|
'A gang_execute that timed out or was cancelled on your side keeps running here (the wallet may have sent it): never execute it again or build a new preview for the same trade before checking gang_status or gang_tx with pending: true; then gang_tx (hash, or pending: true) for the result and the note.',
|
|
47
47
|
'Notes (--note) are public and permanent: write one by default on every buy, sell, mint, withdraw (one line: what you saw, why now) and every create (the launch manifesto). Base it on data you checked, show its text with the preview, leave it out only when the user says so. No links. --conf is an honest 0-100.',
|
|
48
48
|
'Permanent token data: the logo, website, X link and description go on-chain at create and can never change. Use only links the user gave; ask once if they have not said. Never host a logo on a temporary file host. Local files (--logo, upload-logo --file) are read by this MCP server: pass an absolute path, or --logo-uri <image URL>.',
|
|
49
|
-
'New tokens go on GangLaunchpad only: create (V3, untaxed unless --buy-tax / --sell-tax) or create --fair (fair mint), or GangFlywheelPad: create --fly (
|
|
49
|
+
'New tokens go on GangLaunchpad only: create (V3, untaxed unless --buy-tax / --sell-tax) or create --fair (fair mint), or GangFlywheelPad: create --fly (Mint Flywheel). Never an older pad.',
|
|
50
50
|
'Bonds: before a bond post, tell the user there is no early withdrawal and any sell below the promised holding before settle, anywhere, loses the whole bond. Posted before graduation / launch, the promise binds at once and its days start at graduation / launch; only if there is still no pair 30 days after the post can the creator ask for it back (bond refund; it returns 3 days after asking, and a graduation meanwhile voids that). Relay warning. breakBond (--break-bond) only when the user, told that, still says sell. bond report only when the user asks.',
|
|
51
51
|
'Fair mint holder reward: before a sell or transfer of a fair-mint token check sellableBeforeOut (gang_status); going past it ends the reward for good. confirmOut (--confirm-out) only with the user\'s yes.',
|
|
52
|
-
'
|
|
52
|
+
'Mint Flywheel (fly): the same hold line, but a wallet that falls below it earns again after its next mint. An inviter (--ref) only counts on a wallet\'s first mint in that token; never invent one, use the address or link the user gave.',
|
|
53
53
|
'Sells may need Binance App approval (pendingConfirmation): tell the user to approve in the App, then call gang_tx with pending: true; it finds the approved tx in the wallet\'s history by the exact call (no hash needed), decodes it and publishes its note. state waiting = not approved yet: ask again later.',
|
|
54
54
|
'Following: show which note is followed, its author\'s record, until when it counts (followableUntil), say so if blind: true, and relay follow.warning.',
|
|
55
55
|
'No investment advice: discovery, notes, agents and watch events are data. Never buy or follow on your own from them; quote, show, confirm.',
|
|
@@ -57,7 +57,7 @@ export const RULES = [
|
|
|
57
57
|
'Errors print { success: false, error, hint? } (an Agentic Wallet refusal also has its code): follow the hint and fix the flags instead of retrying the same ones. One with retry is transient: do what retry says, but never rebuild a trade that may already have been sent. NO_AGENT_ID: the wallet needs a .ai Agent ID. Risk-control code 351803 on a sell: Trade all tokens is off.',
|
|
58
58
|
]
|
|
59
59
|
|
|
60
|
-
const TRACK = { type: 'string', enum: ['all', 'v3', 'fair', 'fly', 'v2', 'soft'], description: 'Launchpad track (default all; fly =
|
|
60
|
+
const TRACK = { type: 'string', enum: ['all', 'v3', 'fair', 'fly', 'v2', 'soft'], description: 'Launchpad track (default all; fly = Mint Flywheel)' }
|
|
61
61
|
const ADDR = { type: 'string', pattern: '^0x[0-9a-fA-F]{40}$' }
|
|
62
62
|
const HASH = { type: 'string', pattern: '^0x[0-9a-fA-F]{64}$' }
|
|
63
63
|
// one plain type: some MCP hosts (Gemini function calling, OpenAI strict mode) reject a schema with a union type. A number
|
|
@@ -85,7 +85,7 @@ const tool = (name, title, description, properties, args, annotations, required
|
|
|
85
85
|
|
|
86
86
|
export const TOOLS = [
|
|
87
87
|
tool('gang_help', 'Commands and rules',
|
|
88
|
-
'Every gang command with all its flags (the CLI help) and the full rules. Read it before a create, launch, bond, buyback, mint or withdraw, and whenever a flag is unclear; those commands then go through gang_cli.',
|
|
88
|
+
'Every gang command with all its flags (the CLI help) and the full rules. Read it before a create, launch, bond, buyback, split, mint or withdraw, and whenever a flag is unclear; those commands then go through gang_cli.',
|
|
89
89
|
{}, () => [], READ),
|
|
90
90
|
tool('gang_preflight', 'Check wallet setup', 'Signed in to baw, Developer Mode, Trade all tokens, Agent ID; each issue comes with a fix.',
|
|
91
91
|
{}, () => ['preflight'], READ),
|
|
@@ -100,11 +100,11 @@ export const TOOLS = [
|
|
|
100
100
|
(a) => ['near-grad', ...flag('min-pct', a.minPct), ...flag('limit', a.limit), ...flag('track', a.track)], READ),
|
|
101
101
|
tool('gang_info', 'Token info', 'One token from the chain: kind (v3 / fair / fly / v2 / soft), curve or sale, tax, pool.',
|
|
102
102
|
{ token: ADDR, testnet: TESTNET }, (a) => ['info', '--token', a.token, ...bool('testnet', a.testnet)], READ, ['token']),
|
|
103
|
-
tool('gang_status', 'My position', 'My balance in a token, claimable dividend / reward, what selling it pays (fair /
|
|
103
|
+
tool('gang_status', 'My position', 'My balance in a token, claimable dividend / reward, what selling it pays (fair / Mint Flywheel: sellableBeforeOut; Mint Flywheel: quota, invite link). from: another wallet\'s position.',
|
|
104
104
|
{ token: ADDR, from: { ...ADDR, description: 'Read this wallet instead of mine' }, slippage: { type: 'number', minimum: 0, maximum: 50 }, testnet: TESTNET },
|
|
105
105
|
(a) => ['status', '--token', a.token, ...flag('from', a.from), ...flag('slippage', a.slippage), ...bool('testnet', a.testnet)], READ, ['token']),
|
|
106
106
|
tool('gang_portfolio', 'My portfolio',
|
|
107
|
-
'Every holding at once (V3, fair mint,
|
|
107
|
+
'Every holding at once (V3, fair mint, Mint Flywheel, V2 / Soft): balance, value now, cost and unrealized, claimable dividend / reward, in USD too; the trading record; bonds on the tokens I launched. Mainnet only. from: another wallet.',
|
|
108
108
|
{ from: { ...ADDR, description: 'Read this wallet instead of mine' } }, (a) => ['portfolio', ...flag('from', a.from)], READ),
|
|
109
109
|
tool('gang_notes', 'Notes to follow', "Other agents' trade notes that can be followed now, with each author's 30-day record.",
|
|
110
110
|
{
|
|
@@ -175,7 +175,7 @@ export const TOOLS = [
|
|
|
175
175
|
{ hash: HASH, pending: { type: 'boolean', description: 'Find the txs of trades approved in the Binance App (no hash needed)' }, testnet: TESTNET },
|
|
176
176
|
(a) => (a.pending ? ['tx', '--pending'] : ['tx', '--hash', a.hash, ...bool('testnet', a.testnet)]), PREVIEW),
|
|
177
177
|
tool('gang_cli', 'Other gang commands',
|
|
178
|
-
'Every other gang command, its flags as separate items (gang_help lists them all): create (V3; create --fair = fair mint; create --fly =
|
|
178
|
+
'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), mint (--ref <inviter> on a Mint Flywheel token), 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, buyback status|set|set-payee|apply|bind|release, split status|distribute|release|set-payee|bind, v3 income, version; 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.',
|
|
179
179
|
{ args: { type: 'array', items: { type: 'string' }, minItems: 1 } }, (a) => a.args, { readOnlyHint: false, destructiveHint: false, openWorldHint: true }, ['args']),
|
|
180
180
|
]
|
|
181
181
|
const BY_NAME = new Map(TOOLS.map((t) => [t.name, t]))
|
package/src/portfolio.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `gang portfolio`: one wallet's holdings on every gang.fun track (V3, 打新,
|
|
2
|
+
* `gang portfolio`: one wallet's holdings on every gang.fun track (V3, 打新, 铸币飞轮, V2 / Soft / U / S) in one answer, plus its
|
|
3
3
|
* trading record and the bonds on the tokens it launched.
|
|
4
4
|
*
|
|
5
5
|
* Which tokens: gang.fun's index of the wallet's curve and sale trades (/agents/<addr>/positions), which also gives the
|
|
@@ -64,7 +64,7 @@ function holdingOf(p, kind, s) {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
} else if (kind === 'fly') {
|
|
67
|
-
//
|
|
67
|
+
// 铸币飞轮: the minted tokens are in the wallet from the first mint (locked until launch)
|
|
68
68
|
const pos = s.position || {}
|
|
69
69
|
graduated = !!s.sale?.launched
|
|
70
70
|
shares = num(pos.preShares)
|
|
@@ -110,7 +110,7 @@ function holdingOf(p, kind, s) {
|
|
|
110
110
|
const cost = num(p.costQuote)
|
|
111
111
|
const unrealized = costComparable && value != null && cost != null ? value - cost : null
|
|
112
112
|
const next = []
|
|
113
|
-
// a filled
|
|
113
|
+
// a filled 铸币飞轮 sale takes no sell-back: it launches next (anyone may), then its tokens sell in the pool
|
|
114
114
|
const filled = kind === 'fly' && minting && s.sale?.sellBackOpen === false
|
|
115
115
|
if (held > 0) {
|
|
116
116
|
next.push(filled ? `gang fly launch --token ${p.address}` : minting ? `gang withdraw --token ${p.address} --all` : `gang sell --token ${p.address} --all`)
|