four-flap-meme-sdk 4.0.6 → 4.0.8
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/README.en.md +0 -15
- package/README.zh-CN.md +0 -15
- package/dist/abis/flap/portal.js +2 -0
- package/dist/bundle/four-meme/core/create-openfour.d.ts +0 -3
- package/dist/bundle/four-meme/core/create-openfour.js +0 -3
- package/dist/bundle/four-meme/core/create-token.js +0 -3
- package/dist/bundle/four-meme/swap-buy-first/helpers.d.ts +1 -1
- package/dist/bundle/four-meme/swap-buy-first/helpers.js +2 -5
- package/dist/bundle/four-meme/swap-sign-helpers.d.ts +1 -1
- package/dist/bundle/four-meme/swap-sign-helpers.js +2 -6
- package/dist/bundle/four-meme/types/index.d.ts +0 -6
- package/dist/chains/bsc/pancake/bundle-buy-first-plan.d.ts +1 -1
- package/dist/chains/bsc/pancake/bundle-buy-first-plan.js +2 -5
- package/dist/chains/bsc/pancake/quote.d.ts +1 -1
- package/dist/chains/bsc/pancake/quote.js +3 -9
- package/dist/chains/bsc/platforms/iro/token.d.ts +1 -1
- package/dist/chains/bsc/platforms/iro/token.js +3 -5
- package/dist/chains/xlayer/eip7702/profit.d.ts +2 -2
- package/dist/chains/xlayer/eip7702/profit.js +4 -12
- package/dist/chains/xlayer/eoa/quote.d.ts +1 -1
- package/dist/chains/xlayer/eoa/quote.js +2 -6
- package/dist/core/clients/four.d.ts +0 -3
- package/dist/core/clients/four.js +0 -3
- package/dist/core/constants/profit.d.ts +2 -2
- package/dist/core/constants/profit.js +6 -6
- package/dist/domains/flap/index.d.ts +1 -1
- package/dist/domains/flap/ipfs.d.ts +0 -3
- package/dist/domains/flap/module.d.ts +1 -1
- package/dist/domains/flap/portal-bundle-merkle/core.js +3 -3
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-plan.d.ts +1 -1
- package/dist/domains/flap/portal-bundle-merkle/swap-buy-first-plan.js +2 -5
- package/dist/domains/flap/portal-bundle-merkle/swap-planning.js +2 -8
- package/dist/domains/flap/portal.d.ts +1 -1
- package/dist/domains/flap/reader.d.ts +8 -1
- package/dist/domains/flap/reader.js +48 -1
- package/dist/domains/flap/types.d.ts +14 -0
- package/dist/domains/flows/create.d.ts +0 -3
- package/dist/domains/flows/create.js +0 -3
- package/dist/domains/four/contracts/tm-bundle-create.js +0 -3
- package/dist/domains/four/contracts/tm-bundle-helpers.d.ts +0 -3
- package/dist/domains/holders/holders-maker.js +3 -7
- package/dist/domains/lp-inspect/inspect.js +33 -9
- package/dist/domains/openfour/types.d.ts +0 -3
- package/dist/exports/root-foundations.d.ts +1 -1
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -410,9 +410,6 @@ const result = await createTokenFlow({
|
|
|
410
410
|
webUrl: 'https://example.com',
|
|
411
411
|
twitterUrl: 'https://twitter.com/...',
|
|
412
412
|
telegramUrl: 'https://t.me/...',
|
|
413
|
-
githubUrl: 'https://github.com/...',
|
|
414
|
-
youtubeUrl: 'https://youtube.com/...',
|
|
415
|
-
deboxUrl: 'https://debox.pro/...',
|
|
416
413
|
}
|
|
417
414
|
});
|
|
418
415
|
|
|
@@ -446,9 +443,6 @@ console.log('Your address:', result.accountAddress);
|
|
|
446
443
|
| `webUrl` | string | ❌ | Project website |
|
|
447
444
|
| `twitterUrl` | string | ❌ | Twitter/X profile |
|
|
448
445
|
| `telegramUrl` | string | ❌ | Telegram group/channel |
|
|
449
|
-
| `githubUrl` | string | ❌ | GitHub |
|
|
450
|
-
| `youtubeUrl` | string | ❌ | YouTube |
|
|
451
|
-
| `deboxUrl` | string | ❌ | DeBox |
|
|
452
446
|
|
|
453
447
|
### Return Value:
|
|
454
448
|
|
|
@@ -543,9 +537,6 @@ const { createArg, signature } = await four.createToken(accessToken, {
|
|
|
543
537
|
webUrl: 'https://...',
|
|
544
538
|
twitterUrl: 'https://...',
|
|
545
539
|
telegramUrl: 'https://...',
|
|
546
|
-
githubUrl: 'https://...',
|
|
547
|
-
youtubeUrl: 'https://...',
|
|
548
|
-
deboxUrl: 'https://...',
|
|
549
540
|
});
|
|
550
541
|
```
|
|
551
542
|
|
|
@@ -1045,9 +1036,6 @@ const { createArg, signature } = await four.createToken(
|
|
|
1045
1036
|
webUrl?: string, // Optional website
|
|
1046
1037
|
twitterUrl?: string, // Optional Twitter
|
|
1047
1038
|
telegramUrl?: string, // Optional Telegram
|
|
1048
|
-
githubUrl?: string, // Optional GitHub
|
|
1049
|
-
youtubeUrl?: string, // Optional YouTube
|
|
1050
|
-
deboxUrl?: string // Optional DeBox
|
|
1051
1039
|
}
|
|
1052
1040
|
);
|
|
1053
1041
|
```
|
|
@@ -2152,9 +2140,6 @@ const cid = await uploadTokenMeta(
|
|
|
2152
2140
|
website: 'https://example.com',
|
|
2153
2141
|
twitter: 'https://x.com/mytoken',
|
|
2154
2142
|
telegram: 'https://t.me/mytoken',
|
|
2155
|
-
github: 'https://github.com/mytoken',
|
|
2156
|
-
youtube: 'https://youtube.com/@mytoken',
|
|
2157
|
-
debox: 'https://debox.pro/mytoken',
|
|
2158
2143
|
},
|
|
2159
2144
|
'https://your-ipfs-graphql.example'
|
|
2160
2145
|
);
|
package/README.zh-CN.md
CHANGED
|
@@ -425,9 +425,6 @@ const result = await createTokenFlow({
|
|
|
425
425
|
webUrl: 'https://example.com',
|
|
426
426
|
twitterUrl: 'https://twitter.com/...',
|
|
427
427
|
telegramUrl: 'https://t.me/...',
|
|
428
|
-
githubUrl: 'https://github.com/...',
|
|
429
|
-
youtubeUrl: 'https://youtube.com/...',
|
|
430
|
-
deboxUrl: 'https://debox.pro/...',
|
|
431
428
|
}
|
|
432
429
|
});
|
|
433
430
|
|
|
@@ -463,9 +460,6 @@ console.log('你的地址:', result.accountAddress);
|
|
|
463
460
|
| `webUrl` | string | ❌ | 项目网站 |
|
|
464
461
|
| `twitterUrl` | string | ❌ | Twitter/X 账号 |
|
|
465
462
|
| `telegramUrl` | string | ❌ | Telegram 群组/频道 |
|
|
466
|
-
| `githubUrl` | string | ❌ | GitHub |
|
|
467
|
-
| `youtubeUrl` | string | ❌ | YouTube |
|
|
468
|
-
| `deboxUrl` | string | ❌ | DeBox |
|
|
469
463
|
|
|
470
464
|
### 返回值:
|
|
471
465
|
|
|
@@ -561,9 +555,6 @@ const { createArg, signature } = await four.createToken(accessToken, {
|
|
|
561
555
|
webUrl: 'https://...',
|
|
562
556
|
twitterUrl: 'https://...',
|
|
563
557
|
telegramUrl: 'https://...',
|
|
564
|
-
githubUrl: 'https://...',
|
|
565
|
-
youtubeUrl: 'https://...',
|
|
566
|
-
deboxUrl: 'https://...',
|
|
567
558
|
});
|
|
568
559
|
```
|
|
569
560
|
|
|
@@ -1045,9 +1036,6 @@ const { createArg, signature } = await four.createToken(
|
|
|
1045
1036
|
webUrl?: string, // 可选网站
|
|
1046
1037
|
twitterUrl?: string, // 可选 Twitter
|
|
1047
1038
|
telegramUrl?: string, // 可选 Telegram
|
|
1048
|
-
githubUrl?: string, // 可选 GitHub
|
|
1049
|
-
youtubeUrl?: string, // 可选 YouTube
|
|
1050
|
-
deboxUrl?: string // 可选 DeBox
|
|
1051
1039
|
}
|
|
1052
1040
|
);
|
|
1053
1041
|
```
|
|
@@ -2518,9 +2506,6 @@ const cid = await uploadTokenMeta(imageFile as File, {
|
|
|
2518
2506
|
website: 'https://example.com',
|
|
2519
2507
|
twitter: 'https://x.com/mytoken',
|
|
2520
2508
|
telegram: 'https://t.me/mytoken',
|
|
2521
|
-
github: 'https://github.com/mytoken',
|
|
2522
|
-
youtube: 'https://youtube.com/@mytoken',
|
|
2523
|
-
debox: 'https://debox.pro/mytoken',
|
|
2524
2509
|
}, 'https://your-ipfs-graphql.example');
|
|
2525
2510
|
```
|
|
2526
2511
|
|
package/dist/abis/flap/portal.js
CHANGED
|
@@ -10,6 +10,8 @@ export const PORTAL_ABI = [
|
|
|
10
10
|
'function getTokenV4(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,address,bool,bytes32))',
|
|
11
11
|
'function getTokenV5(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,uint256,uint256,address,bool,bytes32))',
|
|
12
12
|
'function getTokenV7(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,uint256,uint256,address,bool,bytes32,uint256,address,uint256,uint8))',
|
|
13
|
+
'function getTokenV8(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,uint256,uint256,address,bool,bytes32,uint256,uint256,address,uint256,uint8,uint8))',
|
|
14
|
+
'function getTokenV8Safe(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,uint256,uint256,address,bool,bytes32,uint256,uint256,address,uint256,uint8,uint8))',
|
|
13
15
|
// 报价方法
|
|
14
16
|
'function previewBuy(address token, uint256 ethAmount) external view returns (uint256)',
|
|
15
17
|
'function previewSell(address token, uint256 tokenAmount) external view returns (uint256)',
|
|
@@ -57,9 +57,6 @@ export async function createOpenFourTokenMerkle(params) {
|
|
|
57
57
|
webUrl: tokenInfo.webUrl,
|
|
58
58
|
twitterUrl: tokenInfo.twitterUrl,
|
|
59
59
|
telegramUrl: tokenInfo.telegramUrl,
|
|
60
|
-
githubUrl: tokenInfo.githubUrl,
|
|
61
|
-
youtubeUrl: tokenInfo.youtubeUrl,
|
|
62
|
-
deboxUrl: tokenInfo.deboxUrl,
|
|
63
60
|
presaleQuote: preSale,
|
|
64
61
|
feePlan: Boolean(tokenInfo.feePlan),
|
|
65
62
|
initParams: tokenInfo.initParams,
|
|
@@ -41,9 +41,6 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
41
41
|
webUrl: tokenInfo.webUrl,
|
|
42
42
|
twitterUrl: tokenInfo.twitterUrl,
|
|
43
43
|
telegramUrl: tokenInfo.telegramUrl,
|
|
44
|
-
githubUrl: tokenInfo.githubUrl,
|
|
45
|
-
youtubeUrl: tokenInfo.youtubeUrl,
|
|
46
|
-
deboxUrl: tokenInfo.deboxUrl,
|
|
47
44
|
preSale: effectivePreSaleStr || '0',
|
|
48
45
|
onlyMPC: false,
|
|
49
46
|
...(tokenInfo.feePlan ? { feePlan: true } : {}),
|
|
@@ -13,7 +13,7 @@ export declare const MAX_SWAP_TX_COUNT: number;
|
|
|
13
13
|
/**
|
|
14
14
|
* 根据 userType 获取每笔交易的利润率
|
|
15
15
|
*/
|
|
16
|
-
export declare function getProfitRatePerTxBps(
|
|
16
|
+
export declare function getProfitRatePerTxBps(_userType?: UserType): number;
|
|
17
17
|
/**
|
|
18
18
|
* 验证买卖笔数
|
|
19
19
|
*/
|
|
@@ -15,11 +15,8 @@ export const MAX_SWAP_TX_COUNT = MAX_BUNDLE_SIGNATURES - BRIBE_TX_COUNT - PROFIT
|
|
|
15
15
|
/**
|
|
16
16
|
* 根据 userType 获取每笔交易的利润率
|
|
17
17
|
*/
|
|
18
|
-
export function getProfitRatePerTxBps(
|
|
19
|
-
|
|
20
|
-
return getSharedProfitRateBps('v1Double');
|
|
21
|
-
}
|
|
22
|
-
return getSharedProfitRateBps('v0Double');
|
|
18
|
+
export function getProfitRatePerTxBps(_userType) {
|
|
19
|
+
return getSharedProfitRateBps('bundleSwap');
|
|
23
20
|
}
|
|
24
21
|
/**
|
|
25
22
|
* 验证买卖笔数
|
|
@@ -2,7 +2,7 @@ import { Wallet, type JsonRpcProvider } from 'ethers';
|
|
|
2
2
|
import { type CommonBundleConfig } from '../../utils/bundle-helpers.js';
|
|
3
3
|
import type { FourSwapSignConfig, SellerNoncePlan, UserType } from './types/index.js';
|
|
4
4
|
export type { SellerNoncePlan } from './types/index.js';
|
|
5
|
-
export declare function getFourSwapProfitRateBps(
|
|
5
|
+
export declare function getFourSwapProfitRateBps(_userType?: UserType): number;
|
|
6
6
|
export declare function needsTmTokenApproval(currentAllowance: bigint, decimals: number): boolean;
|
|
7
7
|
export declare function countSellerNonceSlots(needBribeTx: boolean, needApproval: boolean, includeProfit: boolean): number;
|
|
8
8
|
export declare function planSellerNonces(sellerNonces: number[], needBribeTx: boolean, needApproval: boolean, extractProfit: boolean): SellerNoncePlan;
|
|
@@ -7,12 +7,8 @@ import { createSignProvider } from '../../core/sign-context-helpers.js';
|
|
|
7
7
|
import { HELPER3_ABI, TM_ADDRESS } from './swap-internal.js';
|
|
8
8
|
const APPROVE_INTERFACE = new ethers.Interface(['function approve(address,uint256) returns (bool)']);
|
|
9
9
|
const ERC20_ALLOWANCE_ABI = ['function allowance(address,address) view returns (uint256)'];
|
|
10
|
-
export function getFourSwapProfitRateBps(
|
|
11
|
-
|
|
12
|
-
return getSharedProfitRateBps('v0Single');
|
|
13
|
-
if (userType === 'v1')
|
|
14
|
-
return getSharedProfitRateBps('v1Single');
|
|
15
|
-
return getSharedProfitRateBps('v0Single');
|
|
10
|
+
export function getFourSwapProfitRateBps(_userType) {
|
|
11
|
+
return getSharedProfitRateBps('bundleSwap');
|
|
16
12
|
}
|
|
17
13
|
export function needsTmTokenApproval(currentAllowance, decimals) {
|
|
18
14
|
const threshold = ethers.parseUnits('1000000000', decimals);
|
|
@@ -102,9 +102,6 @@ export type FourCreateWithBundleBuyMerkleParams = {
|
|
|
102
102
|
webUrl?: string;
|
|
103
103
|
twitterUrl?: string;
|
|
104
104
|
telegramUrl?: string;
|
|
105
|
-
githubUrl?: string;
|
|
106
|
-
youtubeUrl?: string;
|
|
107
|
-
deboxUrl?: string;
|
|
108
105
|
/** ✅ AntiSniperFeeMode(开盘高税模式) */
|
|
109
106
|
feePlan?: boolean;
|
|
110
107
|
/** ✅ 税币配置(Tax Token, creatorType=5) */
|
|
@@ -131,9 +128,6 @@ export type FourCreateWithBundleBuySignParams = {
|
|
|
131
128
|
webUrl?: string;
|
|
132
129
|
twitterUrl?: string;
|
|
133
130
|
telegramUrl?: string;
|
|
134
|
-
githubUrl?: string;
|
|
135
|
-
youtubeUrl?: string;
|
|
136
|
-
deboxUrl?: string;
|
|
137
131
|
/** ✅ AntiSniperFeeMode(开盘高税模式) */
|
|
138
132
|
feePlan?: boolean;
|
|
139
133
|
/** ✅ 税币配置(Tax Token, creatorType=5) */
|
|
@@ -2,7 +2,7 @@ import type { MultiNoncePlan, PlanMultiNonceParams, UserType } from './bundle-bu
|
|
|
2
2
|
/**
|
|
3
3
|
* 根据 userType 获取每笔交易的利润率
|
|
4
4
|
*/
|
|
5
|
-
export declare function getProfitRatePerTxBps(
|
|
5
|
+
export declare function getProfitRatePerTxBps(_userType?: UserType): number;
|
|
6
6
|
/**
|
|
7
7
|
* 验证买卖笔数
|
|
8
8
|
*/
|
|
@@ -6,11 +6,8 @@ import { BRIBE_TX_COUNT, MAX_BUNDLE_SIGNATURES, MAX_SWAP_TX_COUNT, PROFIT_TX_COU
|
|
|
6
6
|
/**
|
|
7
7
|
* 根据 userType 获取每笔交易的利润率
|
|
8
8
|
*/
|
|
9
|
-
export function getProfitRatePerTxBps(
|
|
10
|
-
|
|
11
|
-
return getProfitRateBps('v1Double');
|
|
12
|
-
}
|
|
13
|
-
return getProfitRateBps('v0Double'); // v0 或默认
|
|
9
|
+
export function getProfitRatePerTxBps(_userType) {
|
|
10
|
+
return getProfitRateBps('bundleSwap');
|
|
14
11
|
}
|
|
15
12
|
/**
|
|
16
13
|
* 验证买卖笔数
|
|
@@ -4,7 +4,7 @@ export declare function quoteSellOutput({ routeParams, sellAmountWei, provider,
|
|
|
4
4
|
/**
|
|
5
5
|
* 根据 userType 计算利润率
|
|
6
6
|
*/
|
|
7
|
-
export declare function getProfitRateBps(
|
|
7
|
+
export declare function getProfitRateBps(_userType?: UserType): number;
|
|
8
8
|
export declare function calculateProfitAmount(estimatedBNBOut: bigint, userType?: UserType): bigint;
|
|
9
9
|
/**
|
|
10
10
|
* ✅ 获取 ERC20 代币 → 原生代币(BNB)的报价
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ADDRESSES } from '../../../core/constants/index.js';
|
|
1
|
+
import { ADDRESSES, getProfitRateBps as getSharedProfitRateBps } from '../../../core/constants/index.js';
|
|
2
2
|
import { quoteV2, quoteV3 } from '../../../core/quote/quote-helpers.js';
|
|
3
3
|
import { WBNB_ADDRESS, } from './bundle-swap-types.js';
|
|
4
4
|
export async function quoteSellOutput({ routeParams, sellAmountWei, provider, v2RouterAddress, }) {
|
|
@@ -41,14 +41,8 @@ export async function quoteSellOutput({ routeParams, sellAmountWei, provider, v2
|
|
|
41
41
|
/**
|
|
42
42
|
* 根据 userType 计算利润率
|
|
43
43
|
*/
|
|
44
|
-
export function getProfitRateBps(
|
|
45
|
-
|
|
46
|
-
return 4; // 0.06%
|
|
47
|
-
}
|
|
48
|
-
else if (userType === 'v1') {
|
|
49
|
-
return 5; // 0.05%
|
|
50
|
-
}
|
|
51
|
-
return 4; // 默认 0.06%
|
|
44
|
+
export function getProfitRateBps(_userType) {
|
|
45
|
+
return getSharedProfitRateBps('bundleSwap');
|
|
52
46
|
}
|
|
53
47
|
export function calculateProfitAmount(estimatedBNBOut, userType) {
|
|
54
48
|
if (estimatedBNBOut <= 0n) {
|
|
@@ -112,7 +112,7 @@ export interface IroBatchSubscribeForSubmitResult {
|
|
|
112
112
|
*
|
|
113
113
|
* 和 Flap 发币一致的逻辑:
|
|
114
114
|
* 1. 签名所有 subscribe 交易
|
|
115
|
-
* 2. 从买入金额最大的钱包抽取 BNB
|
|
115
|
+
* 2. 从买入金额最大的钱包抽取 BNB 利润(按地址固定费率)
|
|
116
116
|
* 3. 利润通过 2 跳中转转给利润地址 (BSC: payer → hop1 → hop2 → 利润地址)
|
|
117
117
|
* 4. 返回 [...approvalTxs, ...subscribeTxs, ...profitTxs]
|
|
118
118
|
*
|
|
@@ -10,7 +10,7 @@ import { Contract, Interface, Wallet, JsonRpcProvider } from 'ethers';
|
|
|
10
10
|
import { BSC_CHAIN_ID, BSC_RPC_URL } from '../../constants.js';
|
|
11
11
|
import { IRO_TOKEN_ABI, SUBSCRIBE_GAS_LIMIT } from './constants.js';
|
|
12
12
|
import { buildProfitHopTransactions, PROFIT_HOP_COUNT } from '../../../../utils/bundle-helpers.js';
|
|
13
|
-
import { getProfitRecipient } from '../../../../core/constants/profit.js';
|
|
13
|
+
import { getProfitRecipient, getTransferFeePerAddress } from '../../../../core/constants/profit.js';
|
|
14
14
|
const tokenIface = new Interface(IRO_TOKEN_ABI);
|
|
15
15
|
// ============================================================================
|
|
16
16
|
// 查询
|
|
@@ -213,7 +213,7 @@ export async function batchSubscribe(params) {
|
|
|
213
213
|
*
|
|
214
214
|
* 和 Flap 发币一致的逻辑:
|
|
215
215
|
* 1. 签名所有 subscribe 交易
|
|
216
|
-
* 2. 从买入金额最大的钱包抽取 BNB
|
|
216
|
+
* 2. 从买入金额最大的钱包抽取 BNB 利润(按地址固定费率)
|
|
217
217
|
* 3. 利润通过 2 跳中转转给利润地址 (BSC: payer → hop1 → hop2 → 利润地址)
|
|
218
218
|
* 4. 返回 [...approvalTxs, ...subscribeTxs, ...profitTxs]
|
|
219
219
|
*
|
|
@@ -248,9 +248,7 @@ export async function batchSubscribeForSubmit(params) {
|
|
|
248
248
|
wallets.push(new Wallet(sub.privateKey, provider));
|
|
249
249
|
nonces.push(result.nonce);
|
|
250
250
|
}
|
|
251
|
-
|
|
252
|
-
// 使用固定费率:每个地址 0.001 BNB (和 TRANSFER_FEE_PER_ADDRESS 一致)
|
|
253
|
-
const profitPerAddress = 1000000000000000n; // 0.001 BNB
|
|
251
|
+
const profitPerAddress = getTransferFeePerAddress(chainId);
|
|
254
252
|
const totalProfit = profitPerAddress * BigInt(subscribers.length);
|
|
255
253
|
// 从买入金额最大的钱包支付利润
|
|
256
254
|
let maxIndex = 0;
|
|
@@ -6,11 +6,11 @@ export type UserType = 'v0' | 'v1' | 'default';
|
|
|
6
6
|
* - v1: 10 bps = 0.10%
|
|
7
7
|
* - default: 8 bps = 0.08%
|
|
8
8
|
*/
|
|
9
|
-
export declare function getProfitRateBps(
|
|
9
|
+
export declare function getProfitRateBps(_userType?: UserType): number;
|
|
10
10
|
/**
|
|
11
11
|
* 根据用户类型获取利润率(双边/换手模式)
|
|
12
12
|
*/
|
|
13
|
-
export declare function getProfitRateBpsDouble(
|
|
13
|
+
export declare function getProfitRateBpsDouble(_userType?: UserType): number;
|
|
14
14
|
/**
|
|
15
15
|
* 计算利润金额(旧版兼容)
|
|
16
16
|
*/
|
|
@@ -5,22 +5,14 @@ import { getProfitRateBps as getSharedProfitRateBps, getProfitRecipient as pickR
|
|
|
5
5
|
* - v1: 10 bps = 0.10%
|
|
6
6
|
* - default: 8 bps = 0.08%
|
|
7
7
|
*/
|
|
8
|
-
export function getProfitRateBps(
|
|
9
|
-
|
|
10
|
-
return getSharedProfitRateBps('v0Single');
|
|
11
|
-
if (userType === 'v1')
|
|
12
|
-
return getSharedProfitRateBps('v1Single');
|
|
13
|
-
return getSharedProfitRateBps('v0Single');
|
|
8
|
+
export function getProfitRateBps(_userType) {
|
|
9
|
+
return getSharedProfitRateBps('bundleSwap');
|
|
14
10
|
}
|
|
15
11
|
/**
|
|
16
12
|
* 根据用户类型获取利润率(双边/换手模式)
|
|
17
13
|
*/
|
|
18
|
-
export function getProfitRateBpsDouble(
|
|
19
|
-
|
|
20
|
-
return getSharedProfitRateBps('v0Double');
|
|
21
|
-
if (userType === 'v1')
|
|
22
|
-
return getSharedProfitRateBps('v1Double');
|
|
23
|
-
return getSharedProfitRateBps('v0Double');
|
|
14
|
+
export function getProfitRateBpsDouble(_userType) {
|
|
15
|
+
return getSharedProfitRateBps('bundleSwap');
|
|
24
16
|
}
|
|
25
17
|
/**
|
|
26
18
|
* 计算利润金额(旧版兼容)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { JsonRpcProvider } from 'ethers';
|
|
2
2
|
import { type RouteParams, type UserType } from './eoa-bundle-swap-types.js';
|
|
3
|
-
export declare function getProfitRateBps(
|
|
3
|
+
export declare function getProfitRateBps(_userType?: UserType): number;
|
|
4
4
|
export declare function calculateProfitAmount(estimatedOutput: bigint, userType?: UserType): bigint;
|
|
5
5
|
export declare function quoteSellOutput(provider: JsonRpcProvider, routeParams: RouteParams, sellAmountWei: bigint): Promise<bigint>;
|
|
6
6
|
export declare function getERC20ToOkbQuote(provider: JsonRpcProvider, tokenAddress: string, tokenAmount: bigint, version?: 'v2' | 'v3', fee?: number): Promise<bigint>;
|
|
@@ -2,12 +2,8 @@ import { CHAINS, getProfitRateBps as getSharedProfitRateBps } from '../../../cor
|
|
|
2
2
|
import { quoteV2, quoteV3 } from '../../../core/quote/quote-helpers.js';
|
|
3
3
|
import { WOKB_ADDRESS, } from './eoa-bundle-swap-types.js';
|
|
4
4
|
const XLAYER_CHAIN_NAME = CHAINS.XLAYER.name;
|
|
5
|
-
export function getProfitRateBps(
|
|
6
|
-
|
|
7
|
-
return getSharedProfitRateBps('v0Single');
|
|
8
|
-
if (userType === 'v1')
|
|
9
|
-
return getSharedProfitRateBps('v1Single');
|
|
10
|
-
return getSharedProfitRateBps('v0Single');
|
|
5
|
+
export function getProfitRateBps(_userType) {
|
|
6
|
+
return getSharedProfitRateBps('bundleSwap');
|
|
11
7
|
}
|
|
12
8
|
export function calculateProfitAmount(estimatedOutput, userType) {
|
|
13
9
|
if (estimatedOutput <= 0n)
|
|
@@ -14,9 +14,6 @@ export function buildCreateTokenReq(custom, raisedToken) {
|
|
|
14
14
|
webUrl: custom.webUrl,
|
|
15
15
|
twitterUrl: custom.twitterUrl,
|
|
16
16
|
telegramUrl: custom.telegramUrl,
|
|
17
|
-
githubUrl: custom.githubUrl,
|
|
18
|
-
youtubeUrl: custom.youtubeUrl,
|
|
19
|
-
deboxUrl: custom.deboxUrl,
|
|
20
17
|
preSale: custom.preSale,
|
|
21
18
|
onlyMPC: custom.onlyMPC ?? false,
|
|
22
19
|
...(custom.feePlan ? { feePlan: true } : {}),
|
|
@@ -9,9 +9,9 @@ export declare const PROFIT_CONFIG: {
|
|
|
9
9
|
readonly RECIPIENT: string;
|
|
10
10
|
/** 利润比例(基点 bps,1 bps = 0.01%) */
|
|
11
11
|
RATES: {
|
|
12
|
-
/** 普通模式:
|
|
12
|
+
/** 普通模式:30 bps = 0.3%(代币交易 / 拉盘砸盘) */
|
|
13
13
|
NORMAL: number;
|
|
14
|
-
/**
|
|
14
|
+
/** 捆绑换手 / 刷量:3 bps = 0.03% */
|
|
15
15
|
BUNDLE_SWAP: number;
|
|
16
16
|
/** V0 用户单边:8 bps = 0.08% */
|
|
17
17
|
V0_SINGLE: number;
|
|
@@ -21,10 +21,10 @@ export const PROFIT_CONFIG = {
|
|
|
21
21
|
},
|
|
22
22
|
/** 利润比例(基点 bps,1 bps = 0.01%) */
|
|
23
23
|
RATES: {
|
|
24
|
-
/** 普通模式:
|
|
25
|
-
NORMAL:
|
|
26
|
-
/**
|
|
27
|
-
BUNDLE_SWAP:
|
|
24
|
+
/** 普通模式:30 bps = 0.3%(代币交易 / 拉盘砸盘) */
|
|
25
|
+
NORMAL: 30,
|
|
26
|
+
/** 捆绑换手 / 刷量:3 bps = 0.03% */
|
|
27
|
+
BUNDLE_SWAP: 3,
|
|
28
28
|
/** V0 用户单边:8 bps = 0.08% */
|
|
29
29
|
V0_SINGLE: 8,
|
|
30
30
|
/** V0 用户双边:4 bps = 0.04% */
|
|
@@ -109,8 +109,8 @@ export function calculateProfitHopGasCost(gasPrice) {
|
|
|
109
109
|
* - 所有代币(原生币/ERC20)统一按地址执行次数收取原生币
|
|
110
110
|
*/
|
|
111
111
|
export const TRANSFER_FEE_PER_ADDRESS = {
|
|
112
|
-
56:
|
|
113
|
-
97:
|
|
112
|
+
56: 100000000000000n, // BSC: 0.0001 BNB
|
|
113
|
+
97: 100000000000000n, // BSC Testnet: 0.0001 tBNB
|
|
114
114
|
196: 10000000000000000n, // XLayer: 0.01 OKB
|
|
115
115
|
143: 1000000000000000n, // Monad: 0.001 MON
|
|
116
116
|
8453: 1000000000000000n, // Base: 0.001 ETH
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Flap domain public facade
|
|
3
3
|
*/
|
|
4
|
-
export { FlapPortal, FlapPortalWriter, type TokenStateV7, V3LPFeeProfile, lpFeeProfileToV3Fee, FLAP_TOTAL_SUPPLY, } from './module.js';
|
|
4
|
+
export { FlapPortal, FlapPortalWriter, type TokenStateV7, type TokenStateV8, V3LPFeeProfile, lpFeeProfileToV3Fee, FLAP_TOTAL_SUPPLY, } from './module.js';
|
|
5
5
|
export { flapBundleSwapMerkle, flapBatchSwapMerkle, flapQuickBatchSwapMerkle, flapCrossSwapMerkle, flapBundleBuyFirstMerkle, flapDisperseWithBundleMerkle, flapSweepWithBundleMerkle, createTokenWithBundleBuyMerkle, batchBuyWithBundleMerkle, batchSellWithBundleMerkle, flapBundleCreateToDex, } from './portal-bundle-merkle/index.js';
|
|
6
6
|
export type { FlapSwapSignConfig, FlapSwapConfig, FlapBundleSwapSignParams, FlapBundleSwapParams, FlapSwapResult, FlapBatchSwapSignParams, FlapBatchSwapResult, FlapQuickBatchSwapSignParams, FlapQuickBatchSwapResult, FlapCrossSwapParams, FlapCrossSwapResult, UserType as FlapSwapUserType, FlapBuyFirstSignConfig, FlapBuyFirstConfig, FlapBundleBuyFirstSignParams, FlapBundleBuyFirstParams, FlapBuyFirstResult, FlapDisperseSignParams, FlapDisperseMerkleResult, FlapSweepSignParams, FlapSweepMerkleResult, } from './portal-bundle-merkle/index.js';
|
|
7
7
|
export type { FlapChain } from './portal.js';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* 使用时请从具体文件导入
|
|
8
8
|
*/
|
|
9
9
|
export { FlapPortal, FlapPortalWriter, type FlapChain, // 主要的 FlapChain 定义
|
|
10
|
-
type PortalConfig, type TokenStateV2, type TokenStateV3, type TokenStateV4, type TokenStateV5, type TokenStateV7, type QuoteExactInputParams, type ExactInputParams, type ExactInputV3Params, type NewTokenV3Params, type NewTokenV4Params, type NewTokenV5Params, type TaxDistributionConfig, validateTaxDistribution, TokenStatus, TokenVersion, FeeType, DexThreshType, MigratorType, V3LPFeeProfile, lpFeeProfileToV3Fee, DEXId, } from './portal.js';
|
|
10
|
+
type PortalConfig, type TokenStateV2, type TokenStateV3, type TokenStateV4, type TokenStateV5, type TokenStateV7, type TokenStateV8, type QuoteExactInputParams, type ExactInputParams, type ExactInputV3Params, type NewTokenV3Params, type NewTokenV4Params, type NewTokenV5Params, type TaxDistributionConfig, validateTaxDistribution, TokenStatus, TokenVersion, FeeType, DexThreshType, MigratorType, V3LPFeeProfile, lpFeeProfileToV3Fee, DEXId, } from './portal.js';
|
|
11
11
|
export { CDPV2 } from './curve.js';
|
|
12
12
|
export { buildPermitPiggybackAuto } from './permit.js';
|
|
13
13
|
export { uploadTokenMeta, type TokenMetaInput } from './ipfs.js';
|
|
@@ -29,11 +29,11 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
29
29
|
const portalAddr = FLAP_PORTAL_ADDRESSES[chain];
|
|
30
30
|
const originalPortalAddr = FLAP_ORIGINAL_PORTAL_ADDRESSES[chain];
|
|
31
31
|
const portal = new ethers.Contract(originalPortalAddr, PORTAL_ABI, devWallet);
|
|
32
|
-
const { normalizedTax, useV7Portal } = resolveCreateTokenLaunchFlags(params);
|
|
32
|
+
const { normalizedTax, useV7Portal, isTaxLaunch } = resolveCreateTokenLaunchFlags(params);
|
|
33
33
|
const inputToken = params.quoteToken && params.quoteToken !== ZERO_ADDRESS ? params.quoteToken : ZERO_ADDRESS;
|
|
34
34
|
const useNativeToken = inputToken === ZERO_ADDRESS;
|
|
35
35
|
const extractProfit = config.extractProfitOnLaunch === false ? false : shouldExtractProfit(config);
|
|
36
|
-
const useMethodA = canUseLaunchMethodA(privateKeys, buyAmounts, devWallet.address, useNativeToken);
|
|
36
|
+
const useMethodA = !isTaxLaunch && canUseLaunchMethodA(privateKeys, buyAmounts, devWallet.address, useNativeToken);
|
|
37
37
|
let methodAQuoteAmt = 0n;
|
|
38
38
|
let methodABuyMeta;
|
|
39
39
|
if (useMethodA) {
|
|
@@ -113,7 +113,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
113
113
|
}
|
|
114
114
|
nonceManager.clearTemp();
|
|
115
115
|
return {
|
|
116
|
-
signedTransactions: [...
|
|
116
|
+
signedTransactions: [...signedTxs, ...bribeTxs, ...profitTxs],
|
|
117
117
|
tokenAddress,
|
|
118
118
|
profitHopWallets,
|
|
119
119
|
metadata: {
|
|
@@ -7,7 +7,7 @@ import type { MultiNoncePlan, UserType } from './swap-buy-first-types.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* 根据 userType 获取每笔交易的利润率
|
|
9
9
|
*/
|
|
10
|
-
export declare function getProfitRatePerTxBps(
|
|
10
|
+
export declare function getProfitRatePerTxBps(_userType?: UserType): number;
|
|
11
11
|
/**
|
|
12
12
|
* 验证买卖笔数
|
|
13
13
|
*/
|
|
@@ -3,11 +3,8 @@ import { BRIBE_TX_COUNT, MAX_BUNDLE_SIGNATURES, MAX_SWAP_TX_COUNT, PROFIT_TX_COU
|
|
|
3
3
|
/**
|
|
4
4
|
* 根据 userType 获取每笔交易的利润率
|
|
5
5
|
*/
|
|
6
|
-
export function getProfitRatePerTxBps(
|
|
7
|
-
|
|
8
|
-
return getProfitRateBps('v1Double');
|
|
9
|
-
}
|
|
10
|
-
return getProfitRateBps('v0Double'); // v0 或默认
|
|
6
|
+
export function getProfitRatePerTxBps(_userType) {
|
|
7
|
+
return getProfitRateBps('bundleSwap');
|
|
11
8
|
}
|
|
12
9
|
/**
|
|
13
10
|
* 验证买卖笔数
|
|
@@ -161,14 +161,8 @@ export async function buildProfitTransaction({ provider, seller, profitAmount, p
|
|
|
161
161
|
hopWallets: profitHopResult.hopWallets,
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
|
-
function getProfitRateBps(
|
|
165
|
-
|
|
166
|
-
return getSharedProfitRateBps('v0Single');
|
|
167
|
-
}
|
|
168
|
-
else if (userType === 'v1') {
|
|
169
|
-
return getSharedProfitRateBps('v1Single');
|
|
170
|
-
}
|
|
171
|
-
return getSharedProfitRateBps('v0Single');
|
|
164
|
+
function getProfitRateBps(_userType) {
|
|
165
|
+
return getSharedProfitRateBps('bundleSwap');
|
|
172
166
|
}
|
|
173
167
|
export function calculateProfitAmount(quotedNative, userType) {
|
|
174
168
|
if (quotedNative <= 0n) {
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
* 对外 export 符号与路径保持不变。
|
|
10
10
|
*/
|
|
11
11
|
export { TokenStatus, TokenVersion, FeeType, DexThreshType, MigratorType, V3LPFeeProfile, DEXId, lpFeeProfileToV3Fee, validateTaxDistribution, } from './types.js';
|
|
12
|
-
export type { FlapChain, PortalConfig, TokenStateV2, TokenStateV3, TokenStateV4, TokenStateV5, TokenStateV7, QuoteExactInputParams, ExactInputParams, ExactInputV3Params, NewTokenV3Params, NewTokenV4Params, NewTokenV5Params, TaxDistributionConfig, } from './types.js';
|
|
12
|
+
export type { FlapChain, PortalConfig, TokenStateV2, TokenStateV3, TokenStateV4, TokenStateV5, TokenStateV7, TokenStateV8, QuoteExactInputParams, ExactInputParams, ExactInputV3Params, NewTokenV3Params, NewTokenV4Params, NewTokenV5Params, TaxDistributionConfig, } from './types.js';
|
|
13
13
|
export { FlapPortal } from './reader.js';
|
|
14
14
|
export { FlapPortalWriter } from './writer.js';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Flap Portal — 只读查询(reader)
|
|
3
3
|
*/
|
|
4
4
|
import { Contract } from 'ethers';
|
|
5
|
-
import type { PortalConfig, QuoteExactInputParams, TokenStateV2, TokenStateV3, TokenStateV4, TokenStateV5, TokenStateV7 } from './types.js';
|
|
5
|
+
import type { PortalConfig, QuoteExactInputParams, TokenStateV2, TokenStateV3, TokenStateV4, TokenStateV5, TokenStateV7, TokenStateV8 } from './types.js';
|
|
6
6
|
export declare const PORTAL_ABI: string[];
|
|
7
7
|
export declare class FlapPortal {
|
|
8
8
|
private rpcUrl;
|
|
@@ -20,6 +20,13 @@ export declare class FlapPortal {
|
|
|
20
20
|
* 注意:仅部分链支持 V7(如 XLayer v5.7+),不支持的链会 revert
|
|
21
21
|
*/
|
|
22
22
|
getTokenV7(token: string): Promise<TokenStateV7>;
|
|
23
|
+
mapTokenStateV8(raw: unknown[]): TokenStateV8;
|
|
24
|
+
/**
|
|
25
|
+
* BSC TOKEN_TAXED_V3:买卖税在 buyTaxRate / sellTaxRate。
|
|
26
|
+
* 用 V7 读会把残留 taxRate(常见 100 bps)当成当前税。
|
|
27
|
+
*/
|
|
28
|
+
getTokenV8(token: string): Promise<TokenStateV8>;
|
|
29
|
+
getTokenV8Safe(token: string): Promise<TokenStateV8>;
|
|
23
30
|
/**
|
|
24
31
|
* 计算距离毕业还需多少 OKB/ETH(含手续费)
|
|
25
32
|
* @param state TokenStateV5 或 TokenStateV7
|
|
@@ -11,8 +11,11 @@ export const PORTAL_ABI = [
|
|
|
11
11
|
'function getTokenV3(address token) external view returns (uint8,uint256,uint256,uint256,uint8,uint256,uint256,address,bool)',
|
|
12
12
|
'function getTokenV4(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,address,bool,bytes32))',
|
|
13
13
|
'function getTokenV5(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,uint256,uint256,address,bool,bytes32))',
|
|
14
|
-
// V7:
|
|
14
|
+
// V7: taxRate, pool, progress, lpFeeProfile(非 BSC / 旧 Portal)
|
|
15
15
|
'function getTokenV7(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,uint256,uint256,address,bool,bytes32,uint256,address,uint256,uint8))',
|
|
16
|
+
// V8: taxRate 拆成 buyTaxRate, sellTaxRate,末尾带 dexId(BSC TOKEN_TAXED_V3)
|
|
17
|
+
'function getTokenV8(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,uint256,uint256,address,bool,bytes32,uint256,uint256,address,uint256,uint8,uint8))',
|
|
18
|
+
'function getTokenV8Safe(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,uint256,uint256,address,bool,bytes32,uint256,uint256,address,uint256,uint8,uint8))',
|
|
16
19
|
// 报价方法
|
|
17
20
|
'function previewBuy(address token, uint256 ethAmount) external view returns (uint256)',
|
|
18
21
|
'function previewSell(address token, uint256 tokenAmount) external view returns (uint256)',
|
|
@@ -143,6 +146,50 @@ export class FlapPortal {
|
|
|
143
146
|
lpFeeProfile: Number(raw[15]),
|
|
144
147
|
};
|
|
145
148
|
}
|
|
149
|
+
mapTokenStateV8(raw) {
|
|
150
|
+
const buyTaxRate = raw[12];
|
|
151
|
+
const sellTaxRate = raw[13];
|
|
152
|
+
const buy = Number(buyTaxRate ?? 0n);
|
|
153
|
+
const sell = Number(sellTaxRate ?? 0n);
|
|
154
|
+
return {
|
|
155
|
+
status: raw[0],
|
|
156
|
+
reserve: raw[1],
|
|
157
|
+
circulatingSupply: raw[2],
|
|
158
|
+
price: raw[3],
|
|
159
|
+
tokenVersion: raw[4],
|
|
160
|
+
r: raw[5],
|
|
161
|
+
h: raw[6],
|
|
162
|
+
k: raw[7],
|
|
163
|
+
dexSupplyThresh: raw[8],
|
|
164
|
+
quoteTokenAddress: raw[9],
|
|
165
|
+
nativeToQuoteSwapEnabled: raw[10],
|
|
166
|
+
extensionID: raw[11],
|
|
167
|
+
buyTaxRate,
|
|
168
|
+
sellTaxRate,
|
|
169
|
+
taxRate: BigInt(Math.max(buy, sell)),
|
|
170
|
+
pool: raw[14],
|
|
171
|
+
progress: raw[15],
|
|
172
|
+
lpFeeProfile: Number(raw[16]),
|
|
173
|
+
dexId: Number(raw[17] ?? 0),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* BSC TOKEN_TAXED_V3:买卖税在 buyTaxRate / sellTaxRate。
|
|
178
|
+
* 用 V7 读会把残留 taxRate(常见 100 bps)当成当前税。
|
|
179
|
+
*/
|
|
180
|
+
async getTokenV8(token) {
|
|
181
|
+
const raw = await this.contract.getTokenV8(token);
|
|
182
|
+
return this.mapTokenStateV8(raw);
|
|
183
|
+
}
|
|
184
|
+
async getTokenV8Safe(token) {
|
|
185
|
+
try {
|
|
186
|
+
const raw = await this.contract.getTokenV8Safe(token);
|
|
187
|
+
return this.mapTokenStateV8(raw);
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return this.getTokenV8(token);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
146
193
|
/**
|
|
147
194
|
* 计算距离毕业还需多少 OKB/ETH(含手续费)
|
|
148
195
|
* @param state TokenStateV5 或 TokenStateV7
|
|
@@ -123,6 +123,20 @@ export type TokenStateV7 = TokenStateV5 & {
|
|
|
123
123
|
progress: bigint;
|
|
124
124
|
lpFeeProfile: number;
|
|
125
125
|
};
|
|
126
|
+
/**
|
|
127
|
+
* TokenStateV8 - BSC TOKEN_TAXED_V3:taxRate 拆成 buyTaxRate / sellTaxRate
|
|
128
|
+
* 其它链仍用 V7;V8 仅 BSC Portal。
|
|
129
|
+
*/
|
|
130
|
+
export type TokenStateV8 = TokenStateV5 & {
|
|
131
|
+
buyTaxRate: bigint;
|
|
132
|
+
sellTaxRate: bigint;
|
|
133
|
+
/** 兼容读侧:max(buy, sell) */
|
|
134
|
+
taxRate: bigint;
|
|
135
|
+
pool: string;
|
|
136
|
+
progress: bigint;
|
|
137
|
+
lpFeeProfile: number;
|
|
138
|
+
dexId: number;
|
|
139
|
+
};
|
|
126
140
|
/**
|
|
127
141
|
* 将 lpFeeProfile 转换为 V3 fee 值
|
|
128
142
|
*/
|
|
@@ -71,9 +71,6 @@ export async function createTokenFlow(input) {
|
|
|
71
71
|
webUrl: input.payload.webUrl,
|
|
72
72
|
twitterUrl: input.payload.twitterUrl,
|
|
73
73
|
telegramUrl: input.payload.telegramUrl,
|
|
74
|
-
githubUrl: input.payload.githubUrl,
|
|
75
|
-
youtubeUrl: input.payload.youtubeUrl,
|
|
76
|
-
deboxUrl: input.payload.deboxUrl,
|
|
77
74
|
preSale: input.payload.preSale,
|
|
78
75
|
onlyMPC: input.payload.onlyMPC ?? false,
|
|
79
76
|
lpTradingFee: 0.0025,
|
|
@@ -70,9 +70,6 @@ export async function createTokenWithBundleBuy(params) {
|
|
|
70
70
|
webUrl: tokenInfo.webUrl,
|
|
71
71
|
twitterUrl: tokenInfo.twitterUrl,
|
|
72
72
|
telegramUrl: tokenInfo.telegramUrl,
|
|
73
|
-
githubUrl: tokenInfo.githubUrl,
|
|
74
|
-
youtubeUrl: tokenInfo.youtubeUrl,
|
|
75
|
-
deboxUrl: tokenInfo.deboxUrl,
|
|
76
73
|
preSale: tokenInfo.preSale || '0',
|
|
77
74
|
onlyMPC: false,
|
|
78
75
|
lpTradingFee: 0.0025,
|
|
@@ -69,9 +69,6 @@ export type FourCreateWithBundleBuyParams = {
|
|
|
69
69
|
webUrl?: string;
|
|
70
70
|
twitterUrl?: string;
|
|
71
71
|
telegramUrl?: string;
|
|
72
|
-
githubUrl?: string;
|
|
73
|
-
youtubeUrl?: string;
|
|
74
|
-
deboxUrl?: string;
|
|
75
72
|
tokenTaxInfo?: FourTokenTaxInfo;
|
|
76
73
|
feePlan?: boolean;
|
|
77
74
|
quoteSymbol?: string;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { ethers, JsonRpcProvider, Wallet } from 'ethers';
|
|
5
5
|
import { generateWallets } from '../../utils/wallet.js';
|
|
6
6
|
import { NonceManager, getOptimizedGasPrice, buildProfitHopTransactions, PROFIT_HOP_COUNT } from '../../utils/bundle-helpers.js';
|
|
7
|
-
import { BLOCKRAZOR_BUILDER_EOA, getProfitRecipient,
|
|
7
|
+
import { BLOCKRAZOR_BUILDER_EOA, getProfitRecipient, getTransferFeePerAddress, } from '../../core/constants/index.js';
|
|
8
8
|
import { getErrorMessageFromUnknown } from '../../core/index.js';
|
|
9
9
|
import { DEFAULT_GAS_LIMIT, DEFAULT_GAS_PRICE_GWEI, DEFAULT_MAX_WALLETS_PER_BATCH_ERC20, DEFAULT_MAX_WALLETS_PER_BATCH_NATIVE, GAS_BUFFER_MULTIPLIER, NATIVE_TRANSFER_GAS_LIMIT, buildDaoaasBuyTx, buildDisperseHopChainERC20, buildDisperseHopChainNative, buildERC20ApproveTx, buildFlapBuyTx, buildFourBuyTx, buildNativeTransferTx, buildV2BuyTx, buildV2BuyTxWithERC20, buildV3BuyTx, buildV3BuyTxWithERC20, calculateMaxWalletsPerBatch, chunkArray, generateDisperseHopPaths, getBaseTokenAddress, getRouterAddress, } from './holders-maker-helpers.js';
|
|
10
10
|
function formatUnitsFixed(value, decimals, precision = 6) {
|
|
@@ -88,12 +88,8 @@ export async function holdersMaker(params) {
|
|
|
88
88
|
// 4. 分批处理
|
|
89
89
|
const walletBatches = chunkArray(newWallets, maxWalletsPerBatch);
|
|
90
90
|
result.totalBatchCount = walletBatches.length;
|
|
91
|
-
// 5.
|
|
92
|
-
const
|
|
93
|
-
? ethers.parseEther(buyAmountPerHolder) * BigInt(holdersCount) // 按等值 BNB 计算
|
|
94
|
-
: buyAmountWei * BigInt(holdersCount);
|
|
95
|
-
const profitRateBps = getSharedProfitRateBps('normal');
|
|
96
|
-
const totalProfit = (totalBuyAmountForProfit * BigInt(profitRateBps)) / 10000n;
|
|
91
|
+
// 5. 按地址收取转账费(与钱包分发一致)
|
|
92
|
+
const totalProfit = getTransferFeePerAddress(chainId) * BigInt(holdersCount);
|
|
97
93
|
let profitPerBatch = totalProfit / BigInt(walletBatches.length);
|
|
98
94
|
if (profitPerBatch > 0n && chain === 'ENI') {
|
|
99
95
|
profitPerBatch += NATIVE_TRANSFER_GAS_LIMIT * gasPrice;
|
|
@@ -67,13 +67,25 @@ export async function inspectTokenLP(token, opts) {
|
|
|
67
67
|
// ✅ 优先尝试 getTokenV7(包含 taxRate),失败则 fallback 到 getTokenV5
|
|
68
68
|
let st = null;
|
|
69
69
|
let taxRate;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
if (opts.flapChain === 'BSC') {
|
|
71
|
+
try {
|
|
72
|
+
const stV8 = await flap.getTokenV8Safe(token);
|
|
73
|
+
st = stV8;
|
|
74
|
+
taxRate = Math.max(Number(stV8.buyTaxRate ?? 0n), Number(stV8.sellTaxRate ?? 0n));
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// V8 不可用时走 V7
|
|
78
|
+
}
|
|
74
79
|
}
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
if (!st) {
|
|
81
|
+
try {
|
|
82
|
+
const stV7 = await flap.getTokenV7(token);
|
|
83
|
+
st = stV7;
|
|
84
|
+
taxRate = Number(stV7.taxRate ?? 0n);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
st = await flap.getTokenV5(token);
|
|
88
|
+
}
|
|
77
89
|
}
|
|
78
90
|
if (st && st.status !== undefined && Number(st.status) !== 4) {
|
|
79
91
|
result.platform = 'FLAP';
|
|
@@ -317,9 +329,21 @@ export async function inspectTokenLP(token, opts) {
|
|
|
317
329
|
if (opts.flapChain && !result.flap && result.platform !== 'UNKNOWN') {
|
|
318
330
|
try {
|
|
319
331
|
const flap = new FlapPortal({ chain: opts.flapChain, rpcUrl: opts.rpcUrl });
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
332
|
+
let taxRate = 0;
|
|
333
|
+
if (opts.flapChain === 'BSC') {
|
|
334
|
+
try {
|
|
335
|
+
const stV8 = await flap.getTokenV8Safe(token);
|
|
336
|
+
taxRate = Math.max(Number(stV8.buyTaxRate ?? 0n), Number(stV8.sellTaxRate ?? 0n));
|
|
337
|
+
}
|
|
338
|
+
catch {
|
|
339
|
+
const stV7 = await flap.getTokenV7(token);
|
|
340
|
+
taxRate = Number(stV7.taxRate ?? 0n);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
const stV7 = await flap.getTokenV7(token);
|
|
345
|
+
taxRate = Number(stV7.taxRate ?? 0n);
|
|
346
|
+
}
|
|
323
347
|
if (taxRate > 0) {
|
|
324
348
|
result.taxRate = taxRate;
|
|
325
349
|
}
|
|
@@ -61,9 +61,6 @@ export type OpenFourCreateReq = {
|
|
|
61
61
|
webUrl?: string;
|
|
62
62
|
telegramUrl?: string;
|
|
63
63
|
twitterUrl?: string;
|
|
64
|
-
githubUrl?: string;
|
|
65
|
-
youtubeUrl?: string;
|
|
66
|
-
deboxUrl?: string;
|
|
67
64
|
presaleQuote: string | number;
|
|
68
65
|
feePlan: boolean;
|
|
69
66
|
initParams: OpenFourInitParams;
|
|
@@ -22,7 +22,7 @@ export { TM1, type FourChainV1 } from '../domains/four/contracts/tm1.js';
|
|
|
22
22
|
export { TM2, type FourChainV2 } from '../domains/four/contracts/tm2.js';
|
|
23
23
|
export { Helper3, Helper3Writer } from '../domains/four/contracts/helper3.js';
|
|
24
24
|
export { CDPV2 } from '../domains/flap/curve.js';
|
|
25
|
-
export { FlapPortal, FlapPortalWriter, type FlapChain, type PortalConfig, type TokenStateV2, type TokenStateV3, type TokenStateV4, type TokenStateV5, type TokenStateV7, type QuoteExactInputParams, type ExactInputParams, type ExactInputV3Params, type NewTokenV3Params, type NewTokenV4Params, type NewTokenV5Params, type TaxDistributionConfig, validateTaxDistribution, TokenStatus, TokenVersion, DexThreshType, MigratorType, V3LPFeeProfile, lpFeeProfileToV3Fee, DEXId, } from '../domains/flap/portal.js';
|
|
25
|
+
export { FlapPortal, FlapPortalWriter, type FlapChain, type PortalConfig, type TokenStateV2, type TokenStateV3, type TokenStateV4, type TokenStateV5, type TokenStateV7, type TokenStateV8, type QuoteExactInputParams, type ExactInputParams, type ExactInputV3Params, type NewTokenV3Params, type NewTokenV4Params, type NewTokenV5Params, type TaxDistributionConfig, validateTaxDistribution, TokenStatus, TokenVersion, DexThreshType, MigratorType, V3LPFeeProfile, lpFeeProfileToV3Fee, DEXId, } from '../domains/flap/portal.js';
|
|
26
26
|
export { uploadTokenMeta, type TokenMetaInput } from '../domains/flap/ipfs.js';
|
|
27
27
|
export { buildPermitPiggybackAuto } from '../domains/flap/permit.js';
|
|
28
28
|
export { predictVanityTokenAddressByChain, findSaltEndingByChain } from '../domains/flap/vanity.js';
|