@curvefi/api 2.63.9 → 2.64.0

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.
Files changed (77) hide show
  1. package/lib/constants/coins/arbitrum.d.ts +0 -4
  2. package/lib/constants/coins/arbitrum.js +0 -4
  3. package/lib/constants/coins/aurora.d.ts +0 -4
  4. package/lib/constants/coins/aurora.js +0 -4
  5. package/lib/constants/coins/avalanche.d.ts +0 -3
  6. package/lib/constants/coins/avalanche.js +0 -3
  7. package/lib/constants/coins/base.d.ts +0 -4
  8. package/lib/constants/coins/base.js +0 -4
  9. package/lib/constants/coins/bsc.d.ts +0 -4
  10. package/lib/constants/coins/bsc.js +0 -4
  11. package/lib/constants/coins/celo.d.ts +0 -4
  12. package/lib/constants/coins/celo.js +0 -4
  13. package/lib/constants/coins/fantom.d.ts +0 -2
  14. package/lib/constants/coins/fantom.js +0 -2
  15. package/lib/constants/coins/fraxtal.d.ts +0 -4
  16. package/lib/constants/coins/fraxtal.js +0 -4
  17. package/lib/constants/coins/index.d.ts +18 -0
  18. package/lib/constants/coins/index.js +18 -0
  19. package/lib/constants/coins/kava.d.ts +0 -4
  20. package/lib/constants/coins/kava.js +0 -4
  21. package/lib/constants/coins/mantle.d.ts +0 -4
  22. package/lib/constants/coins/mantle.js +0 -4
  23. package/lib/constants/coins/moonbeam.d.ts +0 -4
  24. package/lib/constants/coins/moonbeam.js +0 -4
  25. package/lib/constants/coins/optimism.d.ts +0 -4
  26. package/lib/constants/coins/optimism.js +0 -4
  27. package/lib/constants/coins/polygon.d.ts +0 -3
  28. package/lib/constants/coins/polygon.js +0 -3
  29. package/lib/constants/coins/xdai.d.ts +0 -4
  30. package/lib/constants/coins/xdai.js +0 -4
  31. package/lib/constants/coins/xlayer.d.ts +0 -4
  32. package/lib/constants/coins/xlayer.js +0 -4
  33. package/lib/constants/coins/zksync.d.ts +0 -4
  34. package/lib/constants/coins/zksync.js +0 -4
  35. package/lib/constants/{tricryptoDeployImplementations.d.ts → factory/crypto.d.ts} +21 -0
  36. package/lib/constants/{tricryptoDeployImplementations.js → factory/crypto.js} +85 -0
  37. package/lib/constants/factory/index.d.ts +3 -0
  38. package/lib/constants/factory/index.js +3 -0
  39. package/lib/{factory/constants.d.ts → constants/factory/stable.d.ts} +6 -52
  40. package/lib/{factory/constants.js → constants/factory/stable.js} +41 -151
  41. package/lib/constants/network_constants.d.ts +3 -0
  42. package/lib/constants/{aliases.js → network_constants.js} +253 -96
  43. package/lib/curve.d.ts +22 -16
  44. package/lib/curve.js +94 -362
  45. package/lib/external-api.d.ts +5 -3
  46. package/lib/external-api.js +86 -12
  47. package/lib/factory/common.js +2 -3
  48. package/lib/factory/deploy.js +7 -6
  49. package/lib/factory/factory-api.js +53 -61
  50. package/lib/factory/factory-crypto.js +3 -3
  51. package/lib/factory/factory-tricrypto.js +2 -2
  52. package/lib/factory/factory.js +22 -11
  53. package/lib/index.d.ts +1 -0
  54. package/lib/index.js +2 -1
  55. package/lib/interfaces.d.ts +26 -1
  56. package/lib/pools/PoolTemplate.d.ts +9 -82
  57. package/lib/pools/PoolTemplate.js +37 -379
  58. package/lib/pools/mixins/depositBalancedAmountsMixins.js +3 -3
  59. package/lib/pools/mixins/poolBalancesMixin.d.ts +3 -3
  60. package/lib/pools/mixins/poolBalancesMixin.js +11 -11
  61. package/lib/pools/poolConstructor.js +14 -7
  62. package/lib/pools/subClasses/corePool.d.ts +68 -0
  63. package/lib/pools/subClasses/corePool.js +39 -0
  64. package/lib/pools/{gaugePool.d.ts → subClasses/gaugePool.d.ts} +1 -1
  65. package/lib/pools/{gaugePool.js → subClasses/gaugePool.js} +2 -2
  66. package/lib/pools/subClasses/statsPool.d.ts +45 -0
  67. package/lib/pools/subClasses/statsPool.js +227 -0
  68. package/lib/pools/subClasses/walletPool.d.ts +19 -0
  69. package/lib/pools/subClasses/walletPool.js +72 -0
  70. package/lib/pools/utils.d.ts +1 -0
  71. package/lib/pools/utils.js +36 -0
  72. package/lib/utils.d.ts +10 -1
  73. package/lib/utils.js +45 -7
  74. package/package.json +1 -1
  75. package/lib/constants/aliases.d.ts +0 -17
  76. package/lib/factory/constants-crypto.d.ts +0 -90
  77. package/lib/factory/constants-crypto.js +0 -122
package/lib/curve.js CHANGED
@@ -9,6 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { ethers, Contract, AbstractProvider, } from "ethers";
11
11
  import { Provider as MulticallProvider, Contract as MulticallContract } from "@curvefi/ethcall";
12
+ import { NETWORK_CONSTANTS } from "./constants/network_constants.js";
13
+ import { STABLE_FACTORY_CONSTANTS, CRYPTO_FACTORY_CONSTANTS } from "./constants/factory/index.js";
12
14
  import { getFactoryPoolData } from "./factory/factory.js";
13
15
  import { getFactoryPoolsDataFromApi } from "./factory/factory-api.js";
14
16
  import { getCryptoFactoryPoolData } from "./factory/factory-crypto.js";
@@ -44,30 +46,12 @@ import gasOracleABI from './constants/abis/gas_oracle_optimism.json' assert { ty
44
46
  import gasOracleBlobABI from './constants/abis/gas_oracle_optimism_blob.json' assert { type: 'json' };
45
47
  import votingProposalABI from './constants/abis/voting_proposal.json' assert { type: 'json' };
46
48
  import circulatingSupplyABI from './constants/abis/circulating_supply.json' assert { type: 'json' };
47
- import rootGaugeFactoryABI from "./constants/abis/gauge_factory/root_gauge_factory.json";
48
- import { POOLS_DATA_ETHEREUM, LLAMMAS_DATA_ETHEREUM, POOLS_DATA_POLYGON, POOLS_DATA_FANTOM, POOLS_DATA_AVALANCHE, POOLS_DATA_ARBITRUM, POOLS_DATA_OPTIMISM, POOLS_DATA_XDAI, POOLS_DATA_MOONBEAM, POOLS_DATA_AURORA, POOLS_DATA_KAVA, POOLS_DATA_CELO, POOLS_DATA_ZKSYNC, POOLS_DATA_BASE, POOLS_DATA_BSC, POOLS_DATA_FRAXTAL, POOLS_DATA_XLAYER, POOLS_DATA_MANTLE, } from './constants/pools/index.js';
49
- import { ALIASES_ETHEREUM, ALIASES_OPTIMISM, ALIASES_POLYGON, ALIASES_FANTOM, ALIASES_AVALANCHE, ALIASES_ARBITRUM, ALIASES_XDAI, ALIASES_MOONBEAM, ALIASES_AURORA, ALIASES_KAVA, ALIASES_CELO, ALIASES_ZKSYNC, ALIASES_BASE, ALIASES_BSC, ALIASES_FRAXTAL, ALIASES_XLAYER, ALIASES_MANTLE, } from "./constants/aliases.js";
50
- import { COINS_ETHEREUM, cTokensEthereum, yTokensEthereum, ycTokensEthereum, aTokensEthereum } from "./constants/coins/ethereum.js";
51
- import { COINS_OPTIMISM, cTokensOptimism, yTokensOptimism, ycTokensOptimism, aTokensOptimism } from "./constants/coins/optimism.js";
52
- import { COINS_POLYGON, cTokensPolygon, yTokensPolygon, ycTokensPolygon, aTokensPolygon } from "./constants/coins/polygon.js";
53
- import { COINS_FANTOM, cTokensFantom, yTokensFantom, ycTokensFantom, aTokensFantom } from "./constants/coins/fantom.js";
54
- import { COINS_AVALANCHE, cTokensAvalanche, yTokensAvalanche, ycTokensAvalanche, aTokensAvalanche } from "./constants/coins/avalanche.js";
55
- import { COINS_ARBITRUM, cTokensArbitrum, yTokensArbitrum, ycTokensArbitrum, aTokensArbitrum } from "./constants/coins/arbitrum.js";
56
- import { COINS_XDAI, cTokensXDai, yTokensXDai, ycTokensXDai, aTokensXDai } from "./constants/coins/xdai.js";
57
- import { COINS_MOONBEAM, cTokensMoonbeam, yTokensMoonbeam, ycTokensMoonbeam, aTokensMoonbeam } from "./constants/coins/moonbeam.js";
58
- import { COINS_AURORA, cTokensAurora, yTokensAurora, ycTokensAurora, aTokensAurora } from "./constants/coins/aurora.js";
59
- import { COINS_KAVA, cTokensKava, yTokensKava, ycTokensKava, aTokensKava } from "./constants/coins/kava.js";
60
- import { COINS_CELO, cTokensCelo, yTokensCelo, ycTokensCelo, aTokensCelo } from "./constants/coins/celo.js";
61
- import { COINS_ZKSYNC, cTokensZkSync, yTokensZkSync, ycTokensZkSync, aTokensZkSync } from "./constants/coins/zksync.js";
62
- import { COINS_BASE, cTokensBase, yTokensBase, ycTokensBase, aTokensBase } from "./constants/coins/base.js";
63
- import { COINS_BSC, cTokensBsc, yTokensBsc, ycTokensBsc, aTokensBsc } from "./constants/coins/bsc.js";
64
- import { COINS_FRAXTAL, cTokensFraxtal, yTokensFraxtal, ycTokensFraxtal, aTokensFraxtal } from "./constants/coins/fraxtal.js";
65
- import { COINS_XLAYER, cTokensXLayer, yTokensXLayer, ycTokensXLayer, aTokensXLayer } from "./constants/coins/xlayer.js";
66
- import { COINS_MANTLE, cTokensMantle, yTokensMantle, ycTokensMantle, aTokensMantle } from "./constants/coins/mantle.js";
49
+ import rootGaugeFactoryABI from "./constants/abis/gauge_factory/root_gauge_factory.json" assert { type: 'json' };
67
50
  import { lowerCasePoolDataAddresses, extractDecimals, extractGauges } from "./constants/utils.js";
68
51
  import { _getHiddenPools } from "./external-api.js";
69
52
  import { L2Networks } from "./constants/L2Networks.js";
70
53
  import { getTwocryptoFactoryPoolData } from "./factory/factory-twocrypto.js";
54
+ import { getNetworkConstants } from "./utils.js";
71
55
  export const memoizedContract = () => {
72
56
  const cache = {};
73
57
  return (address, abi, provider) => {
@@ -94,290 +78,12 @@ export const memoizedMulticallContract = () => {
94
78
  }
95
79
  };
96
80
  };
97
- export const NATIVE_TOKENS = {
98
- 1: {
99
- symbol: 'ETH',
100
- wrappedSymbol: 'WETH',
101
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
102
- wrappedAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'.toLowerCase(),
103
- },
104
- 10: {
105
- symbol: 'ETH',
106
- wrappedSymbol: 'WETH',
107
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
108
- wrappedAddress: '0x4200000000000000000000000000000000000006'.toLowerCase(),
109
- },
110
- 56: {
111
- symbol: 'BNB',
112
- wrappedSymbol: 'WBNB',
113
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
114
- wrappedAddress: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c'.toLowerCase(),
115
- },
116
- 100: {
117
- symbol: 'XDAi',
118
- wrappedSymbol: 'WXDAI',
119
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
120
- wrappedAddress: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d'.toLowerCase(),
121
- },
122
- 137: {
123
- symbol: 'MATIC',
124
- wrappedSymbol: 'WMATIC',
125
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
126
- wrappedAddress: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'.toLowerCase(),
127
- },
128
- 196: {
129
- symbol: 'OKB',
130
- wrappedSymbol: 'WOKB',
131
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
132
- wrappedAddress: '0xe538905cf8410324e03a5a23c1c177a474d59b2b'.toLowerCase(),
133
- },
134
- 250: {
135
- symbol: 'FTM',
136
- wrappedSymbol: 'WFTM',
137
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
138
- wrappedAddress: '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83'.toLowerCase(),
139
- },
140
- 252: {
141
- symbol: 'frxETH',
142
- wrappedSymbol: 'wfrxETH',
143
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
144
- wrappedAddress: '0xfc00000000000000000000000000000000000006'.toLowerCase(),
145
- },
146
- 324: {
147
- symbol: 'ETH',
148
- wrappedSymbol: 'WETH',
149
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
150
- wrappedAddress: '0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91'.toLowerCase(),
151
- },
152
- 1284: {
153
- symbol: 'GLMR',
154
- wrappedSymbol: 'WGLMR',
155
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
156
- wrappedAddress: '0xAcc15dC74880C9944775448304B263D191c6077F'.toLowerCase(),
157
- },
158
- 2222: {
159
- symbol: 'KAVA',
160
- wrappedSymbol: 'WKAVA',
161
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
162
- wrappedAddress: '0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b'.toLowerCase(),
163
- },
164
- 5000: {
165
- symbol: 'MNT',
166
- wrappedSymbol: 'WMNT',
167
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
168
- wrappedAddress: '0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8'.toLowerCase(),
169
- },
170
- 8453: {
171
- symbol: 'ETH',
172
- wrappedSymbol: 'WETH',
173
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
174
- wrappedAddress: '0x4200000000000000000000000000000000000006'.toLowerCase(),
175
- },
176
- 42161: {
177
- symbol: 'ETH',
178
- wrappedSymbol: 'WETH',
179
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
180
- wrappedAddress: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1'.toLowerCase(),
181
- },
182
- 42220: {
183
- symbol: 'CELO',
184
- wrappedSymbol: 'WCELO',
185
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
186
- wrappedAddress: '0x3Ad443d769A07f287806874F8E5405cE3Ac902b9'.toLowerCase(),
187
- },
188
- 43114: {
189
- symbol: 'AVAX',
190
- wrappedSymbol: 'WAVAX',
191
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
192
- wrappedAddress: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7'.toLowerCase(),
193
- },
194
- 1313161554: {
195
- symbol: 'ETH',
196
- wrappedSymbol: 'WETH',
197
- address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
198
- wrappedAddress: '0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB'.toLowerCase(),
199
- },
200
- };
201
- export const NETWORK_CONSTANTS = {
202
- 1: {
203
- NAME: 'ethereum',
204
- ALIASES: ALIASES_ETHEREUM,
205
- POOLS_DATA: POOLS_DATA_ETHEREUM,
206
- LLAMMAS_DATA: LLAMMAS_DATA_ETHEREUM,
207
- COINS: COINS_ETHEREUM,
208
- cTokens: cTokensEthereum,
209
- yTokens: yTokensEthereum,
210
- ycTokens: ycTokensEthereum,
211
- aTokens: aTokensEthereum,
212
- },
213
- 10: {
214
- NAME: 'optimism',
215
- ALIASES: ALIASES_OPTIMISM,
216
- POOLS_DATA: POOLS_DATA_OPTIMISM,
217
- COINS: COINS_OPTIMISM,
218
- cTokens: cTokensOptimism,
219
- yTokens: yTokensOptimism,
220
- ycTokens: ycTokensOptimism,
221
- aTokens: aTokensOptimism,
222
- },
223
- 56: {
224
- NAME: 'bsc',
225
- ALIASES: ALIASES_BSC,
226
- POOLS_DATA: POOLS_DATA_BSC,
227
- COINS: COINS_BSC,
228
- cTokens: cTokensBsc,
229
- yTokens: yTokensBsc,
230
- ycTokens: ycTokensBsc,
231
- aTokens: aTokensBsc,
232
- },
233
- 100: {
234
- NAME: 'xdai',
235
- ALIASES: ALIASES_XDAI,
236
- POOLS_DATA: POOLS_DATA_XDAI,
237
- COINS: COINS_XDAI,
238
- cTokens: cTokensXDai,
239
- yTokens: yTokensXDai,
240
- ycTokens: ycTokensXDai,
241
- aTokens: aTokensXDai,
242
- },
243
- 137: {
244
- NAME: 'polygon',
245
- ALIASES: ALIASES_POLYGON,
246
- POOLS_DATA: POOLS_DATA_POLYGON,
247
- COINS: COINS_POLYGON,
248
- cTokens: cTokensPolygon,
249
- yTokens: yTokensPolygon,
250
- ycTokens: ycTokensPolygon,
251
- aTokens: aTokensPolygon,
252
- },
253
- 196: {
254
- NAME: 'x-layer',
255
- ALIASES: ALIASES_XLAYER,
256
- POOLS_DATA: POOLS_DATA_XLAYER,
257
- COINS: COINS_XLAYER,
258
- cTokens: cTokensXLayer,
259
- yTokens: yTokensXLayer,
260
- ycTokens: ycTokensXLayer,
261
- aTokens: aTokensXLayer,
262
- },
263
- 250: {
264
- NAME: 'fantom',
265
- ALIASES: ALIASES_FANTOM,
266
- POOLS_DATA: POOLS_DATA_FANTOM,
267
- COINS: COINS_FANTOM,
268
- cTokens: cTokensFantom,
269
- yTokens: yTokensFantom,
270
- ycTokens: ycTokensFantom,
271
- aTokens: aTokensFantom,
272
- },
273
- 252: {
274
- NAME: 'fraxtal',
275
- ALIASES: ALIASES_FRAXTAL,
276
- POOLS_DATA: POOLS_DATA_FRAXTAL,
277
- COINS: COINS_FRAXTAL,
278
- cTokens: cTokensFraxtal,
279
- yTokens: yTokensFraxtal,
280
- ycTokens: ycTokensFraxtal,
281
- aTokens: aTokensFraxtal,
282
- },
283
- 324: {
284
- NAME: 'zksync',
285
- ALIASES: ALIASES_ZKSYNC,
286
- POOLS_DATA: POOLS_DATA_ZKSYNC,
287
- COINS: COINS_ZKSYNC,
288
- cTokens: cTokensZkSync,
289
- yTokens: yTokensZkSync,
290
- ycTokens: ycTokensZkSync,
291
- aTokens: aTokensZkSync,
292
- },
293
- 1284: {
294
- NAME: 'moonbeam',
295
- ALIASES: ALIASES_MOONBEAM,
296
- POOLS_DATA: POOLS_DATA_MOONBEAM,
297
- COINS: COINS_MOONBEAM,
298
- cTokens: cTokensMoonbeam,
299
- yTokens: yTokensMoonbeam,
300
- ycTokens: ycTokensMoonbeam,
301
- aTokens: aTokensMoonbeam,
302
- },
303
- 2222: {
304
- NAME: 'kava',
305
- ALIASES: ALIASES_KAVA,
306
- POOLS_DATA: POOLS_DATA_KAVA,
307
- COINS: COINS_KAVA,
308
- cTokens: cTokensKava,
309
- yTokens: yTokensKava,
310
- ycTokens: ycTokensKava,
311
- aTokens: aTokensKava,
312
- },
313
- 5000: {
314
- NAME: 'mantle',
315
- ALIASES: ALIASES_MANTLE,
316
- POOLS_DATA: POOLS_DATA_MANTLE,
317
- COINS: COINS_MANTLE,
318
- cTokens: cTokensMantle,
319
- yTokens: yTokensMantle,
320
- ycTokens: ycTokensMantle,
321
- aTokens: aTokensMantle,
322
- },
323
- 8453: {
324
- NAME: 'base',
325
- ALIASES: ALIASES_BASE,
326
- POOLS_DATA: POOLS_DATA_BASE,
327
- COINS: COINS_BASE,
328
- cTokens: cTokensBase,
329
- yTokens: yTokensBase,
330
- ycTokens: ycTokensBase,
331
- aTokens: aTokensBase,
332
- },
333
- 42161: {
334
- NAME: 'arbitrum',
335
- ALIASES: ALIASES_ARBITRUM,
336
- POOLS_DATA: POOLS_DATA_ARBITRUM,
337
- COINS: COINS_ARBITRUM,
338
- cTokens: cTokensArbitrum,
339
- yTokens: yTokensArbitrum,
340
- ycTokens: ycTokensArbitrum,
341
- aTokens: aTokensArbitrum,
342
- },
343
- 42220: {
344
- NAME: 'celo',
345
- ALIASES: ALIASES_CELO,
346
- POOLS_DATA: POOLS_DATA_CELO,
347
- COINS: COINS_CELO,
348
- cTokens: cTokensCelo,
349
- yTokens: yTokensCelo,
350
- ycTokens: ycTokensCelo,
351
- aTokens: aTokensCelo,
352
- },
353
- 43114: {
354
- NAME: 'avalanche',
355
- ALIASES: ALIASES_AVALANCHE,
356
- POOLS_DATA: POOLS_DATA_AVALANCHE,
357
- COINS: COINS_AVALANCHE,
358
- cTokens: cTokensAvalanche,
359
- yTokens: yTokensAvalanche,
360
- ycTokens: ycTokensAvalanche,
361
- aTokens: aTokensAvalanche,
362
- },
363
- 1313161554: {
364
- NAME: 'aurora',
365
- ALIASES: ALIASES_AURORA,
366
- POOLS_DATA: POOLS_DATA_AURORA,
367
- COINS: COINS_AURORA,
368
- cTokens: cTokensAurora,
369
- yTokens: yTokensAurora,
370
- ycTokens: ycTokensAurora,
371
- aTokens: aTokensAurora,
372
- },
373
- };
374
- const OLD_CHAINS = [1, 10, 56, 100, 137, 250, 1284, 2222, 8453, 42161, 42220, 43114, 1313161554]; // these chains have non-ng pools
375
81
  class Curve {
376
82
  constructor() {
377
83
  this.initContract = memoizedContract();
378
84
  this.initMulticallContract = memoizedMulticallContract();
379
85
  this.fetchFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
380
- if ([196, 252, 324, 5000, 1313161554].includes(this.chainId))
86
+ if (!("factory" in this.constants.ALIASES))
381
87
  return;
382
88
  if (useApi) {
383
89
  this.constants.FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory"));
@@ -390,7 +96,7 @@ class Curve {
390
96
  this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory"] = yield this.contracts[this.constants.ALIASES.factory].contract.gauge_implementation(this.constantOptions);
391
97
  });
392
98
  this.fetchCrvusdFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
393
- if (this.chainId != 1)
99
+ if (!("crvusd_factory" in this.constants.ALIASES))
394
100
  return;
395
101
  if (useApi) {
396
102
  this.constants.CRVUSD_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory-crvusd"));
@@ -402,7 +108,7 @@ class Curve {
402
108
  this._updateDecimalsAndGauges(this.constants.CRVUSD_FACTORY_POOLS_DATA);
403
109
  });
404
110
  this.fetchEywaFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
405
- if (this.chainId != 250)
111
+ if (!("eywa_factory" in this.constants.ALIASES))
406
112
  return;
407
113
  if (useApi) {
408
114
  this.constants.EYWA_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory-eywa"));
@@ -414,7 +120,7 @@ class Curve {
414
120
  this._updateDecimalsAndGauges(this.constants.EYWA_FACTORY_POOLS_DATA);
415
121
  });
416
122
  this.fetchCryptoFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
417
- if (![1, 56, 137, 250, 5000, 8453].includes(this.chainId))
123
+ if (!("crypto_factory" in this.constants.ALIASES))
418
124
  return;
419
125
  if (useApi) {
420
126
  this.constants.CRYPTO_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory-crypto"));
@@ -426,8 +132,20 @@ class Curve {
426
132
  this._updateDecimalsAndGauges(this.constants.CRYPTO_FACTORY_POOLS_DATA);
427
133
  this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-crypto"] = yield this.contracts[this.constants.ALIASES.crypto_factory].contract.gauge_implementation(this.constantOptions);
428
134
  });
135
+ this.fetchStableNgFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
136
+ if (!("stable_ng_factory" in this.constants.ALIASES))
137
+ return;
138
+ if (useApi) {
139
+ this.constants.STABLE_NG_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory-stable-ng"));
140
+ }
141
+ else {
142
+ this.constants.STABLE_NG_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, 0, undefined, this.constants.ALIASES.stable_ng_factory));
143
+ }
144
+ this.constants.STABLE_NG_FACTORY_POOLS_DATA = yield this._filterHiddenPools(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
145
+ this._updateDecimalsAndGauges(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
146
+ });
429
147
  this.fetchTworyptoFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
430
- if ([1284].includes(this.chainId))
148
+ if (!("twocrypto_factory" in this.constants.ALIASES))
431
149
  return;
432
150
  if (useApi) {
433
151
  this.constants.TWOCRYPTO_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory-twocrypto"));
@@ -437,10 +155,17 @@ class Curve {
437
155
  }
438
156
  this.constants.TWOCRYPTO_FACTORY_POOLS_DATA = yield this._filterHiddenPools(this.constants.TWOCRYPTO_FACTORY_POOLS_DATA);
439
157
  this._updateDecimalsAndGauges(this.constants.TWOCRYPTO_FACTORY_POOLS_DATA);
440
- this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-twocrypto"] = yield this.contracts[this.constants.ALIASES.twocrypto_factory].contract.gauge_implementation(this.constantOptions);
158
+ if (this.chainId === 1) {
159
+ this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-twocrypto"] =
160
+ yield this.contracts[this.constants.ALIASES.twocrypto_factory].contract.gauge_implementation(this.constantOptions);
161
+ }
162
+ else {
163
+ this.constants.FACTORY_GAUGE_IMPLEMENTATIONS["factory-twocrypto"] =
164
+ yield this.contracts[this.constants.ALIASES.child_gauge_factory].contract.get_implementation(this.constantOptions);
165
+ }
441
166
  });
442
167
  this.fetchTricryptoFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
443
- if ([1284].includes(this.chainId))
168
+ if (!("tricrypto_factory" in this.constants.ALIASES))
444
169
  return;
445
170
  if (useApi) {
446
171
  this.constants.TRICRYPTO_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory-tricrypto"));
@@ -459,20 +184,8 @@ class Curve {
459
184
  yield this.contracts[this.constants.ALIASES.child_gauge_factory].contract.get_implementation(this.constantOptions);
460
185
  }
461
186
  });
462
- this.fetchStableNgFactoryPools = (useApi = true) => __awaiter(this, void 0, void 0, function* () {
463
- if (this.chainId === 1313161554)
464
- return;
465
- if (useApi) {
466
- this.constants.STABLE_NG_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolsDataFromApi.call(this, "factory-stable-ng"));
467
- }
468
- else {
469
- this.constants.STABLE_NG_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, 0, undefined, this.constants.ALIASES.stable_ng_factory));
470
- }
471
- this.constants.STABLE_NG_FACTORY_POOLS_DATA = yield this._filterHiddenPools(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
472
- this._updateDecimalsAndGauges(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
473
- });
474
187
  this.fetchNewFactoryPools = () => __awaiter(this, void 0, void 0, function* () {
475
- if ([196, 252, 1313161554].includes(this.chainId))
188
+ if (!("factory" in this.constants.ALIASES))
476
189
  return [];
477
190
  const currentPoolIds = Object.keys(this.constants.FACTORY_POOLS_DATA);
478
191
  const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
@@ -481,16 +194,8 @@ class Curve {
481
194
  this._updateDecimalsAndGauges(this.constants.FACTORY_POOLS_DATA);
482
195
  return Object.keys(poolData);
483
196
  });
484
- this.fetchNewStableNgFactoryPools = () => __awaiter(this, void 0, void 0, function* () {
485
- const currentPoolIds = Object.keys(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
486
- const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[3]);
487
- const poolData = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, lastPoolIdx + 1, undefined, this.constants.ALIASES.stable_ng_factory));
488
- this.constants.STABLE_NG_FACTORY_POOLS_DATA = Object.assign(Object.assign({}, this.constants.STABLE_NG_FACTORY_POOLS_DATA), poolData);
489
- this._updateDecimalsAndGauges(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
490
- return Object.keys(poolData);
491
- });
492
197
  this.fetchNewCryptoFactoryPools = () => __awaiter(this, void 0, void 0, function* () {
493
- if (![1, 56, 137, 250, 8453].includes(this.chainId))
198
+ if (!("crypto_factory" in this.constants.ALIASES))
494
199
  return [];
495
200
  const currentPoolIds = Object.keys(this.constants.CRYPTO_FACTORY_POOLS_DATA);
496
201
  const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
@@ -499,8 +204,18 @@ class Curve {
499
204
  this._updateDecimalsAndGauges(this.constants.CRYPTO_FACTORY_POOLS_DATA);
500
205
  return Object.keys(poolData);
501
206
  });
207
+ this.fetchNewStableNgFactoryPools = () => __awaiter(this, void 0, void 0, function* () {
208
+ if (!("stable_ng_factory" in this.constants.ALIASES))
209
+ return [];
210
+ const currentPoolIds = Object.keys(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
211
+ const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[3]);
212
+ const poolData = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, lastPoolIdx + 1, undefined, this.constants.ALIASES.stable_ng_factory));
213
+ this.constants.STABLE_NG_FACTORY_POOLS_DATA = Object.assign(Object.assign({}, this.constants.STABLE_NG_FACTORY_POOLS_DATA), poolData);
214
+ this._updateDecimalsAndGauges(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
215
+ return Object.keys(poolData);
216
+ });
502
217
  this.fetchNewTwocryptoFactoryPools = () => __awaiter(this, void 0, void 0, function* () {
503
- if ([1284].includes(this.chainId))
218
+ if (!("twocrypto_factory" in this.constants.ALIASES))
504
219
  return [];
505
220
  const currentPoolIds = Object.keys(this.constants.TWOCRYPTO_FACTORY_POOLS_DATA);
506
221
  const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
@@ -510,7 +225,7 @@ class Curve {
510
225
  return Object.keys(poolData);
511
226
  });
512
227
  this.fetchNewTricryptoFactoryPools = () => __awaiter(this, void 0, void 0, function* () {
513
- if ([1284].includes(this.chainId))
228
+ if (!("tricrypto_factory" in this.constants.ALIASES))
514
229
  return [];
515
230
  const currentPoolIds = Object.keys(this.constants.TRICRYPTO_FACTORY_POOLS_DATA);
516
231
  const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
@@ -520,31 +235,31 @@ class Curve {
520
235
  return Object.keys(poolData);
521
236
  });
522
237
  this.fetchRecentlyDeployedFactoryPool = (poolAddress) => __awaiter(this, void 0, void 0, function* () {
523
- if ([196, 252, 1313161554].includes(this.chainId))
238
+ if (!("factory" in this.constants.ALIASES))
524
239
  return '';
525
240
  const poolData = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, 0, poolAddress));
526
241
  this.constants.FACTORY_POOLS_DATA = Object.assign(Object.assign({}, this.constants.FACTORY_POOLS_DATA), poolData);
527
242
  this._updateDecimalsAndGauges(this.constants.FACTORY_POOLS_DATA);
528
243
  return Object.keys(poolData)[0]; // id
529
244
  });
530
- this.fetchRecentlyDeployedStableNgFactoryPool = (poolAddress) => __awaiter(this, void 0, void 0, function* () {
531
- if (this.chainId === 1313161554)
532
- return '';
533
- const poolData = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, 0, poolAddress, this.constants.ALIASES.stable_ng_factory));
534
- this.constants.STABLE_NG_FACTORY_POOLS_DATA = Object.assign(Object.assign({}, this.constants.STABLE_NG_FACTORY_POOLS_DATA), poolData);
535
- this._updateDecimalsAndGauges(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
536
- return Object.keys(poolData)[0]; // id
537
- });
538
245
  this.fetchRecentlyDeployedCryptoFactoryPool = (poolAddress) => __awaiter(this, void 0, void 0, function* () {
539
- if (![1, 56, 137, 250, 8453].includes(this.chainId))
246
+ if (!("crypto_factory" in this.constants.ALIASES))
540
247
  return '';
541
248
  const poolData = lowerCasePoolDataAddresses(yield getCryptoFactoryPoolData.call(this, 0, poolAddress));
542
249
  this.constants.CRYPTO_FACTORY_POOLS_DATA = Object.assign(Object.assign({}, this.constants.CRYPTO_FACTORY_POOLS_DATA), poolData);
543
250
  this._updateDecimalsAndGauges(this.constants.CRYPTO_FACTORY_POOLS_DATA);
544
251
  return Object.keys(poolData)[0]; // id
545
252
  });
253
+ this.fetchRecentlyDeployedStableNgFactoryPool = (poolAddress) => __awaiter(this, void 0, void 0, function* () {
254
+ if (!("stable_ng_factory" in this.constants.ALIASES))
255
+ return '';
256
+ const poolData = lowerCasePoolDataAddresses(yield getFactoryPoolData.call(this, 0, poolAddress, this.constants.ALIASES.stable_ng_factory));
257
+ this.constants.STABLE_NG_FACTORY_POOLS_DATA = Object.assign(Object.assign({}, this.constants.STABLE_NG_FACTORY_POOLS_DATA), poolData);
258
+ this._updateDecimalsAndGauges(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
259
+ return Object.keys(poolData)[0]; // id
260
+ });
546
261
  this.fetchRecentlyDeployedTwocryptoFactoryPool = (poolAddress) => __awaiter(this, void 0, void 0, function* () {
547
- if ([1284].includes(this.chainId))
262
+ if (!("twocrypto_factory" in this.constants.ALIASES))
548
263
  return '';
549
264
  const poolData = lowerCasePoolDataAddresses(yield getTwocryptoFactoryPoolData.call(this, 0, poolAddress));
550
265
  this.constants.TWOCRYPTO_FACTORY_POOLS_DATA = Object.assign(Object.assign({}, this.constants.TWOCRYPTO_FACTORY_POOLS_DATA), poolData);
@@ -552,7 +267,7 @@ class Curve {
552
267
  return Object.keys(poolData)[0]; // id
553
268
  });
554
269
  this.fetchRecentlyDeployedTricryptoFactoryPool = (poolAddress) => __awaiter(this, void 0, void 0, function* () {
555
- if ([1284].includes(this.chainId))
270
+ if (!("tricrypto_factory" in this.constants.ALIASES))
556
271
  return '';
557
272
  const poolData = lowerCasePoolDataAddresses(yield getTricryptoFactoryPoolData.call(this, 0, poolAddress));
558
273
  this.constants.TRICRYPTO_FACTORY_POOLS_DATA = Object.assign(Object.assign({}, this.constants.TRICRYPTO_FACTORY_POOLS_DATA), poolData);
@@ -564,9 +279,9 @@ class Curve {
564
279
  this.getCrvusdFactoryPoolList = () => Object.keys(this.constants.CRVUSD_FACTORY_POOLS_DATA);
565
280
  this.getEywaFactoryPoolList = () => Object.keys(this.constants.EYWA_FACTORY_POOLS_DATA);
566
281
  this.getCryptoFactoryPoolList = () => Object.keys(this.constants.CRYPTO_FACTORY_POOLS_DATA);
282
+ this.getStableNgFactoryPoolList = () => Object.keys(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
567
283
  this.getTworyptoFactoryPoolList = () => Object.keys(this.constants.TWOCRYPTO_FACTORY_POOLS_DATA);
568
284
  this.getTricryptoFactoryPoolList = () => Object.keys(this.constants.TRICRYPTO_FACTORY_POOLS_DATA);
569
- this.getStableNgFactoryPoolList = () => Object.keys(this.constants.STABLE_NG_FACTORY_POOLS_DATA);
570
285
  this.getPoolList = () => {
571
286
  return [
572
287
  ...this.getMainPoolList(),
@@ -574,12 +289,12 @@ class Curve {
574
289
  ...this.getCrvusdFactoryPoolList(),
575
290
  ...this.getEywaFactoryPoolList(),
576
291
  ...this.getCryptoFactoryPoolList(),
292
+ ...this.getStableNgFactoryPoolList(),
577
293
  ...this.getTworyptoFactoryPoolList(),
578
294
  ...this.getTricryptoFactoryPoolList(),
579
- ...this.getStableNgFactoryPoolList(),
580
295
  ];
581
296
  };
582
- this.getPoolsData = () => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.constants.POOLS_DATA), this.constants.FACTORY_POOLS_DATA), this.constants.CRVUSD_FACTORY_POOLS_DATA), this.constants.EYWA_FACTORY_POOLS_DATA), this.constants.CRYPTO_FACTORY_POOLS_DATA), this.constants.TWOCRYPTO_FACTORY_POOLS_DATA), this.constants.TRICRYPTO_FACTORY_POOLS_DATA), this.constants.STABLE_NG_FACTORY_POOLS_DATA), this.constants.LLAMMAS_DATA));
297
+ this.getPoolsData = () => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.constants.POOLS_DATA), this.constants.FACTORY_POOLS_DATA), this.constants.CRVUSD_FACTORY_POOLS_DATA), this.constants.EYWA_FACTORY_POOLS_DATA), this.constants.CRYPTO_FACTORY_POOLS_DATA), this.constants.STABLE_NG_FACTORY_POOLS_DATA), this.constants.TWOCRYPTO_FACTORY_POOLS_DATA), this.constants.TRICRYPTO_FACTORY_POOLS_DATA), this.constants.LLAMMAS_DATA));
583
298
  this.getGaugeImplementation = (factoryType) => this.constants.FACTORY_GAUGE_IMPLEMENTATIONS[factoryType] || this.constants.ZERO_ADDRESS;
584
299
  // @ts-ignore
585
300
  this.provider = null;
@@ -587,6 +302,7 @@ class Curve {
587
302
  this.signer = null;
588
303
  this.signerAddress = '';
589
304
  this.chainId = 1;
305
+ this.isLiteChain = false;
590
306
  // @ts-ignore
591
307
  this.multicallProvider = null;
592
308
  this.contracts = {};
@@ -594,10 +310,12 @@ class Curve {
594
310
  this.constantOptions = { gasLimit: 12000000 };
595
311
  this.options = {};
596
312
  this.constants = {
597
- NATIVE_TOKEN: NATIVE_TOKENS[1],
313
+ NATIVE_TOKEN: NETWORK_CONSTANTS[1].NATIVE_COIN,
598
314
  NETWORK_NAME: 'ethereum',
599
315
  ALIASES: {},
600
316
  POOLS_DATA: {},
317
+ STABLE_FACTORY_CONSTANTS: {},
318
+ CRYPTO_FACTORY_CONSTANTS: {},
601
319
  FACTORY_POOLS_DATA: {},
602
320
  CRVUSD_FACTORY_POOLS_DATA: {},
603
321
  EYWA_FACTORY_POOLS_DATA: {},
@@ -616,7 +334,7 @@ class Curve {
616
334
  }
617
335
  init(providerType, providerSettings, options = {} // gasPrice in Gwei
618
336
  ) {
619
- var _a;
337
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
620
338
  return __awaiter(this, void 0, void 0, function* () {
621
339
  // @ts-ignore
622
340
  this.provider = null;
@@ -631,10 +349,12 @@ class Curve {
631
349
  this.constantOptions = { gasLimit: 12000000 };
632
350
  this.options = {};
633
351
  this.constants = {
634
- NATIVE_TOKEN: NATIVE_TOKENS[1],
352
+ NATIVE_TOKEN: NETWORK_CONSTANTS[1].NATIVE_COIN,
635
353
  NETWORK_NAME: 'ethereum',
636
354
  ALIASES: {},
637
355
  POOLS_DATA: {},
356
+ STABLE_FACTORY_CONSTANTS: {},
357
+ CRYPTO_FACTORY_CONSTANTS: {},
638
358
  FACTORY_POOLS_DATA: {},
639
359
  CRVUSD_FACTORY_POOLS_DATA: {},
640
360
  EYWA_FACTORY_POOLS_DATA: {},
@@ -703,28 +423,36 @@ class Curve {
703
423
  const network = yield this.provider.getNetwork();
704
424
  console.log("CURVE-JS IS CONNECTED TO NETWORK:", { name: network.name.toUpperCase(), chainId: Number(network.chainId) });
705
425
  this.chainId = Number(network.chainId) === 133 || Number(network.chainId) === 31337 ? 1 : Number(network.chainId);
706
- this.constants.NATIVE_TOKEN = NATIVE_TOKENS[this.chainId];
707
- this.constants.NETWORK_NAME = NETWORK_CONSTANTS[this.chainId].NAME;
708
- this.constants.ALIASES = NETWORK_CONSTANTS[this.chainId].ALIASES;
426
+ this.isLiteChain = !(this.chainId in NETWORK_CONSTANTS);
427
+ const network_constants = yield getNetworkConstants(this.chainId, this.isLiteChain);
428
+ this.constants.NATIVE_TOKEN = network_constants.NATIVE_COIN;
429
+ this.constants.NETWORK_NAME = network_constants.NAME;
430
+ this.constants.ALIASES = network_constants.ALIASES;
709
431
  this.constants.ALIASES.anycall = "0x37414a8662bc1d25be3ee51fb27c2686e2490a89";
710
432
  this.constants.ALIASES.voting_escrow_oracle = "0x12F407340697Ae0b177546E535b91A5be021fBF9";
711
- this.constants.POOLS_DATA = NETWORK_CONSTANTS[this.chainId].POOLS_DATA;
712
- if (this.chainId === 1)
713
- this.constants.LLAMMAS_DATA = NETWORK_CONSTANTS[this.chainId].LLAMMAS_DATA;
433
+ this.constants.POOLS_DATA = (_b = network_constants.POOLS_DATA) !== null && _b !== void 0 ? _b : {};
434
+ this.constants.LLAMMAS_DATA = (_c = network_constants.LLAMMAS_DATA) !== null && _c !== void 0 ? _c : {};
714
435
  for (const poolId in this.constants.POOLS_DATA)
715
436
  this.constants.POOLS_DATA[poolId].in_api = true;
716
- this.constants.COINS = NETWORK_CONSTANTS[this.chainId].COINS;
437
+ this.constants.COINS = (_d = network_constants.COINS) !== null && _d !== void 0 ? _d : {};
717
438
  this.constants.DECIMALS = extractDecimals(Object.assign(Object.assign({}, this.constants.POOLS_DATA), this.constants.LLAMMAS_DATA));
718
439
  this.constants.DECIMALS[this.constants.NATIVE_TOKEN.address] = 18;
719
440
  this.constants.DECIMALS[this.constants.NATIVE_TOKEN.wrappedAddress] = 18;
720
441
  this.constants.GAUGES = extractGauges(this.constants.POOLS_DATA);
721
442
  const [cTokens, yTokens, ycTokens, aTokens] = [
722
- NETWORK_CONSTANTS[this.chainId].cTokens,
723
- NETWORK_CONSTANTS[this.chainId].yTokens,
724
- NETWORK_CONSTANTS[this.chainId].ycTokens,
725
- NETWORK_CONSTANTS[this.chainId].aTokens,
443
+ (_e = network_constants.cTokens) !== null && _e !== void 0 ? _e : [],
444
+ (_f = network_constants.yTokens) !== null && _f !== void 0 ? _f : [],
445
+ (_g = network_constants.ycTokens) !== null && _g !== void 0 ? _g : [],
446
+ (_h = network_constants.aTokens) !== null && _h !== void 0 ? _h : [],
726
447
  ];
727
448
  const customAbiTokens = [...cTokens, ...yTokens, ...ycTokens, ...aTokens];
449
+ if (this.isLiteChain) {
450
+ this.constants.STABLE_FACTORY_CONSTANTS.stableNgBasePoolZap = network_constants.stableNgBasePoolZap;
451
+ }
452
+ else {
453
+ this.constants.STABLE_FACTORY_CONSTANTS = (_j = STABLE_FACTORY_CONSTANTS[this.chainId]) !== null && _j !== void 0 ? _j : {};
454
+ this.constants.CRYPTO_FACTORY_CONSTANTS = (_k = CRYPTO_FACTORY_CONSTANTS[this.chainId]) !== null && _k !== void 0 ? _k : {};
455
+ }
728
456
  if (this.chainId === 5000) {
729
457
  this.constantOptions = {};
730
458
  }
@@ -804,7 +532,7 @@ class Curve {
804
532
  if (this.chainId == 137) {
805
533
  this.setContract(this.constants.ALIASES.router, routerPolygonABI);
806
534
  }
807
- else if (OLD_CHAINS.includes(this.chainId)) {
535
+ else if ("factory" in this.constants.ALIASES) {
808
536
  this.setContract(this.constants.ALIASES.router, routerABI);
809
537
  }
810
538
  else {
@@ -813,8 +541,9 @@ class Curve {
813
541
  this.setContract(this.constants.ALIASES.deposit_and_stake, depositAndStakeABI);
814
542
  this.setContract(this.constants.ALIASES.crypto_calc, cryptoCalcZapABI);
815
543
  this.setContract(this.constants.ALIASES.stable_calc, StableCalcZapABI);
816
- this.setContract(this.constants.ALIASES.factory, factoryABI);
817
- if (this.chainId !== 1313161554 && this.chainId !== 252 && this.chainId !== 324 && this.chainId !== 196 && this.chainId !== 5000) {
544
+ // --------- POOL FACTORY ---------
545
+ if ("factory" in this.constants.ALIASES) {
546
+ this.setContract(this.constants.ALIASES.factory, factoryABI);
818
547
  const factoryContract = this.contracts[this.constants.ALIASES.factory].contract;
819
548
  this.constants.ALIASES.factory_admin = (yield factoryContract.admin(this.constantOptions)).toLowerCase();
820
549
  this.setContract(this.constants.ALIASES.factory_admin, factoryAdminABI);
@@ -822,6 +551,7 @@ class Curve {
822
551
  this.setContract(this.constants.ALIASES.crvusd_factory, factoryABI);
823
552
  this.setContract(this.constants.ALIASES.eywa_factory, factoryEywaABI);
824
553
  this.setContract(this.constants.ALIASES.crypto_factory, cryptoFactoryABI);
554
+ this.setContract(this.constants.ALIASES.stable_ng_factory, stableNgFactoryABI);
825
555
  this.setContract(this.constants.ALIASES.twocrypto_factory, twocryptoFactoryABI);
826
556
  if (this.chainId == 1) {
827
557
  this.setContract(this.constants.ALIASES.tricrypto_factory, tricryptoFactoryMainnetABI);
@@ -829,7 +559,7 @@ class Curve {
829
559
  else {
830
560
  this.setContract(this.constants.ALIASES.tricrypto_factory, tricryptoFactorySidechainABI);
831
561
  }
832
- this.setContract(this.constants.ALIASES.stable_ng_factory, stableNgFactoryABI);
562
+ // --------------------------------
833
563
  this.setContract(this.constants.ALIASES.anycall, anycallABI);
834
564
  this.setContract(this.constants.ALIASES.voting_escrow_oracle, this.chainId === 1 ? votingEscrowOracleEthABI : votingEscrowOracleABI);
835
565
  if (this.chainId === 1) {
@@ -883,6 +613,8 @@ class Curve {
883
613
  });
884
614
  }
885
615
  setContract(address, abi) {
616
+ if (address === this.constants.ZERO_ADDRESS || address === undefined)
617
+ return;
886
618
  // eslint-disable-next-line @typescript-eslint/no-this-alias
887
619
  const curveInstance = this;
888
620
  const proxyHandler = {