@gangfun/cli 0.18.1 → 0.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/README.zh-CN.md +5 -5
- package/package.json +1 -1
- package/src/discover.js +5 -4
- package/src/fly.js +81 -22
- package/src/index.js +24 -24
- package/src/mcp.js +7 -7
- package/src/portfolio.js +3 -3
- package/src/steps.js +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Operate [gang.fun](https://gang.fun) from a Binance **Agentic Wallet**. Curve bu
|
|
|
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 (pad `0x631e66560F4FAE4e486B65349edE48189E48B029`, built in); `--testnet` uses BSC testnet set 2. Rules: `skill/references/fly.md`.
|
|
10
10
|
|
|
11
11
|
**V3 tax tokens and 打新 (0.9.0+):** on GangLaunchpad, live on BSC mainnet since 2026-10-27 (pad `0x15CFD2dc8278Fb87a1783ef42111618E20874365`, GangRouter `0xE040445690Aa56C8b68B7f7038C7b2562B5079C4`, both built in); `--testnet` uses BSC testnet set 10.
|
|
12
12
|
|
|
@@ -67,7 +67,7 @@ gang sell --token <addr> (--amount <tokens> | --all) [--slippage 1] [--to-bnb] [
|
|
|
67
67
|
gang mint --token <addr> --shares <n> [--note …] # 打新 before it fills: + the sale's mint fee (1–3%, the platform's)
|
|
68
68
|
gang withdraw --token <addr> (--shares <n> | --all) [--note …] # 打新: sell back at the mint price before it fills
|
|
69
69
|
gang claim --token <addr> # V3: my dividend (in the quote token); 打新: the holder reward
|
|
70
|
-
gang release --token <addr> # V3: push a tax payment that failed earlier;
|
|
70
|
+
gang release --token <addr> # V3: push a tax payment that failed earlier; 铸币飞轮: an owed dev cut / tax share
|
|
71
71
|
gang follow <note tx> --amount <n> [--slippage 1] [--note …] # buy the token a note is about, as a follow of it
|
|
72
72
|
gang upload-logo (--file ./avatar.png | --url <image URL>) # → ipfs://<cid> (view at https://cdn.gang.fun/ipfs/<cid>)
|
|
73
73
|
# create: GangLaunchpad. A V3 token (own buy / sell tax 1–5%, pool only, paid to the creator itself or a whitelisted
|
|
@@ -75,7 +75,7 @@ gang upload-logo (--file ./avatar.png | --url <image URL>) # → ipfs://<cid>
|
|
|
75
75
|
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
76
|
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
77
|
# --cap 0.25–1% of supply per wallet (1% → at least 50 wallets), --hold 60–90% (the hold line)
|
|
78
|
-
#
|
|
78
|
+
# 铸币飞轮 (Mint Flywheel, GangFlywheelPad; mainnet, --testnet = set 2). --preset j (default: the J template) or
|
|
79
79
|
# steady; every setting can be overridden: --raise 3-50 --quota 5-100 --invite-bonus 0-3 --max-per-tx 1-10 --hold 60-90
|
|
80
80
|
# --mint-fee 1-3 --exit-fee 1-2 --dev-cut 0-10 --buy-pct 0-50 --sell-tax 1-2 --launch-delay 0-300 --window 300-1800
|
|
81
81
|
# --cap-mul 1-2 --post-mint|--no-post-mint --tier flat|standard|linear [--step-pct --step-shares --max-mul] --supply-cap 10-500
|
|
@@ -274,10 +274,10 @@ timed-out `gang_execute`, check `gang_status` / the wallet history instead of ex
|
|
|
274
274
|
| `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 |
|
|
275
275
|
| `GANG_PAD` / `GANG_TESTNET_PAD` | Override the merged GangLaunchpad (mainnet / testnet) behind V3 and 打新 (defaults: mainnet `0x15CF…4365`, testnet set 10 `0xFebF…5BB1`). Old names `GANG_V3_PAD` / `GANG_FAIR_PAD`, `GANG_V3_TESTNET_PAD` / `GANG_FAIR_TESTNET_PAD` still work as aliases |
|
|
276
276
|
| `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 |
|
|
277
|
-
| `GANG_FLY_PAD` / `GANG_TESTNET_FLY_PAD` | GangFlywheelPad (
|
|
277
|
+
| `GANG_FLY_PAD` / `GANG_TESTNET_FLY_PAD` | GangFlywheelPad (铸币飞轮). Defaults: mainnet `0x631e…B029` (open since 2026-10-30), testnet set 2 `0xD648…951c` |
|
|
278
278
|
| `GANG_BOND` / `GANG_TESTNET_BOND` | GangBond (creator bonds, `gang bond`). Defaults: mainnet `0xe92d…14E4` (since 2026-10-29, CLI 0.16.2+), testnet `0xd6a8…1086` |
|
|
279
279
|
| `GANG_ROUTER` / `GANG_TESTNET_ROUTER` | GangRouter proxy (native-BNB V3 buys / mints, and every PancakeSwap trade of a graduated token); old name `GANG_ROUTER_TESTNET` still works. Defaults: mainnet `0xE040…79C4`, testnet set 10 `0x6bB6…C9F6` |
|
|
280
280
|
|
|
281
281
|
## Version
|
|
282
282
|
|
|
283
|
-
`0.18.
|
|
283
|
+
`0.18.3` · repo [gangfun/cli](https://github.com/gangfun/cli) · published to [npm](https://www.npmjs.com/package/@gangfun/cli) on push to `main`
|
package/README.zh-CN.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
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 主网运行(发射台 `0x631e66560F4FAE4e486B65349edE48189E48B029`,已内置);`--testnet` 走 BSC 测试网第 2 套。规则见 `skill/references/fly.md`。
|
|
10
10
|
|
|
11
11
|
**V3 税收币和打新(0.9.0+):** 走 GangLaunchpad,2026-10-27 起在 BSC 主网运行(内盘 `0x15CFD2dc8278Fb87a1783ef42111618E20874365`,GangRouter `0xE040445690Aa56C8b68B7f7038C7b2562B5079C4`,都已内置);`--testnet` 走 BSC 测试网第 10 套。
|
|
12
12
|
|
|
@@ -57,7 +57,7 @@ gang sell --token <addr> (--amount <枚数> | --all) [--slippage 1] [--to-bnb] [
|
|
|
57
57
|
gang mint --token <addr> --shares <n> [--note …] # 打新填满前:另收该币的打新费(1–3%,归平台、不退)
|
|
58
58
|
gang withdraw --token <addr> (--shares <n> | --all) [--note …] # 打新填满前按打新价卖回
|
|
59
59
|
gang claim --token <addr> # V3:领取分红(以报价币到账);打新:领持有奖励
|
|
60
|
-
gang release --token <addr> # V3
|
|
60
|
+
gang release --token <addr> # V3:补转之前打款失败的税;铸币飞轮:补转欠创建者的 dev 分成 / 税
|
|
61
61
|
gang follow <附言 tx> --amount <n> [--slippage 1] [--note …] # 跟单:买附言里的币,并标明跟的是哪条
|
|
62
62
|
gang upload-logo (--file ./avatar.png | --url <图片地址>)
|
|
63
63
|
# 建币:GangLaunchpad。默认是 V3 币(买 / 卖税各 1–5%,只在外盘收,用报价币打给接收地址:发币人自己,或白名单里的
|
|
@@ -86,7 +86,7 @@ gang buyback status|set|set-payee|apply --token 0x… [--pct 0-100] [--to 0x…]
|
|
|
86
86
|
gang create --fair … [--shares <n>] --bond <数量> [--bond-hold …] --bond-days <7-90> # 打新:发币(含 dev 份额)→ 押金
|
|
87
87
|
gang execute --request-id <id>
|
|
88
88
|
gang tx --pending # 在 Binance App 里批准过的交易:按预览时的调用自动找到交易,再按下面这条处理
|
|
89
|
-
#
|
|
89
|
+
# 铸币飞轮(GangFlywheelPad;主网,--testnet 走测试网第 2 套)。--preset j(默认,J 模板)或 steady,每一项都能单独改:
|
|
90
90
|
# --raise 3-50 --quota 5-100 --invite-bonus 0-3 --max-per-tx 1-10 --hold 60-90 --mint-fee 1-3 --exit-fee 1-2 --dev-cut 0-10
|
|
91
91
|
# --buy-pct 0-50 --sell-tax 1-2 --launch-delay 0-300 --window 300-1800 --cap-mul 1-2 --post-mint|--no-post-mint
|
|
92
92
|
# --tier flat|standard|linear [--step-pct --step-shares --max-mul] --supply-cap 10-500
|
|
@@ -238,10 +238,10 @@ Claude Code:`claude mcp add gang -- gang mcp`。同一台机器上 `baw` 要
|
|
|
238
238
|
| `GANG_UPDATE_URL` | 新版本检查查询的地址,默认 `https://registry.npmjs.org/@gangfun/cli/latest`;npmjs 慢或打不开时,可以换成 npm 镜像的 `…/@gangfun/cli/latest` |
|
|
239
239
|
| `GANG_PAD` / `GANG_TESTNET_PAD` | 覆盖合并后的内盘合约 GangLaunchpad(主网 / 测试网),V3 和打新共用(默认:主网 `0x15CF…4365`,测试网第 10 套 `0xFebF…5BB1`)。旧名 `GANG_V3_PAD` / `GANG_FAIR_PAD`、`GANG_V3_TESTNET_PAD` / `GANG_FAIR_TESTNET_PAD` 仍可用(别名) |
|
|
240
240
|
| `GANG_TESTNET_RPC_URL` | 测试网 RPC,可填一个或逗号分隔的多个(不设时先用 PublicNode,再用 BNB Chain 的测试网节点);旧名 `GANG_V3_TESTNET_RPC_URL` / `GANG_FAIR_TESTNET_RPC_URL` 仍可用 |
|
|
241
|
-
| `GANG_FLY_PAD` / `GANG_TESTNET_FLY_PAD` | GangFlywheelPad
|
|
241
|
+
| `GANG_FLY_PAD` / `GANG_TESTNET_FLY_PAD` | GangFlywheelPad(铸币飞轮)。默认:主网 `0x631e…B029`(2026-10-30 起开放),测试网第 2 套 `0xD648…951c` |
|
|
242
242
|
| `GANG_BOND` / `GANG_TESTNET_BOND` | GangBond(押金承诺,`gang bond`)。默认:主网 `0xe92d…14E4`(2026-10-29 起,CLI 0.16.2+),测试网 `0xd6a8…1086` |
|
|
243
243
|
| `GANG_ROUTER` / `GANG_TESTNET_ROUTER` | GangRouter 代理(用原生 BNB 买 V3 / 打新,以及已毕业币的所有外盘买卖);旧名 `GANG_ROUTER_TESTNET` 仍可用。默认:主网 `0xE040…79C4`,测试网第 10 套 `0x6bB6…C9F6` |
|
|
244
244
|
|
|
245
245
|
## 版本
|
|
246
246
|
|
|
247
|
-
`0.18.
|
|
247
|
+
`0.18.3` · [gangfun/cli](https://github.com/gangfun/cli) · push 到 `main` 自动发布到 [npm](https://www.npmjs.com/package/@gangfun/cli)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gangfun/cli",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
4
4
|
"description": "Gang launchpad CLI for Binance Agentic Wallet agents: create on GangLaunchpad (untaxed or tax tokens), 打新 fair mint, PancakeSwap pool trades, LaunchpadV2 and legacy Soft/U/S trade.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/discover.js
CHANGED
|
@@ -66,12 +66,12 @@ const TRADES = { v2: '/stocks/tokens', soft: '/tokens', v3: '/v3/tokens', fair:
|
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* GangLaunchpad rows: `v3` = V3 curves (/v3/tokens), `fair` = 打新 sales (/fair/sales; `graduated` = launched); GangFlywheelPad
|
|
69
|
-
* rows: `fly` =
|
|
69
|
+
* rows: `fly` = 铸币飞轮 sales (/fly/tokens, shaped like the 打新 rows; launched ones may still mint).
|
|
70
70
|
* List rows carry raw wei and no USD; details (/…/<addr>) carry human amounts and USD like the V2 rows.
|
|
71
71
|
* `quoteUsdOf(quoteAddress)` prices a list row's quote (from the V2 / Soft rows), null when unknown.
|
|
72
72
|
*/
|
|
73
73
|
function gangRow(r, quoteUsdOf) {
|
|
74
|
-
// a
|
|
74
|
+
// a 铸币飞轮 row reads like a 打新 one (sharePrice = basePrice, raiseQuote, sold of 10,000)
|
|
75
75
|
const fair = r.track === 'fair' || r.track === 'fly'
|
|
76
76
|
const dec = r.quoteDecimals ?? 18
|
|
77
77
|
const w = (v) => num(v) / 10 ** dec
|
|
@@ -156,7 +156,7 @@ export async function fetchMarket(track = 'all', stop) {
|
|
|
156
156
|
const [v3, fair, fly, v2, soft] = await Promise.all([
|
|
157
157
|
want('v3') ? pages('/v3/tokens?status=all', stop) : none,
|
|
158
158
|
want('fair') ? pages('/fair/sales?status=all', stop) : none,
|
|
159
|
-
//
|
|
159
|
+
// 铸币飞轮 (2026-10-30): a server without the route yet lists none, unless --track fly asked for it alone
|
|
160
160
|
want('fly') ? pages('/fly/tokens?status=all', stop).catch((e) => (track === 'fly' ? Promise.reject(e) : none)) : none,
|
|
161
161
|
want('v2') ? pages('/stocks/tokens', stop) : priced ? prices('/stocks/tokens') : none,
|
|
162
162
|
want('soft') ? pages('/tokens?sort=new', stop) : priced ? prices('/tokens?sort=new') : none,
|
|
@@ -179,10 +179,11 @@ export async function fetchMarket(track = 'all', stop) {
|
|
|
179
179
|
/** The command that acts on a token next: quote / preview a buy (no tx is sent before `gang execute`). */
|
|
180
180
|
const hint = (t) => {
|
|
181
181
|
const amount = `--amount <amount in ${t.quote}>`
|
|
182
|
-
//
|
|
182
|
+
// 铸币飞轮: minting before launch, and after it while the server's postMint flag is on (gang mint picks the post-launch
|
|
183
183
|
// mint); a filled sale waits for its launch, a refund-only one only sells back
|
|
184
184
|
if (t.track === 'fly' && t.status === 'filled') return `gang info --token ${t.address}`
|
|
185
185
|
if (t.track === 'fly' && t.status === 'refund') return `gang withdraw --token ${t.address} --all`
|
|
186
|
+
// (list rows do not say whether post-launch minting is paused: gang mint checks that on chain and says so)
|
|
186
187
|
if (t.track === 'fly' && (!t.graduated || t.postMint)) return `gang mint --token ${t.address} --shares <n>`
|
|
187
188
|
if (t.graduated) return `gang buy --token ${t.address} ${amount}` // the PancakeSwap pool, through GangRouter
|
|
188
189
|
if (t.track === 'fair') return `gang mint --token ${t.address} --shares <n>`
|
package/src/fly.js
CHANGED
|
@@ -6,7 +6,7 @@ import { MERGED_ERRORS_ABI, MERGED_HINTS, padNets, rpcTransport } from './gangpa
|
|
|
6
6
|
import { poolPayBnb, poolTrade } from './pool.js'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* `gang fly …` —
|
|
9
|
+
* `gang fly …` — 铸币飞轮 (Mint Flywheel, track `fly`): GangFlywheelPad, its own pad (kind 3) beside GangLaunchpad.
|
|
10
10
|
* Before launch: 10,000 shares at one price (sale.basePrice), a quota per wallet (baseQuota + invite bonus), sell-back
|
|
11
11
|
* at the mint price less an exit fee. The sale fills (or the creator opens it early at ≥ 30%), then anyone launches it
|
|
12
12
|
* `launchDelay` later: a PancakeSwap pool at the mint price, with a protection window (Agent ID + a per-wallet buy cap).
|
|
@@ -82,6 +82,8 @@ export const FLY_HANDLER_ABI = parseAbi([
|
|
|
82
82
|
'function eligibleShare(address token, address user) view returns (uint256)',
|
|
83
83
|
'function owedOf(address token) view returns (uint256)',
|
|
84
84
|
'function release(address token) returns (uint256 amount)',
|
|
85
|
+
'function blockRefOf(address token) view returns (uint32 blockNumber, uint224 price)',
|
|
86
|
+
'function prevBlockStartOf(address token) view returns (uint256)',
|
|
85
87
|
'error ProtectionNotAgent()', 'error ProtectionCapExceeded()', 'error PriceBelowReference()', 'error NothingOwed()',
|
|
86
88
|
'error SellDuringFlashSwap()', 'error OutOfGas()',
|
|
87
89
|
'event Launched(address indexed token, uint256 protectedUntil, address gate, uint256 cap, uint256 launchPrice)',
|
|
@@ -112,7 +114,7 @@ const PAIR_ABI = parseAbi(['function getReserves() view returns (uint112, uint11
|
|
|
112
114
|
const DEX_ABI = parseAbi(['function getAmountsOut(uint256 amountIn, address[] path) view returns (uint256[] amounts)'])
|
|
113
115
|
const GANG_ROUTER_VIEW = parseAbi(['function pancakeRouter() view returns (address)'])
|
|
114
116
|
|
|
115
|
-
/** What `gang tx` decodes a
|
|
117
|
+
/** What `gang tx` decodes a 铸币飞轮 tx's logs with (the pad, the tax handler, the holder-reward vault). */
|
|
116
118
|
export const FLY_EVENT_ABIS = [FLY_PAD_ABI, FLY_HANDLER_ABI, VAULT_ABI]
|
|
117
119
|
|
|
118
120
|
// platform constants (FlywheelLogic): the pad's own numbers, fixed in the contract
|
|
@@ -133,7 +135,7 @@ const GAS_NOTE = 'gas limit set with room: a hot token\'s first trade in a block
|
|
|
133
135
|
|
|
134
136
|
const HINTS = {
|
|
135
137
|
BadConfig: 'a setting is out of bounds: see reason',
|
|
136
|
-
NotAgent: 'this wallet holds no Agent ID;
|
|
138
|
+
NotAgent: 'this wallet holds no Agent ID; 铸币飞轮 is Agent-only',
|
|
137
139
|
NotMinting: 'the sale no longer takes pre-launch mints / sell-backs (filled, opened early or launched): gang info shows its state',
|
|
138
140
|
NotLaunched: 'the token has not launched yet',
|
|
139
141
|
NotFilled: 'the sale has not filled (or been opened early) yet: nothing to launch',
|
|
@@ -145,7 +147,7 @@ const HINTS = {
|
|
|
145
147
|
PriceAbovePool: 'the mint price is more than 10% above the pool price right now (the pool just dropped): try again shortly',
|
|
146
148
|
PaceExceeded: 'this wallet minted too much too fast: recent post-launch mints (decaying over 30 minutes) plus this one may be at most 2% of the pool\'s quote side; mint fewer shares or wait',
|
|
147
149
|
PostMintOff: 'this sale has no post-launch minting: trade the token in the pool (gang buy / gang sell)',
|
|
148
|
-
MigratorNotSet: 'the
|
|
150
|
+
MigratorNotSet: 'the 铸币飞轮 pad is not open on this network yet',
|
|
149
151
|
BnbShort: 'the BNB sent does not cover the mint (the tier price moved up): re-run to re-quote',
|
|
150
152
|
BnbNotQuote: 'this sale is not WBNB-quoted: pay in its quote (leave out BNB payment)',
|
|
151
153
|
TooFewShares: 'fewer than 3,000 shares are still held 7 days after the fill: the sale can no longer launch, only refund (gang withdraw)',
|
|
@@ -174,7 +176,7 @@ export function flyCtx(testnet) {
|
|
|
174
176
|
}
|
|
175
177
|
}
|
|
176
178
|
|
|
177
|
-
/** true when `token` is a
|
|
179
|
+
/** true when `token` is a 铸币飞轮 token on this pad; null on an RPC error. */
|
|
178
180
|
export async function isFlyToken(ctx, token) {
|
|
179
181
|
try {
|
|
180
182
|
return Number(await ctx.read(ctx.pad, FLY_PAD_ABI, 'kindOf', [token])) === 3
|
|
@@ -187,7 +189,7 @@ export async function isFlyToken(ctx, token) {
|
|
|
187
189
|
export async function padOpen(ctx) {
|
|
188
190
|
return (await ctx.read(ctx.pad, FLY_PAD_ABI, 'migrator')) !== zeroAddress
|
|
189
191
|
}
|
|
190
|
-
const CLOSED = 'the
|
|
192
|
+
const CLOSED = 'the 铸币飞轮 (Mint Flywheel) pad on BSC mainnet takes no creates right now (no migrator set): use --testnet to try it there'
|
|
191
193
|
|
|
192
194
|
const symbolOf = async (ctx, token) => { try { return await ctx.read(token, TOKEN_ABI, 'symbol') } catch { return null } }
|
|
193
195
|
const pct = (bps) => Number(bps) / 100
|
|
@@ -275,10 +277,50 @@ async function poolSide(ctx, token, sale, handler) {
|
|
|
275
277
|
},
|
|
276
278
|
tax: { buyPct: BUY_TAX_PCT, sellPct: pct(sellTaxBps), split: 'the first 1%: holders 50% / platform 25% / creator 25%; sell tax above 1%: holders' },
|
|
277
279
|
supply: { total: formatUnits(supply, 18), max: formatUnits(maxSupply, 18), mintRoom: formatUnits(room, 18) },
|
|
278
|
-
raw: { spot, until: Number(until), gate, cap, sellTaxBps: Number(sellTaxBps), room },
|
|
280
|
+
raw: { spot, blockStart, high, average, until: Number(until), gate, cap, sellTaxBps: Number(sellTaxBps), room },
|
|
279
281
|
}
|
|
280
282
|
}
|
|
281
283
|
|
|
284
|
+
// FlywheelPostLogic: a post-launch mint is refused while the pool is more than 10% below its 30-minute average or its
|
|
285
|
+
// recent high, or when its buyer price is more than 10% above the pool; FlywheelOracle: the previous block start counts
|
|
286
|
+
// for 20 blocks
|
|
287
|
+
const MAX_DROP_BPS = 1_000n, HIGH_GAP_BPS = 1_000n, TWAP_FLOOR_BPS = 100n, PREV_START_BLOCKS = 20n
|
|
288
|
+
const PAUSE_WHY = {
|
|
289
|
+
below_average: 'the pool price is more than 10% below its 30-minute average',
|
|
290
|
+
below_recent_high: 'the pool price is more than 10% below its recent high',
|
|
291
|
+
above_pool: 'a mint would be priced more than 10% above the pool (it dropped in the last blocks)',
|
|
292
|
+
supply_cap: 'the token\'s supply cap leaves no room for a mint',
|
|
293
|
+
}
|
|
294
|
+
const RESUMES = 'minting resumes once the pool price is back within 10% of both its 30-minute average and its recent high (the high decays 0.5% a minute; the average follows the price over 30 minutes)'
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Whether post-launch mints are refused now, by the rules mintPost checks (the wallet's own pace aside): the reads of
|
|
298
|
+
* poolSide plus the handler's previous block start, as of the latest block. → { pausedNow, reason, reasons } where reason
|
|
299
|
+
* is the first rule mintPost would hit.
|
|
300
|
+
*/
|
|
301
|
+
async function mintPause(ctx, token, sale, handler, side) {
|
|
302
|
+
const { spot, blockStart, high, average, room } = side.raw
|
|
303
|
+
const BPS = 10_000n
|
|
304
|
+
const reasons = []
|
|
305
|
+
if (spot * BPS < average * (BPS - MAX_DROP_BPS)) reasons.push('below_average')
|
|
306
|
+
if (spot * BPS < high * (BPS - HIGH_GAP_BPS)) reasons.push('below_recent_high')
|
|
307
|
+
const [bn, [b, bp], packed, one] = await Promise.all([
|
|
308
|
+
ctx.client.getBlockNumber(), ctx.read(handler, FLY_HANDLER_ABI, 'blockRefOf', [token]),
|
|
309
|
+
ctx.read(handler, FLY_HANDLER_ABI, 'prevBlockStartOf', [token]), ctx.read(ctx.pad, FLY_PAD_ABI, 'sharePrice', [token, 1n]),
|
|
310
|
+
])
|
|
311
|
+
const [pb, pp] = BigInt(b) === bn ? [packed >> 224n, packed & ((1n << 224n) - 1n)] : [BigInt(b), bp]
|
|
312
|
+
const prev = bn - pb > PREV_START_BLOCKS ? 0n : pp
|
|
313
|
+
let ref = high > average ? high : average
|
|
314
|
+
if (prev > ref) ref = prev
|
|
315
|
+
const floor = (ref * (BPS - TWAP_FLOOR_BPS)) / BPS
|
|
316
|
+
let price = spot > blockStart ? spot : blockStart
|
|
317
|
+
if (floor > price) price = floor
|
|
318
|
+
if (price * BPS > spot * (BPS + HIGH_GAP_BPS)) reasons.push('above_pool')
|
|
319
|
+
// one share: the buyer's tokens and the liquidity's (at most its price of quote at spot) must fit under the cap
|
|
320
|
+
if (spot > 0n && price > 0n && (one * Q112) / price + (one * Q112) / spot > room) reasons.push('supply_cap')
|
|
321
|
+
return { pausedNow: reasons.length > 0, ...(reasons.length && { reason: reasons[0], reasons, why: PAUSE_WHY[reasons[0]] }) }
|
|
322
|
+
}
|
|
323
|
+
|
|
282
324
|
async function poolReserves(ctx, token, pair) {
|
|
283
325
|
if (!pair) return [0n, 0n]
|
|
284
326
|
const [[r0, r1], t0] = await Promise.all([ctx.read(pair, PAIR_ABI, 'getReserves'), ctx.read(pair, PAIR_ABI, 'token0')])
|
|
@@ -375,16 +417,16 @@ export async function runFly(sub, { opt, flag, out, fail, summarize, resolveLogo
|
|
|
375
417
|
const ctx = flyCtx(testnet)
|
|
376
418
|
const chainId = Number(ctx.chainId)
|
|
377
419
|
const write = (tx, extra) => step(ctx, tx, { chainId, ...extra }, rawOnly, summarize)
|
|
378
|
-
if (flag('note')) fail('--note is not matched to
|
|
420
|
+
if (flag('note')) fail('--note is not matched to 铸币飞轮 trades yet: leave it out')
|
|
379
421
|
|
|
380
422
|
const tokenArg = () => {
|
|
381
423
|
const t = opt('token')
|
|
382
|
-
if (!isAddress(t ?? '')) fail('--token must be the
|
|
424
|
+
if (!isAddress(t ?? '')) fail('--token must be the 铸币飞轮 token\'s address (0x…)', { got: t ?? null })
|
|
383
425
|
return t
|
|
384
426
|
}
|
|
385
427
|
const loadSale = async (token) => {
|
|
386
428
|
const sale = await saleOf(ctx, token)
|
|
387
|
-
if (!sale) fail(`not a
|
|
429
|
+
if (!sale) fail(`not a 铸币飞轮 (Mint Flywheel) token on this pad${testnet ? ' (BSC testnet)' : ''}`, { token, chainId, pad: ctx.pad })
|
|
388
430
|
return sale
|
|
389
431
|
}
|
|
390
432
|
const handlerOf = () => ctx.read(ctx.pad, FLY_PAD_ABI, 'taxHandler')
|
|
@@ -426,8 +468,11 @@ export async function runFly(sub, { opt, flag, out, fail, summarize, resolveLogo
|
|
|
426
468
|
const { raw: _r, ...view } = side
|
|
427
469
|
Object.assign(extra, view)
|
|
428
470
|
if (sale.rules.postMint) {
|
|
429
|
-
const one = await ctx.read(ctx.pad, FLY_PAD_ABI, 'sharePrice', [token, 1n])
|
|
430
|
-
extra.postMint = {
|
|
471
|
+
const [one, pause] = await Promise.all([ctx.read(ctx.pad, FLY_PAD_ABI, 'sharePrice', [token, 1n]), mintPause(ctx, token, sale, handler, side)])
|
|
472
|
+
extra.postMint = {
|
|
473
|
+
sharePriceNow: await units(ctx, sale.quote, one), tierMulNow: Number((one * 100n) / sale.sharePriceRaw) / 100, ...pause,
|
|
474
|
+
...(pause.pausedNow && { resumes: pause.reason === 'supply_cap' ? 'post-launch minting is over: the supply cap is reached' : RESUMES }),
|
|
475
|
+
}
|
|
431
476
|
}
|
|
432
477
|
const [owedTax, swapBack] = await Promise.all([
|
|
433
478
|
ctx.read(handler, FLY_HANDLER_ABI, 'owedOf', [token]),
|
|
@@ -438,7 +483,7 @@ export async function runFly(sub, { opt, flag, out, fail, summarize, resolveLogo
|
|
|
438
483
|
}
|
|
439
484
|
if (owed > 0n) extra.owedDevCut = await units(ctx, sale.quote, owed)
|
|
440
485
|
if (extra.owedDevCut || extra.owedCreatorTax) extra.release = `gang release --token ${token}${net} (anyone; pays the creator)`
|
|
441
|
-
return out({ success: true, chainId, kind: 'fly', ...pub(sale), ...extra, next: nextFor(sale, token, net) })
|
|
486
|
+
return out({ success: true, chainId, kind: 'fly', ...pub(sale), ...extra, next: nextFor(sale, token, net, undefined, extra.postMint) })
|
|
442
487
|
}
|
|
443
488
|
|
|
444
489
|
if (sub === 'status') {
|
|
@@ -490,12 +535,18 @@ export async function runFly(sub, { opt, flag, out, fail, summarize, resolveLogo
|
|
|
490
535
|
} else {
|
|
491
536
|
Object.assign(pos, { reward: 'none', pendingReward: reward.claimable, note: 'did not mint in this sale: the holder reward is only for minters' })
|
|
492
537
|
}
|
|
493
|
-
if (sale.rules.postMint
|
|
494
|
-
const
|
|
495
|
-
pos.
|
|
538
|
+
if (sale.rules.postMint) {
|
|
539
|
+
const pause = await mintPause(ctx, token, sale, handler, side)
|
|
540
|
+
pos.mintPaused = { ...pause, ...(pause.pausedNow && { resumes: pause.reason === 'supply_cap' ? 'post-launch minting is over: the supply cap is reached' : RESUMES }) }
|
|
541
|
+
if (acct.view.quotaLeft > 0) {
|
|
542
|
+
const [acc, paid, fee, tokensOut, ok] = await ctx.read(ctx.pad, FLY_PAD_ABI, 'previewMintPost', [token, who, 1n])
|
|
543
|
+
pos.mintOneShareNow = acc ? { paid: await units(ctx, sale.quote, paid), fee: await units(ctx, sale.quote, fee), tokensOut: formatUnits(tokensOut, 18), ok } : null
|
|
544
|
+
// the sale's rules allow a mint, the wallet's own 30-minute pace does not
|
|
545
|
+
if (acc && !ok && !pause.pausedNow) pos.mintPaused = { pausedNow: true, reason: 'pace', why: 'this wallet\'s recent post-launch mints reach its 30-minute pace (2% of the pool\'s quote side)', resumes: 'the pace decays over 30 minutes' }
|
|
546
|
+
}
|
|
496
547
|
}
|
|
497
548
|
}
|
|
498
|
-
return out({ success: true, chainId, kind: 'fly', wallet: who, sale: pub(sale), position: pos, next: nextFor(sale, token, net, acct.view) })
|
|
549
|
+
return out({ success: true, chainId, kind: 'fly', wallet: who, sale: pub(sale), position: pos, next: nextFor(sale, token, net, acct.view, pos.mintPaused) })
|
|
499
550
|
}
|
|
500
551
|
|
|
501
552
|
if (sub === 'invite') {
|
|
@@ -517,6 +568,12 @@ export async function runFly(sub, { opt, flag, out, fail, summarize, resolveLogo
|
|
|
517
568
|
inviteBonusPerInvite: sale.rules.inviteBonus, invited: acct.view.invited, bonusShares: acct.view.inviteBonusShares,
|
|
518
569
|
quota: acct.view.quota, quotaLeft: acct.view.quotaLeft,
|
|
519
570
|
...(board?.invitees && { invitees: board.invitees }),
|
|
571
|
+
// gang.fun's board counts an invite only while it holds up (so sell-backs can't farm it); the bonus above is the
|
|
572
|
+
// pad's and stays either way. Older servers have no such counts: the output is as before
|
|
573
|
+
...(Number.isFinite(board?.validInvites) && {
|
|
574
|
+
validInvites: board.validInvites, totalInvites: board.totalInvites ?? acct.view.invited,
|
|
575
|
+
validNote: 'gang.fun counts an invite as valid while the invitee still holds pre-launch shares (before the fill), once the sale has filled or launched, or when the invitee first minted after launch; none counts in a refund-only sale. The quota bonus is on chain and stays either way',
|
|
576
|
+
}),
|
|
520
577
|
...(!board && { inviteesNote: `the list of invitees comes from ${API} (/fly/tokens/<token>/invites) once it indexes this pad; the count here is read on chain` }),
|
|
521
578
|
note: 'an invite counts on the invitee\'s first mint in this token (before or after launch), when it passes --ref (gang mint --ref <inviter>) or opens the link; the inviter must have minted here and hold an Agent ID',
|
|
522
579
|
})
|
|
@@ -526,7 +583,7 @@ export async function runFly(sub, { opt, flag, out, fail, summarize, resolveLogo
|
|
|
526
583
|
const name = opt('name'), symbol = opt('symbol')
|
|
527
584
|
if (!name || !symbol) fail('--name and --symbol are required')
|
|
528
585
|
checkMeta()
|
|
529
|
-
if (!(await padOpen(ctx))) fail(testnet ? 'the
|
|
586
|
+
if (!(await padOpen(ctx))) fail(testnet ? 'the 铸币飞轮 pad on BSC testnet has no migrator set: it takes no creates right now' : CLOSED, { pad: ctx.pad })
|
|
530
587
|
const presetName = opt('preset', 'j')
|
|
531
588
|
const preset = FLY_PRESETS[presetName]
|
|
532
589
|
if (!preset) fail(`--preset must be ${Object.keys(FLY_PRESETS).join(' or ')}`, { got: presetName })
|
|
@@ -604,7 +661,7 @@ export async function runFly(sub, { opt, flag, out, fail, summarize, resolveLogo
|
|
|
604
661
|
const sale = await loadSale(token)
|
|
605
662
|
const who = me()
|
|
606
663
|
const acct = await accountOf(ctx, token, sale, who)
|
|
607
|
-
if (sale.gate && !(await hasAgent(ctx, sale.gate, who))) fail('this wallet holds no Agent ID;
|
|
664
|
+
if (sale.gate && !(await hasAgent(ctx, sale.gate, who))) fail('this wallet holds no Agent ID; 铸币飞轮 minting is Agent-only', { wallet: who })
|
|
608
665
|
const referrer = await checkReferrer(ctx, token, sale, who, acct.raw, opt('ref'), fail)
|
|
609
666
|
const quota = { quota: acct.view.quota, quotaLeft: acct.view.quotaLeft, maxPerTx: sale.rules.maxPerTx }
|
|
610
667
|
if (!acct.view.quotaLeft) fail('this wallet\'s quota in this sale is used up', { ...quota, hint: `invites add ${sale.rules.inviteBonus} share(s) each: gang fly invite --token ${token}${net}` })
|
|
@@ -776,7 +833,7 @@ export async function runFly(sub, { opt, flag, out, fail, summarize, resolveLogo
|
|
|
776
833
|
hint: sub === 'buy' ? `before launch, mint shares: gang mint --token ${token} --shares <n>${net}` : `before launch, sell shares back: gang withdraw --token ${token} (--shares <n> | --all)${net}`,
|
|
777
834
|
})
|
|
778
835
|
}
|
|
779
|
-
for (const f of ['bond', 'break-bond', 'settle-first']) if (flag(f)) fail(`--${f}:
|
|
836
|
+
for (const f of ['bond', 'break-bond', 'settle-first']) if (flag(f)) fail(`--${f}: 铸币飞轮 tokens take no GangBond`)
|
|
780
837
|
const slippage = parseNum(fail, 'slippage', opt('slippage', '1'), 0, 50)
|
|
781
838
|
if (sub === 'sell' && flag('all') === !!opt('amount')) fail('pass exactly one of --amount <tokens> or --all')
|
|
782
839
|
if (sub === 'buy' && !flag('amount')) fail('--amount <quote (or BNB) to spend> required')
|
|
@@ -922,11 +979,13 @@ const cfgView = (c) => ({
|
|
|
922
979
|
...(c.tierMode === 2 && { stepPct: pct(c.stepBps), stepShares: c.stepShares, maxMul: c.maxMulX100 / 100 }), supplyCapMul: c.supplyCapMul,
|
|
923
980
|
})
|
|
924
981
|
|
|
925
|
-
/** The command that acts on the sale next. */
|
|
926
|
-
function nextFor(sale, token, net, acct) {
|
|
982
|
+
/** The command that acts on the sale next. `paused`: mintPause (or the wallet's) after launch. */
|
|
983
|
+
function nextFor(sale, token, net, acct, paused) {
|
|
927
984
|
if (sale.status === 'minting') return `gang mint --token ${token} --shares <n>${net}${acct && !acct.minted ? ' [--ref <inviter>]' : ''}`
|
|
928
985
|
if (sale.status === 'filled') return sale.launchableNow ? `gang fly launch --token ${token}${net}` : `wait until ${sale.launchAt}, then gang fly launch --token ${token}${net}`
|
|
929
986
|
if (sale.status === 'stalled') return `gang fly launch --token ${token}${net} (or gang withdraw to sell back)`
|
|
930
987
|
if (sale.status === 'refund') return `gang withdraw --token ${token} --all${net}`
|
|
988
|
+
if (sale.rules.postMint && paused?.pausedNow) return `gang buy --token ${token} --amount <quote>${net} (post-launch minting is paused: ${paused.why})`
|
|
989
|
+
if (sale.rules.postMint && acct && !acct.quotaLeft) return `gang buy --token ${token} --amount <quote>${net} (this wallet's mint quota is used up)`
|
|
931
990
|
return sale.rules.postMint ? `gang mint --token ${token} --shares <n>${net} (or gang buy in the pool)` : `gang buy --token ${token} --amount <quote>${net}`
|
|
932
991
|
}
|
package/src/index.js
CHANGED
|
@@ -203,8 +203,8 @@ const followSkipped = (follow) =>
|
|
|
203
203
|
const HELP = `gang — agent-only launchpad on BNB Chain (Binance Agentic Wallet) · new tokens on GangLaunchpad (V3 / 打新)
|
|
204
204
|
|
|
205
205
|
One command per action, whatever pad the token is on: buy / sell / info / status / claim / mint / withdraw / release
|
|
206
|
-
read the token's kind (GangLaunchpad kindOf: V3 curve or 打新 sale; GangFlywheelPad:
|
|
207
|
-
U / S pads) and run that kind's trade. Results of V3 / 打新 /
|
|
206
|
+
read the token's kind (GangLaunchpad kindOf: V3 curve or 打新 sale; GangFlywheelPad: 铸币飞轮; otherwise the V2 / Soft /
|
|
207
|
+
U / S pads) and run that kind's trade. Results of V3 / 打新 / 铸币飞轮 tokens carry kind: "v3" | "fair" | "fly". --testnet
|
|
208
208
|
= BSC testnet (GangLaunchpad and GangFlywheelPad only); --calldata prints the raw tx instead of a baw preview; --from
|
|
209
209
|
<addr> reads / builds for that wallet (V2 / Soft: graduated tokens only).
|
|
210
210
|
|
|
@@ -217,7 +217,7 @@ U / S pads) and run that kind's trade. Results of V3 / 打新 / 持续打新 tok
|
|
|
217
217
|
V2 / Soft / U / S tokens read on chain (works without gang.fun), the newest --limit
|
|
218
218
|
per pad; --kind v3 (--status curve|graduated|all) / --kind fair
|
|
219
219
|
(--status minting|launched|all): GangLaunchpad tokens from gang.fun; --kind fly
|
|
220
|
-
(--status minting|filled|launched|all):
|
|
220
|
+
(--status minting|filled|launched|all): 铸币飞轮 tokens read from the pad, newest first
|
|
221
221
|
gang hot [--limit 10] [--track all|v3|fair|fly|v2|soft] [--include-graduated]
|
|
222
222
|
tokens not yet graduated / launched, ranked by 24h USD volume
|
|
223
223
|
gang new [--limit 10] [--max-age 2h] [--track …] newest first
|
|
@@ -265,9 +265,9 @@ U / S pads) and run that kind's trade. Results of V3 / 打新 / 持续打新 tok
|
|
|
265
265
|
sales pay native BNB through GangRouter in one tx (--use-wbnb: from WBNB)
|
|
266
266
|
gang withdraw --token <addr> (--shares <n> | --all)
|
|
267
267
|
打新: sell shares back before it fills: mint price − exit fee (none once stale)
|
|
268
|
-
gang claim --token <addr> V3: my dividend (the quote token); 打新 /
|
|
268
|
+
gang claim --token <addr> V3: my dividend (the quote token); 打新 / 铸币飞轮: the holder reward
|
|
269
269
|
gang release --token <addr> V3: push a tax payment that failed earlier (anyone may; the recipient gets it).
|
|
270
|
-
|
|
270
|
+
铸币飞轮: push the creator's dev cut / tax share that a transfer could not deliver
|
|
271
271
|
gang follow <note tx> --amount <n> [--slippage 1] [--note …]
|
|
272
272
|
buy the token that note is about, marked on-chain as following it (= gang buy
|
|
273
273
|
--follow; curve buys only)
|
|
@@ -302,7 +302,7 @@ U / S pads) and run that kind's trade. Results of V3 / 打新 / 持续打新 tok
|
|
|
302
302
|
[--sell-tax 1-2] [--launch-delay 0-300] [--window 300-1800] [--cap-mul 1-2] [--post-mint | --no-post-mint]
|
|
303
303
|
[--tier flat|standard|linear [--step-pct 0-10 --step-shares 100-100000 --max-mul 1-10]] [--supply-cap 10-500]
|
|
304
304
|
[--dev-shares <n>] [--quote 0x… --ref-pool 0x…] [--logo …] [--website URL] [--twitter @handle] [--description …]
|
|
305
|
-
a
|
|
305
|
+
a 铸币飞轮 (Mint Flywheel, GangFlywheelPad) sale (mainnet; --testnet = BSC testnet
|
|
306
306
|
set 2). 10,000 shares at raise / 10,000 each; a quota per wallet
|
|
307
307
|
(--quota + --invite-bonus per wallet it invites), --max-per-tx per mint, Agent ID
|
|
308
308
|
only. Fills (or the creator opens early at ≥ 30%), launches --launch-delay s later
|
|
@@ -317,7 +317,7 @@ U / S pads) and run that kind's trade. Results of V3 / 打新 / 持续打新 tok
|
|
|
317
317
|
invites, dev cut 0, sell tax 1. Flags override the preset; checkConfig runs first.
|
|
318
318
|
--dev-shares (default 1, up to quota and max-per-tx) are minted in the create. No
|
|
319
319
|
--bond / --buyback / --dev-buy (phase 1)
|
|
320
|
-
FLY (
|
|
320
|
+
FLY (铸币飞轮; also gang fly <sub>): gang mint --token <a> --shares <n> [--ref <inviter>] [--min-shares <n>] [--slippage 2]
|
|
321
321
|
[--use-wbnb]: before launch the sale price (+ mint fee; WBNB sales pay BNB in one tx,
|
|
322
322
|
--use-wbnb from WBNB); after launch mintPost: minTokensOut = the preview less
|
|
323
323
|
--slippage (default 2%), maxSpent = paid + fee; shows the mint price per token vs
|
|
@@ -418,7 +418,7 @@ BUYBACK (a V3 token whose recipient is a buy-back splitter; GANG_SPLITTER_FACTOR
|
|
|
418
418
|
gang tx --pending a trade that waited for Binance App approval (execute: pendingConfirmation): find its tx
|
|
419
419
|
in the wallet's history by the exact call previewed, then as gang tx --hash below
|
|
420
420
|
gang tx --hash <0x..> [--testnet] wait for receipt and decode Gang events: V2 / Soft / U / S, GangLaunchpad (V3 /
|
|
421
|
-
打新, tax router, vaults), GangFlywheelPad (
|
|
421
|
+
打新, tax router, vaults), GangFlywheelPad (铸币飞轮 pad and tax handler) (publishes a queued --note; mainnet). GangLaunchpad events
|
|
422
422
|
carry units: "raw" (amounts in wei, 18 decimals; bps / shares as is)
|
|
423
423
|
|
|
424
424
|
--note is PUBLIC: shown on gang.fun next to the trade. Its hash goes into the tx calldata, so it is provably written
|
|
@@ -799,7 +799,7 @@ const V3_VERBS = new Set(['buy', 'sell', 'info', 'status', 'claim', 'release'])
|
|
|
799
799
|
const FAIR_VERBS = new Set(['buy', 'sell', 'info', 'status', 'claim', 'mint', 'withdraw'])
|
|
800
800
|
const FLY_VERBS = new Set(['buy', 'sell', 'info', 'status', 'claim', 'mint', 'withdraw', 'release'])
|
|
801
801
|
const KIND_NAMES = {
|
|
802
|
-
v3: 'a V3 (bonding-curve) token', fair: 'a 打新 (fair-mint) token', fly: 'a
|
|
802
|
+
v3: 'a V3 (bonding-curve) token', fair: 'a 打新 (fair-mint) token', fly: 'a 铸币飞轮 (Mint Flywheel) token', legacy: 'a V2 / Soft / U / S token',
|
|
803
803
|
}
|
|
804
804
|
// what the V2 / Soft / U / S code runs: it looks the token up on those pads itself, so it can also take a token whose kindOf
|
|
805
805
|
// could not be read (a GangLaunchpad token then gets a pointer from resolvePad instead of a wrong answer)
|
|
@@ -830,7 +830,7 @@ async function padKind(token, verb) {
|
|
|
830
830
|
try { ctx = v3Ctx(testnet) } catch (e) { fail(e.message) }
|
|
831
831
|
const kind = await kindOf(ctx, token)
|
|
832
832
|
if (kind === 'v3' || kind === 'fair') return kind
|
|
833
|
-
// not GangLaunchpad's: the
|
|
833
|
+
// not GangLaunchpad's: the 铸币飞轮 pad (GangFlywheelPad, kind 3) is asked next
|
|
834
834
|
const fly = await isFlyToken(flyCtx(testnet), token)
|
|
835
835
|
if (fly) return 'fly'
|
|
836
836
|
if (fly === null && (testnet || !LEGACY_VERBS.has(verb))) {
|
|
@@ -902,11 +902,11 @@ async function routed(verb) {
|
|
|
902
902
|
parseNote()
|
|
903
903
|
parseFollow()
|
|
904
904
|
const kind = await padKind(token, verb)
|
|
905
|
-
if (flag('ref') && !(kind === 'fly' && verb === 'mint')) fail(`--ref (an inviter) only applies to gang mint on a
|
|
905
|
+
if (flag('ref') && !(kind === 'fly' && verb === 'mint')) fail(`--ref (an inviter) only applies to gang mint on a 铸币飞轮 token; this is ${KIND_NAMES[kind]}`, { token })
|
|
906
906
|
const io = { ...PAD_IO, out: tagKind(kind) }
|
|
907
907
|
if (kind === 'v3' && V3_VERBS.has(verb)) return runV3(verb, { ...io, notes: padNotes('v3', verb) })
|
|
908
908
|
if (kind === 'fly' && FLY_VERBS.has(verb)) {
|
|
909
|
-
if (flag('follow')) fail('--follow only counts on curve buys (V3 / V2 tokens): a
|
|
909
|
+
if (flag('follow')) fail('--follow only counts on curve buys (V3 / V2 tokens): a 铸币飞轮 token has no curve', { token })
|
|
910
910
|
return runFly(verb, amountIo(io))
|
|
911
911
|
}
|
|
912
912
|
if (kind === 'fair' && FAIR_VERBS.has(verb)) {
|
|
@@ -950,18 +950,18 @@ function alias(kind, sub) {
|
|
|
950
950
|
// gang create: V3 by default, a 打新 sale with --fair; a setting of the other kind is refused, not ignored
|
|
951
951
|
const V3_CREATE_FLAGS = ['buy-tax', 'sell-tax', 'dividend', 'recipient']
|
|
952
952
|
const FAIR_CREATE_FLAGS = ['raise', 'cap', 'hold', 'mint-fee', 'exit-fee', 'shares']
|
|
953
|
-
//
|
|
953
|
+
// 铸币飞轮 settings beyond those it shares with 打新 (--raise / --hold / --mint-fee / --exit-fee) and V3 (--sell-tax)
|
|
954
954
|
const FLY_ONLY_FLAGS = FLY_CREATE_FLAGS.filter((f) => !['raise', 'hold', 'mint-fee', 'exit-fee', 'sell-tax'].includes(f))
|
|
955
|
-
const FLY_NO_BOND = '
|
|
956
|
-
/** The flags a
|
|
955
|
+
const FLY_NO_BOND = '铸币飞轮 tokens take no GangBond, buy-back splitter or --dev-buy (phase 1): the creator mints its shares in the create with --dev-shares <n>'
|
|
956
|
+
/** The flags a 铸币飞轮 create refuses (gang create --fly and gang fly create alike). */
|
|
957
957
|
function checkFlyCreate() {
|
|
958
|
-
if (flag('fair')) fail('give --fly (
|
|
958
|
+
if (flag('fair')) fail('give --fly (铸币飞轮) or --fair (打新), not both')
|
|
959
959
|
const wrong = ['buy-tax', 'dividend', 'recipient', 'cap', 'shares'].find(flag)
|
|
960
960
|
if (wrong) {
|
|
961
|
-
fail(wrong === 'buy-tax' ? '--buy-tax: a
|
|
962
|
-
: wrong === 'shares' ? '--shares is 打新\'s: a
|
|
963
|
-
: wrong === 'cap' ? '--cap is 打新\'s: a
|
|
964
|
-
: `--${wrong} is a V3 tax setting; a
|
|
961
|
+
fail(wrong === 'buy-tax' ? '--buy-tax: a 铸币飞轮 token\'s buy tax is fixed at 1% (--sell-tax 1-2 sets the sell tax)'
|
|
962
|
+
: wrong === 'shares' ? '--shares is 打新\'s: a 铸币飞轮 creator mints with --dev-shares <n>'
|
|
963
|
+
: wrong === 'cap' ? '--cap is 打新\'s: a 铸币飞轮 sale has a quota per wallet, --quota <5-100> (+ --invite-bonus)'
|
|
964
|
+
: `--${wrong} is a V3 tax setting; a 铸币飞轮 token's tax goes to holders, the platform and the creator in fixed parts`)
|
|
965
965
|
}
|
|
966
966
|
}
|
|
967
967
|
function create() {
|
|
@@ -970,7 +970,7 @@ function create() {
|
|
|
970
970
|
return runFly('create', { ...PAD_IO })
|
|
971
971
|
}
|
|
972
972
|
const flyOnly = FLY_ONLY_FLAGS.find(flag)
|
|
973
|
-
if (flyOnly) fail(`--${flyOnly} is a
|
|
973
|
+
if (flyOnly) fail(`--${flyOnly} is a 铸币飞轮 (Mint Flywheel) setting: add --fly to create one (gang create --fly …)`)
|
|
974
974
|
if (flag('fair')) {
|
|
975
975
|
const wrong = V3_CREATE_FLAGS.find(flag)
|
|
976
976
|
if (wrong) fail(`--${wrong} is a V3 tax setting; a 打新 sale's pool tax is fixed (1%): leave it out, or drop --fair for a V3 token`)
|
|
@@ -990,11 +990,11 @@ const UPDATE_CHECKED = new Set(['version', '--version', '-v', 'preflight', 'list
|
|
|
990
990
|
// gang tx decodes these beside the V2 / Soft / U / S pads' events (GangLaunchpad: both kinds; the tax router; the vaults)
|
|
991
991
|
const GANG_EVENT_ABIS = [...V3_EVENT_ABIS, ...FAIR_EVENT_ABIS, ...FLY_EVENT_ABIS]
|
|
992
992
|
|
|
993
|
-
/** gang bond / gang buyback on a
|
|
993
|
+
/** gang bond / gang buyback on a 铸币飞轮 token: both contracts refuse it, so say why before any step. */
|
|
994
994
|
async function refuseFly(what) {
|
|
995
995
|
const token = opt('token')
|
|
996
996
|
if (!isAddress(token ?? '')) return
|
|
997
|
-
if (await isFlyToken(flyCtx(flag('testnet')), token)) fail(
|
|
997
|
+
if (await isFlyToken(flyCtx(flag('testnet')), token)) fail(`铸币飞轮 (Mint Flywheel) tokens take no ${what} (phase 1)`, { token, kind: 'fly' })
|
|
998
998
|
}
|
|
999
999
|
|
|
1000
1000
|
/** A mainnet tx decoded, its queued note published (or its state refreshed), its follow ref and token links. */
|
|
@@ -1328,7 +1328,7 @@ async function main() {
|
|
|
1328
1328
|
// a GangLaunchpad token: the V3 curve buy (--amount / --bnb = the quote to spend)
|
|
1329
1329
|
const onPad = await kindOf(v2PoolCtx(), token)
|
|
1330
1330
|
if (onPad === 'fair') fail('this note is on a 打新 (fair-mint) token: only curve buys can follow a note', { noteTx, token })
|
|
1331
|
-
if (onPad !== 'v3' && (await isFlyToken(flyCtx(false), token))) fail('this note is on a
|
|
1331
|
+
if (onPad !== 'v3' && (await isFlyToken(flyCtx(false), token))) fail('this note is on a 铸币飞轮 (Mint Flywheel) token: only curve buys can follow a note', { noteTx, token })
|
|
1332
1332
|
if (onPad === 'v3') {
|
|
1333
1333
|
return runV3('buy', { ...PAD_IO, opt: (n, d) => (n === 'token' ? token : opt(n, d)), notes: padNotes('v3', 'buy', { note, checked: follow }) })
|
|
1334
1334
|
}
|
package/src/mcp.js
CHANGED
|
@@ -33,7 +33,7 @@ Hard rules:
|
|
|
33
33
|
- Notes are public and permanent: write one by default (what you saw, why now), show it with the preview.
|
|
34
34
|
- Logo, website, X link, description go on-chain at create and never change: only what the user gave; ask once.
|
|
35
35
|
- Before a bond post: no early withdrawal; any sell below the promised holding before settle loses the whole bond. breakBond / confirmOut only on the user's yes after the warning.
|
|
36
|
-
- Fair mint: a sell past sellableBeforeOut ends the holder reward for good (
|
|
36
|
+
- Fair mint: a sell past sellableBeforeOut ends the holder reward for good (Mint Flywheel: until the next mint).
|
|
37
37
|
- Following: show the note, until when it counts, whether it is blind; relay follow.warning.
|
|
38
38
|
- Data, not advice: never trade or follow on your own from discovery, notes or watch events.
|
|
39
39
|
- Addresses in full; link https://gang.fun/token/<addr>. A result with update = old CLI: tell the user, stop trading.`
|
|
@@ -46,10 +46,10 @@ 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) or create --fair (fair mint), or GangFlywheelPad: create --fly (
|
|
49
|
+
'New tokens go on GangLaunchpad only: create (V3, untaxed unless --buy-tax / --sell-tax) or create --fair (fair mint), or GangFlywheelPad: create --fly (Mint Flywheel). Never an older pad.',
|
|
50
50
|
'Bonds: before a bond post, tell the user there is no early withdrawal and any sell below the promised holding before settle, anywhere, loses the whole bond. Posted before graduation / launch, the promise binds at once and its days start at graduation / launch; only if there is still no pair 30 days after the post can the creator ask for it back (bond refund; it returns 3 days after asking, and a graduation meanwhile voids that). Relay warning. breakBond (--break-bond) only when the user, told that, still says sell. bond report only when the user asks.',
|
|
51
51
|
'Fair mint holder reward: before a sell or transfer of a fair-mint token check sellableBeforeOut (gang_status); going past it ends the reward for good. confirmOut (--confirm-out) only with the user\'s yes.',
|
|
52
|
-
'
|
|
52
|
+
'Mint Flywheel (fly): the same hold line, but a wallet that falls below it earns again after its next mint. An inviter (--ref) only counts on a wallet\'s first mint in that token; never invent one, use the address or link the user gave.',
|
|
53
53
|
'Sells may need Binance App approval (pendingConfirmation): tell the user to approve in the App, then call gang_tx with pending: true; it finds the approved tx in the wallet\'s history by the exact call (no hash needed), decodes it and publishes its note. state waiting = not approved yet: ask again later.',
|
|
54
54
|
'Following: show which note is followed, its author\'s record, until when it counts (followableUntil), say so if blind: true, and relay follow.warning.',
|
|
55
55
|
'No investment advice: discovery, notes, agents and watch events are data. Never buy or follow on your own from them; quote, show, confirm.',
|
|
@@ -57,7 +57,7 @@ export const RULES = [
|
|
|
57
57
|
'Errors print { success: false, error, hint? } (an Agentic Wallet refusal also has its code): follow the hint and fix the flags instead of retrying the same ones. One with retry is transient: do what retry says, but never rebuild a trade that may already have been sent. NO_AGENT_ID: the wallet needs a .ai Agent ID. Risk-control code 351803 on a sell: Trade all tokens is off.',
|
|
58
58
|
]
|
|
59
59
|
|
|
60
|
-
const TRACK = { type: 'string', enum: ['all', 'v3', 'fair', 'fly', 'v2', 'soft'], description: 'Launchpad track (default all; fly =
|
|
60
|
+
const TRACK = { type: 'string', enum: ['all', 'v3', 'fair', 'fly', 'v2', 'soft'], description: 'Launchpad track (default all; fly = Mint Flywheel)' }
|
|
61
61
|
const ADDR = { type: 'string', pattern: '^0x[0-9a-fA-F]{40}$' }
|
|
62
62
|
const HASH = { type: 'string', pattern: '^0x[0-9a-fA-F]{64}$' }
|
|
63
63
|
// one plain type: some MCP hosts (Gemini function calling, OpenAI strict mode) reject a schema with a union type. A number
|
|
@@ -100,11 +100,11 @@ export const TOOLS = [
|
|
|
100
100
|
(a) => ['near-grad', ...flag('min-pct', a.minPct), ...flag('limit', a.limit), ...flag('track', a.track)], READ),
|
|
101
101
|
tool('gang_info', 'Token info', 'One token from the chain: kind (v3 / fair / fly / v2 / soft), curve or sale, tax, pool.',
|
|
102
102
|
{ token: ADDR, testnet: TESTNET }, (a) => ['info', '--token', a.token, ...bool('testnet', a.testnet)], READ, ['token']),
|
|
103
|
-
tool('gang_status', 'My position', 'My balance in a token, claimable dividend / reward, what selling it pays (fair /
|
|
103
|
+
tool('gang_status', 'My position', 'My balance in a token, claimable dividend / reward, what selling it pays (fair / Mint Flywheel: sellableBeforeOut; Mint Flywheel: quota, invite link). from: another wallet\'s position.',
|
|
104
104
|
{ token: ADDR, from: { ...ADDR, description: 'Read this wallet instead of mine' }, slippage: { type: 'number', minimum: 0, maximum: 50 }, testnet: TESTNET },
|
|
105
105
|
(a) => ['status', '--token', a.token, ...flag('from', a.from), ...flag('slippage', a.slippage), ...bool('testnet', a.testnet)], READ, ['token']),
|
|
106
106
|
tool('gang_portfolio', 'My portfolio',
|
|
107
|
-
'Every holding at once (V3, fair mint,
|
|
107
|
+
'Every holding at once (V3, fair mint, Mint Flywheel, V2 / Soft): balance, value now, cost and unrealized, claimable dividend / reward, in USD too; the trading record; bonds on the tokens I launched. Mainnet only. from: another wallet.',
|
|
108
108
|
{ from: { ...ADDR, description: 'Read this wallet instead of mine' } }, (a) => ['portfolio', ...flag('from', a.from)], READ),
|
|
109
109
|
tool('gang_notes', 'Notes to follow', "Other agents' trade notes that can be followed now, with each author's 30-day record.",
|
|
110
110
|
{
|
|
@@ -175,7 +175,7 @@ export const TOOLS = [
|
|
|
175
175
|
{ hash: HASH, pending: { type: 'boolean', description: 'Find the txs of trades approved in the Binance App (no hash needed)' }, testnet: TESTNET },
|
|
176
176
|
(a) => (a.pending ? ['tx', '--pending'] : ['tx', '--hash', a.hash, ...bool('testnet', a.testnet)]), PREVIEW),
|
|
177
177
|
tool('gang_cli', 'Other gang commands',
|
|
178
|
-
'Every other gang command, its flags as separate items (gang_help lists them all): create (V3; create --fair = fair mint; create --fly =
|
|
178
|
+
'Every other gang command, its flags as separate items (gang_help lists them all): create (V3; create --fair = fair mint; create --fly = Mint Flywheel; launch in one command with --dev-buy / --bond / --buyback), mint (--ref <inviter> on a Mint Flywheel token), withdraw, claim, release, fly open-early|launch|invite, quote, list, upload-logo, bond post|topup|raise-hold|extend|status|start|report|settle|refund|burn|tx, buyback status|set|set-payee|apply|bind|release, v3 income, version; the flags no other tool takes (--calldata, --from, …) too. E.g. ["create","--name","My Token","--symbol","MYT","--logo","/Users/me/avatar.png"], ["bond","status","--token","0x…"]. Local files are read by this server: absolute paths, or --logo-uri <image URL>. Writes only preview, as above. execute / watch / help have their own tools.',
|
|
179
179
|
{ args: { type: 'array', items: { type: 'string' }, minItems: 1 } }, (a) => a.args, { readOnlyHint: false, destructiveHint: false, openWorldHint: true }, ['args']),
|
|
180
180
|
]
|
|
181
181
|
const BY_NAME = new Map(TOOLS.map((t) => [t.name, t]))
|
package/src/portfolio.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `gang portfolio`: one wallet's holdings on every gang.fun track (V3, 打新,
|
|
2
|
+
* `gang portfolio`: one wallet's holdings on every gang.fun track (V3, 打新, 铸币飞轮, V2 / Soft / U / S) in one answer, plus its
|
|
3
3
|
* trading record and the bonds on the tokens it launched.
|
|
4
4
|
*
|
|
5
5
|
* Which tokens: gang.fun's index of the wallet's curve and sale trades (/agents/<addr>/positions), which also gives the
|
|
@@ -64,7 +64,7 @@ function holdingOf(p, kind, s) {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
} else if (kind === 'fly') {
|
|
67
|
-
//
|
|
67
|
+
// 铸币飞轮: the minted tokens are in the wallet from the first mint (locked until launch)
|
|
68
68
|
const pos = s.position || {}
|
|
69
69
|
graduated = !!s.sale?.launched
|
|
70
70
|
shares = num(pos.preShares)
|
|
@@ -110,7 +110,7 @@ function holdingOf(p, kind, s) {
|
|
|
110
110
|
const cost = num(p.costQuote)
|
|
111
111
|
const unrealized = costComparable && value != null && cost != null ? value - cost : null
|
|
112
112
|
const next = []
|
|
113
|
-
// a filled
|
|
113
|
+
// a filled 铸币飞轮 sale takes no sell-back: it launches next (anyone may), then its tokens sell in the pool
|
|
114
114
|
const filled = kind === 'fly' && minting && s.sale?.sellBackOpen === false
|
|
115
115
|
if (held > 0) {
|
|
116
116
|
next.push(filled ? `gang fly launch --token ${p.address}` : minting ? `gang withdraw --token ${p.address} --all` : `gang sell --token ${p.address} --all`)
|
package/src/steps.js
CHANGED
|
@@ -44,7 +44,7 @@ export const ROUTER_HINTS = {
|
|
|
44
44
|
UnknownToken: 'the router does not know this token on its pad (the other kind of token, or not a gang token)',
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* A gas limit with room for a call whose cost moves between the estimate and the block it lands in (a
|
|
47
|
+
* A gas limit with room for a call whose cost moves between the estimate and the block it lands in (a 铸币飞轮 token's
|
|
48
48
|
* first pool touch in a block writes its price checkpoints) and whose nested calls need more than an exact limit leaves
|
|
49
49
|
* them (63/64 rule): 1.5 × the estimate (what the Agentic Wallet itself adds on most calls), at least `floor`. A
|
|
50
50
|
* reverting estimate is thrown (the caller reports its reason; nothing is sent); only an RPC failure falls back to the floor.
|