four-flap-meme-sdk 1.9.30 → 1.9.32
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/chains/bsc/platforms/iro/pool.js +1 -0
- package/dist/chains/eni/batch-router/transfer.js +8 -4
- package/dist/chains/eni/constants.d.ts +9 -0
- package/dist/chains/eni/constants.js +4 -0
- package/dist/chains/eni/index.d.ts +2 -0
- package/dist/chains/eni/index.js +4 -0
- package/dist/chains/eni/platforms/daoaas/create.js +3 -2
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +13 -7
- package/dist/chains/eni/platforms/dswap/liquidity.js +4 -2
- package/dist/chains/eni/platforms/fair-launch/launcher.js +5 -3
- package/dist/chains/eni/platforms/fair-launch/pool.js +7 -5
- package/dist/chains/eni/platforms/index.d.ts +1 -0
- package/dist/chains/eni/platforms/index.js +2 -0
- package/dist/chains/eni/platforms/iro/api.d.ts +37 -0
- package/dist/chains/eni/platforms/iro/api.js +64 -0
- package/dist/chains/eni/platforms/iro/constants.d.ts +24 -0
- package/dist/chains/eni/platforms/iro/constants.js +87 -0
- package/dist/chains/eni/platforms/iro/factory.d.ts +36 -0
- package/dist/chains/eni/platforms/iro/factory.js +116 -0
- package/dist/chains/eni/platforms/iro/index.d.ts +16 -0
- package/dist/chains/eni/platforms/iro/index.js +28 -0
- package/dist/chains/eni/platforms/iro/pool.d.ts +43 -0
- package/dist/chains/eni/platforms/iro/pool.js +94 -0
- package/dist/chains/eni/platforms/iro/token.d.ts +69 -0
- package/dist/chains/eni/platforms/iro/token.js +164 -0
- package/dist/chains/eni/platforms/iro/types.d.ts +113 -0
- package/dist/chains/eni/platforms/iro/types.js +6 -0
- package/dist/dex/direct-router.d.ts +6 -9
- package/dist/dex/direct-router.js +4 -10
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/shared/constants/addresses.d.ts +7 -9
- package/dist/shared/constants/addresses.js +10 -14
- package/dist/shared/flap/portal-bundle-merkle/create-to-dex.js +2 -8
- package/dist/shared/flap/vault.d.ts +0 -1
- package/dist/shared/flap/vault.js +0 -1
- package/dist/utils/lp-inspect.d.ts +1 -1
- package/dist/utils/lp-inspect.js +9 -18
- package/package.json +1 -1
|
@@ -113,12 +113,13 @@ export async function eniDisperseForSubmit(params) {
|
|
|
113
113
|
const decimals = params.tokenDecimals ?? 18;
|
|
114
114
|
const isNative = !tokenAddress || tokenAddress === ethers.ZeroAddress;
|
|
115
115
|
const amountsWei = params.amounts.map(a => ethers.parseUnits(a, decimals));
|
|
116
|
-
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, recipients.length);
|
|
117
116
|
const provider = new JsonRpcProvider(rpcUrl, ENI_CHAIN_ID, { staticNetwork: true });
|
|
118
117
|
const mainWallet = new Wallet(fromPrivateKey, provider);
|
|
119
118
|
const feeData = await provider.getFeeData();
|
|
120
119
|
const maxFeePerGas = feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
121
120
|
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
121
|
+
const profitTxGasCost = GAS_LIMITS.NATIVE_TRANSFER * maxFeePerGas;
|
|
122
|
+
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, recipients.length) + profitTxGasCost;
|
|
122
123
|
const erc20GasLimit = params.gasLimit ? BigInt(params.gasLimit) : DEFAULT_GAS_PER_SWEEP;
|
|
123
124
|
if (hopCount > 0) {
|
|
124
125
|
return eniDisperseWithHops({
|
|
@@ -387,7 +388,8 @@ export async function eniSweepForSubmit(params) {
|
|
|
387
388
|
const result = await batchSweepEgas({ rpcUrl, privateKeys: validKeys, amounts: validAmounts, target });
|
|
388
389
|
const signedTxs = result.transactions.map(tx => tx.signedTx);
|
|
389
390
|
if (targetPrivateKey) {
|
|
390
|
-
const
|
|
391
|
+
const profitTxGasCost = GAS_LIMITS.NATIVE_TRANSFER * maxFeePerGas;
|
|
392
|
+
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, validKeys.length) + profitTxGasCost;
|
|
391
393
|
const targetWallet = new Wallet(targetPrivateKey, provider);
|
|
392
394
|
const targetNonce = await targetWallet.getNonce();
|
|
393
395
|
const profitTx = await targetWallet.signTransaction({
|
|
@@ -446,7 +448,8 @@ export async function eniSweepForSubmit(params) {
|
|
|
446
448
|
const result = await batchSweepToken({ rpcUrl, token: tokenAddress, privateKeys: validKeys, amounts: validAmounts, target, gasLimit: erc20GasLimit });
|
|
447
449
|
const signedTxs = result.transactions.map(tx => tx.signedTx);
|
|
448
450
|
if (targetPrivateKey) {
|
|
449
|
-
const
|
|
451
|
+
const profitTxGasCost = GAS_LIMITS.NATIVE_TRANSFER * maxFeePerGas;
|
|
452
|
+
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, validKeys.length) + profitTxGasCost;
|
|
450
453
|
const targetWallet = new Wallet(targetPrivateKey, provider);
|
|
451
454
|
const targetNonce = await targetWallet.getNonce();
|
|
452
455
|
const profitTx = await targetWallet.signTransaction({
|
|
@@ -604,7 +607,8 @@ async function eniSweepWithHops(params) {
|
|
|
604
607
|
}
|
|
605
608
|
const signedTxs = await Promise.all(txsToSign.map(({ wallet, tx }) => wallet.signTransaction(tx)));
|
|
606
609
|
if (targetPrivateKey) {
|
|
607
|
-
const
|
|
610
|
+
const profitTxGasCost = GAS_LIMITS.NATIVE_TRANSFER * maxFeePerGas;
|
|
611
|
+
const profitAmount = calculateTransferFee(ENI_CHAIN_ID, validKeys.length) + profitTxGasCost;
|
|
608
612
|
const targetWallet = new Wallet(targetPrivateKey, provider);
|
|
609
613
|
const targetNonce = await targetWallet.getNonce();
|
|
610
614
|
const profitTx = await targetWallet.signTransaction({
|
|
@@ -23,6 +23,11 @@ export declare const ENI_ADDRESSES: {
|
|
|
23
23
|
readonly DswapV3Router02: "0xcdE487F5B460a516f31FaC520D4e18BA1C8cda49";
|
|
24
24
|
readonly Multicall3: "0xde8bbd91FFd778E8Fc4df66d808159b6245b3D51";
|
|
25
25
|
readonly BatchRouter: "0xDe44dC76cE29f743FbC250930a92a847Bf1662F2";
|
|
26
|
+
readonly IroFactory: "0x556b2aeEcc69AF2084Cfc9282BdeB5888130a566";
|
|
27
|
+
readonly IroOwner: "0x8865b811A402c2669439880B1d57a74B391204a0";
|
|
28
|
+
readonly IroSellFeeContract: "0xec5Fb1FEaAfBf86c7B139fEd5D1c3EA8FFC0b1c5";
|
|
29
|
+
readonly IroSwapV2Router: "0x93b1199fA96f6b9b1f993AA0226eB6076968a9BF";
|
|
30
|
+
readonly IroSwapV2Factory: "0xdE4360F6Cd386FD70Db1386F920138177e3967df";
|
|
26
31
|
};
|
|
27
32
|
export declare const WEGAS: "0x6d1e851446f4d004ae2a72f9afed85e8829a205e";
|
|
28
33
|
export declare const USDT: "0xDC1a8A35b0BaA3229b13f348ED708a2fd50b5e3a";
|
|
@@ -33,6 +38,10 @@ export declare const TOKEN_FACTORY: "0x720ba3aac040543837e306039b0e395b02e9bba9"
|
|
|
33
38
|
export declare const POOL_FACTORY: "0x3f5636a7bd02762625d24769a8f2963de5fbf80c";
|
|
34
39
|
export declare const DSWAP_V2_ROUTER: "0x97ed8be49d9a8b86247090aa41e908e76b8fcf22";
|
|
35
40
|
export declare const DSWAP_V2_FACTORY: "0x548c0e26ce90b333c07abb6d55546304d46d269d";
|
|
41
|
+
export declare const IRO_FACTORY: "0x556b2aeEcc69AF2084Cfc9282BdeB5888130a566";
|
|
42
|
+
export declare const IRO_OWNER: "0x8865b811A402c2669439880B1d57a74B391204a0";
|
|
43
|
+
export declare const IROSWAP_V2_ROUTER: "0x93b1199fA96f6b9b1f993AA0226eB6076968a9BF";
|
|
44
|
+
export declare const IROSWAP_V2_FACTORY: "0xdE4360F6Cd386FD70Db1386F920138177e3967df";
|
|
36
45
|
export declare const ENI_MULTICALL3: "0xde8bbd91FFd778E8Fc4df66d808159b6245b3D51";
|
|
37
46
|
export declare const NATIVE_TRANSFER_GAS_LIMIT: 21055n;
|
|
38
47
|
export declare const ERC20_TRANSFER_GAS_LIMIT: 65000n;
|
|
@@ -25,6 +25,10 @@ export const TOKEN_FACTORY = ADDRESSES.ENI.TokenFactory;
|
|
|
25
25
|
export const POOL_FACTORY = ADDRESSES.ENI.PoolFactory;
|
|
26
26
|
export const DSWAP_V2_ROUTER = ADDRESSES.ENI.DswapV2Router;
|
|
27
27
|
export const DSWAP_V2_FACTORY = ADDRESSES.ENI.DswapV2Factory;
|
|
28
|
+
export const IRO_FACTORY = ADDRESSES.ENI.IroFactory;
|
|
29
|
+
export const IRO_OWNER = ADDRESSES.ENI.IroOwner;
|
|
30
|
+
export const IROSWAP_V2_ROUTER = ADDRESSES.ENI.IroSwapV2Router;
|
|
31
|
+
export const IROSWAP_V2_FACTORY = ADDRESSES.ENI.IroSwapV2Factory;
|
|
28
32
|
export const ENI_MULTICALL3 = ADDRESSES.ENI.Multicall3;
|
|
29
33
|
// ============================================================================
|
|
30
34
|
// Gas 配置
|
|
@@ -18,3 +18,5 @@ export { FairPoolQuery, claimFromPool, claimFromPoolForSubmit, batchClaimForSubm
|
|
|
18
18
|
export type { PoolOverview, PoolClaimParams, PoolClaimResult, } from './platforms/fair-launch/index.js';
|
|
19
19
|
export { getLPPairInfo, batchGetLPPairInfo, getPairAddress, addLiquidityETHForSubmit, removeLiquidityETHForSubmit, addLiquidityForSubmit, removeLiquidityForSubmit, } from './platforms/dswap/index.js';
|
|
20
20
|
export type { LPPairInfo, GetLPInfoParams, BatchGetLPInfoParams, AddLiquidityETHParams, RemoveLiquidityETHParams, AddLiquidityParams, RemoveLiquidityParams, LiquidityTxResult, LiquidityForSubmitResult, } from './platforms/dswap/index.js';
|
|
21
|
+
export { IroFactoryQuery as EniIroFactoryQuery, encodeCreateProjectCall as eniIroEncodeCreateProjectCall, createProject as eniIroCreateProject, parseCreateProjectEvent as eniIroParseCreateProjectEvent, IroTokenQuery as EniIroTokenQuery, subscribe as eniIroSubscribe, pledge as eniIroPledge, batchSubscribe as eniIroBatchSubscribe, batchSubscribeForSubmit as eniIroBatchSubscribeForSubmit, IroPoolQuery as EniIroPoolQuery, poolRemovePledge as eniIroPoolRemovePledge, poolExtract as eniIroPoolExtract, poolTransferAwards as eniIroPoolTransferAwards, batchExtract as eniIroBatchExtract, ENI_IRO_FACTORY_ADDRESS, ENI_IRO_OWNER_ADDRESS, ENI_IRO_SELL_FEE_CONTRACT, ENI_IROSWAP_V2_ROUTER, ENI_IROSWAP_V2_FACTORY, IRO_FACTORY_ABI as ENI_IRO_FACTORY_ABI, IRO_TOKEN_ABI as ENI_IRO_TOKEN_ABI, IRO_POOL_ABI as ENI_IRO_POOL_ABI, ENI_IRO_PLATFORM_URL, setIroApiBase as setEniIroApiBase, iroApiCreateProject as eniIroApiCreateProject, iroApiUploadImage as eniIroApiUploadImage, } from './platforms/iro/index.js';
|
|
22
|
+
export type { WhiteListQuota as EniWhiteListQuota, IroCreateProjectParams as EniIroCreateProjectParams, IroSubscribeParams as EniIroSubscribeParams, IroPledgeParams as EniIroPledgeParams, IroTokenInfo as EniIroTokenInfo, IroTxResult as EniIroTxResult, IroCreateProjectResult as EniIroCreateProjectResult, IroQueryConfig as EniIroQueryConfig, IroCreateParams as EniIroCreateParams, IroBatchSubscribeForSubmitParams as EniIroBatchSubscribeForSubmitParams, IroBatchSubscribeForSubmitResult as EniIroBatchSubscribeForSubmitResult, } from './platforms/iro/index.js';
|
package/dist/chains/eni/index.js
CHANGED
|
@@ -27,3 +27,7 @@ export { FairPoolQuery, claimFromPool, claimFromPoolForSubmit, batchClaimForSubm
|
|
|
27
27
|
// 快捷导出 - DSWAP V2 (流动性管理)
|
|
28
28
|
// ============================================================================
|
|
29
29
|
export { getLPPairInfo, batchGetLPPairInfo, getPairAddress, addLiquidityETHForSubmit, removeLiquidityETHForSubmit, addLiquidityForSubmit, removeLiquidityForSubmit, } from './platforms/dswap/index.js';
|
|
30
|
+
// ============================================================================
|
|
31
|
+
// 快捷导出 - IRO (Initial Rights Offering)
|
|
32
|
+
// ============================================================================
|
|
33
|
+
export { IroFactoryQuery as EniIroFactoryQuery, encodeCreateProjectCall as eniIroEncodeCreateProjectCall, createProject as eniIroCreateProject, parseCreateProjectEvent as eniIroParseCreateProjectEvent, IroTokenQuery as EniIroTokenQuery, subscribe as eniIroSubscribe, pledge as eniIroPledge, batchSubscribe as eniIroBatchSubscribe, batchSubscribeForSubmit as eniIroBatchSubscribeForSubmit, IroPoolQuery as EniIroPoolQuery, poolRemovePledge as eniIroPoolRemovePledge, poolExtract as eniIroPoolExtract, poolTransferAwards as eniIroPoolTransferAwards, batchExtract as eniIroBatchExtract, ENI_IRO_FACTORY_ADDRESS, ENI_IRO_OWNER_ADDRESS, ENI_IRO_SELL_FEE_CONTRACT, ENI_IROSWAP_V2_ROUTER, ENI_IROSWAP_V2_FACTORY, IRO_FACTORY_ABI as ENI_IRO_FACTORY_ABI, IRO_TOKEN_ABI as ENI_IRO_TOKEN_ABI, IRO_POOL_ABI as ENI_IRO_POOL_ABI, ENI_IRO_PLATFORM_URL, setIroApiBase as setEniIroApiBase, iroApiCreateProject as eniIroApiCreateProject, iroApiUploadImage as eniIroApiUploadImage, } from './platforms/iro/index.js';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 支持 createAndInitPurchase — 创建代币并可选首次买入
|
|
5
5
|
*/
|
|
6
6
|
import { Wallet, JsonRpcProvider } from 'ethers';
|
|
7
|
-
import { ENI_CHAIN_ID, ENI_RPC_URL, DAOAAS_PORTAL, } from '../../constants.js';
|
|
7
|
+
import { ENI_CHAIN_ID, ENI_RPC_URL, DAOAAS_PORTAL, NATIVE_TRANSFER_GAS_LIMIT, } from '../../constants.js';
|
|
8
8
|
import { encodeCreateCall } from './portal.js';
|
|
9
9
|
import { buildProfitTransfer } from './portal-direct.js';
|
|
10
10
|
import { calculateProfitAmount, getProfitRateBps, getProfitRecipient } from '../../../../shared/constants/profit.js';
|
|
@@ -62,7 +62,8 @@ export async function createTokenForSubmit(params) {
|
|
|
62
62
|
rpcUrl,
|
|
63
63
|
gasPrice: maxFeePerGas,
|
|
64
64
|
});
|
|
65
|
-
const
|
|
65
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
66
|
+
const profitAmount = calculateProfitAmount(initialBuyAmount, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
66
67
|
const signedTransactions = [createTx.signedTx];
|
|
67
68
|
let totalGasCost = 2000000n * maxFeePerGas;
|
|
68
69
|
if (profitAmount > 0n) {
|
|
@@ -200,7 +200,8 @@ export async function directBuyForSubmit(params) {
|
|
|
200
200
|
const maxFeePerGas = params.gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
201
201
|
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
202
202
|
const tradeTx = await directBuy({ ...params, rpcUrl, gasPrice: maxFeePerGas });
|
|
203
|
-
const
|
|
203
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
204
|
+
const profitAmount = calculateProfitAmount(params.amount, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
204
205
|
const signedTransactions = [tradeTx.signedTx];
|
|
205
206
|
let totalGasCost = 300000n * maxFeePerGas;
|
|
206
207
|
if (profitAmount > 0n) {
|
|
@@ -230,7 +231,8 @@ export async function directSellForSubmit(params) {
|
|
|
230
231
|
const maxFeePerGas = params.gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
231
232
|
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
232
233
|
const estimatedOut = await query.previewSell(params.token, params.tokenAmount);
|
|
233
|
-
const
|
|
234
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
235
|
+
const profitAmount = calculateProfitAmount(estimatedOut, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
234
236
|
const tradeTx = await directSell({
|
|
235
237
|
...params,
|
|
236
238
|
rpcUrl,
|
|
@@ -295,7 +297,8 @@ export async function directBatchBuyForSubmit(params) {
|
|
|
295
297
|
});
|
|
296
298
|
transactions.push({ hash: '', signedTx, from: wallet.address, nonce });
|
|
297
299
|
}
|
|
298
|
-
const
|
|
300
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
301
|
+
const profitAmount = calculateProfitAmount(totalFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
299
302
|
const payerIndex = pickMaxAmountIndex(amounts);
|
|
300
303
|
const profitTx = await buildRevenueTail({
|
|
301
304
|
rpcUrl,
|
|
@@ -351,7 +354,8 @@ export async function directBatchSellForSubmit(params) {
|
|
|
351
354
|
transactions.push({ hash: '', signedTx, from: wallet.address, nonce });
|
|
352
355
|
}
|
|
353
356
|
const totalFlow = estimatedOuts.reduce((sum, amount) => sum + amount, 0n);
|
|
354
|
-
const
|
|
357
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
358
|
+
const profitAmount = calculateProfitAmount(totalFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
355
359
|
const payerIndex = pickMaxAmountIndex(estimatedOuts);
|
|
356
360
|
const profitTx = await buildRevenueTail({
|
|
357
361
|
rpcUrl,
|
|
@@ -427,7 +431,8 @@ export async function directQuickSwapForSubmit(params) {
|
|
|
427
431
|
const gasForBuy = 300000n * maxFeePerGas;
|
|
428
432
|
const hopGasFee = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
429
433
|
const totalFlow = params.buyAmounts.reduce((sum, a) => sum + a, 0n);
|
|
430
|
-
const
|
|
434
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
435
|
+
const profitAmount = calculateProfitAmount(totalFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
431
436
|
const profitGasPerBuyer = (NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas);
|
|
432
437
|
for (let i = 0; i < params.buyerKeys.length; i++) {
|
|
433
438
|
const buyerAddress = new Wallet(params.buyerKeys[i]).address;
|
|
@@ -492,9 +497,10 @@ export async function directQuickSwapForSubmit(params) {
|
|
|
492
497
|
gasPrice: maxFeePerGas,
|
|
493
498
|
});
|
|
494
499
|
const allTxs = [...sellResult.transactions, ...distributeTxs, ...buyResult.transactions];
|
|
495
|
-
// 4)
|
|
500
|
+
// 4) 利润:从最大买方钱包扣除利润(含利润转账 Gas)
|
|
496
501
|
const totalFlow = params.buyAmounts.reduce((sum, amount) => sum + amount, 0n);
|
|
497
|
-
const
|
|
502
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
503
|
+
const profitAmount = calculateProfitAmount(totalFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
498
504
|
const payerIndex = pickMaxAmountIndex(params.buyAmounts);
|
|
499
505
|
const payerKey = params.buyerKeys[payerIndex] || primarySellerKey;
|
|
500
506
|
const payerAddress = new Wallet(payerKey).address.toLowerCase();
|
|
@@ -137,7 +137,8 @@ export async function addLiquidityETHForSubmit(params) {
|
|
|
137
137
|
gasLimit: 350000n,
|
|
138
138
|
});
|
|
139
139
|
signedTxs.push(addLiqTx);
|
|
140
|
-
const
|
|
140
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
141
|
+
const profitAmount = calculateProfitAmount(amountETHDesired, PROFIT_BPS) + profitTxGasCost;
|
|
141
142
|
if (profitAmount > 0n) {
|
|
142
143
|
const profitTx = await signProfitTx({ wallet, nonce: currentNonce, profitAmount, maxFeePerGas, maxPriorityFeePerGas });
|
|
143
144
|
signedTxs.push(profitTx);
|
|
@@ -211,7 +212,8 @@ export async function removeLiquidityETHForSubmit(params) {
|
|
|
211
212
|
gasLimit: 350000n,
|
|
212
213
|
});
|
|
213
214
|
signedTxs.push(removeLiqTx);
|
|
214
|
-
const
|
|
215
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
216
|
+
const profitAmount = calculateProfitAmount(amountETHExpected, PROFIT_BPS) + profitTxGasCost;
|
|
215
217
|
if (profitAmount > 0n) {
|
|
216
218
|
const profitTx = await signProfitTx({ wallet, nonce: currentNonce, profitAmount, maxFeePerGas, maxPriorityFeePerGas });
|
|
217
219
|
signedTxs.push(profitTx);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - 查询代币列表
|
|
8
8
|
*/
|
|
9
9
|
import { Contract, Interface, Wallet, JsonRpcProvider } from 'ethers';
|
|
10
|
-
import { ENI_CHAIN_ID, ENI_RPC_URL, LP_FAIR_LAUNCHER_ABI, } from '../../constants.js';
|
|
10
|
+
import { ENI_CHAIN_ID, ENI_RPC_URL, LP_FAIR_LAUNCHER_ABI, NATIVE_TRANSFER_GAS_LIMIT, } from '../../constants.js';
|
|
11
11
|
import { LP_FAIR_LAUNCHER_ADDRESS } from './constants.js';
|
|
12
12
|
import { buildProfitTransfer } from '../daoaas/portal-direct.js';
|
|
13
13
|
import { calculateProfitAmount, getProfitRateBps, getProfitRecipient } from '../../../../shared/constants/profit.js';
|
|
@@ -155,7 +155,8 @@ export async function setTokenTradeStartTimeForSubmit(params) {
|
|
|
155
155
|
const maxFeePerGas = gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
156
156
|
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
157
157
|
const setResult = await setTokenTradeStartTime({ ...params, rpcUrl, gasPrice: maxFeePerGas });
|
|
158
|
-
const
|
|
158
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
159
|
+
const profitAmount = calculateProfitAmount(maxFeePerGas * 200000n, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
159
160
|
const profitTx = await buildProfitTransfer({
|
|
160
161
|
rpcUrl,
|
|
161
162
|
payerKey: privateKey,
|
|
@@ -230,7 +231,8 @@ export async function launchTokenForSubmit(params) {
|
|
|
230
231
|
// 与 BSC 一致:利润基于实际投资金额(initialQuote)计算
|
|
231
232
|
// WEGAS: value = initialQuote, ERC20: value = 0 但 initialQuote 仍为实际投资额
|
|
232
233
|
const profitFlow = launchParams.initialQuote > 0n ? launchParams.initialQuote : value;
|
|
233
|
-
const
|
|
234
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
235
|
+
const profitAmount = calculateProfitAmount(profitFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
234
236
|
const profitTx = await buildProfitTransfer({
|
|
235
237
|
rpcUrl,
|
|
236
238
|
payerKey: privateKey,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - 构建跟买交易 (claimForSubmit / batchClaimForSubmit)
|
|
8
8
|
*/
|
|
9
9
|
import { Contract, Interface, Wallet, JsonRpcProvider } from 'ethers';
|
|
10
|
-
import { ENI_CHAIN_ID, ENI_RPC_URL, LP_FAIR_POOL_ABI, } from '../../constants.js';
|
|
10
|
+
import { ENI_CHAIN_ID, ENI_RPC_URL, LP_FAIR_POOL_ABI, NATIVE_TRANSFER_GAS_LIMIT, } from '../../constants.js';
|
|
11
11
|
import { buildProfitTransfer } from '../daoaas/portal-direct.js';
|
|
12
12
|
import { calculateProfitAmount, getProfitRateBps, getProfitRecipient } from '../../../../shared/constants/profit.js';
|
|
13
13
|
const poolIface = new Interface(LP_FAIR_POOL_ABI);
|
|
@@ -133,9 +133,10 @@ export async function claimFromPoolForSubmit(params) {
|
|
|
133
133
|
const maxFeePerGas = gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
134
134
|
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? 0n;
|
|
135
135
|
const claimResult = await claimFromPool({ ...params, rpcUrl, gasPrice: maxFeePerGas });
|
|
136
|
-
// 与 BSC
|
|
136
|
+
// 与 BSC 一致:利润基于实际投资金额计算(含利润转账 Gas)
|
|
137
137
|
const profitFlow = quoteAmount ?? value;
|
|
138
|
-
const
|
|
138
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
139
|
+
const profitAmount = calculateProfitAmount(profitFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
139
140
|
const profitTx = await buildProfitTransfer({
|
|
140
141
|
rpcUrl,
|
|
141
142
|
payerKey: privateKey,
|
|
@@ -192,10 +193,11 @@ export async function batchClaimForSubmit(params) {
|
|
|
192
193
|
totalQuoteAmount += qa;
|
|
193
194
|
claimResults.push({ privateKey: claim.privateKey, value: claim.value, quoteAmount: qa, nonce: result.nonce });
|
|
194
195
|
}
|
|
195
|
-
// 与 BSC
|
|
196
|
+
// 与 BSC 一致:利润基于实际投资金额计算(含利润转账 Gas)
|
|
196
197
|
// WEGAS: quoteAmount = value, ERC20: quoteAmount = 实际 ERC20 投资额
|
|
197
198
|
const profitFlow = totalQuoteAmount > 0n ? totalQuoteAmount : totalValue;
|
|
198
|
-
const
|
|
199
|
+
const profitTxGasCost = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
200
|
+
const profitAmount = calculateProfitAmount(profitFlow, NORMAL_PROFIT_BPS) + profitTxGasCost;
|
|
199
201
|
if (profitAmount > 0n) {
|
|
200
202
|
let maxIdx = 0;
|
|
201
203
|
for (let i = 1; i < claimResults.length; i++) {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ENI IRO 平台后端 API
|
|
3
|
+
*
|
|
4
|
+
* 正式服 Base URL: https://eni-api.ironetwork.com
|
|
5
|
+
* 浏览器环境下需要通过 Vite 代理绕过 CORS,例如传入 '/eni-iro-api'
|
|
6
|
+
*/
|
|
7
|
+
export declare const ENI_IRO_PLATFORM_URL = "https://eni-api.ironetwork.com";
|
|
8
|
+
/**
|
|
9
|
+
* 设置 ENI IRO API 的 base URL
|
|
10
|
+
* 浏览器环境下需要通过 Vite 代理绕过 CORS,例如传入 '/eni-iro-api'
|
|
11
|
+
*/
|
|
12
|
+
export declare function setIroApiBase(base: string): void;
|
|
13
|
+
export interface IroApiCreateProjectRequest {
|
|
14
|
+
logo: string;
|
|
15
|
+
name: string;
|
|
16
|
+
symbol: string;
|
|
17
|
+
totalSupply: string;
|
|
18
|
+
description: string;
|
|
19
|
+
hardCap: string;
|
|
20
|
+
initPrice: string;
|
|
21
|
+
}
|
|
22
|
+
export interface IroApiCreateProjectResponse {
|
|
23
|
+
status: number;
|
|
24
|
+
message: string;
|
|
25
|
+
data: {
|
|
26
|
+
projectID: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface IroApiUploadImageResponse {
|
|
30
|
+
status: number;
|
|
31
|
+
message: string;
|
|
32
|
+
data: {
|
|
33
|
+
path: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export declare function iroApiCreateProject(params: IroApiCreateProjectRequest): Promise<string>;
|
|
37
|
+
export declare function iroApiUploadImage(file: File | Blob, filename?: string): Promise<string>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ENI IRO 平台后端 API
|
|
3
|
+
*
|
|
4
|
+
* 正式服 Base URL: https://eni-api.ironetwork.com
|
|
5
|
+
* 浏览器环境下需要通过 Vite 代理绕过 CORS,例如传入 '/eni-iro-api'
|
|
6
|
+
*/
|
|
7
|
+
export const ENI_IRO_PLATFORM_URL = 'https://eni-api.ironetwork.com';
|
|
8
|
+
let _eniIroApiBase = ENI_IRO_PLATFORM_URL;
|
|
9
|
+
/**
|
|
10
|
+
* 设置 ENI IRO API 的 base URL
|
|
11
|
+
* 浏览器环境下需要通过 Vite 代理绕过 CORS,例如传入 '/eni-iro-api'
|
|
12
|
+
*/
|
|
13
|
+
export function setIroApiBase(base) {
|
|
14
|
+
_eniIroApiBase = base.replace(/\/+$/, '');
|
|
15
|
+
}
|
|
16
|
+
function getApiBase() {
|
|
17
|
+
return _eniIroApiBase;
|
|
18
|
+
}
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// 内部请求工具
|
|
21
|
+
// ============================================================================
|
|
22
|
+
async function request(path, options = {}) {
|
|
23
|
+
const url = `${getApiBase()}${path}`;
|
|
24
|
+
const res = await fetch(url, { ...options, headers: { ...options.headers } });
|
|
25
|
+
if (!res.ok) {
|
|
26
|
+
const text = await res.text().catch(() => '');
|
|
27
|
+
throw new Error(`ENI IRO API error (${res.status}): ${text || res.statusText}`);
|
|
28
|
+
}
|
|
29
|
+
return (await res.json());
|
|
30
|
+
}
|
|
31
|
+
// ============================================================================
|
|
32
|
+
// 公开 API
|
|
33
|
+
// ============================================================================
|
|
34
|
+
export async function iroApiCreateProject(params) {
|
|
35
|
+
const body = new FormData();
|
|
36
|
+
body.append('logo', params.logo);
|
|
37
|
+
body.append('name', params.name);
|
|
38
|
+
body.append('symbol', params.symbol);
|
|
39
|
+
body.append('total_supply', params.totalSupply);
|
|
40
|
+
body.append('description', params.description);
|
|
41
|
+
body.append('max', params.hardCap);
|
|
42
|
+
body.append('price', params.initPrice);
|
|
43
|
+
const res = await request('/api/community/create/open', {
|
|
44
|
+
method: 'POST',
|
|
45
|
+
body,
|
|
46
|
+
});
|
|
47
|
+
if (res.status !== 200 || !res.data?.projectID) {
|
|
48
|
+
throw new Error(`ENI IRO API createProject failed: ${res.message || 'unknown'}`);
|
|
49
|
+
}
|
|
50
|
+
return res.data.projectID;
|
|
51
|
+
}
|
|
52
|
+
export async function iroApiUploadImage(file, filename) {
|
|
53
|
+
const uploadName = filename || (file instanceof File ? file.name : 'logo.png');
|
|
54
|
+
const body = new FormData();
|
|
55
|
+
body.append('img', file, uploadName);
|
|
56
|
+
const res = await request('/api/upload/image', {
|
|
57
|
+
method: 'POST',
|
|
58
|
+
body,
|
|
59
|
+
});
|
|
60
|
+
if (res.status !== 200 || !res.data?.path) {
|
|
61
|
+
throw new Error(`ENI IRO API uploadImage failed: ${res.message || 'unknown'}`);
|
|
62
|
+
}
|
|
63
|
+
return res.data.path;
|
|
64
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ENI IRO 平台常量 — 合约地址 + ABI
|
|
3
|
+
*
|
|
4
|
+
* 合约地址统一从 shared/constants/addresses.ts 导入(单一数据源)
|
|
5
|
+
* ABI 与 BSC IRO 完全一致(同一套合约代码)
|
|
6
|
+
*/
|
|
7
|
+
/** IRO 工厂合约地址 (ENI) */
|
|
8
|
+
export declare const ENI_IRO_FACTORY_ADDRESS: "0x556b2aeEcc69AF2084Cfc9282BdeB5888130a566";
|
|
9
|
+
/** IROOwner 合约地址 (ENI) — broker 权限管理 */
|
|
10
|
+
export declare const ENI_IRO_OWNER_ADDRESS: "0x8865b811A402c2669439880B1d57a74B391204a0";
|
|
11
|
+
/** IROSellFeeContract (ENI) — 经纪商买卖手续费 */
|
|
12
|
+
export declare const ENI_IRO_SELL_FEE_CONTRACT: "0xec5Fb1FEaAfBf86c7B139fEd5D1c3EA8FFC0b1c5";
|
|
13
|
+
/** IROSwap V2 Router (ENI) — 使用 UniswapV2Router02 */
|
|
14
|
+
export declare const ENI_IROSWAP_V2_ROUTER: "0x93b1199fA96f6b9b1f993AA0226eB6076968a9BF";
|
|
15
|
+
/** IROSwap V2 Factory (ENI) */
|
|
16
|
+
export declare const ENI_IROSWAP_V2_FACTORY: "0xdE4360F6Cd386FD70Db1386F920138177e3967df";
|
|
17
|
+
/** USDT on ENI (18 decimals) */
|
|
18
|
+
export declare const ENI_USDT: "0xDC1a8A35b0BaA3229b13f348ED708a2fd50b5e3a";
|
|
19
|
+
export declare const IRO_FACTORY_ABI: readonly ["function createProject(uint256 _projectID, uint256 _totalSupply, uint256 _initPrice, string memory _symbol, uint256[2] memory softAndHardCap, address coinAddr, uint256 pledgeDays, tuple(address account, uint256 quota)[] memory _addressList) returns (address pool)", "function projectIDToken(uint256) view returns (address)", "function getPool(address token) view returns (address poolAddress)", "function allToken(uint256) view returns (address token)", "function allTokensLength() view returns (uint256)", "function tokenInfo(address token) view returns (string name, uint256 totalSupply, uint256 initPrice, address creator, uint256 softCap, uint256 hardCap, bool isWhitelisted, uint256 pledgeDays)", "event CreateProject(uint256 indexed projectID, address indexed token, address indexed pool, address TKAAddr, uint256 len)"];
|
|
20
|
+
export declare const IRO_TOKEN_ABI: readonly ["function name() view returns (string)", "function symbol() view returns (string)", "function decimals() view returns (uint8)", "function totalSupply() view returns (uint256)", "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 transferFrom(address from, address to, uint256 amount) returns (bool)", "function subscribe(address _user, uint256 amount) payable", "function pledge(address _user, uint256 amount) payable", "function price() view returns (uint256)", "function creator() view returns (address)", "function isOpen() view returns (bool)", "function isWhitelisted() view returns (bool)", "function isWXOC() view returns (bool)", "function tradingLimit() view returns (uint256)", "function totalCreatorFee() view returns (uint256)", "function POOL() view returns (address)", "function TKA() view returns (address)", "function getTokenPrice() view returns (uint256 pairToken, uint256 pairTKA, uint256 newPrice)", "function dayProduce(uint256 day) view returns (bool)"];
|
|
21
|
+
export declare const IRO_POOL_ABI: readonly ["function pledge(address _user, uint256 amount, uint256 share) external", "function removePledge() external", "function extract(uint256 amount) external", "function transferAwards(address[] recipients, uint256[] TKAAmounts) external", "function token() view returns (address)", "function totalShare() view returns (uint256)", "function produceNum() view returns (uint256)", "function produceLpNum() view returns (uint256)", "function produceLimit() view returns (uint256)", "function lastAddProduce() view returns (uint256)", "function getDeposit(address account) view returns (uint256)", "function getUserPledgeLpForUsdt(address _user) view returns (uint256 lpForUsdt)", "function getLPValueForUSDTValue(uint256 targetTKAValue) view returns (uint256 valueInTKA)", "function increaseRateMap(uint256) view returns (bool status, uint256 rate)"];
|
|
22
|
+
export declare const CREATE_PROJECT_GAS_LIMIT = 5000000n;
|
|
23
|
+
export declare const SUBSCRIBE_GAS_LIMIT = 1500000n;
|
|
24
|
+
export declare const POOL_OPERATION_GAS_LIMIT = 300000n;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ENI IRO 平台常量 — 合约地址 + ABI
|
|
3
|
+
*
|
|
4
|
+
* 合约地址统一从 shared/constants/addresses.ts 导入(单一数据源)
|
|
5
|
+
* ABI 与 BSC IRO 完全一致(同一套合约代码)
|
|
6
|
+
*/
|
|
7
|
+
import { ADDRESSES } from '../../../../shared/constants/addresses.js';
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// 合约地址(从 shared 导入,保持单一数据源)
|
|
10
|
+
// ============================================================================
|
|
11
|
+
/** IRO 工厂合约地址 (ENI) */
|
|
12
|
+
export const ENI_IRO_FACTORY_ADDRESS = ADDRESSES.ENI.IroFactory;
|
|
13
|
+
/** IROOwner 合约地址 (ENI) — broker 权限管理 */
|
|
14
|
+
export const ENI_IRO_OWNER_ADDRESS = ADDRESSES.ENI.IroOwner;
|
|
15
|
+
/** IROSellFeeContract (ENI) — 经纪商买卖手续费 */
|
|
16
|
+
export const ENI_IRO_SELL_FEE_CONTRACT = ADDRESSES.ENI.IroSellFeeContract;
|
|
17
|
+
/** IROSwap V2 Router (ENI) — 使用 UniswapV2Router02 */
|
|
18
|
+
export const ENI_IROSWAP_V2_ROUTER = ADDRESSES.ENI.IroSwapV2Router;
|
|
19
|
+
/** IROSwap V2 Factory (ENI) */
|
|
20
|
+
export const ENI_IROSWAP_V2_FACTORY = ADDRESSES.ENI.IroSwapV2Factory;
|
|
21
|
+
/** USDT on ENI (18 decimals) */
|
|
22
|
+
export const ENI_USDT = ADDRESSES.ENI.USDT;
|
|
23
|
+
// ============================================================================
|
|
24
|
+
// IRO Factory ABI (与 BSC 一致)
|
|
25
|
+
// ============================================================================
|
|
26
|
+
const WHITE_LIST_QUOTA_TUPLE = 'tuple(address account, uint256 quota)';
|
|
27
|
+
export const IRO_FACTORY_ABI = [
|
|
28
|
+
`function createProject(uint256 _projectID, uint256 _totalSupply, uint256 _initPrice, string memory _symbol, uint256[2] memory softAndHardCap, address coinAddr, uint256 pledgeDays, ${WHITE_LIST_QUOTA_TUPLE}[] memory _addressList) returns (address pool)`,
|
|
29
|
+
'function projectIDToken(uint256) view returns (address)',
|
|
30
|
+
'function getPool(address token) view returns (address poolAddress)',
|
|
31
|
+
'function allToken(uint256) view returns (address token)',
|
|
32
|
+
'function allTokensLength() view returns (uint256)',
|
|
33
|
+
`function tokenInfo(address token) view returns (string name, uint256 totalSupply, uint256 initPrice, address creator, uint256 softCap, uint256 hardCap, bool isWhitelisted, uint256 pledgeDays)`,
|
|
34
|
+
'event CreateProject(uint256 indexed projectID, address indexed token, address indexed pool, address TKAAddr, uint256 len)',
|
|
35
|
+
];
|
|
36
|
+
// ============================================================================
|
|
37
|
+
// IRO Token ABI (ERC20 + subscribe/pledge)
|
|
38
|
+
// ============================================================================
|
|
39
|
+
export const IRO_TOKEN_ABI = [
|
|
40
|
+
'function name() view returns (string)',
|
|
41
|
+
'function symbol() view returns (string)',
|
|
42
|
+
'function decimals() view returns (uint8)',
|
|
43
|
+
'function totalSupply() view returns (uint256)',
|
|
44
|
+
'function balanceOf(address account) view returns (uint256)',
|
|
45
|
+
'function allowance(address owner, address spender) view returns (uint256)',
|
|
46
|
+
'function approve(address spender, uint256 amount) returns (bool)',
|
|
47
|
+
'function transfer(address to, uint256 amount) returns (bool)',
|
|
48
|
+
'function transferFrom(address from, address to, uint256 amount) returns (bool)',
|
|
49
|
+
'function subscribe(address _user, uint256 amount) payable',
|
|
50
|
+
'function pledge(address _user, uint256 amount) payable',
|
|
51
|
+
'function price() view returns (uint256)',
|
|
52
|
+
'function creator() view returns (address)',
|
|
53
|
+
'function isOpen() view returns (bool)',
|
|
54
|
+
'function isWhitelisted() view returns (bool)',
|
|
55
|
+
'function isWXOC() view returns (bool)',
|
|
56
|
+
'function tradingLimit() view returns (uint256)',
|
|
57
|
+
'function totalCreatorFee() view returns (uint256)',
|
|
58
|
+
'function POOL() view returns (address)',
|
|
59
|
+
'function TKA() view returns (address)',
|
|
60
|
+
'function getTokenPrice() view returns (uint256 pairToken, uint256 pairTKA, uint256 newPrice)',
|
|
61
|
+
'function dayProduce(uint256 day) view returns (bool)',
|
|
62
|
+
];
|
|
63
|
+
// ============================================================================
|
|
64
|
+
// IRO Pool ABI
|
|
65
|
+
// ============================================================================
|
|
66
|
+
export const IRO_POOL_ABI = [
|
|
67
|
+
'function pledge(address _user, uint256 amount, uint256 share) external',
|
|
68
|
+
'function removePledge() external',
|
|
69
|
+
'function extract(uint256 amount) external',
|
|
70
|
+
'function transferAwards(address[] recipients, uint256[] TKAAmounts) external',
|
|
71
|
+
'function token() view returns (address)',
|
|
72
|
+
'function totalShare() view returns (uint256)',
|
|
73
|
+
'function produceNum() view returns (uint256)',
|
|
74
|
+
'function produceLpNum() view returns (uint256)',
|
|
75
|
+
'function produceLimit() view returns (uint256)',
|
|
76
|
+
'function lastAddProduce() view returns (uint256)',
|
|
77
|
+
'function getDeposit(address account) view returns (uint256)',
|
|
78
|
+
'function getUserPledgeLpForUsdt(address _user) view returns (uint256 lpForUsdt)',
|
|
79
|
+
'function getLPValueForUSDTValue(uint256 targetTKAValue) view returns (uint256 valueInTKA)',
|
|
80
|
+
'function increaseRateMap(uint256) view returns (bool status, uint256 rate)',
|
|
81
|
+
];
|
|
82
|
+
// ============================================================================
|
|
83
|
+
// Gas Limits
|
|
84
|
+
// ============================================================================
|
|
85
|
+
export const CREATE_PROJECT_GAS_LIMIT = 5000000n;
|
|
86
|
+
export const SUBSCRIBE_GAS_LIMIT = 1500000n;
|
|
87
|
+
export const POOL_OPERATION_GAS_LIMIT = 300000n;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ENI IRO Factory — 创建项目 (部署代币 + 资金池)
|
|
3
|
+
*
|
|
4
|
+
* ENI 使用 EIP-1559 (type 2) 交易,与 BSC (type 0) 不同
|
|
5
|
+
*/
|
|
6
|
+
import { JsonRpcProvider } from 'ethers';
|
|
7
|
+
import type { IroCreateParams, IroCreateProjectResult, IroQueryConfig, IroFactoryTokenInfo } from './types.js';
|
|
8
|
+
export declare class IroFactoryQuery {
|
|
9
|
+
private provider;
|
|
10
|
+
private factory;
|
|
11
|
+
constructor(config?: IroQueryConfig);
|
|
12
|
+
getTokenByProjectId(projectId: bigint): Promise<string>;
|
|
13
|
+
getPool(tokenAddress: string): Promise<string>;
|
|
14
|
+
allToken(index: bigint): Promise<string>;
|
|
15
|
+
allTokensLength(): Promise<bigint>;
|
|
16
|
+
tokenInfo(tokenAddress: string): Promise<IroFactoryTokenInfo>;
|
|
17
|
+
getProjectInfo(projectId: bigint): Promise<{
|
|
18
|
+
tokenAddress: string;
|
|
19
|
+
poolAddress: string;
|
|
20
|
+
}>;
|
|
21
|
+
get providerInstance(): JsonRpcProvider;
|
|
22
|
+
}
|
|
23
|
+
export declare function encodeCreateProjectCall(params: import('./types.js').IroCreateProjectParams): string;
|
|
24
|
+
export declare function createProject(params: IroCreateParams): Promise<IroCreateProjectResult>;
|
|
25
|
+
export declare function parseCreateProjectEvent(receipt: {
|
|
26
|
+
logs: Array<{
|
|
27
|
+
topics: string[];
|
|
28
|
+
data: string;
|
|
29
|
+
}>;
|
|
30
|
+
}): {
|
|
31
|
+
projectId: bigint;
|
|
32
|
+
tokenAddress: string;
|
|
33
|
+
poolAddress: string;
|
|
34
|
+
coinAddr: string;
|
|
35
|
+
allTokensLength: bigint;
|
|
36
|
+
} | null;
|