|
1 | | -const { getConfig } = require("../helper/cache") |
2 | | - |
3 | 1 | const LHYPE_VAULT = '0x5748ae796AE46A4F1348a1693de4b50560485562' |
4 | | -const CHAIN_ID_STR = '999' |
5 | | -const HYPE_TOKEN = '0x5555555555555555555555555555555555555555' |
6 | 2 |
|
7 | | -const tvl = async (api) => { |
8 | | - const data = await getConfig( |
9 | | - 'lhype-tokens', |
10 | | - `https://backend.nucleusearn.io/v1/vaults/underlying_strategies?vault_address=${LHYPE_VAULT}&chain_id=${CHAIN_ID_STR}` |
11 | | - ) |
| 3 | +const LHYPE_ACCOUNTANT = '0xcE621a3CA6F72706678cFF0572ae8d15e5F001c3' |
| 4 | + |
| 5 | +const WHYPE = '0x5555555555555555555555555555555555555555' |
12 | 6 |
|
13 | | - const strat = data?.[CHAIN_ID_STR] |
14 | | - if (!strat) return |
| 7 | +const totalSupplyAbi = 'function totalSupply() view returns (uint256)' |
| 8 | +const exchangeRateAbi = 'function getRate() view returns (uint256)' |
| 9 | + |
| 10 | +const tvl = async (api) => { |
| 11 | + const [lhypeTotalSupply, lhypeExchangeRate,] = await Promise.all([ |
| 12 | + api.call({ target: LHYPE_VAULT, abi: totalSupplyAbi }), |
| 13 | + api.call({ target: LHYPE_ACCOUNTANT, abi: exchangeRateAbi, }), |
| 14 | + ]) |
15 | 15 |
|
16 | | - let totalHype = 0 |
17 | | - for (const pos of Object.values(strat)) { |
18 | | - totalHype += Number(pos.valueInBase || 0) |
19 | | - } |
| 16 | + const lhypeTotalValueInHype = lhypeTotalSupply * lhypeExchangeRate / 1e18 |
20 | 17 |
|
21 | | - const hypeAmount = BigInt(Math.round(totalHype * 1e18)) |
22 | | - api.add(HYPE_TOKEN, hypeAmount) |
| 18 | + api.add(WHYPE, lhypeTotalValueInHype) |
23 | 19 | } |
24 | 20 |
|
25 | 21 | module.exports = { |
26 | 22 | hyperliquid: { tvl }, |
27 | | - methodology: 'The total value of assets deployed across all LHYPE strategies.', |
| 23 | + methodology: 'The total value of assets deployed across all LHYPE and WHLP strategies.', |
28 | 24 | misrepresentedTokens: true, |
29 | 25 | } |
0 commit comments