@curvefi/api 2.8.1 → 2.8.4

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": [
@@ -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
  });
@@ -35,6 +35,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
39
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
40
+ if (ar || !(i in from)) {
41
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42
+ ar[i] = from[i];
43
+ }
44
+ }
45
+ return to.concat(ar || Array.prototype.slice.call(from));
46
+ };
38
47
  var __importDefault = (this && this.__importDefault) || function (mod) {
39
48
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
49
  };
@@ -45,7 +54,10 @@ var ethcall_1 = require("ethcall");
45
54
  var ERC20_json_1 = __importDefault(require("../constants/abis/ERC20.json"));
46
55
  var factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/factory-crypto/factory-crypto-pool-2.json"));
47
56
  var gauge_factory_json_1 = __importDefault(require("../constants/abis/gauge_factory.json"));
57
+ var gauge_child_json_1 = __importDefault(require("../constants/abis/gauge_child.json"));
58
+ var base_pool_zap_json_1 = __importDefault(require("../constants/abis/atricrypto3/base_pool_zap.json"));
48
59
  var constants_1 = require("./constants");
60
+ var common_1 = require("./common");
49
61
  var deepFlatten = function (arr) { return [].concat.apply([], arr.map(function (v) { return (Array.isArray(v) ? deepFlatten(v) : v); })); };
50
62
  function getCryptoFactoryIdsAndSwapAddresses() {
51
63
  return __awaiter(this, void 0, void 0, function () {
@@ -134,8 +146,8 @@ function setCryptoFactoryGaugeContracts(factoryGaugeAddresses) {
134
146
  var _this = this;
135
147
  factoryGaugeAddresses.filter(function (addr) { return addr !== ethers_1.ethers.constants.AddressZero; }).forEach(function (addr, i) {
136
148
  _this.contracts[addr] = {
137
- contract: new ethers_1.Contract(addr, gauge_factory_json_1.default, _this.signer || _this.provider),
138
- multicallContract: new ethcall_1.Contract(addr, gauge_factory_json_1.default),
149
+ contract: new ethers_1.Contract(addr, _this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default, _this.signer || _this.provider),
150
+ multicallContract: new ethcall_1.Contract(addr, _this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default),
139
151
  };
140
152
  });
141
153
  }
@@ -308,9 +320,10 @@ function getCoinAddressDecimalsDict(coinAddresses, existingCoinAddressDecimalsDi
308
320
  });
309
321
  });
310
322
  }
323
+ var atricrypto3Lp = "0xdAD97F7713Ae9437fa9249920eC8507e5FbB23d3".toLowerCase();
311
324
  function getCryptoFactoryPoolData() {
312
325
  return __awaiter(this, void 0, void 0, function () {
313
- var _a, poolIds, swapAddresses, tokenAddresses, gaugeAddresses, _b, poolSymbols, poolNames, coinAddresses, underlyingCoinAddresses, existingCoinAddressNameDict, coinAddressNameDict, coinAddressDecimalsDict, CRYPTO_FACTORY_POOLS_DATA, i;
326
+ var _a, poolIds, swapAddresses, tokenAddresses, gaugeAddresses, _b, poolSymbols, poolNames, coinAddresses, underlyingCoinAddresses, existingCoinAddressNameDict, coinAddressNameDict, coinAddressDecimalsDict, CRYPTO_FACTORY_POOLS_DATA, i, isMeta, basePoolId, basePoolCoinNames, basePoolCoinAddresses, basePoolDecimals, basePoolZap;
314
327
  return __generator(this, function (_c) {
315
328
  switch (_c.label) {
316
329
  case 0: return [4 /*yield*/, getCryptoFactoryIdsAndSwapAddresses.call(this)];
@@ -342,27 +355,67 @@ function getCryptoFactoryPoolData() {
342
355
  return [4 /*yield*/, getCoinAddressDecimalsDict.call(this, coinAddresses, this.constants.DECIMALS)];
343
356
  case 8:
344
357
  coinAddressDecimalsDict = _c.sent();
358
+ common_1.setCryptoFactoryZapContracts.call(this);
345
359
  CRYPTO_FACTORY_POOLS_DATA = {};
346
360
  for (i = 0; i < poolIds.length; i++) {
347
- CRYPTO_FACTORY_POOLS_DATA[poolIds[i]] = {
348
- name: poolNames[i].split(": ")[1].trim(),
349
- full_name: poolNames[i],
350
- symbol: poolSymbols[i],
351
- reference_asset: "CRYPTO",
352
- swap_address: swapAddresses[i],
353
- token_address: tokenAddresses[i],
354
- gauge_address: gaugeAddresses[i],
355
- is_crypto: true,
356
- is_factory: true,
357
- underlying_coins: underlyingCoinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }),
358
- wrapped_coins: coinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }),
359
- underlying_coin_addresses: underlyingCoinAddresses[i],
360
- wrapped_coin_addresses: coinAddresses[i],
361
- underlying_decimals: underlyingCoinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }),
362
- wrapped_decimals: coinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }),
363
- swap_abi: factory_crypto_pool_2_json_1.default,
364
- gauge_abi: gauge_factory_json_1.default,
365
- };
361
+ isMeta = this.chainId === 137 && coinAddresses[i][1].toLowerCase() === atricrypto3Lp;
362
+ if (isMeta) {
363
+ basePoolId = "atricrypto3";
364
+ basePoolCoinNames = ['DAI', 'USDC', 'USDT', 'WBTC', 'WETH'];
365
+ basePoolCoinAddresses = [
366
+ '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063',
367
+ '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
368
+ '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
369
+ '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
370
+ '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', // WETH
371
+ ];
372
+ basePoolDecimals = [18, 6, 6, 8, 18];
373
+ basePoolZap = "0x3d8EADb739D1Ef95dd53D718e4810721837c69c1";
374
+ CRYPTO_FACTORY_POOLS_DATA[poolIds[i]] = {
375
+ name: poolNames[i].split(": ")[1].trim(),
376
+ full_name: poolNames[i],
377
+ symbol: poolSymbols[i],
378
+ reference_asset: "CRYPTO",
379
+ swap_address: swapAddresses[i],
380
+ token_address: tokenAddresses[i],
381
+ gauge_address: gaugeAddresses[i],
382
+ deposit_address: basePoolZap,
383
+ is_meta: true,
384
+ is_crypto: true,
385
+ is_factory: true,
386
+ base_pool: basePoolId,
387
+ underlying_coins: __spreadArray([coinAddressNameDict[coinAddresses[i][0]]], basePoolCoinNames, true),
388
+ wrapped_coins: coinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }),
389
+ underlying_coin_addresses: __spreadArray([coinAddresses[i][0]], basePoolCoinAddresses, true),
390
+ wrapped_coin_addresses: coinAddresses[i],
391
+ underlying_decimals: __spreadArray([coinAddressDecimalsDict[coinAddresses[i][0]]], basePoolDecimals, true),
392
+ wrapped_decimals: coinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }),
393
+ swap_abi: factory_crypto_pool_2_json_1.default,
394
+ gauge_abi: this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default,
395
+ deposit_abi: base_pool_zap_json_1.default,
396
+ };
397
+ }
398
+ else {
399
+ CRYPTO_FACTORY_POOLS_DATA[poolIds[i]] = {
400
+ name: poolNames[i].split(": ")[1].trim(),
401
+ full_name: poolNames[i],
402
+ symbol: poolSymbols[i],
403
+ reference_asset: "CRYPTO",
404
+ swap_address: swapAddresses[i],
405
+ token_address: tokenAddresses[i],
406
+ gauge_address: gaugeAddresses[i],
407
+ is_crypto: true,
408
+ is_factory: true,
409
+ underlying_coins: underlyingCoinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }),
410
+ wrapped_coins: coinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }),
411
+ underlying_coin_addresses: underlyingCoinAddresses[i],
412
+ wrapped_coin_addresses: coinAddresses[i],
413
+ underlying_decimals: underlyingCoinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }),
414
+ wrapped_decimals: coinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }),
415
+ swap_abi: factory_crypto_pool_2_json_1.default,
416
+ gauge_abi: this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default,
417
+ };
418
+ }
366
419
  }
367
420
  return [2 /*return*/, CRYPTO_FACTORY_POOLS_DATA];
368
421
  }