four-flap-meme-sdk 1.9.38 → 1.9.40

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.
@@ -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<bigint>;
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) { return this.pool.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(); }
@@ -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<bigint>;
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) { return this.pool.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(); }
@@ -546,8 +546,11 @@ export async function directV2BatchBuy(params) {
546
546
  ? getTokenToNativeQuote(provider, quoteToken, baseProfitWei, chain, 'v2')
547
547
  : Promise.resolve(baseProfitWei)
548
548
  ]);
549
- // 确定最终利润金额
550
- const profitWei = nativeProfitWei > 0n ? nativeProfitWei : 0n;
549
+ // 确定最终利润金额(ENI 链额外补偿利润转账的 gas 成本)
550
+ let profitWei = nativeProfitWei > 0n ? nativeProfitWei : 0n;
551
+ if (profitWei > 0n && chain.toUpperCase() === 'ENI') {
552
+ profitWei += GAS_LIMITS.NATIVE_TRANSFER * gasPrice;
553
+ }
551
554
  const gasLimit = getGasLimit(config, 250000);
552
555
  const txType = config.txType ?? 0;
553
556
  const deadline = getDeadline();
@@ -843,7 +846,10 @@ export async function directV2BatchSell(params) {
843
846
  Promise.all(signPromises),
844
847
  nativeProfitPromise
845
848
  ]);
846
- const profitWei = nativeProfitWei > 0n ? nativeProfitWei : 0n;
849
+ let profitWei = nativeProfitWei > 0n ? nativeProfitWei : 0n;
850
+ if (profitWei > 0n && chain.toUpperCase() === 'ENI') {
851
+ profitWei += GAS_LIMITS.NATIVE_TRANSFER * gasPrice;
852
+ }
847
853
  // ✅ 检查是否使用分布式利润模式
848
854
  const profitMode = config.profitMode || 'single';
849
855
  const skipProfit = config.skipProfit === true;
@@ -949,7 +955,10 @@ export async function directV3BatchBuy(params) {
949
955
  : getTokenToNativeQuote(provider, quoteToken, baseProfitWei, chain, 'v3', fee))
950
956
  : Promise.resolve(baseProfitWei)
951
957
  ]);
952
- const profitWei = nativeProfitWei > 0n ? nativeProfitWei : 0n;
958
+ let profitWei = nativeProfitWei > 0n ? nativeProfitWei : 0n;
959
+ if (profitWei > 0n && chain.toUpperCase() === 'ENI') {
960
+ profitWei += GAS_LIMITS.NATIVE_TRANSFER * gasPrice;
961
+ }
953
962
  const gasLimit = getGasLimit(config, 300000);
954
963
  const txType = config.txType ?? 0;
955
964
  const routerIface = new ethers.Interface(routerAbi);
@@ -1184,7 +1193,10 @@ export async function directV3BatchSell(params) {
1184
1193
  Promise.all(signPromises),
1185
1194
  nativeProfitPromise
1186
1195
  ]);
1187
- const profitWei = nativeProfitWei > 0n ? nativeProfitWei : 0n;
1196
+ let profitWei = nativeProfitWei > 0n ? nativeProfitWei : 0n;
1197
+ if (profitWei > 0n && chain.toUpperCase() === 'ENI') {
1198
+ profitWei += GAS_LIMITS.NATIVE_TRANSFER * gasPrice;
1199
+ }
1188
1200
  // ✅ 检查是否使用分布式利润模式
1189
1201
  const profitMode = config.profitMode || 'single';
1190
1202
  const skipProfit = config.skipProfit === true;
@@ -714,7 +714,10 @@ export async function holdersMaker(params) {
714
714
  : buyAmountWei * BigInt(holdersCount);
715
715
  const profitRateBps = PROFIT_CONFIG.RATE_BPS;
716
716
  const totalProfit = (totalBuyAmountForProfit * BigInt(profitRateBps)) / 10000n;
717
- const profitPerBatch = totalProfit / BigInt(walletBatches.length);
717
+ let profitPerBatch = totalProfit / BigInt(walletBatches.length);
718
+ if (profitPerBatch > 0n && chain === 'ENI') {
719
+ profitPerBatch += NATIVE_TRANSFER_GAS_LIMIT * gasPrice;
720
+ }
718
721
  // 利润计算完成
719
722
  // 6. 生成分发多跳路径(如果启用)
720
723
  let allDisperseHopWallets = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.9.38",
3
+ "version": "1.9.40",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",