four-flap-meme-sdk 1.6.50 → 1.6.52

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.
@@ -573,17 +573,12 @@ export class AADexSwapExecutor {
573
573
  const totalBuyerPrefundEarly = (useNativeToken && capitalMode)
574
574
  ? buyerAis.reduce((sum, ai) => sum + estimateBuyerPrefundEarly(ai.deployed), 0n)
575
575
  : 0n;
576
- // ✅ 计算利润(考虑 buyerPrefund 后的可用利润空间)
577
- const profitWeiRaw = extractProfit ? calculateProfitWei(quotedSellOutWei, profitBps) : 0n;
578
- // 利润上限 = 卖出所得 - 买入金额 - buyerPrefund
579
- const profitCapWithPrefund = quotedSellOutWei > (totalBuyWei + totalBuyerPrefundEarly)
580
- ? (quotedSellOutWei - totalBuyWei - totalBuyerPrefundEarly)
581
- : 0n;
582
- const profitWei = profitWeiRaw > profitCapWithPrefund ? profitCapWithPrefund : profitWeiRaw;
583
- // ✅ 资金充足性检查:卖出所得 >= 买入金额 + buyerPrefund + 利润
576
+ // ✅ 计算利润(不再压缩到“卖出-买入-prefund”上限,按配置直接刮取)
577
+ const profitWei = extractProfit ? calculateProfitWei(quotedSellOutWei, profitBps) : 0n;
578
+ // 资金充足性提示:不再阻断,记录警告后继续分发
584
579
  const totalDistributeNeeded = totalBuyWei + totalBuyerPrefundEarly + profitWei;
585
580
  if (quotedSellOutWei > 0n && totalDistributeNeeded > quotedSellOutWei) {
586
- console.error('[AA DEX 批量换手] 资金不足:', {
581
+ console.warn('[AA DEX 批量换手] ⚠️ 预估卖出金额不足,仍继续分发:', {
587
582
  quotedSellOutWei: ethers.formatEther(quotedSellOutWei),
588
583
  totalBuyWei: ethers.formatEther(totalBuyWei),
589
584
  totalBuyerPrefund: ethers.formatEther(totalBuyerPrefundEarly),
@@ -591,7 +586,6 @@ export class AADexSwapExecutor {
591
586
  totalNeeded: ethers.formatEther(totalDistributeNeeded),
592
587
  shortfall: ethers.formatEther(totalDistributeNeeded - quotedSellOutWei),
593
588
  });
594
- throw new Error(`AA 批量换手:资金不足!卖出预估 ${ethers.formatEther(quotedSellOutWei)} OKB,但分发需要 ${ethers.formatEther(totalDistributeNeeded)} OKB(买入 ${ethers.formatEther(totalBuyWei)} + prefund ${ethers.formatEther(totalBuyerPrefundEarly)} + 利润 ${ethers.formatEther(profitWei)}),缺口 ${ethers.formatEther(totalDistributeNeeded - quotedSellOutWei)} OKB`);
595
589
  }
596
590
  // ✅ 利润在分发阶段通过 AA 内部刮取
597
591
  // ✅ 资金分发逻辑(仅 capitalMode=true 时执行,对应 BSC flapQuickBatchSwapMerkle)
@@ -384,17 +384,12 @@ export class AAPortalSwapExecutor {
384
384
  const totalBuyerPrefundEarly = (useNativeToken && capitalMode)
385
385
  ? buyerAis.reduce((sum, ai) => sum + estimateBuyerPrefundEarly(ai.deployed), 0n)
386
386
  : 0n;
387
- // ✅ 计算利润(考虑 buyerPrefund 后的可用利润空间)
388
- const profitWeiRaw = extractProfit ? calculateProfitWei(quotedSellOutWei, profitBps) : 0n;
389
- // 利润上限 = 卖出所得 - 买入金额 - buyerPrefund
390
- const profitCapWithPrefund = quotedSellOutWei > (totalBuyWei + totalBuyerPrefundEarly)
391
- ? (quotedSellOutWei - totalBuyWei - totalBuyerPrefundEarly)
392
- : 0n;
393
- const profitWei = profitWeiRaw > profitCapWithPrefund ? profitCapWithPrefund : profitWeiRaw;
394
- // ✅ 资金充足性检查:卖出所得 >= 买入金额 + buyerPrefund + 利润
387
+ // ✅ 计算利润(不再压缩到“卖出-买入-prefund”上限,按配置直接刮取)
388
+ const profitWei = extractProfit ? calculateProfitWei(quotedSellOutWei, profitBps) : 0n;
389
+ // 资金充足性提示:不再阻断,记录警告后继续分发
395
390
  const totalDistributeNeeded = totalBuyWei + totalBuyerPrefundEarly + profitWei;
396
391
  if (quotedSellOutWei > 0n && totalDistributeNeeded > quotedSellOutWei) {
397
- console.error('[AA Portal 批量换手] 资金不足:', {
392
+ console.warn('[AA Portal 批量换手] ⚠️ 预估卖出金额不足,仍继续分发:', {
398
393
  quotedSellOutWei: ethers.formatEther(quotedSellOutWei),
399
394
  totalBuyWei: ethers.formatEther(totalBuyWei),
400
395
  totalBuyerPrefund: ethers.formatEther(totalBuyerPrefundEarly),
@@ -402,7 +397,6 @@ export class AAPortalSwapExecutor {
402
397
  totalNeeded: ethers.formatEther(totalDistributeNeeded),
403
398
  shortfall: ethers.formatEther(totalDistributeNeeded - quotedSellOutWei),
404
399
  });
405
- throw new Error(`AA 批量换手:资金不足!卖出预估 ${ethers.formatEther(quotedSellOutWei)} OKB,但分发需要 ${ethers.formatEther(totalDistributeNeeded)} OKB(买入 ${ethers.formatEther(totalBuyWei)} + prefund ${ethers.formatEther(totalBuyerPrefundEarly)} + 利润 ${ethers.formatEther(profitWei)}),缺口 ${ethers.formatEther(totalDistributeNeeded - quotedSellOutWei)} OKB`);
406
400
  }
407
401
  // ✅ 利润在分发阶段通过 AA 内部刮取
408
402
  // ✅ 资金分发逻辑(仅 capitalMode=true 时执行,对应 BSC flapQuickBatchSwapMerkle)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.6.50",
3
+ "version": "1.6.52",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",