@curvefi/api 1.18.0 → 1.20.1

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.
@@ -1,49 +1,47 @@
1
1
  [
2
2
  {
3
- "name": "TokenExchange",
3
+ "anonymous": false,
4
4
  "inputs": [
5
5
  {
6
+ "indexed": true,
6
7
  "name": "buyer",
7
- "type": "address",
8
- "indexed": true
8
+ "type": "address"
9
9
  },
10
10
  {
11
+ "indexed": true,
11
12
  "name": "receiver",
12
- "type": "address",
13
- "indexed": true
13
+ "type": "address"
14
14
  },
15
15
  {
16
+ "indexed": true,
16
17
  "name": "pool",
17
- "type": "address",
18
- "indexed": true
18
+ "type": "address"
19
19
  },
20
20
  {
21
+ "indexed": false,
21
22
  "name": "token_sold",
22
- "type": "address",
23
- "indexed": false
23
+ "type": "address"
24
24
  },
25
25
  {
26
+ "indexed": false,
26
27
  "name": "token_bought",
27
- "type": "address",
28
- "indexed": false
28
+ "type": "address"
29
29
  },
30
30
  {
31
+ "indexed": false,
31
32
  "name": "amount_sold",
32
- "type": "uint256",
33
- "indexed": false
33
+ "type": "uint256"
34
34
  },
35
35
  {
36
+ "indexed": false,
36
37
  "name": "amount_bought",
37
- "type": "uint256",
38
- "indexed": false
38
+ "type": "uint256"
39
39
  }
40
40
  ],
41
- "anonymous": false,
41
+ "name": "TokenExchange",
42
42
  "type": "event"
43
43
  },
44
44
  {
45
- "stateMutability": "nonpayable",
46
- "type": "constructor",
47
45
  "inputs": [
48
46
  {
49
47
  "name": "_address_provider",
@@ -54,16 +52,17 @@
54
52
  "type": "address"
55
53
  }
56
54
  ],
57
- "outputs": []
55
+ "name": "constructor",
56
+ "outputs": [],
57
+ "stateMutability": "nonpayable",
58
+ "type": "constructor"
58
59
  },
59
60
  {
60
61
  "stateMutability": "payable",
61
62
  "type": "fallback"
62
63
  },
63
64
  {
64
- "stateMutability": "payable",
65
- "type": "function",
66
- "name": "exchange_with_best_rate",
65
+ "gas": "490981085",
67
66
  "inputs": [
68
67
  {
69
68
  "name": "_from",
@@ -82,17 +81,18 @@
82
81
  "type": "uint256"
83
82
  }
84
83
  ],
84
+ "name": "exchange_with_best_rate",
85
85
  "outputs": [
86
86
  {
87
87
  "name": "",
88
88
  "type": "uint256"
89
89
  }
90
- ]
90
+ ],
91
+ "stateMutability": "payable",
92
+ "type": "function"
91
93
  },
92
94
  {
93
- "stateMutability": "payable",
94
- "type": "function",
95
- "name": "exchange_with_best_rate",
95
+ "gas": "490981085",
96
96
  "inputs": [
97
97
  {
98
98
  "name": "_from",
@@ -115,17 +115,52 @@
115
115
  "type": "address"
116
116
  }
117
117
  ],
118
+ "name": "exchange_with_best_rate",
118
119
  "outputs": [
119
120
  {
120
121
  "name": "",
121
122
  "type": "uint256"
122
123
  }
123
- ]
124
+ ],
125
+ "stateMutability": "payable",
126
+ "type": "function"
124
127
  },
125
128
  {
126
- "stateMutability": "payable",
127
- "type": "function",
129
+ "gas": "308925",
130
+ "inputs": [
131
+ {
132
+ "name": "_pool",
133
+ "type": "address"
134
+ },
135
+ {
136
+ "name": "_from",
137
+ "type": "address"
138
+ },
139
+ {
140
+ "name": "_to",
141
+ "type": "address"
142
+ },
143
+ {
144
+ "name": "_amount",
145
+ "type": "uint256"
146
+ },
147
+ {
148
+ "name": "_expected",
149
+ "type": "uint256"
150
+ }
151
+ ],
128
152
  "name": "exchange",
153
+ "outputs": [
154
+ {
155
+ "name": "",
156
+ "type": "uint256"
157
+ }
158
+ ],
159
+ "stateMutability": "payable",
160
+ "type": "function"
161
+ },
162
+ {
163
+ "gas": "308925",
129
164
  "inputs": [
130
165
  {
131
166
  "name": "_pool",
@@ -146,19 +181,58 @@
146
181
  {
147
182
  "name": "_expected",
148
183
  "type": "uint256"
184
+ },
185
+ {
186
+ "name": "_receiver",
187
+ "type": "address"
149
188
  }
150
189
  ],
190
+ "name": "exchange",
151
191
  "outputs": [
152
192
  {
153
193
  "name": "",
154
194
  "type": "uint256"
155
195
  }
156
- ]
196
+ ],
197
+ "stateMutability": "payable",
198
+ "type": "function"
157
199
  },
158
200
  {
159
- "stateMutability": "view",
160
- "type": "function",
161
- "name": "get_best_rate",
201
+ "gas": "278915",
202
+ "inputs": [
203
+ {
204
+ "name": "_route",
205
+ "type": "address[9]"
206
+ },
207
+ {
208
+ "name": "_swap_params",
209
+ "type": "uint256[3][4]"
210
+ },
211
+ {
212
+ "name": "_amount",
213
+ "type": "uint256"
214
+ },
215
+ {
216
+ "name": "_expected",
217
+ "type": "uint256"
218
+ },
219
+ {
220
+ "name": "_pools",
221
+ "type": "address[4]"
222
+ }
223
+ ],
224
+ "name": "exchange_multiple",
225
+ "outputs": [
226
+ {
227
+ "name": "",
228
+ "type": "uint256"
229
+ }
230
+ ],
231
+ "stateMutability": "payable",
232
+ "type": "function"
233
+ },
234
+ {
235
+ "gas": "1584665657",
162
236
  "inputs": [
163
237
  {
164
238
  "name": "_from",
@@ -173,6 +247,7 @@
173
247
  "type": "uint256"
174
248
  }
175
249
  ],
250
+ "name": "get_best_rate",
176
251
  "outputs": [
177
252
  {
178
253
  "name": "",
@@ -183,12 +258,45 @@
183
258
  "type": "uint256"
184
259
  }
185
260
  ],
186
- "gas": "395840312"
261
+ "stateMutability": "view",
262
+ "type": "function"
187
263
  },
188
264
  {
265
+ "gas": "1584665657",
266
+ "inputs": [
267
+ {
268
+ "name": "_from",
269
+ "type": "address"
270
+ },
271
+ {
272
+ "name": "_to",
273
+ "type": "address"
274
+ },
275
+ {
276
+ "name": "_amount",
277
+ "type": "uint256"
278
+ },
279
+ {
280
+ "name": "_exclude_pools",
281
+ "type": "address[8]"
282
+ }
283
+ ],
284
+ "name": "get_best_rate",
285
+ "outputs": [
286
+ {
287
+ "name": "",
288
+ "type": "address"
289
+ },
290
+ {
291
+ "name": "",
292
+ "type": "uint256"
293
+ }
294
+ ],
189
295
  "stateMutability": "view",
190
- "type": "function",
191
- "name": "get_exchange_amount",
296
+ "type": "function"
297
+ },
298
+ {
299
+ "gas": "14635",
192
300
  "inputs": [
193
301
  {
194
302
  "name": "_pool",
@@ -207,18 +315,18 @@
207
315
  "type": "uint256"
208
316
  }
209
317
  ],
318
+ "name": "get_exchange_amount",
210
319
  "outputs": [
211
320
  {
212
321
  "name": "",
213
322
  "type": "uint256"
214
323
  }
215
324
  ],
216
- "gas": "5104"
325
+ "stateMutability": "view",
326
+ "type": "function"
217
327
  },
218
328
  {
219
- "stateMutability": "view",
220
- "type": "function",
221
- "name": "get_input_amount",
329
+ "gas": "21156",
222
330
  "inputs": [
223
331
  {
224
332
  "name": "_pool",
@@ -237,18 +345,18 @@
237
345
  "type": "uint256"
238
346
  }
239
347
  ],
348
+ "name": "get_input_amount",
240
349
  "outputs": [
241
350
  {
242
351
  "name": "",
243
352
  "type": "uint256"
244
353
  }
245
354
  ],
246
- "gas": "15358"
355
+ "stateMutability": "view",
356
+ "type": "function"
247
357
  },
248
358
  {
249
- "stateMutability": "view",
250
- "type": "function",
251
- "name": "get_exchange_amounts",
359
+ "gas": "24943",
252
360
  "inputs": [
253
361
  {
254
362
  "name": "_pool",
@@ -267,49 +375,49 @@
267
375
  "type": "uint256[100]"
268
376
  }
269
377
  ],
378
+ "name": "get_exchange_amounts",
270
379
  "outputs": [
271
380
  {
272
381
  "name": "",
273
382
  "type": "uint256[100]"
274
383
  }
275
384
  ],
276
- "gas": "17925"
385
+ "stateMutability": "view",
386
+ "type": "function"
277
387
  },
278
388
  {
279
- "stateMutability": "view",
280
- "type": "function",
281
- "name": "get_calculator",
389
+ "gas": "2654",
282
390
  "inputs": [
283
391
  {
284
392
  "name": "_pool",
285
393
  "type": "address"
286
394
  }
287
395
  ],
396
+ "name": "get_calculator",
288
397
  "outputs": [
289
398
  {
290
399
  "name": "",
291
400
  "type": "address"
292
401
  }
293
402
  ],
294
- "gas": "2429"
403
+ "stateMutability": "view",
404
+ "type": "function"
295
405
  },
296
406
  {
297
- "stateMutability": "nonpayable",
298
- "type": "function",
299
- "name": "update_registry_address",
407
+ "gas": "109973",
300
408
  "inputs": [],
409
+ "name": "update_registry_address",
301
410
  "outputs": [
302
411
  {
303
412
  "name": "",
304
413
  "type": "bool"
305
414
  }
306
415
  ],
307
- "gas": "72066"
416
+ "stateMutability": "nonpayable",
417
+ "type": "function"
308
418
  },
309
419
  {
310
- "stateMutability": "nonpayable",
311
- "type": "function",
312
- "name": "set_calculator",
420
+ "gas": "38057",
313
421
  "inputs": [
314
422
  {
315
423
  "name": "_pool",
@@ -320,118 +428,133 @@
320
428
  "type": "address"
321
429
  }
322
430
  ],
431
+ "name": "set_calculator",
323
432
  "outputs": [
324
433
  {
325
434
  "name": "",
326
435
  "type": "bool"
327
436
  }
328
437
  ],
329
- "gas": "37159"
438
+ "stateMutability": "nonpayable",
439
+ "type": "function"
330
440
  },
331
441
  {
332
- "stateMutability": "nonpayable",
333
- "type": "function",
334
- "name": "set_default_calculator",
442
+ "gas": "37815",
335
443
  "inputs": [
336
444
  {
337
445
  "name": "_calculator",
338
446
  "type": "address"
339
447
  }
340
448
  ],
449
+ "name": "set_default_calculator",
341
450
  "outputs": [
342
451
  {
343
452
  "name": "",
344
453
  "type": "bool"
345
454
  }
346
455
  ],
347
- "gas": "36974"
456
+ "stateMutability": "nonpayable",
457
+ "type": "function"
348
458
  },
349
459
  {
350
- "stateMutability": "nonpayable",
351
- "type": "function",
352
- "name": "claim_balance",
460
+ "gas": "38659",
353
461
  "inputs": [
354
462
  {
355
463
  "name": "_token",
356
464
  "type": "address"
357
465
  }
358
466
  ],
467
+ "name": "claim_balance",
359
468
  "outputs": [
360
469
  {
361
470
  "name": "",
362
471
  "type": "bool"
363
472
  }
364
473
  ],
365
- "gas": "37798"
474
+ "stateMutability": "nonpayable",
475
+ "type": "function"
366
476
  },
367
477
  {
368
- "stateMutability": "nonpayable",
369
- "type": "function",
370
- "name": "set_killed",
478
+ "gas": "37875",
371
479
  "inputs": [
372
480
  {
373
481
  "name": "_is_killed",
374
482
  "type": "bool"
375
483
  }
376
484
  ],
485
+ "name": "set_killed",
377
486
  "outputs": [
378
487
  {
379
488
  "name": "",
380
489
  "type": "bool"
381
490
  }
382
491
  ],
383
- "gas": "37034"
492
+ "stateMutability": "nonpayable",
493
+ "type": "function"
384
494
  },
385
495
  {
386
- "stateMutability": "view",
387
- "type": "function",
388
- "name": "registry",
496
+ "gas": "1706",
389
497
  "inputs": [],
498
+ "name": "registry",
390
499
  "outputs": [
391
500
  {
392
501
  "name": "",
393
502
  "type": "address"
394
503
  }
395
504
  ],
396
- "gas": "1538"
505
+ "stateMutability": "view",
506
+ "type": "function"
397
507
  },
398
508
  {
399
- "stateMutability": "view",
400
- "type": "function",
401
- "name": "factory_registry",
509
+ "gas": "1736",
402
510
  "inputs": [],
511
+ "name": "factory_registry",
403
512
  "outputs": [
404
513
  {
405
514
  "name": "",
406
515
  "type": "address"
407
516
  }
408
517
  ],
409
- "gas": "1568"
518
+ "stateMutability": "view",
519
+ "type": "function"
410
520
  },
411
521
  {
412
- "stateMutability": "view",
413
- "type": "function",
414
- "name": "default_calculator",
522
+ "gas": "1766",
415
523
  "inputs": [],
524
+ "name": "crypto_registry",
416
525
  "outputs": [
417
526
  {
418
527
  "name": "",
419
528
  "type": "address"
420
529
  }
421
530
  ],
422
- "gas": "1598"
531
+ "stateMutability": "view",
532
+ "type": "function"
423
533
  },
424
534
  {
535
+ "gas": "1796",
536
+ "inputs": [],
537
+ "name": "default_calculator",
538
+ "outputs": [
539
+ {
540
+ "name": "",
541
+ "type": "address"
542
+ }
543
+ ],
425
544
  "stateMutability": "view",
426
- "type": "function",
427
- "name": "is_killed",
545
+ "type": "function"
546
+ },
547
+ {
548
+ "gas": "1826",
428
549
  "inputs": [],
550
+ "name": "is_killed",
429
551
  "outputs": [
430
552
  {
431
553
  "name": "",
432
554
  "type": "bool"
433
555
  }
434
556
  ],
435
- "gas": "1628"
557
+ "stateMutability": "view",
558
+ "type": "function"
436
559
  }
437
560
  ]
@@ -7,6 +7,7 @@ export declare const ALIASES_ETHEREUM: {
7
7
  router: string;
8
8
  deposit_and_stake: string;
9
9
  factory: string;
10
+ crypto_factory: string;
10
11
  registry_exchange: string;
11
12
  };
12
13
  export declare const ALIASES_POLYGON: {
@@ -18,5 +19,6 @@ export declare const ALIASES_POLYGON: {
18
19
  router: string;
19
20
  deposit_and_stake: string;
20
21
  factory: string;
22
+ crypto_factory: string;
21
23
  registry_exchange: string;
22
24
  };
@@ -10,6 +10,7 @@ exports.ALIASES_ETHEREUM = {
10
10
  "router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
11
11
  "deposit_and_stake": "0x271fbE8aB7f1fB262f81C77Ea5303F03DA9d3d6A",
12
12
  "factory": '0xb9fc157394af804a3578134a6585c0dc9cc990d4',
13
+ "crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
13
14
  "registry_exchange": "",
14
15
  };
15
16
  exports.ALIASES_POLYGON = {
@@ -21,5 +22,6 @@ exports.ALIASES_POLYGON = {
21
22
  "router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
22
23
  "deposit_and_stake": "0x43FF7b96808988C9d19C1d05Ef19658B03e8a143",
23
24
  "factory": '0x722272d36ef0da72ff51c5a65db7b870e2e8d4ee',
25
+ "crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
24
26
  "registry_exchange": "",
25
27
  };
package/lib/curve.d.ts CHANGED
@@ -29,6 +29,7 @@ export declare let ALIASES: {
29
29
  router: string;
30
30
  deposit_and_stake: string;
31
31
  factory: string;
32
+ crypto_factory: string;
32
33
  registry_exchange: string;
33
34
  };
34
35
  declare class Curve {
@@ -73,6 +74,7 @@ declare class Curve {
73
74
  chainId?: number;
74
75
  }): Promise<void>;
75
76
  fetchFactoryPools(): Promise<void>;
77
+ fetchCryptoFactoryPools(): Promise<void>;
76
78
  setCustomFeeData(customFeeData: {
77
79
  gasPrice?: number;
78
80
  maxFeePerGas?: number;
package/lib/curve.js CHANGED
@@ -63,6 +63,7 @@ exports.curve = exports.ALIASES = exports.DECIMALS_LOWER_CASE = exports.DECIMALS
63
63
  var ethers_1 = require("ethers");
64
64
  var ethcall_1 = require("ethcall");
65
65
  var factory_1 = require("./factory");
66
+ var factory_crypto_1 = require("./factory-crypto");
66
67
  var ERC20_json_1 = __importDefault(require("./constants/abis/json/ERC20.json"));
67
68
  var cERC20_json_1 = __importDefault(require("./constants/abis/json/cERC20.json"));
68
69
  var yERC20_json_1 = __importDefault(require("./constants/abis/json/yERC20.json"));
@@ -75,6 +76,7 @@ var deposit_and_stake_json_1 = __importDefault(require("./constants/abis/json/de
75
76
  var registry_exchange_json_1 = __importDefault(require("./constants/abis/json/registry_exchange.json"));
76
77
  var streamer_json_1 = __importDefault(require("./constants/abis/json/streamer.json"));
77
78
  var factory_json_1 = __importDefault(require("./constants/abis/json/factory.json"));
79
+ var factory_crypto_json_1 = __importDefault(require("./constants/abis/json/factory-crypto.json"));
78
80
  var abis_ethereum_1 = require("./constants/abis/abis-ethereum");
79
81
  var abis_polygon_1 = require("./constants/abis/abis-polygon");
80
82
  var coins_ethereum_1 = require("./constants/coins-ethereum");
@@ -89,6 +91,7 @@ exports.ALIASES = {
89
91
  "router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
90
92
  "deposit_and_stake": "0x271fbE8aB7f1fB262f81C77Ea5303F03DA9d3d6A",
91
93
  "factory": '0xb9fc157394af804a3578134a6585c0dc9cc990d4',
94
+ "crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
92
95
  "registry_exchange": "",
93
96
  };
94
97
  var Curve = /** @class */ (function () {
@@ -421,6 +424,21 @@ var Curve = /** @class */ (function () {
421
424
  contract: new ethers_1.Contract(exports.ALIASES.factory, factory_json_1.default, this.signer || this.provider),
422
425
  multicallContract: new ethcall_1.Contract(exports.ALIASES.factory, factory_json_1.default),
423
426
  };
427
+ this.contracts[exports.ALIASES.crypto_factory] = {
428
+ contract: new ethers_1.Contract(exports.ALIASES.crypto_factory, factory_crypto_json_1.default, this.signer || this.provider),
429
+ multicallContract: new ethcall_1.Contract(exports.ALIASES.crypto_factory, factory_crypto_json_1.default),
430
+ };
431
+ this.contracts[exports.ALIASES.crypto_factory.toLowerCase()] = {
432
+ contract: new ethers_1.Contract(exports.ALIASES.crypto_factory, factory_crypto_json_1.default, this.signer || this.provider),
433
+ multicallContract: new ethcall_1.Contract(exports.ALIASES.crypto_factory, factory_crypto_json_1.default),
434
+ };
435
+ this.constants = {
436
+ ALIASES: exports.ALIASES,
437
+ POOLS_DATA: exports.POOLS_DATA,
438
+ DECIMALS_LOWER_CASE: exports.DECIMALS_LOWER_CASE,
439
+ LP_TOKENS: exports.LP_TOKENS,
440
+ GAUGES: exports.GAUGES,
441
+ };
424
442
  return [2 /*return*/];
425
443
  }
426
444
  });
@@ -432,13 +450,6 @@ var Curve = /** @class */ (function () {
432
450
  return __generator(this, function (_b) {
433
451
  switch (_b.label) {
434
452
  case 0:
435
- this.constants = {
436
- ALIASES: exports.ALIASES,
437
- POOLS_DATA: exports.POOLS_DATA,
438
- DECIMALS_LOWER_CASE: exports.DECIMALS_LOWER_CASE,
439
- LP_TOKENS: exports.LP_TOKENS,
440
- GAUGES: exports.GAUGES,
441
- };
442
453
  _a = this.constants;
443
454
  return [4 /*yield*/, factory_1.getFactoryPoolData.call(this)];
444
455
  case 1:
@@ -448,6 +459,23 @@ var Curve = /** @class */ (function () {
448
459
  });
449
460
  });
450
461
  };
462
+ Curve.prototype.fetchCryptoFactoryPools = function () {
463
+ return __awaiter(this, void 0, void 0, function () {
464
+ var _a;
465
+ return __generator(this, function (_b) {
466
+ switch (_b.label) {
467
+ case 0:
468
+ if (!(this.chainId === 1 || this.chainId === 1337)) return [3 /*break*/, 2];
469
+ _a = this.constants;
470
+ return [4 /*yield*/, factory_crypto_1.getCryptoFactoryPoolData.call(this)];
471
+ case 1:
472
+ _a.CRYPTO_FACTORY_POOLS_DATA = _b.sent();
473
+ _b.label = 2;
474
+ case 2: return [2 /*return*/];
475
+ }
476
+ });
477
+ });
478
+ };
451
479
  Curve.prototype.setCustomFeeData = function (customFeeData) {
452
480
  this.feeData = __assign(__assign({}, this.feeData), customFeeData);
453
481
  };