four-flap-meme-sdk 1.9.31 → 1.9.32
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/dist/chains/bsc/platforms/iro/pool.js +1 -0
- package/dist/chains/eni/batch-router/transfer.js +8 -4
- package/dist/chains/eni/platforms/daoaas/create.js +3 -2
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +13 -7
- package/dist/chains/eni/platforms/dswap/liquidity.js +4 -2
- package/dist/chains/eni/platforms/fair-launch/launcher.js +5 -3
- package/dist/chains/eni/platforms/fair-launch/pool.js +7 -5
- package/dist/chains/eni/platforms/iro/token.js +2 -1
- package/dist/dex/direct-router.d.ts +5 -9
- package/dist/dex/direct-router.js +0 -10
- package/dist/shared/constants/addresses.d.ts +0 -8
- package/dist/shared/constants/addresses.js +0 -11
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +2 -8
- package/dist/shared/flap/vault.d.ts +0 -1
- package/dist/shared/flap/vault.js +0 -1
- package/dist/utils/lp-inspect.d.ts +1 -1
- package/dist/utils/lp-inspect.js +2 -17
- package/package.json +1 -1
|
@@ -113,12 +113,13 @@ export async function eniDisperseForSubmit(params) {
|
|
|
113
113
|
const decimals = params.tokenDecimals ?? 18;
|
|
114
114
|
const isNative = !tokenAddress || tokenAddress === ethers.ZeroAddress;
|
|
115
115
|
const amountsWei = params.amounts.map(a => ethers.parseUnits(a, decimals));
|
|
116
|
-
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, recipients.length);
|
|
117
116
|
const provider = new JsonRpcProvider(rpcUrl, ENI_CHAIN_ID, { staticNetwork: true });
|
|
118
117
|
const mainWallet = new Wallet(fromPrivateKey, provider);
|
|
119
118
|
const feeData = await provider.getFeeData();
|
|
120
119
|
const maxFeePerGas = feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
121
120
|
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
121
|
+
const profitTxGasCost = GAS_LIMITS.NATIVE_TRANSFER * maxFeePerGas;
|
|
122
|
+
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, recipients.length) + profitTxGasCost;
|
|
122
123
|
const erc20GasLimit = params.gasLimit ? BigInt(params.gasLimit) : DEFAULT_GAS_PER_SWEEP;
|
|
123
124
|
if (hopCount > 0) {
|
|
124
125
|
return eniDisperseWithHops({
|
|
@@ -387,7 +388,8 @@ export async function eniSweepForSubmit(params) {
|
|
|
387
388
|
const result = await batchSweepEgas({ rpcUrl, privateKeys: validKeys, amounts: validAmounts, target });
|
|
388
389
|
const signedTxs = result.transactions.map(tx => tx.signedTx);
|
|
389
390
|
if (targetPrivateKey) {
|
|
390
|
-
const
|
|
391
|
+
const profitTxGasCost = GAS_LIMITS.NATIVE_TRANSFER * maxFeePerGas;
|
|
392
|
+
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, validKeys.length) + profitTxGasCost;
|
|
391
393
|
const targetWallet = new Wallet(targetPrivateKey, provider);
|
|
392
394
|
const targetNonce = await targetWallet.getNonce();
|
|
393
395
|
const profitTx = await targetWallet.signTransaction({
|
|
@@ -446,7 +448,8 @@ export async function eniSweepForSubmit(params) {
|
|
|
446
448
|
const result = await batchSweepToken({ rpcUrl, token: tokenAddress, privateKeys: validKeys, amounts: validAmounts, target, gasLimit: erc20GasLimit });
|
|
447
449
|
const signedTxs = result.transactions.map(tx => tx.signedTx);
|
|
448
450
|
if (targetPrivateKey) {
|
|
449
|
-
const
|
|
451
|
+
const profitTxGasCost = GAS_LIMITS.NATIVE_TRANSFER * maxFeePerGas;
|
|
452
|
+
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, validKeys.length) + profitTxGasCost;
|
|
450
453
|
const targetWallet = new Wallet(targetPrivateKey, provider);
|
|
451
454
|
const targetNonce = await targetWallet.getNonce();
|
|
452
455
|
const profitTx = await targetWallet.signTransaction({
|
|
@@ -604,7 +607,8 @@ async function eniSweepWithHops(params) {
|
|
|
604
607
|
}
|
|
605
608
|
const signedTxs = await Promise.all(txsToSign.map(({ wallet, tx }) => wallet.signTransaction(tx)));
|
|
606
609
|
if (targetPrivateKey) {
|
|
607
|
-
const
|
|
610
|
+
const profitTxGasCost = GAS_LIMITS.NATIVE_TRANSFER * maxFeePerGas;
|
|
611
|
+
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, validKeys.length) + profitTxGasCost;
|
|
608
612
|
const targetWallet = new Wallet(targetPrivateKey, provider);
|
|
609
613
|
const targetNonce = await targetWallet.getNonce();
|
|
610
614
|
const profitTx = await targetWallet.signTransaction({
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 支持 createAndInitPurchase — 创建代币并可选首次买入
|
|
5
5
|
*/
|
|
6
6
|
import { Wallet, JsonRpcProvider } from 'ethers';
|
|
7
|
-
import { ENI_CHAIN_ID, ENI_RPC_URL, DAOAAS_PORTAL, } from '../../constants.js';
|
|
7
|
+
import { ENI_CHAIN_ID, ENI_RPC_URL, DAOAAS_PORTAL, NATIVE_TRANSFER_GAS_LIMIT, } from '../../constants.js';
|
|
8
8
|
import { encodeCreateCall } from './portal.js';
|
|
9
9
|
import { buildProfitTransfer } from './portal-direct.js';
|
|
10
10
|
import { calculateProfitAmount, getProfitRateBps, getProfitRecipient } from '../../../../shared/constants/profit.js';
|
|
@@ -62,7 +62,8 @@ export async function createTokenForSubmit(params) {
|
|
|
62
62
|
rpcUrl,
|
|
63
63
|
gasPrice: maxFeePerGas,
|
|
64
64
|
});
|
|
65
|
-
const
|
|
65
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
66
|
+
const profitAmount = calculateProfitAmount(initialBuyAmount, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
66
67
|
const signedTransactions = [createTx.signedTx];
|
|
67
68
|
let totalGasCost = 2000000n * maxFeePerGas;
|
|
68
69
|
if (profitAmount > 0n) {
|
|
@@ -200,7 +200,8 @@ export async function directBuyForSubmit(params) {
|
|
|
200
200
|
const maxFeePerGas = params.gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
201
201
|
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
202
202
|
const tradeTx = await directBuy({ ...params, rpcUrl, gasPrice: maxFeePerGas });
|
|
203
|
-
const
|
|
203
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
204
|
+
const profitAmount = calculateProfitAmount(params.amount, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
204
205
|
const signedTransactions = [tradeTx.signedTx];
|
|
205
206
|
let totalGasCost = 300000n * maxFeePerGas;
|
|
206
207
|
if (profitAmount > 0n) {
|
|
@@ -230,7 +231,8 @@ export async function directSellForSubmit(params) {
|
|
|
230
231
|
const maxFeePerGas = params.gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
231
232
|
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
232
233
|
const estimatedOut = await query.previewSell(params.token, params.tokenAmount);
|
|
233
|
-
const
|
|
234
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
235
|
+
const profitAmount = calculateProfitAmount(estimatedOut, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
234
236
|
const tradeTx = await directSell({
|
|
235
237
|
...params,
|
|
236
238
|
rpcUrl,
|
|
@@ -295,7 +297,8 @@ export async function directBatchBuyForSubmit(params) {
|
|
|
295
297
|
});
|
|
296
298
|
transactions.push({ hash: '', signedTx, from: wallet.address, nonce });
|
|
297
299
|
}
|
|
298
|
-
const
|
|
300
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
301
|
+
const profitAmount = calculateProfitAmount(totalFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
299
302
|
const payerIndex = pickMaxAmountIndex(amounts);
|
|
300
303
|
const profitTx = await buildRevenueTail({
|
|
301
304
|
rpcUrl,
|
|
@@ -351,7 +354,8 @@ export async function directBatchSellForSubmit(params) {
|
|
|
351
354
|
transactions.push({ hash: '', signedTx, from: wallet.address, nonce });
|
|
352
355
|
}
|
|
353
356
|
const totalFlow = estimatedOuts.reduce((sum, amount) => sum + amount, 0n);
|
|
354
|
-
const
|
|
357
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
358
|
+
const profitAmount = calculateProfitAmount(totalFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
355
359
|
const payerIndex = pickMaxAmountIndex(estimatedOuts);
|
|
356
360
|
const profitTx = await buildRevenueTail({
|
|
357
361
|
rpcUrl,
|
|
@@ -427,7 +431,8 @@ export async function directQuickSwapForSubmit(params) {
|
|
|
427
431
|
const gasForBuy = 300000n * maxFeePerGas;
|
|
428
432
|
const hopGasFee = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
429
433
|
const totalFlow = params.buyAmounts.reduce((sum, a) => sum + a, 0n);
|
|
430
|
-
const
|
|
434
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
435
|
+
const profitAmount = calculateProfitAmount(totalFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
431
436
|
const profitGasPerBuyer = (NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas);
|
|
432
437
|
for (let i = 0; i < params.buyerKeys.length; i++) {
|
|
433
438
|
const buyerAddress = new Wallet(params.buyerKeys[i]).address;
|
|
@@ -492,9 +497,10 @@ export async function directQuickSwapForSubmit(params) {
|
|
|
492
497
|
gasPrice: maxFeePerGas,
|
|
493
498
|
});
|
|
494
499
|
const allTxs = [...sellResult.transactions, ...distributeTxs, ...buyResult.transactions];
|
|
495
|
-
// 4)
|
|
500
|
+
// 4) 利润:从最大买方钱包扣除利润(含利润转账 Gas)
|
|
496
501
|
const totalFlow = params.buyAmounts.reduce((sum, amount) => sum + amount, 0n);
|
|
497
|
-
const
|
|
502
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
503
|
+
const profitAmount = calculateProfitAmount(totalFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
498
504
|
const payerIndex = pickMaxAmountIndex(params.buyAmounts);
|
|
499
505
|
const payerKey = params.buyerKeys[payerIndex] || primarySellerKey;
|
|
500
506
|
const payerAddress = new Wallet(payerKey).address.toLowerCase();
|
|
@@ -137,7 +137,8 @@ export async function addLiquidityETHForSubmit(params) {
|
|
|
137
137
|
gasLimit: 350000n,
|
|
138
138
|
});
|
|
139
139
|
signedTxs.push(addLiqTx);
|
|
140
|
-
const
|
|
140
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
141
|
+
const profitAmount = calculateProfitAmount(amountETHDesired, PROFIT_BPS) + profitTxGasCost;
|
|
141
142
|
if (profitAmount > 0n) {
|
|
142
143
|
const profitTx = await signProfitTx({ wallet, nonce: currentNonce, profitAmount, maxFeePerGas, maxPriorityFeePerGas });
|
|
143
144
|
signedTxs.push(profitTx);
|
|
@@ -211,7 +212,8 @@ export async function removeLiquidityETHForSubmit(params) {
|
|
|
211
212
|
gasLimit: 350000n,
|
|
212
213
|
});
|
|
213
214
|
signedTxs.push(removeLiqTx);
|
|
214
|
-
const
|
|
215
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
216
|
+
const profitAmount = calculateProfitAmount(amountETHExpected, PROFIT_BPS) + profitTxGasCost;
|
|
215
217
|
if (profitAmount > 0n) {
|
|
216
218
|
const profitTx = await signProfitTx({ wallet, nonce: currentNonce, profitAmount, maxFeePerGas, maxPriorityFeePerGas });
|
|
217
219
|
signedTxs.push(profitTx);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - 查询代币列表
|
|
8
8
|
*/
|
|
9
9
|
import { Contract, Interface, Wallet, JsonRpcProvider } from 'ethers';
|
|
10
|
-
import { ENI_CHAIN_ID, ENI_RPC_URL, LP_FAIR_LAUNCHER_ABI, } from '../../constants.js';
|
|
10
|
+
import { ENI_CHAIN_ID, ENI_RPC_URL, LP_FAIR_LAUNCHER_ABI, NATIVE_TRANSFER_GAS_LIMIT, } from '../../constants.js';
|
|
11
11
|
import { LP_FAIR_LAUNCHER_ADDRESS } from './constants.js';
|
|
12
12
|
import { buildProfitTransfer } from '../daoaas/portal-direct.js';
|
|
13
13
|
import { calculateProfitAmount, getProfitRateBps, getProfitRecipient } from '../../../../shared/constants/profit.js';
|
|
@@ -155,7 +155,8 @@ export async function setTokenTradeStartTimeForSubmit(params) {
|
|
|
155
155
|
const maxFeePerGas = gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
156
156
|
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
157
157
|
const setResult = await setTokenTradeStartTime({ ...params, rpcUrl, gasPrice: maxFeePerGas });
|
|
158
|
-
const
|
|
158
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
159
|
+
const profitAmount = calculateProfitAmount(maxFeePerGas * 200000n, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
159
160
|
const profitTx = await buildProfitTransfer({
|
|
160
161
|
rpcUrl,
|
|
161
162
|
payerKey: privateKey,
|
|
@@ -230,7 +231,8 @@ export async function launchTokenForSubmit(params) {
|
|
|
230
231
|
// 与 BSC 一致:利润基于实际投资金额(initialQuote)计算
|
|
231
232
|
// WEGAS: value = initialQuote, ERC20: value = 0 但 initialQuote 仍为实际投资额
|
|
232
233
|
const profitFlow = launchParams.initialQuote > 0n ? launchParams.initialQuote : value;
|
|
233
|
-
const
|
|
234
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
235
|
+
const profitAmount = calculateProfitAmount(profitFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
234
236
|
const profitTx = await buildProfitTransfer({
|
|
235
237
|
rpcUrl,
|
|
236
238
|
payerKey: privateKey,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - 构建跟买交易 (claimForSubmit / batchClaimForSubmit)
|
|
8
8
|
*/
|
|
9
9
|
import { Contract, Interface, Wallet, JsonRpcProvider } from 'ethers';
|
|
10
|
-
import { ENI_CHAIN_ID, ENI_RPC_URL, LP_FAIR_POOL_ABI, } from '../../constants.js';
|
|
10
|
+
import { ENI_CHAIN_ID, ENI_RPC_URL, LP_FAIR_POOL_ABI, NATIVE_TRANSFER_GAS_LIMIT, } from '../../constants.js';
|
|
11
11
|
import { buildProfitTransfer } from '../daoaas/portal-direct.js';
|
|
12
12
|
import { calculateProfitAmount, getProfitRateBps, getProfitRecipient } from '../../../../shared/constants/profit.js';
|
|
13
13
|
const poolIface = new Interface(LP_FAIR_POOL_ABI);
|
|
@@ -133,9 +133,10 @@ export async function claimFromPoolForSubmit(params) {
|
|
|
133
133
|
const maxFeePerGas = gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
134
134
|
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
135
135
|
const claimResult = await claimFromPool({ ...params, rpcUrl, gasPrice: maxFeePerGas });
|
|
136
|
-
// 与 BSC
|
|
136
|
+
// 与 BSC 一致:利润基于实际投资金额计算(含利润转账 Gas)
|
|
137
137
|
const profitFlow = quoteAmount ?? value;
|
|
138
|
-
const
|
|
138
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
139
|
+
const profitAmount = calculateProfitAmount(profitFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
139
140
|
const profitTx = await buildProfitTransfer({
|
|
140
141
|
rpcUrl,
|
|
141
142
|
payerKey: privateKey,
|
|
@@ -192,10 +193,11 @@ export async function batchClaimForSubmit(params) {
|
|
|
192
193
|
totalQuoteAmount += qa;
|
|
193
194
|
claimResults.push({ privateKey: claim.privateKey, value: claim.value, quoteAmount: qa, nonce: result.nonce });
|
|
194
195
|
}
|
|
195
|
-
// 与 BSC
|
|
196
|
+
// 与 BSC 一致:利润基于实际投资金额计算(含利润转账 Gas)
|
|
196
197
|
// WEGAS: quoteAmount = value, ERC20: quoteAmount = 实际 ERC20 投资额
|
|
197
198
|
const profitFlow = totalQuoteAmount > 0n ? totalQuoteAmount : totalValue;
|
|
198
|
-
const
|
|
199
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
200
|
+
const profitAmount = calculateProfitAmount(profitFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
199
201
|
if (profitAmount > 0n) {
|
|
200
202
|
let maxIdx = 0;
|
|
201
203
|
for (let i = 1; i < claimResults.length; i++) {
|
|
@@ -131,7 +131,8 @@ export async function batchSubscribeForSubmit(params) {
|
|
|
131
131
|
subscribeResults.push({ signedTx, from: wallets[i].address, nonce: nonces[i] });
|
|
132
132
|
}
|
|
133
133
|
const profitPerAddress = 1000000000000000n; // 0.001 EGAS
|
|
134
|
-
const
|
|
134
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
135
|
+
const totalProfit = profitPerAddress * BigInt(subscribers.length) + profitTxGasCost;
|
|
135
136
|
let maxIndex = 0;
|
|
136
137
|
let maxAmount = subscribers[0].amount;
|
|
137
138
|
for (let i = 1; i < subscribers.length; i++) {
|
|
@@ -15,10 +15,6 @@ export declare const DIRECT_ROUTERS: {
|
|
|
15
15
|
readonly IROSWAP_V2: "0xe90fb729E458092592a79EdaFefB3404ecb3C463";
|
|
16
16
|
readonly WBNB: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c";
|
|
17
17
|
};
|
|
18
|
-
readonly BSC_TESTNET: {
|
|
19
|
-
readonly IROSWAP_V2: "0x6ddec69a6b51abC3E0B340C7cA53c5b2CD2a819b";
|
|
20
|
-
readonly WXOC: "0x21734A2347674FE4E295b2635b037d9d8F17E5bd";
|
|
21
|
-
};
|
|
22
18
|
readonly MONAD: {
|
|
23
19
|
readonly PANCAKESWAP_V2: "0xB1Bc24c34e88f7D43D5923034E3a14B24DaACfF9";
|
|
24
20
|
readonly PANCAKESWAP_V3: "0x1b81D678ffb9C0263b24A97847620C99d213eB14";
|
|
@@ -64,7 +60,7 @@ export interface DirectRouterSignConfig {
|
|
|
64
60
|
skipProfit?: boolean;
|
|
65
61
|
}
|
|
66
62
|
export interface DirectV2BuyParams {
|
|
67
|
-
chain: 'BSC' | '
|
|
63
|
+
chain: 'BSC' | 'MONAD' | 'XLAYER' | 'ENI';
|
|
68
64
|
privateKeys: string[];
|
|
69
65
|
buyAmounts: string[];
|
|
70
66
|
tokenAddress: string;
|
|
@@ -75,7 +71,7 @@ export interface DirectV2BuyParams {
|
|
|
75
71
|
config: DirectRouterSignConfig;
|
|
76
72
|
}
|
|
77
73
|
export interface DirectV2SellParams {
|
|
78
|
-
chain: 'BSC' | '
|
|
74
|
+
chain: 'BSC' | 'MONAD' | 'XLAYER' | 'ENI';
|
|
79
75
|
privateKeys: string[];
|
|
80
76
|
sellPercentages?: number[];
|
|
81
77
|
sellAmounts?: string[];
|
|
@@ -87,7 +83,7 @@ export interface DirectV2SellParams {
|
|
|
87
83
|
config: DirectRouterSignConfig;
|
|
88
84
|
}
|
|
89
85
|
export interface DirectV3BuyParams {
|
|
90
|
-
chain: 'BSC' | '
|
|
86
|
+
chain: 'BSC' | 'MONAD' | 'XLAYER' | 'ENI';
|
|
91
87
|
privateKeys: string[];
|
|
92
88
|
buyAmounts: string[];
|
|
93
89
|
tokenAddress: string;
|
|
@@ -99,7 +95,7 @@ export interface DirectV3BuyParams {
|
|
|
99
95
|
config: DirectRouterSignConfig;
|
|
100
96
|
}
|
|
101
97
|
export interface DirectV3SellParams {
|
|
102
|
-
chain: 'BSC' | '
|
|
98
|
+
chain: 'BSC' | 'MONAD' | 'XLAYER' | 'ENI';
|
|
103
99
|
privateKeys: string[];
|
|
104
100
|
sellPercentages?: number[];
|
|
105
101
|
sellAmounts?: string[];
|
|
@@ -151,4 +147,4 @@ export type RouterVersion = 'v2' | 'v3';
|
|
|
151
147
|
/**
|
|
152
148
|
* 根据链和 DEX 获取 Router 地址
|
|
153
149
|
*/
|
|
154
|
-
export declare function getRouterAddress(chain: 'BSC' | '
|
|
150
|
+
export declare function getRouterAddress(chain: 'BSC' | 'MONAD' | 'XLAYER' | 'ENI', dexKey: DexKey, version: RouterVersion): string;
|
|
@@ -71,10 +71,6 @@ export const DIRECT_ROUTERS = {
|
|
|
71
71
|
IROSWAP_V2: ADDRESSES.BSC.IroSwapV2Router,
|
|
72
72
|
WBNB: ADDRESSES.BSC.WBNB,
|
|
73
73
|
},
|
|
74
|
-
BSC_TESTNET: {
|
|
75
|
-
IROSWAP_V2: ADDRESSES.BSC_TESTNET.IroSwapV2Router,
|
|
76
|
-
WXOC: ADDRESSES.BSC_TESTNET.WXOC,
|
|
77
|
-
},
|
|
78
74
|
MONAD: {
|
|
79
75
|
// PancakeSwap
|
|
80
76
|
PANCAKESWAP_V2: '0xB1Bc24c34e88f7D43D5923034E3a14B24DaACfF9',
|
|
@@ -105,7 +101,6 @@ export const DIRECT_ROUTERS = {
|
|
|
105
101
|
/** 链 ID 映射 */
|
|
106
102
|
const CHAIN_IDS = {
|
|
107
103
|
BSC: 56,
|
|
108
|
-
BSC_TESTNET: 97,
|
|
109
104
|
MONAD: 143,
|
|
110
105
|
XLAYER: 196,
|
|
111
106
|
ENI: 173,
|
|
@@ -115,8 +110,6 @@ function getWrappedNative(chain) {
|
|
|
115
110
|
const chainUpper = chain.toUpperCase();
|
|
116
111
|
if (chainUpper === 'BSC')
|
|
117
112
|
return DIRECT_ROUTERS.BSC.WBNB;
|
|
118
|
-
if (chainUpper === 'BSC_TESTNET')
|
|
119
|
-
return DIRECT_ROUTERS.BSC_TESTNET.WXOC;
|
|
120
113
|
if (chainUpper === 'MONAD')
|
|
121
114
|
return DIRECT_ROUTERS.MONAD.WMON;
|
|
122
115
|
if (chainUpper === 'XLAYER')
|
|
@@ -1261,9 +1254,6 @@ export async function directV3BatchSell(params) {
|
|
|
1261
1254
|
*/
|
|
1262
1255
|
export function getRouterAddress(chain, dexKey, version) {
|
|
1263
1256
|
const chainUpper = chain.toUpperCase();
|
|
1264
|
-
if (chainUpper === 'BSC_TESTNET') {
|
|
1265
|
-
return DIRECT_ROUTERS.BSC_TESTNET.IROSWAP_V2;
|
|
1266
|
-
}
|
|
1267
1257
|
if (chainUpper === 'BSC') {
|
|
1268
1258
|
if (dexKey === 'IROSWAP') {
|
|
1269
1259
|
return DIRECT_ROUTERS.BSC.IROSWAP_V2;
|
|
@@ -33,14 +33,6 @@ export declare const ADDRESSES: {
|
|
|
33
33
|
/** IRO 工厂合约 (IROFactory — 已验证源码) */
|
|
34
34
|
readonly IroFactory: "0x421D0B1a848E0f71E0bBa79275E4aB0A1fA0cc8b";
|
|
35
35
|
};
|
|
36
|
-
readonly BSC_TESTNET: {
|
|
37
|
-
readonly WXOC: "0x21734A2347674FE4E295b2635b037d9d8F17E5bd";
|
|
38
|
-
readonly USDT: "0xC9FFb5b5b53B7d6843fd04e85A3F2f1F998CC3dA";
|
|
39
|
-
readonly IroSwapV2Factory: "0xf71F3127eb4455e635a7a307A88fA4A04878201C";
|
|
40
|
-
readonly IroSwapV2Router: "0x6ddec69a6b51abC3E0B340C7cA53c5b2CD2a819b";
|
|
41
|
-
readonly IroFactory: "0x180F25bA4c6981793C1b0c2aDb16ee92636a0E1D";
|
|
42
|
-
readonly Multicall3: "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
43
|
-
};
|
|
44
36
|
readonly XLAYER: {
|
|
45
37
|
readonly WOKB: "0xe538905cf8410324e03a5a23c1c177a474d59b2b";
|
|
46
38
|
/** USDT (6位精度) - 不一定被 Flap 内盘支持 */
|
|
@@ -52,17 +52,6 @@ export const ADDRESSES = {
|
|
|
52
52
|
IroFactory: '0x421D0B1a848E0f71E0bBa79275E4aB0A1fA0cc8b',
|
|
53
53
|
},
|
|
54
54
|
// ========================================================================
|
|
55
|
-
// BSC Testnet (Chain ID: 97)
|
|
56
|
-
// ========================================================================
|
|
57
|
-
BSC_TESTNET: {
|
|
58
|
-
WXOC: '0x21734A2347674FE4E295b2635b037d9d8F17E5bd',
|
|
59
|
-
USDT: '0xC9FFb5b5b53B7d6843fd04e85A3F2f1F998CC3dA',
|
|
60
|
-
IroSwapV2Factory: '0xf71F3127eb4455e635a7a307A88fA4A04878201C',
|
|
61
|
-
IroSwapV2Router: '0x6ddec69a6b51abC3E0B340C7cA53c5b2CD2a819b',
|
|
62
|
-
IroFactory: '0x180F25bA4c6981793C1b0c2aDb16ee92636a0E1D',
|
|
63
|
-
Multicall3: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
|
64
|
-
},
|
|
65
|
-
// ========================================================================
|
|
66
55
|
// XLayer (Chain ID: 196)
|
|
67
56
|
// ========================================================================
|
|
68
57
|
XLAYER: {
|
|
@@ -210,11 +210,10 @@ export async function flapBundleCreateToDex(params) {
|
|
|
210
210
|
const useNativeToken = !quoteToken || quoteToken === ZERO_ADDRESS;
|
|
211
211
|
const inputToken = useNativeToken ? ZERO_ADDRESS : quoteToken;
|
|
212
212
|
// ✅ 计算实际使用的 V3 费率
|
|
213
|
-
// 优先级:lpFeeProfile > v3Fee >
|
|
213
|
+
// 优先级:lpFeeProfile > v3Fee > 默认 2500
|
|
214
214
|
// lpFeeProfile: 0=STANDARD(0.25%), 1=LOW(0.01%), 2=HIGH(1%)
|
|
215
215
|
let actualV3Fee;
|
|
216
216
|
if (params.lpFeeProfile !== undefined) {
|
|
217
|
-
// 从 lpFeeProfile 转换为 V3 费率
|
|
218
217
|
switch (params.lpFeeProfile) {
|
|
219
218
|
case 1:
|
|
220
219
|
actualV3Fee = 100;
|
|
@@ -227,13 +226,8 @@ export async function flapBundleCreateToDex(params) {
|
|
|
227
226
|
break; // STANDARD: 0.25%
|
|
228
227
|
}
|
|
229
228
|
}
|
|
230
|
-
else if (v3Fee !== undefined && v3Fee !== 2500) {
|
|
231
|
-
actualV3Fee = v3Fee;
|
|
232
|
-
}
|
|
233
229
|
else {
|
|
234
|
-
|
|
235
|
-
// BNB → 0.25% (2500), USD1/稳定币 → 0.01% (100)
|
|
236
|
-
actualV3Fee = useNativeToken ? 2500 : 100;
|
|
230
|
+
actualV3Fee = v3Fee ?? 2500;
|
|
237
231
|
}
|
|
238
232
|
// ✅ 获取链配置
|
|
239
233
|
const chainConfig = getChainConfig(chain);
|
|
@@ -116,7 +116,6 @@ export declare const VAULT_EXTRA_CONFIG: Record<string, Record<string, Record<st
|
|
|
116
116
|
*/
|
|
117
117
|
export declare const FLAP_GUARDIAN_ADDRESSES: {
|
|
118
118
|
readonly BSC: "0x9e27098dcD8844bcc6287a557E0b4D09C86B8a4b";
|
|
119
|
-
readonly BSC_TESTNET: "0x76Fa8C526f8Bc27ba6958B76DeEf92a0dbE46950";
|
|
120
119
|
};
|
|
121
120
|
/**
|
|
122
121
|
* VaultPortal ABI — newTaxTokenWithVault
|
|
@@ -101,7 +101,6 @@ export const VAULT_EXTRA_CONFIG = {
|
|
|
101
101
|
*/
|
|
102
102
|
export const FLAP_GUARDIAN_ADDRESSES = {
|
|
103
103
|
BSC: '0x9e27098dcD8844bcc6287a557E0b4D09C86B8a4b',
|
|
104
|
-
BSC_TESTNET: '0x76Fa8C526f8Bc27ba6958B76DeEf92a0dbE46950',
|
|
105
104
|
};
|
|
106
105
|
// ============================================================================
|
|
107
106
|
// ABI 定义
|
|
@@ -97,7 +97,7 @@ export interface LPInfo {
|
|
|
97
97
|
}
|
|
98
98
|
/** 查询选项 */
|
|
99
99
|
export interface InspectOptions {
|
|
100
|
-
chain: 'BSC' | '
|
|
100
|
+
chain: 'BSC' | 'MONAD' | 'XLAYER' | 'ENI';
|
|
101
101
|
rpcUrl: string;
|
|
102
102
|
flapChain?: FlapChain;
|
|
103
103
|
v3FeeTiers?: number[];
|
package/dist/utils/lp-inspect.js
CHANGED
|
@@ -26,23 +26,8 @@ const CHAIN_DEX_CONFIGS = {
|
|
|
26
26
|
},
|
|
27
27
|
IROSWAP: {
|
|
28
28
|
name: 'IROSwap',
|
|
29
|
-
v2Factory:
|
|
30
|
-
v2Router:
|
|
31
|
-
enabled: true,
|
|
32
|
-
},
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
BSC_TESTNET: {
|
|
36
|
-
wrappedNative: ADDRESSES.BSC_TESTNET.WXOC,
|
|
37
|
-
wrappedNativeSymbol: 'WXOC',
|
|
38
|
-
stableCoins: [
|
|
39
|
-
{ address: ADDRESSES.BSC_TESTNET.USDT, symbol: 'USDT', decimals: 18 },
|
|
40
|
-
],
|
|
41
|
-
dexes: {
|
|
42
|
-
IROSWAP: {
|
|
43
|
-
name: 'IROSwap',
|
|
44
|
-
v2Factory: ADDRESSES.BSC_TESTNET.IroSwapV2Factory,
|
|
45
|
-
v2Router: ADDRESSES.BSC_TESTNET.IroSwapV2Router,
|
|
29
|
+
v2Factory: ADDRESSES.BSC.IroSwapV2Factory,
|
|
30
|
+
v2Router: ADDRESSES.BSC.IroSwapV2Router,
|
|
46
31
|
enabled: true,
|
|
47
32
|
},
|
|
48
33
|
}
|