@gangfun/cli 0.8.0 → 0.9.1
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 +34 -3
- package/README.zh-CN.md +31 -3
- package/package.json +2 -2
- package/src/abi.js +17 -0
- package/src/chain.js +14 -5
- package/src/fair.js +506 -0
- package/src/gangpad.js +108 -0
- package/src/index.js +183 -10
- package/src/logo.js +32 -0
- package/src/pool.js +312 -0
- package/src/steps.js +290 -0
- package/src/v3.js +504 -0
package/README.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Operate [gang.fun](https://gang.fun) from a Binance **Agentic Wallet**. Curve buys/creates require a SPACE ID `.ai` Agent ID. This CLI builds calldata; `baw` signs — no keys in this package.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**`gang create` (0.2.1+):** LaunchpadV2 only (`0x1B8F3f69DFa0a7F63d308C7EB0Fd38D8b099966E`). Soft / LaunchpadU / LaunchpadS: **no new create** — buy/sell/claim existing tokens only. New tokens graduate at ≈ **15 BNB** (PoolCheck). Soft archive tokens still graduate at 20 BNB on-chain.
|
|
6
|
+
|
|
7
|
+
**V3 tax tokens and 打新 (0.9.0+):** `gang v3` / `gang fair` on GangLaunchpad, live on BSC mainnet since 2026-10-27 (pad `0x15CFD2dc8278Fb87a1783ef42111618E20874365`, GangRouter `0xE040445690Aa56C8b68B7f7038C7b2562B5079C4`, both built in); `--testnet` uses BSC testnet set 10.
|
|
6
8
|
|
|
7
9
|
## Install
|
|
8
10
|
|
|
@@ -53,6 +55,26 @@ gang follow <note tx> --bnb <n> [--slippage 1] [--note …] # buy the token a
|
|
|
53
55
|
gang sell --token <addr> (--amount <tokens> | --all) [--slippage 1] [--note … [--conf …] [--reveal-after …]]
|
|
54
56
|
gang upload-logo (--file ./avatar.png | --url <image URL>) # → https://gang.fun/api/logos/<id>.png
|
|
55
57
|
gang create --name <n> --symbol <s> [--logo ./avatar.png | --logo-uri URL] [--website URL] [--twitter @handle] [--taxed] [--quote 0x… --ref-pool 0x…] [--note … [--conf …] [--reveal-after …]]
|
|
58
|
+
# 打新 (fair mint) and V3 share one pad (GangLaunchpad). Mainnet by default (address built in); --testnet = BSC testnet set 10
|
|
59
|
+
gang fair create --name <n> --symbol <s> [--raise 15] [--cap 0.5] [--hold 60] [--mint-fee 1] [--exit-fee 1] [--shares 1] [--logo ./avatar.png | --logo-uri URL] [--website URL] [--twitter @handle] [--description "…"] [--testnet]
|
|
60
|
+
# --cap 0.25–1% of supply per wallet (1% → at least 50 wallets), --hold 60–90% (the hold line)
|
|
61
|
+
gang fair mint --token <addr> --shares <n> [--testnet] # + the sale's mint fee (1–3%, the platform's)
|
|
62
|
+
gang fair withdraw --token <addr> (--shares <n> | --all) [--testnet]
|
|
63
|
+
gang fair buy --token <addr> --amount <n> [--use-quote | --pay-bnb] [--testnet] # after launch: PancakeSwap via GangRouter
|
|
64
|
+
gang fair sell --token <addr> (--amount <tokens> | --all) [--to-bnb] [--confirm-out] [--testnet] # after launch; past sellableBeforeOut needs --confirm-out
|
|
65
|
+
gang fair status --token <addr> [--testnet] # shares; after launch: reward on / out, sellable, to claim
|
|
66
|
+
gang fair claim --token <addr> [--testnet]
|
|
67
|
+
gang fair info --token <addr> | gang fair list [--status minting|launched|all] | gang fair tx --hash <0x..> # lookups ([--testnet])
|
|
68
|
+
# LaunchpadV3 tax token (own buy / sell tax 1–5%, pool only, paid to the creator itself or a whitelisted recipient, in the quote) — same pad as 打新
|
|
69
|
+
gang v3 create --name <n> --symbol <s> --buy-tax 2 --sell-tax 2 [--dividend 0] --recipient 0x… [--logo ./avatar.png | --logo-uri URL] [--website URL] [--twitter @handle] [--description "…"] [--testnet]
|
|
70
|
+
gang v3 buy --token <addr> --amount <quote> [--testnet] # includes the 1% curve fee (no tax on the curve; the tax is pool-only)
|
|
71
|
+
gang v3 sell --token <addr> (--amount <tokens> | --all) [--to-bnb] [--testnet] # graduated: buy / sell go to PancakeSwap via GangRouter
|
|
72
|
+
gang v3 info --token <addr> [--testnet] # tax setting, recipient, what is still owed to it
|
|
73
|
+
gang v3 status --token <addr> [--testnet] # my balance and dividend: claimable now + credited, not sold yet
|
|
74
|
+
gang v3 claim --token <addr> [--testnet] # claim my dividend (in the quote token)
|
|
75
|
+
gang v3 release --token <addr> [--testnet] # push a payment that failed earlier
|
|
76
|
+
gang v3 income --recipient 0x… # a recipient's income per token (gang.fun)
|
|
77
|
+
gang v3 list [--status curve|graduated|all] | gang v3 tx --hash <0x..> # lookups ([--testnet])
|
|
56
78
|
gang execute --request-id <id>
|
|
57
79
|
gang tx --hash <0x..>
|
|
58
80
|
```
|
|
@@ -162,7 +184,13 @@ gang agents --window 30d --sort follow
|
|
|
162
184
|
- **New** creates → ≈15 BNB graduation (LaunchpadV2 / PoolCheck) → PancakeSwap V2, LP burned.
|
|
163
185
|
- Soft legacy (archive): 20 BNB graduation; buy/sell only — no Soft create from this CLI.
|
|
164
186
|
- Before graduation: no transfers, curve only.
|
|
165
|
-
- Graduated:
|
|
187
|
+
- Graduated: `gang buy` / `gang sell` (and `gang v3 buy|sell`, `gang fair buy|sell` after launch) trade in the PancakeSwap
|
|
188
|
+
pool through GangRouter: approve this amount only first, then `poolBuy` / `poolBuyBNB` / `poolSell` / `poolSellForBNB`
|
|
189
|
+
with a minimum from `getAmountsOut` (buy, less the buy tax) or the tax handler's `previewSellNextBlock` (sell), less
|
|
190
|
+
`--slippage`. `--use-quote` / `--pay-bnb` pick what a buy pays with, `--to-bnb` sells for BNB. A taxed sell needs about
|
|
191
|
+
700k gas (it also sells one chunk of the held tax): let the wallet estimate, or give at least 750k.
|
|
192
|
+
The router is checked first (a GangRouter with pool trades, never Pancake or an old router); `--from` works only on
|
|
193
|
+
these pool trades. Details: `references/v3.md` ("Pool trades").
|
|
166
194
|
|
|
167
195
|
## Env
|
|
168
196
|
|
|
@@ -175,7 +203,10 @@ gang agents --window 30d --sort follow
|
|
|
175
203
|
| `GANG_NOTES_DIR` | Local note queue, one file per note: salt and send status, kept 24h (default `~/.gang/notes`); `previews/` in it records what each trade preview carried (note, follow) for `gang execute`, also kept 24h |
|
|
176
204
|
| `GANG_UPDATE_CHECK` | `0` turns off the once-a-day check for a newer CLI on npm (cached in `~/.gang/update.json`) |
|
|
177
205
|
| `GANG_UPDATE_URL` | Where that check asks, default `https://registry.npmjs.org/@gangfun/cli/latest`; set an npm mirror's `…/@gangfun/cli/latest` if npmjs is slow or blocked |
|
|
206
|
+
| `GANG_PAD` / `GANG_TESTNET_PAD` | Override the merged GangLaunchpad (mainnet / testnet) behind both `gang v3` and `gang fair` (defaults: mainnet `0x15CF…4365`, testnet set 10 `0xFebF…5BB1`). Old names `GANG_V3_PAD` / `GANG_FAIR_PAD`, `GANG_V3_TESTNET_PAD` / `GANG_FAIR_TESTNET_PAD` still work as aliases |
|
|
207
|
+
| `GANG_TESTNET_RPC_URL` | Testnet RPC; old names `GANG_V3_TESTNET_RPC_URL` / `GANG_FAIR_TESTNET_RPC_URL` still work |
|
|
208
|
+
| `GANG_ROUTER` / `GANG_TESTNET_ROUTER` | GangRouter proxy (native-BNB V3 buys / mints, and every PancakeSwap trade of a graduated token); old name `GANG_ROUTER_TESTNET` still works. Defaults: mainnet `0xE040…79C4`, testnet set 10 `0x6bB6…C9F6` |
|
|
178
209
|
|
|
179
210
|
## Version
|
|
180
211
|
|
|
181
|
-
`0.
|
|
212
|
+
`0.9.0` · repo [gangfun/cli](https://github.com/gangfun/cli) · published to [npm](https://www.npmjs.com/package/@gangfun/cli) on push to `main` (0.9.0 not yet: npm has 0.8.0)
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
用 Binance **Agentic Wallet** 操作 [gang.fun](https://gang.fun)。内盘买入/发币需要 SPACE ID `.ai` Agent ID。本 CLI 只组 calldata,签名走 `baw`,不持有私钥。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**`gang create`(0.2.1+):** 仅 LaunchpadV2(`0x1B8F3f69DFa0a7F63d308C7EB0Fd38D8b099966E`)。Soft / LaunchpadU / LaunchpadS:**禁止新 create**,仅存量 buy/sell/claim。新币毕业 ≈ **15 BNB**(PoolCheck)。Soft 存量链上仍为 20 BNB 毕业。
|
|
6
|
+
|
|
7
|
+
**V3 税收币和打新(0.9.0+):** `gang v3` / `gang fair` 走 GangLaunchpad,2026-10-27 起在 BSC 主网运行(内盘 `0x15CFD2dc8278Fb87a1783ef42111618E20874365`,GangRouter `0xE040445690Aa56C8b68B7f7038C7b2562B5079C4`,都已内置);`--testnet` 走 BSC 测试网第 10 套。
|
|
6
8
|
|
|
7
9
|
## 安装
|
|
8
10
|
|
|
@@ -43,6 +45,26 @@ gang follow <附言 tx> --bnb <n> [--slippage 1] [--note …] # 跟单:买
|
|
|
43
45
|
gang sell --token <addr> (--amount <tokens> | --all) [--slippage 1] [--note … [--conf …] [--reveal-after …]]
|
|
44
46
|
gang upload-logo (--file ./avatar.png | --url <图片地址>)
|
|
45
47
|
gang create --name <n> --symbol <s> [--logo ./avatar.png | --logo-uri URL] [--website URL] [--twitter @handle] [--taxed] [--quote 0x… --ref-pool 0x…] [--note … [--conf …] [--reveal-after …]]
|
|
48
|
+
# 打新和 V3 共用一个内盘合约(GangLaunchpad)。默认走主网(地址已内置);--testnet 走 BSC 测试网第 10 套
|
|
49
|
+
gang fair create --name <n> --symbol <s> [--raise 15] [--cap 0.5] [--hold 60] [--mint-fee 1] [--exit-fee 1] [--shares 1] [--logo ./avatar.png | --logo-uri URL] [--website URL] [--twitter @handle] [--description "…"] [--testnet]
|
|
50
|
+
# --cap 单地址上限 0.25–1%(1% 时至少 50 个地址),--hold 出局线 60–90%
|
|
51
|
+
gang fair mint --token <addr> --shares <n> [--testnet] # 另收该币的打新费(1–3%,归平台、不退)
|
|
52
|
+
gang fair withdraw --token <addr> (--shares <n> | --all) [--testnet]
|
|
53
|
+
gang fair buy --token <addr> --amount <数量> [--use-quote | --pay-bnb] [--testnet] # 发射后:经 GangRouter 在 PancakeSwap 买
|
|
54
|
+
gang fair sell --token <addr> (--amount <枚数> | --all) [--to-bnb] [--confirm-out] [--testnet] # 发射后;卖过 sellableBeforeOut 须加 --confirm-out
|
|
55
|
+
gang fair status --token <addr> [--testnet] # 份数;发射后:是否出局、还能卖多少、待领奖励
|
|
56
|
+
gang fair claim --token <addr> [--testnet]
|
|
57
|
+
gang fair info --token <addr> | gang fair list [--status minting|launched|all] | gang fair tx --hash <0x..> # 查询(可加 --testnet)
|
|
58
|
+
# LaunchpadV3 税收币(买 / 卖税各 1–5%,只在外盘收,用报价币打给接收地址:发币人自己,或白名单里的合作方)— 和打新同一个内盘合约
|
|
59
|
+
gang v3 create --name <n> --symbol <s> --buy-tax 2 --sell-tax 2 [--dividend 0] --recipient 0x… [--logo ./avatar.png | --logo-uri URL] [--website URL] [--twitter @handle] [--description "…"] [--testnet]
|
|
60
|
+
gang v3 buy --token <addr> --amount <报价币数量> [--testnet] # 含内盘 1% 手续费(内盘不收税,税只在外盘收)
|
|
61
|
+
gang v3 sell --token <addr> (--amount <枚数> | --all) [--to-bnb] [--testnet] # 已毕业:buy / sell 经 GangRouter 走 PancakeSwap
|
|
62
|
+
gang v3 info --token <addr> [--testnet] # 税率、接收地址、还欠接收地址多少
|
|
63
|
+
gang v3 status --token <addr> [--testnet] # 我的持仓和分红:现在可领 + 已记账、还没卖出的部分
|
|
64
|
+
gang v3 claim --token <addr> [--testnet] # 领取分红(以报价币到账)
|
|
65
|
+
gang v3 release --token <addr> [--testnet] # 补转之前打款失败的税
|
|
66
|
+
gang v3 income --recipient 0x… # 接收地址按币统计的到账(读 gang.fun)
|
|
67
|
+
gang v3 list [--status curve|graduated|all] | gang v3 tx --hash <0x..> # 查询(可加 --testnet)
|
|
46
68
|
gang execute --request-id <id>
|
|
47
69
|
gang tx --hash <0x..>
|
|
48
70
|
```
|
|
@@ -138,7 +160,10 @@ gang agents --window 30d --sort follow
|
|
|
138
160
|
|
|
139
161
|
- 内盘每钱包 1%;多付同笔退回。
|
|
140
162
|
- **新**发币 ≈15 BNB 毕业(LaunchpadV2)。Soft 存量归档:20 BNB,仅买卖。
|
|
141
|
-
- 毕业前不可转账;毕业后走 PancakeSwap
|
|
163
|
+
- 毕业前不可转账;毕业后走 PancakeSwap:`gang buy` / `gang sell`(以及 `gang v3 buy|sell`、发射后的 `gang fair buy|sell`)
|
|
164
|
+
经 GangRouter 在外盘成交。先只授权本次用量,再发 `poolBuy` / `poolBuyBNB` / `poolSell` / `poolSellForBNB`;最少到手:买入按
|
|
165
|
+
`getAmountsOut` 扣买入税,卖出按税 handler 的 `previewSellNextBlock`,再扣 `--slippage`。`--use-quote` / `--pay-bnb` 选买入用什么付,
|
|
166
|
+
`--to-bnb` 卖成 BNB。带税的卖出约需 70 万 gas(会顺带换一块税):让钱包自动估算,或者至少给 75 万。生成任何步骤前先核对路由是带外盘功能的 GangRouter(不会是 Pancake 或旧路由);`--from` 只对外盘交易生效。详见 `references/v3.md`「Pool trades」。
|
|
142
167
|
|
|
143
168
|
## 环境变量
|
|
144
169
|
|
|
@@ -151,7 +176,10 @@ gang agents --window 30d --sort follow
|
|
|
151
176
|
| `GANG_NOTES_DIR` | 附言的本地队列,每条一个文件,记着 salt 和提交状态,保留 24 小时(默认 `~/.gang/notes`);其中的 `previews/` 记着每次交易 preview 带了什么(附言、跟单),供 `gang execute` 使用,也保留 24 小时 |
|
|
152
177
|
| `GANG_UPDATE_CHECK` | 设为 `0` 关闭每天一次的新版本检查(查 npm,缓存在 `~/.gang/update.json`) |
|
|
153
178
|
| `GANG_UPDATE_URL` | 新版本检查查询的地址,默认 `https://registry.npmjs.org/@gangfun/cli/latest`;npmjs 慢或打不开时,可以换成 npm 镜像的 `…/@gangfun/cli/latest` |
|
|
179
|
+
| `GANG_PAD` / `GANG_TESTNET_PAD` | 覆盖合并后的内盘合约 GangLaunchpad(主网 / 测试网),`gang v3` 和 `gang fair` 共用(默认:主网 `0x15CF…4365`,测试网第 10 套 `0xFebF…5BB1`)。旧名 `GANG_V3_PAD` / `GANG_FAIR_PAD`、`GANG_V3_TESTNET_PAD` / `GANG_FAIR_TESTNET_PAD` 仍可用(别名) |
|
|
180
|
+
| `GANG_TESTNET_RPC_URL` | 测试网 RPC;旧名 `GANG_V3_TESTNET_RPC_URL` / `GANG_FAIR_TESTNET_RPC_URL` 仍可用 |
|
|
181
|
+
| `GANG_ROUTER` / `GANG_TESTNET_ROUTER` | GangRouter 代理(用原生 BNB 买 V3 / 打新,以及已毕业币的所有外盘买卖);旧名 `GANG_ROUTER_TESTNET` 仍可用。默认:主网 `0xE040…79C4`,测试网第 10 套 `0x6bB6…C9F6` |
|
|
154
182
|
|
|
155
183
|
## 版本
|
|
156
184
|
|
|
157
|
-
`0.
|
|
185
|
+
`0.9.0` · [gangfun/cli](https://github.com/gangfun/cli) · push 到 `main` 自动发布到 [npm](https://www.npmjs.com/package/@gangfun/cli)(0.9.0 还没发布,npm 上是 0.8.0)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gangfun/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Gang launchpad CLI
|
|
3
|
+
"version": "0.9.1",
|
|
4
|
+
"description": "Gang launchpad CLI for Binance Agentic Wallet agents: LaunchpadV2 create / trade, V3 tax tokens, 打新 fair mint, PancakeSwap pool trades, legacy Soft/U/S trade.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"gang": "./src/index.js"
|
package/src/abi.js
CHANGED
|
@@ -62,6 +62,23 @@ export const V2_ABI = [
|
|
|
62
62
|
] },
|
|
63
63
|
]
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* LaunchpadS (stocks track): the V2 trade functions, but its Curve has 9 fields — no `taxed` (every S token is a
|
|
67
|
+
* TaxLaunchToken: 1% pool tax both ways) — and its Created event carries no logoURI / taxed / refPair.
|
|
68
|
+
*/
|
|
69
|
+
export const S_ABI = V2_ABI.filter((x) => !(x.name === 'curves' || (x.type === 'event' && x.name === 'Created'))).concat([
|
|
70
|
+
{ type: 'function', name: 'curves', stateMutability: 'view', inputs: [{ name: 'token', type: 'address' }], outputs: [
|
|
71
|
+
{ name: 'creator', type: 'address' }, { name: 'quote', type: 'address' }, { name: 'realQuote', type: 'uint128' }, { name: 'sold', type: 'uint128' },
|
|
72
|
+
{ name: 'gradAmt', type: 'uint128' }, { name: 'virtualQuote', type: 'uint128' }, { name: 'graduated', type: 'bool' },
|
|
73
|
+
{ name: 'pair', type: 'address' }, { name: 'refPair', type: 'address' },
|
|
74
|
+
] },
|
|
75
|
+
{ type: 'event', name: 'Created', inputs: [
|
|
76
|
+
{ name: 'token', type: 'address', indexed: true }, { name: 'creator', type: 'address', indexed: true },
|
|
77
|
+
{ name: 'name', type: 'string', indexed: false }, { name: 'symbol', type: 'string', indexed: false },
|
|
78
|
+
{ name: 'quote', type: 'address', indexed: true }, { name: 'gradAmt', type: 'uint256', indexed: false },
|
|
79
|
+
] },
|
|
80
|
+
])
|
|
81
|
+
|
|
65
82
|
export const ERC20_ABI = [
|
|
66
83
|
{ type: 'function', name: 'name', stateMutability: 'view', inputs: [], outputs: [{ type: 'string' }] },
|
|
67
84
|
{ type: 'function', name: 'symbol', stateMutability: 'view', inputs: [], outputs: [{ type: 'string' }] },
|
package/src/chain.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createPublicClient, http, formatEther, formatUnits, parseEther, encodeFunctionData, decodeEventLog, decodeErrorResult, isAddress, zeroAddress } from 'viem'
|
|
2
2
|
import { bsc } from 'viem/chains'
|
|
3
|
-
import { SOFT_ABI, V2_ABI, ERC20_ABI, WBNB_ABI } from './abi.js'
|
|
3
|
+
import { SOFT_ABI, V2_ABI, S_ABI, ERC20_ABI, WBNB_ABI } from './abi.js'
|
|
4
4
|
|
|
5
5
|
export const ADDR = {
|
|
6
6
|
v2: '0x1B8F3f69DFa0a7F63d308C7EB0Fd38D8b099966E',
|
|
@@ -41,7 +41,7 @@ const PADS = [
|
|
|
41
41
|
{ id: 'v2', address: ADDR.v2, kind: 'v2', abi: V2_ABI },
|
|
42
42
|
{ id: 'soft', address: ADDR.soft, kind: 'soft', abi: SOFT_ABI },
|
|
43
43
|
{ id: 'u', address: ADDR.u, kind: 'v2', abi: V2_ABI },
|
|
44
|
-
{ id: 's', address: ADDR.s, kind: 'v2', abi:
|
|
44
|
+
{ id: 's', address: ADDR.s, kind: 'v2', abi: S_ABI }, // 9-field Curve (no taxed): see S_ABI
|
|
45
45
|
]
|
|
46
46
|
|
|
47
47
|
/** Resolve which pad hosts `token` by probing curves(token).creator != 0. */
|
|
@@ -71,9 +71,18 @@ function v2InfoFromCurve(c) {
|
|
|
71
71
|
return { kind: 'v2', creator, raised: realQuote, sold, graduated, pair, quote, gradAmt, taxed, virtualQuote, refPair }
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
/** LaunchpadS: no `taxed` field — every S token is a TaxLaunchToken (1% pool tax). */
|
|
75
|
+
function sInfoFromCurve(c) {
|
|
76
|
+
const [creator, quote, realQuote, sold, gradAmt, virtualQuote, graduated, pair, refPair] = c
|
|
77
|
+
return { kind: 'v2', creator, raised: realQuote, sold, graduated, pair, quote, gradAmt, taxed: true, virtualQuote, refPair }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The curve of a resolved pad in one shape, whatever the pad's layout. */
|
|
81
|
+
const curveInfo = (pad) => (pad.kind === 'soft' ? softInfoFromCurve(pad.curve) : pad.id === 's' ? sInfoFromCurve(pad.curve) : v2InfoFromCurve(pad.curve))
|
|
82
|
+
|
|
74
83
|
export async function tokenInfo(token, me) {
|
|
75
84
|
const pad = await resolvePad(token)
|
|
76
|
-
const base =
|
|
85
|
+
const base = curveInfo(pad)
|
|
77
86
|
const [name, symbol] = await Promise.all([erc(token, 'name'), erc(token, 'symbol')])
|
|
78
87
|
let locked = null
|
|
79
88
|
try { locked = await erc(token, 'locked') } catch { /* */ }
|
|
@@ -211,7 +220,7 @@ export async function quoteBuy(token, buyer, amountHuman) {
|
|
|
211
220
|
quotePath: 'onchain-quoteBuy' }
|
|
212
221
|
}
|
|
213
222
|
// Unique path: LaunchpadV2.sol _prepBuy / _tokensOut / _quoteInFor (no on-chain quoteBuy view).
|
|
214
|
-
const base =
|
|
223
|
+
const base = curveInfo(pad)
|
|
215
224
|
let room = null
|
|
216
225
|
try { room = await read(pad.address, pad.abi, 'walletRoom', [token, buyer]) } catch { /* */ }
|
|
217
226
|
const q = v2QuoteBuyFromCurve(base, gross, room)
|
|
@@ -229,7 +238,7 @@ export async function quoteSell(token, tokensIn) {
|
|
|
229
238
|
tokensInFmt: fmtTok(tokensIn), outFmt: fmt(bnbToUser), feeFmt: fmt(fee), unit: 'BNB',
|
|
230
239
|
quotePath: 'onchain-quoteSell' }
|
|
231
240
|
}
|
|
232
|
-
const base =
|
|
241
|
+
const base = curveInfo(pad)
|
|
233
242
|
const q = v2QuoteSellFromCurve(base, tokensIn)
|
|
234
243
|
return { kind: 'v2', pad: pad.id, padAddress: pad.address, quote: base.quote, tokensIn, out: q.out, fee: q.fee,
|
|
235
244
|
tokensInFmt: fmtTok(tokensIn), outFmt: fmt(q.out), feeFmt: fmt(q.fee), unit: 'quote',
|