four-flap-meme-sdk 2.2.6 → 2.2.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/dist/shared/flap/constants.d.ts +2 -0
- package/dist/shared/flap/constants.js +2 -0
- package/dist/shared/flap/portal-bundle-merkle/core.js +84 -17
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +5 -8
- package/dist/shared/flap/portal-create-token.d.ts +8 -7
- package/dist/shared/flap/portal-create-token.js +56 -58
- package/dist/shared/flap/vanity.d.ts +5 -1
- package/dist/shared/flap/vanity.js +9 -1
- package/package.json +1 -1
|
@@ -27,6 +27,8 @@ export declare const FLAP_ORIGINAL_PORTAL_ADDRESSES: {
|
|
|
27
27
|
*/
|
|
28
28
|
export declare const FLAP_TOKEN_IMPL_ADDRESSES: {
|
|
29
29
|
readonly BSC_NORMAL: "0x8b4329947e34b6d56d71a3385cac122bade7d78d";
|
|
30
|
+
/** TOKEN_V3_PERMIT / newTokenV7(Flap Portal v5.8.6+,vanity 后缀仍为 8888) */
|
|
31
|
+
readonly BSC_V3_PERMIT: "0x88881b6f03090462a969eC7f48385744Eeb63333";
|
|
30
32
|
readonly BSC_TAXED: "0x29e6383F0ce68507b5A72a53c2B118a118332aA8";
|
|
31
33
|
readonly BSC_TAXED_V5: "0xae562c6A05b798499507c6276C6Ed796027807BA";
|
|
32
34
|
readonly BASE: "0xF3c514E04f83166E80718f29f0d34F206be40A0A";
|
|
@@ -29,6 +29,8 @@ export const FLAP_ORIGINAL_PORTAL_ADDRESSES = {
|
|
|
29
29
|
*/
|
|
30
30
|
export const FLAP_TOKEN_IMPL_ADDRESSES = {
|
|
31
31
|
BSC_NORMAL: '0x8b4329947e34b6d56d71a3385cac122bade7d78d',
|
|
32
|
+
/** TOKEN_V3_PERMIT / newTokenV7(Flap Portal v5.8.6+,vanity 后缀仍为 8888) */
|
|
33
|
+
BSC_V3_PERMIT: '0x88881b6f03090462a969eC7f48385744Eeb63333',
|
|
32
34
|
BSC_TAXED: '0x29e6383F0ce68507b5A72a53c2B118a118332aA8', // V2: 只有运营钱包的税代币
|
|
33
35
|
BSC_TAXED_V5: '0xae562c6A05b798499507c6276C6Ed796027807BA', // V5: 高级税代币 (mkt/deflation/dividend/lp)
|
|
34
36
|
BASE: '0xF3c514E04f83166E80718f29f0d34F206be40A0A',
|
|
@@ -15,14 +15,27 @@ function resolveCreateTokenLaunchFlags(params) {
|
|
|
15
15
|
const normalizedTax = normalizeTaxLaunchConfig(params.taxV2Config, params.taxRate);
|
|
16
16
|
const isTaxLaunch = !!normalizedTax || (params.taxRate ?? 0) > 0;
|
|
17
17
|
const hasVault = !!normalizedTax?.vaultConfig && normalizedTax.vaultConfig.vaultType !== 'none';
|
|
18
|
-
const
|
|
18
|
+
const useV7Portal = !isTaxLaunch &&
|
|
19
19
|
!hasVault &&
|
|
20
|
-
(params.lpFeeProfile !== undefined ||
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
(params.lpFeeProfile !== undefined ||
|
|
21
|
+
params.dexId !== undefined ||
|
|
22
|
+
params.migratorType === MigratorType.PCS_INFINITY_CL_MIGRATOR);
|
|
23
|
+
return { normalizedTax, isTaxLaunch, hasVault, useV7Portal };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 无捆绑钱包、仅 Dev 自跟买、原生报价 → Flap 文档方式 A(create 内 quoteAmt + msg.value)
|
|
27
|
+
*/
|
|
28
|
+
function canUseLaunchMethodA(privateKeys, buyAmounts, devAddress, useNativeToken) {
|
|
29
|
+
if (!useNativeToken || buyAmounts.length !== 1 || privateKeys.length !== 2) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const buyerAddr = new Wallet(privateKeys[1]).address;
|
|
34
|
+
return buyerAddr.toLowerCase() === devAddress.toLowerCase();
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
26
39
|
}
|
|
27
40
|
export async function createTokenWithBundleBuyMerkle(params) {
|
|
28
41
|
const { chain, privateKeys, buyAmounts, tokenInfo, tokenAddress, config } = params;
|
|
@@ -39,7 +52,17 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
39
52
|
const portalAddr = FLAP_PORTAL_ADDRESSES[chain];
|
|
40
53
|
const originalPortalAddr = FLAP_ORIGINAL_PORTAL_ADDRESSES[chain];
|
|
41
54
|
const portal = new ethers.Contract(originalPortalAddr, PORTAL_ABI, devWallet);
|
|
42
|
-
const { normalizedTax,
|
|
55
|
+
const { normalizedTax, useV7Portal } = resolveCreateTokenLaunchFlags(params);
|
|
56
|
+
const inputToken = params.quoteToken && params.quoteToken !== ZERO_ADDRESS ? params.quoteToken : ZERO_ADDRESS;
|
|
57
|
+
const useNativeToken = inputToken === ZERO_ADDRESS;
|
|
58
|
+
const extractProfit = config.extractProfitOnLaunch === false ? false : shouldExtractProfit(config);
|
|
59
|
+
const useMethodA = canUseLaunchMethodA(privateKeys, buyAmounts, devWallet.address, useNativeToken);
|
|
60
|
+
let methodAQuoteAmt = 0n;
|
|
61
|
+
let methodABuyMeta;
|
|
62
|
+
if (useMethodA) {
|
|
63
|
+
methodABuyMeta = analyzeBuyFunds(buyAmounts, config, extractProfit);
|
|
64
|
+
methodAQuoteAmt = methodABuyMeta.fundsList[0] ?? 0n;
|
|
65
|
+
}
|
|
43
66
|
const createTxPromise = populateCreateTokenTransaction({
|
|
44
67
|
chain,
|
|
45
68
|
devWallet,
|
|
@@ -55,9 +78,9 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
55
78
|
lpFeeProfile: params.lpFeeProfile,
|
|
56
79
|
extensionID: params.extensionID,
|
|
57
80
|
extensionData: params.extensionData,
|
|
58
|
-
|
|
59
|
-
useClInfinityLaunch,
|
|
81
|
+
useV7Portal,
|
|
60
82
|
taxConfig: normalizedTax,
|
|
83
|
+
initialQuoteAmt: useMethodA ? methodAQuoteAmt : 0n,
|
|
61
84
|
});
|
|
62
85
|
const [gasPrice, createTxUnsigned, devNonce] = await Promise.all([
|
|
63
86
|
resolveGasPrice(provider, config),
|
|
@@ -72,19 +95,60 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
72
95
|
gasPrice,
|
|
73
96
|
chainId,
|
|
74
97
|
type: getTxType(config),
|
|
98
|
+
value: useMethodA ? methodAQuoteAmt : 0n,
|
|
75
99
|
};
|
|
76
100
|
const signedCreateTx = await devWallet.signTransaction(createTxRequest);
|
|
77
101
|
signedTxs.push(signedCreateTx);
|
|
102
|
+
if (useMethodA && methodABuyMeta) {
|
|
103
|
+
const { totalBuyAmount, totalProfit } = methodABuyMeta;
|
|
104
|
+
const bribeAmount = getBribeAmount(config);
|
|
105
|
+
const bribeTxs = [];
|
|
106
|
+
let nextDevNonce = devNonce + 1;
|
|
107
|
+
if (bribeAmount > 0n) {
|
|
108
|
+
const bribeTx = await devWallet.signTransaction({
|
|
109
|
+
to: BLOCKRAZOR_BUILDER_EOA,
|
|
110
|
+
value: bribeAmount,
|
|
111
|
+
nonce: nextDevNonce,
|
|
112
|
+
gasPrice,
|
|
113
|
+
gasLimit: GAS_LIMITS.BRIBE,
|
|
114
|
+
chainId,
|
|
115
|
+
type: getTxType(config),
|
|
116
|
+
});
|
|
117
|
+
bribeTxs.push(bribeTx);
|
|
118
|
+
nextDevNonce += 1;
|
|
119
|
+
}
|
|
120
|
+
const profitTxs = [];
|
|
121
|
+
let profitHopWallets;
|
|
122
|
+
if (extractProfit && totalProfit > 0n) {
|
|
123
|
+
const profitHopResult = await buildProfitHopTransactions({
|
|
124
|
+
provider,
|
|
125
|
+
payerWallet: devWallet,
|
|
126
|
+
profitAmount: totalProfit,
|
|
127
|
+
profitRecipient: getProfitRecipient(),
|
|
128
|
+
hopCount: PROFIT_HOP_COUNT,
|
|
129
|
+
gasPrice,
|
|
130
|
+
chainId,
|
|
131
|
+
txType: getTxType(config),
|
|
132
|
+
startNonce: nextDevNonce,
|
|
133
|
+
});
|
|
134
|
+
profitTxs.push(...profitHopResult.signedTransactions);
|
|
135
|
+
profitHopWallets = profitHopResult.hopWallets;
|
|
136
|
+
}
|
|
137
|
+
nonceManager.clearTemp();
|
|
138
|
+
return {
|
|
139
|
+
signedTransactions: [...bribeTxs, ...signedTxs, ...profitTxs],
|
|
140
|
+
tokenAddress,
|
|
141
|
+
profitHopWallets,
|
|
142
|
+
metadata: {
|
|
143
|
+
...buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, 0),
|
|
144
|
+
launchMethod: 'quoteAmt',
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
78
148
|
const buyers = createWallets(privateKeys.slice(1), provider);
|
|
79
|
-
// 发币+捆绑买:默认刮利润(与 emitservice isAddressRevenue 末笔校验、BSC 白名单 slice(-3) 对齐)
|
|
80
|
-
// 仅当显式 extractProfitOnLaunch: false 时关闭(需后端同步放宽校验)
|
|
81
|
-
const extractProfit = config.extractProfitOnLaunch === false ? false : shouldExtractProfit(config);
|
|
82
149
|
const { fundsList, originalAmounts, totalBuyAmount, totalProfit } = analyzeBuyFunds(buyAmounts, config, extractProfit);
|
|
83
150
|
const maxFundsIndex = findMaxIndex(originalAmounts);
|
|
84
151
|
const gasLimits = buildGasLimitList(buyers.length, config);
|
|
85
|
-
// ✅ 支持 quoteToken:如果传入了 quoteToken 且非零地址,则使用它
|
|
86
|
-
const inputToken = params.quoteToken && params.quoteToken !== ZERO_ADDRESS ? params.quoteToken : ZERO_ADDRESS;
|
|
87
|
-
const useNativeToken = inputToken === ZERO_ADDRESS;
|
|
88
152
|
// ✅ 如果使用非原生代币(如 USDC),需要根据精度转换金额
|
|
89
153
|
let adjustedFundsList = fundsList;
|
|
90
154
|
let profitTokenAmount = totalProfit;
|
|
@@ -160,7 +224,10 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
160
224
|
signedTransactions: [...bribeTxs, ...signedTxs, ...signedBuys, ...profitTxs],
|
|
161
225
|
tokenAddress,
|
|
162
226
|
profitHopWallets, // ✅ 返回利润多跳钱包
|
|
163
|
-
metadata:
|
|
227
|
+
metadata: {
|
|
228
|
+
...buildProfitMetadata(extractProfit, totalBuyAmount, totalProfit, buyers.length),
|
|
229
|
+
launchMethod: 'swapExactInput',
|
|
230
|
+
},
|
|
164
231
|
};
|
|
165
232
|
}
|
|
166
233
|
/**
|
|
@@ -309,13 +309,11 @@ export async function flapBundleCreateToDex(params) {
|
|
|
309
309
|
const normalizedTax = normalizeTaxLaunchConfig(params.taxV2Config, params.taxRate);
|
|
310
310
|
const isTaxLaunch = !!normalizedTax || (params.taxRate ?? 0) > 0;
|
|
311
311
|
const hasVault = !!normalizedTax?.vaultConfig && normalizedTax.vaultConfig.vaultType !== 'none';
|
|
312
|
-
const
|
|
312
|
+
const useV7Portal = !isTaxLaunch &&
|
|
313
313
|
!hasVault &&
|
|
314
|
-
(params.lpFeeProfile !== undefined ||
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
!useV4Portal &&
|
|
318
|
-
params.migratorType === MigratorType.PCS_INFINITY_CL_MIGRATOR;
|
|
314
|
+
(params.lpFeeProfile !== undefined ||
|
|
315
|
+
params.dexId !== undefined ||
|
|
316
|
+
params.migratorType === MigratorType.PCS_INFINITY_CL_MIGRATOR);
|
|
319
317
|
const createUnsigned = await populateCreateTokenTransaction({
|
|
320
318
|
chain,
|
|
321
319
|
devWallet,
|
|
@@ -331,8 +329,7 @@ export async function flapBundleCreateToDex(params) {
|
|
|
331
329
|
lpFeeProfile: params.lpFeeProfile,
|
|
332
330
|
extensionID: params.extensionID,
|
|
333
331
|
extensionData: params.extensionData,
|
|
334
|
-
|
|
335
|
-
useClInfinityLaunch,
|
|
332
|
+
useV7Portal,
|
|
336
333
|
taxConfig: normalizedTax,
|
|
337
334
|
});
|
|
338
335
|
const createTx = {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 对齐 Flap 官方文档:
|
|
5
5
|
* - newTokenV6:TOKEN_V2_PERMIT / TOKEN_TAXED_V3
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
6
|
+
* - newTokenV7:TOKEN_V3_PERMIT(BSC 标准 V3 / PCS Infinity CL,与 Flap 官网一致)
|
|
7
|
+
* - newTokenV4:已弃用(Portal 侧 FeatureDisabled,勿再使用)
|
|
8
8
|
* - VaultPortal.newTaxTokenWithVault:带金库的税币(legacy 参数结构)
|
|
9
9
|
*/
|
|
10
10
|
import { Contract, type Wallet } from 'ethers';
|
|
@@ -45,12 +45,16 @@ export type PopulateCreateTokenParams = {
|
|
|
45
45
|
lpFeeProfile?: number;
|
|
46
46
|
extensionID?: string;
|
|
47
47
|
extensionData?: string;
|
|
48
|
-
/** 标准 V3
|
|
48
|
+
/** 标准 V3 / TOKEN_V3_PERMIT(newTokenV7 + PCS_INFINITY_CL_MIGRATOR,对齐 Flap Portal v5.8.6+) */
|
|
49
|
+
useV7Portal?: boolean;
|
|
50
|
+
/** @deprecated 使用 useV7Portal */
|
|
49
51
|
useV4Portal?: boolean;
|
|
50
|
-
/**
|
|
52
|
+
/** @deprecated 已合并到 useV7Portal */
|
|
51
53
|
useClInfinityLaunch?: boolean;
|
|
52
54
|
/** 高级税币 / 税币 V3 配置 */
|
|
53
55
|
taxConfig?: NormalizedTaxLaunchConfig;
|
|
56
|
+
/** 创建时内嵌买入(Flap 文档方式 A:quoteAmt + msg.value) */
|
|
57
|
+
initialQuoteAmt?: bigint;
|
|
54
58
|
};
|
|
55
59
|
/** 将 TaxV2Config(含 distribution 嵌套)或 flat 结构归一化 */
|
|
56
60
|
export declare function normalizeTaxLaunchConfig(input?: {
|
|
@@ -74,7 +78,4 @@ export declare function normalizeTaxLaunchConfig(input?: {
|
|
|
74
78
|
minimumShareBalance?: number;
|
|
75
79
|
};
|
|
76
80
|
}, fallbackTaxRate?: number): NormalizedTaxLaunchConfig | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* 构建发币 populateTransaction(优先 V6/V7,Vault 走 VaultPortal)
|
|
79
|
-
*/
|
|
80
81
|
export declare function populateCreateTokenTransaction(params: PopulateCreateTokenParams): Promise<import("ethers").ContractTransaction>;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 对齐 Flap 官方文档:
|
|
5
5
|
* - newTokenV6:TOKEN_V2_PERMIT / TOKEN_TAXED_V3
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
6
|
+
* - newTokenV7:TOKEN_V3_PERMIT(BSC 标准 V3 / PCS Infinity CL,与 Flap 官网一致)
|
|
7
|
+
* - newTokenV4:已弃用(Portal 侧 FeatureDisabled,勿再使用)
|
|
8
8
|
* - VaultPortal.newTaxTokenWithVault:带金库的税币(legacy 参数结构)
|
|
9
9
|
*/
|
|
10
10
|
import { Contract, ZeroAddress } from 'ethers';
|
|
@@ -38,7 +38,7 @@ function buildV6TaxParams(params, taxConfig, dist) {
|
|
|
38
38
|
salt: params.salt ?? zeroBytes32(),
|
|
39
39
|
migratorType: (params.migratorType ?? MigratorType.V2_MIGRATOR) & 0xff,
|
|
40
40
|
quoteToken: params.quoteToken || ZERO_ADDRESS,
|
|
41
|
-
quoteAmt:
|
|
41
|
+
quoteAmt: resolveCreateQuoteAmt(params),
|
|
42
42
|
beneficiary: params.beneficiary,
|
|
43
43
|
permitData: '0x',
|
|
44
44
|
extensionID: params.extensionID ?? zeroBytes32(),
|
|
@@ -91,10 +91,55 @@ export function normalizeTaxLaunchConfig(input, fallbackTaxRate) {
|
|
|
91
91
|
/**
|
|
92
92
|
* 构建发币 populateTransaction(优先 V6/V7,Vault 走 VaultPortal)
|
|
93
93
|
*/
|
|
94
|
+
function resolveCreateQuoteAmt(params) {
|
|
95
|
+
return params.initialQuoteAmt ?? 0n;
|
|
96
|
+
}
|
|
97
|
+
function resolveUseV7Portal(params) {
|
|
98
|
+
return !!(params.useV7Portal ?? params.useV4Portal ?? params.useClInfinityLaunch);
|
|
99
|
+
}
|
|
100
|
+
/** Flap 文档:TOKEN_V3_PERMIT 须 migratorType=3、feeConfigs 单槽 MARKETING_OR_VAULT 10000 bps */
|
|
101
|
+
function buildNewTokenV7PermitParams(params) {
|
|
102
|
+
const emptyFeeConfig = {
|
|
103
|
+
feeType: FeeType.NONE,
|
|
104
|
+
bps: 0,
|
|
105
|
+
marketingAddress: ZeroAddress,
|
|
106
|
+
dividendToken: ZeroAddress,
|
|
107
|
+
minimumShareBalance: 0n,
|
|
108
|
+
};
|
|
109
|
+
const marketingFeeConfig = {
|
|
110
|
+
feeType: FeeType.MARKETING_OR_VAULT,
|
|
111
|
+
bps: 10000,
|
|
112
|
+
marketingAddress: params.beneficiary,
|
|
113
|
+
dividendToken: ZeroAddress,
|
|
114
|
+
minimumShareBalance: 0n,
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
name: params.tokenInfo.name,
|
|
118
|
+
symbol: params.tokenInfo.symbol,
|
|
119
|
+
meta: params.tokenInfo.meta,
|
|
120
|
+
dexThresh: (params.dexThresh ?? 1) & 0xff,
|
|
121
|
+
salt: params.salt ?? zeroBytes32(),
|
|
122
|
+
migratorType: MigratorType.PCS_INFINITY_CL_MIGRATOR,
|
|
123
|
+
quoteToken: params.quoteToken || ZERO_ADDRESS,
|
|
124
|
+
quoteAmt: resolveCreateQuoteAmt(params),
|
|
125
|
+
permitData: '0x',
|
|
126
|
+
extensionID: params.extensionID ?? zeroBytes32(),
|
|
127
|
+
extensionData: params.extensionData ?? '0x',
|
|
128
|
+
dexId: (params.dexId ?? 0) & 0xff,
|
|
129
|
+
buyTaxRate: 0,
|
|
130
|
+
sellTaxRate: 0,
|
|
131
|
+
taxDuration: 0n,
|
|
132
|
+
antiFarmerDuration: 0n,
|
|
133
|
+
commissionReceiver: ZeroAddress,
|
|
134
|
+
tokenVersion: TokenVersion.TOKEN_V3_PERMIT,
|
|
135
|
+
feeConfigs: [marketingFeeConfig, emptyFeeConfig, emptyFeeConfig, emptyFeeConfig],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
94
138
|
export async function populateCreateTokenTransaction(params) {
|
|
95
139
|
const taxConfig = params.taxConfig;
|
|
96
140
|
const { buyTaxRate, sellTaxRate } = resolveTaxRates(taxConfig, params.taxRate);
|
|
97
141
|
const isTaxLaunch = buyTaxRate > 0 || sellTaxRate > 0;
|
|
142
|
+
const quoteAmt = resolveCreateQuoteAmt(params);
|
|
98
143
|
// 1) Vault 金库税币
|
|
99
144
|
if (taxConfig?.vaultConfig && taxConfig.vaultConfig.vaultType !== 'none') {
|
|
100
145
|
validateTaxDistribution(taxConfig.mktBps, taxConfig.deflationBps, taxConfig.dividendBps, taxConfig.lpBps);
|
|
@@ -114,7 +159,7 @@ export async function populateCreateTokenTransaction(params) {
|
|
|
114
159
|
taxRate: Math.max(buyTaxRate, sellTaxRate) & 0xffff,
|
|
115
160
|
migratorType: (params.migratorType ?? MigratorType.V2_MIGRATOR) & 0xff,
|
|
116
161
|
quoteToken: params.quoteToken || ZERO_ADDRESS,
|
|
117
|
-
quoteAmt
|
|
162
|
+
quoteAmt,
|
|
118
163
|
permitData: '0x',
|
|
119
164
|
extensionID: zeroBytes32(),
|
|
120
165
|
extensionData: '0x',
|
|
@@ -152,58 +197,11 @@ export async function populateCreateTokenTransaction(params) {
|
|
|
152
197
|
sellTaxRate,
|
|
153
198
|
}, { mktBps: 10000, deflationBps: 0, dividendBps: 0, lpBps: 0 }));
|
|
154
199
|
}
|
|
155
|
-
// 3) 标准 V3
|
|
156
|
-
if (params
|
|
157
|
-
return params.originalPortal.
|
|
158
|
-
name: params.tokenInfo.name,
|
|
159
|
-
symbol: params.tokenInfo.symbol,
|
|
160
|
-
meta: params.tokenInfo.meta,
|
|
161
|
-
dexThresh: (params.dexThresh ?? 1) & 0xff,
|
|
162
|
-
salt: params.salt ?? zeroBytes32(),
|
|
163
|
-
taxRate: (params.taxRate ?? 0) & 0xffff,
|
|
164
|
-
migratorType: (params.migratorType ?? MigratorType.V3_MIGRATOR) & 0xff,
|
|
165
|
-
quoteToken: params.quoteToken || ZERO_ADDRESS,
|
|
166
|
-
quoteAmt: 0n,
|
|
167
|
-
beneficiary: params.beneficiary,
|
|
168
|
-
permitData: '0x',
|
|
169
|
-
extensionID: params.extensionID ?? zeroBytes32(),
|
|
170
|
-
extensionData: params.extensionData ?? '0x',
|
|
171
|
-
dexId: (params.dexId ?? 0) & 0xff,
|
|
172
|
-
lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
// 4) PCS Infinity CL(newTokenV7,仅显式 CL 迁移时)
|
|
176
|
-
if (params.useClInfinityLaunch) {
|
|
177
|
-
const emptyFeeConfig = {
|
|
178
|
-
feeType: FeeType.NONE,
|
|
179
|
-
bps: 0,
|
|
180
|
-
marketingAddress: ZeroAddress,
|
|
181
|
-
dividendToken: ZeroAddress,
|
|
182
|
-
minimumShareBalance: 0n,
|
|
183
|
-
};
|
|
184
|
-
return params.originalPortal.newTokenV7.populateTransaction({
|
|
185
|
-
name: params.tokenInfo.name,
|
|
186
|
-
symbol: params.tokenInfo.symbol,
|
|
187
|
-
meta: params.tokenInfo.meta,
|
|
188
|
-
dexThresh: (params.dexThresh ?? 1) & 0xff,
|
|
189
|
-
salt: params.salt ?? zeroBytes32(),
|
|
190
|
-
migratorType: MigratorType.PCS_INFINITY_CL_MIGRATOR,
|
|
191
|
-
quoteToken: params.quoteToken || ZERO_ADDRESS,
|
|
192
|
-
quoteAmt: 0n,
|
|
193
|
-
permitData: '0x',
|
|
194
|
-
extensionID: params.extensionID ?? zeroBytes32(),
|
|
195
|
-
extensionData: params.extensionData ?? '0x',
|
|
196
|
-
dexId: (params.dexId ?? 0) & 0xff,
|
|
197
|
-
buyTaxRate: 0,
|
|
198
|
-
sellTaxRate: 0,
|
|
199
|
-
taxDuration: 0n,
|
|
200
|
-
antiFarmerDuration: 0n,
|
|
201
|
-
commissionReceiver: ZeroAddress,
|
|
202
|
-
tokenVersion: TokenVersion.TOKEN_V3_PERMIT,
|
|
203
|
-
feeConfigs: [emptyFeeConfig, emptyFeeConfig, emptyFeeConfig, emptyFeeConfig],
|
|
204
|
-
});
|
|
200
|
+
// 3) 标准 V3 / TOKEN_V3_PERMIT(newTokenV7 — 与 Flap 官网 / Portal v5.8.6+ 一致;V4 已 FeatureDisabled)
|
|
201
|
+
if (resolveUseV7Portal(params)) {
|
|
202
|
+
return params.originalPortal.newTokenV7.populateTransaction(buildNewTokenV7PermitParams(params));
|
|
205
203
|
}
|
|
206
|
-
//
|
|
204
|
+
// 4) 仅 extension(newTokenV3)
|
|
207
205
|
const hasExtension = !!params.extensionID &&
|
|
208
206
|
params.extensionID !== zeroBytes32() &&
|
|
209
207
|
params.lpFeeProfile === undefined &&
|
|
@@ -218,14 +216,14 @@ export async function populateCreateTokenTransaction(params) {
|
|
|
218
216
|
taxRate: (params.taxRate ?? 0) & 0xffff,
|
|
219
217
|
migratorType: (params.migratorType ?? MigratorType.V3_MIGRATOR) & 0xff,
|
|
220
218
|
quoteToken: params.quoteToken || ZERO_ADDRESS,
|
|
221
|
-
quoteAmt
|
|
219
|
+
quoteAmt,
|
|
222
220
|
beneficiary: params.beneficiary,
|
|
223
221
|
permitData: '0x',
|
|
224
222
|
extensionID: params.extensionID,
|
|
225
223
|
extensionData: params.extensionData ?? '0x',
|
|
226
224
|
});
|
|
227
225
|
}
|
|
228
|
-
//
|
|
226
|
+
// 5) 标准 V2(newTokenV6 + TOKEN_V2_PERMIT)
|
|
229
227
|
return params.originalPortal.newTokenV6.populateTransaction({
|
|
230
228
|
name: params.tokenInfo.name,
|
|
231
229
|
symbol: params.tokenInfo.symbol,
|
|
@@ -234,7 +232,7 @@ export async function populateCreateTokenTransaction(params) {
|
|
|
234
232
|
salt: params.salt ?? zeroBytes32(),
|
|
235
233
|
migratorType: (params.migratorType ?? MigratorType.V2_MIGRATOR) & 0xff,
|
|
236
234
|
quoteToken: params.quoteToken || ZERO_ADDRESS,
|
|
237
|
-
quoteAmt
|
|
235
|
+
quoteAmt,
|
|
238
236
|
beneficiary: params.beneficiary,
|
|
239
237
|
permitData: '0x',
|
|
240
238
|
extensionID: params.extensionID ?? zeroBytes32(),
|
|
@@ -11,7 +11,9 @@ export declare function predictVanityTokenAddress(salt: string, portal: string,
|
|
|
11
11
|
* @param taxedV5 - 是否使用 V5 高级税代币实现 (mkt/deflation/dividend/lp)
|
|
12
12
|
*/
|
|
13
13
|
export declare function predictVanityTokenAddressByChain(chain: 'BSC' | 'BASE' | 'XLAYER' | 'MORPH' | 'MONAD', salt: string, taxed?: boolean, taxedV5?: boolean, // ✅ V5 高级税代币标识 (mkt/deflation/dividend/lp)
|
|
14
|
-
taxedV3?: boolean
|
|
14
|
+
taxedV3?: boolean, // ✅ V5 + Vault 金库税代币标识
|
|
15
|
+
/** BSC 标准币 + newTokenV7 / TOKEN_V3_PERMIT */
|
|
16
|
+
useV3Permit?: boolean): string;
|
|
15
17
|
/**
|
|
16
18
|
* 寻找满足后缀的 salt(默认 8888)
|
|
17
19
|
* 注意:该方法为同步 CPU 搜索,谨慎设置迭代限制
|
|
@@ -43,6 +45,8 @@ export declare function findSaltEndingByChain(opts: {
|
|
|
43
45
|
taxed?: boolean;
|
|
44
46
|
taxedV5?: boolean;
|
|
45
47
|
taxedV3?: boolean;
|
|
48
|
+
/** BSC 标准币 UI「V3」/ newTokenV7 */
|
|
49
|
+
useV3Permit?: boolean;
|
|
46
50
|
}): Promise<{
|
|
47
51
|
salt: string;
|
|
48
52
|
address: string;
|
|
@@ -20,7 +20,9 @@ export function predictVanityTokenAddress(salt, portal, tokenImpl) {
|
|
|
20
20
|
* @param taxedV5 - 是否使用 V5 高级税代币实现 (mkt/deflation/dividend/lp)
|
|
21
21
|
*/
|
|
22
22
|
export function predictVanityTokenAddressByChain(chain, salt, taxed = false, taxedV5 = false, // ✅ V5 高级税代币标识 (mkt/deflation/dividend/lp)
|
|
23
|
-
taxedV3 = false
|
|
23
|
+
taxedV3 = false, // ✅ V5 + Vault 金库税代币标识
|
|
24
|
+
/** BSC 标准币 + newTokenV7 / TOKEN_V3_PERMIT */
|
|
25
|
+
useV3Permit = false) {
|
|
24
26
|
// 使用 Flap 平台的原始 Portal 地址(用于 CREATE2)
|
|
25
27
|
const portal = FLAP_ORIGINAL_PORTAL_ADDRESSES[chain];
|
|
26
28
|
let tokenImpl;
|
|
@@ -29,6 +31,9 @@ taxedV3 = false) {
|
|
|
29
31
|
// ✅ V5 高级税代币(含 vault)使用新的实现地址
|
|
30
32
|
tokenImpl = FLAP_TOKEN_IMPL_ADDRESSES.BSC_TAXED_V5;
|
|
31
33
|
}
|
|
34
|
+
else if (useV3Permit) {
|
|
35
|
+
tokenImpl = FLAP_TOKEN_IMPL_ADDRESSES.BSC_V3_PERMIT;
|
|
36
|
+
}
|
|
32
37
|
else {
|
|
33
38
|
tokenImpl = taxed ? FLAP_TOKEN_IMPL_ADDRESSES.BSC_TAXED : FLAP_TOKEN_IMPL_ADDRESSES.BSC_NORMAL;
|
|
34
39
|
}
|
|
@@ -82,6 +87,9 @@ export async function findSaltEndingByChain(opts) {
|
|
|
82
87
|
// ✅ V5 高级税代币(含 vault)使用新的实现地址
|
|
83
88
|
tokenImpl = FLAP_TOKEN_IMPL_ADDRESSES.BSC_TAXED_V5;
|
|
84
89
|
}
|
|
90
|
+
else if (opts.useV3Permit) {
|
|
91
|
+
tokenImpl = FLAP_TOKEN_IMPL_ADDRESSES.BSC_V3_PERMIT;
|
|
92
|
+
}
|
|
85
93
|
else {
|
|
86
94
|
tokenImpl = opts.taxed ? FLAP_TOKEN_IMPL_ADDRESSES.BSC_TAXED : FLAP_TOKEN_IMPL_ADDRESSES.BSC_NORMAL;
|
|
87
95
|
}
|