four-flap-meme-sdk 2.2.1 → 2.2.3

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.
@@ -232,8 +232,12 @@ export const FLAP_PORTAL_ABI = [
232
232
  'function newTokenV3((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint16 taxRate,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData,bytes32 extensionID,bytes extensionData)) external payable returns (address)',
233
233
  // ✅ V4:支持 dexId / lpFeeProfile(与 portal-bundle-merkle/core.ts 的 newTokenV4.populateTransaction 对齐)
234
234
  'function newTokenV4((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint16 taxRate,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData,bytes32 extensionID,bytes extensionData,uint8 dexId,uint8 lpFeeProfile)) external payable returns (address)',
235
- // ✅ V5:Tax Token V2 高级税收分配
235
+ // ✅ V5:Tax Token V2 高级税收分配(legacy)
236
236
  'function newTokenV5((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint16 taxRate,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData,bytes32 extensionID,bytes extensionData,uint8 dexId,uint8 lpFeeProfile,uint64 taxDuration,uint64 antiFarmerDuration,uint16 mktBps,uint16 deflationBps,uint16 dividendBps,uint16 lpBps,uint256 minimumShareBalance)) external payable returns (address)',
237
+ // ✅ V6:统一发币入口(TOKEN_V2_PERMIT / TOKEN_TAXED_V3)
238
+ 'function newTokenV6((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData,bytes32 extensionID,bytes extensionData,uint8 dexId,uint8 lpFeeProfile,uint16 buyTaxRate,uint16 sellTaxRate,uint64 taxDuration,uint64 antiFarmerDuration,uint16 mktBps,uint16 deflationBps,uint16 dividendBps,uint16 lpBps,uint256 minimumShareBalance,address dividendToken,address commissionReceiver,uint8 tokenVersion)) external payable returns (address)',
239
+ // ✅ V7:TOKEN_V3_PERMIT + CL 迁移
240
+ 'function newTokenV7((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint8 migratorType,address quoteToken,uint256 quoteAmt,bytes permitData,bytes32 extensionID,bytes extensionData,uint8 dexId,uint16 buyTaxRate,uint16 sellTaxRate,uint64 taxDuration,uint64 antiFarmerDuration,address commissionReceiver,uint8 tokenVersion,(uint8 feeType,uint16 bps,address marketingAddress,address dividendToken,uint256 minimumShareBalance)[4] feeConfigs)) external payable returns (address)',
237
241
  // 交易
238
242
  'function swapExactInput((address inputToken,address outputToken,uint256 inputAmount,uint256 minOutputAmount,bytes permitData)) external payable returns (uint256)',
239
243
  // ✅ V3:支持 extensionData(注意:这里的 V3 指“扩展交易接口版本”,不是“外盘 V3 池子”)
@@ -7,12 +7,13 @@
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, DexThreshType, MigratorType, V3LPFeeProfile, lpFeeProfileToV3Fee, DEXId, } from './portal.js';
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';
11
11
  export { CDPV2 } from './curve.js';
12
12
  export { buildPermitPiggybackAuto } from './permit.js';
13
13
  export { uploadTokenMeta, type TokenMetaInput } from './ipfs.js';
14
14
  export { PinataClient, type PinataConfig, pinFileToIPFSWithJWT, pinImageByPath, pinFileToIPFSWithJWTWeb, pinDataURLWithJWTWeb, dataURLToBlob, type PinataPinResp, } from './pinata.js';
15
15
  export { predictVanityTokenAddressByChain, findSaltEndingByChain } from './vanity.js';
16
+ export { MAGIC_DIVIDEND_SELF, normalizeTaxLaunchConfig, populateCreateTokenTransaction, type NormalizedTaxLaunchConfig, } from './portal-create-token.js';
16
17
  export { getFlapMetaByAddress, getFlapMetasByAddresses } from './meta.js';
17
18
  export { parseFlapError, getFlapErrorMessage, getFlapErrorMessageEn, type FlapErrorCode } from './errors.js';
18
19
  export { FLAP_DEFAULT_FEE_RATES, FLAP_IPFS_API_URL, FLAP_VANITY_SUFFIX, FLAP_DEX_THRESHOLDS, FLAP_TOTAL_SUPPLY, ZERO_ADDRESS, CHAIN_TAX_SUPPORT, getVanitySuffix, isChainSupportTax, FLAP_PORTAL_ADDRESSES, } from './constants.js';
@@ -7,12 +7,13 @@
7
7
  * 使用时请从具体文件导入
8
8
  */
9
9
  // 核心模块 - 显式导出避免冲突
10
- export { FlapPortal, FlapPortalWriter, validateTaxDistribution, TokenStatus, TokenVersion, DexThreshType, MigratorType, V3LPFeeProfile, lpFeeProfileToV3Fee, DEXId, } from './portal.js';
10
+ export { FlapPortal, FlapPortalWriter, 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 } from './ipfs.js';
14
14
  export { PinataClient, pinFileToIPFSWithJWT, pinImageByPath, pinFileToIPFSWithJWTWeb, pinDataURLWithJWTWeb, dataURLToBlob, } from './pinata.js';
15
15
  export { predictVanityTokenAddressByChain, findSaltEndingByChain } from './vanity.js';
16
+ export { MAGIC_DIVIDEND_SELF, normalizeTaxLaunchConfig, populateCreateTokenTransaction, } from './portal-create-token.js';
16
17
  export { getFlapMetaByAddress, getFlapMetasByAddresses } from './meta.js';
17
18
  export { parseFlapError, getFlapErrorMessage, getFlapErrorMessageEn } from './errors.js';
18
19
  export { FLAP_DEFAULT_FEE_RATES, FLAP_IPFS_API_URL, FLAP_VANITY_SUFFIX, FLAP_DEX_THRESHOLDS, FLAP_TOTAL_SUPPLY, ZERO_ADDRESS, CHAIN_TAX_SUPPORT, getVanitySuffix, isChainSupportTax, FLAP_PORTAL_ADDRESSES, } from './constants.js';
@@ -7,7 +7,7 @@ import { ZERO_ADDRESS } from '../../../shared/constants/index.js';
7
7
  import { GAS_LIMITS } from '../../constants/index.js';
8
8
  import { MULTICALL3_ABI } from '../../abis/common.js';
9
9
  import { FLAP_PORTAL_ADDRESSES, FLAP_ORIGINAL_PORTAL_ADDRESSES } from '../constants.js';
10
- import { buildVaultParams, VAULT_PORTAL_ADDRESSES, VAULT_PORTAL_ABI } from '../vault.js';
10
+ import { normalizeTaxLaunchConfig, populateCreateTokenTransaction, } from '../portal-create-token.js';
11
11
  import { CHAIN_ID_MAP, PORTAL_ABI, getErrorMessage, getTxType, getGasPriceConfig, shouldExtractProfit, calculateProfit, getProfitRecipient, getBribeAmount, BLOCKRAZOR_BUILDER_EOA, } from './config.js';
12
12
  import { MULTICALL3_ADDRESS, getGasLimit, getTokenToNativeQuote } from './core-helpers.js';
13
13
  export async function createTokenWithBundleBuyMerkle(params) {
@@ -25,142 +25,30 @@ export async function createTokenWithBundleBuyMerkle(params) {
25
25
  const portalAddr = FLAP_PORTAL_ADDRESSES[chain];
26
26
  const originalPortalAddr = FLAP_ORIGINAL_PORTAL_ADDRESSES[chain];
27
27
  const portal = new ethers.Contract(originalPortalAddr, PORTAL_ABI, devWallet);
28
- // 判断使用哪个版本的 newToken
29
- // V5: 提供了 taxV2Config taxRate > 0(Tax Token V2 高级税收分配)
30
- // V4: 提供了 dexId lpFeeProfile(支持 DEX 选择和 LP 费率配置)
31
- // V3: 提供了 extensionID(支持扩展数据)
32
- // V2: 默认
33
- const useV5 = params.taxV2Config !== undefined && (params.taxRate ?? 0) > 0;
34
- const useV4 = !useV5 && (params.dexId !== undefined || params.lpFeeProfile !== undefined);
35
- const useV3 = !useV5 && !useV4 && !!params.extensionID;
36
- // ✅ 优化:并行获取 gasPrice、devWallet nonce 和 createTx
37
- let createTxPromise;
38
- if (useV5) {
39
- // V5: Tax Token V2 高级税收分配
40
- const tv2 = params.taxV2Config;
41
- const dist = tv2.distribution;
42
- const total = dist.mktBps + dist.deflationBps + dist.dividendBps + dist.lpBps;
43
- if (total !== 10000) {
44
- throw new Error(`Tax distribution must sum to 10000 (100%), got ${total}`);
45
- }
46
- // ✅ 判断是否使用金库模式(VaultPortal.newTaxTokenWithVault)
47
- const hasVault = tv2.vaultConfig && tv2.vaultConfig.vaultType !== 'none';
48
- if (hasVault) {
49
- // ✅ 金库模式:通过 VaultPortal.newTaxTokenWithVault 创建代币
50
- const vaultPortalAddr = VAULT_PORTAL_ADDRESSES[chain];
51
- if (!vaultPortalAddr) {
52
- throw new Error(`链 "${chain}" 不支持 Tax Vault 金库功能`);
53
- }
54
- const vaultPortal = new ethers.Contract(vaultPortalAddr, VAULT_PORTAL_ABI, devWallet);
55
- const { vaultFactory, vaultData } = buildVaultParams(tv2.vaultConfig, chain);
56
- createTxPromise = vaultPortal.newTaxTokenWithVault.populateTransaction({
57
- name: tokenInfo.name,
58
- symbol: tokenInfo.symbol,
59
- meta: tokenInfo.meta,
60
- dexThresh: (params.dexThresh ?? 1) & 0xff,
61
- salt: params.salt ?? '0x' + '00'.repeat(32),
62
- taxRate: (params.taxRate ?? 0) & 0xffff,
63
- migratorType: (params.migratorType ?? 0) & 0xff,
64
- quoteToken: params.quoteToken || ZERO_ADDRESS,
65
- quoteAmt: 0n,
66
- permitData: '0x',
67
- extensionID: '0x' + '00'.repeat(32),
68
- extensionData: '0x',
69
- dexId: (params.dexId ?? 0) & 0xff,
70
- lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
71
- taxDuration: BigInt(tv2.taxDuration),
72
- antiFarmerDuration: BigInt(tv2.antiFarmerDuration),
73
- mktBps: dist.mktBps,
74
- deflationBps: dist.deflationBps,
75
- dividendBps: dist.dividendBps,
76
- lpBps: dist.lpBps,
77
- minimumShareBalance: BigInt(dist.minimumShareBalance ?? 10000) * 10n ** 18n,
78
- vaultFactory,
79
- vaultData,
80
- });
81
- }
82
- else {
83
- // 标准 V5: Portal.newTokenV5(无金库)
84
- createTxPromise = portal.newTokenV5.populateTransaction({
85
- name: tokenInfo.name,
86
- symbol: tokenInfo.symbol,
87
- meta: tokenInfo.meta,
88
- dexThresh: (params.dexThresh ?? 1) & 0xff,
89
- salt: params.salt ?? '0x' + '00'.repeat(32),
90
- taxRate: (params.taxRate ?? 0) & 0xffff,
91
- migratorType: (params.migratorType ?? 0) & 0xff,
92
- quoteToken: params.quoteToken || ZERO_ADDRESS,
93
- quoteAmt: 0n,
94
- beneficiary: devWallet.address,
95
- permitData: '0x',
96
- extensionID: params.extensionID ?? '0x' + '00'.repeat(32),
97
- extensionData: params.extensionData ?? '0x',
98
- dexId: (params.dexId ?? 0) & 0xff,
99
- lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
100
- taxDuration: BigInt(tv2.taxDuration),
101
- antiFarmerDuration: BigInt(tv2.antiFarmerDuration),
102
- mktBps: dist.mktBps,
103
- deflationBps: dist.deflationBps,
104
- dividendBps: dist.dividendBps,
105
- lpBps: dist.lpBps,
106
- minimumShareBalance: BigInt(dist.minimumShareBalance ?? 10000) * 10n ** 18n,
107
- });
108
- }
109
- }
110
- else if (useV4) {
111
- // V4: 支持 DEX ID 和 LP 费率配置
112
- createTxPromise = portal.newTokenV4.populateTransaction({
113
- name: tokenInfo.name,
114
- symbol: tokenInfo.symbol,
115
- meta: tokenInfo.meta,
116
- dexThresh: (params.dexThresh ?? 1) & 0xff,
117
- salt: params.salt ?? '0x' + '00'.repeat(32),
118
- taxRate: (params.taxRate ?? 0) & 0xffff,
119
- migratorType: (params.migratorType ?? 0) & 0xff,
120
- quoteToken: params.quoteToken || ZERO_ADDRESS,
121
- quoteAmt: 0n,
122
- beneficiary: devWallet.address,
123
- permitData: '0x',
124
- extensionID: params.extensionID ?? '0x' + '00'.repeat(32),
125
- extensionData: params.extensionData ?? '0x',
126
- dexId: (params.dexId ?? 0) & 0xff,
127
- lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
128
- });
129
- }
130
- else if (useV3) {
131
- // V3: 支持扩展数据
132
- createTxPromise = portal.newTokenV3.populateTransaction({
133
- name: tokenInfo.name,
134
- symbol: tokenInfo.symbol,
135
- meta: tokenInfo.meta,
136
- dexThresh: (params.dexThresh ?? 1) & 0xff,
137
- salt: params.salt ?? '0x' + '00'.repeat(32),
138
- taxRate: (params.taxRate ?? 0) & 0xffff,
139
- migratorType: (params.migratorType ?? 0) & 0xff,
140
- quoteToken: params.quoteToken || ZERO_ADDRESS,
141
- quoteAmt: 0n,
142
- beneficiary: devWallet.address,
143
- permitData: '0x',
144
- extensionID: params.extensionID,
145
- extensionData: params.extensionData ?? '0x',
146
- });
147
- }
148
- else {
149
- // V2: 基础版本
150
- createTxPromise = portal.newTokenV2.populateTransaction({
151
- name: tokenInfo.name,
152
- symbol: tokenInfo.symbol,
153
- meta: tokenInfo.meta,
154
- dexThresh: (params.dexThresh ?? 1) & 0xff,
155
- salt: params.salt ?? '0x' + '00'.repeat(32),
156
- taxRate: (params.taxRate ?? 0) & 0xffff,
157
- migratorType: (params.migratorType ?? 0) & 0xff,
158
- quoteToken: params.quoteToken || ZERO_ADDRESS,
159
- quoteAmt: 0n,
160
- beneficiary: devWallet.address,
161
- permitData: '0x',
162
- });
163
- }
28
+ const normalizedTax = normalizeTaxLaunchConfig(params.taxV2Config, params.taxRate);
29
+ const isTaxLaunch = !!normalizedTax || (params.taxRate ?? 0) > 0;
30
+ const hasVault = !!normalizedTax?.vaultConfig && normalizedTax.vaultConfig.vaultType !== 'none';
31
+ const useV3Standard = !isTaxLaunch &&
32
+ !hasVault &&
33
+ (params.lpFeeProfile !== undefined || params.dexId !== undefined);
34
+ const createTxPromise = populateCreateTokenTransaction({
35
+ chain,
36
+ devWallet,
37
+ originalPortal: portal,
38
+ tokenInfo,
39
+ quoteToken: params.quoteToken || ZERO_ADDRESS,
40
+ beneficiary: devWallet.address,
41
+ dexThresh: params.dexThresh,
42
+ salt: params.salt,
43
+ migratorType: params.migratorType,
44
+ taxRate: params.taxRate,
45
+ dexId: params.dexId,
46
+ lpFeeProfile: params.lpFeeProfile,
47
+ extensionID: params.extensionID,
48
+ extensionData: params.extensionData,
49
+ useV3Standard,
50
+ taxConfig: normalizedTax,
51
+ });
164
52
  const [gasPrice, createTxUnsigned, devNonce] = await Promise.all([
165
53
  resolveGasPrice(provider, config),
166
54
  createTxPromise,
@@ -7,7 +7,7 @@
7
7
  * 3. 买到毕业(代币上 DEX)
8
8
  * 4. 多个钱包在 PancakeSwap(外盘)继续买入
9
9
  */
10
- import { type TaxVaultConfig } from '../vault.js';
10
+ import type { TaxVaultConfig } from '../vault.js';
11
11
  import { type FlapSignConfig } from './config.js';
12
12
  import type { MerkleSignedResult } from './types.js';
13
13
  export type CreateToDexChain = 'bsc' | 'xlayer' | 'base';
@@ -76,10 +76,14 @@ export interface FlapCreateToDexParams {
76
76
  dexId?: number;
77
77
  /** V4 参数:LP 费率档位(0=STANDARD 0.25%, 1=LOW 0.01%, 2=HIGH 1%) */
78
78
  lpFeeProfile?: number;
79
- /** Tax Token V2 高级税收配置(启用后使用 newTokenV5) */
79
+ /** Tax Token V2/V3 高级税收配置(启用后使用 newTokenV6 TOKEN_TAXED_V3) */
80
80
  taxV2Config?: {
81
81
  taxDuration: number;
82
82
  antiFarmerDuration: number;
83
+ buyTaxRate?: number;
84
+ sellTaxRate?: number;
85
+ dividendToken?: string;
86
+ commissionReceiver?: string;
83
87
  mktBps: number;
84
88
  deflationBps: number;
85
89
  dividendBps: number;
@@ -10,7 +10,7 @@
10
10
  import { ethers, Contract, Wallet } from 'ethers';
11
11
  import { NonceManager, getOptimizedGasPrice, buildProfitHopTransactions, PROFIT_HOP_COUNT, } from '../../../utils/bundle-helpers.js';
12
12
  import { FLAP_PORTAL_ADDRESSES, FLAP_ORIGINAL_PORTAL_ADDRESSES } from '../constants.js';
13
- import { buildVaultParams, VAULT_PORTAL_ADDRESSES, VAULT_PORTAL_ABI } from '../vault.js';
13
+ import { normalizeTaxLaunchConfig, populateCreateTokenTransaction, } from '../portal-create-token.js';
14
14
  import { ZERO_ADDRESS } from '../../../shared/constants/index.js';
15
15
  import { GAS_LIMITS } from '../../constants/index.js';
16
16
  import { getGasPriceConfig, getTxType, getProfitRecipient, getProfitRateBps, getBribeAmount, BLOCKRAZOR_BUILDER_EOA, PORTAL_ABI, } from './config.js';
@@ -305,142 +305,30 @@ export async function flapBundleCreateToDex(params) {
305
305
  const devNonce = noncesMap.get(devAddr);
306
306
  noncesMap.set(devAddr, devNonce + 1);
307
307
  const originalPortal = new Contract(originalPortalAddress, PORTAL_ABI, devWallet);
308
- // 判断使用哪个版本的 newToken
309
- // V5: 提供了 taxV2Config(Tax Token V2 高级税收分配)
310
- // V4: 提供了 dexId lpFeeProfile(支持 DEX 选择和 LP 费率配置)
311
- // V3: 提供了 extensionID(支持扩展数据)
312
- // V2: 默认
313
- const useV5 = params.taxV2Config !== undefined && (params.taxRate ?? 0) > 0;
314
- const useV4 = !useV5 && (params.dexId !== undefined || params.lpFeeProfile !== undefined);
315
- const useV3 = !useV5 && !useV4 && !!params.extensionID;
316
- let createUnsigned;
317
- if (useV5) {
318
- // V5: Tax Token V2 高级税收分配
319
- const tv2 = params.taxV2Config;
320
- // 验证税收分配总计必须为 10000
321
- const total = tv2.mktBps + tv2.deflationBps + tv2.dividendBps + tv2.lpBps;
322
- if (total !== 10000) {
323
- throw new Error(`Tax distribution must sum to 10000 (100%), got ${total}`);
324
- }
325
- // ✅ 判断是否使用金库模式(VaultPortal.newTaxTokenWithVault)
326
- const hasVault = tv2.vaultConfig && tv2.vaultConfig.vaultType !== 'none';
327
- if (hasVault) {
328
- // ✅ 金库模式:通过 VaultPortal.newTaxTokenWithVault 创建代币
329
- const chainKey = chain.toUpperCase();
330
- const vaultPortalAddr = VAULT_PORTAL_ADDRESSES[chainKey];
331
- if (!vaultPortalAddr) {
332
- throw new Error(`链 "${chain}" 不支持 Tax Vault 金库功能`);
333
- }
334
- const vaultPortal = new Contract(vaultPortalAddr, VAULT_PORTAL_ABI, devWallet);
335
- const { vaultFactory, vaultData } = buildVaultParams(tv2.vaultConfig, chainKey);
336
- createUnsigned = await vaultPortal.newTaxTokenWithVault.populateTransaction({
337
- name: tokenInfo.name,
338
- symbol: tokenInfo.symbol,
339
- meta: tokenInfo.meta,
340
- dexThresh: (params.dexThresh ?? 1) & 0xff,
341
- salt: params.salt ?? '0x' + '00'.repeat(32),
342
- taxRate: (params.taxRate ?? 0) & 0xffff,
343
- migratorType: (params.migratorType ?? 0) & 0xff,
344
- quoteToken: inputToken,
345
- quoteAmt: 0n,
346
- permitData: '0x',
347
- extensionID: '0x' + '00'.repeat(32),
348
- extensionData: '0x',
349
- dexId: (params.dexId ?? 0) & 0xff,
350
- lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
351
- taxDuration: BigInt(tv2.taxDuration),
352
- antiFarmerDuration: BigInt(tv2.antiFarmerDuration),
353
- mktBps: tv2.mktBps & 0xffff,
354
- deflationBps: tv2.deflationBps & 0xffff,
355
- dividendBps: tv2.dividendBps & 0xffff,
356
- lpBps: tv2.lpBps & 0xffff,
357
- minimumShareBalance: BigInt(tv2.minimumShareBalance ?? 10000) * 10n ** 18n,
358
- vaultFactory,
359
- vaultData,
360
- });
361
- }
362
- else {
363
- // 标准 V5: Portal.newTokenV5(无金库)
364
- createUnsigned = await originalPortal.newTokenV5.populateTransaction({
365
- name: tokenInfo.name,
366
- symbol: tokenInfo.symbol,
367
- meta: tokenInfo.meta,
368
- dexThresh: (params.dexThresh ?? 1) & 0xff,
369
- salt: params.salt ?? '0x' + '00'.repeat(32),
370
- taxRate: (params.taxRate ?? 0) & 0xffff,
371
- migratorType: (params.migratorType ?? 0) & 0xff,
372
- quoteToken: inputToken,
373
- quoteAmt: 0n,
374
- beneficiary: devWallet.address,
375
- permitData: '0x',
376
- extensionID: params.extensionID ?? '0x' + '00'.repeat(32),
377
- extensionData: params.extensionData ?? '0x',
378
- dexId: (params.dexId ?? 0) & 0xff,
379
- lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
380
- taxDuration: BigInt(tv2.taxDuration),
381
- antiFarmerDuration: BigInt(tv2.antiFarmerDuration),
382
- mktBps: tv2.mktBps & 0xffff,
383
- deflationBps: tv2.deflationBps & 0xffff,
384
- dividendBps: tv2.dividendBps & 0xffff,
385
- lpBps: tv2.lpBps & 0xffff,
386
- minimumShareBalance: BigInt(tv2.minimumShareBalance ?? 10000) * 10n ** 18n,
387
- });
388
- }
389
- }
390
- else if (useV4) {
391
- // V4: 支持 DEX ID 和 LP 费率配置(用于选择池子费率)
392
- createUnsigned = await originalPortal.newTokenV4.populateTransaction({
393
- name: tokenInfo.name,
394
- symbol: tokenInfo.symbol,
395
- meta: tokenInfo.meta,
396
- dexThresh: (params.dexThresh ?? 1) & 0xff,
397
- salt: params.salt ?? '0x' + '00'.repeat(32),
398
- taxRate: (params.taxRate ?? 0) & 0xffff,
399
- migratorType: (params.migratorType ?? 0) & 0xff,
400
- quoteToken: inputToken,
401
- quoteAmt: 0n,
402
- beneficiary: devWallet.address,
403
- permitData: '0x',
404
- extensionID: params.extensionID ?? '0x' + '00'.repeat(32),
405
- extensionData: params.extensionData ?? '0x',
406
- dexId: (params.dexId ?? 0) & 0xff,
407
- lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
408
- });
409
- }
410
- else if (useV3) {
411
- // V3: 支持扩展数据
412
- createUnsigned = await originalPortal.newTokenV3.populateTransaction({
413
- name: tokenInfo.name,
414
- symbol: tokenInfo.symbol,
415
- meta: tokenInfo.meta,
416
- dexThresh: (params.dexThresh ?? 1) & 0xff,
417
- salt: params.salt ?? '0x' + '00'.repeat(32),
418
- taxRate: (params.taxRate ?? 0) & 0xffff,
419
- migratorType: (params.migratorType ?? 0) & 0xff,
420
- quoteToken: inputToken,
421
- quoteAmt: 0n,
422
- beneficiary: devWallet.address,
423
- permitData: '0x',
424
- extensionID: params.extensionID,
425
- extensionData: params.extensionData ?? '0x',
426
- });
427
- }
428
- else {
429
- // V2: 基础版本
430
- createUnsigned = await originalPortal.newTokenV2.populateTransaction({
431
- name: tokenInfo.name,
432
- symbol: tokenInfo.symbol,
433
- meta: tokenInfo.meta,
434
- dexThresh: (params.dexThresh ?? 1) & 0xff,
435
- salt: params.salt ?? '0x' + '00'.repeat(32),
436
- taxRate: (params.taxRate ?? 0) & 0xffff,
437
- migratorType: (params.migratorType ?? 0) & 0xff,
438
- quoteToken: inputToken,
439
- quoteAmt: 0n,
440
- beneficiary: devWallet.address,
441
- permitData: '0x',
442
- });
443
- }
308
+ const normalizedTax = normalizeTaxLaunchConfig(params.taxV2Config, params.taxRate);
309
+ const isTaxLaunch = !!normalizedTax || (params.taxRate ?? 0) > 0;
310
+ const hasVault = !!normalizedTax?.vaultConfig && normalizedTax.vaultConfig.vaultType !== 'none';
311
+ const useV3Standard = !isTaxLaunch &&
312
+ !hasVault &&
313
+ (params.lpFeeProfile !== undefined || params.dexId !== undefined);
314
+ const createUnsigned = await populateCreateTokenTransaction({
315
+ chain,
316
+ devWallet,
317
+ originalPortal,
318
+ tokenInfo,
319
+ quoteToken: inputToken,
320
+ beneficiary: devWallet.address,
321
+ dexThresh: params.dexThresh,
322
+ salt: params.salt,
323
+ migratorType: params.migratorType,
324
+ taxRate: params.taxRate,
325
+ dexId: params.dexId,
326
+ lpFeeProfile: params.lpFeeProfile,
327
+ extensionID: params.extensionID,
328
+ extensionData: params.extensionData,
329
+ useV3Standard,
330
+ taxConfig: normalizedTax,
331
+ });
444
332
  const createTx = {
445
333
  ...createUnsigned,
446
334
  from: devWallet.address,
@@ -24,13 +24,21 @@ export type TaxDistributionConfig = {
24
24
  minimumShareBalance?: number;
25
25
  };
26
26
  /**
27
- * Tax Token V2 高级税收参数(用于 newTokenV5
27
+ * Tax Token V2/V3 高级税收参数(用于 newTokenV6 TOKEN_TAXED_V3
28
28
  */
29
29
  export type TaxV2Config = {
30
30
  /** 税收持续时间(秒,最大 100 年,0 = 永久) */
31
31
  taxDuration: number;
32
32
  /** 防打新持续时间(秒,最大 1 年) */
33
33
  antiFarmerDuration: number;
34
+ /** 买入税率(bps,100 = 1%) */
35
+ buyTaxRate?: number;
36
+ /** 卖出税率(bps,100 = 1%) */
37
+ sellTaxRate?: number;
38
+ /** 分红代币地址(零地址 = 原生/quote token) */
39
+ dividendToken?: string;
40
+ /** 佣金接收地址(零地址 = 无佣金) */
41
+ commissionReceiver?: string;
34
42
  /** 税收分配配置 */
35
43
  distribution: TaxDistributionConfig;
36
44
  /** ✅ Tax Vault 金库配置(可选) */
@@ -150,7 +158,7 @@ export type FlapCreateWithBundleBuySignParams = {
150
158
  dexId?: number;
151
159
  /** LP 费率档位:0=STANDARD(0.25%), 1=LOW(0.01%), 2=HIGH(1%) */
152
160
  lpFeeProfile?: number;
153
- /** Tax Token V2 高级税收配置 */
161
+ /** Tax Token V2/V3 高级税收配置 */
154
162
  taxV2Config?: TaxV2Config;
155
163
  };
156
164
  /**
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Portal 发币交易构建(newTokenV6 / newTokenV7 / VaultPortal)
3
+ *
4
+ * 对齐 Flap 官方文档:
5
+ * - newTokenV6:TOKEN_V2_PERMIT / TOKEN_TAXED_V3
6
+ * - newTokenV7:TOKEN_V3_PERMIT(CL 迁移)
7
+ * - VaultPortal.newTaxTokenWithVault:带金库的税币(legacy 参数结构)
8
+ */
9
+ import { Contract, type Wallet } from 'ethers';
10
+ import { type TaxVaultConfig } from './vault.js';
11
+ /** 分红代币:将 launching token 本身作为分红代币 */
12
+ export declare const MAGIC_DIVIDEND_SELF = "0xfEEDFEEDfeEDFEedFEEdFEEDFeEdfEEdFeEdFEEd";
13
+ export type NormalizedTaxLaunchConfig = {
14
+ taxDuration: number;
15
+ antiFarmerDuration: number;
16
+ mktBps: number;
17
+ deflationBps: number;
18
+ dividendBps: number;
19
+ lpBps: number;
20
+ minimumShareBalance?: number;
21
+ buyTaxRate: number;
22
+ sellTaxRate: number;
23
+ dividendToken?: string;
24
+ commissionReceiver?: string;
25
+ vaultConfig?: TaxVaultConfig;
26
+ };
27
+ export type PopulateCreateTokenParams = {
28
+ chain: string;
29
+ devWallet: Wallet;
30
+ originalPortal: Contract;
31
+ tokenInfo: {
32
+ name: string;
33
+ symbol: string;
34
+ meta: string;
35
+ };
36
+ quoteToken?: string;
37
+ beneficiary: string;
38
+ dexThresh?: number;
39
+ salt?: string;
40
+ migratorType?: number;
41
+ /** legacy 单税率(bps),无 buy/sell 时作为对称税率 */
42
+ taxRate?: number;
43
+ dexId?: number;
44
+ lpFeeProfile?: number;
45
+ extensionID?: string;
46
+ extensionData?: string;
47
+ /** 标准 V3 代币(newTokenV7 + TOKEN_V3_PERMIT) */
48
+ useV3Standard?: boolean;
49
+ /** 高级税币 / 税币 V3 配置 */
50
+ taxConfig?: NormalizedTaxLaunchConfig;
51
+ };
52
+ /** 将 TaxV2Config(含 distribution 嵌套)或 flat 结构归一化 */
53
+ export declare function normalizeTaxLaunchConfig(input?: {
54
+ taxDuration: number;
55
+ antiFarmerDuration: number;
56
+ mktBps?: number;
57
+ deflationBps?: number;
58
+ dividendBps?: number;
59
+ lpBps?: number;
60
+ minimumShareBalance?: number;
61
+ buyTaxRate?: number;
62
+ sellTaxRate?: number;
63
+ dividendToken?: string;
64
+ commissionReceiver?: string;
65
+ vaultConfig?: TaxVaultConfig;
66
+ distribution?: {
67
+ mktBps: number;
68
+ deflationBps: number;
69
+ dividendBps: number;
70
+ lpBps: number;
71
+ minimumShareBalance?: number;
72
+ };
73
+ }, fallbackTaxRate?: number): NormalizedTaxLaunchConfig | undefined;
74
+ /**
75
+ * 构建发币 populateTransaction(优先 V6/V7,Vault 走 VaultPortal)
76
+ */
77
+ export declare function populateCreateTokenTransaction(params: PopulateCreateTokenParams): Promise<import("ethers").ContractTransaction>;
@@ -0,0 +1,214 @@
1
+ /**
2
+ * Portal 发币交易构建(newTokenV6 / newTokenV7 / VaultPortal)
3
+ *
4
+ * 对齐 Flap 官方文档:
5
+ * - newTokenV6:TOKEN_V2_PERMIT / TOKEN_TAXED_V3
6
+ * - newTokenV7:TOKEN_V3_PERMIT(CL 迁移)
7
+ * - VaultPortal.newTaxTokenWithVault:带金库的税币(legacy 参数结构)
8
+ */
9
+ import { Contract, ZeroAddress } from 'ethers';
10
+ import { ZERO_ADDRESS } from '../constants/index.js';
11
+ import { buildVaultParams, VAULT_PORTAL_ADDRESSES, VAULT_PORTAL_ABI } from './vault.js';
12
+ import { TokenVersion, MigratorType, FeeType } from './portal.js';
13
+ /** 分红代币:将 launching token 本身作为分红代币 */
14
+ export const MAGIC_DIVIDEND_SELF = '0xfEEDFEEDfeEDFEedFEEdFEEDFeEdfEEdFeEdFEEd';
15
+ function zeroBytes32() {
16
+ return '0x' + '00'.repeat(32);
17
+ }
18
+ function resolveTaxRates(taxConfig, taxRate) {
19
+ const buy = taxConfig?.buyTaxRate ?? taxRate ?? 0;
20
+ const sell = taxConfig?.sellTaxRate ?? taxRate ?? 0;
21
+ return { buyTaxRate: buy & 0xffff, sellTaxRate: sell & 0xffff };
22
+ }
23
+ function validateTaxDistribution(mkt, def, div, lp) {
24
+ const total = mkt + def + div + lp;
25
+ if (total !== 10000) {
26
+ throw new Error(`Tax distribution must sum to 10000 (100%), got ${total}`);
27
+ }
28
+ }
29
+ function buildV6TaxParams(params, taxConfig, dist) {
30
+ const { buyTaxRate, sellTaxRate } = resolveTaxRates(taxConfig, params.taxRate);
31
+ validateTaxDistribution(dist.mktBps, dist.deflationBps, dist.dividendBps, dist.lpBps);
32
+ return {
33
+ name: params.tokenInfo.name,
34
+ symbol: params.tokenInfo.symbol,
35
+ meta: params.tokenInfo.meta,
36
+ dexThresh: (params.dexThresh ?? 1) & 0xff,
37
+ salt: params.salt ?? zeroBytes32(),
38
+ migratorType: (params.migratorType ?? MigratorType.V2_MIGRATOR) & 0xff,
39
+ quoteToken: params.quoteToken || ZERO_ADDRESS,
40
+ quoteAmt: 0n,
41
+ beneficiary: params.beneficiary,
42
+ permitData: '0x',
43
+ extensionID: params.extensionID ?? zeroBytes32(),
44
+ extensionData: params.extensionData ?? '0x',
45
+ dexId: (params.dexId ?? 0) & 0xff,
46
+ lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
47
+ buyTaxRate,
48
+ sellTaxRate,
49
+ taxDuration: BigInt(taxConfig.taxDuration),
50
+ antiFarmerDuration: BigInt(taxConfig.antiFarmerDuration),
51
+ mktBps: dist.mktBps,
52
+ deflationBps: dist.deflationBps,
53
+ dividendBps: dist.dividendBps,
54
+ lpBps: dist.lpBps,
55
+ minimumShareBalance: BigInt(taxConfig.minimumShareBalance ?? 10000) * 10n ** 18n,
56
+ dividendToken: taxConfig.dividendToken || ZeroAddress,
57
+ commissionReceiver: taxConfig.commissionReceiver || ZeroAddress,
58
+ tokenVersion: TokenVersion.TOKEN_TAXED_V3,
59
+ };
60
+ }
61
+ /** 将 TaxV2Config(含 distribution 嵌套)或 flat 结构归一化 */
62
+ export function normalizeTaxLaunchConfig(input, fallbackTaxRate) {
63
+ if (!input)
64
+ return undefined;
65
+ const dist = 'distribution' in input ? input.distribution : undefined;
66
+ const mktBps = dist?.mktBps ?? input.mktBps ?? 10000;
67
+ const deflationBps = dist?.deflationBps ?? input.deflationBps ?? 0;
68
+ const dividendBps = dist?.dividendBps ?? input.dividendBps ?? 0;
69
+ const lpBps = dist?.lpBps ?? input.lpBps ?? 0;
70
+ const minimumShareBalance = dist?.minimumShareBalance ?? input.minimumShareBalance;
71
+ const buyTaxRate = input.buyTaxRate ?? fallbackTaxRate ?? 0;
72
+ const sellTaxRate = input.sellTaxRate ?? fallbackTaxRate ?? 0;
73
+ if (buyTaxRate <= 0 && sellTaxRate <= 0)
74
+ return undefined;
75
+ return {
76
+ taxDuration: input.taxDuration,
77
+ antiFarmerDuration: input.antiFarmerDuration,
78
+ mktBps,
79
+ deflationBps,
80
+ dividendBps,
81
+ lpBps,
82
+ minimumShareBalance,
83
+ buyTaxRate,
84
+ sellTaxRate,
85
+ dividendToken: input.dividendToken,
86
+ commissionReceiver: input.commissionReceiver,
87
+ vaultConfig: input.vaultConfig,
88
+ };
89
+ }
90
+ /**
91
+ * 构建发币 populateTransaction(优先 V6/V7,Vault 走 VaultPortal)
92
+ */
93
+ export async function populateCreateTokenTransaction(params) {
94
+ const taxConfig = params.taxConfig;
95
+ const { buyTaxRate, sellTaxRate } = resolveTaxRates(taxConfig, params.taxRate);
96
+ const isTaxLaunch = buyTaxRate > 0 || sellTaxRate > 0;
97
+ // 1) Vault 金库税币
98
+ if (taxConfig?.vaultConfig && taxConfig.vaultConfig.vaultType !== 'none') {
99
+ validateTaxDistribution(taxConfig.mktBps, taxConfig.deflationBps, taxConfig.dividendBps, taxConfig.lpBps);
100
+ const chainKey = params.chain.toUpperCase();
101
+ const vaultPortalAddr = VAULT_PORTAL_ADDRESSES[chainKey];
102
+ if (!vaultPortalAddr) {
103
+ throw new Error(`链 "${params.chain}" 不支持 Tax Vault 金库功能`);
104
+ }
105
+ const vaultPortal = new Contract(vaultPortalAddr, VAULT_PORTAL_ABI, params.devWallet);
106
+ const { vaultFactory, vaultData } = buildVaultParams(taxConfig.vaultConfig, chainKey);
107
+ return vaultPortal.newTaxTokenWithVault.populateTransaction({
108
+ name: params.tokenInfo.name,
109
+ symbol: params.tokenInfo.symbol,
110
+ meta: params.tokenInfo.meta,
111
+ dexThresh: (params.dexThresh ?? 1) & 0xff,
112
+ salt: params.salt ?? zeroBytes32(),
113
+ taxRate: Math.max(buyTaxRate, sellTaxRate) & 0xffff,
114
+ migratorType: (params.migratorType ?? MigratorType.V2_MIGRATOR) & 0xff,
115
+ quoteToken: params.quoteToken || ZERO_ADDRESS,
116
+ quoteAmt: 0n,
117
+ permitData: '0x',
118
+ extensionID: zeroBytes32(),
119
+ extensionData: '0x',
120
+ dexId: (params.dexId ?? 0) & 0xff,
121
+ lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
122
+ taxDuration: BigInt(taxConfig.taxDuration),
123
+ antiFarmerDuration: BigInt(taxConfig.antiFarmerDuration),
124
+ mktBps: taxConfig.mktBps,
125
+ deflationBps: taxConfig.deflationBps,
126
+ dividendBps: taxConfig.dividendBps,
127
+ lpBps: taxConfig.lpBps,
128
+ minimumShareBalance: BigInt(taxConfig.minimumShareBalance ?? 10000) * 10n ** 18n,
129
+ vaultFactory,
130
+ vaultData,
131
+ });
132
+ }
133
+ // 2) 税币 V3(newTokenV6 + TOKEN_TAXED_V3)
134
+ if (isTaxLaunch && taxConfig) {
135
+ return params.originalPortal.newTokenV6.populateTransaction(buildV6TaxParams(params, taxConfig, {
136
+ mktBps: taxConfig.mktBps,
137
+ deflationBps: taxConfig.deflationBps,
138
+ dividendBps: taxConfig.dividendBps,
139
+ lpBps: taxConfig.lpBps,
140
+ }));
141
+ }
142
+ if (isTaxLaunch) {
143
+ return params.originalPortal.newTokenV6.populateTransaction(buildV6TaxParams(params, {
144
+ taxDuration: 365 * 24 * 60 * 60,
145
+ antiFarmerDuration: 3 * 24 * 60 * 60,
146
+ mktBps: 10000,
147
+ deflationBps: 0,
148
+ dividendBps: 0,
149
+ lpBps: 0,
150
+ buyTaxRate,
151
+ sellTaxRate,
152
+ }, { mktBps: 10000, deflationBps: 0, dividendBps: 0, lpBps: 0 }));
153
+ }
154
+ // 3) 标准 V3(newTokenV7 + TOKEN_V3_PERMIT)
155
+ if (params.useV3Standard) {
156
+ const emptyFeeConfig = {
157
+ feeType: FeeType.NONE,
158
+ bps: 0,
159
+ marketingAddress: ZeroAddress,
160
+ dividendToken: ZeroAddress,
161
+ minimumShareBalance: 0n,
162
+ };
163
+ return params.originalPortal.newTokenV7.populateTransaction({
164
+ name: params.tokenInfo.name,
165
+ symbol: params.tokenInfo.symbol,
166
+ meta: params.tokenInfo.meta,
167
+ dexThresh: (params.dexThresh ?? 1) & 0xff,
168
+ salt: params.salt ?? zeroBytes32(),
169
+ migratorType: MigratorType.PCS_INFINITY_CL_MIGRATOR,
170
+ quoteToken: params.quoteToken || ZERO_ADDRESS,
171
+ quoteAmt: 0n,
172
+ permitData: '0x',
173
+ extensionID: params.extensionID ?? zeroBytes32(),
174
+ extensionData: params.extensionData ?? '0x',
175
+ dexId: (params.dexId ?? 0) & 0xff,
176
+ buyTaxRate: 0,
177
+ sellTaxRate: 0,
178
+ taxDuration: 0n,
179
+ antiFarmerDuration: 0n,
180
+ commissionReceiver: ZeroAddress,
181
+ tokenVersion: TokenVersion.TOKEN_V3_PERMIT,
182
+ feeConfigs: [emptyFeeConfig, emptyFeeConfig, emptyFeeConfig, emptyFeeConfig],
183
+ });
184
+ }
185
+ // 4) 标准 V2(newTokenV6 + TOKEN_V2_PERMIT)
186
+ return params.originalPortal.newTokenV6.populateTransaction({
187
+ name: params.tokenInfo.name,
188
+ symbol: params.tokenInfo.symbol,
189
+ meta: params.tokenInfo.meta,
190
+ dexThresh: (params.dexThresh ?? 1) & 0xff,
191
+ salt: params.salt ?? zeroBytes32(),
192
+ migratorType: (params.migratorType ?? MigratorType.V2_MIGRATOR) & 0xff,
193
+ quoteToken: params.quoteToken || ZERO_ADDRESS,
194
+ quoteAmt: 0n,
195
+ beneficiary: params.beneficiary,
196
+ permitData: '0x',
197
+ extensionID: params.extensionID ?? zeroBytes32(),
198
+ extensionData: params.extensionData ?? '0x',
199
+ dexId: (params.dexId ?? 0) & 0xff,
200
+ lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
201
+ buyTaxRate: 0,
202
+ sellTaxRate: 0,
203
+ taxDuration: 0n,
204
+ antiFarmerDuration: 0n,
205
+ mktBps: 0,
206
+ deflationBps: 0,
207
+ dividendBps: 0,
208
+ lpBps: 0,
209
+ minimumShareBalance: 0n,
210
+ dividendToken: ZeroAddress,
211
+ commissionReceiver: ZeroAddress,
212
+ tokenVersion: TokenVersion.TOKEN_V2_PERMIT,
213
+ });
214
+ }
@@ -11,7 +11,18 @@ export declare enum TokenVersion {
11
11
  TOKEN_LEGACY_MINT_NO_PERMIT_DUPLICATE = 1,
12
12
  TOKEN_V2_PERMIT = 2,
13
13
  TOKEN_GOPLUS = 3,
14
- TOKEN_TAXED = 4
14
+ TOKEN_TAXED = 4,
15
+ TOKEN_TAXED_V2 = 5,
16
+ TOKEN_TAXED_V3 = 6,
17
+ TOKEN_V3_PERMIT = 7
18
+ }
19
+ /** newTokenV7 feeConfigs 槽位类型 */
20
+ export declare enum FeeType {
21
+ NONE = 0,
22
+ MARKETING_OR_VAULT = 1,
23
+ DIVIDEND = 2,
24
+ DEFLATION = 3,
25
+ LP_BPS = 4
15
26
  }
16
27
  export declare enum DexThreshType {
17
28
  TWO_THIRDS = 0,
@@ -23,7 +34,9 @@ export declare enum DexThreshType {
23
34
  }
24
35
  export declare enum MigratorType {
25
36
  V3_MIGRATOR = 0,
26
- V2_MIGRATOR = 1
37
+ V2_MIGRATOR = 1,
38
+ /** PCS Infinity CL 迁移(newTokenV7 / TOKEN_V3_PERMIT) */
39
+ PCS_INFINITY_CL_MIGRATOR = 3
27
40
  }
28
41
  /**
29
42
  * V3 LP 费率档位
@@ -16,7 +16,19 @@ export var TokenVersion;
16
16
  TokenVersion[TokenVersion["TOKEN_V2_PERMIT"] = 2] = "TOKEN_V2_PERMIT";
17
17
  TokenVersion[TokenVersion["TOKEN_GOPLUS"] = 3] = "TOKEN_GOPLUS";
18
18
  TokenVersion[TokenVersion["TOKEN_TAXED"] = 4] = "TOKEN_TAXED";
19
+ TokenVersion[TokenVersion["TOKEN_TAXED_V2"] = 5] = "TOKEN_TAXED_V2";
20
+ TokenVersion[TokenVersion["TOKEN_TAXED_V3"] = 6] = "TOKEN_TAXED_V3";
21
+ TokenVersion[TokenVersion["TOKEN_V3_PERMIT"] = 7] = "TOKEN_V3_PERMIT";
19
22
  })(TokenVersion || (TokenVersion = {}));
23
+ /** newTokenV7 feeConfigs 槽位类型 */
24
+ export var FeeType;
25
+ (function (FeeType) {
26
+ FeeType[FeeType["NONE"] = 0] = "NONE";
27
+ FeeType[FeeType["MARKETING_OR_VAULT"] = 1] = "MARKETING_OR_VAULT";
28
+ FeeType[FeeType["DIVIDEND"] = 2] = "DIVIDEND";
29
+ FeeType[FeeType["DEFLATION"] = 3] = "DEFLATION";
30
+ FeeType[FeeType["LP_BPS"] = 4] = "LP_BPS";
31
+ })(FeeType || (FeeType = {}));
20
32
  export var DexThreshType;
21
33
  (function (DexThreshType) {
22
34
  DexThreshType[DexThreshType["TWO_THIRDS"] = 0] = "TWO_THIRDS";
@@ -30,6 +42,8 @@ export var MigratorType;
30
42
  (function (MigratorType) {
31
43
  MigratorType[MigratorType["V3_MIGRATOR"] = 0] = "V3_MIGRATOR";
32
44
  MigratorType[MigratorType["V2_MIGRATOR"] = 1] = "V2_MIGRATOR";
45
+ /** PCS Infinity CL 迁移(newTokenV7 / TOKEN_V3_PERMIT) */
46
+ MigratorType[MigratorType["PCS_INFINITY_CL_MIGRATOR"] = 3] = "PCS_INFINITY_CL_MIGRATOR";
33
47
  })(MigratorType || (MigratorType = {}));
34
48
  /**
35
49
  * V3 LP 费率档位
@@ -81,8 +95,12 @@ const PORTAL_ABI = [
81
95
  'function newTokenV2((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint16 taxRate,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData)) external payable returns (address)',
82
96
  'function newTokenV3((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint16 taxRate,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData,bytes32 extensionID,bytes extensionData)) external payable returns (address)',
83
97
  'function newTokenV4((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint16 taxRate,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData,bytes32 extensionID,bytes extensionData,uint8 dexId,uint8 lpFeeProfile)) external payable returns (address)',
84
- // newTokenV5: 支持 Tax Token V2 高级税收分配(taxRate > 0 时使用)
98
+ // newTokenV5: 支持 Tax Token V2 高级税收分配(legacy,推荐 newTokenV6)
85
99
  'function newTokenV5((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint16 taxRate,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData,bytes32 extensionID,bytes extensionData,uint8 dexId,uint8 lpFeeProfile,uint64 taxDuration,uint64 antiFarmerDuration,uint16 mktBps,uint16 deflationBps,uint16 dividendBps,uint16 lpBps,uint256 minimumShareBalance)) external payable returns (address)',
100
+ // newTokenV6: 统一入口(TOKEN_V2_PERMIT / TOKEN_TAXED_V3)
101
+ 'function newTokenV6((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData,bytes32 extensionID,bytes extensionData,uint8 dexId,uint8 lpFeeProfile,uint16 buyTaxRate,uint16 sellTaxRate,uint64 taxDuration,uint64 antiFarmerDuration,uint16 mktBps,uint16 deflationBps,uint16 dividendBps,uint16 lpBps,uint256 minimumShareBalance,address dividendToken,address commissionReceiver,uint8 tokenVersion)) external payable returns (address)',
102
+ // newTokenV7: TOKEN_V3_PERMIT + CL 迁移
103
+ 'function newTokenV7((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint8 migratorType,address quoteToken,uint256 quoteAmt,bytes permitData,bytes32 extensionID,bytes extensionData,uint8 dexId,uint16 buyTaxRate,uint16 sellTaxRate,uint64 taxDuration,uint64 antiFarmerDuration,address commissionReceiver,uint8 tokenVersion,(uint8 feeType,uint16 bps,address marketingAddress,address dividendToken,uint256 minimumShareBalance)[4] feeConfigs)) external payable returns (address)',
86
104
  // 受益人领取
87
105
  'function claim(address token) external returns (uint256,uint256)',
88
106
  'function delegateClaim(address token) external returns (uint256,uint256)',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",