four-flap-meme-sdk 1.5.5 → 1.5.8
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.
|
@@ -410,7 +410,13 @@ export async function flapBundleCreateToDex(params) {
|
|
|
410
410
|
}, useNativeToken ? { value: curveBuyAmounts[i] } : {});
|
|
411
411
|
// 最后一个买家触发毕业,需要更多 gas
|
|
412
412
|
const isLastBuyer = i === curveWallets.length - 1;
|
|
413
|
-
|
|
413
|
+
// ⚠️ 触发毕业(创建 Pancake V3 池 + Mint 初始流动性)会非常耗 gas。
|
|
414
|
+
// 链上成功样例 0x29b173... 的 gasLimit=8,000,000,gasUsed≈6,647,149。
|
|
415
|
+
// Flap 官方示例脚本也使用 last_buy=8_000_000。
|
|
416
|
+
const LAST_BUY_GAS_LIMIT = BigInt(8000000);
|
|
417
|
+
const buyGasLimit = isLastBuyer
|
|
418
|
+
? (finalGasLimit > LAST_BUY_GAS_LIMIT ? finalGasLimit : LAST_BUY_GAS_LIMIT)
|
|
419
|
+
: finalGasLimit;
|
|
414
420
|
const tx = {
|
|
415
421
|
...unsigned,
|
|
416
422
|
from: wallet.address,
|
|
@@ -483,11 +489,14 @@ export async function flapBundleCreateToDex(params) {
|
|
|
483
489
|
const exactInputSingleData = routerInterface.encodeFunctionData('exactInputSingle', [exactInputSingleParams]);
|
|
484
490
|
// 用 multicall 包装(官方要求的调用方式)
|
|
485
491
|
const multicallData = routerInterface.encodeFunctionData('multicall', [[exactInputSingleData]]);
|
|
492
|
+
// ⚠️ Pancake SmartRouter 外盘买的 gas 不能太小,否则 bundle 预执行会直接失败。
|
|
493
|
+
// Flap 官方示例配置 dex_buy=5_000_000(flap-bundle-release/app/configs/global.ts)。
|
|
494
|
+
const DEX_BUY_GAS_LIMIT = BigInt(8000000);
|
|
486
495
|
const tx = {
|
|
487
496
|
to: smartRouterAddress,
|
|
488
497
|
data: multicallData,
|
|
489
498
|
nonce: buyNonce,
|
|
490
|
-
gasLimit:
|
|
499
|
+
gasLimit: DEX_BUY_GAS_LIMIT,
|
|
491
500
|
chainId,
|
|
492
501
|
type: txType,
|
|
493
502
|
value: useNativeToken ? buyAmount : 0n
|