@gangfun/cli 0.38.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 +10 -1
- package/README.zh-CN.md +9 -0
- package/package.json +1 -1
- package/src/base.js +272 -0
- package/src/capabilities.js +7 -0
- package/src/chain.js +32 -7
- package/src/creatorfee.js +45 -8
- package/src/flags.js +1 -1
- package/src/floor.js +818 -0
- package/src/gangpad.js +9 -3
- package/src/index.js +111 -11
- package/src/launch.js +255 -22
- package/src/mcp.js +4 -3
- package/src/promote.js +1 -1
- package/src/telemetry.js +1 -1
- package/src/v3.js +120 -18
- package/src/vanity.js +45 -4
package/src/gangpad.js
CHANGED
|
@@ -58,6 +58,9 @@ export const GANG_GENS = {
|
|
|
58
58
|
// capped-v1, 2026-11-08, block 132418984; the Safe allowed it on GangHandlerAdmin at block 132420220
|
|
59
59
|
// (docs/MAINNET-CAPPED-MODULE-2026-11-08.md)
|
|
60
60
|
cappedFactory: '0x294E901ecb66af280C1cDD26fD871601d89a2Dca',
|
|
61
|
+
// floor-v1, 2026-11-12, block 133121257; the Safe allowed it on GangHandlerAdmin at block 133123169
|
|
62
|
+
// (docs/MAINNET-FLOOR-MODULE-2026-11-12.md)
|
|
63
|
+
floorFactory: '0x057d2C1557a0E8298a1E00834D6064497f5DC2fC',
|
|
61
64
|
// the pool side of the promoter share, 2026-11-07, block 132218466; the Safe allowed it on GangHandlerAdmin at block
|
|
62
65
|
// 132219892 (docs/MAINNET-GANG-LAUNCHPAD-3-PROMOTE-2026-11-07.md)
|
|
63
66
|
promotePoolFactory: '0xA633e499ADcD69A4F91dc83587096b2c1903167A',
|
|
@@ -109,6 +112,9 @@ export const GANG_GENS = {
|
|
|
109
112
|
comboFactory: '0xdc1687961c8aAf5A0340c1A73b604cf3a2be543C',
|
|
110
113
|
// capped-v1, 2026-11-08 (deployed at block 141527185, allowed on the GangHandlerAdmin at block 141527190)
|
|
111
114
|
cappedFactory: '0xe3f61865d98993dd39c136Af19651C6F6686498A',
|
|
115
|
+
// floor-v1, 2026-11-11 (deployed at block 142099242, allowed on the GangHandlerAdmin at block 142099247;
|
|
116
|
+
// docs/TESTNET-FLOOR-MODULE-2026-11-11.md)
|
|
117
|
+
floorFactory: '0x0804C018201D8fFe378b873b41B67f136dbdc3F8',
|
|
112
118
|
// the pool side of the promoter share, 2026-11-05 (docs/TESTNET-GANG-LAUNCHPAD-3-2026-11-03.md)
|
|
113
119
|
promotePoolFactory: '0x7a68A65d27591a21C44f91015F930422BA79F1c2',
|
|
114
120
|
// GangCallBond, 2026-11-09, block 141708762 (docs/TESTNET-CALL-BOND-2026-11-09.md)
|
|
@@ -151,19 +157,19 @@ export const GANG_GENS = {
|
|
|
151
157
|
],
|
|
152
158
|
}
|
|
153
159
|
// what a generation brings to a ctx (gen: '1.0' | '2.0' | PAD3_GEN | VAULT_GEN, null for a pad named by the env that this CLI does not know)
|
|
154
|
-
const GEN_FIELDS = ['gen', 'pad', 'router', 'bond', 'splitterFactory', 'splitFactory', 'lpFactory', 'comboFactory', 'cappedFactory', 'promotePoolFactory', 'callBond']
|
|
160
|
+
const GEN_FIELDS = ['gen', 'pad', 'router', 'bond', 'splitterFactory', 'splitFactory', 'lpFactory', 'comboFactory', 'cappedFactory', 'floorFactory', 'promotePoolFactory', 'callBond']
|
|
155
161
|
// the env names of each field, per network (new name first; the old per-command names still work as aliases)
|
|
156
162
|
const GEN_ENV = {
|
|
157
163
|
mainnet: {
|
|
158
164
|
pad: ['GANG_PAD', 'GANG_V3_PAD', 'GANG_FAIR_PAD'], router: ['GANG_ROUTER'], bond: ['GANG_BOND'],
|
|
159
165
|
splitterFactory: ['GANG_SPLITTER_FACTORY'], splitFactory: ['GANG_SPLIT_FACTORY'], lpFactory: ['GANG_LP_FACTORY'],
|
|
160
|
-
comboFactory: ['GANG_COMBO_FACTORY'], cappedFactory: ['GANG_CAPPED_FACTORY'], promotePoolFactory: ['GANG_PROMOTE_POOL_FACTORY'],
|
|
166
|
+
comboFactory: ['GANG_COMBO_FACTORY'], cappedFactory: ['GANG_CAPPED_FACTORY'], floorFactory: ['GANG_FLOOR_FACTORY'], promotePoolFactory: ['GANG_PROMOTE_POOL_FACTORY'],
|
|
161
167
|
callBond: ['GANG_CALL_BOND'],
|
|
162
168
|
},
|
|
163
169
|
testnet: {
|
|
164
170
|
pad: ['GANG_TESTNET_PAD', 'GANG_V3_TESTNET_PAD', 'GANG_FAIR_TESTNET_PAD'], router: ['GANG_TESTNET_ROUTER', 'GANG_ROUTER_TESTNET'],
|
|
165
171
|
bond: ['GANG_TESTNET_BOND'], splitterFactory: ['GANG_TESTNET_SPLITTER_FACTORY'], splitFactory: ['GANG_TESTNET_SPLIT_FACTORY'],
|
|
166
|
-
lpFactory: ['GANG_TESTNET_LP_FACTORY'], comboFactory: ['GANG_TESTNET_COMBO_FACTORY'], cappedFactory: ['GANG_TESTNET_CAPPED_FACTORY'],
|
|
172
|
+
lpFactory: ['GANG_TESTNET_LP_FACTORY'], comboFactory: ['GANG_TESTNET_COMBO_FACTORY'], cappedFactory: ['GANG_TESTNET_CAPPED_FACTORY'], floorFactory: ['GANG_TESTNET_FLOOR_FACTORY'],
|
|
167
173
|
promotePoolFactory: ['GANG_TESTNET_PROMOTE_POOL_FACTORY'], callBond: ['GANG_TESTNET_CALL_BOND'],
|
|
168
174
|
},
|
|
169
175
|
}
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CONFIG, ADDR, listTokens, tokenInfo, quoteBuy, quoteSell, isAgent, balanceOf, allowance,
|
|
4
|
-
calldata, decodeTx, decodeLogs, parseEther, fmt, fmtTok, resolvePad, isAddress, client,
|
|
4
|
+
calldata, decodeTx, decodeLogs, firstByModuleType, parseEther, fmt, fmtTok, resolvePad, isAddress, client,
|
|
5
5
|
} from './chain.js'
|
|
6
6
|
import { baw, bawAddress, bawError, bawFailed, bawSettings, bawStatus, bawPreview, bawExecute } from './baw.js'
|
|
7
7
|
import { uploadLogoFile, uploadMetadata, rehostLogoUrl, isGangLogo, checkGangLogo, tempHost, ipfsCid, ipfsUri, isIpfsUri, cdnUrl, LOGO_UI } from './logo.js'
|
|
@@ -27,9 +27,11 @@ import { runPromote, PROMOTE_EVENT_ABIS } from './promote.js'
|
|
|
27
27
|
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
|
+
import { runFloor, FLOOR_ABI, FLOOR_EVENT_ABIS } from './floor.js'
|
|
31
|
+
import { runBase, BASE_EVENT_ABIS } from './base.js'
|
|
30
32
|
import { runWeekly } from './weekly.js'
|
|
31
33
|
import { runFly, flyCtx, isFlyToken, FLY_EVENT_ABIS, FLY_CREATE_FLAGS } from './fly.js'
|
|
32
|
-
import { FAIR_DEV_BUY, isLaunch, LAUNCH_FLAGS, runLaunch, TAX_CAP_ALONE } from './launch.js'
|
|
34
|
+
import { FAIR_DEV_BUY, isLaunch, LAUNCH_FLAGS, REDEEM_FEE_ALONE, runLaunch, TAX_CAP_ALONE } from './launch.js'
|
|
33
35
|
import { poolPayBnb, poolTrade } from './pool.js'
|
|
34
36
|
import { parseAmount, ROUTER_ABI, ROUTER_HINTS, revertOf as revertIn, step as writeStep } from './steps.js'
|
|
35
37
|
import { MERGED_ERRORS_ABI, genOf, padNets } from './gangpad.js'
|
|
@@ -41,7 +43,7 @@ import { codeOf, record } from './telemetry.js'
|
|
|
41
43
|
import { trending, trendingBlock, TRENDING_NOTE } from './trending.js'
|
|
42
44
|
import { shareFor } from './share.js'
|
|
43
45
|
import { BUY_ACCEPTS, CREATE_ACCEPTS, FAIR_CREATE_FLAGS, LINK_FLAGS, suggestFlag, V3_CREATE_FLAGS, unknownFlagError } from './flags.js'
|
|
44
|
-
import { parseAbi } from 'viem'
|
|
46
|
+
import { encodeEventTopics, parseAbi } from 'viem'
|
|
45
47
|
|
|
46
48
|
const args = process.argv.slice(2)
|
|
47
49
|
const cmd = args[0]
|
|
@@ -516,6 +518,26 @@ U / S pads) and run that kind's trade. Results of V3 / 打新 / 铸币飞轮 tok
|
|
|
516
518
|
recipient (GangCappedSplitterFactory; listed in the same tx) → create → bind → the
|
|
517
519
|
rest of the launch. Quote: WBNB (default), GANG or one listed in the pad's
|
|
518
520
|
QuoteRegistry only.
|
|
521
|
+
gang create … --buy-tax <1-5> --sell-tax <1-5> --floor [--redeem-fee <0-5>] [--tax-cap <amount> [--tax-cap-share <0.01-100>]
|
|
522
|
+
[--split <addr>:<pct>[,…]]] [--dev-buy …]
|
|
523
|
+
V3, taxed, floor module (GangFloorModule, floor-v1): the
|
|
524
|
+
recipient's part of the pool tax is KEPT as a treasury, nothing is bought back or
|
|
525
|
+
added. After graduation any holder can give up tokens for their share of it:
|
|
526
|
+
amount × treasury ÷ (supply − what 0xdead holds), less --redeem-fee % (default 2)
|
|
527
|
+
that stays for the holders who remain (gang floor redeem; the tokens go to 0xdead).
|
|
528
|
+
With --tax-cap, --tax-cap-share % (default 100) of the recipient's part goes to the
|
|
529
|
+
--split payees (default: you) until they have been credited --tax-cap in all, as a
|
|
530
|
+
capped recipient pays them; the rest, and after the cap all of it, is the treasury.
|
|
531
|
+
Without --tax-cap nobody takes a share. The floor is not a price promise: it starts
|
|
532
|
+
at 0, grows only with pool volume and is usually far below the market price; the
|
|
533
|
+
preview shows the % of pool volume that reaches the treasury.
|
|
534
|
+
PERMANENT: the token it serves, the quote, the fee, the cap, payees and shares can
|
|
535
|
+
never change. Steps: the CLI computes the token's address (its name, symbol, tax
|
|
536
|
+
rates and metadata decide it: they are fixed from this step on), clones your floor
|
|
537
|
+
module for that address (GangFloorModuleFactory) → create (at that address, checked
|
|
538
|
+
with the pad before the tx) → bind → the rest of the launch. Not with --buyback /
|
|
539
|
+
--lp / --after-cap / --recipient / --vault; with --promote the promoter share stays
|
|
540
|
+
on the curve. Quote: WBNB (default), GANG or one listed in the pad's QuoteRegistry.
|
|
519
541
|
gang create --fair … [--shares <n>] --bond <quote> [--bond-hold …] --bond-days <7-90>
|
|
520
542
|
打新: create (the dev's --shares are bought in it) → bond. Progress is read from the
|
|
521
543
|
chain (a token this wallet created with this symbol since the plan); a run that finds
|
|
@@ -581,6 +603,28 @@ PROMOTER SHARE (GangLaunchpad 3.0, 0.34.0+; GANG_PROMOTE_POOL_FACTORY / GANG_TES
|
|
|
581
603
|
the dev: reclaim what no root allocated, after 30 days of settler silence once the token
|
|
582
604
|
has graduated, which closes the module FOR GOOD / send what a failed push left
|
|
583
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
|
+
|
|
584
628
|
BOND (押金承诺, GangBond; any GangLaunchpad token, from create on; GANG_BOND / GANG_TESTNET_BOND = its address):
|
|
585
629
|
gang bond post --token <addr> --hold <tokens|N%> --days <7-90> (--amount <quote> | --cover <coverage %>) [--use-wbnb]
|
|
586
630
|
creator only, any time after create (V3: buy on the curve first): bond in the token's
|
|
@@ -747,12 +791,39 @@ CAPPED (a V3 token whose recipient is a capped recipient, capped-v1, 0.35.0+; GA
|
|
|
747
791
|
gang capped chunk --token <addr> [--slippage 1]
|
|
748
792
|
anyone: one chunk now, as gang combo chunk. --module <addr> instead of --token names
|
|
749
793
|
a module directly (not for bind). Gas, --testnet, --calldata, --from as gang combo
|
|
794
|
+
FLOOR (a V3 token whose recipient is a floor module, floor-v1; GANG_FLOOR_FACTORY / GANG_TESTNET_FLOOR_FACTORY):
|
|
795
|
+
gang floor status --token <addr> [--asset <addr>]
|
|
796
|
+
the treasury, the supply it is measured against, what one token redeems for before
|
|
797
|
+
and after the fee, the fee, the cap and payees (if any), what waits to be split or
|
|
798
|
+
pushed, next commands — and whether GangFloorModuleFactory made this module
|
|
799
|
+
(verified) and whether it was cloned for this token: if not, a warning, and no
|
|
800
|
+
other gang floor command is built
|
|
801
|
+
gang floor redeem --token <addr> --amount <tokens>|all [--to <addr>] [--slippage 0]
|
|
802
|
+
a holder, after graduation: give up tokens (they go to 0xdead, IRREVERSIBLE) for
|
|
803
|
+
their share of the treasury less the fee, paid in the quote to --to (default: this
|
|
804
|
+
wallet). The preview shows what selling the same tokens in the pool would pay and
|
|
805
|
+
warns when that is more. Step approve first (the module pulls the tokens), then
|
|
806
|
+
the redemption; its minimum is the previewed amount (--slippage % under it).
|
|
807
|
+
For a creator's GangBond or call bond a redemption is a sell: one that would
|
|
808
|
+
break it is refused unless --break-bond / --break-call-bond (--settle-first as
|
|
809
|
+
in gang sell)
|
|
810
|
+
gang floor distribute --token <addr> [--asset <addr>|wbnb]
|
|
811
|
+
anyone, once bound: splits the quote that arrived and pushes the payees their part,
|
|
812
|
+
with what redemptions set aside for them (a redemption pushes nobody); any other
|
|
813
|
+
asset goes to 0xdead in full (BURNED, paid to nobody)
|
|
814
|
+
gang floor release --token <addr> [--index <i>] [--max <amount>]
|
|
815
|
+
anyone: push a slot what a failed push left owed (as gang capped release)
|
|
816
|
+
gang floor set-payee --token <addr> --to <addr> [--index <i>]
|
|
817
|
+
only the slot's current payee: moves the slot to --to at once
|
|
818
|
+
gang floor bind --token <addr> anyone: bind the module to the token it was cloned for (the launch does it).
|
|
819
|
+
--module <addr> instead of --token names a module directly (not for redeem).
|
|
820
|
+
Gas, --testnet, --calldata, --from as gang capped
|
|
750
821
|
gang execute --request-id <id> broadcast a previewed call
|
|
751
822
|
gang tx --pending a trade that waited for Binance App approval (execute: pendingConfirmation): find its tx
|
|
752
823
|
in the wallet's history by the exact call previewed, then as gang tx --hash below
|
|
753
824
|
gang tx --hash <0x..> [--testnet] wait for receipt and decode Gang events: V2 / Soft / U / S, GangLaunchpad (V3 /
|
|
754
825
|
打新, 铸币飞轮, tax routers, vaults), GangFlywheelPad (铸币飞轮 pads), split modules,
|
|
755
|
-
LP splitters, combined and capped recipients (publishes a queued --note; mainnet). GangLaunchpad events
|
|
826
|
+
LP splitters, combined and capped recipients, floor modules (publishes a queued --note; mainnet). GangLaunchpad events
|
|
756
827
|
carry units: "raw" (amounts in wei, 18 decimals; bps / shares as is)
|
|
757
828
|
|
|
758
829
|
--note is PUBLIC: shown on gang.fun next to the trade. Its hash goes into the tx calldata, so it is provably written
|
|
@@ -1294,7 +1365,7 @@ function alias(kind, sub) {
|
|
|
1294
1365
|
|
|
1295
1366
|
// 铸币飞轮 settings beyond those it shares with 打新 (--raise / --hold / --mint-fee / --exit-fee) and V3 (--sell-tax)
|
|
1296
1367
|
const FLY_ONLY_FLAGS = FLY_CREATE_FLAGS.filter((f) => !['raise', 'hold', 'mint-fee', 'exit-fee', 'sell-tax'].includes(f))
|
|
1297
|
-
const FLY_NO_BOND = '铸币飞轮 tokens take no GangBond, buy-back splitter, split module, LP splitter, combined recipient, capped recipient or --dev-buy (phase 1): the creator mints its shares in the create with --dev-shares <n>'
|
|
1368
|
+
const FLY_NO_BOND = '铸币飞轮 tokens take no GangBond, buy-back splitter, split module, LP splitter, combined recipient, floor module, capped recipient or --dev-buy (phase 1): the creator mints its shares in the create with --dev-shares <n>'
|
|
1298
1369
|
/** The flags a 铸币飞轮 create refuses (gang create --fly and gang fly create alike). */
|
|
1299
1370
|
function checkFlyCreate() {
|
|
1300
1371
|
if (flag('fair')) fail('give --fly (铸币飞轮) or --fair (打新), not both')
|
|
@@ -1307,7 +1378,8 @@ function checkFlyCreate() {
|
|
|
1307
1378
|
: `--${wrong} is a V3 tax setting; a 铸币飞轮 token's tax goes to holders, the platform and the creator in fixed parts`)
|
|
1308
1379
|
}
|
|
1309
1380
|
}
|
|
1310
|
-
const
|
|
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%)'
|
|
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'
|
|
1311
1383
|
// --grad picks a V3 curve's graduation target (2.0 / 3.0); a 打新 / 铸币飞轮 sale ends at its own --raise
|
|
1312
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`
|
|
1313
1385
|
function create() {
|
|
@@ -1341,9 +1413,19 @@ const PREFLIGHT_NEXT = [
|
|
|
1341
1413
|
// commands whose JSON result carries `update`; `watch` streams NDJSON and help is plain text
|
|
1342
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',
|
|
1343
1415
|
'buy', 'follow', 'sell', 'claim', 'mint', 'withdraw', 'release', 'upload-logo', 'create', 'execute', 'tx', 'fair', 'v3', 'bond',
|
|
1344
|
-
'buyback', 'split', 'lp', 'combo', 'capped', 'fly', 'creator-fee', 'promote', 'call-bond'])
|
|
1416
|
+
'buyback', 'split', 'lp', 'combo', 'capped', 'floor', 'base', 'fly', 'creator-fee', 'promote', 'call-bond'])
|
|
1345
1417
|
// gang tx decodes these beside the V2 / Soft / U / S pads' events (GangLaunchpad: both kinds; the tax router; the vaults)
|
|
1346
|
-
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, ...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]
|
|
1419
|
+
// Split with three amounts is the event of four module kinds, and the amounts mean different things in each (a buy-back
|
|
1420
|
+
// splitter's toBuyback / toDev, an LP splitter's toLp / toDev, a promoter pool's toEscrow / toDev, a floor module's
|
|
1421
|
+
// toTreasury / toPayees): gang tx asks the
|
|
1422
|
+
// emitting module what it is before naming them
|
|
1423
|
+
const BUYBACK_SPLIT_ABI = [parseAbi(['event Split(uint256 incoming, uint256 toBuyback, uint256 toDev)'])]
|
|
1424
|
+
const SHARED_SPLIT = {
|
|
1425
|
+
topic: encodeEventTopics({ abi: FLOOR_ABI, eventName: 'Split' })[0],
|
|
1426
|
+
byType: (kind) => (kind === 'lp-burn-v1' ? LP_EVENT_ABIS : kind === 'promote-pool-v1' ? PROMOTE_EVENT_ABIS : kind === 'floor-v1' ? FLOOR_EVENT_ABIS
|
|
1427
|
+
: String(kind ?? '').startsWith('buyback-burn-') ? BUYBACK_SPLIT_ABI : null),
|
|
1428
|
+
}
|
|
1347
1429
|
|
|
1348
1430
|
/** gang bond / gang buyback / gang split / gang lp / gang combo / gang capped on a 铸币飞轮 token: those contracts refuse it, so say why before any step. */
|
|
1349
1431
|
async function refuseFly(what) {
|
|
@@ -1354,7 +1436,7 @@ async function refuseFly(what) {
|
|
|
1354
1436
|
|
|
1355
1437
|
/** A mainnet tx decoded, its queued note published (or its state refreshed), its follow ref and token links. */
|
|
1356
1438
|
async function txReport(hash) {
|
|
1357
|
-
const t = await decodeTx(hash, GANG_EVENT_ABIS)
|
|
1439
|
+
const t = await decodeTx(hash, GANG_EVENT_ABIS, SHARED_SPLIT)
|
|
1358
1440
|
// the input may carry a follow ref and a note commitment: a committed note is sent here if it's still in the
|
|
1359
1441
|
// local queue (e.g. after PENDING_CONFIRMATION), or its state reported / refreshed if already sent
|
|
1360
1442
|
const queued = hasQueued()
|
|
@@ -1438,6 +1520,16 @@ async function main() {
|
|
|
1438
1520
|
const launch = LAUNCH_FLAGS.find((f) => flag(f))
|
|
1439
1521
|
if (launch) fail(`--${launch}: ${VAULT_ALONE}`)
|
|
1440
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
|
+
}
|
|
1441
1533
|
// gang weekly apply takes the same --description / --website / --twitter as a create (they describe the token to come)
|
|
1442
1534
|
const weeklyApply = cmd === 'weekly' && args[1] === 'apply'
|
|
1443
1535
|
for (const name of LINK_FLAGS) {
|
|
@@ -1455,8 +1547,11 @@ async function main() {
|
|
|
1455
1547
|
const capFlag = ['tax-cap', 'tax-cap-share', 'after-cap'].find((f) => flag(f))
|
|
1456
1548
|
if (capFlag && launchKind === 'fair') fail(`--${capFlag} is for V3 tokens: it makes the tax recipient a capped recipient, and a 打新 token has no recipient`)
|
|
1457
1549
|
if (capFlag) fail(TAX_CAP_ALONE)
|
|
1550
|
+
const floorFlag = ['floor', 'redeem-fee'].find((f) => flag(f))
|
|
1551
|
+
if (floorFlag && launchKind === 'fair') fail(`--${floorFlag} is for V3 tokens: it makes the tax recipient a floor module, and a 打新 token has no recipient`)
|
|
1552
|
+
if (flag('redeem-fee')) fail(REDEEM_FEE_ALONE)
|
|
1458
1553
|
const lone = LAUNCH_FLAGS.find((f) => flag(f))
|
|
1459
|
-
if (lone) fail(`--${lone} only applies to a launch in one command: add --bond <quote>${launchKind === 'fair' ? '' : ' (or --dev-buy <quote> / --buyback <pct> / --split <addr>:<pct>,… / --lp <pct> / --tax-cap <amount>)'}`)
|
|
1554
|
+
if (lone) fail(`--${lone} only applies to a launch in one command: add --bond <quote>${launchKind === 'fair' ? '' : ' (or --dev-buy <quote> / --buyback <pct> / --split <addr>:<pct>,… / --lp <pct> / --tax-cap <amount> / --floor)'}`)
|
|
1460
1555
|
}
|
|
1461
1556
|
switch (cmd) {
|
|
1462
1557
|
case 'fair':
|
|
@@ -1502,6 +1597,11 @@ async function main() {
|
|
|
1502
1597
|
case 'capped':
|
|
1503
1598
|
await refuseFly('a capped recipient')
|
|
1504
1599
|
return runCapped(args[1], { opt, flag, out, fail, summarize: summarizePreview })
|
|
1600
|
+
case 'floor':
|
|
1601
|
+
await refuseFly('a floor module')
|
|
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 })
|
|
1505
1605
|
case 'weekly':
|
|
1506
1606
|
return runWeekly(args[1], { opt, flag, out, fail, resolveLogo: resolveLogoUri })
|
|
1507
1607
|
case 'capabilities':
|
|
@@ -1849,7 +1949,7 @@ async function main() {
|
|
|
1849
1949
|
const r = await ctx.client.waitForTransactionReceipt({ hash, timeout: 120_000 })
|
|
1850
1950
|
return out({
|
|
1851
1951
|
success: true, chainId: Number(ctx.chainId), hash, status: r.status, block: Number(r.blockNumber),
|
|
1852
|
-
events: decodeLogs(r.logs, GANG_EVENT_ABIS), explorer: `${ctx.explorer}/tx/${hash}`,
|
|
1952
|
+
events: decodeLogs(r.logs, GANG_EVENT_ABIS, await firstByModuleType(ctx.client, r.logs, SHARED_SPLIT.topic, SHARED_SPLIT.byType)), explorer: `${ctx.explorer}/tx/${hash}`,
|
|
1853
1953
|
})
|
|
1854
1954
|
}
|
|
1855
1955
|
return out(await txReport(hash))
|