impermax-sdk 1.2.152 → 1.2.153
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.
- package/lib/config/amms.js +5 -1
- package/lib/config/contracts/claim-aggregators.js +1 -0
- package/lib/config/contracts/impermax-chef.js +1 -0
- package/lib/config/contracts/impermax-config-manager.js +1 -0
- package/lib/config/contracts/impermax-factories.js +3 -0
- package/lib/config/contracts/imxes.js +1 -0
- package/lib/config/contracts/lending-vault-watcher.js +1 -0
- package/lib/config/contracts/merkle-distributors.js +3 -0
- package/lib/config/contracts/routers.js +4 -0
- package/lib/config/contracts/simple-uniswap-oracles.js +1 -0
- package/lib/config/contracts/weths.js +2 -1
- package/lib/config/debank-ids.js +1 -0
- package/lib/config/endpoints/merkle-distributors.js +3 -0
- package/lib/config/eth.js +2 -0
- package/lib/config/farms.js +2 -1
- package/lib/config/subgraphs.d.ts +1 -0
- package/lib/config/subgraphs.js +6 -2
- package/lib/config/types.d.ts +2 -1
- package/lib/config/types.js +1 -0
- package/lib/offchain/offchain.d.ts +10 -0
- package/lib/offchain/offchain.js +53 -0
- package/lib/offchain/offchainAPRHelper.js +1 -0
- package/package.json +1 -1
package/lib/config/amms.js
CHANGED
|
@@ -224,7 +224,8 @@ exports.AMM_FACTORY = {
|
|
|
224
224
|
[Amms.nile]: '0xcbdf792456367a91708c0036e0678ecfb1f09654',
|
|
225
225
|
[Amms.nileStable]: '0xb037874de77e7b4505261301d2f3ce2fb9036ca7',
|
|
226
226
|
[Amms.etherex]: '0xc0b920f6f1d6122b8187c031554dc8194f644592'
|
|
227
|
-
}
|
|
227
|
+
},
|
|
228
|
+
[types_1.Networks.HyperEVM]: {}
|
|
228
229
|
};
|
|
229
230
|
function getAmmByFactory(network, address) {
|
|
230
231
|
if (!address)
|
|
@@ -300,6 +301,7 @@ exports.AMM_SUBGRAPH_URLS = {
|
|
|
300
301
|
[types_1.Networks.Optimism]: {},
|
|
301
302
|
[types_1.Networks.Sonic]: {},
|
|
302
303
|
[types_1.Networks.Linea]: {},
|
|
304
|
+
[types_1.Networks.HyperEVM]: {}
|
|
303
305
|
};
|
|
304
306
|
exports.ADD_LIQUIDITY_URLS = {
|
|
305
307
|
[types_1.Networks.Ropsten]: {
|
|
@@ -401,6 +403,7 @@ exports.ADD_LIQUIDITY_URLS = {
|
|
|
401
403
|
[Amms.nileStable]: 'https://www.nile.build/manage/v1/',
|
|
402
404
|
[Amms.etherex]: 'https://www.etherex.finance/liquidity'
|
|
403
405
|
},
|
|
406
|
+
[types_1.Networks.HyperEVM]: {}
|
|
404
407
|
};
|
|
405
408
|
exports.AMM_LP_FEE = {
|
|
406
409
|
[types_1.Networks.Ropsten]: {
|
|
@@ -501,4 +504,5 @@ exports.AMM_LP_FEE = {
|
|
|
501
504
|
[Amms.nileStable]: 0,
|
|
502
505
|
[Amms.etherex]: 0
|
|
503
506
|
},
|
|
507
|
+
[types_1.Networks.HyperEVM]: {}
|
|
504
508
|
};
|
|
@@ -25,4 +25,5 @@ exports.IMPERMAX_CONFIG_MANAGER = {
|
|
|
25
25
|
[types_1.Networks.Real]: '0x274C36c461C02B39a110A0801EbB218eC076B79B',
|
|
26
26
|
[types_1.Networks.Sonic]: '0x1A3e33E38D2e70D43f65772f63c5B3f52073b37E',
|
|
27
27
|
[types_1.Networks.Linea]: '0x3A65E736b534B3A3703Eb081b93118852Bf1796a',
|
|
28
|
+
[types_1.Networks.HyperEVM]: '0x0c84eaf5203b0699fc950733336b6379f1429418'
|
|
28
29
|
};
|
|
@@ -75,6 +75,9 @@ exports.IMPERMAX_FACTORY = {
|
|
|
75
75
|
[types_1.Factory.SOLV2]: '0x7A9212D34DD283e952f8f15f084832e9b48ee746',
|
|
76
76
|
[types_1.Factory.SOL_STABLE]: '0x0D5433FEe91fb2DB9dd6A74267Dd900EC2130675'
|
|
77
77
|
},
|
|
78
|
+
[types_1.Networks.HyperEVM]: {
|
|
79
|
+
[types_1.Factory.SOLV2]: '0xdc2037d10f3a10f02b8cf8d3e373c0924b300f7d'
|
|
80
|
+
}
|
|
78
81
|
};
|
|
79
82
|
function getFactoryByAddress(network, address) {
|
|
80
83
|
if (!address)
|
|
@@ -25,6 +25,7 @@ exports.MERKLE_DISTRIBUTOR_IBEX = {
|
|
|
25
25
|
[types_1.Networks.Real]: '',
|
|
26
26
|
[types_1.Networks.Sonic]: '',
|
|
27
27
|
[types_1.Networks.Linea]: '',
|
|
28
|
+
[types_1.Networks.HyperEVM]: ''
|
|
28
29
|
};
|
|
29
30
|
exports.MERKLE_DISTRIBUTOR_IBEX_2 = {
|
|
30
31
|
[types_1.Networks.Polygon]: '0x1c813cDd6dAecE2CB83C52F0798504e42816E9C5',
|
|
@@ -49,6 +50,7 @@ exports.MERKLE_DISTRIBUTOR_IBEX_2 = {
|
|
|
49
50
|
[types_1.Networks.Real]: '',
|
|
50
51
|
[types_1.Networks.Sonic]: '',
|
|
51
52
|
[types_1.Networks.Linea]: '',
|
|
53
|
+
[types_1.Networks.HyperEVM]: '',
|
|
52
54
|
};
|
|
53
55
|
exports.MERKLE_DISTRIBUTOR_ETH = {
|
|
54
56
|
[types_1.Networks.Polygon]: '0x7ce2f634f0698ecdca051ef1dc4be96ef3d05a62',
|
|
@@ -73,4 +75,5 @@ exports.MERKLE_DISTRIBUTOR_ETH = {
|
|
|
73
75
|
[types_1.Networks.Real]: '',
|
|
74
76
|
[types_1.Networks.Sonic]: '',
|
|
75
77
|
[types_1.Networks.Linea]: '',
|
|
78
|
+
[types_1.Networks.HyperEVM]: '',
|
|
76
79
|
};
|
|
@@ -79,6 +79,9 @@ exports.ROUTER = {
|
|
|
79
79
|
[types_1.Factory.SOLV2]: '0xEB81da0cAC9D3efc4bf3270080936C6a5758926f',
|
|
80
80
|
[types_1.Factory.SOL_STABLE]: '0xC8BBC42B546d25c411b9BD42cDDDa12c00B468bc',
|
|
81
81
|
},
|
|
82
|
+
[types_1.Networks.HyperEVM]: {
|
|
83
|
+
[types_1.Factory.SOLV2]: '0xfe1cbfa345de7a08cf5c7aa8b2781756f1c5b496'
|
|
84
|
+
}
|
|
82
85
|
};
|
|
83
86
|
exports.DEFAULT_ROUTER = {
|
|
84
87
|
[types_1.Networks.Ropsten]: '0xbFf4acF789297A8507Eb7493AE18EB2C3A3A9632',
|
|
@@ -103,4 +106,5 @@ exports.DEFAULT_ROUTER = {
|
|
|
103
106
|
[types_1.Networks.Optimism]: '0xb5657FA5ba87CaD11b9150c319069625d423aaD4',
|
|
104
107
|
[types_1.Networks.Sonic]: '0xcBdf792456367a91708C0036E0678eCFB1f09654',
|
|
105
108
|
[types_1.Networks.Linea]: '0xEB81da0cAC9D3efc4bf3270080936C6a5758926f',
|
|
109
|
+
[types_1.Networks.HyperEVM]: '0xfe1cbfa345de7a08cf5c7aa8b2781756f1c5b496'
|
|
106
110
|
};
|
|
@@ -25,5 +25,6 @@ exports.WETH = {
|
|
|
25
25
|
[types_1.Networks.Optimism]: '0x4200000000000000000000000000000000000006',
|
|
26
26
|
[types_1.Networks.Real]: '0x90c6E93849E06EC7478ba24522329d14A5954Df4',
|
|
27
27
|
[types_1.Networks.Sonic]: '0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38',
|
|
28
|
-
[types_1.Networks.Linea]: '0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f',
|
|
28
|
+
[types_1.Networks.Linea]: '0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f',
|
|
29
|
+
[types_1.Networks.HyperEVM]: '0x5555555555555555555555555555555555555555' // whype
|
|
29
30
|
};
|
package/lib/config/debank-ids.js
CHANGED
|
@@ -25,6 +25,7 @@ exports.MERKLE_URL_IBEX = {
|
|
|
25
25
|
[types_1.Networks.Real]: '',
|
|
26
26
|
[types_1.Networks.Sonic]: '',
|
|
27
27
|
[types_1.Networks.Linea]: '',
|
|
28
|
+
[types_1.Networks.HyperEVM]: ''
|
|
28
29
|
};
|
|
29
30
|
exports.MERKLE_URL_IBEX_2 = {
|
|
30
31
|
[types_1.Networks.Polygon]: 'https://misty-rice-9880.impermax.workers.dev',
|
|
@@ -49,6 +50,7 @@ exports.MERKLE_URL_IBEX_2 = {
|
|
|
49
50
|
[types_1.Networks.Real]: '',
|
|
50
51
|
[types_1.Networks.Sonic]: '',
|
|
51
52
|
[types_1.Networks.Linea]: '',
|
|
53
|
+
[types_1.Networks.HyperEVM]: ''
|
|
52
54
|
};
|
|
53
55
|
exports.MERKLE_URL_ETH = {
|
|
54
56
|
[types_1.Networks.Polygon]: 'https://damp-hill-13d0.impermax.workers.dev',
|
|
@@ -73,4 +75,5 @@ exports.MERKLE_URL_ETH = {
|
|
|
73
75
|
[types_1.Networks.Real]: '',
|
|
74
76
|
[types_1.Networks.Sonic]: '',
|
|
75
77
|
[types_1.Networks.Linea]: '',
|
|
78
|
+
[types_1.Networks.HyperEVM]: ''
|
|
76
79
|
};
|
package/lib/config/eth.js
CHANGED
|
@@ -25,6 +25,7 @@ exports.ETH_NAME = {
|
|
|
25
25
|
[types_1.Networks.Real]: 'Ethereum',
|
|
26
26
|
[types_1.Networks.Sonic]: 'S',
|
|
27
27
|
[types_1.Networks.Linea]: 'Ethereum',
|
|
28
|
+
[types_1.Networks.HyperEVM]: 'Hyperliquid',
|
|
28
29
|
};
|
|
29
30
|
exports.ETH_SYMBOL = {
|
|
30
31
|
[types_1.Networks.Ropsten]: 'ETH',
|
|
@@ -49,4 +50,5 @@ exports.ETH_SYMBOL = {
|
|
|
49
50
|
[types_1.Networks.Real]: 'reETH',
|
|
50
51
|
[types_1.Networks.Sonic]: 'S',
|
|
51
52
|
[types_1.Networks.Linea]: 'ETH',
|
|
53
|
+
[types_1.Networks.HyperEVM]: 'HYPE',
|
|
52
54
|
};
|
package/lib/config/farms.js
CHANGED
|
@@ -217,7 +217,8 @@ exports.STAKED_LP_FACTORY = {
|
|
|
217
217
|
[types_1.Networks.Linea]: {
|
|
218
218
|
[Farms.nileStable]: '0xB037874dE77E7b4505261301d2F3CE2fb9036cA7',
|
|
219
219
|
[Farms.etherex]: '0xc0b920f6f1d6122b8187c031554dc8194f644592'
|
|
220
|
-
}
|
|
220
|
+
},
|
|
221
|
+
[types_1.Networks.HyperEVM]: {}
|
|
221
222
|
};
|
|
222
223
|
function getFarmByStakedLPFactory(network, address) {
|
|
223
224
|
if (!address)
|
package/lib/config/subgraphs.js
CHANGED
|
@@ -6,7 +6,6 @@ const types_1 = require("./types");
|
|
|
6
6
|
// - FactoryV2: Sonic/Base/Optimism
|
|
7
7
|
// - FactoryV3: Arbitrum/Base
|
|
8
8
|
// - LendingVaults: Polygon/Arbitrum/Blast/Sonic/Base/Scroll
|
|
9
|
-
// @ts-ignore
|
|
10
9
|
exports.IMPERMAX_SUBGRAPH_URL = {
|
|
11
10
|
[types_1.Networks.Ropsten]: {},
|
|
12
11
|
[types_1.Networks.Mainnet]: {
|
|
@@ -152,7 +151,8 @@ exports.IMPERMAX_SUBGRAPH_URL = {
|
|
|
152
151
|
[types_1.Factory.SOL_STABLE]: [
|
|
153
152
|
'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/Ah5k6hzS9YicNHWuA4Uts9MQQQGbPLDtwD8tYjKaX8Ls',
|
|
154
153
|
]
|
|
155
|
-
}
|
|
154
|
+
},
|
|
155
|
+
[types_1.Networks.HyperEVM]: {}
|
|
156
156
|
};
|
|
157
157
|
exports.IMPERMAX_CHEF_SUBGRAPH_URL = {
|
|
158
158
|
[types_1.Networks.Ropsten]: '',
|
|
@@ -178,6 +178,7 @@ exports.IMPERMAX_CHEF_SUBGRAPH_URL = {
|
|
|
178
178
|
[types_1.Networks.Real]: '',
|
|
179
179
|
[types_1.Networks.Sonic]: '',
|
|
180
180
|
[types_1.Networks.Linea]: '',
|
|
181
|
+
[types_1.Networks.HyperEVM]: ''
|
|
181
182
|
};
|
|
182
183
|
exports.LENDING_VAULT_SUBGRAPH_URL = {
|
|
183
184
|
[types_1.Networks.Ropsten]: '',
|
|
@@ -202,6 +203,7 @@ exports.LENDING_VAULT_SUBGRAPH_URL = {
|
|
|
202
203
|
[types_1.Networks.Scroll]: 'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/BaPMX2ubiRZ4ujqTFmWyrk72fPo6yFLQ7A5Z4BLXCTFU',
|
|
203
204
|
[types_1.Networks.Sonic]: 'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/AHj91C4xwYSfyHAnZiMa1pC4ZwRtzqG3QGVyJchEsJAC',
|
|
204
205
|
[types_1.Networks.Linea]: '',
|
|
206
|
+
[types_1.Networks.HyperEVM]: ''
|
|
205
207
|
};
|
|
206
208
|
exports.BLOCKS_SUBGRAPH_URL = {
|
|
207
209
|
[types_1.Networks.Ropsten]: '',
|
|
@@ -226,6 +228,7 @@ exports.BLOCKS_SUBGRAPH_URL = {
|
|
|
226
228
|
[types_1.Networks.Optimism]: '',
|
|
227
229
|
[types_1.Networks.Sonic]: '',
|
|
228
230
|
[types_1.Networks.Linea]: '',
|
|
231
|
+
[types_1.Networks.HyperEVM]: ''
|
|
229
232
|
};
|
|
230
233
|
exports.XIMX_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/impermax-finance/imx-staking";
|
|
231
234
|
exports.CONFIG_MANAGER_SUBGRAPH_URL = {
|
|
@@ -250,6 +253,7 @@ exports.CONFIG_MANAGER_SUBGRAPH_URL = {
|
|
|
250
253
|
[types_1.Networks.Real]: 'https://api.goldsky.com/api/public/project_cm2d5q4l4w31601vz4swb3vmi/subgraphs/impermax-config-manager-real/1.0/gn',
|
|
251
254
|
[types_1.Networks.Sonic]: 'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/DqzQAecRNGsoRgwVre16Fha9XTPFf9QBo8iZxubysy2x',
|
|
252
255
|
[types_1.Networks.Linea]: 'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/CKu5kt4M1p2ELhn7cef9ZjE9igMH2icv3mzBepEdNPRz',
|
|
256
|
+
[types_1.Networks.HyperEVM]: ''
|
|
253
257
|
};
|
|
254
258
|
exports.WHITELIST_SUBGRAPH_URL = {
|
|
255
259
|
[types_1.Networks.Ropsten]: '',
|
package/lib/config/types.d.ts
CHANGED
package/lib/config/types.js
CHANGED
|
@@ -15,6 +15,14 @@ export interface OffchainCfg {
|
|
|
15
15
|
chainId: number;
|
|
16
16
|
whitelistedPairs?: FactoryIndex<Address[]>;
|
|
17
17
|
}
|
|
18
|
+
type TokenData = {
|
|
19
|
+
token: `${Networks}:${Address}`;
|
|
20
|
+
id: Address;
|
|
21
|
+
symbol: string;
|
|
22
|
+
name: string;
|
|
23
|
+
decimals: number;
|
|
24
|
+
chainId: number;
|
|
25
|
+
};
|
|
18
26
|
export default class Offchain {
|
|
19
27
|
readonly network: Networks;
|
|
20
28
|
readonly chainId: number;
|
|
@@ -110,4 +118,6 @@ export default class Offchain {
|
|
|
110
118
|
getXIMXAPY(): Promise<number>;
|
|
111
119
|
getProtocolChart(): Promise<LlamaTvlChart>;
|
|
112
120
|
getProtocolChainChart(chain: Networks): Promise<LlamaTvlChart>;
|
|
121
|
+
getNetworkTokens(): Promise<TokenData[]>;
|
|
113
122
|
}
|
|
123
|
+
export {};
|
package/lib/offchain/offchain.js
CHANGED
|
@@ -210,5 +210,58 @@ class Offchain {
|
|
|
210
210
|
const chainTvlCharts = await this.getAPRHelper().getChainTvlChart(chain);
|
|
211
211
|
return chainTvlCharts;
|
|
212
212
|
}
|
|
213
|
+
async getNetworkTokens() {
|
|
214
|
+
const tokenMap = new Map();
|
|
215
|
+
const lendingPoolsData = await this.getLendingPoolsData();
|
|
216
|
+
const chainId = this.chainId;
|
|
217
|
+
// Go through each factory
|
|
218
|
+
const factoryPromises = Object.entries(lendingPoolsData).map(async ([factory, pools]) => {
|
|
219
|
+
// Go through each pool in the factory
|
|
220
|
+
const poolPromises = Object.keys(pools).map(async (poolId) => {
|
|
221
|
+
try {
|
|
222
|
+
const lendingPool = await this.getLendingPool(factory, poolId);
|
|
223
|
+
if (!lendingPool)
|
|
224
|
+
return [];
|
|
225
|
+
// Get underlyings
|
|
226
|
+
const tokenPromises = [lendingPool.getBorrowableA(), lendingPool.getBorrowableB()].map(async (borrowable) => {
|
|
227
|
+
try {
|
|
228
|
+
const [address, symbol, name, decimals] = await Promise.all([
|
|
229
|
+
borrowable.getUnderlyingAddress(),
|
|
230
|
+
borrowable.getSymbol(),
|
|
231
|
+
borrowable.getName(),
|
|
232
|
+
borrowable.getDecimals(),
|
|
233
|
+
]);
|
|
234
|
+
if (!address)
|
|
235
|
+
return null;
|
|
236
|
+
return {
|
|
237
|
+
token: `${this.network}:${address}`,
|
|
238
|
+
id: address,
|
|
239
|
+
symbol,
|
|
240
|
+
name,
|
|
241
|
+
decimals,
|
|
242
|
+
chainId,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
console.error(`Error getting token details for borrowable in pool ${poolId}:`, error);
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
const tokens = await Promise.all(tokenPromises);
|
|
251
|
+
return tokens.filter((token) => token !== null);
|
|
252
|
+
}
|
|
253
|
+
catch (error) {
|
|
254
|
+
console.error(`Error processing pool ${poolId} in factory ${factory} on ${this.network}:`, error);
|
|
255
|
+
return [];
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
const poolResults = await Promise.all(poolPromises);
|
|
259
|
+
return poolResults.flat();
|
|
260
|
+
});
|
|
261
|
+
const factoryResults = await Promise.all(factoryPromises);
|
|
262
|
+
const networkTokens = factoryResults.flat();
|
|
263
|
+
networkTokens.forEach(tokenData => tokenMap.set(tokenData.token, tokenData));
|
|
264
|
+
return networkTokens;
|
|
265
|
+
}
|
|
213
266
|
}
|
|
214
267
|
exports.default = Offchain;
|
|
@@ -25,6 +25,7 @@ const LlamaChains = {
|
|
|
25
25
|
[types_1.Networks.Blast]: "blast",
|
|
26
26
|
[types_1.Networks.Sonic]: "sonic",
|
|
27
27
|
[types_1.Networks.Linea]: "linea",
|
|
28
|
+
[types_1.Networks.HyperEVM]: "hyperliquid",
|
|
28
29
|
};
|
|
29
30
|
// Class to get the APR from DefiLlama directly, only makes 1 call to api and caches all pools
|
|
30
31
|
class OffchainAPRHelper {
|