impermax-sdk 2.1.49 → 2.1.51

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.
@@ -26,6 +26,9 @@ var LendingPoolVersion;
26
26
  LendingPoolVersion["V2"] = "V2";
27
27
  LendingPoolVersion["V3"] = "V3";
28
28
  })(LendingPoolVersion = exports.LendingPoolVersion || (exports.LendingPoolVersion = {}));
29
+ // Adjust these to filter out pools with `isLowTVL` and `isHighTVL`
30
+ const LOW_TVL = 25000;
31
+ const HIGH_TVL = 100000;
29
32
  class OffchainLendingPool {
30
33
  constructor(offchain, factory, pairAddress) {
31
34
  this.getOffchain = () => this.offchain;
@@ -246,7 +249,6 @@ class OffchainLendingPool {
246
249
  return uniswapAPR + stakingAPR;
247
250
  });
248
251
  }
249
- // NOTE: Should this also include collateral totalBalanceUSD ?
250
252
  getTVL() {
251
253
  return __awaiter(this, void 0, void 0, function* () {
252
254
  const [supply0USD, supply1USD, totalBalanceUSD] = yield Promise.all([
@@ -272,11 +274,17 @@ class OffchainLendingPool {
272
274
  }
273
275
  isLowTVL() {
274
276
  return __awaiter(this, void 0, void 0, function* () {
277
+ const tvl = yield this.getTVL();
278
+ if (tvl < LOW_TVL)
279
+ return true;
275
280
  return false;
276
281
  });
277
282
  }
278
283
  isHighTVL() {
279
284
  return __awaiter(this, void 0, void 0, function* () {
285
+ const tvl = yield this.getTVL();
286
+ if (tvl > HIGH_TVL)
287
+ return true;
280
288
  return false;
281
289
  });
282
290
  }
@@ -50,6 +50,7 @@ export default class OffchainVault extends OffchainPoolToken {
50
50
  isDeprecated(): Promise<boolean>;
51
51
  isBlacklisted(): Promise<boolean>;
52
52
  isStable(): Promise<boolean>;
53
+ isLowTVL(): Promise<boolean>;
53
54
  isHighTVL(): Promise<boolean>;
54
55
  getVaultChart(): Promise<Array<VaultDayData> | null>;
55
56
  }
@@ -29,6 +29,9 @@ var VaultStatus;
29
29
  VaultStatus["BLACKLISTED"] = "Blacklisted";
30
30
  VaultStatus["ACTIVE"] = "Active";
31
31
  })(VaultStatus = exports.VaultStatus || (exports.VaultStatus = {}));
32
+ // Adjust these to filter out vaults with `isLowTVL` and `isHighTVL`
33
+ const LOW_TVL = 25000;
34
+ const HIGH_TVL = 100000;
32
35
  class OffchainVault extends offchainPoolToken_1.default {
33
36
  constructor(offchain, vaultAddress) {
34
37
  super();
@@ -129,11 +132,28 @@ class OffchainVault extends offchainPoolToken_1.default {
129
132
  }
130
133
  isStable() {
131
134
  return __awaiter(this, void 0, void 0, function* () {
135
+ const [stables, token] = yield Promise.all([
136
+ this.getOffchain().getAPRHelper().getAllStablecoins(),
137
+ this.getSymbol()
138
+ ]);
139
+ if (stables.includes(token))
140
+ return true;
141
+ return false;
142
+ });
143
+ }
144
+ isLowTVL() {
145
+ return __awaiter(this, void 0, void 0, function* () {
146
+ const tvl = yield this.getVaultSupplyUSD();
147
+ if (tvl < LOW_TVL)
148
+ return true;
132
149
  return false;
133
150
  });
134
151
  }
135
152
  isHighTVL() {
136
153
  return __awaiter(this, void 0, void 0, function* () {
154
+ const tvl = yield this.getVaultSupplyUSD();
155
+ if (tvl > HIGH_TVL)
156
+ return true;
137
157
  return false;
138
158
  });
139
159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.49",
3
+ "version": "2.1.51",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",