mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 08:34:23 +08:00
LHYPE TVL update using endpoint NAV (valueInBase sum) (#16807)
This commit is contained in:
@@ -1,32 +1,29 @@
|
||||
const { getConfig } = require("../helper/cache");
|
||||
const { sumTokens2 } = require('../helper/unwrapLPs');
|
||||
const { getConfig } = require("../helper/cache")
|
||||
|
||||
const sanitizeAndValidateEvmAddresses = (addresses) => {
|
||||
return addresses
|
||||
.map((address) => address.replace(/_$/, ""))
|
||||
.filter((address) => /^0x[a-fA-F0-9]{40}$/.test(address));
|
||||
};
|
||||
|
||||
const LHYPE_VAULT_ADDRESS = ['0x5748ae796AE46A4F1348a1693de4b50560485562'];
|
||||
const LHYPE_VAULT = '0x5748ae796AE46A4F1348a1693de4b50560485562'
|
||||
const CHAIN_ID_STR = '999'
|
||||
const HYPE_TOKEN = '0x5555555555555555555555555555555555555555'
|
||||
|
||||
const tvl = async (api) => {
|
||||
const strategies = await getConfig(
|
||||
const data = await getConfig(
|
||||
'lhype-tokens',
|
||||
`https://backend.nucleusearn.io/v1/vaults/underlying_strategies?vault_address=${LHYPE_VAULT_ADDRESS}&chain_id=999`
|
||||
);
|
||||
const hyperevmStrategies = strategies["999"]
|
||||
const tokens = Object.values(hyperevmStrategies).map((strategy) => strategy.tokenAddress);
|
||||
const sanitizedTokens = sanitizeAndValidateEvmAddresses([...tokens, ...LHYPE_VAULT_ADDRESS]);
|
||||
`https://backend.nucleusearn.io/v1/vaults/underlying_strategies?vault_address=${LHYPE_VAULT}&chain_id=${CHAIN_ID_STR}`
|
||||
)
|
||||
|
||||
return sumTokens2({
|
||||
owners: LHYPE_VAULT_ADDRESS,
|
||||
tokens: sanitizedTokens,
|
||||
api,
|
||||
resolveLP: true,
|
||||
permitFailure: true
|
||||
});
|
||||
};
|
||||
const strat = data?.[CHAIN_ID_STR]
|
||||
if (!strat) return
|
||||
|
||||
let totalHype = 0
|
||||
for (const pos of Object.values(strat)) {
|
||||
totalHype += Number(pos.valueInBase || 0)
|
||||
}
|
||||
|
||||
const hypeAmount = BigInt(Math.round(totalHype * 1e18))
|
||||
api.add(HYPE_TOKEN, hypeAmount)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
hyperliquid: { tvl }
|
||||
};
|
||||
hyperliquid: { tvl },
|
||||
methodology: 'The total value of assets deployed across all LHYPE strategies.',
|
||||
misrepresentedTokens: true,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user