@curvefi/api 2.8.3 → 2.8.6

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.
@@ -0,0 +1,216 @@
1
+ [
2
+ {
3
+ "stateMutability": "nonpayable",
4
+ "type": "constructor",
5
+ "inputs": [
6
+ {
7
+ "name": "_base_pool",
8
+ "type": "address"
9
+ },
10
+ {
11
+ "name": "_base_lp_token",
12
+ "type": "address"
13
+ },
14
+ {
15
+ "name": "_weth",
16
+ "type": "address"
17
+ },
18
+ {
19
+ "name": "_base_coins",
20
+ "type": "address[5]"
21
+ }
22
+ ],
23
+ "outputs": []
24
+ },
25
+ {
26
+ "stateMutability": "payable",
27
+ "type": "fallback"
28
+ },
29
+ {
30
+ "stateMutability": "payable",
31
+ "type": "function",
32
+ "name": "exchange",
33
+ "inputs": [
34
+ {
35
+ "name": "_pool",
36
+ "type": "address"
37
+ },
38
+ {
39
+ "name": "i",
40
+ "type": "uint256"
41
+ },
42
+ {
43
+ "name": "j",
44
+ "type": "uint256"
45
+ },
46
+ {
47
+ "name": "_dx",
48
+ "type": "uint256"
49
+ },
50
+ {
51
+ "name": "_min_dy",
52
+ "type": "uint256"
53
+ }
54
+ ],
55
+ "outputs": [
56
+ {
57
+ "name": "",
58
+ "type": "uint256"
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "stateMutability": "view",
64
+ "type": "function",
65
+ "name": "get_dy",
66
+ "inputs": [
67
+ {
68
+ "name": "_pool",
69
+ "type": "address"
70
+ },
71
+ {
72
+ "name": "i",
73
+ "type": "uint256"
74
+ },
75
+ {
76
+ "name": "j",
77
+ "type": "uint256"
78
+ },
79
+ {
80
+ "name": "_dx",
81
+ "type": "uint256"
82
+ }
83
+ ],
84
+ "outputs": [
85
+ {
86
+ "name": "",
87
+ "type": "uint256"
88
+ }
89
+ ]
90
+ },
91
+ {
92
+ "stateMutability": "payable",
93
+ "type": "function",
94
+ "name": "add_liquidity",
95
+ "inputs": [
96
+ {
97
+ "name": "_pool",
98
+ "type": "address"
99
+ },
100
+ {
101
+ "name": "_deposit_amounts",
102
+ "type": "uint256[6]"
103
+ },
104
+ {
105
+ "name": "_min_mint_amount",
106
+ "type": "uint256"
107
+ }
108
+ ],
109
+ "outputs": [
110
+ {
111
+ "name": "",
112
+ "type": "uint256"
113
+ }
114
+ ]
115
+ },
116
+ {
117
+ "stateMutability": "view",
118
+ "type": "function",
119
+ "name": "calc_token_amount",
120
+ "inputs": [
121
+ {
122
+ "name": "_pool",
123
+ "type": "address"
124
+ },
125
+ {
126
+ "name": "_amounts",
127
+ "type": "uint256[6]"
128
+ }
129
+ ],
130
+ "outputs": [
131
+ {
132
+ "name": "",
133
+ "type": "uint256"
134
+ }
135
+ ]
136
+ },
137
+ {
138
+ "stateMutability": "nonpayable",
139
+ "type": "function",
140
+ "name": "remove_liquidity",
141
+ "inputs": [
142
+ {
143
+ "name": "_pool",
144
+ "type": "address"
145
+ },
146
+ {
147
+ "name": "_burn_amount",
148
+ "type": "uint256"
149
+ },
150
+ {
151
+ "name": "_min_amounts",
152
+ "type": "uint256[6]"
153
+ }
154
+ ],
155
+ "outputs": [
156
+ {
157
+ "name": "",
158
+ "type": "uint256[6]"
159
+ }
160
+ ]
161
+ },
162
+ {
163
+ "stateMutability": "nonpayable",
164
+ "type": "function",
165
+ "name": "remove_liquidity_one_coin",
166
+ "inputs": [
167
+ {
168
+ "name": "_pool",
169
+ "type": "address"
170
+ },
171
+ {
172
+ "name": "_burn_amount",
173
+ "type": "uint256"
174
+ },
175
+ {
176
+ "name": "i",
177
+ "type": "uint256"
178
+ },
179
+ {
180
+ "name": "_min_amount",
181
+ "type": "uint256"
182
+ }
183
+ ],
184
+ "outputs": [
185
+ {
186
+ "name": "",
187
+ "type": "uint256"
188
+ }
189
+ ]
190
+ },
191
+ {
192
+ "stateMutability": "view",
193
+ "type": "function",
194
+ "name": "calc_withdraw_one_coin",
195
+ "inputs": [
196
+ {
197
+ "name": "_pool",
198
+ "type": "address"
199
+ },
200
+ {
201
+ "name": "_token_amount",
202
+ "type": "uint256"
203
+ },
204
+ {
205
+ "name": "i",
206
+ "type": "uint256"
207
+ }
208
+ ],
209
+ "outputs": [
210
+ {
211
+ "name": "",
212
+ "type": "uint256"
213
+ }
214
+ ]
215
+ }
216
+ ]
@@ -178,7 +178,7 @@
178
178
  ]
179
179
  },
180
180
  {
181
- "stateMutability": "nonpayable",
181
+ "stateMutability": "view",
182
182
  "type": "function",
183
183
  "name": "claimable_tokens",
184
184
  "inputs": [
package/lib/curve.js CHANGED
@@ -188,11 +188,12 @@ var Curve = /** @class */ (function () {
188
188
  }
189
189
  Curve.prototype.init = function (providerType, providerSettings, options // gasPrice in Gwei
190
190
  ) {
191
+ var _a;
191
192
  if (options === void 0) { options = {}; }
192
193
  return __awaiter(this, void 0, void 0, function () {
193
- var network, _a, _b, cTokens, yTokens, ycTokens, aTokens, customAbiTokens, _c, err_1, _i, _d, pool, _e, _f, coinAddr, _g, _h, coinAddr, _j, _k, coinAddr, _minterABI, addressProviderContract, _l;
194
- return __generator(this, function (_m) {
195
- switch (_m.label) {
194
+ var network, _b, _c, cTokens, yTokens, ycTokens, aTokens, customAbiTokens, _d, err_1, _i, _e, pool, _f, _g, coinAddr, _h, _j, coinAddr, _k, _l, coinAddr, _minterABI, addressProviderContract, _m;
195
+ return __generator(this, function (_o) {
196
+ switch (_o.label) {
196
197
  case 0:
197
198
  // @ts-ignore
198
199
  this.provider = null;
@@ -228,7 +229,7 @@ var Curve = /** @class */ (function () {
228
229
  if (providerSettings.privateKey) {
229
230
  this.signer = new ethers_1.ethers.Wallet(providerSettings.privateKey, this.provider);
230
231
  }
231
- else {
232
+ else if (!((_a = providerSettings.url) === null || _a === void 0 ? void 0 : _a.startsWith("https://rpc.gnosischain.com"))) {
232
233
  this.signer = this.provider.getSigner();
233
234
  }
234
235
  // Web3 provider
@@ -253,14 +254,14 @@ var Curve = /** @class */ (function () {
253
254
  else {
254
255
  throw Error('Wrong providerType');
255
256
  }
256
- _a = this.provider.network;
257
- if (_a) return [3 /*break*/, 2];
257
+ _b = this.provider.network;
258
+ if (_b) return [3 /*break*/, 2];
258
259
  return [4 /*yield*/, this.provider._networkPromise];
259
260
  case 1:
260
- _a = (_m.sent());
261
- _m.label = 2;
261
+ _b = (_o.sent());
262
+ _o.label = 2;
262
263
  case 2:
263
- network = _a;
264
+ network = _b;
264
265
  console.log("CURVE-JS IS CONNECTED TO NETWORK:", network);
265
266
  this.chainId = network.chainId === 1337 ? 1 : network.chainId;
266
267
  this.constants.NETWORK_NAME = exports.NETWORK_CONSTANTS[this.chainId].NAME;
@@ -269,41 +270,41 @@ var Curve = /** @class */ (function () {
269
270
  this.constants.COINS = exports.NETWORK_CONSTANTS[this.chainId].COINS;
270
271
  this.constants.DECIMALS = (0, utils_1.extractDecimals)(this.constants.POOLS_DATA);
271
272
  this.constants.GAUGES = (0, utils_1.extractGauges)(this.constants.POOLS_DATA);
272
- _b = [
273
+ _c = [
273
274
  exports.NETWORK_CONSTANTS[this.chainId].cTokens,
274
275
  exports.NETWORK_CONSTANTS[this.chainId].yTokens,
275
276
  exports.NETWORK_CONSTANTS[this.chainId].ycTokens,
276
277
  exports.NETWORK_CONSTANTS[this.chainId].aTokens,
277
- ], cTokens = _b[0], yTokens = _b[1], ycTokens = _b[2], aTokens = _b[3];
278
+ ], cTokens = _c[0], yTokens = _c[1], ycTokens = _c[2], aTokens = _c[3];
278
279
  customAbiTokens = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], cTokens, true), yTokens, true), ycTokens, true), aTokens, true);
279
280
  this.multicallProvider = new ethcall_1.Provider();
280
281
  return [4 /*yield*/, this.multicallProvider.init(this.provider)];
281
282
  case 3:
282
- _m.sent();
283
+ _o.sent();
283
284
  if (!this.signer) return [3 /*break*/, 8];
284
- _m.label = 4;
285
+ _o.label = 4;
285
286
  case 4:
286
- _m.trys.push([4, 6, , 7]);
287
- _c = this;
287
+ _o.trys.push([4, 6, , 7]);
288
+ _d = this;
288
289
  return [4 /*yield*/, this.signer.getAddress()];
289
290
  case 5:
290
- _c.signerAddress = _m.sent();
291
+ _d.signerAddress = _o.sent();
291
292
  return [3 /*break*/, 7];
292
293
  case 6:
293
- err_1 = _m.sent();
294
+ err_1 = _o.sent();
294
295
  this.signer = null;
295
296
  return [3 /*break*/, 7];
296
297
  case 7: return [3 /*break*/, 9];
297
298
  case 8:
298
299
  this.signerAddress = '';
299
- _m.label = 9;
300
+ _o.label = 9;
300
301
  case 9:
301
302
  this.feeData = { gasPrice: options.gasPrice, maxFeePerGas: options.maxFeePerGas, maxPriorityFeePerGas: options.maxPriorityFeePerGas };
302
303
  return [4 /*yield*/, this.updateFeeData()];
303
304
  case 10:
304
- _m.sent();
305
- for (_i = 0, _d = Object.values(this.constants.POOLS_DATA); _i < _d.length; _i++) {
306
- pool = _d[_i];
305
+ _o.sent();
306
+ for (_i = 0, _e = Object.values(this.constants.POOLS_DATA); _i < _e.length; _i++) {
307
+ pool = _e[_i];
307
308
  this.contracts[pool.swap_address] = {
308
309
  contract: new ethers_1.Contract(pool.swap_address, pool.swap_abi, this.signer || this.provider),
309
310
  multicallContract: new ethcall_1.Contract(pool.swap_address, pool.swap_abi),
@@ -326,15 +327,15 @@ var Curve = /** @class */ (function () {
326
327
  multicallContract: new ethcall_1.Contract(pool.deposit_address, pool.deposit_abi),
327
328
  };
328
329
  }
329
- for (_e = 0, _f = pool.underlying_coin_addresses; _e < _f.length; _e++) {
330
- coinAddr = _f[_e];
330
+ for (_f = 0, _g = pool.underlying_coin_addresses; _f < _g.length; _f++) {
331
+ coinAddr = _g[_f];
331
332
  this.contracts[coinAddr] = {
332
333
  contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
333
334
  multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
334
335
  };
335
336
  }
336
- for (_g = 0, _h = pool.wrapped_coin_addresses; _g < _h.length; _g++) {
337
- coinAddr = _h[_g];
337
+ for (_h = 0, _j = pool.wrapped_coin_addresses; _h < _j.length; _h++) {
338
+ coinAddr = _j[_h];
338
339
  if (customAbiTokens.includes(coinAddr))
339
340
  continue;
340
341
  if (coinAddr in this.contracts)
@@ -345,8 +346,8 @@ var Curve = /** @class */ (function () {
345
346
  };
346
347
  }
347
348
  // TODO add all coins
348
- for (_j = 0, _k = pool.wrapped_coin_addresses; _j < _k.length; _j++) {
349
- coinAddr = _k[_j];
349
+ for (_k = 0, _l = pool.wrapped_coin_addresses; _k < _l.length; _k++) {
350
+ coinAddr = _l[_k];
350
351
  if (cTokens.includes(coinAddr)) {
351
352
  this.contracts[coinAddr] = {
352
353
  contract: new ethers_1.Contract(coinAddr, cERC20_json_1.default, this.signer || this.provider),
@@ -414,10 +415,10 @@ var Curve = /** @class */ (function () {
414
415
  multicallContract: new ethcall_1.Contract(this.constants.ALIASES.address_provider, address_provider_json_1.default),
415
416
  };
416
417
  addressProviderContract = this.contracts[this.constants.ALIASES.address_provider].contract;
417
- _l = this.constants.ALIASES;
418
+ _m = this.constants.ALIASES;
418
419
  return [4 /*yield*/, addressProviderContract.get_address(2, this.constantOptions)];
419
420
  case 11:
420
- _l.registry_exchange = _m.sent();
421
+ _m.registry_exchange = _o.sent();
421
422
  this.contracts[this.constants.ALIASES.registry_exchange] = {
422
423
  contract: new ethers_1.Contract(this.constants.ALIASES.registry_exchange, registry_exchange_json_1.default, this.signer || this.provider),
423
424
  multicallContract: new ethcall_1.Contract(this.constants.ALIASES.registry_exchange, registry_exchange_json_1.default),
@@ -1,2 +1,3 @@
1
1
  import { ICurve } from "../interfaces";
2
2
  export declare function setFactoryZapContracts(this: ICurve): void;
3
+ export declare function setCryptoFactoryZapContracts(this: ICurve): void;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.setFactoryZapContracts = void 0;
6
+ exports.setCryptoFactoryZapContracts = exports.setFactoryZapContracts = void 0;
7
7
  var ethers_1 = require("ethers");
8
8
  var ethcall_1 = require("ethcall");
9
9
  var deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/deposit.json"));
@@ -12,6 +12,7 @@ var DepositZapMetaUsdPolygon_json_1 = __importDefault(require("../constants/abis
12
12
  var DepositZapMetaBtcPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaBtcPolygon.json"));
13
13
  var DepositZapFantom_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapFantom.json"));
14
14
  var DepositZapMetaUsd2Fantom_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaUsd2Fantom.json"));
15
+ var base_pool_zap_json_1 = __importDefault(require("../constants/abis/atricrypto3/base_pool_zap.json"));
15
16
  function setFactoryZapContracts() {
16
17
  if (this.chainId === 1) {
17
18
  var fraxusdcMetaZapAddress = "0x08780fb7E580e492c1935bEe4fA5920b94AA95Da".toLowerCase();
@@ -94,3 +95,13 @@ function setFactoryZapContracts() {
94
95
  }
95
96
  }
96
97
  exports.setFactoryZapContracts = setFactoryZapContracts;
98
+ function setCryptoFactoryZapContracts() {
99
+ if (this.chainId === 137) {
100
+ var atricrypto3ZapAddress = "0x3d8EADb739D1Ef95dd53D718e4810721837c69c1".toLowerCase();
101
+ this.contracts[atricrypto3ZapAddress] = {
102
+ contract: new ethers_1.Contract(atricrypto3ZapAddress, base_pool_zap_json_1.default, this.signer || this.provider),
103
+ multicallContract: new ethcall_1.Contract(atricrypto3ZapAddress, base_pool_zap_json_1.default),
104
+ };
105
+ }
106
+ }
107
+ exports.setCryptoFactoryZapContracts = setCryptoFactoryZapContracts;
@@ -126,6 +126,8 @@ exports.implementationABIDictArbitrum = {
126
126
  exports.implementationABIDictOptimism = {
127
127
  "0x78CF256256C8089d68Cde634Cf7cDEFb39286470": MetaUSD_json_1.default,
128
128
  "0xADf698e4d8Df08b3E2c79682891636eF00F6e205": MetaUSDBalances_json_1.default,
129
+ "0xe8269B33E47761f552E1a3070119560d5fa8bBD6": MetaFraxUSD_json_1.default,
130
+ "0x114C4042B11a2b16F58Fe1BFe847589a122F678a": MetaFraxUSDBalances_json_1.default,
129
131
  "0xC2b1DF84112619D190193E48148000e3990Bf627": Plain2Basic_json_1.default,
130
132
  "0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90": Plain2Balances_json_1.default,
131
133
  "0x4f3E8F405CF5aFC05D68142F3783bDfE13811522": Plain2ETH_json_1.default,
@@ -195,6 +197,8 @@ exports.implementationBasePoolIdDictArbitrum = {
195
197
  exports.implementationBasePoolIdDictOptimism = {
196
198
  "0x78CF256256C8089d68Cde634Cf7cDEFb39286470": "3pool",
197
199
  "0xADf698e4d8Df08b3E2c79682891636eF00F6e205": "3pool",
200
+ "0xe8269B33E47761f552E1a3070119560d5fa8bBD6": "factory-v2-16",
201
+ "0x114C4042B11a2b16F58Fe1BFe847589a122F678a": "factory-v2-16", // fraxusdc
198
202
  };
199
203
  exports.implementationBasePoolIdDictXDai = {
200
204
  "0x4A5bF7Ab9A8202692051c19B102d3eDD62aaBAE6": "3pool",
@@ -225,6 +229,7 @@ exports.basePoolIdZapDictArbitrum = {
225
229
  };
226
230
  exports.basePoolIdZapDictOptimism = {
227
231
  "3pool": "0x167e42a1c7ab4be03764a2222aac57f5f6754411".toLowerCase(),
232
+ "factory-v2-16": "'0x4244eB811D6e0Ef302326675207A95113dB4E1F8'".toLowerCase(),
228
233
  };
229
234
  exports.basePoolIdZapDictXDai = {
230
235
  "3pool": "0x87C067fAc25f123554a0E76596BF28cFa37fD5E9".toLowerCase(),
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -53,9 +64,11 @@ var axios_1 = __importDefault(require("axios"));
53
64
  var ethers_1 = require("ethers");
54
65
  var ethcall_1 = require("ethcall");
55
66
  var gauge_factory_json_1 = __importDefault(require("../constants/abis/gauge_factory.json"));
67
+ var gauge_child_json_1 = __importDefault(require("../constants/abis/gauge_child.json"));
56
68
  var deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/deposit.json"));
57
69
  var ERC20_json_1 = __importDefault(require("../constants/abis/ERC20.json"));
58
70
  var factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/factory-crypto/factory-crypto-pool-2.json"));
71
+ var base_pool_zap_json_1 = __importDefault(require("../constants/abis/atricrypto3/base_pool_zap.json"));
59
72
  var constants_1 = require("./constants");
60
73
  var common_1 = require("./common");
61
74
  function setFactorySwapContracts(rawPoolList, isCrypto) {
@@ -96,8 +109,8 @@ function setFactoryGaugeContracts(rawPoolList) {
96
109
  if (pool.gaugeAddress) {
97
110
  var addr = pool.gaugeAddress.toLowerCase();
98
111
  _this.contracts[addr] = {
99
- contract: new ethers_1.Contract(addr, gauge_factory_json_1.default, _this.signer || _this.provider),
100
- multicallContract: new ethcall_1.Contract(addr, gauge_factory_json_1.default),
112
+ contract: new ethers_1.Contract(addr, _this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default, _this.signer || _this.provider),
113
+ multicallContract: new ethcall_1.Contract(addr, _this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default),
101
114
  };
102
115
  }
103
116
  });
@@ -133,22 +146,38 @@ function setFactoryRewardCoinsContracts(rawPoolList) {
133
146
  }
134
147
  }
135
148
  }
149
+ var atricrypto3Lp = "0xdAD97F7713Ae9437fa9249920eC8507e5FbB23d3".toLowerCase();
136
150
  function getFactoryPoolsDataFromApi(isCrypto) {
137
151
  return __awaiter(this, void 0, void 0, function () {
138
- var network, factoryType, url, response, rawPoolList, mainAddresses, FACTORY_POOLS_DATA;
152
+ var network, factoryType, url, response, rawPoolList, mainAddresses, url_1, response_1, poolGaugeDict, _i, _a, gaugeData, i, FACTORY_POOLS_DATA;
139
153
  var _this = this;
140
- return __generator(this, function (_a) {
141
- switch (_a.label) {
154
+ return __generator(this, function (_b) {
155
+ switch (_b.label) {
142
156
  case 0:
143
157
  network = this.constants.NETWORK_NAME;
144
158
  factoryType = isCrypto ? "factory-crypto" : "factory";
145
159
  url = "https://api.curve.fi/api/getPools/".concat(network, "/").concat(factoryType);
146
160
  return [4 /*yield*/, axios_1.default.get(url)];
147
161
  case 1:
148
- response = _a.sent();
162
+ response = _b.sent();
149
163
  rawPoolList = response.data.data.poolData;
150
164
  mainAddresses = Object.values(this.constants.POOLS_DATA).map(function (pool) { return pool.swap_address.toLowerCase(); });
151
165
  rawPoolList = rawPoolList.filter(function (p) { return !mainAddresses.includes(p.address.toLowerCase()); });
166
+ if (!(this.chainId !== 1)) return [3 /*break*/, 3];
167
+ url_1 = "https://api.curve.fi/api/getFactoGauges/".concat(network);
168
+ return [4 /*yield*/, axios_1.default.get(url_1)];
169
+ case 2:
170
+ response_1 = _b.sent();
171
+ poolGaugeDict = {};
172
+ for (_i = 0, _a = response_1.data.data.gauges; _i < _a.length; _i++) {
173
+ gaugeData = _a[_i];
174
+ poolGaugeDict[gaugeData.swap] = gaugeData.gauge;
175
+ }
176
+ for (i = 0; i < rawPoolList.length; i++) {
177
+ rawPoolList[i].gaugeAddress = poolGaugeDict[rawPoolList[i].address];
178
+ }
179
+ _b.label = 3;
180
+ case 3:
152
181
  setFactorySwapContracts.call(this, rawPoolList, isCrypto);
153
182
  if (isCrypto)
154
183
  setCryptoFactoryTokenContracts.call(this, rawPoolList);
@@ -157,6 +186,8 @@ function getFactoryPoolsDataFromApi(isCrypto) {
157
186
  setFactoryRewardCoinsContracts.call(this, rawPoolList);
158
187
  if (!isCrypto)
159
188
  common_1.setFactoryZapContracts.call(this);
189
+ if (isCrypto)
190
+ common_1.setCryptoFactoryZapContracts.call(this);
160
191
  FACTORY_POOLS_DATA = {};
161
192
  rawPoolList.forEach(function (pool) {
162
193
  var coinAddresses = pool.coins.map(function (c) { return c.address.toLowerCase(); });
@@ -167,36 +198,76 @@ function getFactoryPoolsDataFromApi(isCrypto) {
167
198
  var cryptoCoinNames = pool.coins.map(function (c) { return c.symbol === nativeToken.symbol ? nativeToken.wrappedSymbol : c.symbol; });
168
199
  var underlyingCoinNames = pool.coins.map(function (c) { return c.symbol === nativeToken.wrappedSymbol ? nativeToken.symbol : c.symbol; });
169
200
  var underlyingCoinAddresses = coinAddresses.map(function (addr) { return addr === nativeToken.wrappedAddress ? constants_1.NATIVE_TOKEN_ADDRESS : addr; });
170
- FACTORY_POOLS_DATA[pool.id] = {
171
- name: pool.name.split(": ")[1].trim(),
172
- full_name: pool.name,
173
- symbol: pool.symbol,
174
- reference_asset: "CRYPTO",
175
- swap_address: pool.address.toLowerCase(),
176
- token_address: pool.lpTokenAddress.toLowerCase(),
177
- gauge_address: pool.gaugeAddress ? pool.gaugeAddress.toLowerCase() : ethers_1.ethers.constants.AddressZero,
178
- is_crypto: true,
179
- is_factory: true,
180
- underlying_coins: underlyingCoinNames,
181
- wrapped_coins: cryptoCoinNames,
182
- underlying_coin_addresses: underlyingCoinAddresses,
183
- wrapped_coin_addresses: coinAddresses,
184
- underlying_decimals: coinDecimals,
185
- wrapped_decimals: coinDecimals,
186
- swap_abi: factory_crypto_pool_2_json_1.default,
187
- gauge_abi: gauge_factory_json_1.default,
188
- };
201
+ var isMeta = _this.chainId === 137 && coinAddresses[1].toLowerCase() === atricrypto3Lp;
202
+ if (isMeta) {
203
+ var basePoolId = "atricrypto3";
204
+ var basePoolCoinNames = ['DAI', 'USDC', 'USDT', 'WBTC', 'WETH'];
205
+ var basePoolCoinAddresses = [
206
+ '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063',
207
+ '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
208
+ '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
209
+ '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
210
+ '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', // WETH
211
+ ];
212
+ var basePoolDecimals = [18, 6, 6, 8, 18];
213
+ var basePoolZap = "0x3d8EADb739D1Ef95dd53D718e4810721837c69c1";
214
+ FACTORY_POOLS_DATA[pool.id] = {
215
+ name: pool.name.split(": ")[1].trim(),
216
+ full_name: pool.name,
217
+ symbol: pool.symbol,
218
+ reference_asset: "CRYPTO",
219
+ swap_address: pool.address.toLowerCase(),
220
+ token_address: pool.lpTokenAddress.toLowerCase(),
221
+ gauge_address: pool.gaugeAddress ? pool.gaugeAddress.toLowerCase() : ethers_1.ethers.constants.AddressZero,
222
+ deposit_address: basePoolZap,
223
+ is_meta: true,
224
+ is_crypto: true,
225
+ is_factory: true,
226
+ base_pool: basePoolId,
227
+ underlying_coins: __spreadArray([coinNames[0]], basePoolCoinNames, true),
228
+ wrapped_coins: coinNames,
229
+ underlying_coin_addresses: __spreadArray([coinAddresses[0]], basePoolCoinAddresses, true),
230
+ wrapped_coin_addresses: coinAddresses,
231
+ underlying_decimals: __spreadArray([coinDecimals[0]], basePoolDecimals, true),
232
+ wrapped_decimals: coinDecimals,
233
+ swap_abi: factory_crypto_pool_2_json_1.default,
234
+ gauge_abi: _this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default,
235
+ deposit_abi: base_pool_zap_json_1.default,
236
+ };
237
+ }
238
+ else {
239
+ FACTORY_POOLS_DATA[pool.id] = {
240
+ name: pool.name.split(": ")[1].trim(),
241
+ full_name: pool.name,
242
+ symbol: pool.symbol,
243
+ reference_asset: "CRYPTO",
244
+ swap_address: pool.address.toLowerCase(),
245
+ token_address: pool.lpTokenAddress.toLowerCase(),
246
+ gauge_address: pool.gaugeAddress ? pool.gaugeAddress.toLowerCase() : ethers_1.ethers.constants.AddressZero,
247
+ is_crypto: true,
248
+ is_factory: true,
249
+ underlying_coins: underlyingCoinNames,
250
+ wrapped_coins: cryptoCoinNames,
251
+ underlying_coin_addresses: underlyingCoinAddresses,
252
+ wrapped_coin_addresses: coinAddresses,
253
+ underlying_decimals: coinDecimals,
254
+ wrapped_decimals: coinDecimals,
255
+ swap_abi: factory_crypto_pool_2_json_1.default,
256
+ gauge_abi: _this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default,
257
+ };
258
+ }
189
259
  }
190
260
  else if (pool.implementation.startsWith("meta")) {
191
261
  var implementationABIDict = constants_1.FACTORY_CONSTANTS[_this.chainId].implementationABIDict;
192
262
  var implementationBasePoolIdDict = constants_1.FACTORY_CONSTANTS[_this.chainId].implementationBasePoolIdDict;
193
263
  var basePoolIds = Object.values(implementationBasePoolIdDict).filter(function (poolId, i, arr) { return arr.indexOf(poolId) === i; });
264
+ var allPoolsData_1 = __assign(__assign({}, _this.constants.POOLS_DATA), FACTORY_POOLS_DATA);
194
265
  // @ts-ignore
195
- var basePoolIdCoinsDict = Object.fromEntries(basePoolIds.map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coins]; }));
266
+ var basePoolIdCoinsDict = Object.fromEntries(basePoolIds.map(function (poolId) { var _a; return [poolId, (_a = allPoolsData_1[poolId]) === null || _a === void 0 ? void 0 : _a.underlying_coins]; }));
196
267
  // @ts-ignore
197
- var basePoolIdCoinAddressesDict = Object.fromEntries(basePoolIds.map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coin_addresses]; }));
268
+ var basePoolIdCoinAddressesDict = Object.fromEntries(basePoolIds.map(function (poolId) { var _a; return [poolId, (_a = allPoolsData_1[poolId]) === null || _a === void 0 ? void 0 : _a.underlying_coin_addresses]; }));
198
269
  // @ts-ignore
199
- var basePoolIdDecimalsDict = Object.fromEntries(basePoolIds.map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_decimals]; }));
270
+ var basePoolIdDecimalsDict = Object.fromEntries(basePoolIds.map(function (poolId) { var _a; return [poolId, (_a = allPoolsData_1[poolId]) === null || _a === void 0 ? void 0 : _a.underlying_decimals]; }));
200
271
  var basePoolIdZapDict = constants_1.FACTORY_CONSTANTS[_this.chainId].basePoolIdZapDict;
201
272
  var basePoolId = implementationBasePoolIdDict[pool.implementationAddress];
202
273
  var basePoolCoinNames = basePoolIdCoinsDict[basePoolId];
@@ -222,7 +293,7 @@ function getFactoryPoolsDataFromApi(isCrypto) {
222
293
  underlying_decimals: __spreadArray([coinDecimals[0]], basePoolDecimals, true),
223
294
  wrapped_decimals: coinDecimals,
224
295
  swap_abi: implementationABIDict[pool.implementationAddress],
225
- gauge_abi: gauge_factory_json_1.default,
296
+ gauge_abi: _this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default,
226
297
  deposit_abi: deposit_json_1.default,
227
298
  };
228
299
  }
@@ -245,7 +316,7 @@ function getFactoryPoolsDataFromApi(isCrypto) {
245
316
  underlying_decimals: coinDecimals,
246
317
  wrapped_decimals: coinDecimals,
247
318
  swap_abi: implementationABIDict[pool.implementationAddress],
248
- gauge_abi: gauge_factory_json_1.default,
319
+ gauge_abi: _this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default,
249
320
  };
250
321
  }
251
322
  });