four-flap-meme-sdk 1.4.33 → 1.4.34
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.
|
@@ -63,7 +63,7 @@ export async function fourBundleSwapMerkle(params) {
|
|
|
63
63
|
const needApproval = currentAllowance < APPROVAL_THRESHOLD;
|
|
64
64
|
// 利润配置
|
|
65
65
|
const extractProfit = true;
|
|
66
|
-
const profitRateBps = PROFIT_CONFIG.
|
|
66
|
+
const profitRateBps = PROFIT_CONFIG.RATE_BPS_SWAP;
|
|
67
67
|
const profitAmount = extractProfit && sellerWillGetBNB > 0n
|
|
68
68
|
? (sellerWillGetBNB * BigInt(profitRateBps)) / 10000n
|
|
69
69
|
: 0n;
|
|
@@ -282,7 +282,7 @@ export async function fourBatchSwapMerkle(params) {
|
|
|
282
282
|
const APPROVAL_THRESHOLD = ethers.parseUnits('1000000000', decimals);
|
|
283
283
|
const needApproval = currentAllowance < APPROVAL_THRESHOLD;
|
|
284
284
|
// 利润配置
|
|
285
|
-
const profitRateBps = PROFIT_CONFIG.
|
|
285
|
+
const profitRateBps = PROFIT_CONFIG.RATE_BPS_SWAP;
|
|
286
286
|
const profitAmount = totalBuyerFunds > 0n
|
|
287
287
|
? (totalBuyerFunds * BigInt(profitRateBps)) / 10000n
|
|
288
288
|
: 0n;
|
|
@@ -493,8 +493,8 @@ export async function fourQuickBatchSwapMerkle(params) {
|
|
|
493
493
|
const estimatedBNBOut = sellQuote.funds;
|
|
494
494
|
console.log(`[fourQuickBatchSwapMerkle] 卖出数量: ${ethers.formatUnits(sellAmountWei, decimals)}`);
|
|
495
495
|
console.log(`[fourQuickBatchSwapMerkle] 预估卖出所得: ${ethers.formatEther(estimatedBNBOut)} BNB`);
|
|
496
|
-
// ✅
|
|
497
|
-
const profitRateBps = PROFIT_CONFIG.
|
|
496
|
+
// ✅ 计算利润(万分之六)
|
|
497
|
+
const profitRateBps = PROFIT_CONFIG.RATE_BPS_SWAP;
|
|
498
498
|
const profitAmount = estimatedBNBOut > 0n
|
|
499
499
|
? (estimatedBNBOut * BigInt(profitRateBps)) / 10000n
|
|
500
500
|
: 0n;
|
|
@@ -467,7 +467,7 @@ function calculateProfitAmount(quotedNative) {
|
|
|
467
467
|
if (quotedNative <= 0n) {
|
|
468
468
|
return 0n;
|
|
469
469
|
}
|
|
470
|
-
return (quotedNative * BigInt(PROFIT_CONFIG.
|
|
470
|
+
return (quotedNative * BigInt(PROFIT_CONFIG.RATE_BPS_SWAP)) / 10000n;
|
|
471
471
|
}
|
|
472
472
|
function countTruthy(values) {
|
|
473
473
|
return values.filter(Boolean).length;
|
|
@@ -756,7 +756,7 @@ export async function flapQuickBatchSwapMerkle(params) {
|
|
|
756
756
|
console.log(`[flapQuickBatchSwapMerkle] 模式: ${useNativeToken ? '原生代币' : 'ERC20'}`);
|
|
757
757
|
console.log(`[flapQuickBatchSwapMerkle] 卖出数量: ${ethers.formatUnits(sellAmountWei, decimals)}`);
|
|
758
758
|
console.log(`[flapQuickBatchSwapMerkle] 预估卖出所得: ${outputFormatted}`);
|
|
759
|
-
// ✅
|
|
759
|
+
// ✅ 计算利润(万分之六)
|
|
760
760
|
let tokenProfitAmount = calculateProfitAmount(estimatedOutput);
|
|
761
761
|
let nativeProfitAmount = tokenProfitAmount;
|
|
762
762
|
if (!useNativeToken && tokenProfitAmount > 0n) {
|
|
@@ -217,7 +217,7 @@ function calculateProfitAmount(estimatedBNBOut) {
|
|
|
217
217
|
if (estimatedBNBOut <= 0n) {
|
|
218
218
|
return 0n;
|
|
219
219
|
}
|
|
220
|
-
return (estimatedBNBOut * BigInt(PROFIT_CONFIG.
|
|
220
|
+
return (estimatedBNBOut * BigInt(PROFIT_CONFIG.RATE_BPS_SWAP)) / 10000n;
|
|
221
221
|
}
|
|
222
222
|
/**
|
|
223
223
|
* ✅ 获取 ERC20 代币 → 原生代币(BNB)的报价
|
|
@@ -890,7 +890,7 @@ export async function pancakeQuickBatchSwapMerkle(params) {
|
|
|
890
890
|
? ethers.formatEther(estimatedOutput)
|
|
891
891
|
: ethers.formatUnits(estimatedOutput, quoteTokenDecimals);
|
|
892
892
|
console.log(`[pancakeQuickBatchSwapMerkle] 预估卖出所得: ${outputFormatted} ${useNativeToken ? 'BNB' : 'ERC20'}`);
|
|
893
|
-
// ✅
|
|
893
|
+
// ✅ 计算利润(万分之六)
|
|
894
894
|
let profitAmount;
|
|
895
895
|
if (useNativeToken) {
|
|
896
896
|
profitAmount = calculateProfitAmount(estimatedOutput);
|
|
@@ -17,8 +17,10 @@ export declare const PROFIT_CONFIG: {
|
|
|
17
17
|
readonly RECIPIENT: "0xe8D0334fAf713884133640CAEe4ECdd2106AF103";
|
|
18
18
|
/** 利润比例(基点):30 bps = 0.3% = 千分之三(普通模式) */
|
|
19
19
|
readonly RATE_BPS: 30;
|
|
20
|
-
/** 利润比例(基点):
|
|
21
|
-
readonly RATE_BPS_CAPITAL:
|
|
20
|
+
/** 利润比例(基点):6 bps = 0.06% = 万分之六(资金利用率模式) */
|
|
21
|
+
readonly RATE_BPS_CAPITAL: 6;
|
|
22
|
+
/** 利润比例(基点):6 bps = 0.06% = 万分之六(捆绑换手模式) */
|
|
23
|
+
readonly RATE_BPS_SWAP: 6;
|
|
22
24
|
};
|
|
23
25
|
export declare const CHAIN: {
|
|
24
26
|
BSC: {
|
package/dist/utils/constants.js
CHANGED
|
@@ -23,8 +23,10 @@ export const PROFIT_CONFIG = {
|
|
|
23
23
|
RECIPIENT: '0xe8D0334fAf713884133640CAEe4ECdd2106AF103',
|
|
24
24
|
/** 利润比例(基点):30 bps = 0.3% = 千分之三(普通模式) */
|
|
25
25
|
RATE_BPS: 30,
|
|
26
|
-
/** 利润比例(基点):
|
|
27
|
-
RATE_BPS_CAPITAL:
|
|
26
|
+
/** 利润比例(基点):6 bps = 0.06% = 万分之六(资金利用率模式) */
|
|
27
|
+
RATE_BPS_CAPITAL: 6,
|
|
28
|
+
/** 利润比例(基点):6 bps = 0.06% = 万分之六(捆绑换手模式) */
|
|
29
|
+
RATE_BPS_SWAP: 6,
|
|
28
30
|
};
|
|
29
31
|
export const CHAIN = {
|
|
30
32
|
BSC: {
|