four-flap-meme-sdk 1.3.48 → 1.3.49
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.
|
@@ -493,17 +493,18 @@ export async function directV2BatchSell(params) {
|
|
|
493
493
|
// ABI 中没有 swapExactTokensForETH,只有 swapExactTokensForTokens
|
|
494
494
|
if (useNativeOutput) {
|
|
495
495
|
// 代币 -> ETH:swapExactTokensForTokens + unwrapWETH9
|
|
496
|
-
|
|
497
|
-
//
|
|
496
|
+
//
|
|
497
|
+
// 根据合约源码 Constants.sol:
|
|
498
|
+
// address(1) = MSG_SENDER = 调用者(用户)
|
|
498
499
|
// address(2) = ADDRESS_THIS = Router 合约自己
|
|
499
500
|
const ADDRESS_THIS = '0x0000000000000000000000000000000000000002';
|
|
501
|
+
const multicallData = [];
|
|
500
502
|
// 1. swapExactTokensForTokens - Token -> WETH,发送到 Router 自己
|
|
501
|
-
// path 最后一个元素是 WETH
|
|
502
503
|
const swapData = routerIface.encodeFunctionData('swapExactTokensForTokens', [
|
|
503
504
|
sellAmount,
|
|
504
505
|
0n, // amountOutMin
|
|
505
506
|
path, // path: [token, ..., WETH]
|
|
506
|
-
ADDRESS_THIS, // to = Router 自己,WETH 留在 Router 中
|
|
507
|
+
ADDRESS_THIS, // to = address(2) = Router 自己,WETH 留在 Router 中
|
|
507
508
|
]);
|
|
508
509
|
multicallData.push(swapData);
|
|
509
510
|
// 2. unwrapWETH9 - 将 Router 中的 WETH 解包为 ETH 发送给用户
|