four-flap-meme-sdk 4.0.2 → 4.0.4
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/abis/openfour.d.ts +94 -0
- package/dist/abis/openfour.js +63 -0
- package/dist/bundle/four-meme/core/constants.js +1 -0
- package/dist/bundle/four-meme/core/create-openfour.d.ts +23 -0
- package/dist/bundle/four-meme/core/create-openfour.js +118 -0
- package/dist/bundle/four-meme/core/create-token-quote.d.ts +24 -0
- package/dist/bundle/four-meme/core/create-token-quote.js +53 -0
- package/dist/bundle/four-meme/core/create-token.js +28 -39
- package/dist/bundle/four-meme/core/index.d.ts +2 -0
- package/dist/bundle/four-meme/core/index.js +1 -0
- package/dist/bundle/four-meme/private/buy-quote.d.ts +35 -0
- package/dist/bundle/four-meme/private/buy-quote.js +70 -0
- package/dist/bundle/four-meme/private/buy.js +82 -87
- package/dist/bundle/four-meme/private/index.d.ts +2 -0
- package/dist/bundle/four-meme/private/index.js +1 -0
- package/dist/bundle/four-meme/private/openfour-buy.d.ts +10 -0
- package/dist/bundle/four-meme/private/openfour-buy.js +65 -0
- package/dist/bundle/four-meme/types/index.d.ts +13 -0
- package/dist/chains/bsc/constants.d.ts +1 -0
- package/dist/core/clients/four.d.ts +25 -17
- package/dist/core/clients/four.js +128 -3
- package/dist/core/clients/index.d.ts +1 -1
- package/dist/core/clients/index.js +1 -1
- package/dist/core/constants/addresses.d.ts +2 -0
- package/dist/core/constants/addresses.js +2 -0
- package/dist/domains/flows/create.d.ts +1 -0
- package/dist/domains/flows/create.js +13 -12
- package/dist/domains/four/contracts/tm-bundle-create.js +42 -11
- package/dist/domains/four/contracts/tm-bundle-helpers.d.ts +6 -0
- package/dist/domains/four/index.d.ts +1 -0
- package/dist/domains/four/index.js +1 -0
- package/dist/domains/four/raised-token.d.ts +38 -0
- package/dist/domains/four/raised-token.js +75 -0
- package/dist/domains/four/raised-token.test.d.ts +1 -0
- package/dist/domains/four/raised-token.test.js +43 -0
- package/dist/domains/four/tax-token.d.ts +2 -0
- package/dist/domains/four/tax-token.js +13 -4
- package/dist/domains/four/tax-token.test.d.ts +1 -0
- package/dist/domains/four/tax-token.test.js +89 -0
- package/dist/domains/openfour/create-arg.d.ts +13 -0
- package/dist/domains/openfour/create-arg.js +78 -0
- package/dist/domains/openfour/index.d.ts +4 -0
- package/dist/domains/openfour/index.js +3 -0
- package/dist/domains/openfour/registry.d.ts +4 -0
- package/dist/domains/openfour/registry.js +44 -0
- package/dist/domains/openfour/schema.d.ts +20 -0
- package/dist/domains/openfour/schema.js +88 -0
- package/dist/domains/openfour/types.d.ts +76 -0
- package/dist/domains/openfour/types.js +1 -0
- package/dist/exports/root-bundle-and-tooling.d.ts +4 -2
- package/dist/exports/root-bundle-and-tooling.js +2 -2
- package/dist/exports/root-foundations.d.ts +3 -1
- package/dist/exports/root-foundations.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { parseEther } from 'ethers';
|
|
3
|
+
import { validateFourTokenTaxInfo } from './tax-token.js';
|
|
4
|
+
import { computeOpenFourCreateValueWei, encodeOpenFourModuleParams, isOpenFourPresaleNative, } from '../openfour/index.js';
|
|
5
|
+
describe('validateFourTokenTaxInfo TaxToken9', () => {
|
|
6
|
+
it('four-way sum still 100 without charity fields', () => {
|
|
7
|
+
expect(validateFourTokenTaxInfo({
|
|
8
|
+
feeRate: 5,
|
|
9
|
+
burnRate: 20,
|
|
10
|
+
divideRate: 30,
|
|
11
|
+
liquidityRate: 40,
|
|
12
|
+
recipientRate: 10,
|
|
13
|
+
minSharing: 100000,
|
|
14
|
+
}).valid).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
it('includes charity rates in the 100 sum', () => {
|
|
17
|
+
expect(validateFourTokenTaxInfo({
|
|
18
|
+
feeRate: 5,
|
|
19
|
+
burnRate: 20,
|
|
20
|
+
divideRate: 20,
|
|
21
|
+
liquidityRate: 40,
|
|
22
|
+
recipientRate: 10,
|
|
23
|
+
giggleCharityRate: 5,
|
|
24
|
+
binanceCharityRate: 5,
|
|
25
|
+
minSharing: 100000,
|
|
26
|
+
}).valid).toBe(true);
|
|
27
|
+
});
|
|
28
|
+
it('rejects six-way sum not 100', () => {
|
|
29
|
+
const r = validateFourTokenTaxInfo({
|
|
30
|
+
feeRate: 5,
|
|
31
|
+
burnRate: 20,
|
|
32
|
+
divideRate: 30,
|
|
33
|
+
liquidityRate: 40,
|
|
34
|
+
recipientRate: 10,
|
|
35
|
+
giggleCharityRate: 5,
|
|
36
|
+
binanceCharityRate: 0,
|
|
37
|
+
minSharing: 100000,
|
|
38
|
+
});
|
|
39
|
+
expect(r.valid).toBe(false);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
describe('OpenFour schema encode', () => {
|
|
43
|
+
it('empty schema encodes to 0x', () => {
|
|
44
|
+
const schema = { kind: 'token', version: 1, params: [] };
|
|
45
|
+
expect(encodeOpenFourModuleParams(schema, {})).toBe('0x');
|
|
46
|
+
});
|
|
47
|
+
it('encodes a uint tuple', () => {
|
|
48
|
+
const schema = {
|
|
49
|
+
kind: 'token',
|
|
50
|
+
version: 1,
|
|
51
|
+
params: [
|
|
52
|
+
{
|
|
53
|
+
name: 'buyFeeRate',
|
|
54
|
+
abiType: 'uint16',
|
|
55
|
+
decimals: 0,
|
|
56
|
+
optional: false,
|
|
57
|
+
title: 'buy',
|
|
58
|
+
defaultValue: '100',
|
|
59
|
+
hint: '',
|
|
60
|
+
minValue: '',
|
|
61
|
+
maxValue: '',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
expect(encodeOpenFourModuleParams(schema, { buyFeeRate: '100' })).toMatch(/^0x/);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
describe('OpenFour create value', () => {
|
|
69
|
+
const wbnb = '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c';
|
|
70
|
+
const usdt = '0x55d398326f99059fF775485246999027B3197955';
|
|
71
|
+
it('BNB quote adds presale into msg.value', () => {
|
|
72
|
+
const decoded = {
|
|
73
|
+
createFee: parseEther('0.01'),
|
|
74
|
+
presaleQuote: parseEther('0.2'),
|
|
75
|
+
quoteAsset: wbnb,
|
|
76
|
+
};
|
|
77
|
+
expect(isOpenFourPresaleNative({ ...decoded, wrappedNative: wbnb })).toBe(true);
|
|
78
|
+
expect(computeOpenFourCreateValueWei(decoded, wbnb)).toBe(parseEther('0.21'));
|
|
79
|
+
});
|
|
80
|
+
it('ERC20 quote pays createFee only', () => {
|
|
81
|
+
const decoded = {
|
|
82
|
+
createFee: parseEther('0.01'),
|
|
83
|
+
presaleQuote: parseEther('100'),
|
|
84
|
+
quoteAsset: usdt,
|
|
85
|
+
};
|
|
86
|
+
expect(isOpenFourPresaleNative({ ...decoded, wrappedNative: wbnb })).toBe(false);
|
|
87
|
+
expect(computeOpenFourCreateValueWei(decoded, wbnb)).toBe(parseEther('0.01'));
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type OpenFourDecodedCreateArg = {
|
|
2
|
+
createFee: bigint;
|
|
3
|
+
presaleQuote: bigint;
|
|
4
|
+
quoteAsset: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function decodeOpenFourCreateArg(rawCreateArg: string): OpenFourDecodedCreateArg;
|
|
7
|
+
export declare function isOpenFourPresaleNative(params: {
|
|
8
|
+
presaleQuote: bigint;
|
|
9
|
+
quoteAsset: string;
|
|
10
|
+
wrappedNative: string;
|
|
11
|
+
}): boolean;
|
|
12
|
+
/** OpenFourCore.createToken 的 msg.value:createFee 始终付 BNB;预购仅在 quote=WBNB 时加进 value */
|
|
13
|
+
export declare function computeOpenFourCreateValueWei(decoded: OpenFourDecodedCreateArg, wrappedNative: string): bigint;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { AbiCoder, ParamType } from 'ethers';
|
|
2
|
+
const INIT_PARAMS_14 = [
|
|
3
|
+
{ name: 'name', type: 'string' },
|
|
4
|
+
{ name: 'symbol', type: 'string' },
|
|
5
|
+
{ name: 'tokenUri', type: 'string' },
|
|
6
|
+
{ name: 'maxSupply', type: 'uint256' },
|
|
7
|
+
{ name: 'saleAmount', type: 'uint256' },
|
|
8
|
+
{ name: 'raiseAmount', type: 'uint256' },
|
|
9
|
+
{ name: 'quoteAsset', type: 'address' },
|
|
10
|
+
{ name: 'tokenSalt', type: 'bytes32' },
|
|
11
|
+
{ name: 'tokenParams', type: 'bytes' },
|
|
12
|
+
{ name: 'vaultParams', type: 'bytes' },
|
|
13
|
+
{ name: 'curveParams', type: 'bytes' },
|
|
14
|
+
{ name: 'tradeParams', type: 'bytes' },
|
|
15
|
+
{ name: 'migrateParams', type: 'bytes' },
|
|
16
|
+
{ name: 'customDataParams', type: 'bytes' },
|
|
17
|
+
];
|
|
18
|
+
const INIT_PARAMS_13 = INIT_PARAMS_14.slice(0, 13);
|
|
19
|
+
const OUTER = [
|
|
20
|
+
{ name: 'requestId', type: 'uint256' },
|
|
21
|
+
{ name: 'presetId', type: 'uint256' },
|
|
22
|
+
{ name: 'validTimestamp', type: 'uint256' },
|
|
23
|
+
{ name: 'createFee', type: 'uint256' },
|
|
24
|
+
{ name: 'presaleQuote', type: 'uint256' },
|
|
25
|
+
{ name: 'antiSniperEnabled', type: 'bool' },
|
|
26
|
+
];
|
|
27
|
+
const ABI_14 = [
|
|
28
|
+
ParamType.from({
|
|
29
|
+
type: 'tuple',
|
|
30
|
+
components: [...OUTER, { name: 'initParams', type: 'tuple', components: INIT_PARAMS_14 }],
|
|
31
|
+
}),
|
|
32
|
+
];
|
|
33
|
+
const ABI_13 = [
|
|
34
|
+
ParamType.from({
|
|
35
|
+
type: 'tuple',
|
|
36
|
+
components: [
|
|
37
|
+
...OUTER,
|
|
38
|
+
{ name: 'initParams', type: 'tuple', components: INIT_PARAMS_13 },
|
|
39
|
+
],
|
|
40
|
+
}),
|
|
41
|
+
];
|
|
42
|
+
const coder = AbiCoder.defaultAbiCoder();
|
|
43
|
+
function toBigInt(value) {
|
|
44
|
+
if (value == null)
|
|
45
|
+
return 0n;
|
|
46
|
+
if (typeof value === 'bigint')
|
|
47
|
+
return value;
|
|
48
|
+
return BigInt(String(value));
|
|
49
|
+
}
|
|
50
|
+
export function decodeOpenFourCreateArg(rawCreateArg) {
|
|
51
|
+
let decoded;
|
|
52
|
+
try {
|
|
53
|
+
[decoded] = coder.decode(ABI_14, rawCreateArg);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
[decoded] = coder.decode(ABI_13, rawCreateArg);
|
|
57
|
+
}
|
|
58
|
+
const row = decoded;
|
|
59
|
+
return {
|
|
60
|
+
createFee: toBigInt(row.createFee),
|
|
61
|
+
presaleQuote: toBigInt(row.presaleQuote),
|
|
62
|
+
quoteAsset: String(row.initParams?.quoteAsset ?? ''),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function isOpenFourPresaleNative(params) {
|
|
66
|
+
if (params.presaleQuote <= 0n)
|
|
67
|
+
return false;
|
|
68
|
+
const q = params.quoteAsset.toLowerCase();
|
|
69
|
+
const w = params.wrappedNative.toLowerCase();
|
|
70
|
+
return Boolean(q && w && q === w);
|
|
71
|
+
}
|
|
72
|
+
/** OpenFourCore.createToken 的 msg.value:createFee 始终付 BNB;预购仅在 quote=WBNB 时加进 value */
|
|
73
|
+
export function computeOpenFourCreateValueWei(decoded, wrappedNative) {
|
|
74
|
+
if (isOpenFourPresaleNative({ ...decoded, wrappedNative })) {
|
|
75
|
+
return decoded.createFee + decoded.presaleQuote;
|
|
76
|
+
}
|
|
77
|
+
return decoded.createFee;
|
|
78
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { OpenFourAddresses, OpenFourCreateReq, OpenFourInitParams, OpenFourModuleSchema, OpenFourParamDescriptor, OpenFourPresetSchemas, OpenFourTemplate, OpenFourTemplateConfig, } from './types.js';
|
|
2
|
+
export { collectOpenFourSchemaParams, defaultOpenFourFormFromSchema, emptyOpenFourInitParams, encodeOpenFourInitParams, encodeOpenFourModuleParams, } from './schema.js';
|
|
3
|
+
export { computeOpenFourCreateValueWei, decodeOpenFourCreateArg, isOpenFourPresaleNative, type OpenFourDecodedCreateArg, } from './create-arg.js';
|
|
4
|
+
export { loadOpenFourAddresses, loadOpenFourPresetSchemas } from './registry.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { collectOpenFourSchemaParams, defaultOpenFourFormFromSchema, emptyOpenFourInitParams, encodeOpenFourInitParams, encodeOpenFourModuleParams, } from './schema.js';
|
|
2
|
+
export { computeOpenFourCreateValueWei, decodeOpenFourCreateArg, isOpenFourPresaleNative, } from './create-arg.js';
|
|
3
|
+
export { loadOpenFourAddresses, loadOpenFourPresetSchemas } from './registry.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Provider } from 'ethers';
|
|
2
|
+
import type { OpenFourAddresses, OpenFourPresetSchemas } from './types.js';
|
|
3
|
+
export declare function loadOpenFourAddresses(provider: Provider, registryAddress?: string): Promise<OpenFourAddresses>;
|
|
4
|
+
export declare function loadOpenFourPresetSchemas(provider: Provider, presetId: number | string, toolsAddress?: string): Promise<OpenFourPresetSchemas>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Contract } from 'ethers';
|
|
2
|
+
import { ADDRESSES } from '../../core/constants/index.js';
|
|
3
|
+
import { OPENFOUR_CORE_ABI, OPENFOUR_REGISTRY_ABI, OPENFOUR_TOOLS_ABI } from '../../abis/openfour.js';
|
|
4
|
+
function mapParam(raw) {
|
|
5
|
+
return {
|
|
6
|
+
name: raw.name,
|
|
7
|
+
abiType: raw.abiType,
|
|
8
|
+
decimals: Number(raw.decimals),
|
|
9
|
+
optional: raw.optional,
|
|
10
|
+
title: raw.title,
|
|
11
|
+
defaultValue: raw.defaultValue,
|
|
12
|
+
hint: raw.hint,
|
|
13
|
+
minValue: raw.minValue,
|
|
14
|
+
maxValue: raw.maxValue,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function mapSchema(raw) {
|
|
18
|
+
return {
|
|
19
|
+
kind: raw.kind,
|
|
20
|
+
version: Number(raw.version),
|
|
21
|
+
params: (raw.params ?? []).map(mapParam),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export async function loadOpenFourAddresses(provider, registryAddress) {
|
|
25
|
+
const registry = registryAddress || ADDRESSES.BSC.OpenFourRegistry;
|
|
26
|
+
const reg = new Contract(registry, OPENFOUR_REGISTRY_ABI, provider);
|
|
27
|
+
const [core, tools] = await Promise.all([reg.openFourCore(), reg.openFourTool()]);
|
|
28
|
+
const coreC = new Contract(core, OPENFOUR_CORE_ABI, provider);
|
|
29
|
+
const wrappedNative = (await coreC.wrappedNative());
|
|
30
|
+
return { registry, core: core, tools: tools, wrappedNative };
|
|
31
|
+
}
|
|
32
|
+
export async function loadOpenFourPresetSchemas(provider, presetId, toolsAddress) {
|
|
33
|
+
const toolsAddr = toolsAddress ?? (await loadOpenFourAddresses(provider)).tools;
|
|
34
|
+
const tools = new Contract(toolsAddr, OPENFOUR_TOOLS_ABI, provider);
|
|
35
|
+
const raw = await tools.getPresetEncodeSchemas(BigInt(presetId));
|
|
36
|
+
return {
|
|
37
|
+
token: mapSchema(raw.tokenSchema ?? raw[0]),
|
|
38
|
+
vault: mapSchema(raw.vaultSchema ?? raw[1]),
|
|
39
|
+
curve: mapSchema(raw.curveSchema ?? raw[2]),
|
|
40
|
+
trade: mapSchema(raw.tradeSchema ?? raw[3]),
|
|
41
|
+
migrate: mapSchema(raw.migrateSchema ?? raw[4]),
|
|
42
|
+
customData: mapSchema(raw.customDataSchema ?? raw[5]),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { OpenFourInitParams, OpenFourModuleSchema, OpenFourParamDescriptor } from './types.js';
|
|
2
|
+
export declare function emptyOpenFourInitParams(): OpenFourInitParams;
|
|
3
|
+
export declare function encodeOpenFourModuleParams(schema: OpenFourModuleSchema, form: Record<string, unknown>): string;
|
|
4
|
+
export declare function defaultOpenFourFormFromSchema(params: OpenFourParamDescriptor[]): Record<string, string>;
|
|
5
|
+
export declare function encodeOpenFourInitParams(schemas: {
|
|
6
|
+
token: OpenFourModuleSchema;
|
|
7
|
+
vault: OpenFourModuleSchema;
|
|
8
|
+
curve: OpenFourModuleSchema;
|
|
9
|
+
trade: OpenFourModuleSchema;
|
|
10
|
+
migrate: OpenFourModuleSchema;
|
|
11
|
+
customData: OpenFourModuleSchema;
|
|
12
|
+
}, form: Record<string, unknown>): OpenFourInitParams;
|
|
13
|
+
export declare function collectOpenFourSchemaParams(schemas: {
|
|
14
|
+
token: OpenFourModuleSchema;
|
|
15
|
+
vault: OpenFourModuleSchema;
|
|
16
|
+
curve: OpenFourModuleSchema;
|
|
17
|
+
trade: OpenFourModuleSchema;
|
|
18
|
+
migrate: OpenFourModuleSchema;
|
|
19
|
+
customData: OpenFourModuleSchema;
|
|
20
|
+
}): OpenFourParamDescriptor[];
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { AbiCoder, ZeroAddress, ZeroHash, parseUnits } from 'ethers';
|
|
2
|
+
const coder = AbiCoder.defaultAbiCoder();
|
|
3
|
+
export function emptyOpenFourInitParams() {
|
|
4
|
+
return {
|
|
5
|
+
tokenParams: '0x',
|
|
6
|
+
vaultParams: '0x',
|
|
7
|
+
curveParams: '0x',
|
|
8
|
+
tradeParams: '0x',
|
|
9
|
+
migrateParams: '0x',
|
|
10
|
+
customDataParams: '0x',
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function zeroValue(abiType) {
|
|
14
|
+
if (abiType === 'address')
|
|
15
|
+
return ZeroAddress;
|
|
16
|
+
if (abiType === 'bool')
|
|
17
|
+
return false;
|
|
18
|
+
if (abiType === 'string')
|
|
19
|
+
return '';
|
|
20
|
+
if (abiType === 'bytes')
|
|
21
|
+
return '0x';
|
|
22
|
+
if (abiType === 'bytes32')
|
|
23
|
+
return ZeroHash;
|
|
24
|
+
return 0n;
|
|
25
|
+
}
|
|
26
|
+
function resolveParam(desc, form) {
|
|
27
|
+
const raw = form[desc.name];
|
|
28
|
+
const str = String(raw ?? '').trim();
|
|
29
|
+
const missing = raw == null || str === '';
|
|
30
|
+
if (missing) {
|
|
31
|
+
if (desc.optional)
|
|
32
|
+
return zeroValue(desc.abiType);
|
|
33
|
+
throw new Error(`OpenFour schema: required param "${desc.name}" is missing`);
|
|
34
|
+
}
|
|
35
|
+
switch (desc.abiType) {
|
|
36
|
+
case 'bool':
|
|
37
|
+
if (typeof raw === 'boolean')
|
|
38
|
+
return raw;
|
|
39
|
+
return str === 'true' || str === '1';
|
|
40
|
+
case 'address':
|
|
41
|
+
return str || ZeroAddress;
|
|
42
|
+
case 'string':
|
|
43
|
+
return str;
|
|
44
|
+
case 'bytes32':
|
|
45
|
+
return str || ZeroHash;
|
|
46
|
+
case 'bytes':
|
|
47
|
+
return str || '0x';
|
|
48
|
+
default:
|
|
49
|
+
if (desc.decimals > 0)
|
|
50
|
+
return parseUnits(str, desc.decimals);
|
|
51
|
+
return BigInt(str);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export function encodeOpenFourModuleParams(schema, form) {
|
|
55
|
+
if (!schema.params.length)
|
|
56
|
+
return '0x';
|
|
57
|
+
const types = schema.params.map((p) => p.abiType);
|
|
58
|
+
const values = schema.params.map((p) => resolveParam(p, form));
|
|
59
|
+
return coder.encode([`(${types.join(',')})`], [values]);
|
|
60
|
+
}
|
|
61
|
+
export function defaultOpenFourFormFromSchema(params) {
|
|
62
|
+
const out = {};
|
|
63
|
+
for (const p of params) {
|
|
64
|
+
if (p.defaultValue !== '')
|
|
65
|
+
out[p.name] = p.defaultValue;
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
export function encodeOpenFourInitParams(schemas, form) {
|
|
70
|
+
return {
|
|
71
|
+
tokenParams: encodeOpenFourModuleParams(schemas.token, form),
|
|
72
|
+
vaultParams: encodeOpenFourModuleParams(schemas.vault, form),
|
|
73
|
+
curveParams: encodeOpenFourModuleParams(schemas.curve, form),
|
|
74
|
+
tradeParams: encodeOpenFourModuleParams(schemas.trade, form),
|
|
75
|
+
migrateParams: encodeOpenFourModuleParams(schemas.migrate, form),
|
|
76
|
+
customDataParams: encodeOpenFourModuleParams(schemas.customData, form),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export function collectOpenFourSchemaParams(schemas) {
|
|
80
|
+
return [
|
|
81
|
+
...schemas.token.params,
|
|
82
|
+
...schemas.vault.params,
|
|
83
|
+
...schemas.curve.params,
|
|
84
|
+
...schemas.trade.params,
|
|
85
|
+
...schemas.migrate.params,
|
|
86
|
+
...schemas.customData.params,
|
|
87
|
+
];
|
|
88
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export type OpenFourParamDescriptor = {
|
|
2
|
+
name: string;
|
|
3
|
+
abiType: string;
|
|
4
|
+
decimals: number;
|
|
5
|
+
optional: boolean;
|
|
6
|
+
title: string;
|
|
7
|
+
defaultValue: string;
|
|
8
|
+
hint: string;
|
|
9
|
+
minValue: string;
|
|
10
|
+
maxValue: string;
|
|
11
|
+
};
|
|
12
|
+
export type OpenFourModuleSchema = {
|
|
13
|
+
kind: string;
|
|
14
|
+
version: number;
|
|
15
|
+
params: OpenFourParamDescriptor[];
|
|
16
|
+
};
|
|
17
|
+
export type OpenFourPresetSchemas = {
|
|
18
|
+
token: OpenFourModuleSchema;
|
|
19
|
+
vault: OpenFourModuleSchema;
|
|
20
|
+
curve: OpenFourModuleSchema;
|
|
21
|
+
trade: OpenFourModuleSchema;
|
|
22
|
+
migrate: OpenFourModuleSchema;
|
|
23
|
+
customData: OpenFourModuleSchema;
|
|
24
|
+
};
|
|
25
|
+
export type OpenFourInitParams = {
|
|
26
|
+
tokenParams: string;
|
|
27
|
+
vaultParams: string;
|
|
28
|
+
curveParams: string;
|
|
29
|
+
tradeParams: string;
|
|
30
|
+
migrateParams: string;
|
|
31
|
+
customDataParams: string;
|
|
32
|
+
};
|
|
33
|
+
export type OpenFourTemplate = {
|
|
34
|
+
id: number | string;
|
|
35
|
+
name: string;
|
|
36
|
+
tag: string;
|
|
37
|
+
descr: string;
|
|
38
|
+
status: string;
|
|
39
|
+
amount: string;
|
|
40
|
+
imgUrl: string;
|
|
41
|
+
deploys: number;
|
|
42
|
+
};
|
|
43
|
+
export type OpenFourTemplateConfig = {
|
|
44
|
+
id: number;
|
|
45
|
+
symbol: string;
|
|
46
|
+
symbolAddress: string;
|
|
47
|
+
totalSupply: string;
|
|
48
|
+
saleAmount: string;
|
|
49
|
+
raisedAmount: string;
|
|
50
|
+
createFee: string;
|
|
51
|
+
decimals: number;
|
|
52
|
+
fullName?: string;
|
|
53
|
+
};
|
|
54
|
+
export type OpenFourCreateReq = {
|
|
55
|
+
templateId: number | string;
|
|
56
|
+
name: string;
|
|
57
|
+
shortName: string;
|
|
58
|
+
symbol: string;
|
|
59
|
+
desc: string;
|
|
60
|
+
imgUrl: string;
|
|
61
|
+
webUrl?: string;
|
|
62
|
+
telegramUrl?: string;
|
|
63
|
+
twitterUrl?: string;
|
|
64
|
+
presaleQuote: string | number;
|
|
65
|
+
feePlan: boolean;
|
|
66
|
+
initParams: OpenFourInitParams;
|
|
67
|
+
saleAmount?: string;
|
|
68
|
+
totalSupply?: string;
|
|
69
|
+
raisedAmount?: string;
|
|
70
|
+
};
|
|
71
|
+
export type OpenFourAddresses = {
|
|
72
|
+
registry: string;
|
|
73
|
+
core: string;
|
|
74
|
+
tools: string;
|
|
75
|
+
wrappedNative: string;
|
|
76
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -13,8 +13,8 @@ export { createTokenWithBundleBuy as flapCreateTokenWithBundleBuy, batchBuyWithB
|
|
|
13
13
|
export { fourPrivateBuy, fourPrivateSell, fourBatchPrivateBuy, fourBatchPrivateSell, type FourPrivateBuyParams, type FourPrivateSellParams, type FourBatchPrivateBuyParams, type FourBatchPrivateSellParams, } from '../domains/four/contracts/tm-bundle.js';
|
|
14
14
|
export { flapPrivateBuy, flapPrivateSell, flapBatchPrivateBuy, flapBatchPrivateSell, type FlapPrivateBuyParams, type FlapPrivateSellParams, type FlapBatchPrivateBuyParams, type FlapBatchPrivateSellParams, type FlapBatchPrivateSellResult, } from '../domains/flap/portal-bundle.js';
|
|
15
15
|
export { createTokenWithBundleBuyMerkle as flapCreateTokenWithBundleBuyMerkle, batchBuyWithBundleMerkle as flapBatchBuyWithBundleMerkle, batchSellWithBundleMerkle as flapBatchSellWithBundleMerkle, flapPrivateBuyMerkle, flapPrivateSellMerkle, flapBatchPrivateBuyMerkle, flapBatchPrivateSellMerkle, pancakeProxyBatchBuyMerkle, pancakeProxyBatchSellMerkle, approvePancakeProxy, approvePancakeProxyBatch, flapDisperseWithBundleMerkle, flapSweepWithBundleMerkle, type FlapBundleMerkleConfig, type FlapSignConfig, type FlapProfitMode, type FlapChainForMerkleBundle, type FlapCreateWithBundleBuySignParams, type FlapCreateWithBundleBuyMerkleParams, type FlapCreateWithBundleBuyMerkleResult, type FlapBatchBuySignParams, type FlapBatchBuyMerkleParams, type FlapBatchBuyMerkleResult, type FlapBatchSellSignParams, type FlapBatchSellMerkleParams, type FlapBatchSellMerkleResult, type MerkleTransactionStatus, type MerkleBundleStatus, type FlapPrivateBuyMerkleParams, type FlapPrivateSellMerkleParams, type FlapBatchPrivateBuyMerkleParams, type FlapBatchPrivateSellMerkleParams, type FlapBatchPrivateMerkleResult, type FlapPrivateTransactionResult, type PancakeProxyBatchBuyParams, type PancakeProxyBatchBuyResult, type PancakeProxyBatchSellParams, type PancakeProxyBatchSellResult, type PancakeProxyApprovalParams, type PancakeProxyApprovalBatchParams, type PancakeProxyApprovalBatchResult, type FlapDisperseSignParams, type FlapDisperseMerkleResult, type FlapSweepSignParams, type FlapSweepMerkleResult, } from '../domains/flap/portal-bundle-merkle/index.js';
|
|
16
|
-
export { createTokenWithBundleBuyMerkle as fourCreateTokenWithBundleBuyMerkle, batchBuyWithBundleMerkle as fourBatchBuyWithBundleMerkle, batchSellWithBundleMerkle as fourBatchSellWithBundleMerkle, } from '../bundle/four-meme/core.js';
|
|
17
|
-
export { fourPrivateBuyMerkle, fourPrivateSellMerkle, fourBatchPrivateBuyMerkle, fourBatchPrivateSellMerkle, } from '../bundle/four-meme/private.js';
|
|
16
|
+
export { createTokenWithBundleBuyMerkle as fourCreateTokenWithBundleBuyMerkle, createOpenFourTokenMerkle as fourCreateOpenFourTokenMerkle, batchBuyWithBundleMerkle as fourBatchBuyWithBundleMerkle, batchSellWithBundleMerkle as fourBatchSellWithBundleMerkle, } from '../bundle/four-meme/core.js';
|
|
17
|
+
export { fourPrivateBuyMerkle, fourPrivateSellMerkle, fourBatchPrivateBuyMerkle, fourBatchPrivateSellMerkle, openFourBatchBuyByBudgetMerkle, } from '../bundle/four-meme/private.js';
|
|
18
18
|
export { disperseWithBundleMerkle } from '../bundle/four-meme/utils-disperse.js';
|
|
19
19
|
export { sweepWithBundleMerkle } from '../bundle/four-meme/utils-sweep.js';
|
|
20
20
|
export { pairwiseTransferWithBundleMerkle } from '../bundle/four-meme/utils-pairwise.js';
|
|
@@ -22,6 +22,8 @@ export { fourPancakeProxyBatchBuyMerkle, fourPancakeProxyBatchSellMerkle, approv
|
|
|
22
22
|
export { approveFourTokenManagerBatch } from '../bundle/four-meme/approve-tokenmanager.js';
|
|
23
23
|
export { submitBundleToMerkle, submitMultipleBundles, submitMultipleBundlesParallel, submitBundleToBlockRazor, submitMultipleBundlesToBlockRazor, submitMultipleBundlesToBlockRazorParallel, type MerkleSubmitConfig, type SubmitBundleResult, type BlockRazorSubmitConfig, type BlockRazorSubmitResult, } from '../bundle/submit.js';
|
|
24
24
|
export type { FourBundleMerkleConfig, FourSignConfig, FourCreateWithBundleBuySignParams, FourBatchBuySignParams, FourBatchSellSignParams, FourPrivateBuySignParams, FourPrivateSellSignParams, FourBatchPrivateBuySignParams, FourBatchPrivateSellSignParams, FourPancakeProxyBatchBuySignParams, FourPancakeProxyBatchSellSignParams, DisperseSignParams as FourDisperseSignParams, SweepSignParams as FourSweepSignParams, FourCreateWithBundleBuyMerkleParams, FourCreateWithBundleBuyMerkleResult, FourBatchBuyMerkleParams, FourBatchBuyMerkleResult, FourBatchSellMerkleParams, FourBatchSellMerkleResult, FourPrivateBuyMerkleParams, FourPrivateSellMerkleParams, FourBatchPrivateBuyMerkleParams, FourBatchPrivateSellMerkleParams, FourBatchPrivateMerkleResult, FourPrivateTransactionResult, DisperseMerkleParams, DisperseMerkleResult, SweepMerkleParams, SweepMerkleResult, FourPancakeProxyBatchBuyParams, FourPancakeProxyBatchBuyResult, FourPancakeProxyBatchSellParams, FourPancakeProxyBatchSellResult, FourPancakeProxyApprovalParams, FourPancakeProxyApprovalBatchParams, FourPancakeProxyApprovalBatchResult, ApproveFourTokenManagerBatchParams, ApproveFourTokenManagerBatchResult, } from '../bundle/four-meme/types/index.js';
|
|
25
|
+
export type { OpenFourCreateSignParams } from '../bundle/four-meme/core.js';
|
|
26
|
+
export type { OpenFourBatchBuySignParams } from '../bundle/four-meme/private.js';
|
|
25
27
|
export { isTaxToken as fourIsTaxToken, isAntiSniperFeeMode as fourIsAntiSniperFeeMode, getCreatorType as fourGetCreatorType, getTaxTokenInfo as fourGetTaxTokenInfo, getClaimableFee as fourGetClaimableFee, getClaimedFee as fourGetClaimedFee, getUserRewardInfo as fourGetUserRewardInfo, buildClaimFeeTx as fourBuildClaimFeeTx, buildBatchClaimFeeTxs as fourBuildBatchClaimFeeTxs, validateFourTokenTaxInfo, TAX_TOKEN_ABI, TransferMode as FourTransferMode, type TaxTokenConfig as FourTaxTokenConfig, type TaxTokenRewardStats as FourTaxTokenRewardStats, type TaxTokenUserInfo as FourTaxTokenUserInfo, type TaxTokenInfo as FourTaxTokenInfo, } from '../domains/four/index.js';
|
|
26
28
|
export { PinataClient, type PinataConfig } from '../domains/flap/pinata.js';
|
|
27
29
|
export { pinFileToIPFSWithJWT, pinImageByPath, pinFileToIPFSWithJWTWeb, pinDataURLWithJWTWeb, dataURLToBlob, type PinataPinResp, } from '../domains/flap/pinata.js';
|
|
@@ -13,8 +13,8 @@ export { createTokenWithBundleBuy as flapCreateTokenWithBundleBuy, batchBuyWithB
|
|
|
13
13
|
export { fourPrivateBuy, fourPrivateSell, fourBatchPrivateBuy, fourBatchPrivateSell, } from '../domains/four/contracts/tm-bundle.js';
|
|
14
14
|
export { flapPrivateBuy, flapPrivateSell, flapBatchPrivateBuy, flapBatchPrivateSell, } from '../domains/flap/portal-bundle.js';
|
|
15
15
|
export { createTokenWithBundleBuyMerkle as flapCreateTokenWithBundleBuyMerkle, batchBuyWithBundleMerkle as flapBatchBuyWithBundleMerkle, batchSellWithBundleMerkle as flapBatchSellWithBundleMerkle, flapPrivateBuyMerkle, flapPrivateSellMerkle, flapBatchPrivateBuyMerkle, flapBatchPrivateSellMerkle, pancakeProxyBatchBuyMerkle, pancakeProxyBatchSellMerkle, approvePancakeProxy, approvePancakeProxyBatch, flapDisperseWithBundleMerkle, flapSweepWithBundleMerkle, } from '../domains/flap/portal-bundle-merkle/index.js';
|
|
16
|
-
export { createTokenWithBundleBuyMerkle as fourCreateTokenWithBundleBuyMerkle, batchBuyWithBundleMerkle as fourBatchBuyWithBundleMerkle, batchSellWithBundleMerkle as fourBatchSellWithBundleMerkle, } from '../bundle/four-meme/core.js';
|
|
17
|
-
export { fourPrivateBuyMerkle, fourPrivateSellMerkle, fourBatchPrivateBuyMerkle, fourBatchPrivateSellMerkle, } from '../bundle/four-meme/private.js';
|
|
16
|
+
export { createTokenWithBundleBuyMerkle as fourCreateTokenWithBundleBuyMerkle, createOpenFourTokenMerkle as fourCreateOpenFourTokenMerkle, batchBuyWithBundleMerkle as fourBatchBuyWithBundleMerkle, batchSellWithBundleMerkle as fourBatchSellWithBundleMerkle, } from '../bundle/four-meme/core.js';
|
|
17
|
+
export { fourPrivateBuyMerkle, fourPrivateSellMerkle, fourBatchPrivateBuyMerkle, fourBatchPrivateSellMerkle, openFourBatchBuyByBudgetMerkle, } from '../bundle/four-meme/private.js';
|
|
18
18
|
export { disperseWithBundleMerkle } from '../bundle/four-meme/utils-disperse.js';
|
|
19
19
|
export { sweepWithBundleMerkle } from '../bundle/four-meme/utils-sweep.js';
|
|
20
20
|
export { pairwiseTransferWithBundleMerkle } from '../bundle/four-meme/utils-pairwise.js';
|
|
@@ -14,7 +14,9 @@ export { isExclusiveOnChain, isExclusiveOffChain } from '../utils/mpcExclusive.j
|
|
|
14
14
|
export { ensureSellApprovalV1, checkSellApprovalV1, ensureSellApprovalV2, checkSellApprovalV2, ensureSellApproval, checkSellApproval, ensureFlapSellApproval, checkFlapSellApproval, ensureFlapSellApprovalBatch, checkFlapSellApprovalBatch, checkAllowance, approveToken, checkAllowanceBatch, approveTokenBatch, checkAllowanceRaw, approveTokenRaw, checkAllowanceBatchRaw, approveTokenBatchRaw, } from '../core/erc20/index.js';
|
|
15
15
|
export { parseFourError, type FourErrorCode } from '../utils/errors.js';
|
|
16
16
|
export { getTokenManagerV1, getTokenManagerV2, getTokenManagerHelper3, getTokenManagerV1Writer, getTokenManagerV2Writer, getTokenManagerHelper3Writer, getTokenManagerAddress, type ChainName, } from '../utils/contract-factory.js';
|
|
17
|
-
export { FourClient, buildLoginMessage, type FourConfig, type GenerateNonceReq, type LoginReq, type CreateTokenReq, type CreateTokenResp, type FourTokenTaxInfo, } from '../core/clients/four.js';
|
|
17
|
+
export { FourClient, buildLoginMessage, buildCreateTokenReq, type FourConfig, type GenerateNonceReq, type LoginReq, type CreateTokenReq, type CreateTokenCustom, type CreateTokenResp, type FourTokenTaxInfo, type FourRaisedToken, type FourTokenLabel, } from '../core/clients/four.js';
|
|
18
|
+
export { collectOpenFourSchemaParams, computeOpenFourCreateValueWei, decodeOpenFourCreateArg, defaultOpenFourFormFromSchema, emptyOpenFourInitParams, encodeOpenFourInitParams, encodeOpenFourModuleParams, isOpenFourPresaleNative, loadOpenFourAddresses, loadOpenFourPresetSchemas, type OpenFourAddresses, type OpenFourCreateReq, type OpenFourDecodedCreateArg, type OpenFourInitParams, type OpenFourModuleSchema, type OpenFourParamDescriptor, type OpenFourPresetSchemas, type OpenFourTemplate, type OpenFourTemplateConfig, } from '../domains/openfour/index.js';
|
|
19
|
+
export { FOUR_TOKEN_LABELS, FOUR_BNB_RAISED_TOKEN_FALLBACK, parseRaisedTokens, publishedRaisedTokens, pickRaisedToken, isNativeRaisedToken, computeFourCreateValueWei, raisedTokenTradingFeeBps, } from '../domains/four/raised-token.js';
|
|
18
20
|
export { createTokenOnChain, tryBuy, trySell, buyTokenWithFunds, sellToken, tradeBuy, tradeSell, type CreateOnChainParams, type TryBuyResult, type TrySellResult, } from '../domains/four/contracts/tm.js';
|
|
19
21
|
export { TM1, type FourChainV1 } from '../domains/four/contracts/tm1.js';
|
|
20
22
|
export { TM2, type FourChainV2 } from '../domains/four/contracts/tm2.js';
|
|
@@ -49,7 +49,9 @@ checkAllowance, approveToken, checkAllowanceBatch, approveTokenBatch,
|
|
|
49
49
|
checkAllowanceRaw, approveTokenRaw, checkAllowanceBatchRaw, approveTokenBatchRaw, } from '../core/erc20/index.js';
|
|
50
50
|
export { parseFourError } from '../utils/errors.js';
|
|
51
51
|
export { getTokenManagerV1, getTokenManagerV2, getTokenManagerHelper3, getTokenManagerV1Writer, getTokenManagerV2Writer, getTokenManagerHelper3Writer, getTokenManagerAddress, } from '../utils/contract-factory.js';
|
|
52
|
-
export { FourClient, buildLoginMessage, } from '../core/clients/four.js';
|
|
52
|
+
export { FourClient, buildLoginMessage, buildCreateTokenReq, } from '../core/clients/four.js';
|
|
53
|
+
export { collectOpenFourSchemaParams, computeOpenFourCreateValueWei, decodeOpenFourCreateArg, defaultOpenFourFormFromSchema, emptyOpenFourInitParams, encodeOpenFourInitParams, encodeOpenFourModuleParams, isOpenFourPresaleNative, loadOpenFourAddresses, loadOpenFourPresetSchemas, } from '../domains/openfour/index.js';
|
|
54
|
+
export { FOUR_TOKEN_LABELS, FOUR_BNB_RAISED_TOKEN_FALLBACK, parseRaisedTokens, publishedRaisedTokens, pickRaisedToken, isNativeRaisedToken, computeFourCreateValueWei, raisedTokenTradingFeeBps, } from '../domains/four/raised-token.js';
|
|
53
55
|
export { createTokenOnChain, tryBuy, trySell, buyTokenWithFunds, sellToken, tradeBuy, tradeSell, } from '../domains/four/contracts/tm.js';
|
|
54
56
|
export { TM1 } from '../domains/four/contracts/tm1.js';
|
|
55
57
|
export { TM2 } from '../domains/four/contracts/tm2.js';
|