@gangfun/cli 0.26.1 → 0.28.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 -3
- package/README.zh-CN.md +6 -3
- package/package.json +1 -1
- package/src/flags.js +1 -1
- package/src/gangpad.js +29 -6
- package/src/index.js +25 -6
- package/src/mcp.js +1 -1
- package/src/trending.js +41 -7
- package/src/v3.js +70 -5
package/README.md
CHANGED
|
@@ -18,6 +18,8 @@ Operate [gang.fun](https://gang.fun) from a Binance **Agentic Wallet**. Curve bu
|
|
|
18
18
|
|
|
19
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`).
|
|
20
20
|
|
|
21
|
+
**2.0 金库版: tokens bound to a lock vault (0.27.0+):** a third pad next to 1.0 and 2.0 (GangVaultLaunchpad: the same 2.0 V3 curves, creator fee and `--grad`; no 打新). Each of its tokens is bound at create, for good, to one vault contract the platform listed, and only the wallet the platform named for that vault may create it, one token per naming: `gang create --vault <vault> --name <n> --symbol <s> [--buy-tax … --sell-tax …] [--grad …]` from that wallet. Until graduation the vault locks holders' tokens and releases them only through the pad, for the wallet that sends the tx and holds an Agent ID; locked tokens still count in the holder's 1% cap (`gang status` → `lockedInVault`, `gang info` → `vault`). After graduation it is a plain token. Buys and sells work as on 2.0 (`gang buy` / `gang sell` find the pad through `kindOf`). The pad has no GangBond and no buy-back / split / LP / combined module, so a `--vault` create takes none of `--dev-buy` / `--bond` / `--buyback` / `--split` / `--lp`: buy with `gang buy` once the create lands. A plain `gang create` never goes to this pad. Mainnet pad `0xE90851A90C6278E3d6e4C24320101f8B13D90A11` (GangRouter `0xAcd4944A4090c13d9DACAe60f3019cef9d9bB1Ad`); testnet `0x9108e7b85e69060A5E626A04Ce6DEf323071C8a9` (GangRouter `0x9bF3E197a6719Af856a7c82d23CABFdBcc184f69`).
|
|
22
|
+
|
|
21
23
|
## Install
|
|
22
24
|
|
|
23
25
|
Node ≥ 18. Also install Binance Agentic Wallet CLI (`baw`):
|
|
@@ -81,7 +83,8 @@ gang release --token <addr> # V3: push a tax payment that faile
|
|
|
81
83
|
gang follow <note tx> --amount <n> [--slippage 1] [--note …] # buy the token a note is about, as a follow of it
|
|
82
84
|
gang upload-logo (--file ./avatar.png | --url <image URL>) # → ipfs://<cid> (view at https://cdn.gang.fun/ipfs/<cid>)
|
|
83
85
|
# create: GangLaunchpad. A V3 token (own buy / sell tax 1–5%, pool only, paid to the creator itself or a whitelisted
|
|
84
|
-
# recipient, in the quote; untaxed without --buy-tax / --sell-tax), or with --fair a 打新 (fair mint) sale on the same pad
|
|
86
|
+
# recipient, in the quote; untaxed without --buy-tax / --sell-tax), or with --fair a 打新 (fair mint) sale on the same pad.
|
|
87
|
+
# --vault <vault>: on the 2.0 金库版 pad, bound to that listed vault, from the wallet gang named for it (no --fair / launch flags)
|
|
85
88
|
gang create --name <n> --symbol <s> [--buy-tax 2 --sell-tax 2 [--dividend 0] [--recipient 0x…]] [--logo ./avatar.png | --logo-uri URL] [--website URL] [--twitter @handle] [--description "…"] [--testnet]
|
|
86
89
|
gang create --fair --name <n> --symbol <s> [--raise 15] [--cap 0.5] [--hold 60] [--mint-fee 1] [--exit-fee 1] [--shares 1] [--logo …] [--website URL] [--twitter @handle] [--description "…"] [--testnet]
|
|
87
90
|
# --cap 0.25–1% of supply per wallet (1% → at least 50 wallets), --hold 60–90% (the hold line)
|
|
@@ -183,7 +186,11 @@ gang watch --events new_token,near_grad --max-events 1 --timeout 30m
|
|
|
183
186
|
`gang trending` (0.24.0+) lists what other agents buy now: up to 5 tokens with the most distinct agent buyers in the last 6h
|
|
184
187
|
(creators, bulk-buying bots and platform wallets left out) and up to 3 notes you can follow now by authors who hit 60%+ of
|
|
185
188
|
their judged calls (`GET /api/trending`, cached 5 minutes in `~/.gang/trending.json`). `gang preflight` and `gang list` carry
|
|
186
|
-
the same as `trending` when there is something in it. It is not a recommendation.
|
|
189
|
+
the same as `trending` when there is something in it. It is not a recommendation. From 0.28.0, when the signed-in wallet has
|
|
190
|
+
never traded on Gang (`GET /api/ref/eligible`), 铸币飞轮 sales and the calls on them are left out and
|
|
191
|
+
`firstTrade: { flyLeftOut, note }` says so: a first trade is pointed at a curve token. `gang list --kind fly` still lists them.
|
|
192
|
+
When `gang preflight` finds issues, it also carries `guide: { url, note }` (0.28.0+): `https://gang.fun/start`, the
|
|
193
|
+
step-by-step setup page for the user.
|
|
187
194
|
|
|
188
195
|
After a note is published or a token is created, `gang execute` / `gang tx --hash` carry `share: { text, url, image }`
|
|
189
196
|
(0.25.0+, from `GET /api/share`): English text for X, up to 240 characters, with the gang.fun link whose card X renders.
|
|
@@ -338,4 +345,4 @@ a background process, so a command never waits on it. `GANG_TELEMETRY=0` (or `DO
|
|
|
338
345
|
|
|
339
346
|
## Version
|
|
340
347
|
|
|
341
|
-
`0.
|
|
348
|
+
`0.27.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
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
|
|
19
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`)上交易。
|
|
20
20
|
|
|
21
|
+
**2.0 金库版:绑定锁仓金库的币(0.27.0+):** 和 1.0、2.0 并列的第三个内盘(GangVaultLaunchpad:V3 曲线、creator 分成和 `--grad` 都和 2.0 一样;没有打新)。这里的每个币在创建时就和平台登记过的一个金库合约永久绑定,而且只有平台为这个金库指定的钱包才能发,每次指定只能发一个币:用那个钱包执行 `gang create --vault <金库> --name <n> --symbol <s> [--buy-tax … --sell-tax …] [--grad …]`。毕业前,金库只能通过内盘锁入、取回持有人的币,而且只替发交易、持有 Agent ID 的钱包操作;锁进金库的币仍计入持有人的 1% 上限(`gang status` → `lockedInVault`,`gang info` → `vault`)。毕业后就是普通的币。买卖和 2.0 一样(`gang buy` / `gang sell` 通过 `kindOf` 找到这个内盘)。这个内盘没有 GangBond,也没有回购 / 分账 / 加池 / 组合模块,所以 `--vault` 发币不能带 `--dev-buy` / `--bond` / `--buyback` / `--split` / `--lp`:发币上链后再用 `gang buy` 买。普通的 `gang create` 不会发到这个内盘。主网内盘 `0xE90851A90C6278E3d6e4C24320101f8B13D90A11`(GangRouter `0xAcd4944A4090c13d9DACAe60f3019cef9d9bB1Ad`);测试网 `0x9108e7b85e69060A5E626A04Ce6DEf323071C8a9`(GangRouter `0x9bF3E197a6719Af856a7c82d23CABFdBcc184f69`)。
|
|
22
|
+
|
|
21
23
|
## 安装
|
|
22
24
|
|
|
23
25
|
Node ≥ 18。另需 `baw`:
|
|
@@ -71,7 +73,8 @@ gang release --token <addr> # V3:补转之前打款失败的
|
|
|
71
73
|
gang follow <附言 tx> --amount <n> [--slippage 1] [--note …] # 跟单:买附言里的币,并标明跟的是哪条
|
|
72
74
|
gang upload-logo (--file ./avatar.png | --url <图片地址>)
|
|
73
75
|
# 建币:GangLaunchpad。默认是 V3 币(买 / 卖税各 1–5%,只在外盘收,用报价币打给接收地址:发币人自己,或白名单里的
|
|
74
|
-
# 合作方;不带 --buy-tax / --sell-tax 即无税);加 --fair
|
|
76
|
+
# 合作方;不带 --buy-tax / --sell-tax 即无税);加 --fair 是同一个内盘上的打新。
|
|
77
|
+
# --vault <金库>:发到 2.0 金库版内盘,绑定平台登记的这个金库,只能由平台为它指定的钱包发(不能带 --fair 和一键发射参数)
|
|
75
78
|
gang create --name <n> --symbol <s> [--buy-tax 2 --sell-tax 2 [--dividend 0] [--recipient 0x…]] [--logo ./avatar.png | --logo-uri URL] [--website URL] [--twitter @handle] [--description "…"] [--testnet]
|
|
76
79
|
gang create --fair --name <n> --symbol <s> [--raise 15] [--cap 0.5] [--hold 60] [--mint-fee 1] [--exit-fee 1] [--shares 1] [--logo …] [--website URL] [--twitter @handle] [--description "…"] [--testnet]
|
|
77
80
|
# --cap 单地址上限 0.25–1%(1% 时至少 50 个地址),--hold 出局线 60–90%
|
|
@@ -157,7 +160,7 @@ x.com / twitter.com 链接(主页、帖子、社区),统一存成 `https:/
|
|
|
157
160
|
`gang watch` 输出 NDJSON:带 `<addr>` 时轮询(最短 3s),推 `trade` / `progress`(25/50/75/90%)/ `graduated`;不带则推 `new_token` / `near_grad`(越过 `--min-pct`)/ `graduated`,由 gang.fun 通过一条长连接推送(Server-Sent Events,`GET /api/stream`,0.17.0+;`watching` 行带 `transport: "stream"`)。服务端没有推送接口或加了 `--poll` 时,按 `--interval` 轮询(最短 10s)。
|
|
158
161
|
`--max-events 1` = 阻塞到下一个事件;`--webhook` 把每个事件 POST 出去。详见 [skill/references/discover.md](https://github.com/gangfun/gang-launchpad/blob/main/skill/references/discover.md)。
|
|
159
162
|
|
|
160
|
-
`gang trending`(0.24.0+)列出其他 agent 现在在买什么:最近 6 小时独立 agent 买家最多的至多 5 个币(不算创建者、批量扫币的机器人和平台钱包),以及至多 3 条现在能跟的想法,作者的已判定命中率不低于 60%(`GET /api/trending`,在 `~/.gang/trending.json` 缓存 5 分钟)。有内容时,`gang preflight` 和 `gang list` 的输出里也带同样的 `trending`。这不是推荐。
|
|
163
|
+
`gang trending`(0.24.0+)列出其他 agent 现在在买什么:最近 6 小时独立 agent 买家最多的至多 5 个币(不算创建者、批量扫币的机器人和平台钱包),以及至多 3 条现在能跟的想法,作者的已判定命中率不低于 60%(`GET /api/trending`,在 `~/.gang/trending.json` 缓存 5 分钟)。有内容时,`gang preflight` 和 `gang list` 的输出里也带同样的 `trending`。这不是推荐。0.28.0 起,如果登录的钱包还没在 Gang 交易过(`GET /api/ref/eligible`),列表里不放铸币飞轮的币和关于它们的想法,并用 `firstTrade: { flyLeftOut, note }` 说明:第一笔交易引导到曲线上的币。`gang list --kind fly` 仍会列出它们。`gang preflight` 查出问题时,输出里还带 `guide: { url, note }`(0.28.0+):`https://gang.fun/start`,给用户看的分步设置页。
|
|
161
164
|
|
|
162
165
|
发布附言或创建代币之后,`gang execute` / `gang tx --hash` 的输出带 `share: { text, url, image }`(0.25.0+,来自 `GET /api/share`):可以直接发到 X 的英文文案,最长 240 字符,附 gang.fun 链接,X 会显示该页面的卡片。CLI 本身不发帖。
|
|
163
166
|
|
|
@@ -290,4 +293,4 @@ Claude Code:`claude mcp add gang -- gang mcp`。同一台机器上 `baw` 要
|
|
|
290
293
|
|
|
291
294
|
## 版本
|
|
292
295
|
|
|
293
|
-
`0.
|
|
296
|
+
`0.27.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.28.0",
|
|
4
4
|
"mcpName": "io.github.gangfun/gang",
|
|
5
5
|
"description": "Gang launchpad CLI for Binance Agentic Wallet agents: create on GangLaunchpad (untaxed or tax tokens), 打新 fair mint, PancakeSwap pool trades, LaunchpadV2 and legacy Soft/U/S trade.",
|
|
6
6
|
"type": "module",
|
package/src/flags.js
CHANGED
|
@@ -13,7 +13,7 @@ export const FAIR_CREATE_FLAGS = ['raise', 'cap', 'hold', 'mint-fee', 'exit-fee'
|
|
|
13
13
|
|
|
14
14
|
export const CREATE_ACCEPTS = new Set([
|
|
15
15
|
'name', 'symbol', 'logo', 'logo-file', 'file-logo', 'logo-uri', 'keep-logo-uri', ...LINK_FLAGS, 'description',
|
|
16
|
-
'quote', 'ref-pool', 'grad', 'testnet', 'calldata', 'from', 'note', 'conf', 'reveal-after',
|
|
16
|
+
'quote', 'ref-pool', 'grad', 'vault', 'testnet', 'calldata', 'from', 'note', 'conf', 'reveal-after',
|
|
17
17
|
'fair', 'fly', ...V3_CREATE_FLAGS, ...FAIR_CREATE_FLAGS, ...FLY_CREATE_FLAGS,
|
|
18
18
|
// a launch in one command: its dev buy reads --slippage like gang buy, its bond --use-wbnb like gang bond post
|
|
19
19
|
...LAUNCH_FLAGS, 'slippage', 'use-wbnb',
|
package/src/gangpad.js
CHANGED
|
@@ -7,7 +7,7 @@ import { bsc, bscTestnet } from 'viem/chains'
|
|
|
7
7
|
* on the pad says which kind a token is (0 = not this pad's, 1 = V3 curve, 2 = 打新). The two `create` overloads keep
|
|
8
8
|
* their old selectors, so each command keeps its own ABI fragment.
|
|
9
9
|
*
|
|
10
|
-
* Each network may have several generations of this pad (GANG_GENS: 1.0, 2.0); kindOf on each tells which one has a token.
|
|
10
|
+
* Each network may have several generations of this pad (GANG_GENS: 1.0, 2.0, 2.0 金库版); kindOf on each tells which one has a token.
|
|
11
11
|
*
|
|
12
12
|
* Env (new name first; the old per-command names still work as aliases). The contracts set the create target (gangGens):
|
|
13
13
|
* mainnet: GANG_PAD (aliases GANG_V3_PAD / GANG_FAIR_PAD), GANG_ROUTER, GANG_BOND, GANG_SPLITTER_FACTORY,
|
|
@@ -20,10 +20,17 @@ import { bsc, bscTestnet } from 'viem/chains'
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
* 2.0 金库版 (GangVaultLaunchpad): 2.0 whose only create is createWithVault, binding the token to a listed lock vault.
|
|
24
|
+
* Listed last on each network, so it is never the target of a plain create; gang create --vault picks it.
|
|
25
|
+
*/
|
|
26
|
+
export const VAULT_GEN = '2.0-vault'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* GangLaunchpad generations on each network, newest first (2.0 金库版 aside: always last, see VAULT_GEN). A create goes to
|
|
30
|
+
* the first; a token already out stays on the pad that created it and is served with that generation's GangRouter,
|
|
31
|
+
* GangBond and module factories (each of them is bound to one pad). 2.0 (docs/SPEC-CURVE-CREATOR-FEE-2026-10-31.md) has
|
|
32
|
+
* the same V3 curves and 打新 sales, and keeps 70% of the 1% curve fee for the token's creator (creatorFeeOf /
|
|
33
|
+
* claimCreatorFee); a 1.0 pad has neither.
|
|
27
34
|
*/
|
|
28
35
|
export const GANG_GENS = {
|
|
29
36
|
mainnet: [
|
|
@@ -48,6 +55,14 @@ export const GANG_GENS = {
|
|
|
48
55
|
// combo-v1, 2026-10-31 (the Safe allowed it on GangHandlerAdmin at block 130811492)
|
|
49
56
|
comboFactory: '0xd33C38BE3f8472b3013167830F0638C1704e1DBd',
|
|
50
57
|
},
|
|
58
|
+
// 2026-11-02, pad block 131081707: 2.0 金库版 (GangVaultLaunchpad; docs/MAINNET-GANG-VAULT-LAUNCHPAD-2026-11-02.md).
|
|
59
|
+
// The 2.0 curves, each bound at create to one vault the platform listed (createWithVault, by the wallet the Safe
|
|
60
|
+
// named for that vault: gang create --vault). Never the create target of a plain create. Its own GangRouter; no
|
|
61
|
+
// GangBond and no module factories (none is wired to it)
|
|
62
|
+
{
|
|
63
|
+
gen: VAULT_GEN, pad: '0xE90851A90C6278E3d6e4C24320101f8B13D90A11', router: '0xAcd4944A4090c13d9DACAe60f3019cef9d9bB1Ad',
|
|
64
|
+
bond: null, splitterFactory: null, splitFactory: null, lpFactory: null, comboFactory: null,
|
|
65
|
+
},
|
|
51
66
|
],
|
|
52
67
|
testnet: [
|
|
53
68
|
// 2026-10-31, pad block 139940227: 2.0 with the graduation target the creator picks (GRAD_BNB_TIERS, createWithGradTarget;
|
|
@@ -75,9 +90,14 @@ export const GANG_GENS = {
|
|
|
75
90
|
splitFactory: '0x5F7dC7502E945A860Cf49cca72dA8bD60Fb1567E', lpFactory: '0xA729C60FCa0Bd0D28a55E22126D3fE412AA41591',
|
|
76
91
|
comboFactory: '0x52a8f90a92E5C1828b4436a0B99C6b293f7F4CFE',
|
|
77
92
|
},
|
|
93
|
+
// 2026-11-01, pad block 140215635: 2.0 金库版, testnet v3 (docs/TESTNET-GANG-VAULT-LAUNCHPAD-2026-11-01.md)
|
|
94
|
+
{
|
|
95
|
+
gen: VAULT_GEN, pad: '0x9108e7b85e69060A5E626A04Ce6DEf323071C8a9', router: '0x9bF3E197a6719Af856a7c82d23CABFdBcc184f69',
|
|
96
|
+
bond: null, splitterFactory: null, splitFactory: null, lpFactory: null, comboFactory: null,
|
|
97
|
+
},
|
|
78
98
|
],
|
|
79
99
|
}
|
|
80
|
-
// what a generation brings to a ctx (gen: '1.0' | '2.0', null for a pad named by the env that this CLI does not know)
|
|
100
|
+
// what a generation brings to a ctx (gen: '1.0' | '2.0' | VAULT_GEN, null for a pad named by the env that this CLI does not know)
|
|
81
101
|
const GEN_FIELDS = ['gen', 'pad', 'router', 'bond', 'splitterFactory', 'splitFactory', 'lpFactory', 'comboFactory']
|
|
82
102
|
// the env names of each field, per network (new name first; the old per-command names still work as aliases)
|
|
83
103
|
const GEN_ENV = {
|
|
@@ -176,6 +196,9 @@ export function gangGens(testnet) {
|
|
|
176
196
|
return [first, ...list.filter((g) => !sameAddr(g.pad, first.pad))].map(genFields)
|
|
177
197
|
}
|
|
178
198
|
|
|
199
|
+
/** The 2.0 金库版 generation of `gens` (a ctx's gens or gangGens(testnet)), or null when the network has none. */
|
|
200
|
+
export const vaultGenOf = (gens) => gens.find((g) => g.gen === VAULT_GEN) ?? null
|
|
201
|
+
|
|
179
202
|
/** A generation's contracts as ctx fields (missing ones null). */
|
|
180
203
|
export const genFields = (g) => Object.fromEntries(GEN_FIELDS.map((k) => [k, g?.[k] ?? null]))
|
|
181
204
|
|
package/src/index.js
CHANGED
|
@@ -257,7 +257,8 @@ U / S pads) and run that kind's trade. Results of V3 / 打新 / 铸币飞轮 tok
|
|
|
257
257
|
gang preflight check sign-in, Developer Mode, tradeAllTokens, Agent ID
|
|
258
258
|
gang trending what other agents buy now: up to 5 tokens with the most distinct agent buyers in 6h,
|
|
259
259
|
up to 3 followable notes by 60%+ authors (also carried by preflight and list as
|
|
260
|
-
trending). Not a recommendation: never buy from it on your own
|
|
260
|
+
trending). Not a recommendation: never buy from it on your own. A wallet that never
|
|
261
|
+
traded on Gang gets no 铸币飞轮 rows (firstTrade says so)
|
|
261
262
|
gang list [--limit 20] [--kind v3|fair|fly [--status …]]
|
|
262
263
|
V2 / Soft / U / S tokens read on chain (works without gang.fun), the newest --limit
|
|
263
264
|
per pad; --kind v3 (--status curve|graduated|all) / --kind fair
|
|
@@ -327,8 +328,8 @@ U / S pads) and run that kind's trade. Results of V3 / 打新 / 铸币飞轮 tok
|
|
|
327
328
|
copy an image to gang.fun → logoUrl (ipfs://<cid>, for --logo-uri) and url (CDN)
|
|
328
329
|
|
|
329
330
|
gang create --name <n> --symbol <s> [--buy-tax <1-5> --sell-tax <1-5> [--dividend 0-100] [--recipient <0x…>]]
|
|
330
|
-
[--grad 6|9|12|15] [--quote 0x… --ref-pool 0x…] [--logo <file> | --logo-uri URL]
|
|
331
|
-
[--twitter @handle] [--description <text>] [--testnet]
|
|
331
|
+
[--grad 6|9|12|15] [--vault <0x…>] [--quote 0x… --ref-pool 0x…] [--logo <file> | --logo-uri URL]
|
|
332
|
+
[--website URL] [--twitter @handle] [--description <text>] [--testnet]
|
|
332
333
|
a V3 token on GangLaunchpad (LaunchpadV2 / Soft / U / S take no new tokens; --taxed,
|
|
333
334
|
the old V2 track, is refused). No --buy-tax / --sell-tax: untaxed (no pool tax, no
|
|
334
335
|
dividend, no recipient). Taxed: own buy / sell tax in % (fixed at create), only in the
|
|
@@ -338,6 +339,11 @@ U / S pads) and run that kind's trade. Results of V3 / 打新 / 铸币飞轮 tok
|
|
|
338
339
|
--grad (GangLaunchpad 2.0): the graduation target in BNB raised, 6 / 9 / 12 / 15
|
|
339
340
|
(default 9; market cap at graduation ≈ 5×); 1.0 graduates every curve at 15 and
|
|
340
341
|
refuses --grad. info / status show each token's graduationTargetBnb
|
|
342
|
+
--vault (2.0 金库版): create on the vault pad, the token bound for good to this
|
|
343
|
+
vault gang listed, from the wallet gang named for it (one token per naming). Until
|
|
344
|
+
graduation the vault locks / releases holders' tokens through the pad (locked
|
|
345
|
+
tokens count in the 1% cap: gang status → lockedInVault). Alone: no --fair / --fly,
|
|
346
|
+
no --dev-buy / --bond / --buyback / --split / --lp
|
|
341
347
|
gang create --fair --name <n> --symbol <s> [--raise 15] [--cap 0.5] [--hold 60] [--mint-fee 1] [--exit-fee 1]
|
|
342
348
|
[--shares 1] [--quote 0x… --ref-pool 0x…] [--logo …] [--website URL] [--twitter @handle] [--description …]
|
|
343
349
|
a 打新 (fair mint) sale: one price per share both ways, the last share launches on
|
|
@@ -1152,6 +1158,7 @@ function checkFlyCreate() {
|
|
|
1152
1158
|
: `--${wrong} is a V3 tax setting; a 铸币飞轮 token's tax goes to holders, the platform and the creator in fixed parts`)
|
|
1153
1159
|
}
|
|
1154
1160
|
}
|
|
1161
|
+
const VAULT_ALONE = 'a --vault create stands alone: the 2.0 金库版 pad has no GangBond and no buy-back / split / LP / combined module, and a dev buy is its own gang buy after the create lands'
|
|
1155
1162
|
// --grad picks a V3 curve's graduation target (2.0); a 打新 / 铸币飞轮 sale ends at its own --raise
|
|
1156
1163
|
const GRAD_ONLY_V3 = (what) => `--grad is a V3 curve setting (the graduation target, 2.0): ${what} fills at its --raise instead, so leave --grad out`
|
|
1157
1164
|
function create() {
|
|
@@ -1175,6 +1182,8 @@ function create() {
|
|
|
1175
1182
|
}
|
|
1176
1183
|
|
|
1177
1184
|
// after a clean preflight: where a first trade usually starts
|
|
1185
|
+
// gang.fun's setup page: every preflight issue code, step by step, for the user to open on their phone (gang-web-legacy /start)
|
|
1186
|
+
const SETUP_GUIDE = 'https://gang.fun/start'
|
|
1178
1187
|
const PREFLIGHT_NEXT = [
|
|
1179
1188
|
'gang trending: what other agents buy now',
|
|
1180
1189
|
'gang notes --min-hit 0.6: followable calls by authors who hit 60%+',
|
|
@@ -1273,6 +1282,13 @@ async function main() {
|
|
|
1273
1282
|
const launch = LAUNCH_FLAGS.find((f) => flag(f))
|
|
1274
1283
|
if (launch) fail(`--${launch}: ${FLY_NO_BOND}`)
|
|
1275
1284
|
}
|
|
1285
|
+
// --vault (2.0 金库版): a V3 create bound to a listed vault, alone: no 打新 / 铸币飞轮, no chained launch
|
|
1286
|
+
if (flag('vault')) {
|
|
1287
|
+
if (!tokenCreate || cmd === 'fair') fail('--vault only applies to a V3 create: gang create --vault <vault> …')
|
|
1288
|
+
if (flyCreate || flag('fair')) fail(`--vault binds a V3 curve token to a listed vault: leave --${flyCreate ? 'fly' : 'fair'} out`)
|
|
1289
|
+
const launch = LAUNCH_FLAGS.find((f) => flag(f))
|
|
1290
|
+
if (launch) fail(`--${launch}: ${VAULT_ALONE}`)
|
|
1291
|
+
}
|
|
1276
1292
|
for (const name of LINK_FLAGS) {
|
|
1277
1293
|
if (!tokenCreate && flag(name)) fail(`--${name} only applies when creating a token (\`gang create\`, \`gang create --fair\`, \`gang create --fly\`)`)
|
|
1278
1294
|
}
|
|
@@ -1334,7 +1350,7 @@ async function main() {
|
|
|
1334
1350
|
if (!agent) issues.push({ code: 'NO_AGENT_ID', fix: 'Claim a .ai Agent ID in Binance Wallet (Agent ID banner). Gang only lets Agent ID holders buy/create.' })
|
|
1335
1351
|
}
|
|
1336
1352
|
// after the baw calls: they block the event loop, and the fetch's short timeout would run out meanwhile
|
|
1337
|
-
const hot = trendingBlock()
|
|
1353
|
+
const hot = trendingBlock({ wallet: me })
|
|
1338
1354
|
return out({
|
|
1339
1355
|
success: issues.length === 0, cliVersion: VERSION, status, address: me,
|
|
1340
1356
|
// `launchpad` = createPad: kept for readers of the old field (it used to be the V2 create target)
|
|
@@ -1342,6 +1358,7 @@ async function main() {
|
|
|
1342
1358
|
devMode: settings?.devMode?.enabled ?? null, tradeAllTokens: settings?.tradeAllTokens ?? null, issues,
|
|
1343
1359
|
note: 'New create → GangLaunchpad (gang create = gang v3 create; gang fair create for 打新). LaunchpadV2 / Soft / U / S take no new tokens: existing buy / sell only.',
|
|
1344
1360
|
...(!issues.length && { next: PREFLIGHT_NEXT }),
|
|
1361
|
+
...(issues.length && { guide: { url: SETUP_GUIDE, note: 'Step-by-step setup (Agentic Wallet, Agent ID, Developer Mode, Trade all tokens) for the user to open on their phone; give it with the fixes.' } }),
|
|
1345
1362
|
...await hot.then((t) => (t ? { trending: t } : {})),
|
|
1346
1363
|
})
|
|
1347
1364
|
}
|
|
@@ -1356,7 +1373,7 @@ async function main() {
|
|
|
1356
1373
|
}
|
|
1357
1374
|
const me = bawStatus() === 'CONNECTED' ? bawAddress() : undefined
|
|
1358
1375
|
const perPad = parseCount('limit', opt('limit', '20'), 1000)
|
|
1359
|
-
const hot = trendingBlock()
|
|
1376
|
+
const hot = trendingBlock({ wallet: me })
|
|
1360
1377
|
const { tokens, pads } = await listTokens(me, perPad)
|
|
1361
1378
|
return out({
|
|
1362
1379
|
success: true, createPad: padNets('v3').mainnet.pad, perPad, pads, tokens,
|
|
@@ -1382,10 +1399,12 @@ async function main() {
|
|
|
1382
1399
|
})
|
|
1383
1400
|
}
|
|
1384
1401
|
case 'trending': {
|
|
1385
|
-
|
|
1402
|
+
// the signed-in wallet, if any: a wallet that never traded on Gang gets no 铸币飞轮 rows (trending.js)
|
|
1403
|
+
const t = await trending({ wallet: myAddress() })
|
|
1386
1404
|
if (!t) fail(`gang.fun has no trending list right now (${API}/trending); try gang hot or gang notes --min-hit 0.6`, { retry: true })
|
|
1387
1405
|
return out({
|
|
1388
1406
|
success: true, at: t.at ? localTime(t.at) : null, tokens: t.tokens, calls: t.calls, note: TRENDING_NOTE,
|
|
1407
|
+
...(t.firstTrade && { firstTrade: t.firstTrade }),
|
|
1389
1408
|
...(!t.tokens.length && !t.calls.length && { empty: 'Nothing qualifies right now: no token with enough distinct agent buyers in 6h, no followable note by a 60%+ author.' }),
|
|
1390
1409
|
})
|
|
1391
1410
|
}
|
package/src/mcp.js
CHANGED
|
@@ -46,7 +46,7 @@ export const RULES = [
|
|
|
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; on GangLaunchpad 2.0 --grad 6|9|12|15 picks the graduation target in BNB, default 9) or create --fair (fair mint), or GangFlywheelPad: create --fly (Mint Flywheel). Never an older pad.',
|
|
49
|
+
'New tokens go on GangLaunchpad only: create (V3, untaxed unless --buy-tax / --sell-tax; on GangLaunchpad 2.0 --grad 6|9|12|15 picks the graduation target in BNB, default 9; --vault <vault> only from the wallet gang named for that listed vault, alone, never on your own initiative) 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.',
|
package/src/trending.js
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* `gang trending` prints it; `gang preflight` and `gang list` carry it as `trending`. Cached 5 minutes in
|
|
6
6
|
* ~/.gang/trending.json with a short timeout, so it never slows a command down much, and it's simply left out when gang.fun
|
|
7
7
|
* doesn't answer.
|
|
8
|
+
* For a wallet that has never traded on Gang (GET /api/ref/eligible), 铸币飞轮 sales and the calls on them are left out:
|
|
9
|
+
* a first trade is pointed at a curve token instead.
|
|
8
10
|
*/
|
|
9
11
|
import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'
|
|
10
12
|
import { homedir } from 'node:os'
|
|
@@ -18,6 +20,7 @@ const TTL_MS = 5 * 60_000
|
|
|
18
20
|
const TIMEOUT_MS = 3_000
|
|
19
21
|
const ADDR = /^0x[0-9a-fA-F]{40}$/
|
|
20
22
|
export const TRENDING_NOTE = 'What other agents are buying now, not a recommendation. Mention it only when it helps the user; never buy from it on your own.'
|
|
23
|
+
export const FIRST_TRADE_NOTE = 'This wallet has not traded on Gang yet, so 铸币飞轮 (Mint Flywheel) sales are left out here: a first trade is simpler on a curve token. gang list --kind fly still lists them.'
|
|
21
24
|
|
|
22
25
|
function readCache() {
|
|
23
26
|
try {
|
|
@@ -41,8 +44,29 @@ const tokenRow = (t) => ({
|
|
|
41
44
|
volume24hUsd: t.volume24hUsd ?? null, link: `https://gang.fun/token/${t.address}`, next: `gang info --token ${t.address}`,
|
|
42
45
|
})
|
|
43
46
|
|
|
44
|
-
/**
|
|
45
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Whether `wallet` has never traded on Gang: true / false from gang.fun (GET /api/ref/eligible, which `--ref` also asks),
|
|
49
|
+
* null when there is no wallet or no answer (then nothing is left out). Not cached: a wallet stops being new on its first trade.
|
|
50
|
+
*/
|
|
51
|
+
export async function firstTrade(wallet) {
|
|
52
|
+
if (!ADDR.test(wallet ?? '')) return null
|
|
53
|
+
try {
|
|
54
|
+
const r = await fetch(`${API}/ref/eligible?${new URLSearchParams({ wallet })}`, { headers: { accept: 'application/json', 'user-agent': UA }, signal: AbortSignal.timeout(TIMEOUT_MS) })
|
|
55
|
+
if (!r.ok) return null
|
|
56
|
+
const b = await r.json()
|
|
57
|
+
return b?.eligible === true ? true : b?.reason === 'already_traded' ? false : null
|
|
58
|
+
} catch { return null }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const isFly = (track) => String(track ?? '').toLowerCase() === 'fly'
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* → { at, tokens, calls } (rendered rows), or null when gang.fun has no answer. A miss is cached too, so a down server costs
|
|
65
|
+
* one timeout per 5 minutes. wallet: the signed-in wallet; when it has never traded on Gang, 铸币飞轮 rows are dropped and
|
|
66
|
+
* `firstTrade: { flyLeftOut, note }` says so (only when something was dropped).
|
|
67
|
+
*/
|
|
68
|
+
export async function trending({ wallet = null } = {}) {
|
|
69
|
+
const fresh = firstTrade(wallet)
|
|
46
70
|
const c = readCache()
|
|
47
71
|
let body = c ? c.body : undefined
|
|
48
72
|
if (body === undefined) {
|
|
@@ -53,16 +77,26 @@ export async function trending() {
|
|
|
53
77
|
writeCache(body)
|
|
54
78
|
}
|
|
55
79
|
if (!body || !Array.isArray(body.tokens) || !Array.isArray(body.calls)) return null
|
|
80
|
+
let tokens = body.tokens.filter((t) => ADDR.test(t?.address ?? ''))
|
|
81
|
+
let calls = body.calls.filter((n) => n?.tx)
|
|
82
|
+
let left = 0
|
|
83
|
+
if (await fresh) {
|
|
84
|
+
const before = tokens.length + calls.length
|
|
85
|
+
tokens = tokens.filter((t) => !isFly(t.track))
|
|
86
|
+
calls = calls.filter((n) => !isFly(n.token?.track))
|
|
87
|
+
left = before - tokens.length - calls.length
|
|
88
|
+
}
|
|
56
89
|
return {
|
|
57
90
|
at: body.at ?? null,
|
|
58
|
-
tokens:
|
|
59
|
-
calls:
|
|
91
|
+
tokens: tokens.slice(0, 5).map(tokenRow),
|
|
92
|
+
calls: calls.slice(0, 3).map(noteRow),
|
|
93
|
+
...(left && { firstTrade: { flyLeftOut: left, note: FIRST_TRADE_NOTE } }),
|
|
60
94
|
}
|
|
61
95
|
}
|
|
62
96
|
|
|
63
97
|
/** The `trending` block other commands carry: only when there's something in it. */
|
|
64
|
-
export async function trendingBlock() {
|
|
65
|
-
const t = await trending()
|
|
98
|
+
export async function trendingBlock(opts) {
|
|
99
|
+
const t = await trending(opts)
|
|
66
100
|
if (!t || (!t.tokens.length && !t.calls.length)) return null
|
|
67
|
-
return { tokens: t.tokens, calls: t.calls, more: 'gang trending', note: TRENDING_NOTE }
|
|
101
|
+
return { tokens: t.tokens, calls: t.calls, more: 'gang trending', note: TRENDING_NOTE, ...(t.firstTrade && { firstTrade: t.firstTrade }) }
|
|
68
102
|
}
|
package/src/v3.js
CHANGED
|
@@ -3,7 +3,7 @@ import { decimalsOf, defaultRefPool, dividendOf, VAULT_ABI, fundingStep as fund,
|
|
|
3
3
|
import { API } from './discover.js'
|
|
4
4
|
import { UA } from './version.js'
|
|
5
5
|
import { walletFor } from './fair.js'
|
|
6
|
-
import { atTokenPad, CREATOR_FEE_ABI, GRAD_TARGET_ABI, gradTargetBnbOf, gradTiersOf, KIND_UNREAD, MERGED_ERRORS_ABI, MERGED_HINTS, NOT_ON_MAINNET, notThisKind, padNets, rpcTransport } from './gangpad.js'
|
|
6
|
+
import { atTokenPad, CREATOR_FEE_ABI, genFields, GRAD_TARGET_ABI, gradTargetBnbOf, gradTiersOf, KIND_UNREAD, MERGED_ERRORS_ABI, MERGED_HINTS, NOT_ON_MAINNET, notThisKind, padNets, rpcTransport, VAULT_GEN, vaultGenOf } from './gangpad.js'
|
|
7
7
|
import { createNote, curveCreatorFee } from './creatorfee.js'
|
|
8
8
|
import { poolPayBnb, poolTrade } from './pool.js'
|
|
9
9
|
import { bondGuard } from './bond.js'
|
|
@@ -25,6 +25,12 @@ const TAX = '(uint16 buyTaxBps, uint16 sellTaxBps, uint16 dividendBps, address r
|
|
|
25
25
|
const PAD_ABI = parseAbi([
|
|
26
26
|
`function create(string name, string symbol, string logoURI, string metaURI, address quote, address refPool, ${TAX} tax) returns (address)`,
|
|
27
27
|
`function createWithGradTarget(string name, string symbol, string logoURI, string metaURI, address quote, address refPool, ${TAX} tax, uint256 gradBnb) returns (address)`,
|
|
28
|
+
// 2.0 金库版 (GangVaultLaunchpad): its only create, binding the token to a listed vault for good
|
|
29
|
+
`function createWithVault(string name, string symbol, string logoURI, string metaURI, address quote, address refPool, ${TAX} tax, uint256 gradBnb, address vault) returns (address)`,
|
|
30
|
+
'function isVault(address vault) view returns (bool)',
|
|
31
|
+
'function vaultOf(address token) view returns (address)',
|
|
32
|
+
'function vaultCreator(address vault) view returns (address)',
|
|
33
|
+
'function lockedOf(address token, address user) view returns (uint256)',
|
|
28
34
|
'function buy(address token, uint256 quoteIn, uint256 minTokensOut) returns (uint256)',
|
|
29
35
|
'function sell(address token, uint256 tokensIn, uint256 minQuoteOut) returns (uint256)',
|
|
30
36
|
`function checkTaxConfig(${TAX} tax) view returns (bool ok, string reason)`,
|
|
@@ -47,11 +53,19 @@ const PAD_ABI = parseAbi([
|
|
|
47
53
|
'error PoolNotFactory()', 'error QuoteNotInPool()', 'error PoolNoLiquidity()', 'error ThinReferencePool()', 'error NotContract()',
|
|
48
54
|
'error UnknownPoolType()', 'error QuoteNotAllowed()', 'error RouterNeedsGate()', 'error V3FactoryNotSet()', 'error GradAmtZero()',
|
|
49
55
|
'error VaultFloorTooHigh()',
|
|
56
|
+
'error NotVault()', 'error VaultDelisted()', 'error VaultNotContract()', 'error VaultIsRouter()', 'error VaultCannotTrade()',
|
|
57
|
+
'error UseVaultCreate()', 'error NotVaultCreator()', 'error TraderNotOrigin()',
|
|
50
58
|
'event Created(address indexed token, address indexed creator, string name, string symbol, string logoURI, address indexed quote, address refPair, uint256 gradAmt)',
|
|
51
59
|
'event TaxConfigured(address indexed token, uint16 buyTaxBps, uint16 sellTaxBps, uint16 dividendBps, address indexed recipient)',
|
|
52
60
|
'event Buy(address indexed token, address indexed buyer, uint256 quoteIn, uint256 protocolFee, uint256 tax, uint256 tokensOut, uint256 realQuote)',
|
|
53
61
|
'event Sell(address indexed token, address indexed seller, uint256 tokensIn, uint256 protocolFee, uint256 tax, uint256 quoteOut, uint256 realQuote)',
|
|
54
62
|
'event Graduated(address indexed token, address indexed pair, address quote, uint256 tokenAmount, uint256 quoteAmount)',
|
|
63
|
+
// 2.0 金库版: the token's vault, and what the vault moves for a holder before graduation (through the pad)
|
|
64
|
+
'event VaultBound(address indexed token, address indexed vault)',
|
|
65
|
+
'event VaultLocked(address indexed token, address indexed vault, address indexed user, uint256 amount)',
|
|
66
|
+
'event VaultReleased(address indexed token, address indexed vault, address indexed user, uint256 amount)',
|
|
67
|
+
'event VaultSet(address indexed vault, bool enabled)',
|
|
68
|
+
'event VaultCreatorSet(address indexed vault, address indexed creator)',
|
|
55
69
|
])
|
|
56
70
|
const TAX_ROUTER_ABI = parseAbi([
|
|
57
71
|
'function owedOf(address token) view returns (uint256)',
|
|
@@ -96,10 +110,20 @@ const HINTS = {
|
|
|
96
110
|
RouterNeedsGate: 'the router path is off while the Agent gate is off; re-run with --use-wbnb to buy directly',
|
|
97
111
|
// not a create flag: the shared dividend vault's holding floor for this pad was raised above what V3 allows (10,000 tokens)
|
|
98
112
|
VaultFloorTooHigh: 'the platform\'s dividend vault requires a larger holding than V3 dividends allow (10,000 tokens), so a dividend token can\'t be created right now; --dividend 0 still works, or ask gang to fix the vault setting',
|
|
113
|
+
// 2.0 金库版 (gang create --vault)
|
|
114
|
+
NotVault: '--vault is not a vault listed on the 2.0 金库版 pad: gang lists each vault before its token is created',
|
|
115
|
+
NotVaultCreator: 'this wallet is not the one gang named for this vault (each named wallet creates one token): create from that wallet, or ask gang to name this one',
|
|
116
|
+
UseVaultCreate: 'the 2.0 金库版 pad creates only tokens bound to a listed vault: gang create --vault <vault> …',
|
|
117
|
+
VaultCannotTrade: 'a token\'s own vault never buys or sells it on the curve',
|
|
118
|
+
VaultDelisted: 'the token\'s vault was delisted: it takes no new locks (releases stay open)',
|
|
119
|
+
TraderNotOrigin: 'before graduation the pad moves tokens only for the wallet that sends the tx',
|
|
99
120
|
}
|
|
121
|
+
const VAULT_PAD_ONLY = 'the 2.0 金库版 pad creates only with --vault <vault>: gang create --vault <the vault gang listed for you> …'
|
|
100
122
|
|
|
101
123
|
/** What `gang tx` decodes a V3 trade's logs with (the pad and its 2.0 creator fee, the tax router, the dividend vault). */
|
|
102
124
|
export const V3_EVENT_ABIS = [PAD_ABI, CREATOR_FEE_ABI, GRAD_TARGET_ABI, TAX_ROUTER_ABI, VAULT_ABI]
|
|
125
|
+
/** For test/gens.mjs: the pad ABI (2.0 金库版 entries included) and the hints its errors get. */
|
|
126
|
+
export const _vaultTest = { PAD_ABI, HINTS }
|
|
103
127
|
|
|
104
128
|
export function v3Ctx(testnet) {
|
|
105
129
|
const net = V3_NETS[testnet ? 'testnet' : 'mainnet']
|
|
@@ -164,6 +188,18 @@ async function labelOf(ctx, registry, recipient) {
|
|
|
164
188
|
try { return (await ctx.read(registry, REGISTRY_ABI, 'entries', [recipient]))[2] || null } catch { return null }
|
|
165
189
|
}
|
|
166
190
|
|
|
191
|
+
/** 2.0 金库版: the token's vault and what it means for holders (null on any other pad). */
|
|
192
|
+
async function vaultView(ctx, token, c) {
|
|
193
|
+
if (ctx.gen !== VAULT_GEN) return null
|
|
194
|
+
const address = await ctx.read(ctx.pad, PAD_ABI, 'vaultOf', [token])
|
|
195
|
+
return {
|
|
196
|
+
address, padGen: ctx.gen,
|
|
197
|
+
note: c.graduated
|
|
198
|
+
? 'graduated: a plain token now, the vault moves it like any other contract'
|
|
199
|
+
: 'until graduation the token moves only through the pad: this vault locks a holder\'s tokens (counted in the holder\'s 1% cap, see gang status → lockedInVault) and releases them, for the wallet that sends the tx and holds an Agent ID',
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
167
203
|
/** A token's curve and tax as the pad stores them, plus the recipient's whitelist label. null when not a V3 token. */
|
|
168
204
|
export async function curveOf(ctx, token) {
|
|
169
205
|
const c = await ctx.read(ctx.pad, PAD_ABI, 'curves', [token])
|
|
@@ -320,11 +356,12 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
|
|
|
320
356
|
? { warning: `this token pays its tax to the split module, but the module is bound to another token (${split.token}): the keeper never splits this token's tax (${c.quote}); it is split only by hand (gang split distribute --token ${token}${net} --asset ${c.quote})` } : null
|
|
321
357
|
// 2.0: the creator's part of the curve fee, waiting on the pad
|
|
322
358
|
const gen = await curveCreatorFee(ctx, token, c, net)
|
|
359
|
+
const vault = await vaultView(ctx, token, c)
|
|
323
360
|
const nonWbnb = c.quote.toLowerCase() !== String(ctx.wbnb).toLowerCase()
|
|
324
361
|
const graduationNote = c.graduationTargetBnb != null && !c.graduated
|
|
325
362
|
? gradLine(c.graduationTargetBnb, nonWbnb ? `${c.graduationAt} ${c.quoteSymbol || 'of the quote'}` : null) : null
|
|
326
363
|
return out({
|
|
327
|
-
success: true, chainId: Number(ctx.chainId), ...fees, ...pub, ...gen, ...(graduationNote && { graduationNote }), taxNote, ...(swapBack && { swapBack }), ...(buyback && { buyback }),
|
|
364
|
+
success: true, chainId: Number(ctx.chainId), ...fees, ...pub, ...gen, ...(vault && { vault }), ...(graduationNote && { graduationNote }), taxNote, ...(swapBack && { swapBack }), ...(buyback && { buyback }),
|
|
328
365
|
...(split && { split: { ...split, ...splitWarn } }), ...(lp && { lp: { ...lp, ...lpWarn } }),
|
|
329
366
|
...(combo && { combo: { ...combo, ...(comboWarning && { warning: comboWarning }) } }),
|
|
330
367
|
})
|
|
@@ -342,9 +379,11 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
|
|
|
342
379
|
const q = c.graduated && c.pair && bal > 0n ? await poolSellQuote(ctx, c.taxHandler, token, bal) : null
|
|
343
380
|
// the creator's own view also shows its creator fee (2.0)
|
|
344
381
|
const { creatorFee } = me.toLowerCase() === c.creator.toLowerCase() ? await curveCreatorFee(ctx, token, c, net) : {}
|
|
382
|
+
// 2.0 金库版, before graduation: what this wallet has in the vault, counted in its 1% cap
|
|
383
|
+
const locked = ctx.gen === VAULT_GEN && !c.graduated ? await ctx.read(ctx.pad, PAD_ABI, 'lockedOf', [token, me]) : null
|
|
345
384
|
return out({
|
|
346
385
|
success: true, chainId: Number(ctx.chainId), wallet: me, token, quote: c.quoteSymbol, graduated: c.graduated,
|
|
347
|
-
balance: formatUnits(bal, 18), dividendPct: c.dividendPct, ...(creatorFee && { creatorFee }),
|
|
386
|
+
balance: formatUnits(bal, 18), ...(locked !== null && { lockedInVault: formatUnits(locked, 18) }), dividendPct: c.dividendPct, ...(creatorFee && { creatorFee }),
|
|
348
387
|
graduationTargetBnb: c.graduationTargetBnb, graduationAt: c.graduationAt, progressPct: c.progressPct,
|
|
349
388
|
...(q && {
|
|
350
389
|
poolSellAll: {
|
|
@@ -398,6 +437,8 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
|
|
|
398
437
|
if (!(n >= 1 && n <= 5)) fail(`--${f} must be a number between 1 and 5 (in %); for an untaxed token leave out both tax flags (or give both as 0)`, { got: opt(f) ?? null })
|
|
399
438
|
return n
|
|
400
439
|
}
|
|
440
|
+
// --vault (2.0 金库版): the listed vault the token is bound to for good; the create goes to that pad (createWithVault)
|
|
441
|
+
const vault = flag('vault') ? addrArg(opt, fail, 'vault', 'the vault gang listed for your token') : null
|
|
401
442
|
// --grad: the graduation target in BNB raised, one of the pad's GRAD_BNB_TIERS (2.0); left out: the pad's default
|
|
402
443
|
const grad = flag('grad') ? Number(opt('grad')) : null
|
|
403
444
|
if (grad !== null && !(grad > 0)) fail('--grad must be the graduation target in BNB raised: 6, 9, 12 or 15', { got: opt('grad') ?? null })
|
|
@@ -405,6 +446,24 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
|
|
|
405
446
|
const sellTax = taxed ? taxOf('sell-tax') : 0
|
|
406
447
|
const dividend = taxed ? parseNum(fail, 'dividend', opt('dividend', '0'), 0, 100) : 0
|
|
407
448
|
const me = walletFor(ctx, opt('from'))
|
|
449
|
+
if (vault) {
|
|
450
|
+
// the vault pad, whatever the create target is; its own router, tax handler and fees
|
|
451
|
+
const vg = vaultGenOf(ctx.gens ?? [])
|
|
452
|
+
if (!vg) fail(`--vault: this CLI version knows no 2.0 金库版 pad on ${testnet ? 'the BSC testnet' : 'BSC mainnet'}`)
|
|
453
|
+
Object.assign(ctx, genFields(vg))
|
|
454
|
+
delete ctx._tax
|
|
455
|
+
delete ctx.fees
|
|
456
|
+
// asked before any upload: the pad would refuse the create anyway (NotVault / NotVaultCreator)
|
|
457
|
+
const [listed, named] = await Promise.all([ctx.read(ctx.pad, PAD_ABI, 'isVault', [vault]), ctx.read(ctx.pad, PAD_ABI, 'vaultCreator', [vault])])
|
|
458
|
+
if (!listed) fail(HINTS.NotVault, { vault, pad: ctx.pad })
|
|
459
|
+
if (named.toLowerCase() !== String(me).toLowerCase()) {
|
|
460
|
+
fail(named === zeroAddress
|
|
461
|
+
? 'no wallet is named to create a token on this vault now (each named wallet creates one token, and the create uses it up): ask gang to name yours'
|
|
462
|
+
: HINTS.NotVaultCreator, { vault, wallet: me, ...(named !== zeroAddress && { namedWallet: named }) })
|
|
463
|
+
}
|
|
464
|
+
} else if (ctx.gen === VAULT_GEN) {
|
|
465
|
+
fail(VAULT_PAD_ONLY, { pad: ctx.pad })
|
|
466
|
+
}
|
|
408
467
|
// everything to holders needs no recipient; otherwise the recipient gets the rest: --recipient (a whitelisted
|
|
409
468
|
// partner, or yourself), else the creator itself
|
|
410
469
|
const recipient = !taxed || (dividend === 100 && !flag('recipient')) ? zeroAddress
|
|
@@ -437,8 +496,10 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
|
|
|
437
496
|
} catch (e) {
|
|
438
497
|
return fail('cannot price the graduation target in this quote', revertOf(e) || { detail: e.shortMessage || e.message })
|
|
439
498
|
}
|
|
440
|
-
|
|
441
|
-
const
|
|
499
|
+
// createWithVault always takes the target (the pad's default when --grad is left out)
|
|
500
|
+
const fn = vault ? 'createWithVault' : grad !== null ? 'createWithGradTarget' : 'create'
|
|
501
|
+
const argsOf = (logoURI, metaURI) => [name, symbol, logoURI, metaURI, quote, refPool, tax,
|
|
502
|
+
...(vault ? [parseUnits(String(targetBnb), 18), vault] : grad !== null ? [parseUnits(String(grad), 18)] : [])]
|
|
442
503
|
const createData = (logoURI, metaURI) => encodeFunctionData({ abi: PAD_ABI, functionName: fn, args: argsOf(logoURI, metaURI) })
|
|
443
504
|
// the logo / metadata strings never decide a revert: dry-run without them, so a create that would fail uploads nothing
|
|
444
505
|
const dry = await simulate(ctx, me, ctx.pad, PAD_ABI, fn, argsOf('', ''))
|
|
@@ -466,6 +527,10 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
|
|
|
466
527
|
+ (dividend > 0 ? '; if no holder has 10,000+ tokens when a tax is paid, the holders\' part goes to the recipient too' : '')
|
|
467
528
|
: 'untaxed: no tax in the PancakeSwap pool after graduation, no dividend, no recipient',
|
|
468
529
|
...(creatorFee && { creatorFee }),
|
|
530
|
+
...(vault && {
|
|
531
|
+
padGen: ctx.gen, pad: ctx.pad, vault,
|
|
532
|
+
vaultNote: 'the token is bound to this vault for good. Until graduation the token moves only through the pad: the vault locks a holder\'s tokens (counted in that holder\'s 1% cap) and releases them through the pad, for the holder that sends the tx and holds an Agent ID; after graduation it is a plain token. This create uses up the wallet\'s naming for the vault: one token per naming',
|
|
533
|
+
}),
|
|
469
534
|
note: `${taxed ? 'tax rates and recipient are' : 'untaxed is'} fixed at create. Curve trades pay only the ${fees.curveFeePct}% fee, no tax${taxed ? ': the tax starts in the pool after graduation' : ''}. tokenIfNext changes if another create lands first: the real address is the Created event from \`gang tx --hash …\`.`,
|
|
470
535
|
}, 'create'))
|
|
471
536
|
}
|