@pancakeswap/pools 4.0.8 → 4.0.9

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/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ChainId } from '@pancakeswap/sdk';
2
- import { ethereumTokens, bscTokens, bscTestnetTokens, arbitrumTokens, arbitrumGoerliTokens, CAKE } from '@pancakeswap/tokens';
2
+ import { ethereumTokens, bscTokens, bscTestnetTokens, arbitrumTokens, arbitrumGoerliTokens, zksyncTokens, zkSyncTestnetTokens, CAKE } from '@pancakeswap/tokens';
3
3
  import { getAddress, getContract } from 'viem';
4
4
  import BigNumber7 from 'bignumber.js';
5
5
  import fromPairs2 from 'lodash/fromPairs';
@@ -108,6 +108,15 @@ var livePools2 = [
108
108
  tokenPerBlock: "10",
109
109
  isFinished: false
110
110
  },
111
+ {
112
+ sousId: 361,
113
+ stakingToken: bscTokens.cake,
114
+ earningToken: bscTokens.mbx,
115
+ contractAddress: "0x51ebC2F8D7Af302835A1C2Bd02111a3af573e399",
116
+ poolCategory: "Core" /* CORE */,
117
+ tokenPerBlock: "0.1118",
118
+ version: 3
119
+ },
111
120
  {
112
121
  sousId: 360,
113
122
  stakingToken: bscTokens.cake,
@@ -144,15 +153,6 @@ var livePools2 = [
144
153
  tokenPerBlock: "0.5594",
145
154
  version: 3
146
155
  },
147
- {
148
- sousId: 355,
149
- stakingToken: bscTokens.cake,
150
- earningToken: bscTokens.planet,
151
- contractAddress: "0x69Aeec4EBA2333deC563E378a6AFD5eF23437677",
152
- poolCategory: "Core" /* CORE */,
153
- tokenPerBlock: "150.4",
154
- version: 3
155
- },
156
156
  {
157
157
  sousId: 354,
158
158
  stakingToken: bscTokens.cake,
@@ -232,6 +232,22 @@ var livePools2 = [
232
232
  contractAddress: "0x5250320d765F366E2B96Cd5c7d08F1902422195e",
233
233
  poolCategory: "Core" /* CORE */,
234
234
  tokenPerBlock: "2.017"
235
+ }
236
+ ].map((p) => ({
237
+ ...p,
238
+ contractAddress: getAddress(p.contractAddress),
239
+ stakingToken: p.stakingToken.serialize,
240
+ earningToken: p.earningToken.serialize
241
+ }));
242
+ var finishedPools2 = [
243
+ {
244
+ sousId: 355,
245
+ stakingToken: bscTokens.cake,
246
+ earningToken: bscTokens.planet,
247
+ contractAddress: "0x69Aeec4EBA2333deC563E378a6AFD5eF23437677",
248
+ poolCategory: "Core" /* CORE */,
249
+ tokenPerBlock: "150.4",
250
+ version: 3
235
251
  },
236
252
  {
237
253
  sousId: 325,
@@ -241,14 +257,7 @@ var livePools2 = [
241
257
  poolCategory: "Core" /* CORE */,
242
258
  tokenPerBlock: "0.009765",
243
259
  version: 3
244
- }
245
- ].map((p) => ({
246
- ...p,
247
- contractAddress: getAddress(p.contractAddress),
248
- stakingToken: p.stakingToken.serialize,
249
- earningToken: p.earningToken.serialize
250
- }));
251
- var finishedPools2 = [
260
+ },
252
261
  {
253
262
  sousId: 345,
254
263
  stakingToken: bscTokens.cake,
@@ -3176,12 +3185,77 @@ var finishedPools5 = [
3176
3185
  earningToken: p.earningToken.serialize
3177
3186
  }));
3178
3187
  var pools5 = [...livePools5, ...finishedPools5];
3188
+ var livePools6 = [
3189
+ {
3190
+ sousId: 1,
3191
+ stakingToken: zksyncTokens.cake,
3192
+ earningToken: zksyncTokens.tes,
3193
+ contractAddress: "0xedB2E9eB4fc47d57c08B387775e09E5fC9e21EBE",
3194
+ poolCategory: "Core" /* CORE */,
3195
+ tokenPerSecond: "0.02546",
3196
+ version: 3
3197
+ }
3198
+ ].map((p) => ({
3199
+ ...p,
3200
+ contractAddress: getAddress(p.contractAddress),
3201
+ stakingToken: p.stakingToken.serialize,
3202
+ earningToken: p.earningToken.serialize
3203
+ }));
3204
+ var finishedPools6 = [];
3205
+ var pools6 = [...livePools6, ...finishedPools6];
3206
+ var livePools7 = [
3207
+ {
3208
+ sousId: 4,
3209
+ stakingToken: zkSyncTestnetTokens.cake,
3210
+ earningToken: zkSyncTestnetTokens.mock,
3211
+ contractAddress: "0x4BDFF8A608be623077E54F6916761f631e87D884",
3212
+ poolCategory: "Core" /* CORE */,
3213
+ tokenPerSecond: "0.01",
3214
+ version: 3
3215
+ },
3216
+ {
3217
+ sousId: 3,
3218
+ stakingToken: zkSyncTestnetTokens.cake,
3219
+ earningToken: zkSyncTestnetTokens.mock,
3220
+ contractAddress: "0x926E99bad2BC7dA5c0880f0bebD7f448Be86562B",
3221
+ poolCategory: "Core" /* CORE */,
3222
+ tokenPerSecond: "0.01",
3223
+ version: 3
3224
+ },
3225
+ {
3226
+ sousId: 2,
3227
+ stakingToken: zkSyncTestnetTokens.cake,
3228
+ earningToken: zkSyncTestnetTokens.mock,
3229
+ contractAddress: "0x5F7Cc0C5E3FC6e26bC98d392fa3516D4F33Df8aD",
3230
+ poolCategory: "Core" /* CORE */,
3231
+ tokenPerSecond: "0.01",
3232
+ version: 3
3233
+ },
3234
+ {
3235
+ sousId: 1,
3236
+ stakingToken: zkSyncTestnetTokens.cake,
3237
+ earningToken: zkSyncTestnetTokens.mock,
3238
+ contractAddress: "0x455d2eBbfb172CDba2D499cAf36cBbF5366F976D",
3239
+ poolCategory: "Core" /* CORE */,
3240
+ tokenPerSecond: "0.01",
3241
+ version: 3
3242
+ }
3243
+ ].map((p) => ({
3244
+ ...p,
3245
+ contractAddress: getAddress(p.contractAddress),
3246
+ stakingToken: p.stakingToken.serialize,
3247
+ earningToken: p.earningToken.serialize
3248
+ }));
3249
+ var finishedPools7 = [];
3250
+ var pools7 = [...livePools7, ...finishedPools7];
3179
3251
  var SUPPORTED_CHAIN_IDS = [
3180
3252
  ChainId.BSC,
3181
3253
  ChainId.BSC_TESTNET,
3182
3254
  ChainId.ETHEREUM,
3183
3255
  ChainId.ARBITRUM_ONE,
3184
- ChainId.ARBITRUM_GOERLI
3256
+ ChainId.ARBITRUM_GOERLI,
3257
+ ChainId.ZKSYNC,
3258
+ ChainId.ZKSYNC_TESTNET
3185
3259
  ];
3186
3260
 
3187
3261
  // src/utils/isPoolsSupported.ts
@@ -3195,14 +3269,18 @@ var POOLS_CONFIG_BY_CHAIN = {
3195
3269
  [ChainId.BSC]: pools2,
3196
3270
  [ChainId.BSC_TESTNET]: pools3,
3197
3271
  [ChainId.ARBITRUM_ONE]: pools4,
3198
- [ChainId.ARBITRUM_GOERLI]: pools5
3272
+ [ChainId.ARBITRUM_GOERLI]: pools5,
3273
+ [ChainId.ZKSYNC]: pools6,
3274
+ [ChainId.ZKSYNC_TESTNET]: pools7
3199
3275
  };
3200
3276
  var LIVE_POOLS_CONFIG_BY_CHAIN = {
3201
3277
  [ChainId.ETHEREUM]: livePools,
3202
3278
  [ChainId.BSC]: livePools2,
3203
3279
  [ChainId.BSC_TESTNET]: livePools3,
3204
3280
  [ChainId.ARBITRUM_ONE]: livePools4,
3205
- [ChainId.ARBITRUM_GOERLI]: livePools5
3281
+ [ChainId.ARBITRUM_GOERLI]: livePools5,
3282
+ [ChainId.ZKSYNC]: livePools6,
3283
+ [ChainId.ZKSYNC_TESTNET]: livePools7
3206
3284
  };
3207
3285
  var getPoolsConfig = (chainId) => {
3208
3286
  if (!isPoolsSupported(chainId)) {
@@ -3226,21 +3304,27 @@ var ICAKE = {
3226
3304
  [ChainId.BSC_TESTNET]: "0x",
3227
3305
  [ChainId.ETHEREUM]: "0x",
3228
3306
  [ChainId.ARBITRUM_ONE]: "0x",
3229
- [ChainId.ARBITRUM_GOERLI]: "0x"
3307
+ [ChainId.ARBITRUM_GOERLI]: "0x",
3308
+ [ChainId.ZKSYNC]: "0x",
3309
+ [ChainId.ZKSYNC_TESTNET]: "0x"
3230
3310
  };
3231
3311
  var CAKE_VAULT = {
3232
3312
  [ChainId.BSC]: "0x45c54210128a065de780C4B0Df3d16664f7f859e",
3233
3313
  [ChainId.BSC_TESTNET]: "0x1088Fb24053F03802F673b84d16AE1A7023E400b",
3234
3314
  [ChainId.ETHEREUM]: "0x",
3235
3315
  [ChainId.ARBITRUM_ONE]: "0x",
3236
- [ChainId.ARBITRUM_GOERLI]: "0x"
3316
+ [ChainId.ARBITRUM_GOERLI]: "0x",
3317
+ [ChainId.ZKSYNC]: "0x",
3318
+ [ChainId.ZKSYNC_TESTNET]: "0x"
3237
3319
  };
3238
3320
  var CAKE_FLEXIBLE_SIDE_VAULT = {
3239
3321
  [ChainId.BSC]: "0x615e896A8C2CA8470A2e9dc2E9552998f8658Ea0",
3240
3322
  [ChainId.BSC_TESTNET]: "0x",
3241
3323
  [ChainId.ETHEREUM]: "0x",
3242
3324
  [ChainId.ARBITRUM_ONE]: "0x",
3243
- [ChainId.ARBITRUM_GOERLI]: "0x"
3325
+ [ChainId.ARBITRUM_GOERLI]: "0x",
3326
+ [ChainId.ZKSYNC]: "0x",
3327
+ [ChainId.ZKSYNC_TESTNET]: "0x"
3244
3328
  };
3245
3329
 
3246
3330
  // src/constants/index.ts
@@ -4639,8 +4723,8 @@ function getPoolContractBySousId({ chainId, sousId, signer, publicClient }) {
4639
4723
  if (!chainId) {
4640
4724
  return null;
4641
4725
  }
4642
- const pools6 = getPoolsConfig(chainId);
4643
- const pool = pools6?.find((p) => p.sousId === Number(sousId));
4726
+ const pools8 = getPoolsConfig(chainId);
4727
+ const pool = pools8?.find((p) => p.sousId === Number(sousId));
4644
4728
  if (!pool) {
4645
4729
  return null;
4646
4730
  }
@@ -4662,11 +4746,11 @@ var getLivePoolsWithEnd = async (chainId) => {
4662
4746
  }
4663
4747
  return poolsConfig.filter((p) => p.sousId !== 0 && !p.isFinished);
4664
4748
  };
4665
- async function fetchUpgradedPoolsTimeLimits(pools6, chainId, provider) {
4666
- if (!pools6.length) {
4749
+ async function fetchUpgradedPoolsTimeLimits(pools8, chainId, provider) {
4750
+ if (!pools8.length) {
4667
4751
  return [];
4668
4752
  }
4669
- const calls = pools6.flatMap(({ contractAddress }) => {
4753
+ const calls = pools8.flatMap(({ contractAddress }) => {
4670
4754
  return [
4671
4755
  {
4672
4756
  abi: smartChefABI,
@@ -4693,7 +4777,7 @@ async function fetchUpgradedPoolsTimeLimits(pools6, chainId, provider) {
4693
4777
  resultArray[chunkIndex].push(item);
4694
4778
  return resultArray;
4695
4779
  }, []);
4696
- return pools6.map((cakePoolConfig, index) => {
4780
+ return pools8.map((cakePoolConfig, index) => {
4697
4781
  const [startTimestamp, endTimestamp] = startEndResult[index];
4698
4782
  return {
4699
4783
  sousId: cakePoolConfig.sousId,
@@ -4702,11 +4786,11 @@ async function fetchUpgradedPoolsTimeLimits(pools6, chainId, provider) {
4702
4786
  };
4703
4787
  });
4704
4788
  }
4705
- var fetchLegacyPoolsBlockLimits = async (pools6, chainId, provider) => {
4706
- if (!pools6.length) {
4789
+ var fetchLegacyPoolsBlockLimits = async (pools8, chainId, provider) => {
4790
+ if (!pools8.length) {
4707
4791
  return [];
4708
4792
  }
4709
- const startEndBlockCalls = pools6.flatMap(({ contractAddress }) => {
4793
+ const startEndBlockCalls = pools8.flatMap(({ contractAddress }) => {
4710
4794
  return [
4711
4795
  {
4712
4796
  abi: sousChefABI,
@@ -4739,7 +4823,7 @@ var fetchLegacyPoolsBlockLimits = async (pools6, chainId, provider) => {
4739
4823
  const getTimestampFromBlock = (targetBlock) => {
4740
4824
  return Number(block.timestamp) + (targetBlock - Number(block.number)) * BSC_BLOCK_TIME;
4741
4825
  };
4742
- return pools6.map((cakePoolConfig, index) => {
4826
+ return pools8.map((cakePoolConfig, index) => {
4743
4827
  const [startBlock, endBlock] = startEndBlockResult[index];
4744
4828
  return {
4745
4829
  sousId: cakePoolConfig.sousId,
@@ -4971,7 +5055,7 @@ var fetchUserBalances = async ({ account, chainId, provider }) => {
4971
5055
  return [pool.sousId, new BigNumber7(tokenBalances[pool.stakingToken.address].toString()).toJSON()];
4972
5056
  }).filter((p) => Boolean(p))
4973
5057
  );
4974
- const bnbBalanceJson = new BigNumber7(bnbBalance.result.toString()).toJSON();
5058
+ const bnbBalanceJson = new BigNumber7(bnbBalance.result?.toString()).toJSON();
4975
5059
  const bnbBalances = fromPairs2(bnbPools.map((pool) => [pool.sousId, bnbBalanceJson]));
4976
5060
  return { ...poolTokenBalances, ...bnbBalances };
4977
5061
  };