four-flap-meme-sdk 4.3.5 → 4.3.6

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.
@@ -97,7 +97,12 @@ function resolveCreateQuoteAmt(params) {
97
97
  function resolveUseV7Portal(params) {
98
98
  return !!(params.useV7Portal ?? params.useV4Portal ?? params.useClInfinityLaunch);
99
99
  }
100
- /** Flap 文档:TOKEN_V3_PERMIT 须 migratorType=3、feeConfigs 单槽 MARKETING_OR_VAULT 10000 bps */
100
+ /**
101
+ * 标准 V3 / TOKEN_V3_PERMIT:对齐 Flap 官网 live newTokenV7。
102
+ * 主网 Portal v5.23.1 拒 MARKETING_OR_VAULT(NewTokenV7RuleViolation(8)),
103
+ * 只收单槽 DIVIDEND 10000 bps、dividendToken == quoteToken(原生为 address(0))。
104
+ */
105
+ const V7_DIVIDEND_MIN_SHARE = 10000n * 10n ** 18n;
101
106
  function buildNewTokenV7PermitParams(params) {
102
107
  const emptyFeeConfig = {
103
108
  feeType: FeeType.NONE,
@@ -106,12 +111,13 @@ function buildNewTokenV7PermitParams(params) {
106
111
  dividendToken: ZeroAddress,
107
112
  minimumShareBalance: 0n,
108
113
  };
109
- const marketingFeeConfig = {
110
- feeType: FeeType.MARKETING_OR_VAULT,
114
+ const quoteToken = params.quoteToken || ZERO_ADDRESS;
115
+ const dividendFeeConfig = {
116
+ feeType: FeeType.DIVIDEND,
111
117
  bps: 10000,
112
- marketingAddress: params.beneficiary,
113
- dividendToken: ZeroAddress,
114
- minimumShareBalance: 0n,
118
+ marketingAddress: ZeroAddress,
119
+ dividendToken: quoteToken,
120
+ minimumShareBalance: V7_DIVIDEND_MIN_SHARE,
115
121
  };
116
122
  return {
117
123
  name: params.tokenInfo.name,
@@ -120,7 +126,7 @@ function buildNewTokenV7PermitParams(params) {
120
126
  dexThresh: (params.dexThresh ?? 1) & 0xff,
121
127
  salt: params.salt ?? zeroBytes32(),
122
128
  migratorType: MigratorType.PCS_INFINITY_CL_MIGRATOR,
123
- quoteToken: params.quoteToken || ZERO_ADDRESS,
129
+ quoteToken,
124
130
  quoteAmt: resolveCreateQuoteAmt(params),
125
131
  permitData: '0x',
126
132
  extensionID: params.extensionID ?? zeroBytes32(),
@@ -132,7 +138,7 @@ function buildNewTokenV7PermitParams(params) {
132
138
  antiFarmerDuration: 0n,
133
139
  commissionReceiver: ZeroAddress,
134
140
  tokenVersion: TokenVersion.TOKEN_V3_PERMIT,
135
- feeConfigs: [marketingFeeConfig, emptyFeeConfig, emptyFeeConfig, emptyFeeConfig],
141
+ feeConfigs: [dividendFeeConfig, emptyFeeConfig, emptyFeeConfig, emptyFeeConfig],
136
142
  };
137
143
  }
138
144
  export async function populateCreateTokenTransaction(params) {
@@ -197,7 +203,7 @@ export async function populateCreateTokenTransaction(params) {
197
203
  sellTaxRate,
198
204
  }, { mktBps: 10000, deflationBps: 0, dividendBps: 0, lpBps: 0 }));
199
205
  }
200
- // 3) 标准 V3 / TOKEN_V3_PERMIT(newTokenV7 — 与 Flap 官网 / Portal v5.8.6+ 一致;V4 已 FeatureDisabled)
206
+ // 3) 标准 V3 / TOKEN_V3_PERMIT(newTokenV7 — 对齐官网 live 单槽 DIVIDEND;V4 已 FeatureDisabled)
201
207
  if (resolveUseV7Portal(params)) {
202
208
  return params.originalPortal.newTokenV7.populateTransaction(buildNewTokenV7PermitParams(params));
203
209
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ import { Contract, Interface, Wallet, ZeroAddress } from 'ethers';
2
+ import { describe, expect, it } from 'vitest';
3
+ import { FLAP_PORTAL_ABI } from '../../abis/flap/portal-merkle.js';
4
+ import { ZERO_ADDRESS } from '../../core/constants/index.js';
5
+ import { FeeType, MigratorType, TokenVersion } from './portal.js';
6
+ import { populateCreateTokenTransaction } from './portal-create-token.js';
7
+ describe('populateCreateTokenTransaction V7 tax-free', () => {
8
+ it('uses DIVIDEND 10000 bps like flap.sh, not MARKETING_OR_VAULT', async () => {
9
+ const wallet = Wallet.createRandom();
10
+ const portal = new Contract(ZeroAddress, FLAP_PORTAL_ABI, wallet);
11
+ const tx = await populateCreateTokenTransaction({
12
+ chain: 'BSC',
13
+ devWallet: wallet,
14
+ originalPortal: portal,
15
+ tokenInfo: { name: 'zzz', symbol: 'zzz', meta: 'cid' },
16
+ beneficiary: wallet.address,
17
+ useV7Portal: true,
18
+ });
19
+ const parsed = new Interface(FLAP_PORTAL_ABI).parseTransaction({ data: tx.data });
20
+ expect(parsed?.name).toBe('newTokenV7');
21
+ const p = parsed.args[0];
22
+ expect(Number(p[5])).toBe(MigratorType.PCS_INFINITY_CL_MIGRATOR);
23
+ expect(Number(p[17])).toBe(TokenVersion.TOKEN_V3_PERMIT);
24
+ expect(p[16]).toBe(ZERO_ADDRESS);
25
+ const fee0 = p[18][0];
26
+ expect(Number(fee0[0])).toBe(FeeType.DIVIDEND);
27
+ expect(Number(fee0[1])).toBe(10000);
28
+ expect(fee0[2]).toBe(ZERO_ADDRESS);
29
+ expect(fee0[3]).toBe(ZERO_ADDRESS);
30
+ expect(fee0[4]).toBe(10000n * 10n ** 18n);
31
+ });
32
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "4.3.5",
3
+ "version": "4.3.6",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",