@curvefi/api 2.66.30 → 2.67.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 (94) hide show
  1. package/lib/boosting.d.ts +33 -32
  2. package/lib/boosting.js +320 -252
  3. package/lib/cached.d.ts +4 -3
  4. package/lib/cached.js +63 -19
  5. package/lib/constants/coins/hyperliquid.d.ts +2 -0
  6. package/lib/constants/coins/hyperliquid.js +5 -0
  7. package/lib/constants/coins/index.d.ts +2 -1
  8. package/lib/constants/coins/index.js +2 -1
  9. package/lib/constants/factory/crypto.d.ts +5 -0
  10. package/lib/constants/factory/crypto.js +8 -0
  11. package/lib/constants/factory/stable.js +3 -0
  12. package/lib/constants/network_constants.js +37 -11
  13. package/lib/constants/pools/hyperliquid.d.ts +2 -0
  14. package/lib/constants/pools/hyperliquid.js +2 -0
  15. package/lib/constants/pools/index.d.ts +2 -1
  16. package/lib/constants/pools/index.js +2 -1
  17. package/lib/constants/utils.d.ts +14 -1
  18. package/lib/constants/utils.js +21 -6
  19. package/lib/constants/volumeNetworks.js +1 -1
  20. package/lib/curve.d.ts +5 -5
  21. package/lib/curve.js +21 -38
  22. package/lib/dao.d.ts +32 -31
  23. package/lib/dao.js +420 -350
  24. package/lib/external-api.d.ts +1 -1
  25. package/lib/external-api.js +2 -2
  26. package/lib/factory/common.d.ts +2 -1
  27. package/lib/factory/common.js +1 -1
  28. package/lib/factory/deploy.d.ts +46 -45
  29. package/lib/factory/deploy.js +630 -551
  30. package/lib/factory/factory-api.d.ts +3 -2
  31. package/lib/factory/factory-api.js +22 -23
  32. package/lib/factory/factory-crypto.d.ts +1 -1
  33. package/lib/factory/factory-crypto.js +12 -15
  34. package/lib/factory/factory-tricrypto.d.ts +1 -1
  35. package/lib/factory/factory-tricrypto.js +14 -15
  36. package/lib/factory/factory-twocrypto.d.ts +1 -1
  37. package/lib/factory/factory-twocrypto.js +12 -13
  38. package/lib/factory/factory.d.ts +4 -3
  39. package/lib/factory/factory.js +21 -24
  40. package/lib/index.d.ts +413 -104
  41. package/lib/index.js +253 -257
  42. package/lib/interfaces.d.ts +2 -0
  43. package/lib/pools/PoolTemplate.d.ts +13 -12
  44. package/lib/pools/PoolTemplate.js +279 -285
  45. package/lib/pools/mixins/common.js +2 -2
  46. package/lib/pools/mixins/depositBalancedAmountsMixins.d.ts +12 -4
  47. package/lib/pools/mixins/depositBalancedAmountsMixins.js +1 -15
  48. package/lib/pools/mixins/depositMixins.d.ts +25 -5
  49. package/lib/pools/mixins/depositMixins.js +38 -76
  50. package/lib/pools/mixins/depositWrappedMixins.d.ts +10 -2
  51. package/lib/pools/mixins/depositWrappedMixins.js +17 -33
  52. package/lib/pools/mixins/poolBalancesMixin.d.ts +6 -2
  53. package/lib/pools/mixins/poolBalancesMixin.js +3 -5
  54. package/lib/pools/mixins/swapMixins.d.ts +20 -4
  55. package/lib/pools/mixins/swapMixins.js +36 -70
  56. package/lib/pools/mixins/swapWrappedMixins.d.ts +19 -4
  57. package/lib/pools/mixins/swapWrappedMixins.js +32 -60
  58. package/lib/pools/mixins/withdrawExpectedMixins.d.ts +12 -4
  59. package/lib/pools/mixins/withdrawExpectedMixins.js +6 -11
  60. package/lib/pools/mixins/withdrawImbalanceMixins.d.ts +20 -4
  61. package/lib/pools/mixins/withdrawImbalanceMixins.js +26 -53
  62. package/lib/pools/mixins/withdrawImbalanceWrappedMixins.d.ts +10 -2
  63. package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +12 -27
  64. package/lib/pools/mixins/withdrawMixins.d.ts +25 -5
  65. package/lib/pools/mixins/withdrawMixins.js +33 -67
  66. package/lib/pools/mixins/withdrawOneCoinExpectedMixins.d.ts +12 -4
  67. package/lib/pools/mixins/withdrawOneCoinExpectedMixins.js +8 -13
  68. package/lib/pools/mixins/withdrawOneCoinMixins.d.ts +25 -5
  69. package/lib/pools/mixins/withdrawOneCoinMixins.js +32 -66
  70. package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.d.ts +6 -2
  71. package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +4 -7
  72. package/lib/pools/mixins/withdrawOneCoinWrappedMixins.d.ts +10 -2
  73. package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +13 -29
  74. package/lib/pools/mixins/withdrawWrappedMixins.d.ts +10 -2
  75. package/lib/pools/mixins/withdrawWrappedMixins.js +14 -28
  76. package/lib/pools/poolConstructor.d.ts +2 -1
  77. package/lib/pools/poolConstructor.js +27 -28
  78. package/lib/pools/subClasses/corePool.d.ts +4 -1
  79. package/lib/pools/subClasses/corePool.js +5 -7
  80. package/lib/pools/subClasses/gaugePool.d.ts +5 -3
  81. package/lib/pools/subClasses/gaugePool.js +19 -18
  82. package/lib/pools/subClasses/statsPool.d.ts +2 -0
  83. package/lib/pools/subClasses/statsPool.js +22 -10
  84. package/lib/pools/subClasses/walletPool.d.ts +2 -1
  85. package/lib/pools/subClasses/walletPool.js +6 -6
  86. package/lib/pools/utils.d.ts +7 -6
  87. package/lib/pools/utils.js +316 -297
  88. package/lib/route-graph.worker.d.ts +2 -2
  89. package/lib/route-graph.worker.js +4 -6
  90. package/lib/router.d.ts +12 -11
  91. package/lib/router.js +331 -295
  92. package/lib/utils.d.ts +34 -33
  93. package/lib/utils.js +483 -435
  94. package/package.json +2 -2
@@ -1,3 +1,4 @@
1
- import { IDict, IFactoryPoolType, IPoolData, ICurve, IPoolDataFromApi } from "../interfaces";
1
+ import { IDict, IFactoryPoolType, IPoolData, IPoolDataFromApi } from "../interfaces";
2
+ import { type Curve } from "../curve";
2
3
  export declare const lowerCasePoolDataAddresses: (poolsData: IPoolDataFromApi[]) => IPoolDataFromApi[];
3
- export declare function getFactoryPoolsDataFromApi(this: ICurve, factoryType: IFactoryPoolType): Promise<IDict<IPoolData>>;
4
+ export declare function getFactoryPoolsDataFromApi(this: Curve, factoryType: IFactoryPoolType): Promise<IDict<IPoolData>>;
@@ -7,20 +7,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { curve } from "../curve.js";
11
- import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: 'json' };
12
- import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: 'json' };
13
- import ERC20ABI from "../constants/abis/ERC20.json" with { type: 'json' };
14
- import cryptoFactorySwapABI from "../constants/abis/factory-crypto/factory-crypto-pool-2.json" with { type: 'json' };
15
- import twocryptoFactorySwapABI from "../constants/abis/factory-twocrypto/factory-twocrypto-pool.json" with { type: 'json' };
16
- import tricryptoFactorySwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool.json" with { type: 'json' };
17
- import tricryptoFactoryEthDisabledSwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool-eth-disabled.json" with { type: 'json' };
10
+ import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: "json" };
11
+ import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: "json" };
12
+ import ERC20ABI from "../constants/abis/ERC20.json" with { type: "json" };
13
+ import cryptoFactorySwapABI from "../constants/abis/factory-crypto/factory-crypto-pool-2.json" with { type: "json" };
14
+ import twocryptoFactorySwapABI from "../constants/abis/factory-twocrypto/factory-twocrypto-pool.json" with { type: "json" };
15
+ import tricryptoFactorySwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool.json" with { type: "json" };
16
+ import tricryptoFactoryEthDisabledSwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool-eth-disabled.json" with { type: "json" };
18
17
  import { getPoolIdByAddress, setFactoryZapContracts } from "./common.js";
19
18
  import { _getPoolsFromApi } from "../cached.js";
20
19
  import { assetTypeNameHandler, getPoolName, isStableNgPool } from "../utils.js";
21
- import StableNgBasePoolZapABI from "../constants/abis/stable-ng-base-pool-zap.json" with { type: 'json' };
22
- import MetaStableSwapNGABI from "../constants/abis/factory-stable-ng/meta-stableswap-ng.json" with { type: 'json' };
23
- import PlainStableSwapNGABI from "../constants/abis/factory-stable-ng/plain-stableswap-ng.json" with { type: 'json' };
20
+ import StableNgBasePoolZapABI from "../constants/abis/stable-ng-base-pool-zap.json" with { type: "json" };
21
+ import MetaStableSwapNGABI from "../constants/abis/factory-stable-ng/meta-stableswap-ng.json" with { type: "json" };
22
+ import PlainStableSwapNGABI from "../constants/abis/factory-stable-ng/plain-stableswap-ng.json" with { type: "json" };
24
23
  export const lowerCasePoolDataAddresses = (poolsData) => {
25
24
  var _a;
26
25
  for (const poolData of poolsData) {
@@ -41,20 +40,20 @@ export const lowerCasePoolDataAddresses = (poolsData) => {
41
40
  }
42
41
  return poolsData;
43
42
  };
44
- const getSwapAbiByFactoryType = (factoryType, pool) => {
43
+ function getSwapAbiByFactoryType(factoryType, pool) {
45
44
  var _a;
46
- const isETHEnabled = pool.implementationAddress === ((_a = curve.constants.CRYPTO_FACTORY_CONSTANTS.tricryptoDeployImplementations) === null || _a === void 0 ? void 0 : _a.amm_native_transfers_enabled);
45
+ const isETHEnabled = pool.implementationAddress === ((_a = this.constants.CRYPTO_FACTORY_CONSTANTS.tricryptoDeployImplementations) === null || _a === void 0 ? void 0 : _a.amm_native_transfers_enabled);
47
46
  const map = {
48
47
  "factory-crypto": cryptoFactorySwapABI,
49
48
  "factory-twocrypto": twocryptoFactorySwapABI,
50
49
  "factory-tricrypto": isETHEnabled ? tricryptoFactorySwapABI : tricryptoFactoryEthDisabledSwapABI,
51
50
  };
52
51
  return map[factoryType];
53
- };
52
+ }
54
53
  function setFactorySwapContracts(rawPoolList, swapABIs, factoryType) {
55
54
  if (["factory-crypto", "factory-twocrypto", "factory-tricrypto"].includes(factoryType)) {
56
55
  rawPoolList.forEach((pool) => {
57
- this.setContract(pool.address, getSwapAbiByFactoryType(factoryType, pool));
56
+ this.setContract(pool.address, getSwapAbiByFactoryType.call(this, factoryType, pool));
58
57
  });
59
58
  }
60
59
  else {
@@ -110,7 +109,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
110
109
  rawPoolList.forEach((pool, i) => {
111
110
  var _a, _b, _c, _d, _e, _f, _g, _h;
112
111
  const nativeToken = this.constants.NATIVE_TOKEN;
113
- const isETHEnabled = pool.implementationAddress === ((_a = curve.constants.CRYPTO_FACTORY_CONSTANTS.tricryptoDeployImplementations) === null || _a === void 0 ? void 0 : _a.amm_native_transfers_enabled);
112
+ const isETHEnabled = pool.implementationAddress === ((_a = this.constants.CRYPTO_FACTORY_CONSTANTS.tricryptoDeployImplementations) === null || _a === void 0 ? void 0 : _a.amm_native_transfers_enabled);
114
113
  let coinAddresses = pool.coins.map((c) => c.address);
115
114
  if (this.chainId === 137) {
116
115
  coinAddresses = coinAddresses.map((a) => a === "0x0000000000000000000000000000000000001010" ? nativeToken.wrappedAddress : a);
@@ -169,7 +168,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
169
168
  reference_asset: "CRYPTO",
170
169
  swap_address: pool.address,
171
170
  token_address: pool.lpTokenAddress,
172
- gauge_address: pool.gaugeAddress ? pool.gaugeAddress : curve.constants.ZERO_ADDRESS,
171
+ gauge_address: pool.gaugeAddress ? pool.gaugeAddress : this.constants.ZERO_ADDRESS,
173
172
  deposit_address: basePoolZap.address,
174
173
  is_meta: true,
175
174
  is_crypto: true,
@@ -196,7 +195,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
196
195
  reference_asset: "CRYPTO",
197
196
  swap_address: pool.address,
198
197
  token_address: pool.lpTokenAddress,
199
- gauge_address: pool.gaugeAddress ? pool.gaugeAddress : curve.constants.ZERO_ADDRESS,
198
+ gauge_address: pool.gaugeAddress ? pool.gaugeAddress : this.constants.ZERO_ADDRESS,
200
199
  is_crypto: true,
201
200
  is_plain: isPlain,
202
201
  is_factory: true,
@@ -206,7 +205,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
206
205
  wrapped_coin_addresses: coinAddresses,
207
206
  underlying_decimals: coinDecimals,
208
207
  wrapped_decimals: coinDecimals,
209
- swap_abi: getSwapAbiByFactoryType(factoryType, pool),
208
+ swap_abi: getSwapAbiByFactoryType.call(this, factoryType, pool),
210
209
  gauge_abi: this.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
211
210
  in_api: true,
212
211
  is_ng,
@@ -215,13 +214,13 @@ export function getFactoryPoolsDataFromApi(factoryType) {
215
214
  }
216
215
  else if (pool.isMetaPool) {
217
216
  const allPoolsData = Object.assign(Object.assign({}, this.constants.POOLS_DATA), FACTORY_POOLS_DATA);
218
- const basePoolId = getPoolIdByAddress(rawPoolList, pool.basePoolAddress);
217
+ const basePoolId = getPoolIdByAddress.call(this, rawPoolList, pool.basePoolAddress);
219
218
  this.constants.BASE_POOLS[basePoolId] = this.constants.BASE_POOLS[basePoolId] ? this.constants.BASE_POOLS[basePoolId] + 1 : 1;
220
219
  const basePoolCoinNames = (_d = allPoolsData[basePoolId]) === null || _d === void 0 ? void 0 : _d.underlying_coins;
221
220
  const basePoolCoinAddresses = (_e = allPoolsData[basePoolId]) === null || _e === void 0 ? void 0 : _e.underlying_coin_addresses;
222
221
  const basePoolDecimals = (_f = allPoolsData[basePoolId]) === null || _f === void 0 ? void 0 : _f.underlying_decimals;
223
222
  const basePoolIdZapDict = (_g = this.constants.STABLE_FACTORY_CONSTANTS.basePoolIdZapDict) !== null && _g !== void 0 ? _g : {};
224
- let deposit_address = (_h = this.constants.STABLE_FACTORY_CONSTANTS.stableNgBasePoolZap) !== null && _h !== void 0 ? _h : curve.constants.ZERO_ADDRESS;
223
+ let deposit_address = (_h = this.constants.STABLE_FACTORY_CONSTANTS.stableNgBasePoolZap) !== null && _h !== void 0 ? _h : this.constants.ZERO_ADDRESS;
225
224
  let deposit_abi = StableNgBasePoolZapABI;
226
225
  if (isStableNgPool(basePoolId)) {
227
226
  this.setContract(deposit_address, StableNgBasePoolZapABI);
@@ -237,7 +236,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
237
236
  reference_asset: assetTypeNameHandler(pool.assetTypeName),
238
237
  swap_address: pool.address,
239
238
  token_address: pool.address,
240
- gauge_address: pool.gaugeAddress ? pool.gaugeAddress : curve.constants.ZERO_ADDRESS,
239
+ gauge_address: pool.gaugeAddress ? pool.gaugeAddress : this.constants.ZERO_ADDRESS,
241
240
  deposit_address,
242
241
  implementation_address: pool.implementationAddress, // Only for testing
243
242
  is_meta: true,
@@ -264,7 +263,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
264
263
  reference_asset: assetTypeNameHandler(pool.assetTypeName),
265
264
  swap_address: pool.address,
266
265
  token_address: pool.address,
267
- gauge_address: pool.gaugeAddress ? pool.gaugeAddress : curve.constants.ZERO_ADDRESS,
266
+ gauge_address: pool.gaugeAddress ? pool.gaugeAddress : this.constants.ZERO_ADDRESS,
268
267
  implementation_address: pool.implementationAddress, // Only for testing
269
268
  is_plain: true,
270
269
  is_factory: true,
@@ -1,2 +1,2 @@
1
- import { IDict, IPoolData, ICurve } from "../interfaces";
1
+ import { ICurve, IDict, IPoolData } from "../interfaces";
2
2
  export declare function getCryptoFactoryPoolData(this: ICurve, fromIdx?: number, swapAddress?: string): Promise<IDict<IPoolData>>;
@@ -7,17 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { curve } from "../curve.js";
11
- import ERC20ABI from "../constants/abis/ERC20.json" with { type: 'json' };
12
- import cryptoFactorySwapABI from "../constants/abis/factory-crypto/factory-crypto-pool-2.json" with { type: 'json' };
13
- import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: 'json' };
14
- import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: 'json' };
10
+ import ERC20ABI from "../constants/abis/ERC20.json" with { type: "json" };
11
+ import cryptoFactorySwapABI from "../constants/abis/factory-crypto/factory-crypto-pool-2.json" with { type: "json" };
12
+ import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: "json" };
13
+ import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: "json" };
15
14
  import { setFactoryZapContracts } from "./common.js";
16
15
  const deepFlatten = (arr) => [].concat(...arr.map((v) => (Array.isArray(v) ? deepFlatten(v) : v)));
17
16
  function getRecentlyCreatedCryptoPoolId(swapAddress) {
18
17
  return __awaiter(this, void 0, void 0, function* () {
19
18
  const factoryContract = this.contracts[this.constants.ALIASES.crypto_factory].contract;
20
- const poolCount = Number(curve.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
19
+ const poolCount = Number(this.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
21
20
  for (let i = 1; i <= poolCount; i++) {
22
21
  const address = yield factoryContract.pool_list(poolCount - i);
23
22
  if (address.toLowerCase() === swapAddress.toLowerCase())
@@ -30,7 +29,7 @@ function getCryptoFactoryIdsAndSwapAddresses() {
30
29
  return __awaiter(this, arguments, void 0, function* (fromIdx = 0) {
31
30
  const factoryContract = this.contracts[this.constants.ALIASES.crypto_factory].contract;
32
31
  const factoryMulticallContract = this.contracts[this.constants.ALIASES.crypto_factory].multicallContract;
33
- const poolCount = Number(curve.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
32
+ const poolCount = Number(this.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
34
33
  const calls = [];
35
34
  for (let i = fromIdx; i < poolCount; i++) {
36
35
  calls.push(factoryMulticallContract.pool_list(i));
@@ -69,7 +68,7 @@ function _getLpTokenMap(factorySwapAddresses) {
69
68
  function getPoolsData(factorySwapAddresses) {
70
69
  return __awaiter(this, void 0, void 0, function* () {
71
70
  const factoryMulticallContract = this.contracts[this.constants.ALIASES.crypto_factory].multicallContract;
72
- const isChildGaugeFactoryNull = curve.chainId !== 1 && this.constants.ALIASES.child_gauge_factory === curve.constants.ZERO_ADDRESS;
71
+ const isChildGaugeFactoryNull = this.chainId !== 1 && this.constants.ALIASES.child_gauge_factory === this.constants.ZERO_ADDRESS;
73
72
  const isChildGaugeFactoryOldNull = !("child_gauge_factory_old" in this.constants.ALIASES);
74
73
  const calls = [];
75
74
  if (this.chainId === 1) {
@@ -96,9 +95,9 @@ function getPoolsData(factorySwapAddresses) {
96
95
  if (isChildGaugeFactoryNull || isChildGaugeFactoryOldNull) {
97
96
  for (let index = 0; index < res.length; index++) {
98
97
  if (isChildGaugeFactoryNull && index % 4 == 1)
99
- res.splice(index, 0, curve.constants.ZERO_ADDRESS);
98
+ res.splice(index, 0, this.constants.ZERO_ADDRESS);
100
99
  if (isChildGaugeFactoryOldNull && index % 4 == 2)
101
- res.splice(index, 0, curve.constants.ZERO_ADDRESS);
100
+ res.splice(index, 0, this.constants.ZERO_ADDRESS);
102
101
  }
103
102
  }
104
103
  const tokenAddresses = res.filter((a, i) => i % 4 == 0).map((a) => a.toLowerCase());
@@ -119,9 +118,7 @@ function setCryptoFactoryTokenContracts(factoryTokenAddresses) {
119
118
  });
120
119
  }
121
120
  function setCryptoFactoryGaugeContracts(factoryGaugeAddresses) {
122
- factoryGaugeAddresses.filter((addr) => addr !== curve.constants.ZERO_ADDRESS).forEach((addr, i) => {
123
- this.setContract(addr, this.chainId === 1 ? factoryGaugeABI : gaugeChildABI);
124
- });
121
+ factoryGaugeAddresses.filter((addr) => addr !== this.constants.ZERO_ADDRESS).forEach((addr) => this.setContract(addr, this.chainId === 1 ? factoryGaugeABI : gaugeChildABI));
125
122
  }
126
123
  function setCryptoFactoryCoinsContracts(coinAddresses) {
127
124
  const flattenedCoinAddresses = Array.from(new Set(deepFlatten(coinAddresses)));
@@ -185,7 +182,7 @@ function getCoinsData(tokenAddresses, coinAddresses, existingCoinAddrNameDict, e
185
182
  const tokenNames = res1.filter((a, i) => i % 2 == 1);
186
183
  const res2 = res.slice(tokenAddresses.length * 2);
187
184
  const symbols = res2.filter((a, i) => i % 2 == 0);
188
- const decimals = res2.filter((a, i) => i % 2 == 1).map((_d) => Number(curve.formatUnits(_d, 0)));
185
+ const decimals = res2.filter((a, i) => i % 2 == 1).map((_d) => Number(this.formatUnits(_d, 0)));
189
186
  newCoinAddresses.forEach((addr, i) => {
190
187
  coinAddrNamesDict[addr] = symbols[i];
191
188
  coinAddrDecimalsDict[addr] = decimals[i];
@@ -206,7 +203,7 @@ export function getCryptoFactoryPoolData() {
206
203
  const [tokenAddresses, rawGaugeAddresses, rawOldGaugeAddresses, coinAddresses] = yield getPoolsData.call(this, swapAddresses);
207
204
  const gaugeAddresses = [];
208
205
  for (let i = 0; i < rawGaugeAddresses.length; i++) {
209
- gaugeAddresses.push(rawGaugeAddresses[i] !== curve.constants.ZERO_ADDRESS ? rawGaugeAddresses[i] : rawOldGaugeAddresses[i]);
206
+ gaugeAddresses.push(rawGaugeAddresses[i] !== this.constants.ZERO_ADDRESS ? rawGaugeAddresses[i] : rawOldGaugeAddresses[i]);
210
207
  }
211
208
  setCryptoFactorySwapContracts.call(this, swapAddresses);
212
209
  setCryptoFactoryTokenContracts.call(this, tokenAddresses);
@@ -1,2 +1,2 @@
1
- import { IDict, IPoolData, ICurve } from "../interfaces";
1
+ import { ICurve, IDict, IPoolData } from "../interfaces";
2
2
  export declare function getTricryptoFactoryPoolData(this: ICurve, fromIdx?: number, swapAddress?: string): Promise<IDict<IPoolData>>;
@@ -7,17 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { curve } from "../curve.js";
11
- import ERC20ABI from "../constants/abis/ERC20.json" with { type: 'json' };
12
- import tricryptoFactorySwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool.json" with { type: 'json' };
13
- import tricryptoFactoryEthDisabledSwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool-eth-disabled.json" with { type: 'json' };
14
- import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: 'json' };
15
- import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: 'json' };
10
+ import ERC20ABI from "../constants/abis/ERC20.json" with { type: "json" };
11
+ import tricryptoFactorySwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool.json" with { type: "json" };
12
+ import tricryptoFactoryEthDisabledSwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool-eth-disabled.json" with { type: "json" };
13
+ import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: "json" };
14
+ import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: "json" };
16
15
  const deepFlatten = (arr) => [].concat(...arr.map((v) => (Array.isArray(v) ? deepFlatten(v) : v)));
17
16
  function getRecentlyCreatedCryptoPoolId(swapAddress) {
18
17
  return __awaiter(this, void 0, void 0, function* () {
19
18
  const factoryContract = this.contracts[this.constants.ALIASES.tricrypto_factory].contract;
20
- const poolCount = Number(curve.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
19
+ const poolCount = Number(this.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
21
20
  for (let i = 1; i <= poolCount; i++) {
22
21
  const address = yield factoryContract.pool_list(poolCount - i);
23
22
  if (address.toLowerCase() === swapAddress.toLowerCase())
@@ -30,7 +29,7 @@ function getCryptoFactoryIdsAndSwapAddresses() {
30
29
  return __awaiter(this, arguments, void 0, function* (fromIdx = 0) {
31
30
  const factoryContract = this.contracts[this.constants.ALIASES.tricrypto_factory].contract;
32
31
  const factoryMulticallContract = this.contracts[this.constants.ALIASES.tricrypto_factory].multicallContract;
33
- const poolCount = Number(curve.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
32
+ const poolCount = Number(this.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
34
33
  const calls = [];
35
34
  for (let i = fromIdx; i < poolCount; i++) {
36
35
  calls.push(factoryMulticallContract.pool_list(i));
@@ -49,7 +48,7 @@ function _handleCoinAddresses(coinAddresses) {
49
48
  function getPoolsData(factorySwapAddresses) {
50
49
  return __awaiter(this, void 0, void 0, function* () {
51
50
  const factoryMulticallContract = this.contracts[this.constants.ALIASES.tricrypto_factory].multicallContract;
52
- const isChildGaugeFactoryNull = curve.chainId !== 1 && this.constants.ALIASES.child_gauge_factory === curve.constants.ZERO_ADDRESS;
51
+ const isChildGaugeFactoryNull = this.chainId !== 1 && this.constants.ALIASES.child_gauge_factory === this.constants.ZERO_ADDRESS;
53
52
  const isChildGaugeFactoryOldNull = !("child_gauge_factory_old" in this.constants.ALIASES);
54
53
  const calls = [];
55
54
  if (this.chainId === 1) {
@@ -74,11 +73,11 @@ function getPoolsData(factorySwapAddresses) {
74
73
  if (isChildGaugeFactoryNull || isChildGaugeFactoryOldNull || this.chainId === 1) {
75
74
  for (let index = 0; index < res.length; index++) {
76
75
  if (isChildGaugeFactoryNull && index % 4 == 0)
77
- res.splice(index, 0, curve.constants.ZERO_ADDRESS);
76
+ res.splice(index, 0, this.constants.ZERO_ADDRESS);
78
77
  if (isChildGaugeFactoryOldNull && index % 4 == 1)
79
- res.splice(index, 0, curve.constants.ZERO_ADDRESS);
78
+ res.splice(index, 0, this.constants.ZERO_ADDRESS);
80
79
  if (this.chainId === 1 && index % 4 == 3)
81
- res.splice(index, 0, curve.constants.ZERO_ADDRESS);
80
+ res.splice(index, 0, this.constants.ZERO_ADDRESS);
82
81
  }
83
82
  }
84
83
  const gaugeAddresses = res.filter((a, i) => i % 4 == 0).map((a) => a.toLowerCase());
@@ -94,7 +93,7 @@ function setCryptoFactorySwapContracts(factorySwapAddresses) {
94
93
  });
95
94
  }
96
95
  function setCryptoFactoryGaugeContracts(factoryGaugeAddresses) {
97
- factoryGaugeAddresses.filter((addr) => addr !== curve.constants.ZERO_ADDRESS).forEach((addr, i) => {
96
+ factoryGaugeAddresses.filter((addr) => addr !== this.constants.ZERO_ADDRESS).forEach((addr) => {
98
97
  this.setContract(addr, this.chainId === 1 ? factoryGaugeABI : gaugeChildABI);
99
98
  });
100
99
  }
@@ -156,7 +155,7 @@ function getCoinsData(tokenAddresses, coinAddresses, existingCoinAddrNameDict, e
156
155
  const tokenNames = res1.filter((a, i) => i % 2 == 1);
157
156
  const res2 = res.slice(tokenAddresses.length * 2);
158
157
  const symbols = res2.filter((a, i) => i % 2 == 0);
159
- const decimals = res2.filter((a, i) => i % 2 == 1).map((_d) => Number(curve.formatUnits(_d, 0)));
158
+ const decimals = res2.filter((a, i) => i % 2 == 1).map((_d) => Number(this.formatUnits(_d, 0)));
160
159
  newCoinAddresses.forEach((addr, i) => {
161
160
  coinAddrNamesDict[addr] = symbols[i];
162
161
  coinAddrDecimalsDict[addr] = decimals[i];
@@ -177,7 +176,7 @@ export function getTricryptoFactoryPoolData() {
177
176
  const [rawGaugeAddresses, rawOldGaugeAddresses, coinAddresses, implementationAddresses] = yield getPoolsData.call(this, swapAddresses);
178
177
  const gaugeAddresses = [];
179
178
  for (let i = 0; i < rawGaugeAddresses.length; i++) {
180
- gaugeAddresses.push(rawGaugeAddresses[i] !== curve.constants.ZERO_ADDRESS ? rawGaugeAddresses[i] : rawOldGaugeAddresses[i]);
179
+ gaugeAddresses.push(rawGaugeAddresses[i] !== this.constants.ZERO_ADDRESS ? rawGaugeAddresses[i] : rawOldGaugeAddresses[i]);
181
180
  }
182
181
  setCryptoFactorySwapContracts.call(this, swapAddresses);
183
182
  setCryptoFactoryGaugeContracts.call(this, gaugeAddresses);
@@ -1,2 +1,2 @@
1
- import { IDict, IPoolData, ICurve } from "../interfaces";
1
+ import { ICurve, IDict, IPoolData } from "../interfaces";
2
2
  export declare function getTwocryptoFactoryPoolData(this: ICurve, fromIdx?: number, swapAddress?: string): Promise<IDict<IPoolData>>;
@@ -7,16 +7,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { curve } from "../curve.js";
11
- import ERC20ABI from "../constants/abis/ERC20.json" with { type: 'json' };
12
- import twocryptoFactorySwapABI from "../constants/abis/factory-twocrypto/factory-twocrypto-pool.json" with { type: 'json' };
13
- import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: 'json' };
14
- import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: 'json' };
10
+ import ERC20ABI from "../constants/abis/ERC20.json" with { type: "json" };
11
+ import twocryptoFactorySwapABI from "../constants/abis/factory-twocrypto/factory-twocrypto-pool.json" with { type: "json" };
12
+ import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: "json" };
13
+ import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: "json" };
15
14
  const deepFlatten = (arr) => [].concat(...arr.map((v) => (Array.isArray(v) ? deepFlatten(v) : v)));
16
15
  function getRecentlyCreatedCryptoPoolId(swapAddress) {
17
16
  return __awaiter(this, void 0, void 0, function* () {
18
17
  const factoryContract = this.contracts[this.constants.ALIASES.twocrypto_factory].contract;
19
- const poolCount = Number(curve.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
18
+ const poolCount = Number(this.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
20
19
  for (let i = 1; i <= poolCount; i++) {
21
20
  const address = yield factoryContract.pool_list(poolCount - i);
22
21
  if (address.toLowerCase() === swapAddress.toLowerCase())
@@ -29,7 +28,7 @@ function getTwocryptoFactoryIdsAndSwapAddresses() {
29
28
  return __awaiter(this, arguments, void 0, function* (fromIdx = 0) {
30
29
  const factoryContract = this.contracts[this.constants.ALIASES.twocrypto_factory].contract;
31
30
  const factoryMulticallContract = this.contracts[this.constants.ALIASES.twocrypto_factory].multicallContract;
32
- const poolCount = Number(curve.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
31
+ const poolCount = Number(this.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
33
32
  const calls = [];
34
33
  for (let i = fromIdx; i < poolCount; i++) {
35
34
  calls.push(factoryMulticallContract.pool_list(i));
@@ -48,7 +47,7 @@ function _handleCoinAddresses(coinAddresses) {
48
47
  function getPoolsData(factorySwapAddresses) {
49
48
  return __awaiter(this, void 0, void 0, function* () {
50
49
  const factoryMulticallContract = this.contracts[this.constants.ALIASES.twocrypto_factory].multicallContract;
51
- const isChildGaugeFactoryNull = curve.chainId !== 1 && this.constants.ALIASES.child_gauge_factory === curve.constants.ZERO_ADDRESS;
50
+ const isChildGaugeFactoryNull = this.chainId !== 1 && this.constants.ALIASES.child_gauge_factory === this.constants.ZERO_ADDRESS;
52
51
  const isChildGaugeFactoryOldNull = !("child_gauge_factory_old" in this.constants.ALIASES);
53
52
  const calls = [];
54
53
  if (this.chainId === 1) {
@@ -72,9 +71,9 @@ function getPoolsData(factorySwapAddresses) {
72
71
  if (isChildGaugeFactoryNull || isChildGaugeFactoryOldNull) {
73
72
  for (let index = 0; index < res.length; index++) {
74
73
  if (isChildGaugeFactoryNull && index % 3 == 0)
75
- res.splice(index, 0, curve.constants.ZERO_ADDRESS);
74
+ res.splice(index, 0, this.constants.ZERO_ADDRESS);
76
75
  if (isChildGaugeFactoryOldNull && index % 3 == 1)
77
- res.splice(index, 0, curve.constants.ZERO_ADDRESS);
76
+ res.splice(index, 0, this.constants.ZERO_ADDRESS);
78
77
  }
79
78
  }
80
79
  const gaugeAddresses = res.filter((a, i) => i % 3 == 0).map((a) => a.toLowerCase());
@@ -89,7 +88,7 @@ function setTwocryptoFactorySwapContracts(factorySwapAddresses) {
89
88
  });
90
89
  }
91
90
  function setTwocryptoFactoryGaugeContracts(factoryGaugeAddresses) {
92
- factoryGaugeAddresses.filter((addr) => addr !== curve.constants.ZERO_ADDRESS).forEach((addr, i) => {
91
+ factoryGaugeAddresses.filter((addr) => addr !== this.constants.ZERO_ADDRESS).forEach((addr) => {
93
92
  this.setContract(addr, this.chainId === 1 ? factoryGaugeABI : gaugeChildABI);
94
93
  });
95
94
  }
@@ -154,7 +153,7 @@ function getCoinsData(tokenAddresses, coinAddresses, existingCoinAddrNameDict, e
154
153
  const tokenNames = res1.filter((a, i) => i % 2 == 1);
155
154
  const res2 = res.slice(tokenAddresses.length * 2);
156
155
  const symbols = res2.filter((a, i) => i % 2 == 0);
157
- const decimals = res2.filter((a, i) => i % 2 == 1).map((_d) => Number(curve.formatUnits(_d, 0)));
156
+ const decimals = res2.filter((a, i) => i % 2 == 1).map((_d) => Number(this.formatUnits(_d, 0)));
158
157
  newCoinAddresses.forEach((addr, i) => {
159
158
  coinAddrNamesDict[addr] = symbols[i];
160
159
  coinAddrDecimalsDict[addr] = decimals[i];
@@ -174,7 +173,7 @@ export function getTwocryptoFactoryPoolData() {
174
173
  const [rawGaugeAddresses, rawOldGaugeAddresses, coinAddresses] = yield getPoolsData.call(this, swapAddresses);
175
174
  const gaugeAddresses = [];
176
175
  for (let i = 0; i < rawGaugeAddresses.length; i++) {
177
- gaugeAddresses.push(rawGaugeAddresses[i] !== curve.constants.ZERO_ADDRESS ? rawGaugeAddresses[i] : rawOldGaugeAddresses[i]);
176
+ gaugeAddresses.push(rawGaugeAddresses[i] !== this.constants.ZERO_ADDRESS ? rawGaugeAddresses[i] : rawOldGaugeAddresses[i]);
178
177
  }
179
178
  setTwocryptoFactorySwapContracts.call(this, swapAddresses);
180
179
  setTwocryptoFactoryGaugeContracts.call(this, gaugeAddresses);
@@ -1,9 +1,10 @@
1
- import { IDict, IPoolData, ICurve, IPoolDataShort } from "../interfaces";
1
+ import { IDict, IPoolData, IPoolDataShort } from "../interfaces";
2
+ import { Curve } from "../curve";
2
3
  export declare const BLACK_LIST: {
3
4
  [index: number]: any;
4
5
  };
5
- export declare function getBasePools(this: ICurve, factoryAddress: string, rawSwapAddresses: string[], tmpPools: IPoolDataShort[]): Promise<{
6
+ export declare function getBasePools(this: Curve, factoryAddress: string, rawSwapAddresses: string[], tmpPools: IPoolDataShort[]): Promise<{
6
7
  ids: string[];
7
8
  addresses: string[];
8
9
  }>;
9
- export declare function getFactoryPoolData(this: ICurve, fromIdx?: number, swapAddress?: string, factoryAddress?: string): Promise<IDict<IPoolData>>;
10
+ export declare function getFactoryPoolData(this: Curve, fromIdx?: number, swapAddress?: string, factoryAddress?: string): Promise<IDict<IPoolData>>;
@@ -8,15 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { Contract as MulticallContract } from "@curvefi/ethcall";
11
- import { curve } from "../curve.js";
12
- import ERC20ABI from "../constants/abis/ERC20.json" with { type: 'json' };
13
- import PlainStableSwapNGABI from "../constants/abis/factory-stable-ng/plain-stableswap-ng.json" with { type: 'json' };
14
- import MetaStableSwapNGABI from "../constants/abis/factory-stable-ng/meta-stableswap-ng.json" with { type: 'json' };
15
- import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: 'json' };
16
- import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: 'json' };
17
- import StableNgBasePoolZapABI from "../constants/abis/stable-ng-base-pool-zap.json" with { type: 'json' };
11
+ import ERC20ABI from "../constants/abis/ERC20.json" with { type: "json" };
12
+ import PlainStableSwapNGABI from "../constants/abis/factory-stable-ng/plain-stableswap-ng.json" with { type: "json" };
13
+ import MetaStableSwapNGABI from "../constants/abis/factory-stable-ng/meta-stableswap-ng.json" with { type: "json" };
14
+ import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: "json" };
15
+ import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: "json" };
16
+ import StableNgBasePoolZapABI from "../constants/abis/stable-ng-base-pool-zap.json" with { type: "json" };
18
17
  import { getPoolIdByAddress, setFactoryZapContracts } from "./common.js";
19
18
  import { getPoolName, isStableNgPool } from "../utils.js";
19
+ import { formatUnits } from "../constants/utils";
20
20
  export const BLACK_LIST = {
21
21
  1: [
22
22
  "0x066b6e1e93fa7dcd3f0eb7f8bac7d5a747ce0bf9",
@@ -44,7 +44,7 @@ export function getBasePools(factoryAddress, rawSwapAddresses, tmpPools) {
44
44
  const basePoolAddresses = [];
45
45
  result.forEach((item) => {
46
46
  if (item !== '0x0000000000000000000000000000000000000000') {
47
- basePoolIds.push(getPoolIdByAddress(tmpPools, item));
47
+ basePoolIds.push(getPoolIdByAddress.call(this, tmpPools, item));
48
48
  basePoolAddresses.push(item);
49
49
  }
50
50
  else {
@@ -62,7 +62,7 @@ function getRecentlyCreatedPoolId(swapAddress, factoryAddress) {
62
62
  return __awaiter(this, void 0, void 0, function* () {
63
63
  const factoryContract = this.contracts[factoryAddress].contract;
64
64
  const prefix = factoryAddress === this.constants.ALIASES.factory ? 'factory-v2' : 'factory-stable-ng';
65
- const poolCount = Number(curve.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
65
+ const poolCount = Number(this.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
66
66
  for (let i = 1; i <= poolCount; i++) {
67
67
  const address = yield factoryContract.pool_list(poolCount - i);
68
68
  if (address.toLowerCase() === swapAddress.toLowerCase())
@@ -76,7 +76,7 @@ function getFactoryIdsAndSwapAddresses() {
76
76
  var _a;
77
77
  const factoryContract = this.contracts[factoryAddress].contract;
78
78
  const factoryMulticallContract = this.contracts[factoryAddress].multicallContract;
79
- const poolCount = Number(curve.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
79
+ const poolCount = Number(this.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
80
80
  const calls = [];
81
81
  for (let i = fromIdx; i < poolCount; i++) {
82
82
  calls.push(factoryMulticallContract.pool_list(i));
@@ -99,18 +99,18 @@ function _handleReferenceAssets(referenceAssets) {
99
99
  0: "USD",
100
100
  1: "ETH",
101
101
  2: "BTC",
102
- }[curve.formatUnits(t, 0)] || "OTHER";
102
+ }[formatUnits(t, 0)] || "OTHER";
103
103
  });
104
104
  }
105
105
  function _handleCoinAddresses(coinAddresses) {
106
106
  return coinAddresses.map((addresses) => addresses
107
- .filter((addr) => addr !== curve.constants.ZERO_ADDRESS)
107
+ .filter((addr) => addr !== this.constants.ZERO_ADDRESS)
108
108
  .map((addr) => this.chainId === 137 && addr === "0x0000000000000000000000000000000000001010" ? this.constants.NATIVE_TOKEN.address : addr.toLowerCase()));
109
109
  }
110
110
  function getPoolsData(factorySwapAddresses, factoryAddress) {
111
111
  return __awaiter(this, void 0, void 0, function* () {
112
112
  const factoryMulticallContract = this.contracts[factoryAddress].multicallContract;
113
- const isChildGaugeFactoryNull = curve.chainId !== 1 && this.constants.ALIASES.child_gauge_factory === curve.constants.ZERO_ADDRESS;
113
+ const isChildGaugeFactoryNull = this.chainId !== 1 && this.constants.ALIASES.child_gauge_factory === this.constants.ZERO_ADDRESS;
114
114
  const isChildGaugeFactoryOldNull = !("child_gauge_factory_old" in this.constants.ALIASES);
115
115
  const isStableNgFactory = factoryAddress === this.constants.ALIASES['stable_ng_factory'];
116
116
  const calls = [];
@@ -139,9 +139,9 @@ function getPoolsData(factorySwapAddresses, factoryAddress) {
139
139
  if (isChildGaugeFactoryNull || isChildGaugeFactoryOldNull || isStableNgFactory) {
140
140
  for (let index = 0; index < res.length; index++) {
141
141
  if (isChildGaugeFactoryNull && index % 8 == 1)
142
- res.splice(index, 0, curve.constants.ZERO_ADDRESS);
142
+ res.splice(index, 0, this.constants.ZERO_ADDRESS);
143
143
  if (isChildGaugeFactoryOldNull && index % 8 == 2)
144
- res.splice(index, 0, curve.constants.ZERO_ADDRESS);
144
+ res.splice(index, 0, this.constants.ZERO_ADDRESS);
145
145
  if (isStableNgFactory && index % 8 == 3)
146
146
  res.splice(index, 0, -1);
147
147
  }
@@ -163,7 +163,7 @@ function setFactorySwapContracts(factorySwapAddresses, factorySwapABIs) {
163
163
  });
164
164
  }
165
165
  function setFactoryGaugeContracts(factoryGaugeAddresses) {
166
- factoryGaugeAddresses.filter((addr) => addr !== curve.constants.ZERO_ADDRESS).forEach((addr, i) => {
166
+ factoryGaugeAddresses.filter((addr) => addr !== this.constants.ZERO_ADDRESS).forEach((addr) => {
167
167
  this.setContract(addr, this.chainId === 1 ? factoryGaugeABI : gaugeChildABI);
168
168
  });
169
169
  }
@@ -214,7 +214,7 @@ function getCoinsData(coinAddresses, existingCoinAddrNameDict, existingCoinAddrD
214
214
  }
215
215
  const res = yield this.multicallProvider.all(calls);
216
216
  const symbols = res.filter((a, i) => i % 2 == 0);
217
- const decimals = res.filter((a, i) => i % 2 == 1).map((_d) => Number(curve.formatUnits(_d, 0)));
217
+ const decimals = res.filter((a, i) => i % 2 == 1).map((_d) => Number(this.formatUnits(_d, 0)));
218
218
  newCoinAddresses.forEach((addr, i) => {
219
219
  coinAddrNamesDict[addr] = symbols[i];
220
220
  coinAddrDecimalsDict[addr] = decimals[i];
@@ -223,14 +223,14 @@ function getCoinsData(coinAddresses, existingCoinAddrNameDict, existingCoinAddrD
223
223
  });
224
224
  }
225
225
  export function getFactoryPoolData() {
226
- return __awaiter(this, arguments, void 0, function* (fromIdx = 0, swapAddress, factoryAddress = curve.constants.ALIASES.factory) {
226
+ return __awaiter(this, arguments, void 0, function* (fromIdx = 0, swapAddress, factoryAddress = this.constants.ALIASES.factory) {
227
227
  var _a, _b, _c;
228
228
  const [rawPoolIds, rawSwapAddresses] = swapAddress ?
229
229
  [[yield getRecentlyCreatedPoolId.call(this, swapAddress, factoryAddress)], [swapAddress.toLowerCase()]]
230
230
  : yield getFactoryIdsAndSwapAddresses.call(this, fromIdx, factoryAddress);
231
231
  if (rawPoolIds.length === 0)
232
232
  return {};
233
- const is_ng = factoryAddress === curve.constants.ALIASES.stable_ng_factory;
233
+ const is_ng = factoryAddress === this.constants.ALIASES.stable_ng_factory;
234
234
  const [rawImplementations, rawGauges, rawOldGauges, rawReferenceAssets, rawPoolSymbols, rawPoolNames, rawIsMeta, rawCoinAddresses] = yield getPoolsData.call(this, rawSwapAddresses, factoryAddress);
235
235
  const poolIds = [];
236
236
  const swapAddresses = [];
@@ -247,7 +247,7 @@ export function getFactoryPoolData() {
247
247
  poolIds.push(rawPoolIds[i]);
248
248
  swapAddresses.push(rawSwapAddresses[i]);
249
249
  implementations.push(rawImplementations[i]);
250
- gaugeAddresses.push(rawGauges[i] !== curve.constants.ZERO_ADDRESS ? rawGauges[i] : rawOldGauges[i]);
250
+ gaugeAddresses.push(rawGauges[i] !== this.constants.ZERO_ADDRESS ? rawGauges[i] : rawOldGauges[i]);
251
251
  referenceAssets.push(rawReferenceAssets[i]);
252
252
  poolSymbols.push(rawPoolSymbols[i]);
253
253
  poolNames.push(rawPoolNames[i]);
@@ -298,15 +298,12 @@ export function getFactoryPoolData() {
298
298
  }
299
299
  else {
300
300
  const allPoolsData = Object.assign(Object.assign(Object.assign(Object.assign({}, this.constants.POOLS_DATA), this.constants.FACTORY_POOLS_DATA), this.constants.STABLE_NG_FACTORY_POOLS_DATA), FACTORY_POOLS_DATA);
301
- // @ts-ignore
302
301
  const basePoolIdCoinsDict = Object.fromEntries(basePools.ids.map((poolId) => { var _a; return [poolId, (_a = allPoolsData[poolId]) === null || _a === void 0 ? void 0 : _a.underlying_coins]; }));
303
- // @ts-ignore
304
302
  const basePoolIdCoinAddressesDict = Object.fromEntries(basePools.ids.map((poolId) => { var _a; return [poolId, (_a = allPoolsData[poolId]) === null || _a === void 0 ? void 0 : _a.underlying_coin_addresses]; }));
305
- // @ts-ignore
306
303
  const basePoolIdDecimalsDict = Object.fromEntries(basePools.ids.map((poolId) => { var _a; return [poolId, (_a = allPoolsData[poolId]) === null || _a === void 0 ? void 0 : _a.underlying_decimals]; }));
307
304
  const basePoolIdZapDict = (_b = this.constants.STABLE_FACTORY_CONSTANTS.basePoolIdZapDict) !== null && _b !== void 0 ? _b : {};
308
305
  this.constants.BASE_POOLS[basePools.ids[i]] = this.constants.BASE_POOLS[basePools.ids[i]] ? this.constants.BASE_POOLS[basePools.ids[i]] + 1 : 1;
309
- let deposit_address = (_c = this.constants.STABLE_FACTORY_CONSTANTS.stableNgBasePoolZap) !== null && _c !== void 0 ? _c : curve.constants.ZERO_ADDRESS;
306
+ let deposit_address = (_c = this.constants.STABLE_FACTORY_CONSTANTS.stableNgBasePoolZap) !== null && _c !== void 0 ? _c : this.constants.ZERO_ADDRESS;
310
307
  let deposit_abi = StableNgBasePoolZapABI;
311
308
  if (isStableNgPool(basePools.ids[i])) {
312
309
  this.setContract(deposit_address, StableNgBasePoolZapABI);