@gangfun/cli 0.43.2 → 0.44.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 +2 -2
- package/README.zh-CN.md +3 -3
- package/package.json +1 -1
- package/src/capabilities.js +1 -0
- package/src/gradreward.js +38 -11
- package/src/index.js +11 -5
- package/src/launch.js +11 -4
- package/src/v3.js +22 -9
package/README.md
CHANGED
|
@@ -24,9 +24,9 @@ Operate [gang.fun](https://gang.fun) from a Binance **Agentic Wallet**. Curve bu
|
|
|
24
24
|
|
|
25
25
|
**Opening base (0.40.0+, open on BSC mainnet and testnet):** `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
26
|
|
|
27
|
-
**Graduation reward (冲毕业奖励, 0.42.0+, open on BSC mainnet and testnet since 2026-11-17;
|
|
27
|
+
**Graduation reward (冲毕业奖励, 0.42.0+, open on BSC mainnet and testnet since 2026-11-17; with `--countdown-reward` and its carry 0.44.0+, open on mainnet and testnet since 2026-11-17):** `gang create … --grad-reward <seed> [--gr-min-buy <amount>] [--gr-entries <1-20>] [--gr-last <0-50>] [--gr-refund-days <30-180>]` creates a GangLaunchpad 3.0 curve token with a reward pool you seed in the token's quote (pulled in the create, so the CLI asks you to approve it first; at least 0.1 BNB worth). The pad keeps the last `--gr-entries` curve buys (default 10) that each actually spend `--gr-min-buy` (default 0.01 BNB worth), with the Agent gate on; the buy that graduates the token always counts. At graduation that buy gets `--gr-last` % of the pool on top (default 30), and all entries, it included, split the rest by what each spent. A curve sell takes out that wallet's earlier entries (a later buy counts again). Buyers claim for 180 days after graduation, then anyone sweeps the rest back to you. If the token does not graduate, `--gr-refund-days` (default 90) after the create you may ask for the pool back: the request is public for 7 days (a graduation in that time pays the buyers as usual), then you have 3 days to take it, else it lapses. Buyers pay only the usual price and fee: the pool is your money, paid to the last buys before graduation by a fixed public rule. Works with `--promote` on an untaxed token or with `--recipient`, and with `--countdown-reward`: then `--gr-carry` % of the pool (default 20) goes into the token's countdown reward module at graduation, and the unclaimed rest goes there too. Not with `--vault` / `--base` / `--fair` / `--fly` or a launch in one command. `gang buy` / `gang sell` previews say under `rewards.gradReward` whether the buy counts and what a sell takes out. `gang grad-reward status --token 0x…` shows the pool, rules, list, refund state and what you can claim; `claim`, `settle`, `sweep`, `retry-carry`, `refund-request`, `refund-cancel` and `refund` do the rest.
|
|
28
28
|
|
|
29
|
-
**Countdown reward (倒计时奖励, 0.43.2+, BSC mainnet and testnet):** `gang create … --buy-tax 3 --sell-tax 3 --countdown-reward --cd-max-payout <amount> [--cd-window 60m] [--cd-max-round 6h] [--cd-idle 30d] [--cd-payout 30] [--cd-last 20] [--cd-dev 0] [--cd-entries 10] [--cd-min-buy 0.05] [--cd-min-pot 0.1] [--cd-seed <amount>]` makes the token's tax recipient its own GangCountdownReward module (`countdown-v1`): your share of the pool tax becomes a reward for buyers. After graduation, each buy of at least `--cd-min-buy` through the module puts the countdown `--cd-window` ahead, but a round never runs past `--cd-max-round` from its first counted buy. When the countdown runs out, the round's last `--cd-entries` counted buys share `--cd-payout` % of the pool, never more than `--cd-max-payout` (required): equal shares, the very last buy `--cd-last` % of the payout on top; a round that ends at its cap pays equal shares only, since its end time was public. No round starts under `--cd-min-pot`; after `--cd-idle` days with no counted buy anyone may pay the last round once more. `--cd-dev` % of the arriving tax stays yours. `--cd-min-buy` / `--cd-min-pot` default to 0.05 / 0.1 BNB on a WBNB-quoted token and must be given for another quote. The preview shows what share of pool volume reaches the pool, what a round can pay at most and what taking every slot costs (slots × minimum buy × buy tax). Be clear with buyers: anyone, the creator included, can take slots with several wallets, and only buys through the module count, as the gang CLI and MCP send them (`gang buy`; not PancakeSwap's router, aggregators or GangRouter; the gang.fun site only shows the countdown). Like `--floor`, the module is cloned for the token's address first, then the token is created there, bound, and `--cd-seed` (if any) approved and funded: one tx per run, re-run the same command. A changed tax rate or `--cd-*` setting is refused. A fund preview that doesn't show up in the module's books is built again only with `--cd-seed-again`; the first may still be waiting for approval in the Binance App, so approve only one.
|
|
29
|
+
**Countdown reward (倒计时奖励, 0.43.2+, BSC mainnet and testnet):** `gang create … --buy-tax 3 --sell-tax 3 --countdown-reward --cd-max-payout <amount> [--cd-window 60m] [--cd-max-round 6h] [--cd-idle 30d] [--cd-payout 30] [--cd-last 20] [--cd-dev 0] [--cd-entries 10] [--cd-min-buy 0.05] [--cd-min-pot 0.1] [--cd-seed <amount>]` makes the token's tax recipient its own GangCountdownReward module (`countdown-v1`): your share of the pool tax becomes a reward for buyers. After graduation, each buy of at least `--cd-min-buy` through the module puts the countdown `--cd-window` ahead, but a round never runs past `--cd-max-round` from its first counted buy. When the countdown runs out, the round's last `--cd-entries` counted buys share `--cd-payout` % of the pool, never more than `--cd-max-payout` (required): equal shares, the very last buy `--cd-last` % of the payout on top; a round that ends at its cap pays equal shares only, since its end time was public. No round starts under `--cd-min-pot`; after `--cd-idle` days with no counted buy anyone may pay the last round once more. `--cd-dev` % of the arriving tax stays yours. `--cd-min-buy` / `--cd-min-pot` default to 0.05 / 0.1 BNB on a WBNB-quoted token and must be given for another quote. The preview shows what share of pool volume reaches the pool, what a round can pay at most and what taking every slot costs (slots × minimum buy × buy tax). Be clear with buyers: anyone, the creator included, can take slots with several wallets, and only buys through the module count, as the gang CLI and MCP send them (`gang buy`; not PancakeSwap's router, aggregators or GangRouter; the gang.fun site only shows the countdown). Like `--floor`, the module is cloned for the token's address first, then the token is created there, bound, and `--cd-seed` (if any) approved and funded: one tx per run, re-run the same command. A changed tax rate or `--cd-*` setting is refused. A fund preview that doesn't show up in the module's books is built again only with `--cd-seed-again`; the first may still be waiting for approval in the Binance App, so approve only one. With `--grad-reward` too (0.44.0+): `--gr-carry` % of that pool (default 20) goes into this module at graduation (see the graduation reward above). `gang buy` of a graduated countdown token goes through the module with `mustCount` (a buy that would not count is refused before anything is built; `--cd-uncounted` buys anyway); its preview's `rewards.countdown` says whether it counts and why, the round, its deadline and cap, the pool and your estimated share. `gang countdown status|claim|settle|finalize|claim-dev --token 0x… [--to 0x…]` does the rest. Factories: mainnet `0xa1e3117a59104de7D97667cF22f9AB886a5f2957`, testnet `0x0f83ABC7d39C0d043d3f5612E304D9395B5fe582`.
|
|
30
30
|
|
|
31
31
|
**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`).
|
|
32
32
|
|
package/README.zh-CN.md
CHANGED
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
|
|
25
25
|
**开盘底仓(0.40.0+,BSC 主网和测试网可用):** `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
26
|
|
|
27
|
-
**冲毕业奖励(0.42.0+,BSC 主网和测试网 2026-11-17
|
|
27
|
+
**冲毕业奖励(0.42.0+,BSC 主网和测试网 2026-11-17 起可用;和 `--countdown-reward` 一起用、转一部分给倒计时奖励要 0.44.0+,主网和测试网 2026-11-17 起已开):** `gang create … --grad-reward <种子钱> [--gr-min-buy <金额>] [--gr-entries <1-20>] [--gr-last <0-50>] [--gr-refund-days <30-180>]` 在 GangLaunchpad 3.0 上建一个曲线币,同时用这个币的报价币放进一笔奖励池。种子钱在建币时拉走,所以 CLI 会先让你批准;至少值 0.1 BNB。
|
|
28
28
|
|
|
29
29
|
- **谁能分**:pad 记下最后 `--gr-entries` 笔(默认 10)曲线买入,每笔都要实际花掉 `--gr-min-buy`(默认值 0.01 BNB),而且 Agent 门槛开着;把币推过毕业线的那一笔一律计入。
|
|
30
30
|
- **怎么分**:毕业时,这一笔先额外拿奖励池的 `--gr-last`%(默认 30),剩下的由所有格子(包括这一笔)按各自实际花掉的金额分。
|
|
31
31
|
- **卖出**:在曲线上卖出,这个钱包之前的格子全部失效;之后再买会重新计入。
|
|
32
32
|
- **领取**:毕业后 180 天内买家自己领,之后任何人都可以把剩下的部分退给你。
|
|
33
33
|
- **不毕业**:建币满 `--gr-refund-days` 天(默认 90)后,你可以申请撤回。申请公示 7 天,期间毕业照常发放;公示期满后 3 天内可以取回,过期就要重新申请。
|
|
34
|
-
- **组合**:可以和 `--promote` 一起用(不带税,或者带 `--recipient
|
|
34
|
+
- **组合**:可以和 `--promote` 一起用(不带税,或者带 `--recipient`);也可以和 `--countdown-reward` 一起用:毕业时奖励池的 `--gr-carry`%(默认 20)转进这个币的倒计时奖励模块,没领的剩余也转进去,不退给你;不能和 `--vault` / `--base` / `--fair` / `--fly` 或一条命令发射一起用。
|
|
35
35
|
|
|
36
36
|
买家只付正常的价格和手续费:奖励池是你自己的钱,按公开的固定规则发给毕业前最后几笔买入。`gang buy` / `gang sell` 的预览会在 `rewards.gradReward` 里说明这笔会不会计入、卖出会让哪些格子失效。`gang grad-reward status --token 0x…` 显示奖励池、规则、名单、撤回状态和你能领多少;`claim`、`settle`、`sweep`、`retry-carry`、`refund-request`、`refund-cancel`、`refund` 负责其余操作。
|
|
37
37
|
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
- **怎么分**:倒计时结束时,这一轮最后 `--cd-entries` 笔计入的买入平分奖励池的 `--cd-payout`%(不超过必填的 `--cd-max-payout`),最后一笔再多拿这一轮的 `--cd-last`%。到上限结束的轮次结束时间是公开的,所以只平分,不发额外部分。
|
|
42
42
|
- **其他**:奖励池低于 `--cd-min-pot` 时不开新轮;连续 `--cd-idle` 天没有计入的买入,任何人可以把最后一轮再发一次。`--cd-dev`% 的税留给你。WBNB 报价的币 `--cd-min-buy` / `--cd-min-pot` 默认 0.05 / 0.1 BNB,其他报价币必须写明。
|
|
43
43
|
- **预览**:写明池子成交额有多少进奖励池、一轮最多发多少、占满所有名额要花多少(名额数 × 最低买入 × 买入税)。要如实告诉买家:任何人(包括你自己)都可以用多个钱包占名额;只有 gang CLI / MCP 通过模块发出的买入才算(`gang buy`;PancakeSwap 路由、聚合器、GangRouter 都不算;gang.fun 网站只展示倒计时)。
|
|
44
|
-
- **步骤**:和 `--floor` 一样,先算出币的地址并为它克隆模块,再在这个地址建币、bind,有 `--cd-seed` 时再批准和 fund。每次运行一笔交易,重复运行同一条命令。中途改了税率或 `--cd-*` 设置会被拒绝。fund 预览构建过、但模块账目里还看不到时,只有加 `--cd-seed-again` 才会再构建一笔;前一笔可能还在 Binance App
|
|
44
|
+
- **步骤**:和 `--floor` 一样,先算出币的地址并为它克隆模块,再在这个地址建币、bind,有 `--cd-seed` 时再批准和 fund。每次运行一笔交易,重复运行同一条命令。中途改了税率或 `--cd-*` 设置会被拒绝。fund 预览构建过、但模块账目里还看不到时,只有加 `--cd-seed-again` 才会再构建一笔;前一笔可能还在 Binance App 里等批准,两笔只批一笔。也可以同时加 `--grad-reward`(0.44.0+):毕业时冲毕业奖励池的 `--gr-carry`%(默认 20)转进这个模块(见上面的冲毕业奖励)。
|
|
45
45
|
|
|
46
46
|
毕业后的 `gang buy` 默认通过模块买入并要求计入(不计入的买单在构建前就会拒绝;`--cd-uncounted` 照买不计入),预览的 `rewards.countdown` 写明计不计入、原因、当前轮次、截止时间和上限、奖励池、你的预计份额。`gang countdown status|claim|settle|finalize|claim-dev --token 0x… [--to 0x…]` 负责其余操作。工厂:主网 `0xa1e3117a59104de7D97667cF22f9AB886a5f2957`,测试网 `0x0f83ABC7d39C0d043d3f5612E304D9395B5fe582`。
|
|
47
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gangfun/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.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/capabilities.js
CHANGED
|
@@ -66,6 +66,7 @@ export const COMMANDS = [
|
|
|
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
67
|
c('create --grad-reward', 'preview', 'high', '0.42.0', 'Create a 3.0 curve token with a reward pool the creator seeds for the last curve buys before graduation (by what each spent; the graduating buy gets a share on top); refundable only after a public notice if it never graduates'),
|
|
68
68
|
c('create --countdown-reward', 'preview', 'high', '0.43.2', "Launch a taxed 3.0 token whose tax recipient is its countdown reward module: the creator's share of the pool tax becomes a reward the last counted buys of each round share when its countdown runs out; every setting fixed for good, several steps (clone, create, bind, seed)"),
|
|
69
|
+
c('create --countdown-reward --grad-reward', 'preview', 'high', '0.44.0', "Launch a taxed 3.0 token with both rewards: the countdown reward module as its tax recipient, and a graduation reward pool the creator seeds; at graduation --gr-carry % of that pool (default 20) goes into the module's reward pool, and the unclaimed rest later too. A carry needs the pad to have opened it; --gr-carry 0 launches both without one"),
|
|
69
70
|
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'),
|
|
70
71
|
c('mint', 'preview', 'medium', '0.12.0', 'Buy shares of a 打新 or Mint Flywheel sale'),
|
|
71
72
|
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' } } }),
|
package/src/gradreward.js
CHANGED
|
@@ -55,7 +55,7 @@ export const GRAD_EVENT_ABIS = [GRAD_PAD_ABI]
|
|
|
55
55
|
|
|
56
56
|
export const HINTS = {
|
|
57
57
|
GradNotOpen: 'the graduation reward is closed on this pad: drop --grad-reward',
|
|
58
|
-
BadGradConfig: '--grad-reward out of bounds: a seed above 0, --gr-min-buy above 0, --gr-entries 1–20, --gr-last 0–50, --gr-refund-days 30–180',
|
|
58
|
+
BadGradConfig: '--grad-reward out of bounds: a seed above 0, --gr-min-buy above 0, --gr-entries 1–20, --gr-last 0–50, --gr-refund-days 30–180, --gr-carry 0–50',
|
|
59
59
|
BadCountdown: 'the tax recipient is a countdown reward module made for another token or quote (or a carry was asked without one)',
|
|
60
60
|
NotGradState: 'the reward is not in the state this needs (on the curve for a refund; graduated for a claim, a settle or a sweep)',
|
|
61
61
|
RefundNotDue: 'a refund needs: --gr-refund-days passed since the create to ask; then a 7-day public notice; then 3 days to take it, after which the request lapses',
|
|
@@ -69,7 +69,7 @@ export const revertOf = (e) => revertIn(e, [GRAD_PAD_ABI], HINTS)
|
|
|
69
69
|
|
|
70
70
|
export const STATES = ['none', 'on the curve', 'graduated: claims open', 'refunded to the creator', 'closed']
|
|
71
71
|
export const MAX_ENTRIES = 20
|
|
72
|
-
export const DEFAULTS = { entries: 10, lastPct: 30, refundDays: 90 }
|
|
72
|
+
export const DEFAULTS = { entries: 10, lastPct: 30, refundDays: 90, carryPct: 20 }
|
|
73
73
|
// in BNB, converted into the quote at the pad's own rate (graduation amount ÷ target)
|
|
74
74
|
export const DEFAULT_MIN_BUY_BNB = '0.01'
|
|
75
75
|
export const MIN_SEED_BNB = '0.1'
|
|
@@ -77,9 +77,9 @@ export const NOTICE_DAYS = 7
|
|
|
77
77
|
export const WINDOW_DAYS = 3
|
|
78
78
|
export const CLAIM_DAYS = 180
|
|
79
79
|
|
|
80
|
-
export const GRAD_FLAGS = ['grad-reward', 'gr-min-buy', 'gr-entries', 'gr-last', 'gr-refund-days']
|
|
81
|
-
export const GRAD_USAGE = '--grad-reward <seed> [--gr-min-buy <amount>] [--gr-entries <1-20>] [--gr-last <0-50>] [--gr-refund-days <30-180>]: the reward pool you put in at create (in the token\'s quote), the least a buy must spend to count, how many of the last buys share it, the % the graduating buy gets on top,
|
|
82
|
-
export const GRAD_ALONE = 'a --grad-reward create
|
|
80
|
+
export const GRAD_FLAGS = ['grad-reward', 'gr-min-buy', 'gr-entries', 'gr-last', 'gr-refund-days', 'gr-carry']
|
|
81
|
+
export const GRAD_USAGE = '--grad-reward <seed> [--gr-min-buy <amount>] [--gr-entries <1-20>] [--gr-last <0-50>] [--gr-refund-days <30-180>] [--gr-carry <0-50>, with --countdown-reward]: the reward pool you put in at create (in the token\'s quote), the least a buy must spend to count, how many of the last buys share it, the % the graduating buy gets on top, the days before you may ask for the pool back, and (with --countdown-reward) the % of the pool carried into the token\'s countdown reward at graduation (default 20)'
|
|
82
|
+
export const GRAD_ALONE = 'a --grad-reward create goes alone or with --countdown-reward only: no chained dev buy, GangBond or buy-back / split / LP / combined / floor / capped recipient, no --base, no --vault. A dev buy is its own gang buy after the create lands'
|
|
83
83
|
export const RULE = 'the reward pool is the creator\'s own money, paid to the last buys before graduation by a fixed public rule (by what each spent); buyers pay only the usual curve price and 1% fee and get the tokens they buy'
|
|
84
84
|
|
|
85
85
|
/** The --grad-reward / --gr-* flags, checked: { seed, minBuy, entries, lastBps, refundDays } (amounts as typed), or { error }. */
|
|
@@ -104,7 +104,9 @@ export function parseGradReward(opt, flag) {
|
|
|
104
104
|
if (l.error) return l
|
|
105
105
|
const r = int('gr-refund-days', DEFAULTS.refundDays, 30, 180, 'days after the create before you may ask for the pool back')
|
|
106
106
|
if (r.error) return r
|
|
107
|
-
|
|
107
|
+
const c = int('gr-carry', null, 0, 50, '% of the pool carried into the token\'s countdown reward at graduation')
|
|
108
|
+
if (c.error) return c
|
|
109
|
+
return { seed: String(seed).trim(), minBuy: minBuy && String(minBuy).trim(), entries: e.v, lastBps: l.v * 100, refundDays: r.v, carryBps: c.v == null ? null : c.v * 100 }
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
/** Whether `ctx.pad` takes a graduation reward now: { open: true } / { open: false, why } / { unread }. */
|
|
@@ -119,6 +121,27 @@ export async function gradSupport(ctx) {
|
|
|
119
121
|
return { open: true, countdownFactory: deps[2] }
|
|
120
122
|
}
|
|
121
123
|
|
|
124
|
+
/** Why a carry can't be asked of this pad (its countdown factory is not this CLI's), or null. */
|
|
125
|
+
export const carryClosed = (padFactory, cliFactory) => (cliFactory && String(padFactory ?? '').toLowerCase() === cliFactory.toLowerCase()
|
|
126
|
+
? null
|
|
127
|
+
: `--gr-carry: the pad has not opened the graduation reward's carry into the countdown reward yet (its countdown factory is ${padFactory ?? 'unset'}, this CLI's is ${cliFactory ?? 'none'}): add --gr-carry 0 to launch both without a carry`)
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Before a --countdown-reward launch clones its module (gas, and the metadata fixed for good): what the create would
|
|
131
|
+
* refuse later about its --grad-reward, as { error, ...details }, or null.
|
|
132
|
+
*/
|
|
133
|
+
export async function gradLaunchCheck(read, pad, testnet, gr, cliFactory) {
|
|
134
|
+
let deps
|
|
135
|
+
try { deps = await read(pad, GRAD_PAD_ABI, 'gradRewardDeps') } catch (e) {
|
|
136
|
+
if (missingRead(e)) return { error: `GangLaunchpad 3.0 on ${testnet ? 'the BSC testnet' : 'BSC mainnet'} has no graduation reward yet (the pad is not upgraded for it): drop --grad-reward`, pad }
|
|
137
|
+
return { error: 'could not check the pad for the graduation reward (RPC error)', pad, detail: e.shortMessage || e.message.split('\n')[0], retry: 'same command again' }
|
|
138
|
+
}
|
|
139
|
+
if (!deps[0]) return { error: 'the graduation reward is closed on this pad: drop --grad-reward', pad }
|
|
140
|
+
const carryBps = gr.carryBps ?? DEFAULTS.carryPct * 100
|
|
141
|
+
const closed = carryBps > 0 ? carryClosed(deps[2], cliFactory) : null
|
|
142
|
+
return closed ? { error: closed, pad } : null
|
|
143
|
+
}
|
|
144
|
+
|
|
122
145
|
/** `amountBnb` (a decimal string) in the quote, at the rate the curve's graduation amount fixes (gradAmt ÷ target BNB). */
|
|
123
146
|
export const bnbInQuote = (amountBnb, gradAmt, targetBnb) =>
|
|
124
147
|
(parseUnits(String(amountBnb), 18) * gradAmt) / parseUnits(String(targetBnb), 18)
|
|
@@ -127,22 +150,26 @@ const iso = (s) => (Number(s) > 0 ? new Date(Number(s) * 1000).toISOString() : n
|
|
|
127
150
|
const pctOf = (bps) => Number(bps) / 100
|
|
128
151
|
|
|
129
152
|
/** What the create preview says about the reward (pure; amounts as display strings). */
|
|
130
|
-
export function gradCreateView({ seed, minBuy, sym, entries, lastBps, refundDays, targetBnb, seedFloorNote, gateOn }) {
|
|
153
|
+
export function gradCreateView({ seed, minBuy, sym, entries, lastBps, refundDays, targetBnb, seedFloorNote, gateOn, carryBps = 0, toModule = false }) {
|
|
131
154
|
const last = pctOf(lastBps)
|
|
155
|
+
const carry = pctOf(carryBps)
|
|
156
|
+
const pool = carry > 0 ? `the payout (the pool less the ${carry}% carry)` : 'the pool'
|
|
157
|
+
const rest = toModule ? 'to the token\'s countdown reward module (its reward pool)' : 'back to you'
|
|
132
158
|
return {
|
|
133
159
|
pool: `${seed} ${sym}`, payWithThisTx: `${seed} ${sym}, pulled from this wallet in the create (approve the pad for it first)`,
|
|
134
160
|
minBuy: `${minBuy} ${sym}`, entries, lastPct: last, refundDays,
|
|
135
161
|
who: `the last ${entries} curve buys that each actually spend at least ${minBuy} ${sym} (after a wallet-cap or graduation cut); the buy that graduates the token at ${targetBnb} BNB counts whatever it spends. Only while the pad's Agent gate is on (${gateOn ? 'it is on now' : 'IT IS OFF NOW: no buy would count until gang turns it back on'}): with it off, no buy counts`,
|
|
162
|
+
...(carry > 0 && { carryPct: carry, carry: `at graduation ${carry}% of the pool goes into this token's countdown reward module, as its reward pool (through the module's receiveCarry; the pad found the module from the token's tax recipient, nobody types its address). If the module takes less (it refuses, or the gas runs short), the rest is owed and anyone resends it with gang grad-reward retry-carry. The last buys share the rest` }),
|
|
136
163
|
split: last > 0
|
|
137
|
-
? `at graduation the buy that graduates it gets ${last}% of
|
|
138
|
-
: `at graduation all ${entries} entries split
|
|
164
|
+
? `at graduation the buy that graduates it gets ${last}% of ${pool} on top; then all ${entries} entries, it included, split the rest by what each spent (a wallet with several entries adds them up)`
|
|
165
|
+
: `at graduation all ${entries} entries split ${pool} by what each spent (a wallet with several entries adds them up)`,
|
|
139
166
|
sells: 'a curve sell takes out every entry that wallet has so far; a later buy of the same wallet counts again',
|
|
140
|
-
claims: `buyers claim with gang grad-reward claim for ${CLAIM_DAYS} days after graduation; then anyone sweeps the unclaimed rest (and the rounding dust)
|
|
167
|
+
claims: `buyers claim with gang grad-reward claim for ${CLAIM_DAYS} days after graduation; then anyone sweeps the unclaimed rest (and the rounding dust) ${rest}`,
|
|
141
168
|
refund: `if the token does not graduate: ${refundDays} days after the create you may ask for the pool back (gang grad-reward refund-request). The request is public for ${NOTICE_DAYS} days; a graduation in that time pays the buyers as usual. Then you have ${WINDOW_DAYS} days to take it (gang grad-reward refund), after which the request lapses and must be made again`,
|
|
142
169
|
rule: RULE,
|
|
143
170
|
risks: 'anyone watching the curve can time the last buys, and one person with several Agent IDs can fill several entries: weighting by spend means many small entries earn no more than one large one, but a push into a full list still crowds out the oldest entries. A higher --gr-min-buy and more --gr-entries make that harder',
|
|
144
171
|
...(seedFloorNote && { seedFloor: seedFloorNote }),
|
|
145
|
-
warning: `PERMANENT: ${seed} ${sym} leaves this wallet in the create. You get it back only through the refund above (if the token does not graduate) or as the unclaimed rest 180 days after graduation. The size, the rules and the numbers never change`,
|
|
172
|
+
warning: `PERMANENT: ${seed} ${sym} leaves this wallet in the create. You get it back only through the refund above (if the token does not graduate)${toModule ? '' : ' or as the unclaimed rest 180 days after graduation'}. The size, the rules and the numbers never change`,
|
|
146
173
|
}
|
|
147
174
|
}
|
|
148
175
|
|
package/src/index.js
CHANGED
|
@@ -567,7 +567,7 @@ U / S pads) and run that kind's trade. Results of V3 / 打新 / 铸币飞轮 tok
|
|
|
567
567
|
through the module count. PERMANENT: every setting. Steps: the token's address
|
|
568
568
|
first (as --floor), clone your module for it → create → bind → seed → the rest of
|
|
569
569
|
the launch. Not with --floor / --buyback / --lp / --split / --tax-cap / --recipient /
|
|
570
|
-
--vault
|
|
570
|
+
--vault; with --grad-reward too (0.44.0+), --gr-carry % of that pool (default 20) goes into the module at graduation; with --promote the promoter share stays on the curve. Quote: WBNB, GANG or
|
|
571
571
|
one listed in the pad's QuoteRegistry
|
|
572
572
|
gang create --fair … [--shares <n>] --bond <quote> [--bond-hold …] --bond-days <7-90>
|
|
573
573
|
打新: create (the dev's --shares are bought in it) → bond. Progress is read from the
|
|
@@ -658,17 +658,21 @@ OPENING BASE (GangLaunchpad 3.0, base-v1, 0.40.0+; open on BSC mainnet and testn
|
|
|
658
658
|
|
|
659
659
|
GRADUATION REWARD (冲毕业奖励, GangLaunchpad 3.0, 0.42.0+; open on BSC mainnet and testnet; the pad says whether it is open):
|
|
660
660
|
gang create … --grad-reward <seed> [--gr-min-buy <amount>] [--gr-entries <1-20>] [--gr-last <0-50>] [--gr-refund-days <30-180>]
|
|
661
|
+
[--countdown-reward … --gr-carry <0-50>]
|
|
661
662
|
you seed a reward pool in the token's quote (pulled in the create: approve first;
|
|
662
663
|
at least 0.1 BNB worth) for the last --gr-entries curve buys (default 10) that each
|
|
663
664
|
actually spend --gr-min-buy (default 0.01 BNB worth), while the pad's Agent gate is
|
|
664
|
-
on; the buy that graduates the token counts whatever it spends and gets --gr-last % of the pool on top (default 30); all
|
|
665
|
+
on; the buy that graduates the token counts whatever it spends and gets --gr-last % of the payout (the pool less any --gr-carry) on top (default 30); all
|
|
665
666
|
entries, it included, split the rest by what each spent. A curve sell takes that
|
|
666
667
|
wallet's earlier entries out. Buyers claim for 180 days after graduation, then the
|
|
667
668
|
rest goes back to you (to the token's countdown module if that is its tax recipient). Not graduating: --gr-refund-days (default 90) after the
|
|
668
669
|
create you may ask for it back; the request is public for 7 days (a graduation in
|
|
669
670
|
that time pays the buyers), then you have 3 days to take it, else it lapses. The
|
|
670
671
|
buyers pay only the usual price and fee: it is your money, paid by a fixed public rule. With --promote
|
|
671
|
-
on an untaxed token or with --recipient;
|
|
672
|
+
on an untaxed token or with --recipient; with --countdown-reward (a taxed launch whose
|
|
673
|
+
recipient is the token's countdown reward module) --gr-carry % of the pool (default
|
|
674
|
+
20) goes into that module's reward pool at graduation, and the unclaimed rest goes
|
|
675
|
+
there too, not back to you; not with --vault / --base / --fair / --fly
|
|
672
676
|
or a launch in one command (--dev-buy, --bond, --buyback, --split, --lp, --tax-cap,
|
|
673
677
|
--floor). gang buy / gang sell previews say whether a buy counts (rewards.gradReward)
|
|
674
678
|
and what a sell takes out
|
|
@@ -1638,9 +1642,11 @@ async function main() {
|
|
|
1638
1642
|
if (!flag('grad-reward')) fail(`--${grFlag} goes with --grad-reward <seed>`)
|
|
1639
1643
|
if (flyCreate || flag('fair') || cmd === 'fair') fail(`--grad-reward rewards the last buys of a V3 curve: leave --${flyCreate ? 'fly' : 'fair'} out`)
|
|
1640
1644
|
if (flag('base') || flag('vault')) fail(`--grad-reward and --${flag('base') ? 'base' : 'vault'} can't go together`)
|
|
1641
|
-
if (flag('countdown-reward')) fail('--grad-reward and --countdown-reward can\'t go together in this CLI version: running both rewards on one token (the graduation reward carried into the countdown pool) comes in a later version. Launch with one of them')
|
|
1642
1645
|
if (wantsPoolModule('v3', flag, opt)) fail('--grad-reward with --promote on a taxed token: that --promote would start a promoter pool launch, which a --grad-reward create does not take. Add --recipient <your address> (the creator\'s own share stays in the create), or use an untaxed token')
|
|
1643
|
-
|
|
1646
|
+
if (flag('gr-carry') && !flag('countdown-reward')) fail('--gr-carry carries part of the pool into the token\'s countdown reward: add --countdown-reward, or leave --gr-carry out')
|
|
1647
|
+
// the one launch it goes with: --countdown-reward (and its --cd-* settings, --restart)
|
|
1648
|
+
const cdOk = (f) => flag('countdown-reward') && (f === 'countdown-reward' || f === 'restart' || CD_FLAGS.includes(f))
|
|
1649
|
+
const launch = LAUNCH_FLAGS.find((f) => flag(f) && !cdOk(f))
|
|
1644
1650
|
if (launch) fail(`--${launch}: ${GRAD_ALONE}`)
|
|
1645
1651
|
}
|
|
1646
1652
|
// gang weekly apply takes the same --description / --website / --twitter as a create (they describe the token to come)
|
package/src/launch.js
CHANGED
|
@@ -15,7 +15,7 @@ import { claimCmd, notThroughModule } from './creatorfee.js'
|
|
|
15
15
|
import { COMBO_ABI, COMBO_FACTORY_ABI, comboFactoryAddress, comboLine, comboNotDeployed, comboOf, comboParts, parseComboSpec, PERMANENT_NOTE, simulateCombo } from './combo.js'
|
|
16
16
|
import { FLOOR_ABI, FLOOR_FACTORY_ABI, FLOOR_NOTE, floorFactoryAddress, floorLine, floorNotDeployed, floorOf, floorShown, OTHER_ASSETS_NOTE as FLOOR_OTHER_ASSETS_NOTE, parseFloorSpec, PERMANENT_NOTE as FLOOR_PERMANENT_NOTE, simulateFloor, treasuryShare } from './floor.js'
|
|
17
17
|
import { mineToken } from './vanity.js'
|
|
18
|
-
import {
|
|
18
|
+
import { gradLaunchCheck, parseGradReward } from './gradreward.js'
|
|
19
19
|
import { CD_ALONE, CD_FLAGS, COUNTDOWN_ABI, COUNTDOWN_FACTORY_ABI, countdownConfig, countdownCreateView, countdownFactoryAddress, countdownNotLive, countdownRaw, countdownShown, formatCountdown, parseCountdownSpec, sameConfig, simulateCountdown } from './countdown.js'
|
|
20
20
|
import { CAPPED_ABI, CAPPED_FACTORY_ABI, cappedFactoryAddress, cappedLine, cappedNotDeployed, cappedOf, cappedParts, capUnits, capVolume, COVERAGE_NOTE, OTHER_ASSETS_NOTE, parseCappedSpec, PERMANENT_NOTE as CAPPED_PERMANENT_NOTE, quoteUnits, simulateCapped, splitPcts } from './capped.js'
|
|
21
21
|
|
|
@@ -224,9 +224,6 @@ export async function runLaunch(kind, { io, runV3, runFair, runBond, padNotes })
|
|
|
224
224
|
const f = CD_FLAGS.find((x) => flag(x))
|
|
225
225
|
if (f) fail(`--${f}: ${CD_ALONE}`)
|
|
226
226
|
}
|
|
227
|
-
if (countdown && ['grad-reward', ...GRAD_FLAGS].some((x) => flag(x))) {
|
|
228
|
-
fail('--grad-reward and --countdown-reward can\'t go together in this CLI version: running both rewards on one token (the graduation reward carried into the countdown pool) comes in a later version. Launch with one of them')
|
|
229
|
-
}
|
|
230
227
|
if (countdown) {
|
|
231
228
|
const other = ['floor', 'redeem-fee', 'buyback', 'buyback-to', 'lp', 'lp-to', 'split', 'tax-cap', 'tax-cap-share', 'after-cap', 'recipient', 'vault'].find((x) => flag(x))
|
|
232
229
|
if (other) fail(`--${other} does not go with --countdown-reward: a token has one tax recipient, and the countdown reward module takes it (the recipient's part of the pool tax becomes the buyers' reward pool)`)
|
|
@@ -983,6 +980,16 @@ export async function runLaunch(kind, { io, runV3, runFair, runBond, padNotes })
|
|
|
983
980
|
const env = testnet ? 'GANG_TESTNET_COUNTDOWN_FACTORY' : 'GANG_COUNTDOWN_FACTORY'
|
|
984
981
|
return fail(`GangCountdownRewardFactory has no code at ${cdSpec.factory} on ${testnet ? 'the BSC testnet' : 'BSC mainnet'}: launch without --countdown-reward for now${process.env[env] ? ` (or fix ${env})` : ''}`, { factory: cdSpec.factory })
|
|
985
982
|
}
|
|
983
|
+
// --grad-reward with it: what its create would refuse is refused before the clone (gas, metadata fixed for good)
|
|
984
|
+
if (flag('grad-reward')) {
|
|
985
|
+
const gr = parseGradReward(opt, flag)
|
|
986
|
+
if (gr.error) return fail(gr.error, { got: gr.got })
|
|
987
|
+
const no = await gradLaunchCheck(read, net.pad, testnet, gr, cdSpec.factory)
|
|
988
|
+
if (no) {
|
|
989
|
+
const { error, ...extra } = no
|
|
990
|
+
return fail(error, extra)
|
|
991
|
+
}
|
|
992
|
+
}
|
|
986
993
|
const vctx = { ...net, client, read }
|
|
987
994
|
const handler = await read(net.pad, FLOOR_PAD_ABI, 'taxHandler')
|
|
988
995
|
const buyBps = Math.round(Number(opt('buy-tax')) * 100), sellBps = Math.round(Number(opt('sell-tax')) * 100)
|
package/src/v3.js
CHANGED
|
@@ -18,7 +18,7 @@ import { floorFactoryAddress, floorOf, floorShown, treasuryShare, typedFloorModu
|
|
|
18
18
|
import { COUNTDOWN_TYPE, countdownBuy, countdownFactoryAddress, countdownForToken, countdownSellLine, formatCountdown } from './countdown.js'
|
|
19
19
|
import { VANITY_ABI, vanityCreate, vanityDeployer } from './vanity.js'
|
|
20
20
|
import { BASE_LOST, BASE_NO_BOND, BASE_PAD_ABI, baseOf as baseVaultView, basePayoff, baseSupport, baseTaxLine, HINTS as BASE_HINTS, parseBase, scheduleLine } from './base.js'
|
|
21
|
-
import { bnbInQuote, DEFAULT_MIN_BUY_BNB, GRAD_FLAGS, GRAD_PAD_ABI, gradBuyLine, gradCreateView, gradOf, gradSellLine, gradSupport, HINTS as GRAD_HINTS, MIN_SEED_BNB, parseGradReward } from './gradreward.js'
|
|
21
|
+
import { bnbInQuote, carryClosed, DEFAULT_MIN_BUY_BNB, DEFAULTS as GRAD_DEFAULTS, GRAD_FLAGS, GRAD_PAD_ABI, gradBuyLine, gradCreateView, gradOf, gradSellLine, gradSupport, HINTS as GRAD_HINTS, MIN_SEED_BNB, parseGradReward } from './gradreward.js'
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* `gang v3 …` — LaunchpadV3 (tax recipient): a token with its own buy / sell tax (1–5% each), a dividend share and a
|
|
@@ -541,8 +541,12 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
|
|
|
541
541
|
if (gr) {
|
|
542
542
|
if (vault) fail('--grad-reward and --vault can\'t go together: a vault-bound token takes no graduation reward (its locks move balances outside the curve)')
|
|
543
543
|
if (base) fail('--grad-reward and --base can\'t go together (one create entry each)')
|
|
544
|
-
|
|
544
|
+
// the one launch it goes with: --countdown-reward (the module cloned for this token takes the tax; the carry goes there)
|
|
545
|
+
if ((launchFloor && launchFloor.noun !== 'countdown reward module') || launchPoolModule) fail('--grad-reward goes on a plain create, or a --countdown-reward launch only')
|
|
545
546
|
}
|
|
547
|
+
const cdLaunch = launchFloor?.noun === 'countdown reward module'
|
|
548
|
+
const carryBps = gr ? (gr.carryBps ?? (cdLaunch ? GRAD_DEFAULTS.carryPct * 100 : 0)) : 0
|
|
549
|
+
if (gr && carryBps > 0 && !cdLaunch) fail('--gr-carry carries part of the pool into the token\'s countdown reward: add --countdown-reward (the launch clones the module), or leave --gr-carry out')
|
|
546
550
|
if (grad !== null && !(grad > 0)) fail('--grad must be the graduation target in BNB raised: 6, 9, 12 or 15', { got: opt('grad') ?? null })
|
|
547
551
|
const buyTax = taxed ? taxOf('buy-tax') : 0
|
|
548
552
|
const sellTax = taxed ? taxOf('sell-tax') : 0
|
|
@@ -599,10 +603,16 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
|
|
|
599
603
|
if (support.unread) fail('could not check the pad for the opening base (RPC error)', { pad: ctx.pad, detail: support.unread, retry: 'same command again' })
|
|
600
604
|
if (!support.open) fail(`${support.why}: drop --base${testnet ? '' : ' (it is on the BSC testnet: --testnet)'}`, { pad: ctx.pad })
|
|
601
605
|
}
|
|
606
|
+
// with --countdown-reward, the pad knows the module (the carry's and the sweep's destination) only once gang opened
|
|
607
|
+
// the carry with this CLI's countdown factory
|
|
608
|
+
let grToModule = false
|
|
602
609
|
if (gr) {
|
|
603
610
|
const support = await gradSupport(ctx)
|
|
604
611
|
if (support.unread) fail('could not check the pad for the graduation reward (RPC error)', { pad: ctx.pad, detail: support.unread, retry: 'same command again' })
|
|
605
612
|
if (!support.open) fail(`${support.why}: drop --grad-reward${testnet ? '' : ' (it is on the BSC testnet: --testnet)'}`, { pad: ctx.pad })
|
|
613
|
+
const cf = countdownFactoryAddress(testnet)
|
|
614
|
+
grToModule = cdLaunch && !!cf && String(support.countdownFactory ?? '').toLowerCase() === cf.toLowerCase()
|
|
615
|
+
if (carryBps > 0 && !grToModule) fail(carryClosed(support.countdownFactory, cf), { pad: ctx.pad })
|
|
606
616
|
}
|
|
607
617
|
// the recipient may be the creator itself: checkTaxConfigFor knows who creates (a pad without it: checkTaxConfig)
|
|
608
618
|
const [ok, reason] = await ctx.read(ctx.pad, PAD_ABI, 'checkTaxConfigFor', [me, tax]).catch((e) => {
|
|
@@ -675,12 +685,12 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
|
|
|
675
685
|
if (seedRaw < seedFloor) fail(`--grad-reward: the seed must be at least ${await units(ctx, quote, seedFloor)} ${sym} (${MIN_SEED_BNB} BNB at this token's rate): a smaller pool is not worth a list`, { got: gr.seed })
|
|
676
686
|
if (seedRaw >= 2n ** 128n || minBuyRaw >= 2n ** 96n || minBuyRaw === 0n) fail('--grad-reward / --gr-min-buy: amount out of range', { seed: gr.seed, minBuy: gr.minBuy })
|
|
677
687
|
grCfg = {
|
|
678
|
-
seed: seedRaw, minBuy: minBuyRaw, entries: gr.entries, lastBps: gr.lastBps, carryBps
|
|
688
|
+
seed: seedRaw, minBuy: minBuyRaw, entries: gr.entries, lastBps: gr.lastBps, carryBps, refundAfter: gr.refundDays * 86_400,
|
|
679
689
|
promoteBps: promote?.shareBps ?? 0, promoteWindow: promote?.window ?? 0,
|
|
680
690
|
}
|
|
681
691
|
grView = gradCreateView({
|
|
682
692
|
seed: await units(ctx, quote, seedRaw), minBuy: await units(ctx, quote, minBuyRaw), sym, entries: gr.entries, lastBps: gr.lastBps,
|
|
683
|
-
refundDays: gr.refundDays, targetBnb, gateOn: await ctx.read(ctx.pad, GRAD_PAD_ABI, 'agentGateEnabled'),
|
|
693
|
+
refundDays: gr.refundDays, targetBnb, gateOn: await ctx.read(ctx.pad, GRAD_PAD_ABI, 'agentGateEnabled'), carryBps, toModule: grToModule,
|
|
684
694
|
...(!gr.minBuy && { seedFloorNote: `--gr-min-buy left out: ${DEFAULT_MIN_BUY_BNB} BNB at this token's rate` }),
|
|
685
695
|
})
|
|
686
696
|
const pre = await fundingStep(ctx, me, quote, seedRaw, sym, 'approve-quote', rawOnly, summarize)
|
|
@@ -700,12 +710,15 @@ export async function runV3(sub, { opt, flag, out, fail, summarize, resolveLogo,
|
|
|
700
710
|
const prepareCreate = (logoURI, metaURI, fixed = null) => vanityCreate(ctx, me, createData(logoURI, metaURI), {
|
|
701
711
|
args: [name, symbol, metaURI, handler, tax.buyTaxBps, tax.sellTaxBps, false], fixed,
|
|
702
712
|
})
|
|
703
|
-
// the logo / metadata strings never decide a revert: dry-run without them, so a create that would fail uploads nothing
|
|
704
|
-
|
|
713
|
+
// the logo / metadata strings never decide a revert: dry-run without them, so a create that would fail uploads nothing.
|
|
714
|
+
// A pinned launch (floor / countdown module cloned for one address) has them fixed already: its dry run uses them and
|
|
715
|
+
// the pinned salt, since a carry checks that the module was made for this very token address
|
|
716
|
+
const pinned = launchFloor ? [launchFloor.logoURI, launchFloor.metaURI] : ['', '']
|
|
717
|
+
const probe = await prepareCreate(...pinned, launchFloor ? { salt: launchFloor.salt, token: launchFloor.token } : null)
|
|
705
718
|
// createWithSalt (abcd) or the entry itself; a base create sends exactly its cost either way
|
|
706
|
-
const dry = await simulate(ctx, me, ctx.pad, probe.salt ? VANITY_ABI : createAbi,
|
|
707
|
-
probe.salt ? 'createWithSalt' : fn, probe.salt ? [probe.salt, createData(
|
|
708
|
-
if (dry
|
|
719
|
+
const dry = probe.mismatch ? null : await simulate(ctx, me, ctx.pad, probe.salt ? VANITY_ABI : createAbi,
|
|
720
|
+
probe.salt ? 'createWithSalt' : fn, probe.salt ? [probe.salt, createData(...pinned)] : argsOf(...pinned), baseCost)
|
|
721
|
+
if (dry?.failed) return out({ success: false, step: 'create', ...dry.failed })
|
|
709
722
|
// a floor launch: the module was cloned for one token address, so the create reuses the metadata and the salt that
|
|
710
723
|
// give it, and is refused when anything that decides the address (name, symbol, tax rates) changed since
|
|
711
724
|
const logo = launchFloor ? { logoURI: launchFloor.logoURI, uploaded: !!launchFloor.uploaded } : await resolveLogo()
|