@curvefi/api 2.12.1 → 2.13.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.
@@ -0,0 +1,291 @@
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[3]"
21
+ }
22
+ ],
23
+ "outputs": []
24
+ },
25
+ {
26
+ "stateMutability": "payable",
27
+ "type": "fallback"
28
+ },
29
+ {
30
+ "stateMutability": "pure",
31
+ "type": "function",
32
+ "name": "base_pool",
33
+ "inputs": [],
34
+ "outputs": [
35
+ {
36
+ "name": "",
37
+ "type": "address"
38
+ }
39
+ ]
40
+ },
41
+ {
42
+ "stateMutability": "pure",
43
+ "type": "function",
44
+ "name": "base_token",
45
+ "inputs": [],
46
+ "outputs": [
47
+ {
48
+ "name": "",
49
+ "type": "address"
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "stateMutability": "view",
55
+ "type": "function",
56
+ "name": "price_oracle",
57
+ "inputs": [
58
+ {
59
+ "name": "_pool",
60
+ "type": "address"
61
+ }
62
+ ],
63
+ "outputs": [
64
+ {
65
+ "name": "",
66
+ "type": "uint256"
67
+ }
68
+ ]
69
+ },
70
+ {
71
+ "stateMutability": "view",
72
+ "type": "function",
73
+ "name": "price_scale",
74
+ "inputs": [
75
+ {
76
+ "name": "_pool",
77
+ "type": "address"
78
+ }
79
+ ],
80
+ "outputs": [
81
+ {
82
+ "name": "",
83
+ "type": "uint256"
84
+ }
85
+ ]
86
+ },
87
+ {
88
+ "stateMutability": "view",
89
+ "type": "function",
90
+ "name": "lp_price",
91
+ "inputs": [
92
+ {
93
+ "name": "_pool",
94
+ "type": "address"
95
+ }
96
+ ],
97
+ "outputs": [
98
+ {
99
+ "name": "",
100
+ "type": "uint256"
101
+ }
102
+ ]
103
+ },
104
+ {
105
+ "stateMutability": "payable",
106
+ "type": "function",
107
+ "name": "exchange",
108
+ "inputs": [
109
+ {
110
+ "name": "_pool",
111
+ "type": "address"
112
+ },
113
+ {
114
+ "name": "i",
115
+ "type": "uint256"
116
+ },
117
+ {
118
+ "name": "j",
119
+ "type": "uint256"
120
+ },
121
+ {
122
+ "name": "_dx",
123
+ "type": "uint256"
124
+ },
125
+ {
126
+ "name": "_min_dy",
127
+ "type": "uint256"
128
+ }
129
+ ],
130
+ "outputs": [
131
+ {
132
+ "name": "",
133
+ "type": "uint256"
134
+ }
135
+ ]
136
+ },
137
+ {
138
+ "stateMutability": "view",
139
+ "type": "function",
140
+ "name": "get_dy",
141
+ "inputs": [
142
+ {
143
+ "name": "_pool",
144
+ "type": "address"
145
+ },
146
+ {
147
+ "name": "i",
148
+ "type": "uint256"
149
+ },
150
+ {
151
+ "name": "j",
152
+ "type": "uint256"
153
+ },
154
+ {
155
+ "name": "_dx",
156
+ "type": "uint256"
157
+ }
158
+ ],
159
+ "outputs": [
160
+ {
161
+ "name": "",
162
+ "type": "uint256"
163
+ }
164
+ ]
165
+ },
166
+ {
167
+ "stateMutability": "payable",
168
+ "type": "function",
169
+ "name": "add_liquidity",
170
+ "inputs": [
171
+ {
172
+ "name": "_pool",
173
+ "type": "address"
174
+ },
175
+ {
176
+ "name": "_deposit_amounts",
177
+ "type": "uint256[4]"
178
+ },
179
+ {
180
+ "name": "_min_mint_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_token_amount",
195
+ "inputs": [
196
+ {
197
+ "name": "_pool",
198
+ "type": "address"
199
+ },
200
+ {
201
+ "name": "_amounts",
202
+ "type": "uint256[4]"
203
+ }
204
+ ],
205
+ "outputs": [
206
+ {
207
+ "name": "",
208
+ "type": "uint256"
209
+ }
210
+ ]
211
+ },
212
+ {
213
+ "stateMutability": "nonpayable",
214
+ "type": "function",
215
+ "name": "remove_liquidity",
216
+ "inputs": [
217
+ {
218
+ "name": "_pool",
219
+ "type": "address"
220
+ },
221
+ {
222
+ "name": "_burn_amount",
223
+ "type": "uint256"
224
+ },
225
+ {
226
+ "name": "_min_amounts",
227
+ "type": "uint256[4]"
228
+ }
229
+ ],
230
+ "outputs": [
231
+ {
232
+ "name": "",
233
+ "type": "uint256[4]"
234
+ }
235
+ ]
236
+ },
237
+ {
238
+ "stateMutability": "nonpayable",
239
+ "type": "function",
240
+ "name": "remove_liquidity_one_coin",
241
+ "inputs": [
242
+ {
243
+ "name": "_pool",
244
+ "type": "address"
245
+ },
246
+ {
247
+ "name": "_burn_amount",
248
+ "type": "uint256"
249
+ },
250
+ {
251
+ "name": "i",
252
+ "type": "uint256"
253
+ },
254
+ {
255
+ "name": "_min_amount",
256
+ "type": "uint256"
257
+ }
258
+ ],
259
+ "outputs": [
260
+ {
261
+ "name": "",
262
+ "type": "uint256"
263
+ }
264
+ ]
265
+ },
266
+ {
267
+ "stateMutability": "view",
268
+ "type": "function",
269
+ "name": "calc_withdraw_one_coin",
270
+ "inputs": [
271
+ {
272
+ "name": "_pool",
273
+ "type": "address"
274
+ },
275
+ {
276
+ "name": "_token_amount",
277
+ "type": "uint256"
278
+ },
279
+ {
280
+ "name": "i",
281
+ "type": "uint256"
282
+ }
283
+ ],
284
+ "outputs": [
285
+ {
286
+ "name": "",
287
+ "type": "uint256"
288
+ }
289
+ ]
290
+ }
291
+ ]
@@ -0,0 +1,283 @@
1
+ [
2
+ {
3
+ "stateMutability": "nonpayable",
4
+ "type": "constructor",
5
+ "inputs": [
6
+ {
7
+ "name": "_base_pool",
8
+ "type": "address"
9
+ },
10
+ {
11
+ "name": "_weth",
12
+ "type": "address"
13
+ }
14
+ ],
15
+ "outputs": []
16
+ },
17
+ {
18
+ "stateMutability": "payable",
19
+ "type": "fallback"
20
+ },
21
+ {
22
+ "stateMutability": "pure",
23
+ "type": "function",
24
+ "name": "base_pool",
25
+ "inputs": [],
26
+ "outputs": [
27
+ {
28
+ "name": "",
29
+ "type": "address"
30
+ }
31
+ ]
32
+ },
33
+ {
34
+ "stateMutability": "pure",
35
+ "type": "function",
36
+ "name": "base_token",
37
+ "inputs": [],
38
+ "outputs": [
39
+ {
40
+ "name": "",
41
+ "type": "address"
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "stateMutability": "view",
47
+ "type": "function",
48
+ "name": "price_oracle",
49
+ "inputs": [
50
+ {
51
+ "name": "_pool",
52
+ "type": "address"
53
+ }
54
+ ],
55
+ "outputs": [
56
+ {
57
+ "name": "",
58
+ "type": "uint256"
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "stateMutability": "view",
64
+ "type": "function",
65
+ "name": "price_scale",
66
+ "inputs": [
67
+ {
68
+ "name": "_pool",
69
+ "type": "address"
70
+ }
71
+ ],
72
+ "outputs": [
73
+ {
74
+ "name": "",
75
+ "type": "uint256"
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "stateMutability": "view",
81
+ "type": "function",
82
+ "name": "lp_price",
83
+ "inputs": [
84
+ {
85
+ "name": "_pool",
86
+ "type": "address"
87
+ }
88
+ ],
89
+ "outputs": [
90
+ {
91
+ "name": "",
92
+ "type": "uint256"
93
+ }
94
+ ]
95
+ },
96
+ {
97
+ "stateMutability": "payable",
98
+ "type": "function",
99
+ "name": "exchange",
100
+ "inputs": [
101
+ {
102
+ "name": "_pool",
103
+ "type": "address"
104
+ },
105
+ {
106
+ "name": "i",
107
+ "type": "uint256"
108
+ },
109
+ {
110
+ "name": "j",
111
+ "type": "uint256"
112
+ },
113
+ {
114
+ "name": "_dx",
115
+ "type": "uint256"
116
+ },
117
+ {
118
+ "name": "_min_dy",
119
+ "type": "uint256"
120
+ }
121
+ ],
122
+ "outputs": [
123
+ {
124
+ "name": "",
125
+ "type": "uint256"
126
+ }
127
+ ]
128
+ },
129
+ {
130
+ "stateMutability": "view",
131
+ "type": "function",
132
+ "name": "get_dy",
133
+ "inputs": [
134
+ {
135
+ "name": "_pool",
136
+ "type": "address"
137
+ },
138
+ {
139
+ "name": "i",
140
+ "type": "uint256"
141
+ },
142
+ {
143
+ "name": "j",
144
+ "type": "uint256"
145
+ },
146
+ {
147
+ "name": "_dx",
148
+ "type": "uint256"
149
+ }
150
+ ],
151
+ "outputs": [
152
+ {
153
+ "name": "",
154
+ "type": "uint256"
155
+ }
156
+ ]
157
+ },
158
+ {
159
+ "stateMutability": "payable",
160
+ "type": "function",
161
+ "name": "add_liquidity",
162
+ "inputs": [
163
+ {
164
+ "name": "_pool",
165
+ "type": "address"
166
+ },
167
+ {
168
+ "name": "_deposit_amounts",
169
+ "type": "uint256[3]"
170
+ },
171
+ {
172
+ "name": "_min_mint_amount",
173
+ "type": "uint256"
174
+ }
175
+ ],
176
+ "outputs": [
177
+ {
178
+ "name": "",
179
+ "type": "uint256"
180
+ }
181
+ ]
182
+ },
183
+ {
184
+ "stateMutability": "view",
185
+ "type": "function",
186
+ "name": "calc_token_amount",
187
+ "inputs": [
188
+ {
189
+ "name": "_pool",
190
+ "type": "address"
191
+ },
192
+ {
193
+ "name": "_amounts",
194
+ "type": "uint256[3]"
195
+ }
196
+ ],
197
+ "outputs": [
198
+ {
199
+ "name": "",
200
+ "type": "uint256"
201
+ }
202
+ ]
203
+ },
204
+ {
205
+ "stateMutability": "nonpayable",
206
+ "type": "function",
207
+ "name": "remove_liquidity",
208
+ "inputs": [
209
+ {
210
+ "name": "_pool",
211
+ "type": "address"
212
+ },
213
+ {
214
+ "name": "_burn_amount",
215
+ "type": "uint256"
216
+ },
217
+ {
218
+ "name": "_min_amounts",
219
+ "type": "uint256[3]"
220
+ }
221
+ ],
222
+ "outputs": [
223
+ {
224
+ "name": "",
225
+ "type": "uint256[3]"
226
+ }
227
+ ]
228
+ },
229
+ {
230
+ "stateMutability": "nonpayable",
231
+ "type": "function",
232
+ "name": "remove_liquidity_one_coin",
233
+ "inputs": [
234
+ {
235
+ "name": "_pool",
236
+ "type": "address"
237
+ },
238
+ {
239
+ "name": "_burn_amount",
240
+ "type": "uint256"
241
+ },
242
+ {
243
+ "name": "i",
244
+ "type": "uint256"
245
+ },
246
+ {
247
+ "name": "_min_amount",
248
+ "type": "uint256"
249
+ }
250
+ ],
251
+ "outputs": [
252
+ {
253
+ "name": "",
254
+ "type": "uint256"
255
+ }
256
+ ]
257
+ },
258
+ {
259
+ "stateMutability": "view",
260
+ "type": "function",
261
+ "name": "calc_withdraw_one_coin",
262
+ "inputs": [
263
+ {
264
+ "name": "_pool",
265
+ "type": "address"
266
+ },
267
+ {
268
+ "name": "_token_amount",
269
+ "type": "uint256"
270
+ },
271
+ {
272
+ "name": "i",
273
+ "type": "uint256"
274
+ }
275
+ ],
276
+ "outputs": [
277
+ {
278
+ "name": "",
279
+ "type": "uint256"
280
+ }
281
+ ]
282
+ }
283
+ ]
@@ -3,3 +3,4 @@ export declare const lowerCasePoolDataAddresses: (poolsData: IDict<IPoolData>) =
3
3
  export declare const extractDecimals: (poolsData: IDict<IPoolData>) => IDict<number>;
4
4
  export declare const extractGauges: (poolsData: IDict<IPoolData>) => string[];
5
5
  export declare const lowerCaseValues: (dict: IDict<string>) => IDict<string>;
6
+ export declare const lowerCaseKeys: (dict: IDict<string>) => IDict<string>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lowerCaseValues = exports.extractGauges = exports.extractDecimals = exports.lowerCasePoolDataAddresses = void 0;
3
+ exports.lowerCaseKeys = exports.lowerCaseValues = exports.extractGauges = exports.extractDecimals = exports.lowerCasePoolDataAddresses = void 0;
4
4
  var ethers_1 = require("ethers");
5
5
  var lowerCasePoolDataAddresses = function (poolsData) {
6
6
  for (var poolId in poolsData) {
@@ -58,3 +58,8 @@ var lowerCaseValues = function (dict) {
58
58
  return Object.fromEntries(Object.entries(dict).map(function (entry) { return [entry[0], entry[1].toLowerCase()]; }));
59
59
  };
60
60
  exports.lowerCaseValues = lowerCaseValues;
61
+ var lowerCaseKeys = function (dict) {
62
+ // @ts-ignore
63
+ return Object.fromEntries(Object.entries(dict).map(function (entry) { return [entry[0].toLowerCase(), entry[1]]; }));
64
+ };
65
+ exports.lowerCaseKeys = lowerCaseKeys;
@@ -1,3 +1,2 @@
1
1
  import { ICurve } from "../interfaces";
2
- export declare function setFactoryZapContracts(this: ICurve): void;
3
- export declare function setCryptoFactoryZapContracts(this: ICurve): void;
2
+ export declare function setFactoryZapContracts(this: ICurve, isCrypto: boolean): void;
@@ -1,15 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.setCryptoFactoryZapContracts = exports.setFactoryZapContracts = void 0;
7
- var ethers_1 = require("ethers");
8
- var ethcall_1 = require("ethcall");
3
+ exports.setFactoryZapContracts = void 0;
9
4
  var constants_1 = require("./constants");
10
- var base_pool_zap_json_1 = __importDefault(require("../constants/abis/atricrypto3/base_pool_zap.json"));
11
- function setFactoryZapContracts() {
12
- var basePoolIdZapDict = constants_1.FACTORY_CONSTANTS[this.chainId].basePoolIdZapDict;
5
+ var constants_crypto_1 = require("./constants-crypto");
6
+ function setFactoryZapContracts(isCrypto) {
7
+ var basePoolIdZapDict = (isCrypto ? constants_crypto_1.CRYPTO_FACTORY_CONSTANTS : constants_1.FACTORY_CONSTANTS)[this.chainId].basePoolIdZapDict;
13
8
  for (var basePoolId in basePoolIdZapDict) {
14
9
  if (!Object.prototype.hasOwnProperty.call(basePoolIdZapDict, basePoolId))
15
10
  continue;
@@ -20,13 +15,3 @@ function setFactoryZapContracts() {
20
15
  }
21
16
  }
22
17
  exports.setFactoryZapContracts = setFactoryZapContracts;
23
- function setCryptoFactoryZapContracts() {
24
- if (this.chainId === 137) {
25
- var atricrypto3ZapAddress = "0x3d8EADb739D1Ef95dd53D718e4810721837c69c1".toLowerCase();
26
- this.contracts[atricrypto3ZapAddress] = {
27
- contract: new ethers_1.Contract(atricrypto3ZapAddress, base_pool_zap_json_1.default, this.signer || this.provider),
28
- multicallContract: new ethcall_1.Contract(atricrypto3ZapAddress, base_pool_zap_json_1.default),
29
- };
30
- }
31
- }
32
- exports.setCryptoFactoryZapContracts = setCryptoFactoryZapContracts;
@@ -0,0 +1,55 @@
1
+ import { IDict } from "../interfaces";
2
+ export declare const lpTokenBasePoolIdDictEthereum: IDict<string>;
3
+ export declare const lpTokenBasePoolIdDictPolygon: IDict<string>;
4
+ export declare const lpTokenBasePoolIdDictFantom: IDict<string>;
5
+ export declare const lpTokenBasePoolIdDictAvalanche: IDict<string>;
6
+ export declare const lpTokenBasePoolIdDictArbitrum: IDict<string>;
7
+ export declare const lpTokenBasePoolIdDictOptimism: IDict<string>;
8
+ export declare const lpTokenBasePoolIdDictXDai: IDict<string>;
9
+ export declare const lpTokenBasePoolIdDictMoonbeam: IDict<string>;
10
+ export declare const lpTokenBasePoolIdDictKava: IDict<string>;
11
+ export declare const basePoolIdZapDictEthereum: IDict<{
12
+ address: string;
13
+ ABI: any;
14
+ }>;
15
+ export declare const basePoolIdZapDictPolygon: IDict<{
16
+ address: string;
17
+ ABI: any;
18
+ }>;
19
+ export declare const basePoolIdZapDictFantom: IDict<{
20
+ address: string;
21
+ ABI: any;
22
+ }>;
23
+ export declare const basePoolIdZapDictAvalanche: IDict<{
24
+ address: string;
25
+ ABI: any;
26
+ }>;
27
+ export declare const basePoolIdZapDictArbitrum: IDict<{
28
+ address: string;
29
+ ABI: any;
30
+ }>;
31
+ export declare const basePoolIdZapDictOptimism: IDict<{
32
+ address: string;
33
+ ABI: any;
34
+ }>;
35
+ export declare const basePoolIdZapDictXDai: IDict<{
36
+ address: string;
37
+ ABI: any;
38
+ }>;
39
+ export declare const basePoolIdZapDictMoonbeam: IDict<{
40
+ address: string;
41
+ ABI: any;
42
+ }>;
43
+ export declare const basePoolIdZapDictKava: IDict<{
44
+ address: string;
45
+ ABI: any;
46
+ }>;
47
+ export declare const CRYPTO_FACTORY_CONSTANTS: {
48
+ [index: number]: {
49
+ lpTokenBasePoolIdDict: IDict<string>;
50
+ basePoolIdZapDict: IDict<{
51
+ address: string;
52
+ ABI: any;
53
+ }>;
54
+ };
55
+ };
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CRYPTO_FACTORY_CONSTANTS = exports.basePoolIdZapDictKava = exports.basePoolIdZapDictMoonbeam = exports.basePoolIdZapDictXDai = exports.basePoolIdZapDictOptimism = exports.basePoolIdZapDictArbitrum = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictFantom = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.lpTokenBasePoolIdDictKava = exports.lpTokenBasePoolIdDictMoonbeam = exports.lpTokenBasePoolIdDictXDai = exports.lpTokenBasePoolIdDictOptimism = exports.lpTokenBasePoolIdDictArbitrum = exports.lpTokenBasePoolIdDictAvalanche = exports.lpTokenBasePoolIdDictFantom = exports.lpTokenBasePoolIdDictPolygon = exports.lpTokenBasePoolIdDictEthereum = void 0;
7
+ var utils_1 = require("../constants/utils");
8
+ // --- ZAPS --
9
+ var base_pool_zap_json_1 = __importDefault(require("../constants/abis/atricrypto3/base_pool_zap.json"));
10
+ var meta_zap_crypto_json_1 = __importDefault(require("../constants/abis/3pool/meta_zap_crypto.json"));
11
+ var meta_zap_crypto_json_2 = __importDefault(require("../constants/abis/fraxusdc/meta_zap_crypto.json"));
12
+ exports.lpTokenBasePoolIdDictEthereum = (0, utils_1.lowerCaseKeys)({
13
+ '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490': '3pool',
14
+ '0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC': 'fraxusdc',
15
+ });
16
+ exports.lpTokenBasePoolIdDictPolygon = (0, utils_1.lowerCaseKeys)({
17
+ '0xdAD97F7713Ae9437fa9249920eC8507e5FbB23d3': 'atricrypto3',
18
+ });
19
+ exports.lpTokenBasePoolIdDictFantom = (0, utils_1.lowerCaseKeys)({});
20
+ exports.lpTokenBasePoolIdDictAvalanche = (0, utils_1.lowerCaseKeys)({});
21
+ exports.lpTokenBasePoolIdDictArbitrum = (0, utils_1.lowerCaseKeys)({});
22
+ exports.lpTokenBasePoolIdDictOptimism = (0, utils_1.lowerCaseKeys)({});
23
+ exports.lpTokenBasePoolIdDictXDai = (0, utils_1.lowerCaseKeys)({});
24
+ exports.lpTokenBasePoolIdDictMoonbeam = (0, utils_1.lowerCaseKeys)({});
25
+ exports.lpTokenBasePoolIdDictKava = (0, utils_1.lowerCaseKeys)({});
26
+ exports.basePoolIdZapDictEthereum = {
27
+ '3pool': {
28
+ address: "0x97aDC08FA1D849D2C48C5dcC1DaB568B169b0267".toLowerCase(),
29
+ ABI: meta_zap_crypto_json_1.default,
30
+ },
31
+ fraxusdc: {
32
+ address: "0x5de4ef4879f4fe3bbadf2227d2ac5d0e2d76c895".toLowerCase(),
33
+ ABI: meta_zap_crypto_json_2.default,
34
+ },
35
+ };
36
+ exports.basePoolIdZapDictPolygon = {
37
+ atricrypto3: {
38
+ address: "0x3d8EADb739D1Ef95dd53D718e4810721837c69c1".toLowerCase(),
39
+ ABI: base_pool_zap_json_1.default,
40
+ },
41
+ };
42
+ exports.basePoolIdZapDictFantom = {};
43
+ exports.basePoolIdZapDictAvalanche = {};
44
+ exports.basePoolIdZapDictArbitrum = {};
45
+ exports.basePoolIdZapDictOptimism = {};
46
+ exports.basePoolIdZapDictXDai = {};
47
+ exports.basePoolIdZapDictMoonbeam = {};
48
+ exports.basePoolIdZapDictKava = {};
49
+ exports.CRYPTO_FACTORY_CONSTANTS = {
50
+ 1: {
51
+ lpTokenBasePoolIdDict: exports.lpTokenBasePoolIdDictEthereum,
52
+ basePoolIdZapDict: exports.basePoolIdZapDictEthereum,
53
+ },
54
+ 10: {
55
+ lpTokenBasePoolIdDict: exports.lpTokenBasePoolIdDictOptimism,
56
+ basePoolIdZapDict: exports.basePoolIdZapDictOptimism,
57
+ },
58
+ 100: {
59
+ lpTokenBasePoolIdDict: exports.lpTokenBasePoolIdDictXDai,
60
+ basePoolIdZapDict: exports.basePoolIdZapDictXDai,
61
+ },
62
+ 137: {
63
+ lpTokenBasePoolIdDict: exports.lpTokenBasePoolIdDictPolygon,
64
+ basePoolIdZapDict: exports.basePoolIdZapDictPolygon,
65
+ },
66
+ 250: {
67
+ lpTokenBasePoolIdDict: exports.lpTokenBasePoolIdDictFantom,
68
+ basePoolIdZapDict: exports.basePoolIdZapDictFantom,
69
+ },
70
+ 1284: {
71
+ lpTokenBasePoolIdDict: exports.lpTokenBasePoolIdDictMoonbeam,
72
+ basePoolIdZapDict: exports.basePoolIdZapDictMoonbeam,
73
+ },
74
+ 2222: {
75
+ lpTokenBasePoolIdDict: exports.lpTokenBasePoolIdDictKava,
76
+ basePoolIdZapDict: exports.basePoolIdZapDictKava,
77
+ },
78
+ 43114: {
79
+ lpTokenBasePoolIdDict: exports.lpTokenBasePoolIdDictAvalanche,
80
+ basePoolIdZapDict: exports.basePoolIdZapDictAvalanche,
81
+ },
82
+ 42161: {
83
+ lpTokenBasePoolIdDict: exports.lpTokenBasePoolIdDictArbitrum,
84
+ basePoolIdZapDict: exports.basePoolIdZapDictArbitrum,
85
+ },
86
+ };
@@ -28,7 +28,7 @@ var Plain4ETH_json_1 = __importDefault(require("../constants/abis/factory-v2/Pla
28
28
  var Plain4Optimized_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain4Optimized.json"));
29
29
  // --- ZAPS --
30
30
  var deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/deposit.json"));
31
- var metaZap_json_1 = __importDefault(require("../constants/abis/fraxusdc/metaZap.json"));
31
+ var meta_zap_json_1 = __importDefault(require("../constants/abis/fraxusdc/meta_zap.json"));
32
32
  var DepositZapMetaUsdPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaUsdPolygon.json"));
33
33
  var DepositZapMetaBtcPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaBtcPolygon.json"));
34
34
  var DepositZapFantom_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapFantom.json"));
@@ -253,7 +253,7 @@ exports.basePoolIdZapDictEthereum = {
253
253
  },
254
254
  fraxusdc: {
255
255
  address: "0x08780fb7E580e492c1935bEe4fA5920b94AA95Da".toLowerCase(),
256
- ABI: metaZap_json_1.default,
256
+ ABI: meta_zap_json_1.default,
257
257
  },
258
258
  sbtc: {
259
259
  address: "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(),
@@ -66,11 +66,10 @@ var ethcall_1 = require("ethcall");
66
66
  var gauge_factory_json_1 = __importDefault(require("../constants/abis/gauge_factory.json"));
67
67
  var gauge_child_json_1 = __importDefault(require("../constants/abis/gauge_child.json"));
68
68
  var gauge_rewards_only_json_1 = __importDefault(require("../constants/abis/gauge_rewards_only.json"));
69
- var deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/deposit.json"));
70
69
  var ERC20_json_1 = __importDefault(require("../constants/abis/ERC20.json"));
71
70
  var factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/factory-crypto/factory-crypto-pool-2.json"));
72
- var base_pool_zap_json_1 = __importDefault(require("../constants/abis/atricrypto3/base_pool_zap.json"));
73
71
  var constants_1 = require("./constants");
72
+ var constants_crypto_1 = require("./constants-crypto");
74
73
  var common_1 = require("./common");
75
74
  function setFactorySwapContracts(rawPoolList, isCrypto) {
76
75
  var _this = this;
@@ -147,7 +146,6 @@ function setFactoryRewardCoinsContracts(rawPoolList) {
147
146
  }
148
147
  }
149
148
  }
150
- var atricrypto3Lp = "0xdAD97F7713Ae9437fa9249920eC8507e5FbB23d3".toLowerCase();
151
149
  function getFactoryPoolsDataFromApi(isCrypto) {
152
150
  return __awaiter(this, void 0, void 0, function () {
153
151
  var network, factoryType, url, response, rawPoolList, mainAddresses, url_1, response_1, poolGaugeDict, _i, _a, gaugeData, i, FACTORY_POOLS_DATA;
@@ -185,10 +183,7 @@ function getFactoryPoolsDataFromApi(isCrypto) {
185
183
  setFactoryGaugeContracts.call(this, rawPoolList);
186
184
  setFactoryCoinsContracts.call(this, rawPoolList);
187
185
  setFactoryRewardCoinsContracts.call(this, rawPoolList);
188
- if (!isCrypto)
189
- common_1.setFactoryZapContracts.call(this);
190
- if (isCrypto)
191
- common_1.setCryptoFactoryZapContracts.call(this);
186
+ common_1.setFactoryZapContracts.call(this, isCrypto);
192
187
  FACTORY_POOLS_DATA = {};
193
188
  rawPoolList.forEach(function (pool) {
194
189
  var coinAddresses = pool.coins.map(function (c) { return c.address.toLowerCase(); });
@@ -196,23 +191,19 @@ function getFactoryPoolsDataFromApi(isCrypto) {
196
191
  var coinDecimals = pool.coins.map(function (c) { return Number(c.decimals); });
197
192
  var nativeToken = _this.constants.NATIVE_TOKEN;
198
193
  if (isCrypto) {
199
- var cryptoCoinNames = pool.coins.map(function (c) { return c.symbol === nativeToken.symbol ? nativeToken.wrappedSymbol : c.symbol; });
194
+ var wrappedCoinNames = pool.coins.map(function (c) { return c.symbol === nativeToken.symbol ? nativeToken.wrappedSymbol : c.symbol; });
200
195
  var underlyingCoinNames = pool.coins.map(function (c) { return c.symbol === nativeToken.wrappedSymbol ? nativeToken.symbol : c.symbol; });
201
196
  var underlyingCoinAddresses = coinAddresses.map(function (addr) { return addr === nativeToken.wrappedAddress ? nativeToken.address : addr; });
202
197
  var isPlain = !coinAddresses.includes(nativeToken.wrappedAddress);
203
- var isMeta = _this.chainId === 137 && coinAddresses[1].toLowerCase() === atricrypto3Lp;
204
- if (isMeta) {
205
- var basePoolId = "atricrypto3";
206
- var basePoolCoinNames = ['DAI', 'USDC', 'USDT', 'WBTC', 'WETH'];
207
- var basePoolCoinAddresses = [
208
- '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063',
209
- '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
210
- '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
211
- '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
212
- '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', // WETH
213
- ];
214
- var basePoolDecimals = [18, 6, 6, 8, 18];
215
- var basePoolZap = "0x3d8EADb739D1Ef95dd53D718e4810721837c69c1";
198
+ var lpTokenBasePoolIdDict = constants_crypto_1.CRYPTO_FACTORY_CONSTANTS[_this.chainId].lpTokenBasePoolIdDict;
199
+ var basePoolIdZapDict = constants_crypto_1.CRYPTO_FACTORY_CONSTANTS[_this.chainId].basePoolIdZapDict;
200
+ var basePoolId = lpTokenBasePoolIdDict[coinAddresses[1].toLowerCase()];
201
+ if (basePoolId) { // isMeta
202
+ var allPoolsData = __assign(__assign({}, _this.constants.POOLS_DATA), FACTORY_POOLS_DATA);
203
+ var basePoolCoinNames = __spreadArray([], allPoolsData[basePoolId].underlying_coins, true);
204
+ var basePoolCoinAddresses = __spreadArray([], allPoolsData[basePoolId].underlying_coin_addresses, true);
205
+ var basePoolDecimals = __spreadArray([], allPoolsData[basePoolId].underlying_decimals, true);
206
+ var basePoolZap = basePoolIdZapDict[basePoolId];
216
207
  FACTORY_POOLS_DATA[pool.id] = {
217
208
  name: pool.name.split(": ")[1].trim(),
218
209
  full_name: pool.name,
@@ -221,20 +212,20 @@ function getFactoryPoolsDataFromApi(isCrypto) {
221
212
  swap_address: pool.address.toLowerCase(),
222
213
  token_address: pool.lpTokenAddress.toLowerCase(),
223
214
  gauge_address: pool.gaugeAddress ? pool.gaugeAddress.toLowerCase() : ethers_1.ethers.constants.AddressZero,
224
- deposit_address: basePoolZap,
215
+ deposit_address: basePoolZap.address,
225
216
  is_meta: true,
226
217
  is_crypto: true,
227
218
  is_factory: true,
228
219
  base_pool: basePoolId,
229
- underlying_coins: __spreadArray([coinNames[0]], basePoolCoinNames, true),
230
- wrapped_coins: coinNames,
231
- underlying_coin_addresses: __spreadArray([coinAddresses[0]], basePoolCoinAddresses, true),
220
+ underlying_coins: __spreadArray([underlyingCoinNames[0]], basePoolCoinNames, true),
221
+ wrapped_coins: wrappedCoinNames,
222
+ underlying_coin_addresses: __spreadArray([underlyingCoinAddresses[0]], basePoolCoinAddresses, true),
232
223
  wrapped_coin_addresses: coinAddresses,
233
224
  underlying_decimals: __spreadArray([coinDecimals[0]], basePoolDecimals, true),
234
225
  wrapped_decimals: coinDecimals,
235
226
  swap_abi: factory_crypto_pool_2_json_1.default,
236
227
  gauge_abi: _this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default,
237
- deposit_abi: base_pool_zap_json_1.default,
228
+ deposit_abi: basePoolZap.ABI,
238
229
  };
239
230
  }
240
231
  else {
@@ -250,7 +241,7 @@ function getFactoryPoolsDataFromApi(isCrypto) {
250
241
  is_plain: isPlain,
251
242
  is_factory: true,
252
243
  underlying_coins: underlyingCoinNames,
253
- wrapped_coins: cryptoCoinNames,
244
+ wrapped_coins: wrappedCoinNames,
254
245
  underlying_coin_addresses: underlyingCoinAddresses,
255
246
  wrapped_coin_addresses: coinAddresses,
256
247
  underlying_decimals: coinDecimals,
@@ -276,7 +267,7 @@ function getFactoryPoolsDataFromApi(isCrypto) {
276
267
  var basePoolCoinNames = basePoolIdCoinsDict[basePoolId];
277
268
  var basePoolCoinAddresses = basePoolIdCoinAddressesDict[basePoolId];
278
269
  var basePoolDecimals = basePoolIdDecimalsDict[basePoolId];
279
- var basePoolZap = basePoolIdZapDict[basePoolId].address;
270
+ var basePoolZap = basePoolIdZapDict[basePoolId];
280
271
  FACTORY_POOLS_DATA[pool.id] = {
281
272
  name: pool.name.split(": ")[1].trim(),
282
273
  full_name: pool.name,
@@ -285,7 +276,7 @@ function getFactoryPoolsDataFromApi(isCrypto) {
285
276
  swap_address: pool.address.toLowerCase(),
286
277
  token_address: pool.address.toLowerCase(),
287
278
  gauge_address: pool.gaugeAddress ? pool.gaugeAddress.toLowerCase() : ethers_1.ethers.constants.AddressZero,
288
- deposit_address: basePoolZap,
279
+ deposit_address: basePoolZap.address,
289
280
  is_meta: true,
290
281
  is_factory: true,
291
282
  base_pool: basePoolId,
@@ -297,7 +288,7 @@ function getFactoryPoolsDataFromApi(isCrypto) {
297
288
  wrapped_decimals: coinDecimals,
298
289
  swap_abi: implementationABIDict[pool.implementationAddress],
299
290
  gauge_abi: _this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default,
300
- deposit_abi: deposit_json_1.default,
291
+ deposit_abi: basePoolZap.ABI,
301
292
  };
302
293
  }
303
294
  else {
@@ -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) {
@@ -55,8 +66,8 @@ var ERC20_json_1 = __importDefault(require("../constants/abis/ERC20.json"));
55
66
  var factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/factory-crypto/factory-crypto-pool-2.json"));
56
67
  var gauge_factory_json_1 = __importDefault(require("../constants/abis/gauge_factory.json"));
57
68
  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"));
59
69
  var common_1 = require("./common");
70
+ var constants_crypto_1 = require("./constants-crypto");
60
71
  var deepFlatten = function (arr) { return [].concat.apply([], arr.map(function (v) { return (Array.isArray(v) ? deepFlatten(v) : v); })); };
61
72
  function getCryptoFactoryIdsAndSwapAddresses() {
62
73
  return __awaiter(this, void 0, void 0, function () {
@@ -323,10 +334,9 @@ function getCoinAddressDecimalsDict(coinAddresses, existingCoinAddressDecimalsDi
323
334
  });
324
335
  });
325
336
  }
326
- var atricrypto3Lp = "0xdAD97F7713Ae9437fa9249920eC8507e5FbB23d3".toLowerCase();
327
337
  function getCryptoFactoryPoolData() {
328
338
  return __awaiter(this, void 0, void 0, function () {
329
- 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;
339
+ var _a, poolIds, swapAddresses, tokenAddresses, gaugeAddresses, _b, poolSymbols, poolNames, coinAddresses, underlyingCoinAddresses, existingCoinAddressNameDict, coinAddressNameDict, coinAddressDecimalsDict, CRYPTO_FACTORY_POOLS_DATA, i, lpTokenBasePoolIdDict, basePoolIdZapDict, basePoolId, allPoolsData, basePoolCoinNames, basePoolCoinAddresses, basePoolDecimals, basePoolZap;
330
340
  return __generator(this, function (_c) {
331
341
  switch (_c.label) {
332
342
  case 0: return [4 /*yield*/, getCryptoFactoryIdsAndSwapAddresses.call(this)];
@@ -358,22 +368,18 @@ function getCryptoFactoryPoolData() {
358
368
  return [4 /*yield*/, getCoinAddressDecimalsDict.call(this, coinAddresses, this.constants.DECIMALS)];
359
369
  case 8:
360
370
  coinAddressDecimalsDict = _c.sent();
361
- common_1.setCryptoFactoryZapContracts.call(this);
371
+ common_1.setFactoryZapContracts.call(this, true);
362
372
  CRYPTO_FACTORY_POOLS_DATA = {};
363
373
  for (i = 0; i < poolIds.length; i++) {
364
- isMeta = this.chainId === 137 && coinAddresses[i][1].toLowerCase() === atricrypto3Lp;
365
- if (isMeta) {
366
- basePoolId = "atricrypto3";
367
- basePoolCoinNames = ['DAI', 'USDC', 'USDT', 'WBTC', 'WETH'];
368
- basePoolCoinAddresses = [
369
- '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063',
370
- '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
371
- '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
372
- '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
373
- '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', // WETH
374
- ];
375
- basePoolDecimals = [18, 6, 6, 8, 18];
376
- basePoolZap = "0x3d8EADb739D1Ef95dd53D718e4810721837c69c1";
374
+ lpTokenBasePoolIdDict = constants_crypto_1.CRYPTO_FACTORY_CONSTANTS[this.chainId].lpTokenBasePoolIdDict;
375
+ basePoolIdZapDict = constants_crypto_1.CRYPTO_FACTORY_CONSTANTS[this.chainId].basePoolIdZapDict;
376
+ basePoolId = lpTokenBasePoolIdDict[coinAddresses[i][1].toLowerCase()];
377
+ if (basePoolId) { // isMeta
378
+ allPoolsData = __assign(__assign({}, this.constants.POOLS_DATA), CRYPTO_FACTORY_POOLS_DATA);
379
+ basePoolCoinNames = __spreadArray([], allPoolsData[basePoolId].underlying_coins, true);
380
+ basePoolCoinAddresses = __spreadArray([], allPoolsData[basePoolId].underlying_coin_addresses, true);
381
+ basePoolDecimals = __spreadArray([], allPoolsData[basePoolId].underlying_decimals, true);
382
+ basePoolZap = basePoolIdZapDict[basePoolId];
377
383
  CRYPTO_FACTORY_POOLS_DATA[poolIds[i]] = {
378
384
  name: poolNames[i].split(": ")[1].trim(),
379
385
  full_name: poolNames[i],
@@ -382,20 +388,20 @@ function getCryptoFactoryPoolData() {
382
388
  swap_address: swapAddresses[i],
383
389
  token_address: tokenAddresses[i],
384
390
  gauge_address: gaugeAddresses[i],
385
- deposit_address: basePoolZap,
391
+ deposit_address: basePoolZap.address,
386
392
  is_meta: true,
387
393
  is_crypto: true,
388
394
  is_factory: true,
389
395
  base_pool: basePoolId,
390
- underlying_coins: __spreadArray([coinAddressNameDict[coinAddresses[i][0]]], basePoolCoinNames, true),
396
+ underlying_coins: __spreadArray([coinAddressNameDict[underlyingCoinAddresses[i][0]]], basePoolCoinNames, true),
391
397
  wrapped_coins: coinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }),
392
- underlying_coin_addresses: __spreadArray([coinAddresses[i][0]], basePoolCoinAddresses, true),
398
+ underlying_coin_addresses: __spreadArray([underlyingCoinAddresses[i][0]], basePoolCoinAddresses, true),
393
399
  wrapped_coin_addresses: coinAddresses[i],
394
- underlying_decimals: __spreadArray([coinAddressDecimalsDict[coinAddresses[i][0]]], basePoolDecimals, true),
400
+ underlying_decimals: __spreadArray([coinAddressDecimalsDict[underlyingCoinAddresses[i][0]]], basePoolDecimals, true),
395
401
  wrapped_decimals: coinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }),
396
402
  swap_abi: factory_crypto_pool_2_json_1.default,
397
403
  gauge_abi: this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default,
398
- deposit_abi: base_pool_zap_json_1.default,
404
+ deposit_abi: basePoolZap.ABI,
399
405
  };
400
406
  }
401
407
  else {
@@ -415,7 +415,7 @@ function getFactoryPoolData() {
415
415
  isMeta = _c.sent();
416
416
  implementationBasePoolIdDict = constants_1.FACTORY_CONSTANTS[this.chainId].implementationBasePoolIdDict;
417
417
  basePoolIds = implementations.map(function (addr) { return implementationBasePoolIdDict[addr]; });
418
- common_1.setFactoryZapContracts.call(this);
418
+ common_1.setFactoryZapContracts.call(this, false);
419
419
  FACTORY_POOLS_DATA = {};
420
420
  _loop_2 = function (i) {
421
421
  if (!isMeta[i]) {
@@ -126,7 +126,7 @@ export interface IRouteStep {
126
126
  outputCoinAddress: string;
127
127
  i: number;
128
128
  j: number;
129
- swapType: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
129
+ swapType: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
130
130
  swapAddress: string;
131
131
  }
132
132
  export interface IRoute_ {
@@ -231,7 +231,7 @@ var getPool = function (poolId) {
231
231
  !(curve_1.curve.chainId === 100 && poolDummy.id === "tricrypto")) { // tricrypto2 (eth), tricrypto (arbitrum); 100 is xDAI
232
232
  Object.assign(Pool.prototype, swapMixins_1.swapTricrypto2Mixin);
233
233
  }
234
- else if (poolDummy.isMetaFactory && ((0, exports.getPool)(poolDummy.basePool).isLending || (0, exports.getPool)(poolDummy.basePool).isFake)) {
234
+ else if (poolDummy.isMetaFactory && ((0, exports.getPool)(poolDummy.basePool).isLending || (0, exports.getPool)(poolDummy.basePool).isFake || poolDummy.isCrypto)) {
235
235
  Object.assign(Pool.prototype, swapMixins_1.swapMetaFactoryMixin);
236
236
  }
237
237
  else {
package/lib/router.js CHANGED
@@ -126,7 +126,7 @@ var _findAllRoutesTheShorterTheBetter = function (inputCoinAddress, outputCoinAd
126
126
  // Looking for outputCoinAddress only on the final step
127
127
  if (step === 3 && underlying_coin_addresses[j] !== outputCoinAddress)
128
128
  continue;
129
- swapType = poolId === 'aave' ? 10 : 9;
129
+ swapType = poolId === 'aave' ? 11 : 10;
130
130
  for (_d = 0, _e = routes[inCoin]; _d < _e.length; _d++) {
131
131
  inCoinRoute = _e[_d];
132
132
  routes[underlying_coin_addresses[j]] = ((_s = routes[underlying_coin_addresses[j]]) !== null && _s !== void 0 ? _s : []).concat([__spreadArray(__spreadArray([], inCoinRoute, true), [
@@ -153,7 +153,7 @@ var _findAllRoutesTheShorterTheBetter = function (inputCoinAddress, outputCoinAd
153
153
  // Looking for outputCoinAddress only on the final step
154
154
  if (step === 3 && token_address !== outputCoinAddress)
155
155
  return [3 /*break*/, 11];
156
- swapType = is_lending ? 8 : underlying_coin_addresses.length === 2 ? 6 : 7;
156
+ swapType = is_lending ? 9 : underlying_coin_addresses.length === 2 ? 7 : 8;
157
157
  for (_f = 0, _h = routes[inCoin]; _f < _h.length; _f++) {
158
158
  inCoinRoute = _h[_f];
159
159
  routes[token_address] = ((_t = routes[token_address]) !== null && _t !== void 0 ? _t : []).concat([__spreadArray(__spreadArray([], inCoinRoute, true), [
@@ -239,7 +239,11 @@ var _findAllRoutesTheShorterTheBetter = function (inputCoinAddress, outputCoinAd
239
239
  if (tvl === 0)
240
240
  return [3 /*break*/, 10];
241
241
  hasEth = (inCoin === curve_1.curve.constants.NATIVE_TOKEN.address || underlying_coin_addresses[j] === curve_1.curve.constants.NATIVE_TOKEN.address);
242
- swapType = ((base_pool === null || base_pool === void 0 ? void 0 : base_pool.is_lending) && poolData.is_factory) ? 5 : hasEth ? 3 : poolData.is_crypto ? 4 : 2;
242
+ swapType = (poolData.is_crypto && poolData.is_meta && poolData.is_factory) ? 6
243
+ : ((base_pool === null || base_pool === void 0 ? void 0 : base_pool.is_lending) && poolData.is_factory) ? 5
244
+ : hasEth ? 3
245
+ : poolData.is_crypto ? 4
246
+ : 2;
243
247
  for (_o = 0, _p = routes[inCoin]; _o < _p.length; _o++) {
244
248
  inCoinRoute = _p[_o];
245
249
  routes[underlying_coin_addresses[j]] = ((_v = routes[underlying_coin_addresses[j]]) !== null && _v !== void 0 ? _v : []).concat([__spreadArray(__spreadArray([], inCoinRoute, true), [
@@ -251,7 +255,7 @@ var _findAllRoutesTheShorterTheBetter = function (inputCoinAddress, outputCoinAd
251
255
  i: inCoinIndexes.underlying_coin,
252
256
  j: j,
253
257
  swapType: swapType,
254
- swapAddress: ethers_1.ethers.constants.AddressZero,
258
+ swapAddress: (swapType === 5 || swapType === 6) ? poolData.swap_address : ethers_1.ethers.constants.AddressZero,
255
259
  },
256
260
  ], false)]);
257
261
  }
@@ -349,7 +353,7 @@ var _findAllRoutesTvl = function (inputCoinAddress, outputCoinAddress) { return
349
353
  return [4 /*yield*/, ((0, pools_1.getPool)(poolId)).stats.totalLiquidity()];
350
354
  case 1:
351
355
  tvl = _q.apply(void 0, [_r.sent()]);
352
- swapType = poolId === 'aave' ? 10 : 9;
356
+ swapType = poolId === 'aave' ? 11 : 10;
353
357
  newRoutes = routes[inCoin].map(function (route) {
354
358
  var routePoolIds = route.steps.map(function (s) { return s.poolId; });
355
359
  // Steps <= 4
@@ -406,7 +410,7 @@ var _findAllRoutesTvl = function (inputCoinAddress, outputCoinAddress) { return
406
410
  return [4 /*yield*/, ((0, pools_1.getPool)(poolId)).stats.totalLiquidity()];
407
411
  case 5:
408
412
  tvl_1 = _o.apply(void 0, [_p.sent()]);
409
- swapType_1 = is_lending ? 8 : underlying_coin_addresses.length === 2 ? 6 : 7;
413
+ swapType_1 = is_lending ? 9 : underlying_coin_addresses.length === 2 ? 7 : 8;
410
414
  newRoutes = routes[inCoin].map(function (route) {
411
415
  var routePoolIds = route.steps.map(function (s) { return s.poolId; });
412
416
  // Steps <= 4
@@ -540,7 +544,11 @@ var _findAllRoutesTvl = function (inputCoinAddress, outputCoinAddress) { return
540
544
  if (tvl === 0)
541
545
  return [2 /*return*/, "continue"];
542
546
  hasEth = (inCoin === curve_1.curve.constants.NATIVE_TOKEN.address || underlying_coin_addresses[j] === curve_1.curve.constants.NATIVE_TOKEN.address);
543
- swapType = ((base_pool === null || base_pool === void 0 ? void 0 : base_pool.is_lending) && poolData.is_factory) ? 5 : hasEth ? 3 : poolData.is_crypto ? 4 : 2;
547
+ swapType = (poolData.is_crypto && poolData.is_meta && poolData.is_factory) ? 6
548
+ : ((base_pool === null || base_pool === void 0 ? void 0 : base_pool.is_lending) && poolData.is_factory) ? 5
549
+ : hasEth ? 3
550
+ : poolData.is_crypto ? 4
551
+ : 2;
544
552
  newRoutes = routes[inCoin].map(function (route) {
545
553
  var routePoolIds = route.steps.map(function (s) { return s.poolId; });
546
554
  // Steps <= 4
@@ -559,7 +567,7 @@ var _findAllRoutesTvl = function (inputCoinAddress, outputCoinAddress) { return
559
567
  i: inCoinIndexes.underlying_coin,
560
568
  j: j,
561
569
  swapType: swapType,
562
- swapAddress: swapType === 5 ? poolData.swap_address : ethers_1.ethers.constants.AddressZero,
570
+ swapAddress: (swapType === 5 || swapType === 6) ? poolData.swap_address : ethers_1.ethers.constants.AddressZero,
563
571
  },
564
572
  ], false),
565
573
  minTvl: Math.min(tvl, route.minTvl),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.12.1",
3
+ "version": "2.13.0",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",