@gearbox-protocol/sdk 1.15.21 → 1.15.23
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/lib/apy/curveAPY.js +19 -12
- package/lib/oracles/priceFeeds.js +1 -1
- package/package.json +1 -1
package/lib/apy/curveAPY.js
CHANGED
|
@@ -45,17 +45,21 @@ var ethers_1 = require("ethers");
|
|
|
45
45
|
var constants_1 = require("../core/constants");
|
|
46
46
|
var formatter_1 = require("../utils/formatter");
|
|
47
47
|
var mappers_1 = require("../utils/mappers");
|
|
48
|
-
var
|
|
49
|
-
"3Crv": "
|
|
50
|
-
FRAX3CRV: "
|
|
51
|
-
gusd3CRV: "
|
|
52
|
-
LUSD3CRV: "
|
|
53
|
-
crvPlain3andSUSD: "
|
|
54
|
-
steCRV: "
|
|
55
|
-
crvFRAX: "
|
|
48
|
+
var POOL_DICTIONARY = {
|
|
49
|
+
"3Crv": "0",
|
|
50
|
+
FRAX3CRV: "34",
|
|
51
|
+
gusd3CRV: "19",
|
|
52
|
+
LUSD3CRV: "33",
|
|
53
|
+
crvPlain3andSUSD: "15",
|
|
54
|
+
steCRV: "14",
|
|
55
|
+
crvFRAX: "44", // 0xDcEF968d416a41Cdac0ED8702fAC8128A64241A2
|
|
56
56
|
};
|
|
57
57
|
var RESPONSE_DECIMALS = 100;
|
|
58
58
|
var ZERO = ethers_1.BigNumber.from(0);
|
|
59
|
+
// const MAIN = "https://api.curve.fi/api/getPools/ethereum/main";
|
|
60
|
+
// const CRYPTO = "https://api.curve.fi/api/getPools/ethereum/crypto";
|
|
61
|
+
// const FACTORY = "https://api.curve.fi/api/getPools/ethereum/factory";
|
|
62
|
+
// const FACTORY_CRYPTO = "https://api.curve.fi/api/getPools/ethereum/factory-crypto";
|
|
59
63
|
// https://www.convexfinance.com/api/curve-apys
|
|
60
64
|
// http://localhost:8000/api/curve-apys
|
|
61
65
|
var URL = "https://www.convexfinance.com/api/curve-apys";
|
|
@@ -70,15 +74,18 @@ function getCurveAPY() {
|
|
|
70
74
|
case 1:
|
|
71
75
|
data = (_a.sent()).data;
|
|
72
76
|
apys_1 = (data || {}).apys;
|
|
73
|
-
curveAPY = (0, mappers_1.objectEntries)(
|
|
74
|
-
var curveSymbol = _a[0],
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
+
curveAPY = (0, mappers_1.objectEntries)(POOL_DICTIONARY).reduce(function (acc, _a) {
|
|
78
|
+
var curveSymbol = _a[0], poolId = _a[1];
|
|
79
|
+
var baseApy = (apys_1[poolId] || {}).baseApy;
|
|
80
|
+
if (baseApy === undefined)
|
|
81
|
+
console.warn("No base apy for: ".concat(curveSymbol, ", ").concat(poolId));
|
|
82
|
+
acc[curveSymbol] = (0, formatter_1.toBN)(((baseApy || 0) / RESPONSE_DECIMALS).toString(), constants_1.WAD_DECIMALS_POW);
|
|
77
83
|
return acc;
|
|
78
84
|
}, {});
|
|
79
85
|
return [2 /*return*/, curveAPY];
|
|
80
86
|
case 2:
|
|
81
87
|
e_1 = _a.sent();
|
|
88
|
+
console.error(e_1);
|
|
82
89
|
return [2 /*return*/, {
|
|
83
90
|
"3Crv": ZERO,
|
|
84
91
|
crvFRAX: ZERO,
|
|
@@ -251,7 +251,7 @@ exports.priceFeedsByNetwork = {
|
|
|
251
251
|
priceFeedETH: {
|
|
252
252
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
253
253
|
address: {
|
|
254
|
-
Mainnet: "
|
|
254
|
+
Mainnet: "0x86392dC19c0b719886221c78AB11eb8Cf5c52812",
|
|
255
255
|
Goerli: "0x0C539D95F202eF8b3981521782ABd3a12c5C4F95",
|
|
256
256
|
},
|
|
257
257
|
},
|