@gangfun/cli 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/README.zh-CN.md +9 -0
- package/package.json +1 -1
- package/src/base.js +272 -0
- package/src/capabilities.js +7 -0
- package/src/chain.js +32 -7
- package/src/creatorfee.js +45 -8
- package/src/flags.js +1 -1
- package/src/floor.js +818 -0
- package/src/gangpad.js +9 -3
- package/src/index.js +111 -11
- package/src/launch.js +255 -22
- package/src/mcp.js +4 -3
- package/src/promote.js +1 -1
- package/src/telemetry.js +1 -1
- package/src/v3.js +120 -18
- package/src/vanity.js +45 -4
package/README.md
CHANGED
|
@@ -20,6 +20,10 @@ Operate [gang.fun](https://gang.fun) from a Binance **Agentic Wallet**. Curve bu
|
|
|
20
20
|
|
|
21
21
|
**Capped recipient (0.35.0+):** `--tax-cap <amount>` on a taxed launch makes a V3 token's tax recipient one GangCappedSplitter (`capped-v1`): `gang create … --buy-tax 3 --sell-tax 3 --tax-cap 20 --tax-cap-share 50 --split self:70,0x…:30 --after-cap buyback:70,lp:30` pushes 50% of the recipient's part to the payees (`--split` shares of that part; default: all to the dev) until they have been credited 20 of the launch's quote in all (WBNB for a BNB launch, else `--quote`, counted in its own decimals); the rest, and after the cap all of it, is 70% bought back and burned and 30% added to the pair as liquidity (LP to 0xdead). `--tax-cap-share` defaults to 100, `--after-cap` to `buyback:100`. The split that crosses the cap pays exactly what is left of it, and the preview gives the rough pool volume at which the cap is reached. The cap covers only this recipient's part of the pool tax: not the creator fee, not the dev's own tokens (the dev can still sell), not the holders' dividend. **Everything is permanent**: the cap, its quote, the ratios, payees and shares can never change; a payee can only move its own slot. Any other asset sent to it goes to 0xdead in full when it is distributed (one that can't be sent there stays in the module). Not with `--buyback` / `--lp` / `--buyback-to` / `--lp-to` / `--recipient`. `gang capped status|distribute|release|set-payee|bind|chunk` shows and drives it. Live on BSC mainnet (factory `0x294E901ecb66af280C1cDD26fD871601d89a2Dca`, allowed by the platform's Safe on 2026-11-08; built in) and the BSC testnet (`0xe3f61865d98993dd39c136Af19651C6F6686498A`).
|
|
22
22
|
|
|
23
|
+
**Floor module (0.39.0+, BSC mainnet and testnet):** `--floor` on a taxed launch makes a V3 token's tax recipient one GangFloorModule (`floor-v1`): `gang create … --buy-tax 3 --sell-tax 3 --floor [--redeem-fee 2] [--tax-cap 20 --tax-cap-share 50 --split self:70,0x…:30]`. The recipient's part of the pool tax is kept as a treasury — nothing is bought back or added. After graduation any holder can give up tokens for their share of it (`gang floor redeem`: the tokens go to 0xdead, for good), less `--redeem-fee` % (0–5, default 2) that stays for the holders who remain. With `--tax-cap` the `--split` payees take `--tax-cap-share` % until they have been credited the cap, as a capped recipient pays them; without it nobody takes a share. The floor is not a price promise: it starts at 0, grows only with pool volume and is usually far below the market price — `gang floor redeem` shows what selling the same tokens in the pool would pay and warns when that is more. The module is cloned for the one address its token will have, so the launch fixes the token's name, symbol, tax rates and metadata at its first step, and checks with the pad that the create lands at that address before building it. `gang floor status` says whether GangFloorModuleFactory made the module and whether it was cloned for this token; if not, the token has no floor and no `gang floor` call is built.
|
|
24
|
+
|
|
25
|
+
**Opening base (0.40.0+, BSC testnet; on mainnet the pad is upgraded and the base opens with an owner (Safe) call — until then `--base` stops with "closed"):** `gang create … --base <5|10> --base-vest <30|90|180> [--grad 6|9|12|15]` creates a GangLaunchpad 3.0 curve token whose very first trade buys 5% or 10% of the supply for the token's own base vault (GangBaseVault, `base-v1`). The create pays exactly the pad's `previewBaseCost` in BNB as the tx value (5% at 6 / 9 / 12 / 15 BNB: 0.0994 / 0.1490 / 0.1987 / 0.2484 BNB; 10%: 0.2090 / 0.3135 / 0.4180 / 0.5225; the 1% fee included, 70% of it back as your creator fee). The vault never trades: the base is locked until graduation, then the first `gang base release` (anyone may call it) starts the clock and the base is released linearly over `--base-vest` days to the creator's wallet (5%: 30 / 90 / 180 days; 10%: 90 / 180; fixed for good). **If the token never graduates, the base and its cost stay locked for good.** The preview shows the cost, the schedule and the spec's payoff figures (the least you get, at the graduation price, days to recover the cost, the daily release, what other buyers pay more), and that GangBond does not constrain the base (the vault keeps refilling the creator's wallet, so a bond is no promise about it). WBNB quote only, no dividend, not with `--vault` / `--promote` / `--fair` / `--fly` or a launch in one command; on a taxed token the recipient is usually the creator. With abcd on, the create goes through `createWithSalt` with the BNB. The CLI asks the pad (`baseVaultImpl`) and refuses `--base` where it is not live. `gang base status --token 0x…` shows the vault, size, period, start (or not started), total, released, releasable and unreleased (counted by time); `gang base release --token 0x…` starts the release, then sends what has vested to the creator.
|
|
26
|
+
|
|
23
27
|
**Call bond and follow binding (0.37.0+):** an agent can back its own call — a buy note on a GangLaunchpad 3.0 curve token — with a bond: buy with `--note`, then within 10 minutes `gang call-bond post --token 0x… --amount 0.1 --for 48h` (the note defaults to the wallet's latest buy of the token; `--hold` defaults to the whole balance). Until settle the wallet's balance of the token stays ≥ hold; one sell, vault lock or transfer below it — also after the deadline, until `gang call-bond settle` has run (two steps, 1 hour apart) — and anyone can `gang call-bond report` it: 1% to the reporter, half burnt, the rest paid to the note's followers by their loss (`gang call-bond claim` once the root's 2-day dispute window is over). Nothing of a broken bond comes back to the caller. Quotes: WBNB, USDT, USDC, USD1. A caller's `gang v3 sell` below its hold is refused unless `--break-call-bond`. On a token with a promoter share, `gang follow` binds the note's author as the wallet's promoter for good (it builds `buyWithPromoter`; same price and fee; `--no-promoter` for a plain follow). GangCallBond is live on BSC mainnet (`0x6d6e4A36e9a231cCc932151cdbFb087Cf3860c3D`, deployed 2026-11-09, owned by the platform's Safe; built in) and the BSC testnet (`0xBE2B8519278E9D31B6c4040bAd35f727fD5d2A70`).
|
|
24
28
|
|
|
25
29
|
**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`).
|
|
@@ -142,6 +146,10 @@ gang create … --buy-tax 3 --sell-tax 3 --buyback 30 --lp 30 [--split self:70,0
|
|
|
142
146
|
gang combo status|distribute|release|set-payee|bind|chunk --token 0x… [--asset 0x…] [--index <i>] [--to 0x…] [--slippage 1] # the combined recipient: ratios, payees, set aside, owed, the next chunk and the keeper's plan; chunk = one chunk now (anyone)
|
|
143
147
|
gang create … --buy-tax 3 --sell-tax 3 --tax-cap 20 [--tax-cap-share 50] [--split self:70,0x…:30] [--after-cap buyback:70,lp:30] # V3, capped recipient: the payees get --tax-cap-share % until --tax-cap in all, the rest (and then all) bought back / added. PERMANENT
|
|
144
148
|
gang capped status|distribute|release|set-payee|bind|chunk --token 0x… [--asset 0x…] [--index <i>] [--to 0x…] [--slippage 1] # the capped recipient: cap, paid / left / progress, ratios, payees, set aside, owed, the next chunk; other assets go to 0xdead
|
|
149
|
+
gang create … --buy-tax 3 --sell-tax 3 --floor [--redeem-fee 2] [--tax-cap 20 [--tax-cap-share 50] [--split self:70,0x…:30]] # V3, floor module: the recipient's part of the tax is kept as a treasury holders can redeem; with --tax-cap the payees take their share until the cap
|
|
150
|
+
gang floor status|redeem|distribute|release|set-payee|bind --token 0x… [--amount <tokens>|all] [--to 0x…] [--asset 0x…] [--index <i>] [--break-bond] [--break-call-bond] [--settle-first] # the floor module: treasury, what a token redeems for, fee, cap and payees; redeem burns the tokens (0xdead) for their share of the treasury
|
|
151
|
+
gang create … --base 5|10 --base-vest 30|90|180 [--grad 6|9|12|15] # 3.0 opening base: the create also buys 5% / 10% for a base vault, paid in BNB; locked until graduation (for good if it never graduates), then released linearly to you
|
|
152
|
+
gang base status|release --token 0x… # the base vault: size, period, start, released, releasable, unreleased; release starts the clock, then sends what has vested to the creator
|
|
145
153
|
gang create --fair … [--shares <n>] --bond <quote> [--bond-hold …] --bond-days <7-90> # 打新: create (dev shares) → bond
|
|
146
154
|
gang execute --request-id <id>
|
|
147
155
|
gang tx --pending # trades approved in the Binance App: found by the exact call previewed, then as below
|
|
@@ -280,7 +288,7 @@ take MCP servers instead of a shell (Claude Desktop / Code, Cursor, …). Each t
|
|
|
280
288
|
|
|
281
289
|
| Tool | Runs |
|
|
282
290
|
|---|---|
|
|
283
|
-
| `gang_help` | this CLI's whole help (every command, every flag) and the full rules (0.17.2+): what an agent with no skill installed reads before a create, launch, bond, buyback, split, lp, combo, capped, mint or withdraw |
|
|
291
|
+
| `gang_help` | this CLI's whole help (every command, every flag) and the full rules (0.17.2+): what an agent with no skill installed reads before a create, launch, bond, buyback, split, lp, combo, capped, floor, mint or withdraw |
|
|
284
292
|
| `gang_preflight`, `gang_trending`, `gang_hot`, `gang_new`, `gang_near_grad`, `gang_info`, `gang_status`, `gang_portfolio`, `gang_notes`, `gang_agents` | the read commands of the same name (`gang_portfolio`: 0.17.6+; `gang_trending`: 0.24.0+) |
|
|
285
293
|
| `gang_tx` | `gang tx --hash …`: decode a tx, publish its queued note; `pending: true` = `gang tx --pending`, the trades approved in the Binance App (no hash needed) |
|
|
286
294
|
| `gang_watch` | `gang watch` until `maxEvents` (default 1) or `timeout` (default 50s, at most 30m): returns `{ events, meta }`, `timedOut: true` when nothing came; call it again to keep waiting |
|
|
@@ -351,6 +359,7 @@ timed-out `gang_execute`, check `gang_status` / the wallet history instead of ex
|
|
|
351
359
|
| `GANG_LP_FACTORY` / `GANG_TESTNET_LP_FACTORY` | GangLiquiditySplitterFactory of the create target (`--lp`). Defaults (CLI 0.20.0+): mainnet 3.0 `0x98C5…1752` (2.0 `0x8ac8…c0E4`, 1.0 `0xE043…C248`, since 2026-10-31), testnet 3.0 `0x4A3a…6B07` (2.0 `0xAEec…36E4`, first 2.0 `0x4f15…1619`, 1.0 `0xA729…1591`) |
|
|
352
360
|
| `GANG_COMBO_FACTORY` / `GANG_TESTNET_COMBO_FACTORY` | GangComboSplitterFactory of the create target (several of `--buyback` / `--lp` / `--split`; a token's combined recipient is on its own generation's). Defaults (CLI 0.22.0+): mainnet 3.0 `0x2018…eA39` (2.0 `0xcCeA…98Be`, 1.0 `0xd33C…1DBd`, since 2026-10-31), testnet 3.0 `0xdc16…543C` (2.0 `0x312c…84BD`, 1.0 `0x52a8…4CFE`; the first 2.0 has none) |
|
|
353
361
|
| `GANG_CAPPED_FACTORY` / `GANG_TESTNET_CAPPED_FACTORY` | GangCappedSplitterFactory of the create target (`--tax-cap` on a taxed V3 launch). CLI 0.35.0+; built in: mainnet `0x294E901ecb66af280C1cDD26fD871601d89a2Dca`, testnet `0xe3f61865d98993dd39c136Af19651C6F6686498A` |
|
|
362
|
+
| `GANG_FLOOR_FACTORY` / `GANG_TESTNET_FLOOR_FACTORY` | GangFloorModuleFactory of the create target (`--floor` on a taxed V3 launch). Built in: mainnet `0x057d2C1557a0E8298a1E00834D6064497f5DC2fC`, testnet `0x0804C018201D8fFe378b873b41B67f136dbdc3F8` |
|
|
354
363
|
| `GANG_CALL_BOND` / `GANG_TESTNET_CALL_BOND` | GangCallBond of GangLaunchpad 3.0 (`gang call-bond`). CLI 0.37.0+; built in: mainnet `0x6d6e4A36e9a231cCc932151cdbFb087Cf3860c3D`, testnet `0xBE2B8519278E9D31B6c4040bAd35f727fD5d2A70` |
|
|
355
364
|
| `GANG_SPLITTER_FACTORY` / `GANG_TESTNET_SPLITTER_FACTORY` | GangBuybackSplitterFactory of the create target (`--buyback`). Defaults: mainnet 3.0 `0xc128…3194` (2.0 `0x77e4…803C`, 1.0 `0xf1d5…F1Cd`), testnet 3.0 `0x3533…d110` (2.0 `0xDC9E…0f6e`, first 2.0 `0xBc26…33AE`, 1.0 `0x7E63…2BBe`) |
|
|
356
365
|
| `GANG_ROUTER` / `GANG_TESTNET_ROUTER` | GangRouter proxy of the create target (native-BNB V3 buys / mints, and every PancakeSwap trade of a graduated token; a token uses its own generation's); old name `GANG_ROUTER_TESTNET` still works. Defaults: mainnet 3.0 `0xec97…61e7` (2.0 `0xa832…844a`, 1.0 `0xE040…79C4`), testnet 3.0 `0x0954…87b9` (2.0 `0x5a4F…dDAA`, first 2.0 `0xb218…FC08`, 1.0 `0x6bB6…C9F6`) |
|
package/README.zh-CN.md
CHANGED
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
**税收封顶(0.35.0+):** 有税发射时给 `--tax-cap <数量>`,V3 币的税收接收地址就是一个封顶合约(GangCappedSplitter,`capped-v1`):`gang create … --buy-tax 3 --sell-tax 3 --tax-cap 20 --tax-cap-share 50 --split self:70,0x…:30 --after-cap buyback:70,lp:30` 把接收地址那份税的 50% 推给收款人(`--split` 的比例是这一部分里的比例;不给时全给 dev),直到收款人累计拿满 20 个发射报价币(BNB 发射就是 WBNB,否则是 `--quote`,按它自己的小数位计);其余部分,以及封顶之后的全部,70% 回购销毁、30% 加进池子做流动性(LP 打进 0xdead)。`--tax-cap-share` 默认 100,`--after-cap` 默认 `buyback:100`。跨过上限的那一笔只给到剩余额度,预览会给出大约多少池子成交量会封顶。封顶只管这个接收地址那份税:不管创建者的曲线手续费分成,不管 dev 自己的币(照样能卖),也不管持有人分红。**全部永久不可改**:上限、计价币、比例、收款人和份额以后都不能改;收款人只能把自己那一份换到新地址。打进来的其他资产在分配(distribute)时全部打进 0xdead(打不进去的留在合约里)。不能和 `--buyback` / `--lp` / `--buyback-to` / `--lp-to` / `--recipient` 同用。`gang capped status|distribute|release|set-payee|bind|chunk` 查看和操作。BSC 主网已上线(工厂 `0x294E901ecb66af280C1cDD26fD871601d89a2Dca`,平台多签于 2026-11-08 批准;已内置),测试网也有(`0xe3f61865d98993dd39c136Af19651C6F6686498A`)。
|
|
22
22
|
|
|
23
|
+
**底价赎回(0.39.0+,BSC 主网和测试网):** 有税发射时给 `--floor`,V3 币的税收接收地址就是一个底价模块(GangFloorModule,`floor-v1`):`gang create … --buy-tax 3 --sell-tax 3 --floor [--redeem-fee 2] [--tax-cap 20 --tax-cap-share 50 --split self:70,0x…:30]`。接收地址那一份池子税不回购、不加池,留在模块里当金库。毕业后任何持有人都可以把代币交出去,按比例取走金库里的报价币(`gang floor redeem`,代币进 0xdead,不可逆),扣掉 `--redeem-fee` %(0–5,默认 2),这部分留给还持有的人。带 `--tax-cap` 时,`--split` 里的收款人先拿 `--tax-cap-share` %,累计拿满上限为止,规则和税收封顶一样;不带则没有人分走。底价不是价格承诺:它从 0 开始,只随池子成交增长,通常远低于市价——`gang floor redeem` 会显示同样的代币在池子里卖出能拿多少,卖出更多时给出警告。模块是为代币将来的那一个地址克隆的,所以发射的第一步就把代币的名称、符号、税率和元数据定死,建币前还会向 pad 核对这笔建币确实落在那个地址上。`gang floor status` 会说明这个模块是不是 GangFloorModuleFactory 创建的、是不是为这个币克隆的;不是的话这个币没有底价,CLI 也不会生成任何 `gang floor` 调用。
|
|
24
|
+
|
|
25
|
+
**开盘底仓(0.40.0+,BSC 测试网;主网 pad 已升级,等多签开放后可用,开放前 `--base` 会提示未开放):** `gang create … --base <5|10> --base-vest <30|90|180> [--grad 6|9|12|15]` 在 GangLaunchpad 3.0 上建一个曲线币,它的第一笔成交就是给这个币专属的底仓金库(GangBaseVault,`base-v1`)买入总量的 5% 或 10%。建币交易按 pad 的 `previewBaseCost` 正好付这么多 BNB(5% 在 6 / 9 / 12 / 15 BNB 档:0.0994 / 0.1490 / 0.1987 / 0.2484 BNB;10%:0.2090 / 0.3135 / 0.4180 / 0.5225;含 1% 手续费,其中 70% 作为创建人手续费返还给你)。金库不交易:毕业前底仓锁住;毕业后第一次有人调 `gang base release`(谁都可以调)开始计时,之后在 `--base-vest` 天里匀速释放到创建人的钱包(5%:30 / 90 / 180 天;10%:90 / 180 天;写死不能改)。**如果代币永远不毕业,底仓和为它付的钱永远锁着,收不回来。** 预览里有花费、释放节奏和规格里的收益表(最少能拿多少、按毕业价算多少、几天收回成本、每天释放量、其他买家多付多少),并说明保证金约束不了底仓(金库一直往创建人钱包里补币,保证金不代表对底仓的任何承诺)。只支持 WBNB 计价,不能带分红,不能和 `--vault` / `--promote` / `--fair` / `--fly` 或一条命令发射一起用;带税时收款人通常就是创建人自己。开启 abcd 时建币经 `createWithSalt` 带上 BNB 发出。CLI 会先问 pad(`baseVaultImpl`),没开放的地方直接拒绝 `--base`。`gang base status --token 0x…` 显示金库、底仓大小、释放期、开始时间(或未开始)、总量、已释放、可释放和未释放(按时间算);`gang base release --token 0x…` 第一次调用开始计时,之后把已经到期的部分转给创建人。
|
|
26
|
+
|
|
23
27
|
**喊单保证金和跟单绑定(0.37.0+):** agent 可以给自己的喊单(GangLaunchpad 3.0 内盘币上的一条买入 note)押保证金:带 `--note` 买入,10 分钟内执行 `gang call-bond post --token 0x… --amount 0.1 --for 48h`(note 默认取这个钱包最近一次买这个币的交易;`--hold` 默认是全部余额)。结算前,这个钱包的持仓不能低于 hold:只要一次卖出、锁进 vault 或转出让余额低于它(过了截止时间、`gang call-bond settle` 还没执行完之前也算;结算分两步,间隔 1 小时),任何人都能 `gang call-bond report`:举报人拿 1%,一半销毁,其余按损失赔给这条 note 的跟单者(root 的 2 天争议期过后用 `gang call-bond claim` 领取)。违约的保证金一分都不会回到喊单者。报价币:WBNB、USDT、USDC、USD1。喊单者用 `gang v3 sell` 卖到低于 hold 会被拒,除非加 `--break-call-bond`。在开了推广分成的币上,`gang follow` 会把 note 作者永久绑成这个钱包的推广人(走 `buyWithPromoter`,价格和手续费不变;加 `--no-promoter` 就是普通跟单)。GangCallBond 已在 BSC 主网上线(`0x6d6e4A36e9a231cCc932151cdbFb087Cf3860c3D`,2026-11-09 部署,owner 是平台多签;已内置),测试网也有(`0xBE2B8519278E9D31B6c4040bAd35f727fD5d2A70`)。
|
|
24
28
|
|
|
25
29
|
**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`)上交易。
|
|
@@ -121,6 +125,10 @@ gang create … --buy-tax 3 --sell-tax 3 --buyback 30 --lp 30 [--split self:70,0
|
|
|
121
125
|
gang combo status|distribute|release|set-payee|bind|chunk --token 0x… [--asset 0x…] [--index <i>] [--to 0x…] [--slippage 1] # 组合合约:比例、收款人、待回购 / 待加池、欠款、下一块和 keeper 的计划;chunk = 现在手动做一块(任何人)
|
|
122
126
|
gang create … --buy-tax 3 --sell-tax 3 --tax-cap 20 [--tax-cap-share 50] [--split self:70,0x…:30] [--after-cap buyback:70,lp:30] # V3 税收封顶:收款人拿 --tax-cap-share %,累计拿满 --tax-cap 为止,其余(封顶后全部)回购 / 加池。永久不可改
|
|
123
127
|
gang capped status|distribute|release|set-payee|bind|chunk --token 0x… [--asset 0x…] [--index <i>] [--to 0x…] [--slippage 1] # 封顶合约:上限、已付 / 剩余 / 进度、比例、收款人、待回购 / 待加池、欠款、下一块;其他资产打进 0xdead
|
|
128
|
+
gang create … --buy-tax 3 --sell-tax 3 --floor [--redeem-fee 2] [--tax-cap 20 [--tax-cap-share 50] [--split self:70,0x…:30]] # V3 底价赎回:接收地址那一份税留作金库,持有人可以赎回;带 --tax-cap 时收款人先拿到上限为止
|
|
129
|
+
gang floor status|redeem|distribute|release|set-payee|bind --token 0x… [--amount <数量>|all] [--to 0x…] [--asset 0x…] [--index <i>] [--break-bond] [--break-call-bond] [--settle-first] # 底价模块:金库、每枚能赎回多少、手续费、上限和收款人;redeem 把代币打进 0xdead,换回金库里按比例的一份
|
|
130
|
+
gang create … --base 5|10 --base-vest 30|90|180 [--grad 6|9|12|15] # 3.0 开盘底仓:建币时用 BNB 给底仓金库买 5% / 10%;毕业前锁住(不毕业就永远锁着),毕业后匀速释放给你
|
|
131
|
+
gang base status|release --token 0x… # 底仓金库:大小、释放期、开始时间、已释放、可释放、未释放;release 第一次开始计时,之后把到期的部分转给创建人
|
|
124
132
|
gang create --fair … [--shares <n>] --bond <数量> [--bond-hold …] --bond-days <7-90> # 打新:发币(含 dev 份额)→ 押金
|
|
125
133
|
gang execute --request-id <id>
|
|
126
134
|
gang tx --pending # 在 Binance App 里批准过的交易:按预览时的调用自动找到交易,再按下面这条处理
|
|
@@ -301,6 +309,7 @@ Claude Code:`claude mcp add gang -- gang mcp`。同一台机器上 `baw` 要
|
|
|
301
309
|
| `GANG_LP_FACTORY` / `GANG_TESTNET_LP_FACTORY` | 发币目标那一代的 GangLiquiditySplitterFactory(`--lp`)。默认(CLI 0.20.0+):主网 3.0 `0x98C5…1752`(2.0 `0x8ac8…c0E4`,1.0 `0xE043…C248`,2026-10-31 起),测试网 3.0 `0x4A3a…6B07`(2.0 `0xAEec…36E4`,第一版 2.0 `0x4f15…1619`,1.0 `0xA729…1591`) |
|
|
302
310
|
| `GANG_COMBO_FACTORY` / `GANG_TESTNET_COMBO_FACTORY` | 发币目标那一代的 GangComboSplitterFactory(同时给 `--buyback` / `--lp` / `--split` 中的几个;已有的币用它自己那一代的)。默认(CLI 0.22.0+):主网 3.0 `0x2018…eA39`(2.0 `0xcCeA…98Be`,1.0 `0xd33C…1DBd`,2026-10-31 起),测试网 3.0 `0xdc16…543C`(2.0 `0x312c…84BD`,1.0 `0x52a8…4CFE`;第一版 2.0 没有) |
|
|
303
311
|
| `GANG_CAPPED_FACTORY` / `GANG_TESTNET_CAPPED_FACTORY` | 发币目标那一代的 GangCappedSplitterFactory(有税 V3 发射的 `--tax-cap`)。CLI 0.35.0+;已内置:主网 `0x294E901ecb66af280C1cDD26fD871601d89a2Dca`,测试网 `0xe3f61865d98993dd39c136Af19651C6F6686498A` |
|
|
312
|
+
| `GANG_FLOOR_FACTORY` / `GANG_TESTNET_FLOOR_FACTORY` | 发币目标那一代的 GangFloorModuleFactory(有税 V3 发射的 `--floor`)。已内置:主网 `0x057d2C1557a0E8298a1E00834D6064497f5DC2fC`,测试网 `0x0804C018201D8fFe378b873b41B67f136dbdc3F8` |
|
|
304
313
|
| `GANG_CALL_BOND` / `GANG_TESTNET_CALL_BOND` | GangLaunchpad 3.0 的 GangCallBond(`gang call-bond`)。CLI 0.37.0+;已内置:主网 `0x6d6e4A36e9a231cCc932151cdbFb087Cf3860c3D`,测试网 `0xBE2B8519278E9D31B6c4040bAd35f727fD5d2A70` |
|
|
305
314
|
| `GANG_ROUTER` / `GANG_TESTNET_ROUTER` | 发币目标那一代的 GangRouter 代理(用原生 BNB 买 V3 / 打新,以及已毕业币的所有外盘买卖;已有的币用它自己那一代的);旧名 `GANG_ROUTER_TESTNET` 仍可用。默认:主网 3.0 `0xec97…61e7`(2.0 `0xa832…844a`,1.0 `0xE040…79C4`),测试网 3.0 `0x0954…87b9`(2.0 `0x5a4F…dDAA`,第一版 2.0 `0xb218…FC08`,1.0 `0x6bB6…C9F6`) |
|
|
306
315
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gangfun/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.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/base.js
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { createPublicClient, encodeFunctionData, formatUnits, hexToString, isAddress, parseAbi, zeroAddress } from 'viem'
|
|
2
|
+
import { walletFor } from './fair.js'
|
|
3
|
+
import { atTokenPad, KIND_UNREAD, NOT_ON_MAINNET, PAD3_GEN, padNets, rpcTransport } from './gangpad.js'
|
|
4
|
+
import { revertOf as revertIn, step } from './steps.js'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The opening base of a GangLaunchpad 3.0 curve token (base-v1, docs/SPEC-BASE-VAULT-V2-2026-11-12.md): at create the
|
|
8
|
+
* creator pays exactly previewBaseCost(gradBnb, baseBps) in BNB and the pad buys 5% or 10% of the supply as the curve's
|
|
9
|
+
* first trade, for a per-token GangBaseVault. The vault never trades; after graduation anyone's first release() starts
|
|
10
|
+
* the clock, then it releases linearly to the creator (fixed). A token that never graduates keeps its base locked.
|
|
11
|
+
*
|
|
12
|
+
* `gang create … --base <5|10> --base-vest <30|90|180>` (v3.js builds it with the pieces here) and `gang base
|
|
13
|
+
* status|release`. The pad says whether it has the base (baseVaultImpl); an older pad (mainnet before its upgrade) has
|
|
14
|
+
* no such function and the CLI refuses the flag.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export const BASE_TYPE = 'base-v1'
|
|
18
|
+
const TAX = '(uint16 buyTaxBps, uint16 sellTaxBps, uint16 dividendBps, address recipient)'
|
|
19
|
+
export const BASE_PAD_ABI = parseAbi([
|
|
20
|
+
`function createWithBase(string name, string symbol, string logoURI, string metaURI, ${TAX} tax, uint256 gradBnb, (uint16 baseBps, uint32 vestDays) base) payable returns (address token)`,
|
|
21
|
+
'function baseVaultImpl() view returns (address)',
|
|
22
|
+
'function baseVaultOf(address token) view returns (address)',
|
|
23
|
+
'function baseOf(address token) view returns (uint256)',
|
|
24
|
+
'function previewBaseCost(uint256 gradBnb, uint16 baseBps) view returns (uint256)',
|
|
25
|
+
'error BaseNotOpen()', 'error BadBaseConfig()', 'error WrongBaseVaultImpl()', 'error BaseBuyRefused()', 'error BadMsgValue()',
|
|
26
|
+
'event BaseVaultImplSet(address indexed impl)',
|
|
27
|
+
'event BaseCreated(address indexed token, address indexed vault, uint256 tokens, uint256 cost, uint16 baseBps, uint32 vestDays)',
|
|
28
|
+
])
|
|
29
|
+
export const BASE_VAULT_ABI = parseAbi([
|
|
30
|
+
'function pad() view returns (address)',
|
|
31
|
+
'function token() view returns (address)',
|
|
32
|
+
'function creator() view returns (address)',
|
|
33
|
+
'function startAt() view returns (uint64)',
|
|
34
|
+
'function duration() view returns (uint64)',
|
|
35
|
+
'function total() view returns (uint256)',
|
|
36
|
+
'function released() view returns (uint256)',
|
|
37
|
+
'function releasable() view returns (uint256)',
|
|
38
|
+
'function moduleType() view returns (bytes32)',
|
|
39
|
+
'function release() returns (uint256 amount)',
|
|
40
|
+
'error NotPad()', 'error AlreadyInitialized()', 'error BadInit()', 'error NotGraduated()', 'error NothingToRelease()', 'error Reentered()',
|
|
41
|
+
'event Initialized(address indexed token, address indexed creator, uint32 vestDays)',
|
|
42
|
+
'event Began(uint64 startAt, uint256 total)',
|
|
43
|
+
'event Released(address indexed creator, uint256 amount, uint256 releasedTotal)',
|
|
44
|
+
])
|
|
45
|
+
/** What `gang tx` decodes a base create's and a base vault's logs with. */
|
|
46
|
+
export const BASE_EVENT_ABIS = [BASE_PAD_ABI, BASE_VAULT_ABI]
|
|
47
|
+
const ERC20_ABI = parseAbi([
|
|
48
|
+
'function balanceOf(address) view returns (uint256)',
|
|
49
|
+
'function locked() view returns (bool)',
|
|
50
|
+
'function symbol() view returns (string)',
|
|
51
|
+
])
|
|
52
|
+
|
|
53
|
+
export const HINTS = {
|
|
54
|
+
BaseNotOpen: 'this pad has the opening base but it is closed (no vault implementation set): drop --base',
|
|
55
|
+
BadBaseConfig: '--base 5 takes --base-vest 30 / 90 / 180, --base 10 only 90 / 180; a dividend token takes no base',
|
|
56
|
+
BadMsgValue: 'the BNB sent is not exactly the base cost the pad asks (previewBaseCost): build the create again',
|
|
57
|
+
BaseBuyRefused: 'the pad refused the base buy (never expected from a create): report it to gang',
|
|
58
|
+
NotGraduated: 'the token has not graduated: the base stays locked until it does (and for good if it never does)',
|
|
59
|
+
NothingToRelease: 'nothing has vested since the last release: try again later (gang base status shows when)',
|
|
60
|
+
}
|
|
61
|
+
export const revertOf = (e) => revertIn(e, [BASE_PAD_ABI, BASE_VAULT_ABI], HINTS)
|
|
62
|
+
|
|
63
|
+
/** Base size (bps of the supply) → the release periods offered (spec §4.2; Pad3Module._baseOffered). */
|
|
64
|
+
export const BASE_OFFERED = { 500: [30, 90, 180], 1000: [90, 180] }
|
|
65
|
+
const TOTAL_SUPPLY = 1_000_000_000n * 10n ** 18n
|
|
66
|
+
const POOL_TOKENS = 200_000_000 // what graduation puts in the pair beside the graduation amount
|
|
67
|
+
const VIRTUAL_TOKEN = 1_066_666_666.666_666_7 // CurveLogic3.VIRTUAL_TOKEN, in whole tokens
|
|
68
|
+
const CURVE_SUPPLY = 800_000_000
|
|
69
|
+
|
|
70
|
+
export const BASE_USAGE = '--base <5|10> --base-vest <30|90|180>: the % of the supply bought for your base vault at create (5 or 10) and the days it is released over after graduation (5%: 30 / 90 / 180; 10%: 90 / 180)'
|
|
71
|
+
export const BASE_NO_BOND = 'GangBond does not constrain the base: a bond checks only the creator wallet\'s balance, and the vault keeps refilling that wallet as it releases, so a bond on a base token says nothing about what you do with the base (and a bond lasts 90 days at most). Do not present a bond as a promise about the base'
|
|
72
|
+
export const BASE_LOST = 'If the token never graduates, the base stays locked in the vault for good and the BNB you paid for it stays in the curve: there is no refund, cancel or early release'
|
|
73
|
+
|
|
74
|
+
/** { baseBps, vestDays } from --base / --base-vest, or { error }. */
|
|
75
|
+
export function parseBase(base, vest) {
|
|
76
|
+
if (base == null || !/^(5|10)%?$/.test(String(base).trim())) return { error: BASE_USAGE, got: base ?? null }
|
|
77
|
+
const baseBps = Number(String(base).trim().replace('%', '')) * 100
|
|
78
|
+
if (vest == null) return { error: `--base needs --base-vest <days>: ${baseBps === 500 ? '30, 90 or 180' : '90 or 180'} (the release period after graduation, fixed for good)` }
|
|
79
|
+
const vestDays = Number(String(vest).trim())
|
|
80
|
+
if (!BASE_OFFERED[baseBps].includes(vestDays)) {
|
|
81
|
+
return { error: baseBps === 1000 && vestDays === 30 ? 'a 10% base is released over 90 or 180 days, not 30 (30 days is for a 5% base)' : `--base-vest for a ${baseBps / 100}% base must be ${BASE_OFFERED[baseBps].join(', ')} (days)`, got: vest }
|
|
82
|
+
}
|
|
83
|
+
return { baseBps, vestDays }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Whether `ctx.pad` has the opening base: { open: true, impl } / { open: false, why } / { unread } (RPC error). An older
|
|
88
|
+
* pad has no baseVaultImpl (a revert without data); 0 = closed.
|
|
89
|
+
*/
|
|
90
|
+
export async function baseSupport(ctx) {
|
|
91
|
+
if (ctx.gen !== PAD3_GEN) return { open: false, why: `GangLaunchpad ${ctx.gen ?? ctx.pad} has no opening base (3.0 only)` }
|
|
92
|
+
let impl
|
|
93
|
+
try { impl = await ctx.read(ctx.pad, BASE_PAD_ABI, 'baseVaultImpl') } catch (e) {
|
|
94
|
+
if (missingRead(e)) return { open: false, why: `GangLaunchpad 3.0 on ${ctx.chainId === '97' ? 'the BSC testnet' : 'BSC mainnet'} has no opening base yet (the pad is not upgraded for it)` }
|
|
95
|
+
return { unread: e.shortMessage || e.message.split('\n')[0] }
|
|
96
|
+
}
|
|
97
|
+
if (impl.toLowerCase() === zeroAddress) return { open: false, why: 'the opening base is closed on this pad (no vault implementation set)' }
|
|
98
|
+
return { open: true, impl }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** A call that hit a contract without the function (no data back), never a node's internal error (-32603). */
|
|
102
|
+
export function missingRead(e) {
|
|
103
|
+
if (e?.walk?.((x) => x?.code === -32603)) return false
|
|
104
|
+
if (e?.walk?.((x) => x?.name === 'ContractFunctionZeroDataError')) return true
|
|
105
|
+
const r = e?.walk?.((x) => x?.name === 'ContractFunctionRevertedError')
|
|
106
|
+
return !!r && !r.data && (!r.raw || r.raw === '0x')
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const r = (x, d = 2) => Math.round(x * 10 ** d) / 10 ** d
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The numbers of spec §2 for one base, from the graduation target `gradBnb` (BNB), the size and period and the cost
|
|
113
|
+
* the pad asks (wei). Pool figures are the constant-product pair graduation makes (200M tokens + gradBnb), before the
|
|
114
|
+
* PancakeSwap fee and any tax.
|
|
115
|
+
*/
|
|
116
|
+
export function basePayoff({ gradBnb, baseBps, vestDays, cost, creatorFeeShareBps = 7000 }) {
|
|
117
|
+
const g = Number(gradBnb)
|
|
118
|
+
const b = (baseBps / 10_000) * 1e9 // tokens
|
|
119
|
+
const costBnb = Number(formatUnits(cost, 18))
|
|
120
|
+
const gradPrice = g / POOL_TOKENS
|
|
121
|
+
const atGradPrice = b * gradPrice
|
|
122
|
+
const minimum = (g * b) / (POOL_TOKENS + b) // released and sold into the pair with no other buyer
|
|
123
|
+
const endPrice = (POOL_TOKENS / (POOL_TOKENS + b)) ** 2
|
|
124
|
+
const vq = g / 3
|
|
125
|
+
const baseNet = (vq * b) / (VIRTUAL_TOKEN - b)
|
|
126
|
+
const fee = costBnb / 100
|
|
127
|
+
return {
|
|
128
|
+
costBnb: formatUnits(cost, 18),
|
|
129
|
+
tokens: `${b / 1e6}M (${baseBps / 100}% of the supply)`,
|
|
130
|
+
feeIncluded: `1% curve fee included (${r(fee, 6)} BNB); ${creatorFeeShareBps / 100}% of it is credited back to you as the creator fee (gang creator-fee --claim), so you pay about ${r((fee * (10_000 - creatorFeeShareBps)) / 10_000, 6)} BNB of fee`,
|
|
131
|
+
averagePrice: `about 1/${r(atGradPrice / costBnb, 1)} of the graduation price`,
|
|
132
|
+
worthAtGraduation: `${r(atGradPrice, 4)} BNB at the graduation price (${r(atGradPrice / g, 2)} × the ${g} BNB target)`,
|
|
133
|
+
poolShare: `${r((b / POOL_TOKENS) * 100, 1)}% of the tokens the PancakeSwap pair gets at graduation`,
|
|
134
|
+
youGet: {
|
|
135
|
+
minimum: `about ${r(minimum, 3)} BNB: every release sold at once and no other buyer in the pool (the price then ends at ${Math.round(endPrice * 100)}% of the graduation price). The worst case for holders and the least you get, not a cap`,
|
|
136
|
+
atGraduationPrice: `${r(atGradPrice, 4)} BNB if the price stays at the graduation price`,
|
|
137
|
+
higher: 'more if the price is higher, with no upper limit',
|
|
138
|
+
daysToRecoverCost: `about ${r((costBnb * vestDays) / atGradPrice, 1)} days of release, sold at the graduation price, pay back the cost; after that the base carries no risk for you`,
|
|
139
|
+
releasedPerDay: `${r((b / vestDays / POOL_TOKENS) * 100, 2)}% of the pair's tokens a day (${r(b / vestDays / 1e6, 3)}M tokens)`,
|
|
140
|
+
},
|
|
141
|
+
othersPay: {
|
|
142
|
+
startPrice: `the curve starts ${r((VIRTUAL_TOKEN / (VIRTUAL_TOKEN - b)) ** 2, 2)}× higher than without a base`,
|
|
143
|
+
averageToGraduation: `buyers who take the curve to graduation pay ${r(((1 - baseNet / g) / ((CURVE_SUPPLY - b) / CURVE_SUPPLY) - 1) * 100, 1)}% more on average`,
|
|
144
|
+
},
|
|
145
|
+
figures: 'computed from the curve and the pair graduation makes, before the PancakeSwap fee and any tax',
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** The release schedule in words. */
|
|
150
|
+
export const scheduleLine = (vestDays) => `after graduation, the first gang base release (anyone may call it) starts the clock; from then on the base is released linearly over ${vestDays} days to the creator's wallet — fixed for good, nobody can change the period or the wallet. The time between graduation and that first call does not count: calling it late only delays your own release`
|
|
151
|
+
|
|
152
|
+
/** The tax line of a base create: the creator is usually its own tax recipient (a base token takes no dividend). */
|
|
153
|
+
export function baseTaxLine({ taxed, sellTaxPct, platformTaxPct, selfRecipient }) {
|
|
154
|
+
if (!taxed) return null
|
|
155
|
+
return selfRecipient
|
|
156
|
+
? `you are this token's tax recipient: of the ${sellTaxPct}% sell tax you pay selling released base in the pool, all but the platform's ${platformTaxPct}% of volume comes back to you (a base token has no dividend), so you keep the figures above less about ${platformTaxPct}% of what you sell, and less the PancakeSwap fee (0.25%) and slippage, which none of these figures include`
|
|
157
|
+
: `the ${sellTaxPct}% sell tax on what you sell of the base goes to the recipient (${platformTaxPct}% of volume to the platform), not to you: the figures above are before it, and before the PancakeSwap fee (0.25%) and slippage`
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function baseCtx(testnet) {
|
|
161
|
+
const net = padNets('v3')[testnet ? 'testnet' : 'mainnet']
|
|
162
|
+
if (!net.pad) throw new Error(NOT_ON_MAINNET)
|
|
163
|
+
const client = createPublicClient({ chain: net.chain, transport: rpcTransport(net.rpcs) })
|
|
164
|
+
return { ...net, client, read: (address, abi, functionName, args = []) => client.readContract({ address, abi, functionName, args }) }
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const tok = (x) => formatUnits(x, 18)
|
|
168
|
+
const pctOf = (x) => Number((x * 1_000_000n) / TOTAL_SUPPLY) / 10_000
|
|
169
|
+
const iso = (s) => (Number(s) > 0 ? new Date(Number(s) * 1000).toISOString() : null)
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* The token's base vault as the pad and the vault say, at one block: null when the token has none, { error } when it
|
|
173
|
+
* cannot be read. `now` (seconds) is that block's time. Unreleased is by time (total − what has vested), not the
|
|
174
|
+
* vault's balance: anyone can push a release out (spec §10).
|
|
175
|
+
*/
|
|
176
|
+
export async function baseOf(ctx, token) {
|
|
177
|
+
if (ctx.gen !== PAD3_GEN) return null
|
|
178
|
+
let vault
|
|
179
|
+
try { vault = await ctx.read(ctx.pad, BASE_PAD_ABI, 'baseVaultOf', [token]) } catch (e) {
|
|
180
|
+
if (missingRead(e)) return null // a pad before the base: no token of it has one
|
|
181
|
+
throw e
|
|
182
|
+
}
|
|
183
|
+
if (vault.toLowerCase() === zeroAddress) return null
|
|
184
|
+
// written once at create: the rest is read at one block, so the time and the vault's numbers agree
|
|
185
|
+
const block = await ctx.client.getBlock()
|
|
186
|
+
const at = { blockNumber: block.number }
|
|
187
|
+
const read = (address, abi, functionName, args = []) => ctx.client.readContract({ address, abi, functionName, args, ...at })
|
|
188
|
+
const [bought, vPad, vToken, creator, startAt, duration, total, released, releasable, type, balance, locked] = await Promise.all([
|
|
189
|
+
read(ctx.pad, BASE_PAD_ABI, 'baseOf', [token]),
|
|
190
|
+
...['pad', 'token', 'creator', 'startAt', 'duration', 'total', 'released', 'releasable', 'moduleType'].map((f) => read(vault, BASE_VAULT_ABI, f)),
|
|
191
|
+
read(token, ERC20_ABI, 'balanceOf', [vault]), read(token, ERC20_ABI, 'locked'),
|
|
192
|
+
])
|
|
193
|
+
const now = block.timestamp
|
|
194
|
+
const kind = (() => { try { return hexToString(type, { size: 32 }).replace(/\0+$/, '') } catch { return null } })()
|
|
195
|
+
const ours = vPad.toLowerCase() === ctx.pad.toLowerCase() && vToken.toLowerCase() === token.toLowerCase() && kind === BASE_TYPE
|
|
196
|
+
const started = startAt > 0n
|
|
197
|
+
const vested = !started ? 0n : now - startAt >= duration ? total : (total * (now - startAt)) / duration
|
|
198
|
+
// by time (spec §10): before the start, the whole base bought at create (tokens sent in later are not the base)
|
|
199
|
+
const unreleased = started ? (total > vested ? total - vested : 0n) : bought
|
|
200
|
+
const days = Number(duration / 86_400n)
|
|
201
|
+
return {
|
|
202
|
+
vault, claims: kind, ...(ours ? {} : { warning: 'the vault the pad names does not say it is this token\'s base-v1 vault of this pad: report it to gang' }),
|
|
203
|
+
creator, recipient: creator, baseTokens: tok(bought), basePct: pctOf(bought), vestDays: days,
|
|
204
|
+
graduated: !locked, started,
|
|
205
|
+
startAt: started ? iso(startAt) : 'not started',
|
|
206
|
+
...(started && { endsAt: iso(startAt + duration), elapsedDays: Math.min(days, Number((now - startAt) / 864n) / 100) }),
|
|
207
|
+
total: started ? tok(total) : null,
|
|
208
|
+
released: tok(released), releasable: tok(releasable),
|
|
209
|
+
vestedSoFar: tok(vested), unreleased: tok(unreleased), unreleasedPct: pctOf(unreleased), inVault: tok(balance),
|
|
210
|
+
note: !started
|
|
211
|
+
? locked
|
|
212
|
+
? `locked until graduation. Then the first gang base release starts a ${days}-day linear release to the creator. ${BASE_LOST.replace('you paid', 'the creator paid')}`
|
|
213
|
+
: `graduated, release not started: the first gang base release (anyone may call it) starts the clock; nothing moves in that call`
|
|
214
|
+
: vested >= total && now - startAt >= duration
|
|
215
|
+
? balance === 0n
|
|
216
|
+
? 'fully released: the vault is empty (gang base release has nothing to send)'
|
|
217
|
+
: 'the release period is over: gang base release sends the vault\'s whole balance to the creator'
|
|
218
|
+
: `releasing linearly to the creator until ${iso(startAt + duration)}; unreleased is counted by time (total − vested so far), not from the vault's balance`,
|
|
219
|
+
bond: BASE_NO_BOND,
|
|
220
|
+
raw: { bought, startAt, duration, total, released, releasable, balance, locked, now },
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const SUBS = ['status', 'release']
|
|
225
|
+
const USAGE = 'usage: gang base <status|release> --token <addr> [--testnet] [--calldata] [--from <addr>] — see gang help'
|
|
226
|
+
|
|
227
|
+
/** `gang base <sub>`: a 3.0 curve token's opening base vault. */
|
|
228
|
+
export async function runBase(sub, { opt, flag, out, fail, summarize }) {
|
|
229
|
+
if (!SUBS.includes(sub)) return fail(USAGE, { got: sub ?? null })
|
|
230
|
+
const testnet = flag('testnet')
|
|
231
|
+
let ctx
|
|
232
|
+
try { ctx = baseCtx(testnet) } catch (e) { return fail(e.message) }
|
|
233
|
+
const chainId = Number(ctx.chainId)
|
|
234
|
+
const tn = testnet ? ' --testnet' : ''
|
|
235
|
+
const token = opt('token')
|
|
236
|
+
if (!isAddress(token ?? '')) return fail('--token must be a 3.0 curve token address (0x…)', { got: token ?? null })
|
|
237
|
+
const kind = await atTokenPad(ctx, token)
|
|
238
|
+
if (kind === null) return fail(KIND_UNREAD.error, { token, retry: KIND_UNREAD.retry })
|
|
239
|
+
if (kind !== 'v3') return fail(`not a V3 curve token on a GangLaunchpad (${testnet ? 'BSC testnet' : 'BSC mainnet; add --testnet for a testnet token'})`, { token, chainId, ...(kind && kind !== 'none' && { kind }) })
|
|
240
|
+
let s
|
|
241
|
+
try { s = await baseOf(ctx, token) } catch (e) {
|
|
242
|
+
return fail('could not read the token\'s base vault (RPC error)', { token, detail: e.shortMessage || e.message.split('\n')[0], retry: 'same command again' })
|
|
243
|
+
}
|
|
244
|
+
if (!s) return fail('this token has no opening base (it was not created with --base)', { token, pad: ctx.pad, padGen: ctx.gen })
|
|
245
|
+
const { raw, ...shown } = s
|
|
246
|
+
if (sub === 'status') {
|
|
247
|
+
return out({
|
|
248
|
+
success: true, chainId, token, pad: ctx.pad, ...shown,
|
|
249
|
+
...(raw.locked ? {} : !s.started ? { next: `gang base release --token ${token}${tn}` } : raw.releasable > 0n ? { next: `gang base release --token ${token}${tn}` } : {}),
|
|
250
|
+
})
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// release: anyone; the tokens always go to the creator
|
|
254
|
+
if (s.warning) return fail(s.warning, { vault: s.vault })
|
|
255
|
+
if (raw.locked) return fail(HINTS.NotGraduated, { token, vault: s.vault })
|
|
256
|
+
if (s.started && raw.releasable === 0n) return fail(HINTS.NothingToRelease, { token, vault: s.vault, releasedSoFar: s.released, ...(s.endsAt && { endsAt: s.endsAt }) })
|
|
257
|
+
const me = walletFor(ctx, opt('from'))
|
|
258
|
+
let sim
|
|
259
|
+
try { await ctx.client.simulateContract({ account: me, address: s.vault, abi: BASE_VAULT_ABI, functionName: 'release' }) } catch (e) {
|
|
260
|
+
const rv = revertOf(e)
|
|
261
|
+
sim = rv ? { reverted: true, ...rv } : { reverted: false, error: e.shortMessage || e.message.split('\n')[0] }
|
|
262
|
+
}
|
|
263
|
+
if (sim) return out({ success: false, step: 'base-release', ...sim })
|
|
264
|
+
const data = encodeFunctionData({ abi: BASE_VAULT_ABI, functionName: 'release' })
|
|
265
|
+
const mine = String(me).toLowerCase() === s.creator.toLowerCase()
|
|
266
|
+
return out(step(ctx, { from: me, to: s.vault, data }, {
|
|
267
|
+
step: 'base-release', chainId, token, vault: s.vault, creator: s.creator,
|
|
268
|
+
...(s.started
|
|
269
|
+
? { amount: s.releasable, note: `sends what has vested and was not sent yet (about ${s.releasable} tokens now; a little more by the time it lands) to the creator ${s.creator}${mine ? ' (you)' : ', not to the wallet that calls'}` }
|
|
270
|
+
: { amount: '0', starts: true, note: `starts the ${s.vestDays}-day release now: the vault records its balance (${s.inVault} tokens) as the total and sends nothing in this call; from then on the creator ${s.creator}${mine ? ' (you)' : ''} can release what has vested` }),
|
|
271
|
+
}, flag('calldata'), summarize))
|
|
272
|
+
}
|
package/src/capabilities.js
CHANGED
|
@@ -64,6 +64,7 @@ export const COMMANDS = [
|
|
|
64
64
|
c('creator-fee --claim --to', 'preview', 'high', '0.23.0', 'Creator only: claim the creator fee to another address'),
|
|
65
65
|
c('upload-logo', 'publish', 'medium', '0.2.0', 'Publish a local image or a URL on gang.fun, at once: only a file the user named', { needsUserConfirmation: true }),
|
|
66
66
|
c('create', 'preview', 'high', '0.1.0', 'Launch a token. Its name, tax, logo and links never change; a launch in one command also buys, bonds or binds modules'),
|
|
67
|
+
c('create --base', 'preview', 'high', '0.40.0', 'Create a 3.0 curve token that buys 5% or 10% of its supply for a base vault in the same tx, paid in BNB: locked until graduation (for good if it never graduates), then released linearly to the creator'),
|
|
67
68
|
c('mint', 'preview', 'medium', '0.12.0', 'Buy shares of a 打新 or Mint Flywheel sale'),
|
|
68
69
|
c('withdraw', 'preview', 'medium', '0.12.0', 'Sell shares back at the mint price, less the exit fee, before the sale fills', { riskIf: { 'break-bond': { risk: 'high', why: '打新 only: gives up the whole bond' } } }),
|
|
69
70
|
c('claim', 'preview', 'low', '0.12.0', 'Claim my dividend or holder reward'),
|
|
@@ -95,6 +96,12 @@ export const COMMANDS = [
|
|
|
95
96
|
c('capped distribute', 'preview', 'low', '0.35.0', 'Anyone: split the bound quote (payees up to the cap), or send another asset to 0xdead'),
|
|
96
97
|
c('capped chunk', 'preview', 'low', '0.35.0', 'Anyone: one buy-back or liquidity chunk'),
|
|
97
98
|
]),
|
|
99
|
+
...baseModule('floor', '0.39.0', "That slot's payee only", [
|
|
100
|
+
c('floor redeem', 'preview', 'high', '0.39.0', 'Holder: give up tokens (to 0xdead, for good) for their share of the floor treasury, less the fee'),
|
|
101
|
+
c('floor distribute', 'preview', 'low', '0.39.0', 'Anyone: split the bound quote and push the payees their part, or send another asset to 0xdead'),
|
|
102
|
+
]),
|
|
103
|
+
c('base status', 'read', 'none', '0.40.0', "A 3.0 token's opening base: its vault, size, release period, start, released, releasable and unreleased (by time)"),
|
|
104
|
+
c('base release', 'preview', 'low', '0.40.0', "Anyone, after graduation: start the base's linear release (first call), then send what has vested to the creator"),
|
|
98
105
|
c('promote buy', 'preview', 'medium', '0.34.0', "Buy naming a promoter: a wallet's first trade of the token binds it for good, on the curve"),
|
|
99
106
|
c('promote status', 'read', 'none', '0.34.0', "A token's promoter terms, a wallet's binding and what it can claim"),
|
|
100
107
|
c('promote earnings', 'read', 'none', '0.34.0', 'A promoter wallet: shares to claim on the curve and in the pool'),
|
package/src/chain.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createPublicClient, formatEther, parseAbi, parseEther, encodeFunctionData, decodeEventLog, isAddress, zeroAddress } from 'viem'
|
|
1
|
+
import { createPublicClient, formatEther, hexToString, parseAbi, parseEther, encodeFunctionData, decodeEventLog, isAddress, zeroAddress } from 'viem'
|
|
2
2
|
import { bsc } from 'viem/chains'
|
|
3
3
|
import { SOFT_ABI, V2_ABI, S_ABI, ERC20_ABI, WBNB_ABI } from './abi.js'
|
|
4
4
|
import { genOf, padNets, rpcTransport } from './gangpad.js'
|
|
@@ -292,13 +292,18 @@ export const calldata = {
|
|
|
292
292
|
* reads beside the V2 / Soft / U / S pads'. Integers stay as on chain (strings), marked `units: 'raw'`: amounts are in wei
|
|
293
293
|
* (18 decimals), bps / shares / counts as they are; the V2 / Soft events are formatted (no `units`).
|
|
294
294
|
*/
|
|
295
|
-
export function decodeLogs(logs, abis) {
|
|
295
|
+
export function decodeLogs(logs, abis, firstFor = null) {
|
|
296
296
|
const events = []
|
|
297
297
|
for (const log of logs) {
|
|
298
|
-
|
|
298
|
+
// an event signature several module kinds share (Split with three amounts): the emitting module's own ABI first
|
|
299
|
+
const first = firstFor ? firstFor(log) : null
|
|
300
|
+
for (const abi of first ? [...first, ...abis] : abis) {
|
|
299
301
|
try {
|
|
300
302
|
const ev = decodeEventLog({ abi, data: log.data, topics: log.topics })
|
|
301
|
-
events.push({
|
|
303
|
+
events.push({
|
|
304
|
+
event: ev.eventName, contract: log.address, units: 'raw', ...(first === UNKNOWN_KIND_ABI && { kindUnread: true }),
|
|
305
|
+
...Object.fromEntries(Object.entries(ev.args).map(([k, v]) => [k, typeof v === 'bigint' ? v.toString() : v])),
|
|
306
|
+
})
|
|
302
307
|
break
|
|
303
308
|
} catch { /* other contract / event */ }
|
|
304
309
|
}
|
|
@@ -306,15 +311,35 @@ export function decodeLogs(logs, abis) {
|
|
|
306
311
|
return events
|
|
307
312
|
}
|
|
308
313
|
|
|
309
|
-
|
|
310
|
-
|
|
314
|
+
const MODULE_TYPE_ABI = parseAbi(['function moduleType() view returns (bytes32)'])
|
|
315
|
+
/** What a shared-signature event decodes to when its module's kind could not be read: no kind's field names are guessed. */
|
|
316
|
+
const UNKNOWN_KIND_ABI = [parseAbi(['event Split(uint256 incoming, uint256 firstPart, uint256 secondPart)'])]
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* For logs whose topic0 is `topic` — an event signature several module kinds share, whose fields mean different things
|
|
320
|
+
* in each — the decoder of the emitting module's own kind, asked of its moduleType(): `byType(kind)`. A module whose
|
|
321
|
+
* kind is unread or unknown decodes with neutral field names and `kindUnread: true`, never with another kind's.
|
|
322
|
+
*/
|
|
323
|
+
export async function firstByModuleType(c, logs, topic, byType) {
|
|
324
|
+
const addrs = [...new Set(logs.filter((l) => l.topics[0] === topic).map((l) => l.address.toLowerCase()))]
|
|
325
|
+
const types = new Map(await Promise.all(addrs.map(async (a) => [a, await c.readContract({ address: a, abi: MODULE_TYPE_ABI, functionName: 'moduleType' })
|
|
326
|
+
.then((t) => hexToString(t, { size: 32 }).replace(/\0+$/, '')).catch(() => null)])))
|
|
327
|
+
return (log) => (log.topics[0] === topic ? byType(types.get(log.address.toLowerCase())) ?? UNKNOWN_KIND_ABI : null)
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* `extraAbis`: decoders for logs not from the V2 / Soft / U / S pads (see decodeLogs). `shared`: { topic, byType } for
|
|
332
|
+
* an event signature several module kinds share (firstByModuleType).
|
|
333
|
+
*/
|
|
334
|
+
export async function decodeTx(hash, extraAbis = [], shared = null) {
|
|
311
335
|
const r = await client.waitForTransactionReceipt({ hash, timeout: 120_000 })
|
|
336
|
+
const firstFor = shared ? await firstByModuleType(client, r.logs, shared.topic, shared.byType) : null
|
|
312
337
|
const events = []
|
|
313
338
|
const known = new Map(PADS.map((p) => [p.address.toLowerCase(), p]))
|
|
314
339
|
for (const log of r.logs) {
|
|
315
340
|
const pad = known.get(log.address.toLowerCase())
|
|
316
341
|
if (!pad) {
|
|
317
|
-
events.push(...decodeLogs([log], extraAbis))
|
|
342
|
+
events.push(...decodeLogs([log], extraAbis, firstFor))
|
|
318
343
|
continue
|
|
319
344
|
}
|
|
320
345
|
try {
|
package/src/creatorfee.js
CHANGED
|
@@ -3,6 +3,7 @@ import { revertOf as revertIn, step, units } from './steps.js'
|
|
|
3
3
|
import { atTokenPad, CREATOR_FEE_ABI, creatorFeeShareOf, NOT_ON_MAINNET, padNets, rpcTransport } from './gangpad.js'
|
|
4
4
|
import { walletFor } from './fair.js'
|
|
5
5
|
import { promoteTermsOf } from './promote.js'
|
|
6
|
+
import { floorVerified } from './floor.js'
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* `gang creator-fee` — the GangLaunchpad 2.0 creator fee (docs/SPEC-CURVE-CREATOR-FEE-2026-10-31.md): of the 1% fee on
|
|
@@ -23,7 +24,7 @@ const CURVES_ABI = parseAbi([
|
|
|
23
24
|
const SYMBOL_ABI = parseAbi(['function symbol() view returns (string)'])
|
|
24
25
|
const MODULE_TYPE_ABI = parseAbi(['function moduleType() view returns (bytes32)'])
|
|
25
26
|
const QUOTE_ABI = parseAbi(['function quote() view returns (address)'])
|
|
26
|
-
const CAP_QUOTE_ABI = parseAbi(['function capQuote() view returns (address)'])
|
|
27
|
+
const CAP_QUOTE_ABI = parseAbi(['function capQuote() view returns (address)', 'function floorQuote() view returns (address)', 'function floorToken() view returns (address)'])
|
|
27
28
|
const ABIS = [CREATOR_FEE_ABI, CURVES_ABI]
|
|
28
29
|
const HINTS = {
|
|
29
30
|
NotCreator: 'only the token\'s creator (the wallet that created it) can claim its creator fee; pass that wallet with --from',
|
|
@@ -68,7 +69,7 @@ export async function createNote(ctx, net = '') {
|
|
|
68
69
|
export function payOutCmd(moduleType, at, net = '', { asset, assetSymbol } = {}) {
|
|
69
70
|
const t = String(moduleType ?? '')
|
|
70
71
|
const base = t.startsWith('buyback-burn-') ? 'gang buyback' : t === 'lp-burn-v1' ? 'gang lp'
|
|
71
|
-
: t === 'split-v1' ? 'gang split' : t === 'combo-v1' ? 'gang combo' : t === 'capped-v1' ? 'gang capped' : null
|
|
72
|
+
: t === 'split-v1' ? 'gang split' : t === 'combo-v1' ? 'gang combo' : t === 'capped-v1' ? 'gang capped' : t === 'floor-v1' ? 'gang floor' : null
|
|
72
73
|
if (!base) return null
|
|
73
74
|
const splitter = base === 'gang buyback' || base === 'gang lp'
|
|
74
75
|
const m = `--module ${at ?? '<module>'}`
|
|
@@ -77,6 +78,11 @@ export function payOutCmd(moduleType, at, net = '', { asset, assetSymbol } = {})
|
|
|
77
78
|
? `${base} distribute ${m} --asset ${asset}${net} (anyone) sends ALL of it to 0xdead: ${assetSymbol ?? 'this asset'} is not the module's quote, so it is burned, paid to nobody`
|
|
78
79
|
: `${base} distribute ${m}${net} (anyone) then splits it as the tax: the payees' part is pushed and counted against the cap (so it only uses the cap up sooner), the rest set aside for buy-back and liquidity`
|
|
79
80
|
}
|
|
81
|
+
if (base === 'gang floor') {
|
|
82
|
+
return asset
|
|
83
|
+
? `${base} distribute ${m} --asset ${asset}${net} (anyone) sends ALL of it to 0xdead: ${assetSymbol ?? 'this asset'} is not the module's quote, so it is burned, paid to nobody`
|
|
84
|
+
: `${base} distribute ${m}${net} (anyone) then splits it as the tax: the payees' part (if the module has payees and their cap is not reached) is pushed and counted against the cap, the rest joins the treasury every holder can redeem`
|
|
85
|
+
}
|
|
80
86
|
// a fee in another quote than the module's own: split / distribute of the bound quote never moves it
|
|
81
87
|
if (asset) {
|
|
82
88
|
return splitter
|
|
@@ -95,13 +101,15 @@ export function claimToModule({ moduleType, at, net = '', bound, quote, quoteSym
|
|
|
95
101
|
const other = !!bound && !!quote && bound.toLowerCase() !== quote.toLowerCase()
|
|
96
102
|
const unbound = !bound || /^0x0{40}$/.test(bound)
|
|
97
103
|
// a capped recipient burns every asset but its quote: unbound, its quote is already fixed (capQuote)
|
|
98
|
-
const
|
|
104
|
+
const burns = moduleType === 'capped-v1' || moduleType === 'floor-v1'
|
|
105
|
+
const noun = moduleType === 'floor-v1' ? 'floor module' : 'capped recipient'
|
|
106
|
+
const burned = burns && !!quote && (unbound ? !!capQuote && capQuote.toLowerCase() !== quote.toLowerCase() : other)
|
|
99
107
|
const payOut = payOutCmd(moduleType, at, net, (other && !unbound) || burned ? { asset: quote, assetSymbol: quoteSymbol } : {})
|
|
100
108
|
if (!payOut) return { payOut: null, warning: null }
|
|
101
|
-
if (burned) return { payOut, warning: `the
|
|
109
|
+
if (burned) return { payOut, warning: `the ${noun}'s quote is ${(unbound ? capSymbol : boundSymbol) ?? (unbound ? capQuote : bound)}, this fee is in ${quoteSymbol ?? quote}: it sends any other asset to 0xdead in full, so a fee claimed there is burned` }
|
|
102
110
|
// its quote unknown (capQuote() unread): never stay silent about a burn that may follow
|
|
103
|
-
if (
|
|
104
|
-
return { payOut, warning: `could not read the
|
|
111
|
+
if (burns && unbound && !capQuote) {
|
|
112
|
+
return { payOut, warning: `could not read the ${noun}'s quote (${moduleType === 'floor-v1' ? 'floorQuote' : 'capQuote'}): if it is not ${quoteSymbol ?? quote}, this fee's quote, a fee claimed there is burned (it sends any other asset to 0xdead in full). Check gang ${moduleType === 'floor-v1' ? 'floor' : 'capped'} status --module ${at ?? '<module>'}${net} first` }
|
|
105
113
|
}
|
|
106
114
|
if (unbound) return { payOut, warning: 'the module is not bound to a token yet: it pays this out only once it is bound (its launch binds it)' }
|
|
107
115
|
if (!other) return { payOut, warning: null }
|
|
@@ -110,7 +118,23 @@ export function claimToModule({ moduleType, at, net = '', bound, quote, quoteSym
|
|
|
110
118
|
warning: `the module's own quote is ${boundSymbol ?? bound}, this fee is in ${quoteSymbol ?? quote}: split / distribute of the module's quote leave it where it is`,
|
|
111
119
|
}
|
|
112
120
|
}
|
|
113
|
-
|
|
121
|
+
/**
|
|
122
|
+
* `--to` a contract that says it is a floor module and is not known to be one (`verified`: false, or null when the
|
|
123
|
+
* check could not be read; `hasFactory`: whether the token's pad generation has a floor factory to check against). Pure.
|
|
124
|
+
*/
|
|
125
|
+
export function unverifiedFloorNote(verified, hasFactory) {
|
|
126
|
+
if (verified === null) return 'could not check whether GangFloorModuleFactory made this contract (RPC error): run the command again before claiming there'
|
|
127
|
+
if (!hasFactory) return 'this contract says it is a floor module, but this token\'s GangLaunchpad generation has no floor factory to check it against: a fee claimed there is in that contract\'s hands, and nothing here confirms it is a treasury holders can redeem'
|
|
128
|
+
return 'this contract says it is a floor module, but GangFloorModuleFactory did not make it: a fee claimed there is in its hands, not in a treasury holders can redeem'
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** `--to` a floor module that was not cloned for `token` (or whose token could not be read): what to say. Pure. */
|
|
132
|
+
export function floorModuleOfAnother(floorToken, token) {
|
|
133
|
+
if (!floorToken) return 'could not read which token this floor module was cloned for: if it is not this token, the fee goes to another token\'s holders and payees. Check gang floor status --module first'
|
|
134
|
+
if (floorToken.toLowerCase() === String(token).toLowerCase()) return null
|
|
135
|
+
return `this floor module was cloned for another token (${floorToken}), not this one: a fee claimed there goes to that token's payees and holders, and this token's holders get nothing of it`
|
|
136
|
+
}
|
|
137
|
+
const LAUNCH_TYPES = { buyback: 'buyback-burn-v4', lp: 'lp-burn-v1', split: 'split-v1', combo: 'combo-v1', capped: 'capped-v1', floor: 'floor-v1' }
|
|
114
138
|
|
|
115
139
|
/** Added to the create's note when the tax recipient is one of the dev's modules (`module`: its name; `kind`: buyback | lp | split | combo | capped). */
|
|
116
140
|
export const notThroughModule = (module, { token, at, net = '', kind } = {}) =>
|
|
@@ -266,10 +290,23 @@ export async function runCreatorFee({ opt, flag, out, fail, summarize }) {
|
|
|
266
290
|
let toModule = { payOut: null, warning: null }
|
|
267
291
|
if (toType && payOutCmd(toType, to)) {
|
|
268
292
|
const bound = await ctx.read(to, QUOTE_ABI, 'quote').catch(() => null)
|
|
269
|
-
const capQuote = toType === 'capped-v1' ? await ctx.read(to, CAP_QUOTE_ABI, 'capQuote').catch(() => null)
|
|
293
|
+
const capQuote = toType === 'capped-v1' ? await ctx.read(to, CAP_QUOTE_ABI, 'capQuote').catch(() => null)
|
|
294
|
+
: toType === 'floor-v1' ? await ctx.read(to, CAP_QUOTE_ABI, 'floorQuote').catch(() => null) : null
|
|
270
295
|
const sym = (a) => (a && !/^0x0{40}$/.test(a) ? ctx.read(a, SYMBOL_ABI, 'symbol').catch(() => null) : null)
|
|
271
296
|
const [quoteSymbol, boundSymbol, capSymbol] = await Promise.all([sym(quote), sym(bound), sym(capQuote)])
|
|
272
297
|
toModule = claimToModule({ moduleType: toType, at: to, net, bound, quote, quoteSymbol, boundSymbol, capQuote, capSymbol })
|
|
298
|
+
// a floor module serves one token: a fee claimed into another token's module goes to that token's holders and payees
|
|
299
|
+
if (toType === 'floor-v1') {
|
|
300
|
+
// only a module GangFloorModuleFactory made does what a floor module does: nothing is promised about any other
|
|
301
|
+
const verified = await floorVerified(ctx.read, to, ctx.floorFactory ?? null)
|
|
302
|
+
if (verified !== true) {
|
|
303
|
+
toModule = { payOut: 'what this contract does with a fee sent to it is unknown', warning: unverifiedFloorNote(verified, !!ctx.floorFactory) }
|
|
304
|
+
} else {
|
|
305
|
+
const floorToken = await ctx.read(to, CAP_QUOTE_ABI, 'floorToken').catch(() => null)
|
|
306
|
+
const note = floorModuleOfAnother(floorToken, token)
|
|
307
|
+
if (note) toModule = { ...toModule, warning: toModule.warning ? `${note}. Also: ${toModule.warning}` : note }
|
|
308
|
+
}
|
|
309
|
+
}
|
|
273
310
|
}
|
|
274
311
|
const { payOut, warning } = toModule
|
|
275
312
|
return out(step(ctx, { from: me, to: ctx.pad, data }, {
|
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', 'vault', 'testnet', 'calldata', 'from', 'note', 'conf', 'reveal-after',
|
|
16
|
+
'quote', 'ref-pool', 'grad', 'vault', 'base', 'base-vest', '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',
|