four-flap-meme-sdk 1.3.29 → 1.3.30
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.
|
@@ -461,8 +461,8 @@ export async function fourPancakeProxyBatchSellMerkle(params) {
|
|
|
461
461
|
else {
|
|
462
462
|
quotedOutputs = new Array(amountsWei.length).fill(0n);
|
|
463
463
|
}
|
|
464
|
-
// minOuts
|
|
465
|
-
minOuts = quotedOutputs.map(
|
|
464
|
+
// ✅ minOuts = 0,不设置滑点限制(大额交易更稳定)
|
|
465
|
+
minOuts = quotedOutputs.map(() => 0n);
|
|
466
466
|
}
|
|
467
467
|
// ✅ 计算利润并找出收益最多的钱包(提前计算,预先获取 nonce)
|
|
468
468
|
let totalProfit = 0n;
|
|
@@ -295,8 +295,8 @@ export async function fourBatchPrivateSellMerkle(params) {
|
|
|
295
295
|
return 0n;
|
|
296
296
|
}
|
|
297
297
|
}));
|
|
298
|
-
// minOuts
|
|
299
|
-
minOuts = quotedOutputs.map(
|
|
298
|
+
// ✅ minOuts = 0,不设置滑点限制(大额交易更稳定)
|
|
299
|
+
minOuts = quotedOutputs.map(() => 0n);
|
|
300
300
|
}
|
|
301
301
|
// ✅ Step 0: 检查代币余额
|
|
302
302
|
const tokenContract = new ethers.Contract(tokenAddress, ERC20_ABI, provider);
|
|
@@ -554,11 +554,13 @@ async function quoteSellOutputsWithQuote(portal, tokenAddress, amountsWei, outpu
|
|
|
554
554
|
}));
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
|
-
function resolveMinOutputs(provided, walletCount,
|
|
557
|
+
function resolveMinOutputs(provided, walletCount, _quotedOutputs) {
|
|
558
558
|
if (provided && provided.length === walletCount) {
|
|
559
559
|
return provided.map(m => typeof m === 'string' ? ethers.parseEther(m) : BigInt(m));
|
|
560
560
|
}
|
|
561
|
-
|
|
561
|
+
// ✅ 默认 minOutput = 0,不设置滑点限制
|
|
562
|
+
// 原因:大额交易时 5% 滑点可能不够,导致交易失败
|
|
563
|
+
return Array(walletCount).fill(0n);
|
|
562
564
|
}
|
|
563
565
|
async function appendSellProfitTransaction({ extractProfit, quotedOutputs, wallets, nonceManager, signedTxs, chainId, gasPrice, config, outputToken, useNativeOutput = true, provider }) {
|
|
564
566
|
if (!extractProfit || quotedOutputs.length === 0) {
|
|
@@ -532,7 +532,7 @@ async function resolveSellOutputs({ params, provider, tokenAddress, routeType, a
|
|
|
532
532
|
const quotedOutput = await getSingleQuote(params, provider, tokenAddress, routeType, amountsWei[0]);
|
|
533
533
|
return {
|
|
534
534
|
quotedOutputs: [quotedOutput],
|
|
535
|
-
minOuts: [
|
|
535
|
+
minOuts: [0n] // ✅ minOutput = 0,不设置滑点限制
|
|
536
536
|
};
|
|
537
537
|
}
|
|
538
538
|
// ✅ 使用 Multicall3 批量获取报价(仅 V2 路由支持)
|
|
@@ -561,7 +561,7 @@ async function resolveSellOutputs({ params, provider, tokenAddress, routeType, a
|
|
|
561
561
|
});
|
|
562
562
|
return {
|
|
563
563
|
quotedOutputs,
|
|
564
|
-
minOuts: quotedOutputs.map((
|
|
564
|
+
minOuts: quotedOutputs.map(() => 0n) // ✅ minOutput = 0,不设置滑点限制
|
|
565
565
|
};
|
|
566
566
|
}
|
|
567
567
|
catch {
|
|
@@ -572,7 +572,7 @@ async function resolveSellOutputs({ params, provider, tokenAddress, routeType, a
|
|
|
572
572
|
const quotedOutputs = await Promise.all(amountsWei.map(amount => getSingleQuote(params, provider, tokenAddress, routeType, amount)));
|
|
573
573
|
return {
|
|
574
574
|
quotedOutputs,
|
|
575
|
-
minOuts: quotedOutputs.map(
|
|
575
|
+
minOuts: quotedOutputs.map(() => 0n) // ✅ minOutput = 0,不设置滑点限制
|
|
576
576
|
};
|
|
577
577
|
}
|
|
578
578
|
/**
|