impermax-sdk 2.1.498 → 2.1.500

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.
@@ -54,7 +54,8 @@ export declare enum Amms {
54
54
  velodromeStable = "velodromeStable",
55
55
  blackhole = "blackhole",
56
56
  blackhole1 = "blackhole1",
57
- aeroCL = "aeroCL"
57
+ aeroCL = "aeroCL",
58
+ etherex = "etherex"
58
59
  }
59
60
  export declare const hrAmms: {
60
61
  uniswap: string;
@@ -112,6 +113,7 @@ export declare const hrAmms: {
112
113
  blackhole: string;
113
114
  blackhole1: string;
114
115
  aeroCL: string;
116
+ etherex: string;
115
117
  };
116
118
  export declare const AMM_FACTORY: AmmIndex;
117
119
  export declare function getAmmByFactory(network: Networks, address: Address): Amms | null;
@@ -59,6 +59,7 @@ var Amms;
59
59
  Amms["blackhole"] = "blackhole";
60
60
  Amms["blackhole1"] = "blackhole1";
61
61
  Amms["aeroCL"] = "aeroCL";
62
+ Amms["etherex"] = "etherex";
62
63
  })(Amms = exports.Amms || (exports.Amms = {}));
63
64
  exports.hrAmms = {
64
65
  [Amms.uniswap]: 'UniswapV2',
@@ -115,7 +116,8 @@ exports.hrAmms = {
115
116
  [Amms.velodromeStable]: 'Velodrome Stable',
116
117
  [Amms.blackhole]: 'Blackhole',
117
118
  [Amms.blackhole1]: 'Blackhole',
118
- [Amms.aeroCL]: 'Aero Slipstream'
119
+ [Amms.aeroCL]: 'Aero Slipstream',
120
+ [Amms.etherex]: 'Etherex'
119
121
  };
120
122
  exports.AMM_FACTORY = {
121
123
  [types_1.Networks.Ropsten]: {
@@ -219,6 +221,7 @@ exports.AMM_FACTORY = {
219
221
  [types_1.Networks.Linea]: {
220
222
  [Amms.nile]: '0xcbdf792456367a91708c0036e0678ecfb1f09654',
221
223
  [Amms.nileStable]: '0xb037874de77e7b4505261301d2f3ce2fb9036ca7',
224
+ [Amms.etherex]: '0xc0b920f6f1d6122b8187c031554dc8194f644592'
222
225
  },
223
226
  [types_1.Networks.Unichain]: {
224
227
  [Amms.uniswapv3]: '0x1f98400000000000000000000000000000000003'
@@ -392,7 +395,8 @@ exports.ADD_LIQUIDITY_URLS = {
392
395
  },
393
396
  [types_1.Networks.Linea]: {
394
397
  [Amms.nile]: 'https://www.nile.build/manage/v1/',
395
- [Amms.nileStable]: 'https://www.nile.build/manage/v1/'
398
+ [Amms.nileStable]: 'https://www.nile.build/manage/v1/',
399
+ [Amms.etherex]: 'https://www.etherex.finance/liquidity'
396
400
  },
397
401
  [types_1.Networks.Unichain]: {},
398
402
  };
@@ -489,7 +493,8 @@ exports.AMM_LP_FEE = {
489
493
  },
490
494
  [types_1.Networks.Linea]: {
491
495
  [Amms.nile]: 0,
492
- [Amms.nileStable]: 0
496
+ [Amms.nileStable]: 0,
497
+ [Amms.etherex]: 0
493
498
  },
494
499
  [types_1.Networks.Unichain]: {},
495
500
  };
@@ -52,7 +52,8 @@ export declare enum Farms {
52
52
  alien = "alien",
53
53
  nileStable = "nileStable",
54
54
  equalizerStable = "equalizerStable",
55
- velodromeStable = "velodromeStable"
55
+ velodromeStable = "velodromeStable",
56
+ etherex = "etherex"
56
57
  }
57
58
  export declare const hrFarms: {
58
59
  quickswapOld: string;
@@ -105,6 +106,7 @@ export declare const hrFarms: {
105
106
  nileStable: string;
106
107
  equalizerStable: string;
107
108
  velodromeStable: string;
109
+ etherex: string;
108
110
  };
109
111
  export type FarmIndex = {
110
112
  [key in Networks]: {
@@ -57,6 +57,7 @@ var Farms;
57
57
  Farms["nileStable"] = "nileStable";
58
58
  Farms["equalizerStable"] = "equalizerStable";
59
59
  Farms["velodromeStable"] = "velodromeStable";
60
+ Farms["etherex"] = "etherex";
60
61
  })(Farms = exports.Farms || (exports.Farms = {}));
61
62
  exports.hrFarms = {
62
63
  [Farms.quickswapOld]: 'QuickSwap',
@@ -108,7 +109,8 @@ exports.hrFarms = {
108
109
  [Farms.alien]: 'AlienBase',
109
110
  [Farms.nileStable]: 'Nile Stable',
110
111
  [Farms.equalizerStable]: 'Equalizer Stable',
111
- [Farms.velodromeStable]: 'Velodrome Stable'
112
+ [Farms.velodromeStable]: 'Velodrome Stable',
113
+ [Farms.etherex]: 'Etherex'
112
114
  };
113
115
  exports.STAKED_LP_FACTORY = {
114
116
  [types_1.Networks.Ropsten]: {},
@@ -205,6 +207,7 @@ exports.STAKED_LP_FACTORY = {
205
207
  },
206
208
  [types_1.Networks.Linea]: {
207
209
  [Farms.nileStable]: '0xB037874dE77E7b4505261301d2F3CE2fb9036cA7',
210
+ [Farms.etherex]: '0xc0b920f6f1d6122b8187c031554dc8194f644592'
208
211
  },
209
212
  [types_1.Networks.Unichain]: {}
210
213
  };
@@ -266,7 +266,11 @@ exports.WHITELISTED_PAIRS = {
266
266
  "0x6F988b0810C9F26e653982f0c55872ffe618801C",
267
267
  "0xFa8268Ab238c3FFAD3f96693088d569b70eF9300",
268
268
  "0x05EFe1133d9ca372017647e0e71174517C663683",
269
- "0xf45e449fAC0E910F2736FF45eF8ff9ff4b6112Ac", // usdc/nil
269
+ "0xf45e449fAC0E910F2736FF45eF8ff9ff4b6112Ac",
270
+ "0x5d62c23961D8ad01B5B4B446477DED4C57863ed3",
271
+ "0xD0c167809c3E6466BBf7cB3DdD8A253927937a82",
272
+ "0x37aa7c58e56d1e60006f1fd2e699059e2661e229",
273
+ "0x5468ff957772276c6d0a06dc7ce083b273d3577a" // elite/frxusd
270
274
  ],
271
275
  [types_1.Factory.SOL_STABLE]: [
272
276
  // nile stable
@@ -50,7 +50,9 @@ class OffchainAccountNftlpAeroCL extends offchainAccountNftlpGenericCL_1.default
50
50
  }
51
51
  async getTotalRewardEarned(tokenId) {
52
52
  const storedTotalRewardEarned = await this.getStoredTotalRewardEarned(tokenId);
53
- const newlyEarnedReward = await this.getNewlyEarnedReward(tokenId);
53
+ // NOTE: Temporary fix
54
+ //const newlyEarnedReward = await this.getNewlyEarnedReward(tokenId);
55
+ const newlyEarnedReward = await this.getUnclaimedReward(tokenId);
54
56
  return storedTotalRewardEarned + newlyEarnedReward;
55
57
  }
56
58
  }
@@ -53,7 +53,9 @@ class OffchainAccountNftlpUniswapV3 extends offchainAccountNftlpGenericCL_1.defa
53
53
  }
54
54
  async getTotalFeesEarned(tokenId) {
55
55
  const storedTotalFeesEarned = await this.getStoredTotalFeesEarned(tokenId);
56
- const newlyEarnedFees = await this.getNewlyEarnedFees(tokenId);
56
+ // NOTE: Temporary fix
57
+ //const newlyEarnedFees = await this.getNewlyEarnedFees(tokenId);
58
+ const newlyEarnedFees = await this.getUnclaimedFees(tokenId);
57
59
  return {
58
60
  amountX: storedTotalFeesEarned.amountX + newlyEarnedFees.amountX,
59
61
  amountY: storedTotalFeesEarned.amountY + newlyEarnedFees.amountY,
@@ -104,23 +104,22 @@ class OffchainLendingPoolV2 extends offchainLendingPool_1.default {
104
104
  async getTotalAPR() {
105
105
  const uniswapV2Pair = await this.getUniswapV2PairAddress();
106
106
  // If llama fails/apr is 0 we get the uniswapAPR and stakingAPR through subgraph
107
- const apr = await this.offchain
108
- .getAPRHelper()
109
- .getLlamaAPR(uniswapV2Pair, this.offchain.network);
107
+ const apr = await this.offchain.getAPRHelper().getLlamaAPR(uniswapV2Pair, this.offchain.network);
110
108
  if (apr > 0)
111
109
  return apr;
112
110
  // Try shadow on Sonic network
113
111
  if (this.offchain.network === types_1.Networks.Sonic) {
114
- const shadowAPR = await this.offchain
115
- .getAPRHelper()
116
- .getShadowAPR(uniswapV2Pair, this.offchain.network);
112
+ const shadowAPR = await this.offchain.getAPRHelper().getShadowAPR(uniswapV2Pair, this.offchain.network);
117
113
  if (shadowAPR > 0)
118
114
  return shadowAPR;
119
115
  }
120
- const [uniswapAPR, stakingAPR] = await Promise.all([
121
- this.getUniswapAPR(),
122
- this.getStakingAPR(),
123
- ]);
116
+ // Try Etherex on Linea
117
+ if (this.offchain.network == types_1.Networks.Linea) {
118
+ const etherexAPR = await this.offchain.getAPRHelper().getEtherexAPR(uniswapV2Pair, this.offchain.network);
119
+ if (etherexAPR > 0)
120
+ return Number(etherexAPR);
121
+ }
122
+ const [uniswapAPR, stakingAPR] = await Promise.all([this.getUniswapAPR(), this.getStakingAPR()]);
124
123
  return uniswapAPR + stakingAPR;
125
124
  }
126
125
  async getAmm() {
@@ -25,6 +25,8 @@ export default class OffchainAPRHelper {
25
25
  private totalSuppliedInitialized;
26
26
  private stablecoins;
27
27
  private stablecoinsInitialized;
28
+ private etherexAllPools;
29
+ private etherexInitialized;
28
30
  private readonly blacklistedProjects;
29
31
  offchainMultichain: OffchainMultichain;
30
32
  constructor(offchainMultichain: OffchainMultichain);
@@ -32,10 +34,12 @@ export default class OffchainAPRHelper {
32
34
  private isBlacklisted;
33
35
  private initializeYields;
34
36
  private initializeShadowPools;
37
+ private initializeEtherexPools;
35
38
  private initializeTvls;
36
39
  private initializePoolsBorrow;
37
40
  private getLlamaYields;
38
41
  private getShadowPools;
42
+ private getEtherexPools;
39
43
  private getLlamaTvls;
40
44
  private getChainsTotalSupplied;
41
45
  getLlamaYieldsParams(pool: Address, chain: Networks, params: string[]): Promise<number[]>;
@@ -48,6 +52,7 @@ export default class OffchainAPRHelper {
48
52
  tvlUsd: number;
49
53
  }>;
50
54
  getShadowAPR(pool: Address, chain: Networks): Promise<number>;
55
+ getEtherexAPR(pool: Address, chain: Networks): Promise<number>;
51
56
  getTvlData(networks?: Networks[]): Promise<{
52
57
  totalSuppliedUSD: number;
53
58
  totalBorrowedUSD: number;
@@ -47,6 +47,8 @@ class OffchainAPRHelper {
47
47
  // Misc.
48
48
  this.stablecoins = [];
49
49
  this.stablecoinsInitialized = null;
50
+ this.etherexAllPools = {};
51
+ this.etherexInitialized = null;
50
52
  this.blacklistedProjects = new Set([
51
53
  "extra-finance",
52
54
  "beefy",
@@ -57,6 +59,7 @@ class OffchainAPRHelper {
57
59
  this.offchainMultichain = offchainMultichain;
58
60
  this.getLlamaYields();
59
61
  this.getShadowPools();
62
+ this.getEtherexPools();
60
63
  }
61
64
  cleanCache() {
62
65
  this.llamaAllPools = {};
@@ -112,6 +115,21 @@ class OffchainAPRHelper {
112
115
  this.shadowAllPools = {};
113
116
  }
114
117
  }
118
+ async initializeEtherexPools() {
119
+ try {
120
+ const response = await fetch("https://etherex-api-production.up.railway.app/mixed-pairs").then((i) => i.json());
121
+ this.etherexAllPools = response.pairs.reduce((acc, pool) => {
122
+ acc[pool.id.toLowerCase()] = {
123
+ lpApr: pool.lpApr
124
+ };
125
+ return acc;
126
+ }, {});
127
+ }
128
+ catch (err) {
129
+ console.warn("Etherex API down?");
130
+ this.etherexAllPools = {};
131
+ }
132
+ }
115
133
  // Initializes all our chain tvl and borrows from llama
116
134
  async initializeTvls() {
117
135
  try {
@@ -180,6 +198,12 @@ class OffchainAPRHelper {
180
198
  await this.shadowInitialized;
181
199
  return this.shadowAllPools;
182
200
  }
201
+ async getEtherexPools() {
202
+ if (!this.etherexInitialized)
203
+ this.etherexInitialized = this.initializeEtherexPools();
204
+ await this.etherexInitialized;
205
+ return this.etherexAllPools;
206
+ }
183
207
  async getLlamaTvls() {
184
208
  // First call initializes
185
209
  if (!this.tvlInitialized)
@@ -242,6 +266,16 @@ class OffchainAPRHelper {
242
266
  const apy = shadowPools[pool.toLowerCase()]?.lpApr / 100;
243
267
  return apy || 0;
244
268
  }
269
+ async getEtherexAPR(pool, chain) {
270
+ if (chain !== types_1.Networks.Linea)
271
+ return 0;
272
+ // Get or initialize the Shadow pools
273
+ const etherexPools = await this.getEtherexPools();
274
+ // `initializeShadowPools` keys by pool address
275
+ // Convert to decimals to match `getUniswapAPR` and `getStakingAPR`
276
+ const apy = etherexPools[pool.toLowerCase()]?.lpApr / 100;
277
+ return apy || 0;
278
+ }
245
279
  /*--------------------------------------------------------*
246
280
  * Protocol Stats
247
281
  *--------------------------------------------------------*/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.498",
3
+ "version": "2.1.500",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",