Files
Francisco Tarantuviez 5c609a7d5d Fix Turtle Club TVL (#16646)
Co-authored-by: Adin Lieblein <adinmlieblein@gmail.com>
2025-10-20 09:57:57 +01:00

25 lines
829 B
JavaScript

const { log } = require("../helper/utils");
const getERC4626VaultsTvl = async (api, vaults) => {
for (const vault of vaults) {
// Get the underlying asset from the vault
const asset = await api.call({
abi: 'function asset() view returns (address)',
target: vault,
});
// Get total assets from the morpho vault
const totalAssets = await api.call({
abi: 'function totalAssets() view returns (uint256)',
target: vault,
});
// Add the underlying asset with the total assets amount
// This represents the actual underlying assets held by the vault
api.add(asset, totalAssets);
}
}
module.exports = {
getERC4626VaultsTvl,
}