impermax-sdk 1.2.147 → 1.2.149

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.
@@ -55,7 +55,8 @@ export declare enum Amms {
55
55
  nileStable = "nileStable",
56
56
  swapx = "swapx",
57
57
  blackhole = "blackhole",
58
- blackhole1 = "blackhole1"
58
+ blackhole1 = "blackhole1",
59
+ etherex = "etherex"
59
60
  }
60
61
  export declare const hrAmms: {
61
62
  uniswap: string;
@@ -114,6 +115,7 @@ export declare const hrAmms: {
114
115
  swapx: string;
115
116
  blackhole: string;
116
117
  blackhole1: string;
118
+ etherex: string;
117
119
  };
118
120
  export declare const AMM_FACTORY: AmmIndex;
119
121
  export declare function getAmmByFactory(network: Networks, address: Address): Amms | null;
@@ -60,6 +60,7 @@ var Amms;
60
60
  Amms["swapx"] = "swapx";
61
61
  Amms["blackhole"] = "blackhole";
62
62
  Amms["blackhole1"] = "blackhole1";
63
+ Amms["etherex"] = "etherex";
63
64
  })(Amms = exports.Amms || (exports.Amms = {}));
64
65
  exports.hrAmms = {
65
66
  [Amms.uniswap]: 'Uniswap',
@@ -117,7 +118,8 @@ exports.hrAmms = {
117
118
  [Amms.nileStable]: 'Nile Stable',
118
119
  [Amms.swapx]: 'SwapX',
119
120
  [Amms.blackhole]: 'Blackhole',
120
- [Amms.blackhole1]: 'Blackhole'
121
+ [Amms.blackhole1]: 'Blackhole',
122
+ [Amms.etherex]: 'Etherex'
121
123
  };
122
124
  exports.AMM_FACTORY = {
123
125
  [types_1.Networks.Ropsten]: {
@@ -221,6 +223,7 @@ exports.AMM_FACTORY = {
221
223
  [types_1.Networks.Linea]: {
222
224
  [Amms.nile]: '0xcbdf792456367a91708c0036e0678ecfb1f09654',
223
225
  [Amms.nileStable]: '0xb037874de77e7b4505261301d2f3ce2fb9036ca7',
226
+ [Amms.etherex]: '0xc0b920f6f1d6122b8187c031554dc8194f644592'
224
227
  }
225
228
  };
226
229
  function getAmmByFactory(network, address) {
@@ -395,7 +398,8 @@ exports.ADD_LIQUIDITY_URLS = {
395
398
  },
396
399
  [types_1.Networks.Linea]: {
397
400
  [Amms.nile]: 'https://www.nile.build/manage/v1/',
398
- [Amms.nileStable]: 'https://www.nile.build/manage/v1/'
401
+ [Amms.nileStable]: 'https://www.nile.build/manage/v1/',
402
+ [Amms.etherex]: 'https://www.etherex.finance/liquidity'
399
403
  },
400
404
  };
401
405
  exports.AMM_LP_FEE = {
@@ -494,6 +498,7 @@ exports.AMM_LP_FEE = {
494
498
  },
495
499
  [types_1.Networks.Linea]: {
496
500
  [Amms.nile]: 0,
497
- [Amms.nileStable]: 0
501
+ [Amms.nileStable]: 0,
502
+ [Amms.etherex]: 0
498
503
  },
499
504
  };
@@ -24,5 +24,5 @@ exports.IMX = {
24
24
  [types_1.Networks.Optimism]: '',
25
25
  [types_1.Networks.Real]: '',
26
26
  [types_1.Networks.Sonic]: '',
27
- [types_1.Networks.Linea]: '',
27
+ [types_1.Networks.Linea]: '0xcf0f95e34f25d1bb3d9cad3cbb2eb40dab7c3841',
28
28
  };
@@ -55,7 +55,8 @@ export declare enum Farms {
55
55
  equalizerStableV2 = "equalizerStableV2",
56
56
  velodrome = "velodrome",
57
57
  alien = "alien",
58
- velodromeStable = "velodromeStable"
58
+ velodromeStable = "velodromeStable",
59
+ etherex = "etherex"
59
60
  }
60
61
  export declare const hrFarms: {
61
62
  quickswapOld: string;
@@ -112,6 +113,7 @@ export declare const hrFarms: {
112
113
  velodrome: string;
113
114
  velodromeStable: string;
114
115
  alien: string;
116
+ etherex: string;
115
117
  };
116
118
  export type FarmIndex = {
117
119
  [key in Networks]: {
@@ -60,6 +60,7 @@ var Farms;
60
60
  Farms["velodrome"] = "velodrome";
61
61
  Farms["alien"] = "alien";
62
62
  Farms["velodromeStable"] = "velodromeStable";
63
+ Farms["etherex"] = "etherex";
63
64
  })(Farms = exports.Farms || (exports.Farms = {}));
64
65
  exports.hrFarms = {
65
66
  [Farms.quickswapOld]: 'QuickSwap',
@@ -116,6 +117,7 @@ exports.hrFarms = {
116
117
  [Farms.velodrome]: 'Velodrome',
117
118
  [Farms.velodromeStable]: 'Velodrome Stable',
118
119
  [Farms.alien]: 'AlienBase',
120
+ [Farms.etherex]: 'Etherex'
119
121
  };
120
122
  exports.STAKED_LP_FACTORY = {
121
123
  [types_1.Networks.Ropsten]: {},
@@ -214,6 +216,7 @@ exports.STAKED_LP_FACTORY = {
214
216
  },
215
217
  [types_1.Networks.Linea]: {
216
218
  [Farms.nileStable]: '0xB037874dE77E7b4505261301d2F3CE2fb9036cA7',
219
+ [Farms.etherex]: '0xc0b920f6f1d6122b8187c031554dc8194f644592'
217
220
  }
218
221
  };
219
222
  function getFarmByStakedLPFactory(network, address) {
@@ -186,6 +186,11 @@ class OffchainLendingPool {
186
186
  if (nileAPR > 0)
187
187
  return nileAPR;
188
188
  }
189
+ else if (this.offchain.network == types_1.Networks.Linea && selAmm == amms_1.Amms.etherex) {
190
+ const etherexAPR = await this.offchain.getAPRHelper().getEtherexAPR(uniswapV2Pair, this.offchain.network);
191
+ if (etherexAPR > 0)
192
+ return Number(etherexAPR);
193
+ }
189
194
  const [uniswapAPR, stakingAPR] = await Promise.all([this.getUniswapAPR(), this.getStakingAPR()]);
190
195
  return uniswapAPR + stakingAPR;
191
196
  }
@@ -23,6 +23,8 @@ export default class OffchainAPRHelper {
23
23
  private protocolTvlChart;
24
24
  private shadowAllPools;
25
25
  private shadowInitialized;
26
+ private etherexAllPools;
27
+ private etherexInitialized;
26
28
  private nileAllPools;
27
29
  private nileInitialized;
28
30
  private readonly blacklistedProjects;
@@ -33,6 +35,7 @@ export default class OffchainAPRHelper {
33
35
  private initializeYields;
34
36
  private initializeTvls;
35
37
  private initializePoolsBorrow;
38
+ private initializeEtherexPools;
36
39
  private initializeShadowPools;
37
40
  private initializeNilePools;
38
41
  private getLlamaYields;
@@ -40,9 +43,11 @@ export default class OffchainAPRHelper {
40
43
  private getChainsTotalSupplied;
41
44
  private getShadowPools;
42
45
  private getNilePools;
46
+ private getEtherexPools;
43
47
  getLlamaAPR(pool: Address, chain: Networks): Promise<number>;
44
48
  getShadowAPR(pool: Address, chain: Networks): Promise<number>;
45
49
  getNileAPR(pool: Address, chain: Networks): Promise<number>;
50
+ getEtherexAPR(pool: Address, chain: Networks): Promise<number>;
46
51
  getLlamaTvlAndBorrows(chain: Networks): Promise<{
47
52
  tvl: number;
48
53
  borrowed: number;
@@ -40,6 +40,8 @@ class OffchainAPRHelper {
40
40
  this.protocolTvlChart = [];
41
41
  this.shadowAllPools = {};
42
42
  this.shadowInitialized = null;
43
+ this.etherexAllPools = {};
44
+ this.etherexInitialized = null;
43
45
  this.nileAllPools = {};
44
46
  this.nileInitialized = null;
45
47
  this.blacklistedProjects = new Set([
@@ -139,6 +141,21 @@ class OffchainAPRHelper {
139
141
  this.chainsTotalSupplied = {};
140
142
  }
141
143
  }
144
+ async initializeEtherexPools() {
145
+ try {
146
+ const response = await fetch("https://etherex-api-production.up.railway.app/mixed-pairs").then((i) => i.json());
147
+ this.etherexAllPools = response.pairs.reduce((acc, pool) => {
148
+ acc[pool.id.toLowerCase()] = {
149
+ lpApr: pool.lpApr
150
+ };
151
+ return acc;
152
+ }, {});
153
+ }
154
+ catch (err) {
155
+ console.warn("Etherex API down?");
156
+ this.etherexAllPools = {};
157
+ }
158
+ }
142
159
  async initializeShadowPools() {
143
160
  try {
144
161
  const response = await fetch("https://api.shadow.so/mixed-pairs").then((i) => i.json());
@@ -205,6 +222,12 @@ class OffchainAPRHelper {
205
222
  await this.nileInitialized;
206
223
  return this.nileAllPools;
207
224
  }
225
+ async getEtherexPools() {
226
+ if (!this.etherexInitialized)
227
+ this.etherexInitialized = this.initializeEtherexPools();
228
+ await this.etherexInitialized;
229
+ return this.etherexAllPools;
230
+ }
208
231
  // ---------------- Getters ---------------- //
209
232
  async getLlamaAPR(pool, chain) {
210
233
  // Get or initialize the pools
@@ -244,6 +267,20 @@ class OffchainAPRHelper {
244
267
  const apy = nilePools[pool.toLowerCase()]?.lpApr;
245
268
  return apy || 0;
246
269
  }
270
+ // Shadow APRs for Shadow on Sonic chain only
271
+ async getEtherexAPR(pool, chain) {
272
+ if (chain !== types_1.Networks.Linea)
273
+ return 0;
274
+ // Get or initialize the Shadow pools
275
+ const etherexPools = await this.getEtherexPools();
276
+ // `initializeShadowPools` keys by pool address
277
+ // Convert to decimals to match `getUniswapAPR` and `getStakingAPR`
278
+ console.log(etherexPools[pool.toLowerCase()]);
279
+ console.log(etherexPools);
280
+ const apy = etherexPools[pool.toLowerCase()]?.lpApr / 100;
281
+ console.log("APY: ", apy);
282
+ return apy || 0;
283
+ }
247
284
  async getLlamaTvlAndBorrows(chain) {
248
285
  // Get or initialize the tvl for all chains
249
286
  const [llamaTvls, totalSuppliedYields] = await Promise.all([
@@ -96,7 +96,13 @@ const dexscreener_ids = {
96
96
  // ID on avalanche
97
97
  "0x34a528da3b2ea5c6ad1796eba756445d1299a577": "avalanche",
98
98
  // Anon on avalanche
99
- "0x79bbf4508b1391af3a0f4b30bb5fc4aa9ab0e07c": "avalanche"
99
+ "0x79bbf4508b1391af3a0f4b30bb5fc4aa9ab0e07c": "avalanche",
100
+ // REX on Linea
101
+ "0xefd81eec32b9a8222d1842ec3d99c7532c31e348": "linea",
102
+ // Ibex on Lnea
103
+ '0xcf0f95e34f25d1bb3d9cad3cbb2eb40dab7c3841': "linea",
104
+ // frxusd on linea
105
+ "0xc7346783f5e645aa998b106ef9e7f499528673d8": "linea"
100
106
  };
101
107
  const fantom_ids = {
102
108
  // uponly on ftm
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "1.2.147",
3
+ "version": "1.2.149",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",