@gearbox-protocol/sdk 1.15.21 → 1.15.22

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.
Files changed (2) hide show
  1. package/lib/apy/curveAPY.js +19 -12
  2. package/package.json +1 -1
@@ -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 NAME_DICTIONARY = {
49
- "3Crv": "3pool",
50
- FRAX3CRV: "frax",
51
- gusd3CRV: "gusd",
52
- LUSD3CRV: "lusd",
53
- crvPlain3andSUSD: "susdv2",
54
- steCRV: "steth",
55
- crvFRAX: "fraxusdc", // TODO: CHECK!
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)(NAME_DICTIONARY).reduce(function (acc, _a) {
74
- var curveSymbol = _a[0], apiEntry = _a[1];
75
- var _b = (apys_1[apiEntry] || {}).baseApy, baseApy = _b === void 0 ? 0 : _b;
76
- acc[curveSymbol] = (0, formatter_1.toBN)((baseApy / RESPONSE_DECIMALS).toString(), constants_1.WAD_DECIMALS_POW);
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "1.15.21",
3
+ "version": "1.15.22",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",