four-flap-meme-sdk 1.9.39 → 1.9.41
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/constants.d.ts +1 -1
- package/dist/chains/bsc/platforms/iro/constants.js +1 -1
- package/dist/chains/bsc/platforms/iro/pool.d.ts +10 -1
- package/dist/chains/bsc/platforms/iro/pool.js +7 -1
- package/dist/chains/eni/platforms/daoaas/portal-direct.js +10 -10
- package/dist/chains/eni/platforms/iro/constants.d.ts +1 -1
- package/dist/chains/eni/platforms/iro/constants.js +1 -1
- package/dist/chains/eni/platforms/iro/pool.d.ts +10 -1
- package/dist/chains/eni/platforms/iro/pool.js +7 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ export declare const IROSWAP_V2_FACTORY: "0x637D87a4165C5fF8f6cdDa8EC8cA394b1f0C
|
|
|
11
11
|
export declare const USDT_BSC: "0x55d398326f99059fF775485246999027B3197955";
|
|
12
12
|
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)"];
|
|
13
13
|
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)"];
|
|
14
|
-
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)", "function totalSupply() view returns (uint256)", "function balanceOf(address) view returns (uint256)", "function lastPrice() view returns (uint256)", "function userAward(address) view returns (uint256)", "function getUserStake(address) view returns (uint256)", "function ownerAddr() view returns (address)", "function isInitialized() view returns (bool)"];
|
|
14
|
+
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)", "function totalSupply() view returns (uint256)", "function balanceOf(address) view returns (uint256)", "function lastPrice() view returns (uint256)", "function userAward(address) view returns (uint256 deposit, uint256 debt, uint256 share, uint256 lastTimestamp, uint256 totalDeposit, uint256 totalInviteReward, uint256 lastInviteReward, uint256 pledgeNum)", "function getUserStake(address) view returns (uint256)", "function ownerAddr() view returns (address)", "function isInitialized() view returns (bool)"];
|
|
15
15
|
/** 默认 Gas Limit — createProject */
|
|
16
16
|
export declare const CREATE_PROJECT_GAS_LIMIT = 5000000n;
|
|
17
17
|
/** 默认 Gas Limit — subscribe / pledge (内含 addLiquidity + swap) */
|
|
@@ -81,7 +81,7 @@ export const IRO_POOL_ABI = [
|
|
|
81
81
|
'function totalSupply() view returns (uint256)',
|
|
82
82
|
'function balanceOf(address) view returns (uint256)',
|
|
83
83
|
'function lastPrice() view returns (uint256)',
|
|
84
|
-
'function userAward(address) view returns (uint256)',
|
|
84
|
+
'function userAward(address) view returns (uint256 deposit, uint256 debt, uint256 share, uint256 lastTimestamp, uint256 totalDeposit, uint256 totalInviteReward, uint256 lastInviteReward, uint256 pledgeNum)',
|
|
85
85
|
'function getUserStake(address) view returns (uint256)',
|
|
86
86
|
'function ownerAddr() view returns (address)',
|
|
87
87
|
'function isInitialized() view returns (bool)',
|
|
@@ -41,7 +41,16 @@ export declare class IroPoolQuery {
|
|
|
41
41
|
totalSupply(): Promise<bigint>;
|
|
42
42
|
balanceOf(account: string): Promise<bigint>;
|
|
43
43
|
lastPrice(): Promise<bigint>;
|
|
44
|
-
userAward(account: string): Promise<
|
|
44
|
+
userAward(account: string): Promise<{
|
|
45
|
+
deposit: bigint;
|
|
46
|
+
debt: bigint;
|
|
47
|
+
share: bigint;
|
|
48
|
+
lastTimestamp: bigint;
|
|
49
|
+
totalDeposit: bigint;
|
|
50
|
+
totalInviteReward: bigint;
|
|
51
|
+
lastInviteReward: bigint;
|
|
52
|
+
pledgeNum: bigint;
|
|
53
|
+
}>;
|
|
45
54
|
getUserStake(account: string): Promise<bigint>;
|
|
46
55
|
ownerAddr(): Promise<string>;
|
|
47
56
|
isInitialized(): Promise<boolean>;
|
|
@@ -65,7 +65,13 @@ export class IroPoolQuery {
|
|
|
65
65
|
async totalSupply() { return this.pool.totalSupply(); }
|
|
66
66
|
async balanceOf(account) { return this.pool.balanceOf(account); }
|
|
67
67
|
async lastPrice() { return this.pool.lastPrice(); }
|
|
68
|
-
async userAward(account) {
|
|
68
|
+
async userAward(account) {
|
|
69
|
+
const raw = await this.pool.userAward(account);
|
|
70
|
+
return {
|
|
71
|
+
deposit: BigInt(raw[0]), debt: BigInt(raw[1]), share: BigInt(raw[2]), lastTimestamp: BigInt(raw[3]),
|
|
72
|
+
totalDeposit: BigInt(raw[4]), totalInviteReward: BigInt(raw[5]), lastInviteReward: BigInt(raw[6]), pledgeNum: BigInt(raw[7]),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
69
75
|
async getUserStake(account) { return this.pool.getUserStake(account); }
|
|
70
76
|
async ownerAddr() { return this.pool.ownerAddr(); }
|
|
71
77
|
async isInitialized() { return this.pool.isInitialized(); }
|
|
@@ -45,7 +45,7 @@ export async function directBuy(params) {
|
|
|
45
45
|
const provider = new JsonRpcProvider(params.rpcUrl ?? ENI_RPC_URL, ENI_CHAIN_ID, { staticNetwork: true });
|
|
46
46
|
const wallet = new Wallet(params.privateKey, provider);
|
|
47
47
|
const calldata = encodeBuyCall(params.token, params.amountOutMin ?? 0n);
|
|
48
|
-
const nonce = params.nonce ?? await wallet.getNonce();
|
|
48
|
+
const nonce = params.nonce ?? await wallet.getNonce('pending');
|
|
49
49
|
const feeData = await provider.getFeeData();
|
|
50
50
|
const tx = await wallet.signTransaction({
|
|
51
51
|
to: DAOAAS_PORTAL,
|
|
@@ -70,7 +70,7 @@ export async function directSell(params) {
|
|
|
70
70
|
const provider = new JsonRpcProvider(params.rpcUrl ?? ENI_RPC_URL, ENI_CHAIN_ID, { staticNetwork: true });
|
|
71
71
|
const wallet = new Wallet(params.privateKey, provider);
|
|
72
72
|
const calldata = encodeSellCall(params.token, params.tokenAmount, params.amountOutMin ?? 0n);
|
|
73
|
-
const nonce = params.nonce ?? await wallet.getNonce();
|
|
73
|
+
const nonce = params.nonce ?? await wallet.getNonce('pending');
|
|
74
74
|
const feeData = await provider.getFeeData();
|
|
75
75
|
const tx = await wallet.signTransaction({
|
|
76
76
|
to: DAOAAS_PORTAL,
|
|
@@ -109,7 +109,7 @@ export async function directBatchBuy(params) {
|
|
|
109
109
|
const preview = await query.previewBuy(token, amounts[i]);
|
|
110
110
|
const minOut = applySlippage(preview, slippageBps);
|
|
111
111
|
const calldata = encodeBuyCall(token, minOut);
|
|
112
|
-
const nonce = await wallet.getNonce();
|
|
112
|
+
const nonce = await wallet.getNonce('pending');
|
|
113
113
|
const signedTx = await wallet.signTransaction({
|
|
114
114
|
to: DAOAAS_PORTAL,
|
|
115
115
|
value: amounts[i],
|
|
@@ -145,7 +145,7 @@ export async function directBatchSell(params) {
|
|
|
145
145
|
const preview = await query.previewSell(token, tokenAmounts[i]);
|
|
146
146
|
const minOut = applySlippage(preview, slippageBps);
|
|
147
147
|
const calldata = encodeSellCall(token, tokenAmounts[i], minOut);
|
|
148
|
-
const nonce = await wallet.getNonce();
|
|
148
|
+
const nonce = await wallet.getNonce('pending');
|
|
149
149
|
const signedTx = await wallet.signTransaction({
|
|
150
150
|
to: DAOAAS_PORTAL,
|
|
151
151
|
data: calldata,
|
|
@@ -283,7 +283,7 @@ export async function directBatchBuyForSubmit(params) {
|
|
|
283
283
|
: slippageBps;
|
|
284
284
|
const minOut = applySlippage(preview, effectiveSlippage);
|
|
285
285
|
const calldata = encodeBuyCall(token, minOut);
|
|
286
|
-
const nonce = await wallet.getNonce();
|
|
286
|
+
const nonce = await wallet.getNonce('pending');
|
|
287
287
|
const signedTx = await wallet.signTransaction({
|
|
288
288
|
to: DAOAAS_PORTAL,
|
|
289
289
|
value: amounts[i],
|
|
@@ -340,7 +340,7 @@ export async function directBatchSellForSubmit(params) {
|
|
|
340
340
|
: slippageBps;
|
|
341
341
|
const minOut = applySlippage(preview, effectiveSlippage);
|
|
342
342
|
const calldata = encodeSellCall(token, tokenAmounts[i], minOut);
|
|
343
|
-
const nonce = await wallet.getNonce();
|
|
343
|
+
const nonce = await wallet.getNonce('pending');
|
|
344
344
|
const signedTx = await wallet.signTransaction({
|
|
345
345
|
to: DAOAAS_PORTAL,
|
|
346
346
|
data: calldata,
|
|
@@ -401,7 +401,7 @@ export async function directQuickSwapForSubmit(params) {
|
|
|
401
401
|
const otherSellTxs = sellResult.transactions.filter(tx => tx.from.toLowerCase() === otherWallet.address.toLowerCase());
|
|
402
402
|
const otherNextNonce = otherSellTxs.length > 0
|
|
403
403
|
? Math.max(...otherSellTxs.map(tx => tx.nonce)) + 1
|
|
404
|
-
: await otherWallet.getNonce();
|
|
404
|
+
: await otherWallet.getNonce('pending');
|
|
405
405
|
const otherBalance = await provider.getBalance(otherWallet.address);
|
|
406
406
|
const reserveGas = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
407
407
|
const transferable = otherBalance - reserveGas;
|
|
@@ -427,7 +427,7 @@ export async function directQuickSwapForSubmit(params) {
|
|
|
427
427
|
const primarySellTxs = sellResult.transactions.filter(tx => tx.from.toLowerCase() === primarySellerAddress);
|
|
428
428
|
let primaryNextNonce = primarySellTxs.length > 0
|
|
429
429
|
? Math.max(...primarySellTxs.map(tx => tx.nonce)) + 1
|
|
430
|
-
: await primarySellerWallet.getNonce();
|
|
430
|
+
: await primarySellerWallet.getNonce('pending');
|
|
431
431
|
const gasForBuy = 300000n * maxFeePerGas;
|
|
432
432
|
const hopGasFee = NATIVE_TRANSFER_GAS_LIMIT * maxFeePerGas;
|
|
433
433
|
const totalFlow = params.buyAmounts.reduce((sum, a) => sum + a, 0n);
|
|
@@ -505,7 +505,7 @@ export async function directQuickSwapForSubmit(params) {
|
|
|
505
505
|
const payerKey = params.buyerKeys[payerIndex] || primarySellerKey;
|
|
506
506
|
const payerAddress = new Wallet(payerKey).address.toLowerCase();
|
|
507
507
|
const payerTxs = allTxs.filter(tx => tx.from.toLowerCase() === payerAddress);
|
|
508
|
-
const payerNonce = payerTxs.length > 0 ? Math.max(...payerTxs.map(tx => tx.nonce)) + 1 : await new Wallet(payerKey, provider).getNonce();
|
|
508
|
+
const payerNonce = payerTxs.length > 0 ? Math.max(...payerTxs.map(tx => tx.nonce)) + 1 : await new Wallet(payerKey, provider).getNonce('pending');
|
|
509
509
|
const profitTx = await buildRevenueTail({
|
|
510
510
|
rpcUrl,
|
|
511
511
|
payerKey,
|
|
@@ -535,7 +535,7 @@ export async function buildProfitTransfer(params) {
|
|
|
535
535
|
const provider = new JsonRpcProvider(rpcUrl, ENI_CHAIN_ID, { staticNetwork: true });
|
|
536
536
|
const wallet = new Wallet(payerKey, provider);
|
|
537
537
|
const feeData = await provider.getFeeData();
|
|
538
|
-
const nonce = explicitNonce ?? await wallet.getNonce();
|
|
538
|
+
const nonce = explicitNonce ?? await wallet.getNonce('pending');
|
|
539
539
|
const resolvedMaxFeePerGas = maxFeePerGas ?? gasPrice ?? feeData.maxFeePerGas ?? feeData.gasPrice ?? 1000000000n;
|
|
540
540
|
const resolvedMaxPriorityFeePerGas = maxPriorityFeePerGas ?? feeData.maxPriorityFeePerGas ?? 0n;
|
|
541
541
|
const signedTx = await wallet.signTransaction({
|
|
@@ -18,7 +18,7 @@ export declare const ENI_IROSWAP_V2_FACTORY: "0xdE4360F6Cd386FD70Db1386F92013817
|
|
|
18
18
|
export declare const ENI_USDT: "0xDC1a8A35b0BaA3229b13f348ED708a2fd50b5e3a";
|
|
19
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
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)", "function totalSupply() view returns (uint256)", "function balanceOf(address) view returns (uint256)", "function lastPrice() view returns (uint256)", "function userAward(address) view returns (uint256)", "function getUserStake(address) view returns (uint256)", "function ownerAddr() view returns (address)", "function isInitialized() 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)", "function totalSupply() view returns (uint256)", "function balanceOf(address) view returns (uint256)", "function lastPrice() view returns (uint256)", "function userAward(address) view returns (uint256 deposit, uint256 debt, uint256 share, uint256 lastTimestamp, uint256 totalDeposit, uint256 totalInviteReward, uint256 lastInviteReward, uint256 pledgeNum)", "function getUserStake(address) view returns (uint256)", "function ownerAddr() view returns (address)", "function isInitialized() view returns (bool)"];
|
|
22
22
|
export declare const CREATE_PROJECT_GAS_LIMIT = 8000000n;
|
|
23
23
|
export declare const SUBSCRIBE_GAS_LIMIT = 3000000n;
|
|
24
24
|
export declare const POOL_OPERATION_GAS_LIMIT = 300000n;
|
|
@@ -81,7 +81,7 @@ export const IRO_POOL_ABI = [
|
|
|
81
81
|
'function totalSupply() view returns (uint256)',
|
|
82
82
|
'function balanceOf(address) view returns (uint256)',
|
|
83
83
|
'function lastPrice() view returns (uint256)',
|
|
84
|
-
'function userAward(address) view returns (uint256)',
|
|
84
|
+
'function userAward(address) view returns (uint256 deposit, uint256 debt, uint256 share, uint256 lastTimestamp, uint256 totalDeposit, uint256 totalInviteReward, uint256 lastInviteReward, uint256 pledgeNum)',
|
|
85
85
|
'function getUserStake(address) view returns (uint256)',
|
|
86
86
|
'function ownerAddr() view returns (address)',
|
|
87
87
|
'function isInitialized() view returns (bool)',
|
|
@@ -26,7 +26,16 @@ export declare class IroPoolQuery {
|
|
|
26
26
|
totalSupply(): Promise<bigint>;
|
|
27
27
|
balanceOf(account: string): Promise<bigint>;
|
|
28
28
|
lastPrice(): Promise<bigint>;
|
|
29
|
-
userAward(account: string): Promise<
|
|
29
|
+
userAward(account: string): Promise<{
|
|
30
|
+
deposit: bigint;
|
|
31
|
+
debt: bigint;
|
|
32
|
+
share: bigint;
|
|
33
|
+
lastTimestamp: bigint;
|
|
34
|
+
totalDeposit: bigint;
|
|
35
|
+
totalInviteReward: bigint;
|
|
36
|
+
lastInviteReward: bigint;
|
|
37
|
+
pledgeNum: bigint;
|
|
38
|
+
}>;
|
|
30
39
|
getUserStake(account: string): Promise<bigint>;
|
|
31
40
|
ownerAddr(): Promise<string>;
|
|
32
41
|
isInitialized(): Promise<boolean>;
|
|
@@ -32,7 +32,13 @@ export class IroPoolQuery {
|
|
|
32
32
|
async totalSupply() { return this.pool.totalSupply(); }
|
|
33
33
|
async balanceOf(account) { return this.pool.balanceOf(account); }
|
|
34
34
|
async lastPrice() { return this.pool.lastPrice(); }
|
|
35
|
-
async userAward(account) {
|
|
35
|
+
async userAward(account) {
|
|
36
|
+
const raw = await this.pool.userAward(account);
|
|
37
|
+
return {
|
|
38
|
+
deposit: BigInt(raw[0]), debt: BigInt(raw[1]), share: BigInt(raw[2]), lastTimestamp: BigInt(raw[3]),
|
|
39
|
+
totalDeposit: BigInt(raw[4]), totalInviteReward: BigInt(raw[5]), lastInviteReward: BigInt(raw[6]), pledgeNum: BigInt(raw[7]),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
36
42
|
async getUserStake(account) { return this.pool.getUserStake(account); }
|
|
37
43
|
async ownerAddr() { return this.pool.ownerAddr(); }
|
|
38
44
|
async isInitialized() { return this.pool.isInitialized(); }
|