impermax-sdk 1.2.72 → 1.2.74

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.
@@ -11,6 +11,7 @@ export default class OffchainLendingPool {
11
11
  private readonly factory;
12
12
  private readonly pairAddress;
13
13
  private readonly poolTokens;
14
+ private readonly llamaAPRChains;
14
15
  constructor(offchain: Offchain, factory: Factory, pairAddress: Address);
15
16
  getOffchain: () => Offchain;
16
17
  getFactory: () => Factory;
@@ -21,6 +21,13 @@ const amms_1 = require("../../config/amms");
21
21
  const factories_1 = require("../../config/factories");
22
22
  class OffchainLendingPool {
23
23
  constructor(offchain, factory, pairAddress) {
24
+ // NOTE: We try to get the defillama APRs on these chains only, add more if needed
25
+ this.llamaAPRChains = [
26
+ types_1.Networks.Fantom,
27
+ types_1.Networks.Optimism,
28
+ types_1.Networks.Scroll,
29
+ types_1.Networks.Base
30
+ ];
24
31
  this.getOffchain = () => this.offchain;
25
32
  this.getFactory = () => this.factory;
26
33
  this.getPairAddress = () => this.pairAddress;
@@ -215,12 +222,10 @@ class OffchainLendingPool {
215
222
  return totalBorrowsUSDA + totalBorrowsUSDB;
216
223
  });
217
224
  }
218
- // Try get APR from defillama if the uniswapv2 pair is listed on `offchainAPRHelper`
219
225
  getTotalAPR() {
220
226
  return __awaiter(this, void 0, void 0, function* () {
221
227
  const uniswapV2Pair = (yield this.getLendingPoolData()).pair.uniswapV2PairAddress;
222
- // Remove this condition for all chains
223
- if (this.offchain.network == types_1.Networks.Fantom) {
228
+ if (this.llamaAPRChains.includes(this.offchain.network)) {
224
229
  // If llama fails/apr is 0 we get the uniswapAPR and stakingAPR through subgraph
225
230
  const apr = yield this.offchain.getAPRHelper().getLlamaAPR(uniswapV2Pair, this.offchain.network);
226
231
  if (apr > 0)
@@ -5,6 +5,7 @@ export default class OffchainAPRHelper {
5
5
  private initialized;
6
6
  private chainTvls;
7
7
  private tvlInitialized;
8
+ private readonly blacklistedProjects;
8
9
  offchain: Offchain;
9
10
  constructor(offchain: Offchain);
10
11
  cleanCache(): void;
@@ -38,6 +38,10 @@ class OffchainAPRHelper {
38
38
  this.initialized = null;
39
39
  this.chainTvls = {};
40
40
  this.tvlInitialized = null;
41
+ this.blacklistedProjects = new Set([
42
+ "extra-finance",
43
+ "beefy"
44
+ ]);
41
45
  this.offchain = offchain;
42
46
  }
43
47
  cleanCache() {
@@ -47,10 +51,11 @@ class OffchainAPRHelper {
47
51
  this.tvlInitialized = null;
48
52
  }
49
53
  // Blacklist certain projects which might report same pool as dex (aggregators, etc.)
54
+ // Reason we need this is that we want the DEX APR and not the APR of other projects
55
+ // using that same LP on their strategies, and sometimes pools_old from defillama
56
+ // shares lp address across different projects.
50
57
  isBlacklisted(project) {
51
- // Names from llama's response.project
52
- const blacklistedProjects = new Set(["extra-finance", "beefy"]);
53
- return blacklistedProjects.has(project);
58
+ return this.blacklistedProjects.has(project);
54
59
  }
55
60
  // Initializes all llama pools
56
61
  initializeYields() {
@@ -53,6 +53,7 @@ const coingecko_ids = {
53
53
  "0xa61beb4a3d02decb01039e378237032b351125b4": "eura",
54
54
  "0x7002458b1df59eccb57387bc79ffc7c29e22e6f7": "origin-protocol",
55
55
  "0xdbfefd2e8460a6ee4955a68582f85708baea60a3": "super-oeth",
56
+ "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf": "coinbase-wrapped-btc",
56
57
  // optimism
57
58
  "0x9560e827af36c94d2ac33a39bce1fe78631088db": "velodrome-finance",
58
59
  "0x4200000000000000000000000000000000000042": "optimism",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "1.2.72",
3
+ "version": "1.2.74",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",