four-flap-meme-sdk 1.7.75 → 1.7.77

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.
@@ -226,6 +226,8 @@ export const FLAP_PORTAL_ABI = [
226
226
  '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)',
227
227
  // ✅ V4:支持 dexId / lpFeeProfile(与 portal-bundle-merkle/core.ts 的 newTokenV4.populateTransaction 对齐)
228
228
  '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)',
229
+ // ✅ V5:Tax Token V2 高级税收分配
230
+ '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)',
229
231
  // 交易
230
232
  'function swapExactInput((address inputToken,address outputToken,uint256 inputAmount,uint256 minOutputAmount,bytes permitData)) external payable returns (uint256)',
231
233
  // ✅ V3:支持 extensionData(注意:这里的 V3 指“扩展交易接口版本”,不是“外盘 V3 池子”)
@@ -51,6 +51,13 @@ function encodeCreateCallV4(params) {
51
51
  const portalIface = new Interface(FLAP_PORTAL_ABI);
52
52
  return portalIface.encodeFunctionData('newTokenV4', [params]);
53
53
  }
54
+ /**
55
+ * 编码创建代币调用 V5(Tax Token V2 高级税收分配)
56
+ */
57
+ function encodeCreateCallV5(params) {
58
+ const portalIface = new Interface(FLAP_PORTAL_ABI);
59
+ return portalIface.encodeFunctionData('newTokenV5', [params]);
60
+ }
54
61
  /**
55
62
  * 编码内盘买入调用
56
63
  *
@@ -176,10 +183,43 @@ export async function bundleCreateBuy(params) {
176
183
  calls.push(buildProfitCall(devWallet.address, profitAmount, profitRecipient, delegateInterface));
177
184
  }
178
185
  // 2. 创建代币
179
- const useV4 = params.dexId !== undefined || params.lpFeeProfile !== undefined;
180
- const useV3 = !useV4 && !!params.extensionID;
186
+ const useV5 = params.taxV2Config !== undefined && (params.taxRate ?? 0) > 0;
187
+ const useV4 = !useV5 && (params.dexId !== undefined || params.lpFeeProfile !== undefined);
188
+ const useV3 = !useV5 && !useV4 && !!params.extensionID;
181
189
  let createData;
182
- if (useV4) {
190
+ if (useV5) {
191
+ // V5: Tax Token V2 高级税收分配
192
+ const tv2 = params.taxV2Config;
193
+ const total = tv2.mktBps + tv2.deflationBps + tv2.dividendBps + tv2.lpBps;
194
+ if (total !== 10000) {
195
+ throw new Error(`Tax distribution must sum to 10000 (100%), got ${total}`);
196
+ }
197
+ createData = encodeCreateCallV5({
198
+ name: tokenInfo.name,
199
+ symbol: tokenInfo.symbol,
200
+ meta: tokenInfo.meta,
201
+ dexThresh: params.dexThresh ?? 1,
202
+ salt: params.salt ?? ZERO_HASH,
203
+ taxRate: params.taxRate ?? 0,
204
+ migratorType: params.migratorType ?? 0,
205
+ quoteToken: params.quoteToken ?? ZERO_ADDRESS,
206
+ quoteAmt: params.quoteAmt ?? 0n,
207
+ beneficiary: params.beneficiary ?? devWallet.address,
208
+ permitData: params.permitData ?? '0x',
209
+ extensionID: params.extensionID ?? ZERO_HASH,
210
+ extensionData: params.extensionData ?? '0x',
211
+ dexId: params.dexId ?? 0,
212
+ lpFeeProfile: params.lpFeeProfile ?? 0,
213
+ taxDuration: BigInt(tv2.taxDuration),
214
+ antiFarmerDuration: BigInt(tv2.antiFarmerDuration),
215
+ mktBps: tv2.mktBps,
216
+ deflationBps: tv2.deflationBps,
217
+ dividendBps: tv2.dividendBps,
218
+ lpBps: tv2.lpBps,
219
+ minimumShareBalance: BigInt(tv2.minimumShareBalance ?? 10000) * (10n ** 18n),
220
+ });
221
+ }
222
+ else if (useV4) {
183
223
  createData = encodeCreateCallV4({
184
224
  name: tokenInfo.name,
185
225
  symbol: tokenInfo.symbol,
@@ -339,23 +379,59 @@ export async function bundleCreateToDex(params) {
339
379
  calls.push(buildProfitCall(payerWallet.address, profitAmount, profitRecipient, delegateInterface));
340
380
  }
341
381
  // 2. 创建代币 (Payer 发起)
342
- const createData = encodeCreateCallV4({
343
- name: tokenInfo.name,
344
- symbol: tokenInfo.symbol,
345
- meta: tokenInfo.meta,
346
- dexThresh: (params.dexThresh ?? 1) & 0xff,
347
- salt: params.salt ?? ZERO_HASH,
348
- taxRate: params.taxRate ?? 0,
349
- migratorType: params.migratorType ?? 0,
350
- quoteToken: params.quoteToken ?? ZERO_ADDRESS,
351
- quoteAmt: params.quoteAmt ?? 0n,
352
- beneficiary: params.beneficiary ?? payerWallet.address,
353
- permitData: params.permitData ?? '0x',
354
- extensionID: params.extensionID ?? ZERO_HASH,
355
- extensionData: params.extensionData ?? '0x',
356
- dexId: params.dexId ?? 0,
357
- lpFeeProfile: params.lpFeeProfile ?? 0,
358
- });
382
+ const useV5 = params.taxV2Config !== undefined && (params.taxRate ?? 0) > 0;
383
+ let createData;
384
+ if (useV5) {
385
+ // V5: Tax Token V2 高级税收分配
386
+ const tv2 = params.taxV2Config;
387
+ const total = tv2.mktBps + tv2.deflationBps + tv2.dividendBps + tv2.lpBps;
388
+ if (total !== 10000) {
389
+ throw new Error(`Tax distribution must sum to 10000 (100%), got ${total}`);
390
+ }
391
+ createData = encodeCreateCallV5({
392
+ name: tokenInfo.name,
393
+ symbol: tokenInfo.symbol,
394
+ meta: tokenInfo.meta,
395
+ dexThresh: (params.dexThresh ?? 1) & 0xff,
396
+ salt: params.salt ?? ZERO_HASH,
397
+ taxRate: params.taxRate ?? 0,
398
+ migratorType: params.migratorType ?? 0,
399
+ quoteToken: params.quoteToken ?? ZERO_ADDRESS,
400
+ quoteAmt: params.quoteAmt ?? 0n,
401
+ beneficiary: params.beneficiary ?? payerWallet.address,
402
+ permitData: params.permitData ?? '0x',
403
+ extensionID: params.extensionID ?? ZERO_HASH,
404
+ extensionData: params.extensionData ?? '0x',
405
+ dexId: params.dexId ?? 0,
406
+ lpFeeProfile: params.lpFeeProfile ?? 0,
407
+ taxDuration: BigInt(tv2.taxDuration),
408
+ antiFarmerDuration: BigInt(tv2.antiFarmerDuration),
409
+ mktBps: tv2.mktBps,
410
+ deflationBps: tv2.deflationBps,
411
+ dividendBps: tv2.dividendBps,
412
+ lpBps: tv2.lpBps,
413
+ minimumShareBalance: BigInt(tv2.minimumShareBalance ?? 10000) * (10n ** 18n),
414
+ });
415
+ }
416
+ else {
417
+ createData = encodeCreateCallV4({
418
+ name: tokenInfo.name,
419
+ symbol: tokenInfo.symbol,
420
+ meta: tokenInfo.meta,
421
+ dexThresh: (params.dexThresh ?? 1) & 0xff,
422
+ salt: params.salt ?? ZERO_HASH,
423
+ taxRate: params.taxRate ?? 0,
424
+ migratorType: params.migratorType ?? 0,
425
+ quoteToken: params.quoteToken ?? ZERO_ADDRESS,
426
+ quoteAmt: params.quoteAmt ?? 0n,
427
+ beneficiary: params.beneficiary ?? payerWallet.address,
428
+ permitData: params.permitData ?? '0x',
429
+ extensionID: params.extensionID ?? ZERO_HASH,
430
+ extensionData: params.extensionData ?? '0x',
431
+ dexId: params.dexId ?? 0,
432
+ lpFeeProfile: params.lpFeeProfile ?? 0,
433
+ });
434
+ }
359
435
  const createBatchCall = delegateInterface.encodeFunctionData('executeBatch', [[{
360
436
  target: FLAP_PORTAL_ADDRESS,
361
437
  value: params.quoteAmt ?? 0n,
@@ -78,6 +78,6 @@ export declare const ERC20_ABI: readonly ["function approve(address spender, uin
78
78
  export declare const MULTICALL3_ABI: readonly ["function aggregate3Value((address target, bool allowFailure, uint256 value, bytes callData)[] calls) external payable returns ((bool success, bytes returnData)[] returnData)"];
79
79
  export declare const V3_ROUTER_ABI: readonly ["function exactInputSingle((address tokenIn, address tokenOut, uint24 fee, address recipient, uint256 amountIn, uint256 amountOutMinimum, uint160 sqrtPriceLimitX96)) external payable returns (uint256 amountOut)", "function multicall(uint256 deadline, bytes[] data) external payable returns (bytes[] results)", "function unwrapWETH9(uint256 amountMinimum, address recipient) external payable", "function refundETH() external payable"];
80
80
  export declare const V2_ROUTER_ABI: readonly ["function swapExactETHForTokensSupportingFeeOnTransferTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) external payable", "function swapExactTokensForETHSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) external", "function swapExactTokensForTokensSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) external"];
81
- export declare const FLAP_PORTAL_ABI: readonly ["function buy(address token) external payable returns (uint256)", "function sell(address token, uint256 amount, uint256 minOut) external returns (uint256)", "function swapExactInput((address inputToken, address outputToken, uint256 inputAmount, uint256 minOutputAmount, bytes permitData) params) external payable returns (uint256)", "function swapExactInputV3((address inputToken, address outputToken, uint256 inputAmount, uint256 minOutputAmount, bytes permitData, bytes extensionData) params) external payable returns (uint256)", "function newTokenV2((string name, string symbol, string meta, uint8 dexThresh, bytes32 salt, uint16 taxRate, uint8 migratorType, address quoteToken, uint256 quoteAmt, address beneficiary, bytes permitData) params) external payable returns (address)", "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) params) external payable returns (address)", "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) params) external payable returns (address)", "function getToken(address token) external view returns (tuple(address creator, uint256 supply, uint256 reserve, bool graduated))", "function getTokenV5(address token) external view returns (uint8 status, uint256 reserve, uint256 circulatingSupply, uint256 price, uint8 tokenVersion, uint256 r, uint256 h, uint256 k, uint256 dexSupplyThresh, address quoteTokenAddress, bool nativeToQuoteSwapEnabled, bytes32 extensionID)", "function getTokenV7(address token) external view returns (uint8 status, uint256 reserve, uint256 circulatingSupply, uint256 price, uint8 tokenVersion, uint256 r, uint256 h, uint256 k, uint256 dexSupplyThresh, address quoteTokenAddress, bool nativeToQuoteSwapEnabled, bytes32 extensionID, uint8 taxRate, address pool, uint256 progress, uint8 lpFeeProfile)", "function quoteBuy(address token, uint256 ethIn) external view returns (uint256)", "function quoteSell(address token, uint256 tokenIn) external view returns (uint256)", "function quoteExactInput((address inputToken, address outputToken, uint256 inputAmount) params) external view returns (uint256)", "function previewBuy(address token, uint256 ethAmount) external view returns (uint256)", "function previewSell(address token, uint256 tokenAmount) external view returns (uint256)"];
81
+ export declare const FLAP_PORTAL_ABI: readonly ["function buy(address token) external payable returns (uint256)", "function sell(address token, uint256 amount, uint256 minOut) external returns (uint256)", "function swapExactInput((address inputToken, address outputToken, uint256 inputAmount, uint256 minOutputAmount, bytes permitData) params) external payable returns (uint256)", "function swapExactInputV3((address inputToken, address outputToken, uint256 inputAmount, uint256 minOutputAmount, bytes permitData, bytes extensionData) params) external payable returns (uint256)", "function newTokenV2((string name, string symbol, string meta, uint8 dexThresh, bytes32 salt, uint16 taxRate, uint8 migratorType, address quoteToken, uint256 quoteAmt, address beneficiary, bytes permitData) params) external payable returns (address)", "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) params) external payable returns (address)", "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) params) external payable returns (address)", "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) params) external payable returns (address)", "function getToken(address token) external view returns (tuple(address creator, uint256 supply, uint256 reserve, bool graduated))", "function getTokenV5(address token) external view returns (uint8 status, uint256 reserve, uint256 circulatingSupply, uint256 price, uint8 tokenVersion, uint256 r, uint256 h, uint256 k, uint256 dexSupplyThresh, address quoteTokenAddress, bool nativeToQuoteSwapEnabled, bytes32 extensionID)", "function getTokenV7(address token) external view returns (uint8 status, uint256 reserve, uint256 circulatingSupply, uint256 price, uint8 tokenVersion, uint256 r, uint256 h, uint256 k, uint256 dexSupplyThresh, address quoteTokenAddress, bool nativeToQuoteSwapEnabled, bytes32 extensionID, uint8 taxRate, address pool, uint256 progress, uint8 lpFeeProfile)", "function quoteBuy(address token, uint256 ethIn) external view returns (uint256)", "function quoteSell(address token, uint256 tokenIn) external view returns (uint256)", "function quoteExactInput((address inputToken, address outputToken, uint256 inputAmount) params) external view returns (uint256)", "function previewBuy(address token, uint256 ethAmount) external view returns (uint256)", "function previewSell(address token, uint256 tokenAmount) external view returns (uint256)"];
82
82
  export declare const EIP7702_TX_TYPE = 4;
83
83
  export declare const EIP7702_AUTH_PREFIX = 5;
@@ -170,6 +170,8 @@ export const FLAP_PORTAL_ABI = [
170
170
  'function newTokenV2((string name, string symbol, string meta, uint8 dexThresh, bytes32 salt, uint16 taxRate, uint8 migratorType, address quoteToken, uint256 quoteAmt, address beneficiary, bytes permitData) params) external payable returns (address)',
171
171
  '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) params) external payable returns (address)',
172
172
  '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) params) external payable returns (address)',
173
+ // newTokenV5: Tax Token V2 高级税收分配
174
+ '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) params) external payable returns (address)',
173
175
  // ========================================
174
176
  // 查询功能
175
177
  // ========================================
@@ -372,6 +372,16 @@ export interface CreateTokenParams {
372
372
  dexId?: number;
373
373
  /** LP 费率配置 (V4 使用, 0=0.25%, 1=0.01%, 2=1%) */
374
374
  lpFeeProfile?: number;
375
+ /** Tax Token V2 高级税收配置(V5 使用,taxRate > 0 时启用) */
376
+ taxV2Config?: {
377
+ taxDuration: number;
378
+ antiFarmerDuration: number;
379
+ mktBps: number;
380
+ deflationBps: number;
381
+ dividendBps: number;
382
+ lpBps: number;
383
+ minimumShareBalance?: number;
384
+ };
375
385
  }
376
386
  export interface BundleCreateBuyParams extends CreateTokenParams {
377
387
  /** 开发者钱包私钥(发起者,发币) */
@@ -93,14 +93,49 @@ export async function createTokenWithBundleBuyMerkle(params) {
93
93
  const originalPortalAddr = FLAP_ORIGINAL_PORTAL_ADDRESSES[chain];
94
94
  const portal = new ethers.Contract(originalPortalAddr, PORTAL_ABI, devWallet);
95
95
  // ✅ 判断使用哪个版本的 newToken
96
+ // V5: 提供了 taxV2Config 且 taxRate > 0(Tax Token V2 高级税收分配)
96
97
  // V4: 提供了 dexId 或 lpFeeProfile(支持 DEX 选择和 LP 费率配置)
97
98
  // V3: 提供了 extensionID(支持扩展数据)
98
99
  // V2: 默认
99
- const useV4 = params.dexId !== undefined || params.lpFeeProfile !== undefined;
100
- const useV3 = !useV4 && !!params.extensionID;
100
+ const useV5 = params.taxV2Config !== undefined && (params.taxRate ?? 0) > 0;
101
+ const useV4 = !useV5 && (params.dexId !== undefined || params.lpFeeProfile !== undefined);
102
+ const useV3 = !useV5 && !useV4 && !!params.extensionID;
101
103
  // ✅ 优化:并行获取 gasPrice、devWallet nonce 和 createTx
102
104
  let createTxPromise;
103
- if (useV4) {
105
+ if (useV5) {
106
+ // V5: Tax Token V2 高级税收分配
107
+ const tv2 = params.taxV2Config;
108
+ const dist = tv2.distribution;
109
+ const total = dist.mktBps + dist.deflationBps + dist.dividendBps + dist.lpBps;
110
+ if (total !== 10000) {
111
+ throw new Error(`Tax distribution must sum to 10000 (100%), got ${total}`);
112
+ }
113
+ createTxPromise = portal.newTokenV5.populateTransaction({
114
+ name: tokenInfo.name,
115
+ symbol: tokenInfo.symbol,
116
+ meta: tokenInfo.meta,
117
+ dexThresh: (params.dexThresh ?? 1) & 0xff,
118
+ salt: params.salt ?? '0x' + '00'.repeat(32),
119
+ taxRate: (params.taxRate ?? 0) & 0xffff,
120
+ migratorType: (params.migratorType ?? 0) & 0xff,
121
+ quoteToken: params.quoteToken || ZERO_ADDRESS,
122
+ quoteAmt: 0n,
123
+ beneficiary: devWallet.address,
124
+ permitData: '0x',
125
+ extensionID: params.extensionID ?? '0x' + '00'.repeat(32),
126
+ extensionData: params.extensionData ?? '0x',
127
+ dexId: (params.dexId ?? 0) & 0xff,
128
+ lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
129
+ taxDuration: BigInt(tv2.taxDuration),
130
+ antiFarmerDuration: BigInt(tv2.antiFarmerDuration),
131
+ mktBps: dist.mktBps,
132
+ deflationBps: dist.deflationBps,
133
+ dividendBps: dist.dividendBps,
134
+ lpBps: dist.lpBps,
135
+ minimumShareBalance: BigInt(dist.minimumShareBalance ?? 10000) * (10n ** 18n),
136
+ });
137
+ }
138
+ else if (useV4) {
104
139
  // V4: 支持 DEX ID 和 LP 费率配置
105
140
  createTxPromise = portal.newTokenV4.populateTransaction({
106
141
  name: tokenInfo.name,
@@ -76,6 +76,16 @@ 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) */
80
+ taxV2Config?: {
81
+ taxDuration: number;
82
+ antiFarmerDuration: number;
83
+ mktBps: number;
84
+ deflationBps: number;
85
+ dividendBps: number;
86
+ lpBps: number;
87
+ minimumShareBalance?: number;
88
+ };
79
89
  /** V3 扩展 ID */
80
90
  extensionID?: string;
81
91
  /** V3 扩展数据 */
@@ -301,13 +301,52 @@ export async function flapBundleCreateToDex(params) {
301
301
  noncesMap.set(devAddr, devNonce + 1);
302
302
  const originalPortal = new Contract(originalPortalAddress, PORTAL_ABI, devWallet);
303
303
  // ✅ 判断使用哪个版本的 newToken
304
+ // V5: 提供了 taxV2Config(Tax Token V2 高级税收分配)
304
305
  // V4: 提供了 dexId 或 lpFeeProfile(支持 DEX 选择和 LP 费率配置)
305
306
  // V3: 提供了 extensionID(支持扩展数据)
306
307
  // V2: 默认
307
- const useV4 = params.dexId !== undefined || params.lpFeeProfile !== undefined;
308
- const useV3 = !useV4 && !!params.extensionID;
308
+ console.log('[create-to-dex] 🔍 taxV2Config:', params.taxV2Config);
309
+ console.log('[create-to-dex] 🔍 taxRate:', params.taxRate);
310
+ const useV5 = params.taxV2Config !== undefined && (params.taxRate ?? 0) > 0;
311
+ console.log('[create-to-dex] 🔍 useV5:', useV5);
312
+ const useV4 = !useV5 && (params.dexId !== undefined || params.lpFeeProfile !== undefined);
313
+ const useV3 = !useV5 && !useV4 && !!params.extensionID;
309
314
  let createUnsigned;
310
- if (useV4) {
315
+ if (useV5) {
316
+ // V5: Tax Token V2 高级税收分配
317
+ const tv2 = params.taxV2Config;
318
+ // 验证税收分配总计必须为 10000
319
+ const total = tv2.mktBps + tv2.deflationBps + tv2.dividendBps + tv2.lpBps;
320
+ if (total !== 10000) {
321
+ throw new Error(`Tax distribution must sum to 10000 (100%), got ${total}`);
322
+ }
323
+ createUnsigned = await originalPortal.newTokenV5.populateTransaction({
324
+ name: tokenInfo.name,
325
+ symbol: tokenInfo.symbol,
326
+ meta: tokenInfo.meta,
327
+ dexThresh: (params.dexThresh ?? 1) & 0xff,
328
+ salt: params.salt ?? '0x' + '00'.repeat(32),
329
+ taxRate: (params.taxRate ?? 0) & 0xffff,
330
+ migratorType: (params.migratorType ?? 0) & 0xff,
331
+ quoteToken: inputToken,
332
+ quoteAmt: 0n,
333
+ beneficiary: devWallet.address,
334
+ permitData: '0x',
335
+ extensionID: params.extensionID ?? '0x' + '00'.repeat(32),
336
+ extensionData: params.extensionData ?? '0x',
337
+ dexId: (params.dexId ?? 0) & 0xff,
338
+ lpFeeProfile: (params.lpFeeProfile ?? 0) & 0xff,
339
+ // Tax Token V2 专属字段
340
+ taxDuration: BigInt(tv2.taxDuration),
341
+ antiFarmerDuration: BigInt(tv2.antiFarmerDuration),
342
+ mktBps: tv2.mktBps & 0xffff,
343
+ deflationBps: tv2.deflationBps & 0xffff,
344
+ dividendBps: tv2.dividendBps & 0xffff,
345
+ lpBps: tv2.lpBps & 0xffff,
346
+ minimumShareBalance: BigInt(tv2.minimumShareBalance ?? 10000) * (10n ** 18n),
347
+ });
348
+ }
349
+ else if (useV4) {
311
350
  // V4: 支持 DEX ID 和 LP 费率配置(用于选择池子费率)
312
351
  createUnsigned = await originalPortal.newTokenV4.populateTransaction({
313
352
  name: tokenInfo.name,
@@ -6,6 +6,33 @@ import type { GeneratedWallet } from '../../utils/wallet.js';
6
6
  * - 分布式模式最多支持 12 个钱包(12 交易 + 36 多跳 + 1 贿赂 = 49 笔)
7
7
  */
8
8
  export type FlapProfitMode = 'single' | 'distributed';
9
+ /**
10
+ * Tax Token V2 税收分配配置
11
+ * 注意:mktBps + deflationBps + dividendBps + lpBps 必须等于 10000 (100%)
12
+ */
13
+ export type TaxDistributionConfig = {
14
+ /** 营销分配(基点,0-10000,发送到 beneficiary 地址) */
15
+ mktBps: number;
16
+ /** 通缩销毁(基点,0-10000,直接销毁) */
17
+ deflationBps: number;
18
+ /** 持有者分红(基点,0-10000,发送到分红合约) */
19
+ dividendBps: number;
20
+ /** 流动性提供(基点,0-10000,LP 发送到 dead address) */
21
+ lpBps: number;
22
+ /** 分红最低持仓门槛(代币数量,dividendBps > 0 时必填,最小 10000) */
23
+ minimumShareBalance?: number;
24
+ };
25
+ /**
26
+ * Tax Token V2 高级税收参数(用于 newTokenV5)
27
+ */
28
+ export type TaxV2Config = {
29
+ /** 税收持续时间(秒,最大 100 年,0 = 永久) */
30
+ taxDuration: number;
31
+ /** 防打新持续时间(秒,最大 1 年) */
32
+ antiFarmerDuration: number;
33
+ /** 税收分配配置 */
34
+ distribution: TaxDistributionConfig;
35
+ };
9
36
  export type FlapSignConfig = {
10
37
  rpcUrl: string;
11
38
  txType?: 0 | 2;
@@ -118,6 +145,8 @@ export type FlapCreateWithBundleBuySignParams = {
118
145
  dexId?: number;
119
146
  /** LP 费率档位:0=STANDARD(0.25%), 1=LOW(0.01%), 2=HIGH(1%) */
120
147
  lpFeeProfile?: number;
148
+ /** Tax Token V2 高级税收配置 */
149
+ taxV2Config?: TaxV2Config;
121
150
  };
122
151
  /**
123
152
  * ✅ Flap 创建代币 + 购买结果(简化版)
@@ -179,6 +179,53 @@ export type NewTokenV4Params = {
179
179
  dexId: number;
180
180
  lpFeeProfile: number;
181
181
  };
182
+ /**
183
+ * newTokenV5 参数
184
+ * 相比 V4 新增了 Tax Token V2 高级税收分配功能
185
+ * 当 taxRate > 0 时,支持多种税收分配方式:营销、销毁、分红、流动性
186
+ */
187
+ export type NewTokenV5Params = {
188
+ name: string;
189
+ symbol: string;
190
+ meta: string;
191
+ dexThresh: number;
192
+ salt: string;
193
+ taxRate: number;
194
+ migratorType: number;
195
+ quoteToken: string;
196
+ quoteAmt: bigint;
197
+ beneficiary: string;
198
+ permitData?: string;
199
+ extensionID: string;
200
+ extensionData?: string;
201
+ dexId: number;
202
+ lpFeeProfile: number;
203
+ taxDuration: bigint;
204
+ antiFarmerDuration: bigint;
205
+ mktBps: number;
206
+ deflationBps: number;
207
+ dividendBps: number;
208
+ lpBps: number;
209
+ minimumShareBalance: bigint;
210
+ };
211
+ /**
212
+ * 税收分配配置(用于 UI)
213
+ * 注意:mktBps + deflationBps + dividendBps + lpBps 必须等于 10000 (100%)
214
+ */
215
+ export type TaxDistributionConfig = {
216
+ mktBps: number;
217
+ deflationBps: number;
218
+ dividendBps: number;
219
+ lpBps: number;
220
+ minimumShareBalance?: bigint;
221
+ };
222
+ /**
223
+ * 验证税收分配是否有效
224
+ */
225
+ export declare function validateTaxDistribution(config: TaxDistributionConfig): {
226
+ valid: boolean;
227
+ error?: string;
228
+ };
182
229
  export declare class FlapPortal {
183
230
  private rpcUrl;
184
231
  protected portal: string;
@@ -283,6 +330,50 @@ export declare class FlapPortalWriter extends FlapPortal {
283
330
  newTokenV4(args: NewTokenV4Params & {
284
331
  msgValue?: bigint;
285
332
  }): Promise<any>;
333
+ /**
334
+ * 创建 Token V5(支持 Tax Token V2 高级税收分配)
335
+ *
336
+ * 当 taxRate > 0 时,支持以下税收分配:
337
+ * - mktBps: 营销分配(发送到 beneficiary 地址)
338
+ * - deflationBps: 通缩销毁(直接销毁)
339
+ * - dividendBps: 持有者分红(发送到分红合约)
340
+ * - lpBps: 流动性提供(LP 发送到 dead address)
341
+ *
342
+ * 注意:mktBps + deflationBps + dividendBps + lpBps 必须等于 10000 (100%)
343
+ *
344
+ * @example
345
+ * ```typescript
346
+ * // 创建一个 3% 税率的代币,税收分配:40% 营销,30% 销毁,20% 分红,10% 流动性
347
+ * await portal.newTokenV5({
348
+ * name: 'My Tax Token',
349
+ * symbol: 'MTT',
350
+ * meta: 'bafkrei...',
351
+ * dexThresh: DexThreshType.FOUR_FIFTHS,
352
+ * salt: '0x...',
353
+ * taxRate: 300, // 3%
354
+ * migratorType: MigratorType.V2_MIGRATOR, // 税代币必须使用 V2 迁移器
355
+ * quoteToken: '0x0000000000000000000000000000000000000000',
356
+ * quoteAmt: 0n,
357
+ * beneficiary: '0x...',
358
+ * extensionID: '0x0000000000000000000000000000000000000000000000000000000000000000',
359
+ * dexId: DEXId.DEX0,
360
+ * lpFeeProfile: V3LPFeeProfile.LP_FEE_PROFILE_STANDARD,
361
+ * taxDuration: 365n * 24n * 60n * 60n, // 1 年
362
+ * antiFarmerDuration: 60n * 60n, // 1 小时
363
+ * mktBps: 4000, // 40%
364
+ * deflationBps: 3000, // 30%
365
+ * dividendBps: 2000, // 20%
366
+ * lpBps: 1000, // 10%
367
+ * minimumShareBalance: 10000n * 10n ** 18n, // 10K 代币
368
+ * msgValue: parseEther('0.01'),
369
+ * });
370
+ * ```
371
+ *
372
+ * @note 税代币(taxRate > 0)必须使用 V2_MIGRATOR
373
+ */
374
+ newTokenV5(args: NewTokenV5Params & {
375
+ msgValue?: bigint;
376
+ }): Promise<any>;
286
377
  claim(token: string): Promise<{
287
378
  txHash: string;
288
379
  tokenAmount: bigint;
@@ -81,6 +81,8 @@ const PORTAL_ABI = [
81
81
  '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
82
  '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
83
  '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 时使用)
85
+ '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)',
84
86
  // 受益人领取
85
87
  'function claim(address token) external returns (uint256,uint256)',
86
88
  'function delegateClaim(address token) external returns (uint256,uint256)',
@@ -101,6 +103,19 @@ export function lpFeeProfileToV3Fee(profile) {
101
103
  default: return 2500; // 默认 STANDARD
102
104
  }
103
105
  }
106
+ /**
107
+ * 验证税收分配是否有效
108
+ */
109
+ export function validateTaxDistribution(config) {
110
+ const total = config.mktBps + config.deflationBps + config.dividendBps + config.lpBps;
111
+ if (total !== 10000) {
112
+ return { valid: false, error: `税收分配总计必须为 100%,当前为 ${total / 100}%` };
113
+ }
114
+ if (config.dividendBps > 0 && (!config.minimumShareBalance || config.minimumShareBalance < 10000n * 10n ** 18n)) {
115
+ return { valid: false, error: '启用分红时,最低持仓门槛必须至少为 10,000 个代币' };
116
+ }
117
+ return { valid: true };
118
+ }
104
119
  export class FlapPortal {
105
120
  constructor(cfg) {
106
121
  this.rpcUrl = cfg.rpcUrl;
@@ -465,6 +480,84 @@ export class FlapPortalWriter extends FlapPortal {
465
480
  }, { value: args.msgValue });
466
481
  return await tx.wait();
467
482
  }
483
+ /**
484
+ * 创建 Token V5(支持 Tax Token V2 高级税收分配)
485
+ *
486
+ * 当 taxRate > 0 时,支持以下税收分配:
487
+ * - mktBps: 营销分配(发送到 beneficiary 地址)
488
+ * - deflationBps: 通缩销毁(直接销毁)
489
+ * - dividendBps: 持有者分红(发送到分红合约)
490
+ * - lpBps: 流动性提供(LP 发送到 dead address)
491
+ *
492
+ * 注意:mktBps + deflationBps + dividendBps + lpBps 必须等于 10000 (100%)
493
+ *
494
+ * @example
495
+ * ```typescript
496
+ * // 创建一个 3% 税率的代币,税收分配:40% 营销,30% 销毁,20% 分红,10% 流动性
497
+ * await portal.newTokenV5({
498
+ * name: 'My Tax Token',
499
+ * symbol: 'MTT',
500
+ * meta: 'bafkrei...',
501
+ * dexThresh: DexThreshType.FOUR_FIFTHS,
502
+ * salt: '0x...',
503
+ * taxRate: 300, // 3%
504
+ * migratorType: MigratorType.V2_MIGRATOR, // 税代币必须使用 V2 迁移器
505
+ * quoteToken: '0x0000000000000000000000000000000000000000',
506
+ * quoteAmt: 0n,
507
+ * beneficiary: '0x...',
508
+ * extensionID: '0x0000000000000000000000000000000000000000000000000000000000000000',
509
+ * dexId: DEXId.DEX0,
510
+ * lpFeeProfile: V3LPFeeProfile.LP_FEE_PROFILE_STANDARD,
511
+ * taxDuration: 365n * 24n * 60n * 60n, // 1 年
512
+ * antiFarmerDuration: 60n * 60n, // 1 小时
513
+ * mktBps: 4000, // 40%
514
+ * deflationBps: 3000, // 30%
515
+ * dividendBps: 2000, // 20%
516
+ * lpBps: 1000, // 10%
517
+ * minimumShareBalance: 10000n * 10n ** 18n, // 10K 代币
518
+ * msgValue: parseEther('0.01'),
519
+ * });
520
+ * ```
521
+ *
522
+ * @note 税代币(taxRate > 0)必须使用 V2_MIGRATOR
523
+ */
524
+ async newTokenV5(args) {
525
+ // 验证税收分配
526
+ if (args.taxRate > 0) {
527
+ const total = args.mktBps + args.deflationBps + args.dividendBps + args.lpBps;
528
+ if (total !== 10000) {
529
+ throw new Error(`税收分配总计必须为 10000 (100%),当前为 ${total}`);
530
+ }
531
+ if (args.dividendBps > 0 && args.minimumShareBalance < 10000n * 10n ** 18n) {
532
+ throw new Error('启用分红时,最低持仓门槛必须至少为 10,000 个代币');
533
+ }
534
+ }
535
+ const tx = await this.contract.newTokenV5({
536
+ name: args.name,
537
+ symbol: args.symbol,
538
+ meta: args.meta,
539
+ dexThresh: args.dexThresh,
540
+ salt: args.salt,
541
+ taxRate: args.taxRate,
542
+ migratorType: args.migratorType,
543
+ quoteToken: args.quoteToken,
544
+ quoteAmt: args.quoteAmt,
545
+ beneficiary: args.beneficiary,
546
+ permitData: args.permitData ?? '0x',
547
+ extensionID: args.extensionID,
548
+ extensionData: args.extensionData ?? '0x',
549
+ dexId: args.dexId,
550
+ lpFeeProfile: args.lpFeeProfile,
551
+ taxDuration: args.taxDuration,
552
+ antiFarmerDuration: args.antiFarmerDuration,
553
+ mktBps: args.mktBps,
554
+ deflationBps: args.deflationBps,
555
+ dividendBps: args.dividendBps,
556
+ lpBps: args.lpBps,
557
+ minimumShareBalance: args.minimumShareBalance,
558
+ }, { value: args.msgValue });
559
+ return await tx.wait();
560
+ }
468
561
  // 受益人领取收益
469
562
  async claim(token) {
470
563
  const tx = await this.contract.claim(token);
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export { TM1, type FourChainV1 } from './contracts/tm1.js';
11
11
  export { TM2, type FourChainV2 } from './contracts/tm2.js';
12
12
  export { Helper3, Helper3Writer } from './contracts/helper3.js';
13
13
  export { CDPV2 } from './flap/curve.js';
14
- 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, TokenStatus, TokenVersion, DexThreshType, MigratorType, V3LPFeeProfile, lpFeeProfileToV3Fee, DEXId } from './flap/portal.js';
14
+ 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 './flap/portal.js';
15
15
  export { uploadTokenMeta, type TokenMetaInput } from './flap/ipfs.js';
16
16
  export { buildPermitPiggybackAuto } from './flap/permit.js';
17
17
  export { predictVanityTokenAddressByChain, findSaltEndingByChain } from './flap/vanity.js';
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ export { TM1 } from './contracts/tm1.js';
30
30
  export { TM2 } from './contracts/tm2.js';
31
31
  export { Helper3, Helper3Writer } from './contracts/helper3.js';
32
32
  export { CDPV2 } from './flap/curve.js';
33
- export { FlapPortal, FlapPortalWriter, TokenStatus, TokenVersion, DexThreshType, MigratorType, V3LPFeeProfile, lpFeeProfileToV3Fee, DEXId } from './flap/portal.js';
33
+ export { FlapPortal, FlapPortalWriter, validateTaxDistribution, TokenStatus, TokenVersion, DexThreshType, MigratorType, V3LPFeeProfile, lpFeeProfileToV3Fee, DEXId } from './flap/portal.js';
34
34
  export { uploadTokenMeta } from './flap/ipfs.js';
35
35
  export { buildPermitPiggybackAuto } from './flap/permit.js';
36
36
  export { predictVanityTokenAddressByChain, findSaltEndingByChain } from './flap/vanity.js';
@@ -69,7 +69,7 @@ export declare const ENTRYPOINT_ABI: readonly ["function getNonce(address sender
69
69
  /** SimpleAccount ABI */
70
70
  export declare const SIMPLE_ACCOUNT_ABI: readonly ["function execute(address dest, uint256 value, bytes func) external", "function executeBatch(address[] calldata dest, bytes[] calldata func) external", "function executeBatch(address[] calldata dest, uint256[] calldata values, bytes[] calldata func) external"];
71
71
  /** Flap Portal ABI */
72
- export declare const PORTAL_ABI: readonly ["function swapExactInput((address inputToken,address outputToken,uint256 inputAmount,uint256 minOutputAmount,bytes permitData) params) payable returns (uint256)", "function swapExactInputV3((address inputToken,address outputToken,uint256 inputAmount,uint256 minOutputAmount,bytes permitData,bytes extensionData)) external payable returns (uint256)", "function buy(address token, address to, uint256 minAmount) external payable returns (uint256)", "function sell(address token, uint256 amount, uint256 minEth) external returns (uint256)", "function quoteExactInput((address inputToken,address outputToken,uint256 inputAmount)) external returns (uint256)", "function previewBuy(address token, uint256 ethAmount) external view returns (uint256)", "function previewSell(address token, uint256 tokenAmount) external view returns (uint256)", "function getTokenV5(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,uint256,uint256,address,bool,bytes32))", "function getTokenV7(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,uint256,uint256,address,bool,bytes32,uint16,address,uint256,uint8))", "function newTokenV2((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint16 taxRate,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData) params) external payable returns (address)", "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) params) external payable returns (address)", "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) params) external payable returns (address)"];
72
+ export declare const PORTAL_ABI: readonly ["function swapExactInput((address inputToken,address outputToken,uint256 inputAmount,uint256 minOutputAmount,bytes permitData) params) payable returns (uint256)", "function swapExactInputV3((address inputToken,address outputToken,uint256 inputAmount,uint256 minOutputAmount,bytes permitData,bytes extensionData)) external payable returns (uint256)", "function buy(address token, address to, uint256 minAmount) external payable returns (uint256)", "function sell(address token, uint256 amount, uint256 minEth) external returns (uint256)", "function quoteExactInput((address inputToken,address outputToken,uint256 inputAmount)) external returns (uint256)", "function previewBuy(address token, uint256 ethAmount) external view returns (uint256)", "function previewSell(address token, uint256 tokenAmount) external view returns (uint256)", "function getTokenV5(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,uint256,uint256,address,bool,bytes32))", "function getTokenV7(address token) external view returns ((uint8,uint256,uint256,uint256,uint8,uint256,uint256,uint256,uint256,address,bool,bytes32,uint16,address,uint256,uint8))", "function newTokenV2((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint16 taxRate,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData) params) external payable returns (address)", "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) params) external payable returns (address)", "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) params) external payable returns (address)", "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) params) external payable returns (address)"];
73
73
  /** ERC20 ABI */
74
74
  export declare const ERC20_ABI: readonly ["function balanceOf(address account) view returns (uint256)", "function allowance(address owner, address spender) view returns (uint256)", "function approve(address spender, uint256 amount) returns (bool)", "function transfer(address to, uint256 amount) returns (bool)", "function decimals() view returns (uint8)", "function symbol() view returns (string)", "function name() view returns (string)"];
75
75
  /** PotatoSwap V2 Router ABI */
@@ -126,6 +126,8 @@ export const PORTAL_ABI = [
126
126
  'function newTokenV2((string name,string symbol,string meta,uint8 dexThresh,bytes32 salt,uint16 taxRate,uint8 migratorType,address quoteToken,uint256 quoteAmt,address beneficiary,bytes permitData) params) external payable returns (address)',
127
127
  '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) params) external payable returns (address)',
128
128
  '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) params) external payable returns (address)',
129
+ // newTokenV5: Tax Token V2 高级税收分配
130
+ '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) params) external payable returns (address)',
129
131
  ];
130
132
  /** ERC20 ABI */
131
133
  export const ERC20_ABI = [
@@ -123,6 +123,33 @@ export declare function encodeCreateCallV4(params: {
123
123
  dexId: number;
124
124
  lpFeeProfile: number;
125
125
  }): string;
126
+ /**
127
+ * 编码创建代币调用 V5(Tax Token V2 高级税收分配)
128
+ */
129
+ export declare function encodeCreateCallV5(params: {
130
+ name: string;
131
+ symbol: string;
132
+ meta: string;
133
+ dexThresh: number;
134
+ salt: string;
135
+ taxRate: number;
136
+ migratorType: number;
137
+ quoteToken: string;
138
+ quoteAmt: bigint;
139
+ beneficiary: string;
140
+ permitData: string;
141
+ extensionID: string;
142
+ extensionData: string;
143
+ dexId: number;
144
+ lpFeeProfile: number;
145
+ taxDuration: bigint;
146
+ antiFarmerDuration: bigint;
147
+ mktBps: number;
148
+ deflationBps: number;
149
+ dividendBps: number;
150
+ lpBps: number;
151
+ minimumShareBalance: bigint;
152
+ }): string;
126
153
  export interface PortalQueryConfig {
127
154
  rpcUrl?: string;
128
155
  chainId?: number;
@@ -149,6 +149,12 @@ export function encodeCreateCallV3(params) {
149
149
  export function encodeCreateCallV4(params) {
150
150
  return portalIface.encodeFunctionData('newTokenV4', [params]);
151
151
  }
152
+ /**
153
+ * 编码创建代币调用 V5(Tax Token V2 高级税收分配)
154
+ */
155
+ export function encodeCreateCallV5(params) {
156
+ return portalIface.encodeFunctionData('newTokenV5', [params]);
157
+ }
152
158
  /**
153
159
  * Portal 查询器
154
160
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.7.75",
3
+ "version": "1.7.77",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",