@curvefi/api 1.12.0 → 1.15.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.
- package/README.md +98 -1
- package/lib/constants/abis/abis-ethereum.js +144 -16
- package/lib/constants/abis/abis-polygon.js +17 -1
- package/lib/constants/abis/json/aave/rewards.json +107 -0
- package/lib/constants/abis/json/atricrypto3/swap.json +63 -63
- package/lib/constants/abis/json/atricrypto3/zap.json +8 -8
- package/lib/constants/abis/json/busd/deposit.json +5 -10
- package/lib/constants/abis/json/busd/swap.json +18 -36
- package/lib/constants/abis/json/compound/deposit.json +5 -10
- package/lib/constants/abis/json/compound/migration.json +1 -2
- package/lib/constants/abis/json/compound/oldSwap.json +16 -32
- package/lib/constants/abis/json/compound/swap.json +18 -36
- package/lib/constants/abis/json/crveth/swap.json +61 -61
- package/lib/constants/abis/json/eurt/swap.json +29 -29
- package/lib/constants/abis/json/eurtusd/deposit.json +13 -13
- package/lib/constants/abis/json/eurtusd/swap.json +59 -59
- package/lib/constants/abis/json/gauge.json +1 -1
- package/lib/constants/abis/json/gauge_factory.json +879 -0
- package/lib/constants/abis/json/gauge_rewards_only.json +649 -0
- package/lib/constants/abis/json/gauge_synthetix.json +590 -0
- package/lib/constants/abis/json/gauge_v2.json +942 -0
- package/lib/constants/abis/json/gauge_v3.json +954 -0
- package/lib/constants/abis/json/gauge_v4.json +913 -0
- package/lib/constants/abis/json/iearn/deposit.json +5 -10
- package/lib/constants/abis/json/iearn/swap.json +18 -36
- package/lib/constants/abis/json/minter.json +165 -0
- package/lib/constants/abis/json/pax/deposit.json +5 -10
- package/lib/constants/abis/json/pax/swap.json +19 -38
- package/lib/constants/abis/json/ren/swap.json +19 -38
- package/lib/constants/abis/json/ren-polygon/swap.json +46 -46
- package/lib/constants/abis/json/reth/swap.json +38 -38
- package/lib/constants/abis/json/sbtc/swap.json +19 -38
- package/lib/constants/abis/json/streamer.json +257 -0
- package/lib/constants/abis/json/susdv2/deposit.json +5 -10
- package/lib/constants/abis/json/susdv2/swap.json +16 -32
- package/lib/constants/abis/json/tricrypto2/deposit.json +3 -3
- package/lib/constants/abis/json/tricrypto2/swap.json +60 -60
- package/lib/constants/abis/json/usdt/deposit.json +5 -10
- package/lib/constants/abis/json/usdt/swap.json +19 -37
- package/lib/constants/aliases.d.ts +2 -0
- package/lib/constants/aliases.js +3 -1
- package/lib/constants/coins-ethereum.js +4 -2
- package/lib/constants/coins-polygon.js +3 -2
- package/lib/curve.d.ts +1 -0
- package/lib/curve.js +47 -16
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/interfaces.d.ts +8 -0
- package/lib/pools.d.ts +41 -5
- package/lib/pools.js +334 -52
- package/lib/utils.d.ts +2 -1
- package/lib/utils.js +42 -29
- package/package.json +1 -1
|
@@ -267,12 +267,11 @@
|
|
|
267
267
|
"outputs": [
|
|
268
268
|
{
|
|
269
269
|
"type": "uint256",
|
|
270
|
-
"name": "
|
|
270
|
+
"name": ""
|
|
271
271
|
}
|
|
272
272
|
],
|
|
273
273
|
"inputs": [],
|
|
274
|
-
"
|
|
275
|
-
"payable": false,
|
|
274
|
+
"stateMutability": "view",
|
|
276
275
|
"type": "function",
|
|
277
276
|
"gas": "1327351"
|
|
278
277
|
},
|
|
@@ -294,8 +293,7 @@
|
|
|
294
293
|
"name": "deposit"
|
|
295
294
|
}
|
|
296
295
|
],
|
|
297
|
-
"
|
|
298
|
-
"payable": false,
|
|
296
|
+
"stateMutability": "view",
|
|
299
297
|
"type": "function",
|
|
300
298
|
"gas": "5171741"
|
|
301
299
|
},
|
|
@@ -339,8 +337,7 @@
|
|
|
339
337
|
"name": "dx"
|
|
340
338
|
}
|
|
341
339
|
],
|
|
342
|
-
"
|
|
343
|
-
"payable": false,
|
|
340
|
+
"stateMutability": "view",
|
|
344
341
|
"type": "function",
|
|
345
342
|
"gas": "3016651"
|
|
346
343
|
},
|
|
@@ -366,8 +363,7 @@
|
|
|
366
363
|
"name": "dy"
|
|
367
364
|
}
|
|
368
365
|
],
|
|
369
|
-
"
|
|
370
|
-
"payable": false,
|
|
366
|
+
"stateMutability": "view",
|
|
371
367
|
"type": "function",
|
|
372
368
|
"gas": "3016657"
|
|
373
369
|
},
|
|
@@ -393,8 +389,7 @@
|
|
|
393
389
|
"name": "dx"
|
|
394
390
|
}
|
|
395
391
|
],
|
|
396
|
-
"
|
|
397
|
-
"payable": false,
|
|
392
|
+
"stateMutability": "view",
|
|
398
393
|
"type": "function",
|
|
399
394
|
"gas": "3016494"
|
|
400
395
|
},
|
|
@@ -420,8 +415,7 @@
|
|
|
420
415
|
"name": "dy"
|
|
421
416
|
}
|
|
422
417
|
],
|
|
423
|
-
"
|
|
424
|
-
"payable": false,
|
|
418
|
+
"stateMutability": "view",
|
|
425
419
|
"type": "function",
|
|
426
420
|
"gas": "3016500"
|
|
427
421
|
},
|
|
@@ -626,8 +620,7 @@
|
|
|
626
620
|
"name": "arg0"
|
|
627
621
|
}
|
|
628
622
|
],
|
|
629
|
-
"
|
|
630
|
-
"payable": false,
|
|
623
|
+
"stateMutability": "view",
|
|
631
624
|
"type": "function",
|
|
632
625
|
"gas": "2190"
|
|
633
626
|
},
|
|
@@ -645,8 +638,7 @@
|
|
|
645
638
|
"name": "arg0"
|
|
646
639
|
}
|
|
647
640
|
],
|
|
648
|
-
"
|
|
649
|
-
"payable": false,
|
|
641
|
+
"stateMutability": "view",
|
|
650
642
|
"type": "function",
|
|
651
643
|
"gas": "2220"
|
|
652
644
|
},
|
|
@@ -677,8 +669,7 @@
|
|
|
677
669
|
}
|
|
678
670
|
],
|
|
679
671
|
"inputs": [],
|
|
680
|
-
"
|
|
681
|
-
"payable": false,
|
|
672
|
+
"stateMutability": "view",
|
|
682
673
|
"type": "function",
|
|
683
674
|
"gas": "2081"
|
|
684
675
|
},
|
|
@@ -691,8 +682,7 @@
|
|
|
691
682
|
}
|
|
692
683
|
],
|
|
693
684
|
"inputs": [],
|
|
694
|
-
"
|
|
695
|
-
"payable": false,
|
|
685
|
+
"stateMutability": "view",
|
|
696
686
|
"type": "function",
|
|
697
687
|
"gas": "2111"
|
|
698
688
|
},
|
|
@@ -705,8 +695,7 @@
|
|
|
705
695
|
}
|
|
706
696
|
],
|
|
707
697
|
"inputs": [],
|
|
708
|
-
"
|
|
709
|
-
"payable": false,
|
|
698
|
+
"stateMutability": "view",
|
|
710
699
|
"type": "function",
|
|
711
700
|
"gas": "2141"
|
|
712
701
|
},
|
|
@@ -719,8 +708,7 @@
|
|
|
719
708
|
}
|
|
720
709
|
],
|
|
721
710
|
"inputs": [],
|
|
722
|
-
"
|
|
723
|
-
"payable": false,
|
|
711
|
+
"stateMutability": "view",
|
|
724
712
|
"type": "function",
|
|
725
713
|
"gas": "2171"
|
|
726
714
|
},
|
|
@@ -734,8 +722,7 @@
|
|
|
734
722
|
}
|
|
735
723
|
],
|
|
736
724
|
"inputs": [],
|
|
737
|
-
"
|
|
738
|
-
"payable": false,
|
|
725
|
+
"stateMutability": "view",
|
|
739
726
|
"type": "function",
|
|
740
727
|
"gas": "2201"
|
|
741
728
|
},
|
|
@@ -749,8 +736,7 @@
|
|
|
749
736
|
}
|
|
750
737
|
],
|
|
751
738
|
"inputs": [],
|
|
752
|
-
"
|
|
753
|
-
"payable": false,
|
|
739
|
+
"stateMutability": "view",
|
|
754
740
|
"type": "function",
|
|
755
741
|
"gas": "2231"
|
|
756
742
|
},
|
|
@@ -763,8 +749,7 @@
|
|
|
763
749
|
}
|
|
764
750
|
],
|
|
765
751
|
"inputs": [],
|
|
766
|
-
"
|
|
767
|
-
"payable": false,
|
|
752
|
+
"stateMutability": "view",
|
|
768
753
|
"type": "function",
|
|
769
754
|
"gas": "2261"
|
|
770
755
|
},
|
|
@@ -777,8 +762,7 @@
|
|
|
777
762
|
}
|
|
778
763
|
],
|
|
779
764
|
"inputs": [],
|
|
780
|
-
"
|
|
781
|
-
"payable": false,
|
|
765
|
+
"stateMutability": "view",
|
|
782
766
|
"type": "function",
|
|
783
767
|
"gas": "2291"
|
|
784
768
|
},
|
|
@@ -791,8 +775,7 @@
|
|
|
791
775
|
}
|
|
792
776
|
],
|
|
793
777
|
"inputs": [],
|
|
794
|
-
"
|
|
795
|
-
"payable": false,
|
|
778
|
+
"stateMutability": "view",
|
|
796
779
|
"type": "function",
|
|
797
780
|
"gas": "2321"
|
|
798
781
|
},
|
|
@@ -805,8 +788,7 @@
|
|
|
805
788
|
}
|
|
806
789
|
],
|
|
807
790
|
"inputs": [],
|
|
808
|
-
"
|
|
809
|
-
"payable": false,
|
|
791
|
+
"stateMutability": "view",
|
|
810
792
|
"type": "function",
|
|
811
793
|
"gas": "2351"
|
|
812
794
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const ALIASES_ETHEREUM: {
|
|
2
2
|
crv: string;
|
|
3
|
+
minter: string;
|
|
3
4
|
voting_escrow: string;
|
|
4
5
|
gauge_controller: string;
|
|
5
6
|
address_provider: string;
|
|
@@ -8,6 +9,7 @@ export declare const ALIASES_ETHEREUM: {
|
|
|
8
9
|
};
|
|
9
10
|
export declare const ALIASES_POLYGON: {
|
|
10
11
|
crv: string;
|
|
12
|
+
minter: string;
|
|
11
13
|
voting_escrow: string;
|
|
12
14
|
gauge_controller: string;
|
|
13
15
|
address_provider: string;
|
package/lib/constants/aliases.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ALIASES_POLYGON = exports.ALIASES_ETHEREUM = void 0;
|
|
4
4
|
exports.ALIASES_ETHEREUM = {
|
|
5
5
|
"crv": "0xD533a949740bb3306d119CC777fa900bA034cd52",
|
|
6
|
+
"minter": "0xd061D61a4d941c39E5453435B6345Dc261C2fcE0",
|
|
6
7
|
"voting_escrow": "0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2",
|
|
7
8
|
"gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
|
|
8
9
|
"address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
|
|
@@ -10,7 +11,8 @@ exports.ALIASES_ETHEREUM = {
|
|
|
10
11
|
"registry_exchange": "",
|
|
11
12
|
};
|
|
12
13
|
exports.ALIASES_POLYGON = {
|
|
13
|
-
"crv": "
|
|
14
|
+
"crv": "0x172370d5cd63279efa6d502dab29171933a610af",
|
|
15
|
+
"minter": "0xd061D61a4d941c39E5453435B6345Dc261C2fcE0",
|
|
14
16
|
"voting_escrow": "0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2",
|
|
15
17
|
"gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
|
|
16
18
|
"address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
|
|
@@ -90,7 +90,8 @@ exports.USD_COINS_ETHEREUM = {
|
|
|
90
90
|
alusd: "0xbc6da0fe9ad5f3b0d58160288917aa56653660e9",
|
|
91
91
|
mim: "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3",
|
|
92
92
|
'3crv': "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
|
|
93
|
-
crv: "0xD533a949740bb3306d119CC777fa900bA034cd52",
|
|
93
|
+
crv: "0xD533a949740bb3306d119CC777fa900bA034cd52",
|
|
94
|
+
cvx: "0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b", // CVX
|
|
94
95
|
};
|
|
95
96
|
// @ts-ignore
|
|
96
97
|
exports.USD_COINS_LOWER_CASE_ETHEREUM = Object.fromEntries(Object.entries(exports.USD_COINS_ETHEREUM).map(function (entry) { return [entry[0], entry[1].toLowerCase()]; }));
|
|
@@ -158,7 +159,8 @@ exports.DECIMALS_ETHEREUM = {
|
|
|
158
159
|
"0xbc6da0fe9ad5f3b0d58160288917aa56653660e9": 18,
|
|
159
160
|
"0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3": 18,
|
|
160
161
|
"0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490": 18,
|
|
161
|
-
"0xD533a949740bb3306d119CC777fa900bA034cd52": 18,
|
|
162
|
+
"0xD533a949740bb3306d119CC777fa900bA034cd52": 18,
|
|
163
|
+
"0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b": 18, // CVX
|
|
162
164
|
};
|
|
163
165
|
// @ts-ignore
|
|
164
166
|
exports.DECIMALS_LOWER_CASE_ETHEREUM = Object.fromEntries(Object.entries(exports.DECIMALS_ETHEREUM).map(function (entry) { return [entry[0].toLowerCase(), entry[1]]; }));
|
|
@@ -44,7 +44,7 @@ exports.USD_COINS_POLYGON = {
|
|
|
44
44
|
};
|
|
45
45
|
// @ts-ignore
|
|
46
46
|
exports.USD_COINS_LOWER_CASE_POLYGON = Object.fromEntries(Object.entries(exports.USD_COINS_POLYGON).map(function (entry) { return [entry[0], entry[1].toLowerCase()]; }));
|
|
47
|
-
exports.COINS_POLYGON = __assign(__assign(__assign(__assign(__assign({}, exports.BTC_COINS_POLYGON), exports.ETH_COINS_POLYGON), exports.LINK_COINS_POLYGON), exports.EUR_COINS_POLYGON), exports.USD_COINS_POLYGON);
|
|
47
|
+
exports.COINS_POLYGON = __assign(__assign(__assign(__assign(__assign(__assign({}, exports.BTC_COINS_POLYGON), exports.ETH_COINS_POLYGON), exports.LINK_COINS_POLYGON), exports.EUR_COINS_POLYGON), exports.USD_COINS_POLYGON), { crv: "0x172370d5cd63279efa6d502dab29171933a610af" });
|
|
48
48
|
exports.DECIMALS_POLYGON = {
|
|
49
49
|
"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063": 18,
|
|
50
50
|
"0x2791bca1f2de4661ed88a30c99a7a9449aa84174": 6,
|
|
@@ -58,7 +58,8 @@ exports.DECIMALS_POLYGON = {
|
|
|
58
58
|
"0x5c2ed810328349100A66B82b78a1791B101C9D61": 8,
|
|
59
59
|
"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619": 18,
|
|
60
60
|
"0x28424507fefb6f7f8E9D3860F56504E4e5f5f390": 18,
|
|
61
|
-
"0x7BDF330f423Ea880FF95fC41A280fD5eCFD3D09f": 6,
|
|
61
|
+
"0x7BDF330f423Ea880FF95fC41A280fD5eCFD3D09f": 6,
|
|
62
|
+
"0x172370d5cd63279efa6d502dab29171933a610af": 18, // CRV
|
|
62
63
|
};
|
|
63
64
|
// @ts-ignore
|
|
64
65
|
exports.DECIMALS_LOWER_CASE_POLYGON = Object.fromEntries(Object.entries(exports.DECIMALS_POLYGON).map(function (entry) { return [entry[0].toLowerCase(), entry[1]]; }));
|
package/lib/curve.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare let DECIMALS: DictInterface<number>;
|
|
|
22
22
|
export declare let DECIMALS_LOWER_CASE: DictInterface<number>;
|
|
23
23
|
export declare let ALIASES: {
|
|
24
24
|
crv: string;
|
|
25
|
+
minter: string;
|
|
25
26
|
voting_escrow: string;
|
|
26
27
|
gauge_controller: string;
|
|
27
28
|
address_provider: string;
|
package/lib/curve.js
CHANGED
|
@@ -65,12 +65,13 @@ var ethcall_1 = require("ethcall");
|
|
|
65
65
|
var ERC20_json_1 = __importDefault(require("./constants/abis/json/ERC20.json"));
|
|
66
66
|
var cERC20_json_1 = __importDefault(require("./constants/abis/json/cERC20.json"));
|
|
67
67
|
var yERC20_json_1 = __importDefault(require("./constants/abis/json/yERC20.json"));
|
|
68
|
-
var
|
|
68
|
+
var minter_json_1 = __importDefault(require("./constants/abis/json/minter.json"));
|
|
69
69
|
var votingescrow_json_1 = __importDefault(require("./constants/abis/json/votingescrow.json"));
|
|
70
70
|
var address_provider_json_1 = __importDefault(require("./constants/abis/json/address_provider.json"));
|
|
71
71
|
var gaugecontroller_json_1 = __importDefault(require("./constants/abis/json/gaugecontroller.json"));
|
|
72
72
|
var router_json_1 = __importDefault(require("./constants/abis/json/router.json"));
|
|
73
73
|
var registry_exchange_json_1 = __importDefault(require("./constants/abis/json/registry_exchange.json"));
|
|
74
|
+
var streamer_json_1 = __importDefault(require("./constants/abis/json/streamer.json"));
|
|
74
75
|
var abis_ethereum_1 = require("./constants/abis/abis-ethereum");
|
|
75
76
|
var abis_polygon_1 = require("./constants/abis/abis-polygon");
|
|
76
77
|
var coins_ethereum_1 = require("./constants/coins-ethereum");
|
|
@@ -78,6 +79,7 @@ var coins_polygon_1 = require("./constants/coins-polygon");
|
|
|
78
79
|
var aliases_1 = require("./constants/aliases");
|
|
79
80
|
exports.ALIASES = {
|
|
80
81
|
"crv": "0xD533a949740bb3306d119CC777fa900bA034cd52",
|
|
82
|
+
"minter": "0xd061D61a4d941c39E5453435B6345Dc261C2fcE0",
|
|
81
83
|
"voting_escrow": "0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2",
|
|
82
84
|
"gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
|
|
83
85
|
"address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
|
|
@@ -103,9 +105,9 @@ var Curve = /** @class */ (function () {
|
|
|
103
105
|
) {
|
|
104
106
|
if (options === void 0) { options = {}; }
|
|
105
107
|
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
-
var cTokens, yTokens, ycTokens, aTokens, network, _a, customAbiTokens, _b, _i, _c, pool, _d, _e, coinAddr, _f, _g, coinAddr, _h, _j, coinAddr, addressProviderContract,
|
|
107
|
-
return __generator(this, function (
|
|
108
|
-
switch (
|
|
108
|
+
var cTokens, yTokens, ycTokens, aTokens, network, _a, customAbiTokens, _b, _i, _c, pool, _d, _e, coinAddr, _f, _g, coinAddr, _h, _j, coinAddr, _k, _l, rewardTokenAddr, addressProviderContract, _m;
|
|
109
|
+
return __generator(this, function (_o) {
|
|
110
|
+
switch (_o.label) {
|
|
109
111
|
case 0:
|
|
110
112
|
// JsonRpc provider
|
|
111
113
|
if (providerType.toLowerCase() === 'JsonRpc'.toLowerCase()) {
|
|
@@ -145,8 +147,8 @@ var Curve = /** @class */ (function () {
|
|
|
145
147
|
if (_a) return [3 /*break*/, 2];
|
|
146
148
|
return [4 /*yield*/, this.provider._networkPromise];
|
|
147
149
|
case 1:
|
|
148
|
-
_a = (
|
|
149
|
-
|
|
150
|
+
_a = (_o.sent());
|
|
151
|
+
_o.label = 2;
|
|
150
152
|
case 2:
|
|
151
153
|
network = _a;
|
|
152
154
|
console.log("CURVE-JS IS CONNECTED TO NETWORK:", network);
|
|
@@ -202,21 +204,21 @@ var Curve = /** @class */ (function () {
|
|
|
202
204
|
this.multicallProvider = new ethcall_1.Provider();
|
|
203
205
|
return [4 /*yield*/, this.multicallProvider.init(this.provider)];
|
|
204
206
|
case 3:
|
|
205
|
-
|
|
207
|
+
_o.sent();
|
|
206
208
|
if (!this.signer) return [3 /*break*/, 5];
|
|
207
209
|
_b = this;
|
|
208
210
|
return [4 /*yield*/, this.signer.getAddress()];
|
|
209
211
|
case 4:
|
|
210
|
-
_b.signerAddress =
|
|
212
|
+
_b.signerAddress = _o.sent();
|
|
211
213
|
return [3 /*break*/, 6];
|
|
212
214
|
case 5:
|
|
213
215
|
this.signerAddress = '';
|
|
214
|
-
|
|
216
|
+
_o.label = 6;
|
|
215
217
|
case 6:
|
|
216
218
|
this.feeData = { gasPrice: options.gasPrice, maxFeePerGas: options.maxFeePerGas, maxPriorityFeePerGas: options.maxPriorityFeePerGas };
|
|
217
219
|
return [4 /*yield*/, this.updateFeeData()];
|
|
218
220
|
case 7:
|
|
219
|
-
|
|
221
|
+
_o.sent();
|
|
220
222
|
// TODO delete toLowerCase()
|
|
221
223
|
for (_i = 0, _c = Object.values(exports.POOLS_DATA); _i < _c.length; _i++) {
|
|
222
224
|
pool = _c[_i];
|
|
@@ -239,12 +241,12 @@ var Curve = /** @class */ (function () {
|
|
|
239
241
|
};
|
|
240
242
|
}
|
|
241
243
|
this.contracts[pool.gauge_address] = {
|
|
242
|
-
contract: new ethers_1.Contract(pool.gauge_address,
|
|
243
|
-
multicallContract: new ethcall_1.Contract(pool.gauge_address,
|
|
244
|
+
contract: new ethers_1.Contract(pool.gauge_address, pool.gauge_abi, this.signer || this.provider),
|
|
245
|
+
multicallContract: new ethcall_1.Contract(pool.gauge_address, pool.gauge_abi),
|
|
244
246
|
};
|
|
245
247
|
this.contracts[pool.gauge_address.toLowerCase()] = {
|
|
246
|
-
contract: new ethers_1.Contract(pool.gauge_address,
|
|
247
|
-
multicallContract: new ethcall_1.Contract(pool.gauge_address,
|
|
248
|
+
contract: new ethers_1.Contract(pool.gauge_address, pool.gauge_abi, this.signer || this.provider),
|
|
249
|
+
multicallContract: new ethcall_1.Contract(pool.gauge_address, pool.gauge_abi),
|
|
248
250
|
};
|
|
249
251
|
if (pool.deposit_address && this.contracts[pool.deposit_address] === undefined) {
|
|
250
252
|
this.contracts[pool.deposit_address] = {
|
|
@@ -314,6 +316,27 @@ var Curve = /** @class */ (function () {
|
|
|
314
316
|
};
|
|
315
317
|
}
|
|
316
318
|
}
|
|
319
|
+
if (pool.reward_contract) {
|
|
320
|
+
this.contracts[pool.reward_contract] = {
|
|
321
|
+
contract: new ethers_1.Contract(pool.reward_contract, streamer_json_1.default, this.signer || this.provider),
|
|
322
|
+
multicallContract: new ethcall_1.Contract(pool.reward_contract, streamer_json_1.default),
|
|
323
|
+
};
|
|
324
|
+
this.contracts[pool.reward_contract.toLowerCase()] = {
|
|
325
|
+
contract: new ethers_1.Contract(pool.reward_contract, streamer_json_1.default, this.signer || this.provider),
|
|
326
|
+
multicallContract: new ethcall_1.Contract(pool.reward_contract, streamer_json_1.default),
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
for (_k = 0, _l = pool.reward_tokens || []; _k < _l.length; _k++) {
|
|
330
|
+
rewardTokenAddr = _l[_k];
|
|
331
|
+
this.contracts[rewardTokenAddr] = {
|
|
332
|
+
contract: new ethers_1.Contract(rewardTokenAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
333
|
+
multicallContract: new ethcall_1.Contract(rewardTokenAddr, ERC20_json_1.default),
|
|
334
|
+
};
|
|
335
|
+
this.contracts[rewardTokenAddr.toLowerCase()] = {
|
|
336
|
+
contract: new ethers_1.Contract(rewardTokenAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
337
|
+
multicallContract: new ethcall_1.Contract(rewardTokenAddr, ERC20_json_1.default),
|
|
338
|
+
};
|
|
339
|
+
}
|
|
317
340
|
}
|
|
318
341
|
this.contracts[exports.ALIASES.crv] = {
|
|
319
342
|
contract: new ethers_1.Contract(exports.ALIASES.crv, ERC20_json_1.default, this.signer || this.provider),
|
|
@@ -323,6 +346,14 @@ var Curve = /** @class */ (function () {
|
|
|
323
346
|
contract: new ethers_1.Contract(exports.ALIASES.crv, ERC20_json_1.default, this.signer || this.provider),
|
|
324
347
|
multicallContract: new ethcall_1.Contract(exports.ALIASES.crv, ERC20_json_1.default),
|
|
325
348
|
};
|
|
349
|
+
this.contracts[exports.ALIASES.minter] = {
|
|
350
|
+
contract: new ethers_1.Contract(exports.ALIASES.minter, minter_json_1.default, this.signer || this.provider),
|
|
351
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.minter, minter_json_1.default),
|
|
352
|
+
};
|
|
353
|
+
this.contracts[exports.ALIASES.minter.toLowerCase()] = {
|
|
354
|
+
contract: new ethers_1.Contract(exports.ALIASES.minter, minter_json_1.default, this.signer || this.provider),
|
|
355
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.minter, minter_json_1.default),
|
|
356
|
+
};
|
|
326
357
|
this.contracts[exports.ALIASES.voting_escrow] = {
|
|
327
358
|
contract: new ethers_1.Contract(exports.ALIASES.voting_escrow, votingescrow_json_1.default, this.signer || this.provider),
|
|
328
359
|
multicallContract: new ethcall_1.Contract(exports.ALIASES.voting_escrow, votingescrow_json_1.default),
|
|
@@ -340,10 +371,10 @@ var Curve = /** @class */ (function () {
|
|
|
340
371
|
multicallContract: new ethcall_1.Contract(exports.ALIASES.address_provider, address_provider_json_1.default),
|
|
341
372
|
};
|
|
342
373
|
addressProviderContract = this.contracts[exports.ALIASES.address_provider].contract;
|
|
343
|
-
|
|
374
|
+
_m = exports.ALIASES;
|
|
344
375
|
return [4 /*yield*/, addressProviderContract.get_address(2, this.constantOptions)];
|
|
345
376
|
case 8:
|
|
346
|
-
|
|
377
|
+
_m.registry_exchange = _o.sent();
|
|
347
378
|
this.contracts[exports.ALIASES.registry_exchange] = {
|
|
348
379
|
contract: new ethers_1.Contract(exports.ALIASES.registry_exchange, registry_exchange_json_1.default, this.signer || this.provider),
|
|
349
380
|
multicallContract: new ethcall_1.Contract(exports.ALIASES.registry_exchange, registry_exchange_json_1.default),
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/interfaces.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export interface DictInterface<T> {
|
|
|
2
2
|
[index: string]: T;
|
|
3
3
|
}
|
|
4
4
|
export interface PoolDataInterface {
|
|
5
|
+
reference_asset: 'USD' | 'EUR' | 'BTC' | 'ETH' | 'LINK' | 'CRYPTO';
|
|
5
6
|
N_COINS: number;
|
|
6
7
|
underlying_decimals: number[];
|
|
7
8
|
decimals: number[];
|
|
@@ -23,6 +24,7 @@ export interface PoolDataInterface {
|
|
|
23
24
|
underlying_coin_addresses: string[];
|
|
24
25
|
coin_addresses: string[];
|
|
25
26
|
swap_abi: any;
|
|
27
|
+
gauge_abi: any;
|
|
26
28
|
deposit_abi?: any;
|
|
27
29
|
old_swap_abi?: any;
|
|
28
30
|
is_meta?: boolean;
|
|
@@ -48,4 +50,10 @@ export interface PoolDataInterface {
|
|
|
48
50
|
reward_token?: string;
|
|
49
51
|
reward_tokens?: string[];
|
|
50
52
|
pool_type?: string;
|
|
53
|
+
reward_contract?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface RewardsApyInterface {
|
|
56
|
+
token: string;
|
|
57
|
+
symbol: string;
|
|
58
|
+
apy: string;
|
|
51
59
|
}
|
package/lib/pools.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
2
|
import BigNumber from 'bignumber.js';
|
|
3
|
-
import { DictInterface } from './interfaces';
|
|
3
|
+
import { DictInterface, RewardsApyInterface } from './interfaces';
|
|
4
4
|
export declare class Pool {
|
|
5
5
|
name: string;
|
|
6
|
+
referenceAsset: string;
|
|
6
7
|
swap: string;
|
|
7
8
|
zap: string | null;
|
|
8
9
|
lpToken: string;
|
|
9
10
|
gauge: string;
|
|
11
|
+
rewardContract: string | null;
|
|
10
12
|
underlyingCoins: string[];
|
|
11
13
|
coins: string[];
|
|
12
14
|
underlyingCoinAddresses: string[];
|
|
@@ -19,6 +21,7 @@ export declare class Pool {
|
|
|
19
21
|
isCrypto: boolean;
|
|
20
22
|
basePool: string;
|
|
21
23
|
isFactory: boolean;
|
|
24
|
+
rewardTokens: string[];
|
|
22
25
|
estimateGas: {
|
|
23
26
|
addLiquidityApprove: (amounts: string[]) => Promise<number>;
|
|
24
27
|
addLiquidity: (amounts: string[]) => Promise<number>;
|
|
@@ -41,12 +44,38 @@ export declare class Pool {
|
|
|
41
44
|
exchangeWrappedApprove: (inputCoin: string | number, amount: string) => Promise<number>;
|
|
42
45
|
exchangeWrapped: (inputCoin: string | number, outputCoin: string | number, amount: string, maxSlippage: number) => Promise<number>;
|
|
43
46
|
};
|
|
47
|
+
stats: {
|
|
48
|
+
getParameters: () => Promise<{
|
|
49
|
+
virtualPrice: string;
|
|
50
|
+
fee: string;
|
|
51
|
+
adminFee: string;
|
|
52
|
+
A: string;
|
|
53
|
+
gamma?: string;
|
|
54
|
+
}>;
|
|
55
|
+
getPoolBalances: () => Promise<string[]>;
|
|
56
|
+
getPoolWrappedBalances: () => Promise<string[]>;
|
|
57
|
+
getTotalLiquidity: () => Promise<string>;
|
|
58
|
+
getVolume: () => Promise<string>;
|
|
59
|
+
getBaseApy: () => Promise<{
|
|
60
|
+
day: string;
|
|
61
|
+
week: string;
|
|
62
|
+
month: string;
|
|
63
|
+
total: string;
|
|
64
|
+
}>;
|
|
65
|
+
getTokenApy: () => Promise<[baseApy: string, boostedApy: string]>;
|
|
66
|
+
getRewardsApy: () => Promise<RewardsApyInterface[]>;
|
|
67
|
+
};
|
|
44
68
|
constructor(name: string);
|
|
45
69
|
calcLpTokenAmount: (amounts: string[], isDeposit?: boolean) => Promise<string>;
|
|
46
70
|
calcLpTokenAmountWrapped: (amounts: string[], isDeposit?: boolean) => Promise<string>;
|
|
47
|
-
|
|
48
|
-
getPoolBalances
|
|
49
|
-
getPoolWrappedBalances
|
|
71
|
+
private getParameters;
|
|
72
|
+
private getPoolBalances;
|
|
73
|
+
private getPoolWrappedBalances;
|
|
74
|
+
private getTotalLiquidity;
|
|
75
|
+
private getVolume;
|
|
76
|
+
private getBaseApy;
|
|
77
|
+
private getTokenApy;
|
|
78
|
+
private getRewardsApy;
|
|
50
79
|
addLiquidityExpected: (amounts: string[]) => Promise<string>;
|
|
51
80
|
addLiquiditySlippage: (amounts: string[]) => Promise<string>;
|
|
52
81
|
addLiquidityIsApproved: (amounts: string[]) => Promise<boolean>;
|
|
@@ -101,6 +130,14 @@ export declare class Pool {
|
|
|
101
130
|
gaugeDeposit: (lpTokenAmount: string) => Promise<string>;
|
|
102
131
|
private gaugeWithdrawEstimateGas;
|
|
103
132
|
gaugeWithdraw: (lpTokenAmount: string) => Promise<string>;
|
|
133
|
+
gaugeClaimableTokens: (address?: string) => Promise<string>;
|
|
134
|
+
gaugeClaimTokens: () => Promise<string>;
|
|
135
|
+
gaugeClaimableRewards: (address?: string) => Promise<{
|
|
136
|
+
token: string;
|
|
137
|
+
symbol: string;
|
|
138
|
+
amount: string;
|
|
139
|
+
}[]>;
|
|
140
|
+
gaugeClaimRewards: () => Promise<string>;
|
|
104
141
|
balances: (...addresses: string[] | string[][]) => Promise<DictInterface<DictInterface<string>> | DictInterface<string>>;
|
|
105
142
|
lpTokenBalances: (...addresses: string[] | string[][]) => Promise<DictInterface<DictInterface<string>> | DictInterface<string>>;
|
|
106
143
|
underlyingCoinBalances: (...addresses: string[] | string[][]) => Promise<DictInterface<DictInterface<string>> | DictInterface<string>>;
|
|
@@ -121,7 +158,6 @@ export declare class Pool {
|
|
|
121
158
|
gaugeMaxBoostedDeposit: (...addresses: string[]) => Promise<DictInterface<string>>;
|
|
122
159
|
gaugeOptimalDeposits: (...accounts: string[]) => Promise<DictInterface<string>>;
|
|
123
160
|
boost: (address: string) => Promise<string>;
|
|
124
|
-
getApy: () => Promise<string[]>;
|
|
125
161
|
private _getCoinIdx;
|
|
126
162
|
private _getRates;
|
|
127
163
|
private _balances;
|