@gangfun/cli 0.22.0 → 0.23.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 +22 -16
- package/README.zh-CN.md +21 -16
- package/package.json +1 -1
- package/src/bond.js +17 -15
- package/src/buyback.js +118 -19
- package/src/chain.js +2 -2
- package/src/combo.js +9 -9
- package/src/creatorfee.js +261 -0
- package/src/discover.js +2 -0
- package/src/fair.js +7 -4
- package/src/fly.js +4 -1
- package/src/gangpad.js +249 -24
- package/src/index.js +53 -14
- package/src/launch.js +33 -1
- package/src/lp.js +52 -15
- package/src/mcp.js +2 -2
- package/src/portfolio.js +25 -5
- package/src/split.js +7 -8
- package/src/v3.js +90 -29
package/README.md
CHANGED
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
Operate [gang.fun](https://gang.fun) from a Binance **Agentic Wallet**. Curve buys/creates require a SPACE ID `.ai` Agent ID. This CLI builds calldata; `baw` signs — no keys in this package.
|
|
4
4
|
|
|
5
|
-
**`gang create`:** launches a V3 token on GangLaunchpad (`gang create --fair` a 打新 sale); it's untaxed unless `--buy-tax` / `--sell-tax` are given. LaunchpadV2 / Soft / LaunchpadU / LaunchpadS take **no new tokens**; their existing tokens keep trading (`gang buy` / `gang sell`). New tokens graduate at
|
|
5
|
+
**`gang create`:** launches a V3 token on GangLaunchpad (`gang create --fair` a 打新 sale); it's untaxed unless `--buy-tax` / `--sell-tax` are given. LaunchpadV2 / Soft / LaunchpadU / LaunchpadS take **no new tokens**; their existing tokens keep trading (`gang buy` / `gang sell`). New V3 tokens graduate at **15 BNB** on GangLaunchpad 1.0; on 2.0 the creator picks **6 / 9 / 12 / 15 BNB** with `--grad` (default 9). Soft archive tokens still graduate at 20 BNB on-chain.
|
|
6
6
|
|
|
7
7
|
**One command per action (0.12.0+):** `gang buy` / `sell` / `info` / `status` / `claim` / `mint` / `withdraw` / `release` work on every token: the CLI reads the token's kind and runs the V3, 打新 or V2 / Soft code. `gang v3 …` / `gang fair …` stay as aliases.
|
|
8
8
|
|
|
9
9
|
**铸币飞轮 / Mint Flywheel (0.18.0+):** `gang create --fly` starts a sale on GangFlywheelPad (its own pad, kind 3): shares with a quota per wallet (invites add quota), a pool at the mint price once it fills, and minting that goes on after launch. The unified commands detect these tokens (`kind: "fly"`); `gang fly …` is the alias. Live on BSC mainnet since 2026-10-30 (V1 pad `0x631e66560F4FAE4e486B65349edE48189E48B029`); from 0.21.0 new tokens go to the V2 pad `0x281889ad915c1A95ffc4922235c6314b3Cbd8a5a` (built in; `create --fly` says so while it is not open yet), and every other command follows the token's own pad. `--testnet` uses BSC testnet (V1 set 2, V2 `0x7069…E3d6`). Rules: `skill/references/fly.md`.
|
|
10
10
|
|
|
11
|
-
**V3 tax tokens and 打新 (0.9.0+):** on GangLaunchpad, live on BSC mainnet since 2026-10-27 (pad `0x15CFD2dc8278Fb87a1783ef42111618E20874365`, GangRouter `0xE040445690Aa56C8b68B7f7038C7b2562B5079C4`,
|
|
11
|
+
**V3 tax tokens and 打新 (0.9.0+):** on GangLaunchpad, live on BSC mainnet since 2026-10-27 (1.0: pad `0x15CFD2dc8278Fb87a1783ef42111618E20874365`, GangRouter `0xE040445690Aa56C8b68B7f7038C7b2562B5079C4`; new tokens go to 2.0 since 2026-10-31: pad `0x770331a9accdb53ACb4a45B6c5B7D151fADCe557`, GangRouter `0xa83209d6bfC2B220cD86410cCDDC71FEb354844a`; all built in); `--testnet` uses BSC testnet (2.0 for new tokens, set 10 = 1.0 for its tokens).
|
|
12
12
|
|
|
13
|
-
**Split recipient (0.19.0+):** `gang create … --buy-tax … --sell-tax … --split self:60,0x…:30,0x…:10` makes a V3 token's tax recipient the dev's split module (GangSplitModule, `split-v1`): the recipient's part of the tax is split among 1–10 payees at shares fixed for good (nobody, not the dev, not the platform, can change them; a payee can only move its own slot). `self` is the creating wallet (`me` also works); payee slots are numbered as in the contract, from 0 (`--index`). The quote must be one the keeper splits: WBNB (default), GANG or a quote in the pad's QuoteRegistry (others are refused before the clone, as for `--buyback`); `gang split distribute` still splits any asset sent to the module. `gang split …` shows and drives it. Live on BSC mainnet (factory `0x27e08271E52B2D129c824CD245e69471a8d3067c`, allowed by the platform's Safe on 2026-10-30
|
|
13
|
+
**Split recipient (0.19.0+):** `gang create … --buy-tax … --sell-tax … --split self:60,0x…:30,0x…:10` makes a V3 token's tax recipient the dev's split module (GangSplitModule, `split-v1`): the recipient's part of the tax is split among 1–10 payees at shares fixed for good (nobody, not the dev, not the platform, can change them; a payee can only move its own slot). `self` is the creating wallet (`me` also works); payee slots are numbered as in the contract, from 0 (`--index`). The quote must be one the keeper splits: WBNB (default), GANG or a quote in the pad's QuoteRegistry (others are refused before the clone, as for `--buyback`); `gang split distribute` still splits any asset sent to the module. `gang split …` shows and drives it. Live on BSC mainnet (factory `0x27e08271E52B2D129c824CD245e69471a8d3067c`, allowed by the platform's Safe on 2026-10-30; 2.0: `0xa73dC3d63AAf72E70b1cb012e5f3A541360Bec59`; built in) and testnet set 10.
|
|
14
14
|
|
|
15
|
-
**Auto-liquidity recipient (0.20.0+):** `gang create … --buy-tax … --sell-tax … --lp 70 [--lp-to 0x…]` makes a V3 token's tax recipient the dev's LP splitter (GangLiquiditySplitter, `lp-burn-v1`, the buy-back splitter's sibling): `--lp` % of the recipient's part of the tax is added to the token's PancakeSwap pair as liquidity whose LP goes to 0xdead (locked for good), the rest goes to the dev or `--lp-to`. After graduation the keeper adds it in chunks (half buys the token, all of it goes back in with the matching quote; one per 4 minutes). The ratio and payee change as for `--buyback` (a raise at once, a cut after a 3-day notice; the payee at once). Same quotes as `--buyback` / `--split`. `gang lp …` shows and drives it. Live on BSC mainnet (factory `0xE0436867dAFcf42Ee1418083251a9B8B61F0C248`, allowed by the platform's Safe on 2026-10-31
|
|
15
|
+
**Auto-liquidity recipient (0.20.0+):** `gang create … --buy-tax … --sell-tax … --lp 70 [--lp-to 0x…]` makes a V3 token's tax recipient the dev's LP splitter (GangLiquiditySplitter, `lp-burn-v1`, the buy-back splitter's sibling): `--lp` % of the recipient's part of the tax is added to the token's PancakeSwap pair as liquidity whose LP goes to 0xdead (locked for good), the rest goes to the dev or `--lp-to`. After graduation the keeper adds it in chunks (half buys the token, all of it goes back in with the matching quote; one per 4 minutes). The ratio and payee change as for `--buyback` (a raise at once, a cut after a 3-day notice; the payee at once). Same quotes as `--buyback` / `--split`. `gang lp …` shows and drives it. Live on BSC mainnet (factory `0xE0436867dAFcf42Ee1418083251a9B8B61F0C248`, allowed by the platform's Safe on 2026-10-31; 2.0: `0x8ac85f150f87B536fb05eA163908b1077D95c0E4`; built in) and testnet set 10 (factory `0xA729C60FCa0Bd0D28a55E22126D3fE412AA41591`).
|
|
16
16
|
|
|
17
|
-
**Combined recipient (0.22.0+):** two or three of `--buyback`, `--lp`, `--split` on one taxed launch make a V3 token's tax recipient one GangComboSplitter (`combo-v1`): `gang create … --buy-tax 3 --sell-tax 3 --buyback 30 --lp 30 --split self:70,0x…:30` buys back and burns 30% of the recipient's part, adds 30% to the pair as liquidity (LP to 0xdead) and pushes the rest (40%) to the payees, whose `--split` shares are of that rest (here 28% / 12% of the recipient's part); without `--split` the rest goes to the dev, and `--buyback` + `--lp` = 100 takes no payees. **Everything is permanent**: the ratios, payees and shares can never change (unlike a lone `--buyback` / `--lp`, whose ratio the dev can change); a payee can only move its own slot. Any other asset sent to it: the buy-back + LP share to 0xdead, the rest to the payees. `--buyback-to` / `--lp-to` don't apply. One flag alone still uses its own module. `gang combo status|distribute|release|set-payee|bind|chunk` shows and drives it. On BSC mainnet (factory `0xd33C38BE3f8472b3013167830F0638C1704e1DBd`, deployed 2026-10-31
|
|
17
|
+
**Combined recipient (0.22.0+):** two or three of `--buyback`, `--lp`, `--split` on one taxed launch make a V3 token's tax recipient one GangComboSplitter (`combo-v1`): `gang create … --buy-tax 3 --sell-tax 3 --buyback 30 --lp 30 --split self:70,0x…:30` buys back and burns 30% of the recipient's part, adds 30% to the pair as liquidity (LP to 0xdead) and pushes the rest (40%) to the payees, whose `--split` shares are of that rest (here 28% / 12% of the recipient's part); without `--split` the rest goes to the dev, and `--buyback` + `--lp` = 100 takes no payees. **Everything is permanent**: the ratios, payees and shares can never change (unlike a lone `--buyback` / `--lp`, whose ratio the dev can change); a payee can only move its own slot. Any other asset sent to it: the buy-back + LP share to 0xdead, the rest to the payees. `--buyback-to` / `--lp-to` don't apply. One flag alone still uses its own module. `gang combo status|distribute|release|set-payee|bind|chunk` shows and drives it. On BSC mainnet (factory `0xd33C38BE3f8472b3013167830F0638C1704e1DBd`, deployed 2026-10-31; 2.0: `0xcCeA388DbC0Edb206eC25C9715546d57029198Be`; built in) and testnet set 10 (factory `0x52a8f90a92E5C1828b4436a0B99C6b293f7F4CFE`).
|
|
18
|
+
|
|
19
|
+
**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`).
|
|
18
20
|
|
|
19
21
|
## Install
|
|
20
22
|
|
|
@@ -44,7 +46,7 @@ npx skills add gangfun/gang-launchpad/skill
|
|
|
44
46
|
1. Binance App → Wallet → Agentic Wallet → create; claim a `.ai` Agent ID.
|
|
45
47
|
2. Enable **Developer Mode** and **Trade all tokens**.
|
|
46
48
|
3. `baw auth signin` → confirm in the App.
|
|
47
|
-
4. `gang preflight` — `createPad` must be GangLaunchpad (`
|
|
49
|
+
4. `gang preflight` — `createPad` must be GangLaunchpad 2.0 (`0x770331a9…E557`; `createPadGen` `2.0`).
|
|
48
50
|
|
|
49
51
|
## Commands
|
|
50
52
|
|
|
@@ -59,11 +61,12 @@ gang notes [--agent a,b] [--min-hit 0.6] [--sort new|author|followers] [--token
|
|
|
59
61
|
gang watch --notes [--agent a,b] [--min-hit 0.6] [--interval 30] [--events note,revealed] # new followable notes
|
|
60
62
|
gang agents [--window 1d|7d|30d|all] [--sort score|hitRate|count|follow|followUsd] [--limit 10] # who to follow
|
|
61
63
|
# One command per action, whatever pad the token is on (0.12.0+): the CLI reads GangLaunchpad's kindOf (V3 curve / 打新
|
|
62
|
-
# sale; otherwise the V2 / Soft / U / S pads) and runs that kind's trade. --testnet = BSC testnet set 10 (GangLaunchpad only)
|
|
64
|
+
# sale; otherwise the V2 / Soft / U / S pads) and runs that kind's trade. --testnet = BSC testnet, 2.0 and set 10 (GangLaunchpad only)
|
|
63
65
|
gang list [--limit 20] [--kind v3|fair|fly [--status …]] # V2 / Soft / U / S on chain, newest 20 per pad; --kind v3|fair: from gang.fun, fly: the pad
|
|
64
66
|
gang info --token <addr> # one token, any pad (gang token is the older name)
|
|
65
67
|
gang status --token <addr> # my position: balance; V3 dividend / 打新 reward, sellable; poolSellAll
|
|
66
|
-
gang portfolio [--from <addr>] # every holding: balance, value, cost / unrealized, claimable, USD; bonds
|
|
68
|
+
gang portfolio [--from <addr>] # every holding: balance, value, cost / unrealized, claimable, USD; bonds; creator fees (2.0)
|
|
69
|
+
gang creator-fee [--token <addr>] [--from <creator>] [--claim [--to <addr>]] # GangLaunchpad 2.0: 70% of the 1% curve fee, the creator's
|
|
67
70
|
gang quote --token <addr> --amount <n> # V2 / Soft / U / S curve only (Soft: BNB; V2: quote ERC-20, LaunchpadV2.sol math)
|
|
68
71
|
gang buy --token <addr> --amount <n> [--slippage 1] [--follow <note tx>] [--note "<why>" [--conf 0-100] [--reveal-after 1-72h]]
|
|
69
72
|
# --amount = what to spend in the token's quote (--bnb is the older name). V3: includes the 1% curve fee (no tax on the
|
|
@@ -110,10 +113,12 @@ gang bond burn --token <addr> | gang bond tx --hash <0x..> # push one buy-
|
|
|
110
113
|
gang create … --dev-buy <quote> [--bond <quote> [--bond-hold <tokens|N%|all>] --bond-days <7-90>] # V3: create → dev buy → bond
|
|
111
114
|
gang create … --buy-tax 3 --sell-tax 3 --buyback 50 [--buyback-to 0x…] [--dev-buy …] # V3: the recipient's part of the tax 50% bought back + burned, the rest to you (or --buyback-to)
|
|
112
115
|
gang buyback status|set|set-payee|apply --token 0x… [--pct 0-100] [--to 0x…] # the buy-back splitter: ratio (raise now, cut after 3 days), payee (at once), what waits
|
|
116
|
+
gang buyback split --token 0x… (or --module 0x…) # anyone: split what arrived (e.g. a creator fee claimed --to it before graduation): the payee's part now, the buy-back's set aside (0.23.0+); sweep --asset 0x… sends another asset (not its quote) to the payee
|
|
113
117
|
gang create … --buy-tax 3 --sell-tax 3 --split self:60,0x…:30,0x…:10 [--dev-buy …] # V3: the recipient's part of the tax split among 1–10 payees at fixed shares (% summing to 100; self = you)
|
|
114
118
|
gang split status|distribute|release|set-payee|bind --token 0x… [--asset 0x…] [--index <i>] [--to 0x…] # the split module: payees (slot --index from 0), what waits / is owed; split by hand; a payee moves its own slot
|
|
115
119
|
gang create … --buy-tax 3 --sell-tax 3 --lp 70 [--lp-to 0x…] [--dev-buy …] # V3: the recipient's part of the tax 70% added to the pool as liquidity (LP to 0xdead), the rest to you (or --lp-to)
|
|
116
120
|
gang lp status|set|set-payee|apply|bind|release|add --token 0x… [--pct 0-100] [--to 0x…] [--slippage 1] # the LP splitter: ratio, payee, what is set aside, the next chunk; add = one chunk now (anyone)
|
|
121
|
+
gang lp split --token 0x… (or --module 0x…) # anyone: split what arrived: the payee's part now, the pool's set aside (0.23.0+)
|
|
117
122
|
gang create … --buy-tax 3 --sell-tax 3 --buyback 30 --lp 30 [--split self:70,0x…:30] [--dev-buy …] # V3, combined recipient: 30% bought back + burned, 30% added as liquidity, the rest to the payees (shares of the rest; default you). PERMANENT
|
|
118
123
|
gang combo status|distribute|release|set-payee|bind|chunk --token 0x… [--asset 0x…] [--index <i>] [--to 0x…] [--slippage 1] # the combined recipient: ratios, payees, set aside, owed, the next chunk and the keeper's plan; chunk = one chunk now (anyone)
|
|
119
124
|
gang create --fair … [--shares <n>] --bond <quote> [--bond-hold …] --bond-days <7-90> # 打新: create (dev shares) → bond
|
|
@@ -262,7 +267,7 @@ timed-out `gang_execute`, check `gang_status` / the wallet history instead of ex
|
|
|
262
267
|
## Rules (short)
|
|
263
268
|
|
|
264
269
|
- 1% per-wallet cap on the curve; excess input refunded in-tx.
|
|
265
|
-
- **New** creates (GangLaunchpad) →
|
|
270
|
+
- **New** creates (GangLaunchpad) → graduation at 15 BNB (1.0) or the creator's `--grad` pick (2.0: 6 / 9 / 12 / 15, default 9) → PancakeSwap V2, LP burned. LaunchpadV2: existing tokens only.
|
|
266
271
|
- Soft legacy (archive): 20 BNB graduation; buy/sell only — no Soft create from this CLI.
|
|
267
272
|
- Before graduation: no transfers, curve only.
|
|
268
273
|
- Graduated / launched: `gang buy` / `gang sell` trade in the PancakeSwap
|
|
@@ -285,16 +290,17 @@ timed-out `gang_execute`, check `gang_status` / the wallet history instead of ex
|
|
|
285
290
|
| `GANG_STREAM` | `0`: `gang watch` market mode polls instead of using the server's stream (same as `--poll`) |
|
|
286
291
|
| `GANG_UPDATE_CHECK` | `0` turns off the once-a-day check for a newer CLI on npm (cached in `~/.gang/update.json`) |
|
|
287
292
|
| `GANG_UPDATE_URL` | Where that check asks, default `https://registry.npmjs.org/@gangfun/cli/latest`; set an npm mirror's `…/@gangfun/cli/latest` if npmjs is slow or blocked |
|
|
288
|
-
| `GANG_PAD` / `GANG_TESTNET_PAD` |
|
|
293
|
+
| `GANG_PAD` / `GANG_TESTNET_PAD` | The GangLaunchpad new tokens go to (mainnet / testnet), behind V3 and 打新. Defaults: mainnet 2.0 `0x7703…E557` (1.0 `0x15CF…4365` kept for its tokens); testnet 2.0 `0xb14d…3B3E` (the first 2.0 `0x6381…39be` and 1.0, set 10 `0xFebF…5BB1`, kept for their tokens). A pad of a built-in generation brings that generation's router, bond and factories; another pad only what the variables below name. Old names `GANG_V3_PAD` / `GANG_FAIR_PAD`, `GANG_V3_TESTNET_PAD` / `GANG_FAIR_TESTNET_PAD` still work as aliases |
|
|
289
294
|
| `GANG_TESTNET_RPC_URL` | Testnet RPC, one URL or a comma list (unset: PublicNode, then BNB Chain's testnet nodes); old names `GANG_V3_TESTNET_RPC_URL` / `GANG_FAIR_TESTNET_RPC_URL` still work |
|
|
290
295
|
| `GANG_FLY_PAD_V2` / `GANG_TESTNET_FLY_PAD_V2` | GangFlywheelPad V2 (铸币飞轮), where new tokens go. Defaults: mainnet `0x2818…8a5a`, testnet `0x7069…E3d6` |
|
|
291
296
|
| `GANG_FLY_PAD` / `GANG_TESTNET_FLY_PAD` | GangFlywheelPad V1 (铸币飞轮). Defaults: mainnet `0x631e…B029` (open since 2026-10-30), testnet set 2 `0xD648…951c` |
|
|
292
|
-
| `GANG_BOND` / `GANG_TESTNET_BOND` | GangBond (creator bonds, `gang bond
|
|
293
|
-
| `GANG_SPLIT_FACTORY` / `GANG_TESTNET_SPLIT_FACTORY` | GangSplitModuleFactory (`--split`). Defaults: mainnet `0x27e0…067c
|
|
294
|
-
| `GANG_LP_FACTORY` / `GANG_TESTNET_LP_FACTORY` | GangLiquiditySplitterFactory (`--lp`). Defaults (CLI 0.20.0+): mainnet `0xE043…C248
|
|
295
|
-
| `GANG_COMBO_FACTORY` / `GANG_TESTNET_COMBO_FACTORY` | GangComboSplitterFactory (several of `--buyback` / `--lp` / `--split
|
|
296
|
-
| `
|
|
297
|
+
| `GANG_BOND` / `GANG_TESTNET_BOND` | GangBond of the create target (creator bonds, `gang bond`; a token's bond is on its own generation's). Defaults: mainnet 2.0 `0x2313…E0D8` (1.0 `0xe92d…14E4`, since 2026-10-29, CLI 0.16.2+), testnet 2.0 `0x3974…51F9` (first 2.0 `0x9139…F97f`, 1.0 `0xd6a8…1086`) |
|
|
298
|
+
| `GANG_SPLIT_FACTORY` / `GANG_TESTNET_SPLIT_FACTORY` | GangSplitModuleFactory of the create target (`--split`). Defaults: mainnet 2.0 `0xa73d…ec59` (1.0 `0x27e0…067c`, since 2026-10-30, CLI 0.19.0+), testnet 2.0 `0xb9ab…3513` (first 2.0 `0x860D…0879`, 1.0 `0x5F7d…567E`) |
|
|
299
|
+
| `GANG_LP_FACTORY` / `GANG_TESTNET_LP_FACTORY` | GangLiquiditySplitterFactory of the create target (`--lp`). Defaults (CLI 0.20.0+): mainnet 2.0 `0x8ac8…c0E4` (1.0 `0xE043…C248`, since 2026-10-31), testnet 2.0 `0xAEec…36E4` (first 2.0 `0x4f15…1619`, 1.0 `0xA729…1591`) |
|
|
300
|
+
| `GANG_COMBO_FACTORY` / `GANG_TESTNET_COMBO_FACTORY` | GangComboSplitterFactory of the create target (several of `--buyback` / `--lp` / `--split`; a token's combined recipient is on its own generation's). Defaults (CLI 0.22.0+): mainnet 2.0 `0xcCeA…98Be` (1.0 `0xd33C…1DBd`, since 2026-10-31), testnet 2.0 `0x312c…84BD` (1.0 `0x52a8…4CFE`; the first 2.0 has none) |
|
|
301
|
+
| `GANG_SPLITTER_FACTORY` / `GANG_TESTNET_SPLITTER_FACTORY` | GangBuybackSplitterFactory of the create target (`--buyback`). Defaults: mainnet 2.0 `0x77e4…803C` (1.0 `0xf1d5…F1Cd`), testnet 2.0 `0xDC9E…0f6e` (first 2.0 `0xBc26…33AE`, 1.0 `0x7E63…2BBe`) |
|
|
302
|
+
| `GANG_ROUTER` / `GANG_TESTNET_ROUTER` | GangRouter proxy of the create target (native-BNB V3 buys / mints, and every PancakeSwap trade of a graduated token; a token uses its own generation's); old name `GANG_ROUTER_TESTNET` still works. Defaults: mainnet 2.0 `0xa832…844a` (1.0 `0xE040…79C4`), testnet 2.0 `0x5a4F…dDAA` (first 2.0 `0xb218…FC08`, 1.0 `0x6bB6…C9F6`) |
|
|
297
303
|
|
|
298
304
|
## Version
|
|
299
305
|
|
|
300
|
-
`0.
|
|
306
|
+
`0.23.0` · 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
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
用 Binance **Agentic Wallet** 操作 [gang.fun](https://gang.fun)。内盘买入/发币需要 SPACE ID `.ai` Agent ID。本 CLI 只组 calldata,签名走 `baw`,不持有私钥。
|
|
4
4
|
|
|
5
|
-
**`gang create`:** 在 GangLaunchpad 上发 V3 币(`gang create --fair` 发打新);不带 `--buy-tax` / `--sell-tax` 就是无税币。LaunchpadV2 / Soft / LaunchpadU / LaunchpadS **不再发新币**,存量币照常交易(`gang buy` / `gang sell
|
|
5
|
+
**`gang create`:** 在 GangLaunchpad 上发 V3 币(`gang create --fair` 发打新);不带 `--buy-tax` / `--sell-tax` 就是无税币。LaunchpadV2 / Soft / LaunchpadU / LaunchpadS **不再发新币**,存量币照常交易(`gang buy` / `gang sell`)。V3 新币在 GangLaunchpad 1.0 上 **15 BNB** 毕业;2.0 上由 creator 用 `--grad` 选 **6 / 9 / 12 / 15 BNB**(默认 9)。Soft 存量链上仍为 20 BNB 毕业。
|
|
6
6
|
|
|
7
7
|
**一个动作一条命令(0.12.0+):** `gang buy` / `sell` / `info` / `status` / `claim` / `mint` / `withdraw` / `release` 对所有币都能用:CLI 先读出这个币的类型,再执行 V3、打新或 V2 / Soft 的逻辑。`gang v3 …` / `gang fair …` 保留为别名。
|
|
8
8
|
|
|
9
9
|
**铸币飞轮(0.18.0+):** `gang create --fly` 在 GangFlywheelPad(单独的发射台,kind 3)上开一场铸币飞轮:按份 mint,每个钱包有额度,邀请可以加额度;打满后按 mint 价开池,开池后还能继续 mint。统一命令会自动识别这类币(`kind: "fly"`),`gang fly …` 是别名。2026-10-30 起在 BSC 主网运行(V1 发射台 `0x631e66560F4FAE4e486B65349edE48189E48B029`);0.21.0 起新币发在 V2 发射台 `0x281889ad915c1A95ffc4922235c6314b3Cbd8a5a`(已内置;V2 开放前 `create --fly` 会直接说明),其他命令按代币自己的发射台走。`--testnet` 走 BSC 测试网(V1 第 2 套,V2 `0x7069…E3d6`)。规则见 `skill/references/fly.md`。
|
|
10
10
|
|
|
11
|
-
**V3 税收币和打新(0.9.0+):** 走 GangLaunchpad,2026-10-27 起在 BSC
|
|
11
|
+
**V3 税收币和打新(0.9.0+):** 走 GangLaunchpad,2026-10-27 起在 BSC 主网运行(1.0:内盘 `0x15CFD2dc8278Fb87a1783ef42111618E20874365`,GangRouter `0xE040445690Aa56C8b68B7f7038C7b2562B5079C4`;2026-10-31 起新币发到 2.0:内盘 `0x770331a9accdb53ACb4a45B6c5B7D151fADCe557`,GangRouter `0xa83209d6bfC2B220cD86410cCDDC71FEb354844a`;都已内置);`--testnet` 走 BSC 测试网(新币发到 2.0,第 10 套即 1.0 上的币照常用)。
|
|
12
12
|
|
|
13
|
-
**多人分账收款(0.19.0+):** `gang create … --buy-tax … --sell-tax … --split self:60,0x…:30,0x…:10` 把 V3 币的税收接收地址设成 dev 自己的分账模块(GangSplitModule,`split-v1`):接收地址那份税按固定比例分给 1–10 个地址,名单和比例永久不能改(dev 和平台都改不了;每个收款人只能把自己那一份换到别的地址)。`self` 表示发币钱包(也可以写 `me`);收款人序号和合约一致,从 0 开始(`--index`)。报价币只能是 keeper 会分账的:WBNB(默认)、GANG 或发射台 QuoteRegistry 里的报价币(其他的在克隆前就拒绝,和 `--buyback` 一样);转进模块的其他资产仍可用 `gang split distribute` 手动分。`gang split …` 查看和操作。已在 BSC 主网(工厂 `0x27e08271E52B2D129c824CD245e69471a8d3067c`,2026-10-30
|
|
13
|
+
**多人分账收款(0.19.0+):** `gang create … --buy-tax … --sell-tax … --split self:60,0x…:30,0x…:10` 把 V3 币的税收接收地址设成 dev 自己的分账模块(GangSplitModule,`split-v1`):接收地址那份税按固定比例分给 1–10 个地址,名单和比例永久不能改(dev 和平台都改不了;每个收款人只能把自己那一份换到别的地址)。`self` 表示发币钱包(也可以写 `me`);收款人序号和合约一致,从 0 开始(`--index`)。报价币只能是 keeper 会分账的:WBNB(默认)、GANG 或发射台 QuoteRegistry 里的报价币(其他的在克隆前就拒绝,和 `--buyback` 一样);转进模块的其他资产仍可用 `gang split distribute` 手动分。`gang split …` 查看和操作。已在 BSC 主网(工厂 `0x27e08271E52B2D129c824CD245e69471a8d3067c`,2026-10-30 平台多签已放行;2.0:`0xa73dC3d63AAf72E70b1cb012e5f3A541360Bec59`;已内置)和测试网第 10 套可用。
|
|
14
14
|
|
|
15
|
-
**自动加池子收款(0.20.0+):** `gang create … --buy-tax … --sell-tax … --lp 70 [--lp-to 0x…]` 把 V3 币的税收接收地址设成 dev 自己的加池合约(GangLiquiditySplitter,`lp-burn-v1`,和回购合约同一套规则):接收地址那份税的 `--lp`% 加进这个币的 PancakeSwap 池子做流动性,LP 打进 0xdead 永久锁定,其余给 dev(或 `--lp-to` 指定的地址)。毕业后由 keeper 分块加池(一半买币,买到的币全部连同对应的报价币放回池子;每 4 分钟最多一块)。比例和收款地址的改法同 `--buyback`(提高立即生效,下调 3 天公告后生效;收款地址立即生效)。报价币要求同 `--buyback` / `--split`。`gang lp …` 查看和操作。已在 BSC 主网(工厂 `0xE0436867dAFcf42Ee1418083251a9B8B61F0C248`,2026-10-31
|
|
15
|
+
**自动加池子收款(0.20.0+):** `gang create … --buy-tax … --sell-tax … --lp 70 [--lp-to 0x…]` 把 V3 币的税收接收地址设成 dev 自己的加池合约(GangLiquiditySplitter,`lp-burn-v1`,和回购合约同一套规则):接收地址那份税的 `--lp`% 加进这个币的 PancakeSwap 池子做流动性,LP 打进 0xdead 永久锁定,其余给 dev(或 `--lp-to` 指定的地址)。毕业后由 keeper 分块加池(一半买币,买到的币全部连同对应的报价币放回池子;每 4 分钟最多一块)。比例和收款地址的改法同 `--buyback`(提高立即生效,下调 3 天公告后生效;收款地址立即生效)。报价币要求同 `--buyback` / `--split`。`gang lp …` 查看和操作。已在 BSC 主网(工厂 `0xE0436867dAFcf42Ee1418083251a9B8B61F0C248`,2026-10-31 平台多签已放行;2.0:`0x8ac85f150f87B536fb05eA163908b1077D95c0E4`;已内置)和测试网第 10 套(工厂 `0xA729C60FCa0Bd0D28a55E22126D3fE412AA41591`)可用。
|
|
16
16
|
|
|
17
|
-
**组合收款(0.22.0+):** 一次有税发射里同时给 `--buyback`、`--lp`、`--split` 中的两个或三个,V3 币的税收接收地址就是一个组合合约(GangComboSplitter,`combo-v1`):`gang create … --buy-tax 3 --sell-tax 3 --buyback 30 --lp 30 --split self:70,0x…:30` 把接收地址那份税的 30% 回购销毁、30% 加进池子做流动性(LP 打进 0xdead),其余 40% 推给收款人;`--split` 的比例是「剩下那部分」的比例(这里分别是接收地址那份的 28% / 12%)。不给 `--split` 时剩下的全给 dev;`--buyback` + `--lp` = 100 时不能有收款人。**全部永久不可改**:比例、收款人和份额以后都不能改(不像单独的 `--buyback` / `--lp`,dev 可以调比例);收款人只能把自己那一份换到新地址。打进来的其他资产:回购 + 加池那部分比例打进 0xdead,其余给收款人。`--buyback-to` / `--lp-to` 不适用。只给一个参数时仍走各自的单独模块。`gang combo status|distribute|release|set-payee|bind|chunk` 查看和操作。已在 BSC 主网(工厂 `0xd33C38BE3f8472b3013167830F0638C1704e1DBd`,2026-10-31
|
|
17
|
+
**组合收款(0.22.0+):** 一次有税发射里同时给 `--buyback`、`--lp`、`--split` 中的两个或三个,V3 币的税收接收地址就是一个组合合约(GangComboSplitter,`combo-v1`):`gang create … --buy-tax 3 --sell-tax 3 --buyback 30 --lp 30 --split self:70,0x…:30` 把接收地址那份税的 30% 回购销毁、30% 加进池子做流动性(LP 打进 0xdead),其余 40% 推给收款人;`--split` 的比例是「剩下那部分」的比例(这里分别是接收地址那份的 28% / 12%)。不给 `--split` 时剩下的全给 dev;`--buyback` + `--lp` = 100 时不能有收款人。**全部永久不可改**:比例、收款人和份额以后都不能改(不像单独的 `--buyback` / `--lp`,dev 可以调比例);收款人只能把自己那一份换到新地址。打进来的其他资产:回购 + 加池那部分比例打进 0xdead,其余给收款人。`--buyback-to` / `--lp-to` 不适用。只给一个参数时仍走各自的单独模块。`gang combo status|distribute|release|set-payee|bind|chunk` 查看和操作。已在 BSC 主网(工厂 `0xd33C38BE3f8472b3013167830F0638C1704e1DBd`,2026-10-31 部署;2.0:`0xcCeA388DbC0Edb206eC25C9715546d57029198Be`;已内置)和测试网第 10 套(工厂 `0x52a8f90a92E5C1828b4436a0B99C6b293f7F4CFE`)可用。
|
|
18
|
+
|
|
19
|
+
**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`)上交易。
|
|
18
20
|
|
|
19
21
|
## 安装
|
|
20
22
|
|
|
@@ -34,7 +36,7 @@ Skill:`npx skills add gangfun/gang-launchpad/skill`
|
|
|
34
36
|
1. 币安 App → 钱包 → Agentic Wallet;领取 `.ai` Agent ID。
|
|
35
37
|
2. 打开 **Developer Mode** 与 **Trade all tokens**。
|
|
36
38
|
3. `baw auth signin`
|
|
37
|
-
4. `gang preflight` — `createPad` 须为 GangLaunchpad(`
|
|
39
|
+
4. `gang preflight` — `createPad` 须为 GangLaunchpad 2.0(`0x770331a9…E557`,`createPadGen` 为 `2.0`)。
|
|
38
40
|
|
|
39
41
|
## 命令
|
|
40
42
|
|
|
@@ -49,11 +51,12 @@ gang notes [--agent a,b] [--min-hit 0.6] [--sort new|author|followers] [--token
|
|
|
49
51
|
gang watch --notes [--agent a,b] [--min-hit 0.6] [--interval 30] [--events note,revealed] # 新出现的可跟想法
|
|
50
52
|
gang agents [--window 1d|7d|30d|all] [--sort score|hitRate|count|follow|followUsd] [--limit 10] # 跟谁
|
|
51
53
|
# 一个动作一条命令,不管币在哪个内盘(0.12.0+):CLI 读 GangLaunchpad 的 kindOf(V3 内盘 / 打新;都不是就走
|
|
52
|
-
# V2 / Soft / U / S),再执行对应的交易。--testnet 走 BSC
|
|
54
|
+
# V2 / Soft / U / S),再执行对应的交易。--testnet 走 BSC 测试网 2.0 和第 10 套(只有 GangLaunchpad)
|
|
53
55
|
gang list [--limit 20] [--kind v3|fair|fly [--status …]] # 链上读 V2 / Soft / U / S,每个盘最新 20 个;--kind v3|fair:从 gang.fun 列,fly:从发射台读
|
|
54
56
|
gang info --token <addr> # 任意内盘的一个币(gang token 是旧名)
|
|
55
57
|
gang status --token <addr> # 我的持仓:余额;V3 分红 / 打新奖励、还能卖多少;poolSellAll
|
|
56
|
-
gang portfolio [--from <addr>] # 全部持仓:余额、价值、成本 /
|
|
58
|
+
gang portfolio [--from <addr>] # 全部持仓:余额、价值、成本 / 浮盈、可领、美元;押金;creator 分成(2.0)
|
|
59
|
+
gang creator-fee [--token <addr>] [--from <creator>] [--claim [--to <addr>]] # GangLaunchpad 2.0:内盘 1% 手续费的 70% 归 creator
|
|
57
60
|
gang quote --token <addr> --amount <n> # 只算 V2 / Soft / U / S 内盘(Soft:BNB;V2:报价币 ERC-20)
|
|
58
61
|
gang buy --token <addr> --amount <n> [--slippage 1] [--follow <附言 tx>] [--note "<理由>" [--conf 0-100] [--reveal-after 1-72h]]
|
|
59
62
|
# --amount 是要花的报价币数量(--bnb 是旧名)。V3:含内盘 1% 手续费(内盘不收税;WBNB 报价经 GangRouter 直接付 BNB)。
|
|
@@ -89,10 +92,12 @@ gang bond burn --token <addr> | gang bond tx --hash <0x..> # 推进一块
|
|
|
89
92
|
gang create … --dev-buy <报价币数量> [--bond <数量> [--bond-hold <枚数|N%|all>] --bond-days <7-90>] # V3:发币 → dev 内盘买入 → 押金
|
|
90
93
|
gang create … --buy-tax 3 --sell-tax 3 --buyback 50 [--buyback-to 0x…] [--dev-buy …] # V3:接收地址那份税 50% 回购销毁,其余给你(或 --buyback-to 指定的地址)
|
|
91
94
|
gang buyback status|set|set-payee|apply --token 0x… [--pct 0-100] [--to 0x…] # 回购合约:比例(提高立即生效,下调 3 天后)、收款地址(立即生效)、待回购金额
|
|
95
|
+
gang buyback split --token 0x…(或 --module 0x…) # 任何人:把新到的钱分掉(比如毕业前领进来的创作者费):收款人那份立即转出,回购那份留着(0.23.0+);sweep --asset 0x… 把报价币以外的币全部转给收款人
|
|
92
96
|
gang create … --buy-tax 3 --sell-tax 3 --split self:60,0x…:30,0x…:10 [--dev-buy …] # V3:接收地址那份税按固定比例分给 1–10 个地址(百分比合计 100;self = 你自己)
|
|
93
97
|
gang split status|distribute|release|set-payee|bind --token 0x… [--asset 0x…] [--index <i>] [--to 0x…] # 分账模块:名单(--index 从 0 开始)、待分和欠款;手动分账;收款人换自己的地址
|
|
94
98
|
gang create … --buy-tax 3 --sell-tax 3 --lp 70 [--lp-to 0x…] [--dev-buy …] # V3:接收地址那份税 70% 加进池子做流动性(LP 打进 0xdead),其余给你(或 --lp-to 指定的地址)
|
|
95
99
|
gang lp status|set|set-payee|apply|bind|release|add --token 0x… [--pct 0-100] [--to 0x…] [--slippage 1] # 加池合约:比例、收款地址、待加池金额、下一块;add = 现在手动加一块(任何人)
|
|
100
|
+
gang lp split --token 0x…(或 --module 0x…) # 任何人:把新到的钱分掉:收款人那份立即转出,加池那份留着(0.23.0+)
|
|
96
101
|
gang create … --buy-tax 3 --sell-tax 3 --buyback 30 --lp 30 [--split self:70,0x…:30] [--dev-buy …] # V3 组合收款:30% 回购销毁,30% 加池,其余给收款人(比例按剩下那部分算;默认给你)。永久不可改
|
|
97
102
|
gang combo status|distribute|release|set-payee|bind|chunk --token 0x… [--asset 0x…] [--index <i>] [--to 0x…] [--slippage 1] # 组合合约:比例、收款人、待回购 / 待加池、欠款、下一块和 keeper 的计划;chunk = 现在手动做一块(任何人)
|
|
98
103
|
gang create --fair … [--shares <n>] --bond <数量> [--bond-hold …] --bond-days <7-90> # 打新:发币(含 dev 份额)→ 押金
|
|
@@ -231,7 +236,7 @@ Claude Code:`claude mcp add gang -- gang mcp`。同一台机器上 `baw` 要
|
|
|
231
236
|
## 规则(短)
|
|
232
237
|
|
|
233
238
|
- 内盘每钱包 1%;多付同笔退回。
|
|
234
|
-
- **新**发币(GangLaunchpad
|
|
239
|
+
- **新**发币(GangLaunchpad):1.0 上 15 BNB 毕业,2.0 上按 creator 的 `--grad`(6 / 9 / 12 / 15,默认 9)。LaunchpadV2 只剩存量币。Soft 存量归档:20 BNB,仅买卖。
|
|
235
240
|
- 毕业前不可转账;毕业(或打新发射)后走 PancakeSwap:`gang buy` / `gang sell`
|
|
236
241
|
经 GangRouter 在外盘成交。先只授权本次用量,再发 `poolBuy` / `poolBuyBNB` / `poolSell` / `poolSellForBNB`;最少到手:买入按
|
|
237
242
|
`getAmountsOut` 扣买入税,卖出按税 handler 的 `previewSellNextBlock`,再扣 `--slippage`。`--use-quote` / `--pay-bnb` 选买入用什么付,
|
|
@@ -249,16 +254,16 @@ Claude Code:`claude mcp add gang -- gang mcp`。同一台机器上 `baw` 要
|
|
|
249
254
|
| `GANG_STREAM` | 设为 `0` 时 `gang watch` 全市场模式不用服务端推送、改为轮询(同 `--poll`) |
|
|
250
255
|
| `GANG_UPDATE_CHECK` | 设为 `0` 关闭每天一次的新版本检查(查 npm,缓存在 `~/.gang/update.json`) |
|
|
251
256
|
| `GANG_UPDATE_URL` | 新版本检查查询的地址,默认 `https://registry.npmjs.org/@gangfun/cli/latest`;npmjs 慢或打不开时,可以换成 npm 镜像的 `…/@gangfun/cli/latest` |
|
|
252
|
-
| `GANG_PAD` / `GANG_TESTNET_PAD` | 覆盖合并后的内盘合约 GangLaunchpad(主网 / 测试网),V3 和打新共用(默认:主网 `0x15CF…4365
|
|
257
|
+
| `GANG_PAD` / `GANG_TESTNET_PAD` | 覆盖合并后的内盘合约 GangLaunchpad(主网 / 测试网),V3 和打新共用(默认:主网 2.0 `0x7703…E557`(1.0 `0x15CF…4365` 留给它的币),测试网 2.0 `0xb14d…3B3E`;测试网第一版 2.0 `0x6381…39be` 和第 10 套 `0xFebF…5BB1` 留给各自的币)。旧名 `GANG_V3_PAD` / `GANG_FAIR_PAD`、`GANG_V3_TESTNET_PAD` / `GANG_FAIR_TESTNET_PAD` 仍可用(别名) |
|
|
253
258
|
| `GANG_TESTNET_RPC_URL` | 测试网 RPC,可填一个或逗号分隔的多个(不设时先用 PublicNode,再用 BNB Chain 的测试网节点);旧名 `GANG_V3_TESTNET_RPC_URL` / `GANG_FAIR_TESTNET_RPC_URL` 仍可用 |
|
|
254
259
|
| `GANG_FLY_PAD_V2` / `GANG_TESTNET_FLY_PAD_V2` | GangFlywheelPad V2(铸币飞轮),新币发在这里。默认:主网 `0x2818…8a5a`,测试网 `0x7069…E3d6` |
|
|
255
260
|
| `GANG_FLY_PAD` / `GANG_TESTNET_FLY_PAD` | GangFlywheelPad V1(铸币飞轮)。默认:主网 `0x631e…B029`(2026-10-30 起开放),测试网第 2 套 `0xD648…951c` |
|
|
256
|
-
| `GANG_BOND` / `GANG_TESTNET_BOND` | GangBond(押金承诺,`gang bond
|
|
257
|
-
| `GANG_SPLIT_FACTORY` / `GANG_TESTNET_SPLIT_FACTORY` | GangSplitModuleFactory(`--split`)。默认:主网 `0x27e0…067c
|
|
258
|
-
| `GANG_LP_FACTORY` / `GANG_TESTNET_LP_FACTORY` | GangLiquiditySplitterFactory(`--lp`)。默认(CLI 0.20.0+):主网 `0xE043…C248
|
|
259
|
-
| `GANG_COMBO_FACTORY` / `GANG_TESTNET_COMBO_FACTORY` | GangComboSplitterFactory(同时给 `--buyback` / `--lp` / `--split`
|
|
260
|
-
| `GANG_ROUTER` / `GANG_TESTNET_ROUTER` | GangRouter 代理(用原生 BNB 买 V3 /
|
|
261
|
+
| `GANG_BOND` / `GANG_TESTNET_BOND` | 发币目标那一代的 GangBond(押金承诺,`gang bond`;已有的币用它自己那一代的)。默认:主网 2.0 `0x2313…E0D8`(1.0 `0xe92d…14E4`,2026-10-29 起,CLI 0.16.2+),测试网 2.0 `0x3974…51F9`(第一版 2.0 `0x9139…F97f`,1.0 `0xd6a8…1086`) |
|
|
262
|
+
| `GANG_SPLIT_FACTORY` / `GANG_TESTNET_SPLIT_FACTORY` | 发币目标那一代的 GangSplitModuleFactory(`--split`)。默认:主网 2.0 `0xa73d…ec59`(1.0 `0x27e0…067c`,2026-10-30 起,CLI 0.19.0+),测试网 2.0 `0xb9ab…3513`(第一版 2.0 `0x860D…0879`,1.0 `0x5F7d…567E`) |
|
|
263
|
+
| `GANG_LP_FACTORY` / `GANG_TESTNET_LP_FACTORY` | 发币目标那一代的 GangLiquiditySplitterFactory(`--lp`)。默认(CLI 0.20.0+):主网 2.0 `0x8ac8…c0E4`(1.0 `0xE043…C248`,2026-10-31 起),测试网 2.0 `0xAEec…36E4`(第一版 2.0 `0x4f15…1619`,1.0 `0xA729…1591`) |
|
|
264
|
+
| `GANG_COMBO_FACTORY` / `GANG_TESTNET_COMBO_FACTORY` | 发币目标那一代的 GangComboSplitterFactory(同时给 `--buyback` / `--lp` / `--split` 中的几个;已有的币用它自己那一代的)。默认(CLI 0.22.0+):主网 2.0 `0xcCeA…98Be`(1.0 `0xd33C…1DBd`,2026-10-31 起),测试网 2.0 `0x312c…84BD`(1.0 `0x52a8…4CFE`;第一版 2.0 没有) |
|
|
265
|
+
| `GANG_ROUTER` / `GANG_TESTNET_ROUTER` | 发币目标那一代的 GangRouter 代理(用原生 BNB 买 V3 / 打新,以及已毕业币的所有外盘买卖;已有的币用它自己那一代的);旧名 `GANG_ROUTER_TESTNET` 仍可用。默认:主网 2.0 `0xa832…844a`(1.0 `0xE040…79C4`),测试网 2.0 `0x5a4F…dDAA`(第一版 2.0 `0xb218…FC08`,1.0 `0x6bB6…C9F6`) |
|
|
261
266
|
|
|
262
267
|
## 版本
|
|
263
268
|
|
|
264
|
-
`0.
|
|
269
|
+
`0.23.0` · [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.
|
|
3
|
+
"version": "0.23.0",
|
|
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
|
"scripts": {
|
package/src/bond.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createPublicClient, parseAbi, encodeFunctionData, decodeEventLog, formatUnits, parseUnits, isAddress, zeroAddress } from 'viem'
|
|
2
2
|
import { decimalsOf, fundingStep as fund, parseAmount, parseIntIn, parseNum, revertOf as revertIn, step, units, GAS_RESERVE } from './steps.js'
|
|
3
|
-
import { MERGED_ERRORS_ABI, MERGED_HINTS, NOT_ON_MAINNET, padNets, rpcTransport } from './gangpad.js'
|
|
3
|
+
import { atTokenPad, GANG_GENS, gangGens, KIND_UNREAD, MERGED_ERRORS_ABI, MERGED_HINTS, NOT_ON_MAINNET, padNets, rpcTransport } from './gangpad.js'
|
|
4
4
|
import { bawAddress } from './baw.js'
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -12,17 +12,13 @@ import { bawAddress } from './baw.js'
|
|
|
12
12
|
* returns the whole bond to the creator; refund does the same when the pair never came within 30 days of the post.
|
|
13
13
|
* One contract per network, no owner; it only reads the pad.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* One GangBond per GangLaunchpad generation (it reads one pad): a token's bond is on its own generation's GangBond.
|
|
16
|
+
* Env: GANG_BOND (mainnet), GANG_TESTNET_BOND (testnet) override the create target's (gangpad.js).
|
|
16
17
|
*/
|
|
17
18
|
|
|
18
|
-
// script/DeployGangBond.s.sol
|
|
19
|
-
|
|
20
|
-
|
|
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'
|
|
25
|
-
export const TESTNET_BOND = '0xd6a8dd5d1E6641a34A255f25Db2B3ED397CB1086'
|
|
19
|
+
// script/DeployGangBond.s.sol, once per generation: the create target's (GANG_GENS in gangpad.js has each one's history)
|
|
20
|
+
export const MAINNET_BOND = GANG_GENS.mainnet[0].bond
|
|
21
|
+
export const TESTNET_BOND = GANG_GENS.testnet[0].bond
|
|
26
22
|
|
|
27
23
|
export const BOND_ABI = parseAbi([
|
|
28
24
|
'function post(address token, uint256 amount, uint256 holdAmount, uint64 duration) payable',
|
|
@@ -105,16 +101,17 @@ const TOTAL_SUPPLY = 1_000_000_000n * 10n ** 18n
|
|
|
105
101
|
const DAY = 86_400
|
|
106
102
|
const MAX_UINT = 2n ** 256n - 1n
|
|
107
103
|
|
|
108
|
-
/** GangBond
|
|
104
|
+
/** GangBond of the create target on `testnet` / mainnet (env first); null when not deployed there. */
|
|
109
105
|
export function bondAddress(testnet) {
|
|
110
|
-
return (testnet
|
|
106
|
+
return gangGens(testnet)[0].bond || null
|
|
111
107
|
}
|
|
112
108
|
|
|
113
109
|
function bondCtx(testnet) {
|
|
114
110
|
const net = padNets('v3')[testnet ? 'testnet' : 'mainnet']
|
|
115
111
|
if (!net.pad) throw new Error(NOT_ON_MAINNET)
|
|
112
|
+
// a token's bond is its own generation's (set after atTokenPad); the create target may have none yet
|
|
116
113
|
const bond = bondAddress(testnet)
|
|
117
|
-
if (!bond) throw new Error(`GangBond is not deployed on ${testnet ? 'the BSC testnet' : 'BSC mainnet'} in this CLI version: set ${testnet ? 'GANG_TESTNET_BOND' : 'GANG_BOND'} to its address`)
|
|
114
|
+
if (!net.gens.some((g) => g.bond)) throw new Error(`GangBond is not deployed on ${testnet ? 'the BSC testnet' : 'BSC mainnet'} in this CLI version: set ${testnet ? 'GANG_TESTNET_BOND' : 'GANG_BOND'} to its address`)
|
|
118
115
|
const client = createPublicClient({ chain: net.chain, transport: rpcTransport(net.rpcs) })
|
|
119
116
|
return { ...net, bond, client, read: (address, abi, functionName, args = []) => client.readContract({ address, abi, functionName, args }) }
|
|
120
117
|
}
|
|
@@ -307,7 +304,8 @@ export async function runBond(sub, { opt, flag, out, fail, summarize }) {
|
|
|
307
304
|
const r = await ctx.client.waitForTransactionReceipt({ hash, timeout: 120_000 })
|
|
308
305
|
const events = []
|
|
309
306
|
for (const log of r.logs) {
|
|
310
|
-
|
|
307
|
+
// any generation's GangBond (a token's bond is on its own generation's)
|
|
308
|
+
if (!ctx.gens.some((g) => same(log.address, g.bond))) continue
|
|
311
309
|
try {
|
|
312
310
|
const ev = decodeEventLog({ abi: BOND_ABI, data: log.data, topics: log.topics })
|
|
313
311
|
events.push({ event: ev.eventName, ...Object.fromEntries(Object.entries(ev.args).map(([k, v]) => [k, typeof v === 'bigint' ? v.toString() : v])) })
|
|
@@ -317,6 +315,9 @@ export async function runBond(sub, { opt, flag, out, fail, summarize }) {
|
|
|
317
315
|
}
|
|
318
316
|
|
|
319
317
|
const token = tokenArg(opt, fail)
|
|
318
|
+
// the token's generation: its pad and its GangBond
|
|
319
|
+
if ((await atTokenPad(ctx, token)) === null) return fail(KIND_UNREAD.error, { token: token, retry: KIND_UNREAD.retry })
|
|
320
|
+
if (!ctx.bond) return fail('this token\'s GangLaunchpad generation has no GangBond in this CLI version', { token, chainId, padGen: ctx.gen })
|
|
320
321
|
const m = await marketOf(ctx, token)
|
|
321
322
|
if (!m) return fail('not a GangLaunchpad token (V3 or 打新) on this network: bonds cover only those', { token, chainId })
|
|
322
323
|
const view = await bondView(ctx, token, m)
|
|
@@ -555,7 +556,8 @@ export async function runBond(sub, { opt, flag, out, fail, summarize }) {
|
|
|
555
556
|
* - { info: {…} } — go on, with these fields added to the preview (headroom after the sell, or the --break-bond warning).
|
|
556
557
|
*/
|
|
557
558
|
export async function bondGuard(ctx, p, rawOnly, summarize) {
|
|
558
|
-
|
|
559
|
+
// the token's generation's GangBond when ctx is on its pad (atTokenPad), else the create target's
|
|
560
|
+
const addr = 'bond' in ctx ? ctx.bond : bondAddress(p.testnet)
|
|
559
561
|
if (!addr) return null
|
|
560
562
|
let b
|
|
561
563
|
try { b = await ctx.read(addr, BOND_ABI, 'bondOf', [p.token]) } catch (e) {
|
package/src/buyback.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createPublicClient, parseAbi, encodeFunctionData, formatUnits, hexToString, isAddress, zeroAddress } from 'viem'
|
|
2
|
-
import { padNets, NOT_ON_MAINNET, rpcTransport } from './gangpad.js'
|
|
2
|
+
import { atPad, atTokenPad, GANG_GENS, KIND_UNREAD, gangGens, listedBy, padNets, NOT_ON_MAINNET, rpcTransport } from './gangpad.js'
|
|
3
3
|
import { walletFor } from './fair.js'
|
|
4
4
|
import { parseNum, revertOf as revertIn, step } from './steps.js'
|
|
5
5
|
|
|
@@ -13,17 +13,16 @@ import { parseNum, revertOf as revertIn, step } from './steps.js'
|
|
|
13
13
|
* want it leaves --buyback out: the tax goes to their own address as before.
|
|
14
14
|
* The ratio: a raise applies at once, a cut 3 days after it is asked for (then anyone applies it within 7 days, or it
|
|
15
15
|
* lapses). The keeper buys back in chunks (≤ 0.5% of the pool's quote side, never > 2% above the 10-minute average).
|
|
16
|
-
* Env: GANG_SPLITTER_FACTORY / GANG_TESTNET_SPLITTER_FACTORY override the
|
|
16
|
+
* Env: GANG_SPLITTER_FACTORY / GANG_TESTNET_SPLITTER_FACTORY override the create target's factory (gangpad.js).
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
export const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
const BUYBACK_TYPES = ['buyback-burn-v1', 'buyback-burn-v2', BUYBACK_TYPE]
|
|
19
|
+
// one factory per GangLaunchpad generation (it is bound to one pad): the create target's (GANG_GENS in gangpad.js)
|
|
20
|
+
export const MAINNET_SPLITTER_FACTORY = GANG_GENS.mainnet[0].splitterFactory
|
|
21
|
+
export const TESTNET_SPLITTER_FACTORY = GANG_GENS.testnet[0].splitterFactory
|
|
22
|
+
/** The factories' clones; v1 (mainnet's first factory, 0x6bcd…8546) pays the dev, v2 and later their payee; v3 buys at
|
|
23
|
+
* most one chunk per 4 minutes (GangBond audit H-1); v4 (GangLaunchpad 2.0's factory) prices a chunk on what the pair
|
|
24
|
+
* received (re-review L-1). Same calls from v2 on. */
|
|
25
|
+
const BUYBACK_TYPES = ['buyback-burn-v1', 'buyback-burn-v2', 'buyback-burn-v3', 'buyback-burn-v4']
|
|
27
26
|
|
|
28
27
|
export const FACTORY_ABI = parseAbi([
|
|
29
28
|
'function create(uint16 buybackBps, bytes32 salt, address payee) returns (address splitter)',
|
|
@@ -49,6 +48,9 @@ export const SPLITTER_ABI = parseAbi([
|
|
|
49
48
|
'function setBuybackBps(uint16 newBps)',
|
|
50
49
|
'function applyBuybackBps()',
|
|
51
50
|
'function releaseDev() returns (uint256)',
|
|
51
|
+
'function split()',
|
|
52
|
+
'function sweep(address asset)',
|
|
53
|
+
'function pad() view returns (address)',
|
|
52
54
|
'function payee() view returns (address)',
|
|
53
55
|
'function setPayee(address newPayee)',
|
|
54
56
|
'error NotDev()',
|
|
@@ -61,6 +63,8 @@ export const SPLITTER_ABI = parseAbi([
|
|
|
61
63
|
'error NotDue()',
|
|
62
64
|
'error CutLapsed()',
|
|
63
65
|
'error NothingOwed()',
|
|
66
|
+
'error NotBound()',
|
|
67
|
+
'error NotSweepable()',
|
|
64
68
|
])
|
|
65
69
|
|
|
66
70
|
const PAD_ABI = parseAbi([
|
|
@@ -78,12 +82,13 @@ const HINTS = {
|
|
|
78
82
|
CutLapsed: 'the cut was not applied within 7 days after its notice and has lapsed: ask for it again',
|
|
79
83
|
NoProposal: 'no cut asked for',
|
|
80
84
|
NothingOwed: 'nothing is owed to the dev',
|
|
85
|
+
NotBound: 'the splitter is not bound to a token yet',
|
|
86
|
+
NotSweepable: 'sweep never moves the splitter\'s own quote: gang buyback split splits it',
|
|
81
87
|
}
|
|
82
88
|
const revertOf = (e) => revertIn(e, [SPLITTER_ABI, FACTORY_ABI], HINTS)
|
|
83
89
|
|
|
84
90
|
export function splitterFactoryAddress(testnet) {
|
|
85
|
-
return (testnet
|
|
86
|
-
: process.env.GANG_SPLITTER_FACTORY || MAINNET_SPLITTER_FACTORY) || null
|
|
91
|
+
return gangGens(testnet)[0].splitterFactory || null
|
|
87
92
|
}
|
|
88
93
|
|
|
89
94
|
export const notDeployed = (testnet) =>
|
|
@@ -93,6 +98,61 @@ export const notDeployed = (testnet) =>
|
|
|
93
98
|
export const buybackBpsOf = (fail, raw) => Math.round(parseNum(fail, 'buyback', raw, 0, 100) * 100)
|
|
94
99
|
|
|
95
100
|
const pct = (bps) => Number(bps) / 100
|
|
101
|
+
const SYMBOL_ABI = parseAbi(['function symbol() view returns (string)'])
|
|
102
|
+
const ASSET_ABI = parseAbi(['function symbol() view returns (string)', 'function decimals() view returns (uint8)', 'function balanceOf(address) view returns (uint256)'])
|
|
103
|
+
|
|
104
|
+
/** --asset <addr>|wbnb of a sweep (required). */
|
|
105
|
+
export function sweepAsset(opt, fail, wbnb) {
|
|
106
|
+
const a = opt('asset')
|
|
107
|
+
if (/^wbnb$/i.test(a ?? '')) return wbnb
|
|
108
|
+
if (!isAddress(a ?? '') || a === zeroAddress) fail('--asset <addr>|wbnb required: the asset to send to the payee (any but the splitter\'s own quote)', { got: a ?? null })
|
|
109
|
+
return a
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* `sweep` of a buy-back / LP splitter, from the raw reads (pure: unit-tested): the splitter's whole balance of `asset`
|
|
114
|
+
* goes to the payee (the contract refuses its own quote and an unbound splitter). { error } when it can't.
|
|
115
|
+
*/
|
|
116
|
+
export function sweepPlan({ asset, quote, balance, decimals = 18, symbol, payee, cmd }) {
|
|
117
|
+
if (!quote || /^0x0{40}$/.test(quote)) return { error: 'the splitter is not bound to a token yet: sweep works once it is bound (its launch binds it)' }
|
|
118
|
+
if (asset.toLowerCase() === quote.toLowerCase()) return { error: `that is the splitter's own quote: sweep never moves it; ${cmd} split splits it (the payee's part now, the rest set aside)` }
|
|
119
|
+
if (BigInt(balance) === 0n) return { error: `the splitter holds no ${symbol ?? asset}: nothing to sweep` }
|
|
120
|
+
return { asset, assetSymbol: symbol ?? null, amount: formatUnits(BigInt(balance), Number(decimals)), payee }
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** The reads behind sweepPlan: the splitter's quote and its balance of `asset`. */
|
|
124
|
+
export async function sweepReads(read, splitter, abi, asset) {
|
|
125
|
+
const [quote, balance, decimals, symbol] = await Promise.all([
|
|
126
|
+
read(splitter, abi, 'quote'), read(asset, ASSET_ABI, 'balanceOf', [splitter]),
|
|
127
|
+
read(asset, ASSET_ABI, 'decimals').catch(() => 18), read(asset, ASSET_ABI, 'symbol').catch(() => null),
|
|
128
|
+
])
|
|
129
|
+
return { quote, balance, decimals, symbol }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** A module named by --module that no GangLaunchpad pad of this network owns, or that its GangHandlerAdmin never listed. */
|
|
133
|
+
export const notListed = (what, net) =>
|
|
134
|
+
`not one of the platform's ${what}s: no GangLaunchpad pad${net ? ' on the BSC testnet' : ''} lists it (GangHandlerAdmin moduleOf), so the CLI will not call it`
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* `split` of a buy-back / LP splitter, from the raw reads (pure: unit-tested): what arrived since the last split
|
|
138
|
+
* (`unsplit`), the share set aside (`bps`, for `part`: the buy-back or the liquidity) and the payee's part, pushed now.
|
|
139
|
+
* { error } when nothing waits to be split.
|
|
140
|
+
*/
|
|
141
|
+
export function splitPlan({ unsplit, bps, left, payee, part, leftField, symbol, unbound }) {
|
|
142
|
+
const waiting = BigInt(unsplit)
|
|
143
|
+
if (waiting === 0n) {
|
|
144
|
+
return {
|
|
145
|
+
error: unbound ? 'nothing to split: the splitter is not bound to a token yet, so it has no quote'
|
|
146
|
+
: `nothing waits to be split: no quote arrived since the last split${BigInt(left) > 0n ? ` (${leftField} ${formatUnits(BigInt(left), 18)} is already set aside)` : ''}`,
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const setAside = (waiting * BigInt(bps)) / 10_000n
|
|
150
|
+
const toPayee = waiting - setAside
|
|
151
|
+
return {
|
|
152
|
+
quote: symbol, splitting: formatUnits(waiting, 18), toPayee: formatUnits(toPayee, 18), payee,
|
|
153
|
+
setAside: formatUnits(setAside, 18), setAsideFor: part, [`${leftField}After`]: formatUnits(BigInt(left) + setAside, 18),
|
|
154
|
+
}
|
|
155
|
+
}
|
|
96
156
|
const iso = (s) => new Date(Number(s) * 1000).toISOString()
|
|
97
157
|
|
|
98
158
|
/** The splitter's state when `addr` is a GangBuybackSplitter; null when it is not (an EOA, a partner, another module). */
|
|
@@ -137,8 +197,8 @@ export async function simulateCall(client, from, address, abi, functionName, arg
|
|
|
137
197
|
}
|
|
138
198
|
}
|
|
139
199
|
|
|
140
|
-
const SUBS = ['status', 'set', 'set-payee', 'apply', 'bind', 'release']
|
|
141
|
-
const USAGE = 'usage: gang buyback <status|set|set-payee|apply|bind|release> --token <addr> [--pct <0-100>] [--to <addr>] [--testnet] — see gang help'
|
|
200
|
+
const SUBS = ['status', 'set', 'set-payee', 'apply', 'bind', 'release', 'split', 'sweep']
|
|
201
|
+
const USAGE = 'usage: gang buyback <status|set|set-payee|apply|bind|release|split|sweep> --token <addr> (split / sweep: or --module <addr>) [--pct <0-100>] [--to <addr>] [--asset <addr>|wbnb] [--testnet] — see gang help'
|
|
142
202
|
|
|
143
203
|
/** `gang buyback <sub>`: the splitter of a V3 token (its tax recipient), found from --token. */
|
|
144
204
|
export async function runBuyback(sub, { opt, flag, out, fail, summarize }) {
|
|
@@ -147,14 +207,29 @@ export async function runBuyback(sub, { opt, flag, out, fail, summarize }) {
|
|
|
147
207
|
const rawOnly = flag('calldata')
|
|
148
208
|
let ctx
|
|
149
209
|
try { ctx = buybackCtx(testnet) } catch (e) { return fail(e.message) }
|
|
150
|
-
|
|
151
|
-
|
|
210
|
+
// split / sweep may name the splitter itself (--module), e.g. the --to of a creator-fee claim
|
|
211
|
+
const named = (sub === 'split' || sub === 'sweep') && flag('module')
|
|
212
|
+
if (named && flag('token')) fail('give --token (its tax recipient is the splitter) or --module, not both')
|
|
213
|
+
let token = opt('token')
|
|
152
214
|
let recipient
|
|
153
|
-
|
|
154
|
-
|
|
215
|
+
if (named) {
|
|
216
|
+
recipient = opt('module')
|
|
217
|
+
if (!isAddress(recipient ?? '')) fail('--module must be a buy-back splitter address (0x…)', { got: recipient ?? null })
|
|
218
|
+
const pad = await ctx.read(recipient, SPLITTER_ABI, 'pad').catch(() => null)
|
|
219
|
+
if (!pad || !atPad(ctx, pad, testnet)) return fail(notListed('buy-back splitter', testnet), { module: recipient })
|
|
220
|
+
} else {
|
|
221
|
+
if (!isAddress(token ?? '')) fail('--token must be a V3 token address (0x…)', { got: token ?? null })
|
|
222
|
+
if ((await atTokenPad(ctx, token)) === null) return fail(KIND_UNREAD.error, { token: token, retry: KIND_UNREAD.retry }) // else on the pad of the token's generation
|
|
223
|
+
try { recipient = (await ctx.read(ctx.pad, PAD_ABI, 'taxConfigOf', [token]))[3] } catch {
|
|
224
|
+
return fail('not a V3 token on this pad', { token, chainId: Number(ctx.chainId) })
|
|
225
|
+
}
|
|
155
226
|
}
|
|
156
227
|
const s = await splitterOf(ctx.read, recipient)
|
|
157
|
-
if (!s)
|
|
228
|
+
if (!s) {
|
|
229
|
+
return fail(named ? 'not a buy-back splitter (buyback-burn-v1 … v4)' : 'this token\'s tax recipient is not a buy-back splitter',
|
|
230
|
+
named ? { module: recipient } : { token, recipient: recipient === zeroAddress ? null : recipient })
|
|
231
|
+
}
|
|
232
|
+
if (named) token = s.token
|
|
158
233
|
const chainId = Number(ctx.chainId)
|
|
159
234
|
const me = () => walletFor(ctx, opt('from'))
|
|
160
235
|
const send = async (functionName, args, extra) => {
|
|
@@ -201,6 +276,30 @@ export async function runBuyback(sub, { opt, flag, out, fail, summarize }) {
|
|
|
201
276
|
return send('applyBuybackBps', [], { step: 'apply-cut', fromPct: s.buybackPct, toPct: s.pendingCut.toPct, note: 'anyone may apply a cut once its notice ran' })
|
|
202
277
|
}
|
|
203
278
|
|
|
279
|
+
if (sub === 'split') {
|
|
280
|
+
if (!(await listedBy(ctx, s.splitter))) return fail(notListed('buy-back splitter', testnet), { module: s.splitter })
|
|
281
|
+
const [waiting, left, quote] = await Promise.all(['unsplit', 'buybackLeft', 'quote'].map((f) => ctx.read(s.splitter, SPLITTER_ABI, f)))
|
|
282
|
+
const symbol = quote === zeroAddress ? null : await ctx.read(quote, SYMBOL_ABI, 'symbol').catch(() => null)
|
|
283
|
+
const plan = splitPlan({ unsplit: waiting, bps: s.buybackBps, left, payee: s.payee, part: 'buy-back', leftField: 'buybackLeft', symbol, unbound: !s.token })
|
|
284
|
+
if (plan.error) return fail(plan.error, { splitter: s.splitter, buybackLeft: s.buybackLeft, devOwed: s.devOwed })
|
|
285
|
+
const ref = `--token ${s.token}${testnet ? ' --testnet' : ''}`
|
|
286
|
+
return send('split', [], {
|
|
287
|
+
step: 'split', ...plan,
|
|
288
|
+
note: `anyone may: splits what arrived since the last split. ${plan.toPayee} goes to the payee now (should that push fail, it is owed: gang buyback release ${ref}); ${plan.setAside} (${s.buybackPct}%) is set aside for the buy-back, which the keeper spends in chunks once the token trades in its pool (each chunk splits first too, so after graduation this runs by itself)`,
|
|
289
|
+
})
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (sub === 'sweep') {
|
|
293
|
+
if (!(await listedBy(ctx, s.splitter))) return fail(notListed('buy-back splitter', testnet), { module: s.splitter })
|
|
294
|
+
const asset = sweepAsset(opt, fail, ctx.wbnb)
|
|
295
|
+
const plan = sweepPlan({ asset, ...(await sweepReads(ctx.read, s.splitter, SPLITTER_ABI, asset)), payee: s.payee, cmd: 'gang buyback' })
|
|
296
|
+
if (plan.error) return fail(plan.error, { splitter: s.splitter, asset })
|
|
297
|
+
return send('sweep', [asset], {
|
|
298
|
+
step: 'sweep', ...plan,
|
|
299
|
+
note: 'anyone may: sends the splitter\'s whole balance of this asset (not its own quote; e.g. a creator fee or another token\'s tax in another quote) to the payee; none of it is bought back',
|
|
300
|
+
})
|
|
301
|
+
}
|
|
302
|
+
|
|
204
303
|
// release
|
|
205
304
|
if (!(Number(s.devOwed) > 0)) return fail(HINTS.NothingOwed)
|
|
206
305
|
return send('releaseDev', [], { step: 'release', amount: s.devOwed, payee: s.payee, note: 'anyone may; the payee gets what a failed push left owed' })
|
package/src/chain.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createPublicClient, formatEther, parseEther, encodeFunctionData, decodeEventLog, isAddress, zeroAddress } from 'viem'
|
|
2
2
|
import { bsc } from 'viem/chains'
|
|
3
3
|
import { SOFT_ABI, V2_ABI, S_ABI, ERC20_ABI, WBNB_ABI } from './abi.js'
|
|
4
|
-
import {
|
|
4
|
+
import { genOf, padNets, rpcTransport } from './gangpad.js'
|
|
5
5
|
import { mapLimit } from './limit.js'
|
|
6
6
|
|
|
7
7
|
export const ADDR = {
|
|
@@ -49,7 +49,7 @@ export async function resolvePad(token) {
|
|
|
49
49
|
} catch { /* wrong ABI shape or empty */ }
|
|
50
50
|
}
|
|
51
51
|
// tokens from `gang create` / `gang fair create` live on GangLaunchpad, which these commands don't trade
|
|
52
|
-
const kind = await
|
|
52
|
+
const { kind } = await genOf({ gens: padNets('v3').mainnet.gens, read }, token)
|
|
53
53
|
if (GANG_POINTER[kind]) throw new Error(`${token} is ${GANG_POINTER[kind](token)}`)
|
|
54
54
|
throw new Error(
|
|
55
55
|
`not a Gang token on known pads (V2/Soft/U/S): ${token}. ` +
|