From cbd1b6a4c6f1a99a632cc9d070a077f4841e8223 Mon Sep 17 00:00:00 2001 From: EtherPilled Date: Thu, 27 Nov 2025 14:55:13 -0400 Subject: [PATCH 1/5] Add auto-compounder vault TVL tracking for Infinite Trading Protocol --- projects/infinite/index.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/projects/infinite/index.js b/projects/infinite/index.js index 5b7c53d3aa0..555074d61e3 100644 --- a/projects/infinite/index.js +++ b/projects/infinite/index.js @@ -1,4 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') const ITP_VAULT_ADDRRESS= '0x23371aEEaF8718955C93aEC726b3CAFC772B9E37' const ITP_ON_OPTIMISM = "0x0a7B751FcDBBAA8BB988B9217ad5Fb5cfe7bf7A0"; @@ -9,6 +10,16 @@ const OP_TOKEN_ADDRESS = ADDRESSES.optimism.OP; const USDC_OP_TOKEN_ADDRESS = ADDRESSES.optimism.USDC_CIRCLE; const ITP_STAKED_ABI = "function getVaultInfo() view returns (uint256, uint256, uint256, uint256, uint256, uint256[], uint256)"; +// Auto-compounder vault contracts and their corresponding LP tokens +const AUTO_COMPOUNDERS = [ + { vault: "0x569D92f0c94C04C74c2f3237983281875D9e2247", lp: "0xC04754F8027aBBFe9EeA492C9cC78b66946a07D1" }, // ITP/VELO + { vault: "0xFCEa66a3333a4A3d911ce86cEf8Bdbb8bC16aCA6", lp: "0x3d5cbc66c366a51975918a132b1809c34d5c6fa2" }, // ITP/DHT + { vault: "0x2811a577cf57A2Aa34e94B0Eb56157066717563f", lp: "0xdAD7B4C48b5B0BE1159c674226BE19038814eBf6" }, // ITP/wstETH + { vault: "0x8A2e22BdA1fF16bdEf27b6072e087452fa874b69", lp: "0x79F1af622FE2C636a2d946F03A62D1DfC8cA6de4" }, // ITP/OP + { vault: "0x3092F8dE262F363398F15DDE5E609a752938Cc11", lp: "0x93e40C357C4Dc57b5d2B9198a94Da2bD1C2e89cA" }, // ITP/WBTC + { vault: "0xC4628802a42F83E5bce3caB05A4ac2F6E485F276", lp: "0x7e019a99f0dee5796db59c571ae9680c9c866a8e" }, // ITP/USDC +]; + const getStakedTVL = async (api) => { const { chain } = api let stakedTVL = 0; @@ -39,9 +50,27 @@ const getStakedTVL = async (api) => { api.addUSDValue(stakedTVL) } +// Auto-compounder TVL: fetches LP token balances from vaults and unwraps them +const getAutoCompounderTVL = async (api) => { + // Get the LP token balances held by all auto-compounder vault contracts + const balances = await api.multiCall({ + abi: "uint256:balance", + calls: AUTO_COMPOUNDERS.map(ac => ac.vault), + }); + + // Add LP tokens and their balances to the API + AUTO_COMPOUNDERS.forEach((ac, i) => { + api.add(ac.lp, balances[i]); + }); + + // Unwrap LP tokens to get underlying asset values + return sumTokens2({ api, resolveLP: true }); +} + module.exports = { + methodology: "Tracks ITP staking vault TVL using VELO price oracle, and auto-compounder vault TVL by unwrapping LP tokens held in 6 vault contracts. Auto-compounders automatically compound VELO rewards back into LP positions.", optimism: { - tvl: () => ({}), + tvl: getAutoCompounderTVL, staking: getStakedTVL }, } From 4cf52751f0d773cefafaa462fd941fe384d42ea7 Mon Sep 17 00:00:00 2001 From: EtherPilled Date: Fri, 28 Nov 2025 16:38:01 -0400 Subject: [PATCH 2/5] Add treasury multisigs and cbEGGS.finance TVL to Infinite Trading adapter --- projects/infinite/index.js | 51 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/projects/infinite/index.js b/projects/infinite/index.js index 555074d61e3..f5220682f0e 100644 --- a/projects/infinite/index.js +++ b/projects/infinite/index.js @@ -1,6 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') +// === ITP Staking Vault (Optimism) === const ITP_VAULT_ADDRRESS= '0x23371aEEaF8718955C93aEC726b3CAFC772B9E37' const ITP_ON_OPTIMISM = "0x0a7B751FcDBBAA8BB988B9217ad5Fb5cfe7bf7A0"; const VELO_PRICE_ORACLE = "0x395942C2049604a314d39F370Dfb8D87AAC89e16"; @@ -10,7 +11,7 @@ const OP_TOKEN_ADDRESS = ADDRESSES.optimism.OP; const USDC_OP_TOKEN_ADDRESS = ADDRESSES.optimism.USDC_CIRCLE; const ITP_STAKED_ABI = "function getVaultInfo() view returns (uint256, uint256, uint256, uint256, uint256, uint256[], uint256)"; -// Auto-compounder vault contracts and their corresponding LP tokens +// === Auto-compounder vault contracts and their corresponding LP tokens (Optimism) === const AUTO_COMPOUNDERS = [ { vault: "0x569D92f0c94C04C74c2f3237983281875D9e2247", lp: "0xC04754F8027aBBFe9EeA492C9cC78b66946a07D1" }, // ITP/VELO { vault: "0xFCEa66a3333a4A3d911ce86cEf8Bdbb8bC16aCA6", lp: "0x3d5cbc66c366a51975918a132b1809c34d5c6fa2" }, // ITP/DHT @@ -20,6 +21,13 @@ const AUTO_COMPOUNDERS = [ { vault: "0xC4628802a42F83E5bce3caB05A4ac2F6E485F276", lp: "0x7e019a99f0dee5796db59c571ae9680c9c866a8e" }, // ITP/USDC ]; +// === Treasury Multisigs === +const TREASURY_1 = "0xb5dB6e5a301E595B76F40319896a8dbDc277CEfB" +const TREASURY_2 = "0x1E2cD0E5905AFB73a67c497D82be271Cc65302Eb" + +// === cbEGGS Contract (Base) - owned by Infinite Trading === +const CBEGGS_CONTRACT = "0xddbabe113c376f51e5817242871879353098c296" + const getStakedTVL = async (api) => { const { chain } = api let stakedTVL = 0; @@ -67,10 +75,49 @@ const getAutoCompounderTVL = async (api) => { return sumTokens2({ api, resolveLP: true }); } +// Treasury TVL: sum all tokens in treasury multisigs +const getTreasuryTVL = async (api) => { + return sumTokens2({ + api, + owners: [TREASURY_1, TREASURY_2], + }) +} + +// cbEGGS TVL on Base: ETH backing in the contract +const getCbEggsTVL = async (api) => { + // Get ETH balance of the cbEGGS contract (the "backing") + const ethBalance = await api.call({ + target: CBEGGS_CONTRACT, + abi: 'function getBacking() view returns (uint256)', + }) + + // Add native ETH balance + api.add(ADDRESSES.null, ethBalance) + + return api.getBalances() +} + module.exports = { - methodology: "Tracks ITP staking vault TVL using VELO price oracle, and auto-compounder vault TVL by unwrapping LP tokens held in 6 vault contracts. Auto-compounders automatically compound VELO rewards back into LP positions.", + methodology: "Tracks ITP staking vault TVL, auto-compounder vault TVL (6 vaults unwrapping LP tokens), treasury holdings across multiple chains (Ethereum, Arbitrum, Optimism, Polygon, Base), and cbEGGS.finance protocol TVL (ETH backing on Base). cbEGGS is owned by Infinite Trading.", optimism: { tvl: getAutoCompounderTVL, staking: getStakedTVL }, + ethereum: { + tvl: getTreasuryTVL, + }, + arbitrum: { + tvl: getTreasuryTVL, + }, + polygon: { + tvl: getTreasuryTVL, + }, + base: { + tvl: async (api) => { + // Combine treasury + cbEGGS TVL on Base + const treasury = await getTreasuryTVL(api) + const cbEggs = await getCbEggsTVL(api) + return api.getBalances() + } + }, } From 9d7947fa9b428c34ffe21394a525b6f01a53533e Mon Sep 17 00:00:00 2001 From: EtherPilled Date: Fri, 28 Nov 2025 22:08:52 -0400 Subject: [PATCH 3/5] Add dHEDGE managed vaults TVL and treasury token holdings to Infinite Trading adapter --- projects/infinite/index.js | 85 +++++++++++++++++++++++++++++++++----- 1 file changed, 74 insertions(+), 11 deletions(-) diff --git a/projects/infinite/index.js b/projects/infinite/index.js index f5220682f0e..518eff2cf3d 100644 --- a/projects/infinite/index.js +++ b/projects/infinite/index.js @@ -22,12 +22,24 @@ const AUTO_COMPOUNDERS = [ ]; // === Treasury Multisigs === -const TREASURY_1 = "0xb5dB6e5a301E595B76F40319896a8dbDc277CEfB" -const TREASURY_2 = "0x1E2cD0E5905AFB73a67c497D82be271Cc65302Eb" +const TREASURY_1 = "0xb5dB6e5a301E595B76F40319896a8dbDc277CEfB" // Main DAO treasury +const TREASURY_2 = "0x1E2cD0E5905AFB73a67c497D82be271Cc65302Eb" // Secondary treasury // === cbEGGS Contract (Base) - owned by Infinite Trading === const CBEGGS_CONTRACT = "0xddbabe113c376f51e5817242871879353098c296" +// === dHEDGE Factory Contracts (for vault discovery) === +const DHEDGE_FACTORY = { + optimism: "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", + arbitrum: "0xffFb5fB14606EB3a548C113026355020dDF27535", + polygon: "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", + base: "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F" +} + +// dHEDGE ABIs +const DHEDGE_V2_FACTORY_ABI = "function getManagedPools(address manager) view returns (address[] managedPools)" +const DHEDGE_V2_VAULT_SUMMARY_ABI = "function getFundSummary() view returns (tuple(string name, uint256 totalSupply, uint256 totalFundValue))" + const getStakedTVL = async (api) => { const { chain } = api let stakedTVL = 0; @@ -75,15 +87,48 @@ const getAutoCompounderTVL = async (api) => { return sumTokens2({ api, resolveLP: true }); } -// Treasury TVL: sum all tokens in treasury multisigs +// Treasury TVL: sum all tokens in treasury multisigs + dHEDGE vault tokens const getTreasuryTVL = async (api) => { return sumTokens2({ api, owners: [TREASURY_1, TREASURY_2], + resolveLP: true, // Resolve LP tokens if treasury holds auto-compounder LPs }) } -// cbEGGS TVL on Base: ETH backing in the contract +// dHEDGE managed vaults TVL: Infinite Trading manages dHEDGE vaults across chains +const getDhedgeVaultsTVL = async (api) => { + const { chain } = api + const factory = DHEDGE_FACTORY[chain] + + if (!factory) return + + // Get all vaults managed by TREASURY_1 (the main DAO wallet) + const managedVaults = await api.call({ + abi: DHEDGE_V2_FACTORY_ABI, + target: factory, + params: [TREASURY_1], + }) + + if (!managedVaults || managedVaults.length === 0) return + + // Get total fund value for each vault + const summaries = await api.multiCall({ + abi: DHEDGE_V2_VAULT_SUMMARY_ABI, + calls: managedVaults, + permitFailure: true, + }) + + // Sum up all vault TVLs (totalFundValue is in USD with 18 decimals) + const totalAUM = summaries.reduce((acc, vault) => { + return acc + (vault && vault.totalFundValue ? Number(vault.totalFundValue) : 0) + }, 0) + + // Add as USDT (standard for misrepresented tokens in DeFiLlama) + return { + tether: totalAUM / 1e18 + } +}// cbEGGS TVL on Base: ETH backing in the contract const getCbEggsTVL = async (api) => { // Get ETH balance of the cbEGGS contract (the "backing") const ethBalance = await api.call({ @@ -98,25 +143,43 @@ const getCbEggsTVL = async (api) => { } module.exports = { - methodology: "Tracks ITP staking vault TVL, auto-compounder vault TVL (6 vaults unwrapping LP tokens), treasury holdings across multiple chains (Ethereum, Arbitrum, Optimism, Polygon, Base), and cbEGGS.finance protocol TVL (ETH backing on Base). cbEGGS is owned by Infinite Trading.", + methodology: "Tracks ITP staking vault TVL, auto-compounder vault TVL (6 vaults unwrapping LP tokens), treasury holdings across multiple chains (Ethereum, Arbitrum, Optimism, Polygon, Base), dHEDGE managed vaults AUM (~$300k managed by DAO treasury), and cbEGGS.finance protocol TVL (ETH backing on Base). cbEGGS is owned by Infinite Trading.", + misrepresentedTokens: true, optimism: { - tvl: getAutoCompounderTVL, + tvl: async (api) => { + await getAutoCompounderTVL(api) + await getTreasuryTVL(api) + const dhedgeTVL = await getDhedgeVaultsTVL(api) + if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) + return api.getBalances() + }, staking: getStakedTVL }, ethereum: { tvl: getTreasuryTVL, }, arbitrum: { - tvl: getTreasuryTVL, + tvl: async (api) => { + await getTreasuryTVL(api) + const dhedgeTVL = await getDhedgeVaultsTVL(api) + if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) + return api.getBalances() + }, }, polygon: { - tvl: getTreasuryTVL, + tvl: async (api) => { + await getTreasuryTVL(api) + const dhedgeTVL = await getDhedgeVaultsTVL(api) + if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) + return api.getBalances() + }, }, base: { tvl: async (api) => { - // Combine treasury + cbEGGS TVL on Base - const treasury = await getTreasuryTVL(api) - const cbEggs = await getCbEggsTVL(api) + await getTreasuryTVL(api) + await getCbEggsTVL(api) + const dhedgeTVL = await getDhedgeVaultsTVL(api) + if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) return api.getBalances() } }, From 4b58cd82df9ffeba6eb68909cc849c537d10cc83 Mon Sep 17 00:00:00 2001 From: EtherPilled Date: Tue, 16 Dec 2025 14:13:25 -0400 Subject: [PATCH 4/5] feat: separate Infinite Trading treasury TVL from protocol TVL --- projects/infinite/index.js | 97 ++------------------------------- projects/treasury/infinite.js | 100 ++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 93 deletions(-) create mode 100644 projects/treasury/infinite.js diff --git a/projects/infinite/index.js b/projects/infinite/index.js index 518eff2cf3d..31e5a78547f 100644 --- a/projects/infinite/index.js +++ b/projects/infinite/index.js @@ -21,25 +21,9 @@ const AUTO_COMPOUNDERS = [ { vault: "0xC4628802a42F83E5bce3caB05A4ac2F6E485F276", lp: "0x7e019a99f0dee5796db59c571ae9680c9c866a8e" }, // ITP/USDC ]; -// === Treasury Multisigs === -const TREASURY_1 = "0xb5dB6e5a301E595B76F40319896a8dbDc277CEfB" // Main DAO treasury -const TREASURY_2 = "0x1E2cD0E5905AFB73a67c497D82be271Cc65302Eb" // Secondary treasury - // === cbEGGS Contract (Base) - owned by Infinite Trading === const CBEGGS_CONTRACT = "0xddbabe113c376f51e5817242871879353098c296" -// === dHEDGE Factory Contracts (for vault discovery) === -const DHEDGE_FACTORY = { - optimism: "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", - arbitrum: "0xffFb5fB14606EB3a548C113026355020dDF27535", - polygon: "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", - base: "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F" -} - -// dHEDGE ABIs -const DHEDGE_V2_FACTORY_ABI = "function getManagedPools(address manager) view returns (address[] managedPools)" -const DHEDGE_V2_VAULT_SUMMARY_ABI = "function getFundSummary() view returns (tuple(string name, uint256 totalSupply, uint256 totalFundValue))" - const getStakedTVL = async (api) => { const { chain } = api let stakedTVL = 0; @@ -87,48 +71,7 @@ const getAutoCompounderTVL = async (api) => { return sumTokens2({ api, resolveLP: true }); } -// Treasury TVL: sum all tokens in treasury multisigs + dHEDGE vault tokens -const getTreasuryTVL = async (api) => { - return sumTokens2({ - api, - owners: [TREASURY_1, TREASURY_2], - resolveLP: true, // Resolve LP tokens if treasury holds auto-compounder LPs - }) -} - -// dHEDGE managed vaults TVL: Infinite Trading manages dHEDGE vaults across chains -const getDhedgeVaultsTVL = async (api) => { - const { chain } = api - const factory = DHEDGE_FACTORY[chain] - - if (!factory) return - - // Get all vaults managed by TREASURY_1 (the main DAO wallet) - const managedVaults = await api.call({ - abi: DHEDGE_V2_FACTORY_ABI, - target: factory, - params: [TREASURY_1], - }) - - if (!managedVaults || managedVaults.length === 0) return - - // Get total fund value for each vault - const summaries = await api.multiCall({ - abi: DHEDGE_V2_VAULT_SUMMARY_ABI, - calls: managedVaults, - permitFailure: true, - }) - - // Sum up all vault TVLs (totalFundValue is in USD with 18 decimals) - const totalAUM = summaries.reduce((acc, vault) => { - return acc + (vault && vault.totalFundValue ? Number(vault.totalFundValue) : 0) - }, 0) - - // Add as USDT (standard for misrepresented tokens in DeFiLlama) - return { - tether: totalAUM / 1e18 - } -}// cbEGGS TVL on Base: ETH backing in the contract +// cbEGGS TVL on Base: ETH backing in the contract const getCbEggsTVL = async (api) => { // Get ETH balance of the cbEGGS contract (the "backing") const ethBalance = await api.call({ @@ -143,44 +86,12 @@ const getCbEggsTVL = async (api) => { } module.exports = { - methodology: "Tracks ITP staking vault TVL, auto-compounder vault TVL (6 vaults unwrapping LP tokens), treasury holdings across multiple chains (Ethereum, Arbitrum, Optimism, Polygon, Base), dHEDGE managed vaults AUM (~$300k managed by DAO treasury), and cbEGGS.finance protocol TVL (ETH backing on Base). cbEGGS is owned by Infinite Trading.", - misrepresentedTokens: true, + methodology: "Tracks ITP staking vault TVL, auto-compounder vault TVL (6 vaults unwrapping LP tokens on Optimism), and cbEGGS.finance protocol TVL (ETH backing on Base). cbEGGS is owned by Infinite Trading.", optimism: { - tvl: async (api) => { - await getAutoCompounderTVL(api) - await getTreasuryTVL(api) - const dhedgeTVL = await getDhedgeVaultsTVL(api) - if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) - return api.getBalances() - }, + tvl: getAutoCompounderTVL, staking: getStakedTVL }, - ethereum: { - tvl: getTreasuryTVL, - }, - arbitrum: { - tvl: async (api) => { - await getTreasuryTVL(api) - const dhedgeTVL = await getDhedgeVaultsTVL(api) - if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) - return api.getBalances() - }, - }, - polygon: { - tvl: async (api) => { - await getTreasuryTVL(api) - const dhedgeTVL = await getDhedgeVaultsTVL(api) - if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) - return api.getBalances() - }, - }, base: { - tvl: async (api) => { - await getTreasuryTVL(api) - await getCbEggsTVL(api) - const dhedgeTVL = await getDhedgeVaultsTVL(api) - if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) - return api.getBalances() - } + tvl: getCbEggsTVL }, } diff --git a/projects/treasury/infinite.js b/projects/treasury/infinite.js new file mode 100644 index 00000000000..9154c8001e4 --- /dev/null +++ b/projects/treasury/infinite.js @@ -0,0 +1,100 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +// === Treasury Multisigs === +const TREASURY_1 = "0xb5dB6e5a301E595B76F40319896a8dbDc277CEfB" // Main DAO treasury +const TREASURY_2 = "0x1E2cD0E5905AFB73a67c497D82be271Cc65302Eb" // Secondary treasury + +// === dHEDGE Factory Contracts (for vault discovery) === +const DHEDGE_FACTORY = { + optimism: "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", + arbitrum: "0xffFb5fB14606EB3a548C113026355020dDF27535", + polygon: "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", + base: "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F" +} + +// dHEDGE ABIs +const DHEDGE_V2_FACTORY_ABI = "function getManagedPools(address manager) view returns (address[] managedPools)" +const DHEDGE_V2_VAULT_SUMMARY_ABI = "function getFundSummary() view returns (tuple(string name, uint256 totalSupply, uint256 totalFundValue))" + +// Treasury TVL: sum all tokens in treasury multisigs +const getTreasuryTVL = async (api) => { + return sumTokens2({ + api, + owners: [TREASURY_1, TREASURY_2], + resolveLP: true, // Resolve LP tokens if treasury holds auto-compounder LPs + }) +} + +// dHEDGE managed vaults TVL: Infinite Trading manages dHEDGE vaults across chains +const getDhedgeVaultsTVL = async (api) => { + const { chain } = api + const factory = DHEDGE_FACTORY[chain] + + if (!factory) return + + // Get all vaults managed by TREASURY_1 (the main DAO wallet) + const managedVaults = await api.call({ + abi: DHEDGE_V2_FACTORY_ABI, + target: factory, + params: [TREASURY_1], + }) + + if (!managedVaults || managedVaults.length === 0) return + + // Get total fund value for each vault + const summaries = await api.multiCall({ + abi: DHEDGE_V2_VAULT_SUMMARY_ABI, + calls: managedVaults, + permitFailure: true, + }) + + // Sum up all vault TVLs (totalFundValue is in USD with 18 decimals) + const totalAUM = summaries.reduce((acc, vault) => { + return acc + (vault && vault.totalFundValue ? Number(vault.totalFundValue) : 0) + }, 0) + + // Add as USDT (standard for misrepresented tokens in DeFiLlama) + return { + tether: totalAUM / 1e18 + } +} + +module.exports = { + methodology: "Tracks Infinite Trading treasury holdings across multiple chains (Ethereum, Arbitrum, Optimism, Polygon, Base) including direct multisig balances and dHEDGE managed vault AUM (~$300k).", + misrepresentedTokens: true, + optimism: { + tvl: async (api) => { + await getTreasuryTVL(api) + const dhedgeTVL = await getDhedgeVaultsTVL(api) + if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) + return api.getBalances() + }, + }, + ethereum: { + tvl: getTreasuryTVL, + }, + arbitrum: { + tvl: async (api) => { + await getTreasuryTVL(api) + const dhedgeTVL = await getDhedgeVaultsTVL(api) + if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) + return api.getBalances() + }, + }, + polygon: { + tvl: async (api) => { + await getTreasuryTVL(api) + const dhedgeTVL = await getDhedgeVaultsTVL(api) + if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) + return api.getBalances() + }, + }, + base: { + tvl: async (api) => { + await getTreasuryTVL(api) + const dhedgeTVL = await getDhedgeVaultsTVL(api) + if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) + return api.getBalances() + } + }, +} From 25835270e14a8ed3657d50c4a19ec1b80e6b5117 Mon Sep 17 00:00:00 2001 From: EtherPilled Date: Tue, 16 Dec 2025 14:42:23 -0400 Subject: [PATCH 5/5] fix: correctly separate dHEDGE managed vaults (protocol) from held vault tokens (treasury) --- projects/infinite/index.js | 67 ++++++++++++++++++++++++++-- projects/treasury/infinite.js | 82 ++++------------------------------- 2 files changed, 72 insertions(+), 77 deletions(-) diff --git a/projects/infinite/index.js b/projects/infinite/index.js index 31e5a78547f..af07f10661c 100644 --- a/projects/infinite/index.js +++ b/projects/infinite/index.js @@ -24,6 +24,21 @@ const AUTO_COMPOUNDERS = [ // === cbEGGS Contract (Base) - owned by Infinite Trading === const CBEGGS_CONTRACT = "0xddbabe113c376f51e5817242871879353098c296" +// === Treasury address (for managed dHEDGE vaults) === +const TREASURY_1 = "0xb5dB6e5a301E595B76F40319896a8dbDc277CEfB" // Main DAO treasury + +// === dHEDGE Factory Contracts (for vault discovery) === +const DHEDGE_FACTORY = { + optimism: "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", + arbitrum: "0xffFb5fB14606EB3a548C113026355020dDF27535", + polygon: "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", + base: "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F" +} + +// dHEDGE ABIs +const DHEDGE_V2_FACTORY_ABI = "function getManagedPools(address manager) view returns (address[] managedPools)" +const DHEDGE_V2_VAULT_SUMMARY_ABI = "function getFundSummary() view returns (tuple(string name, uint256 totalSupply, uint256 totalFundValue))" + const getStakedTVL = async (api) => { const { chain } = api let stakedTVL = 0; @@ -71,6 +86,38 @@ const getAutoCompounderTVL = async (api) => { return sumTokens2({ api, resolveLP: true }); } +// dHEDGE managed vaults TVL: Infinite Trading manages dHEDGE vaults across chains (protocol TVL) +const getDhedgeVaultsTVL = async (api) => { + const { chain } = api + const factory = DHEDGE_FACTORY[chain] + + if (!factory) return + + // Get all vaults managed by TREASURY_1 (the main DAO wallet acting as manager) + const managedVaults = await api.call({ + abi: DHEDGE_V2_FACTORY_ABI, + target: factory, + params: [TREASURY_1], + }) + + if (!managedVaults || managedVaults.length === 0) return + + // Get total fund value for each vault + const summaries = await api.multiCall({ + abi: DHEDGE_V2_VAULT_SUMMARY_ABI, + calls: managedVaults, + permitFailure: true, + }) + + // Sum up all vault TVLs (totalFundValue is in USD with 18 decimals) + const totalAUM = summaries.reduce((acc, vault) => { + return acc + (vault && vault.totalFundValue ? Number(vault.totalFundValue) : 0) + }, 0) + + // Add as USD value + api.addUSDValue(totalAUM / 1e18) +} + // cbEGGS TVL on Base: ETH backing in the contract const getCbEggsTVL = async (api) => { // Get ETH balance of the cbEGGS contract (the "backing") @@ -86,12 +133,26 @@ const getCbEggsTVL = async (api) => { } module.exports = { - methodology: "Tracks ITP staking vault TVL, auto-compounder vault TVL (6 vaults unwrapping LP tokens on Optimism), and cbEGGS.finance protocol TVL (ETH backing on Base). cbEGGS is owned by Infinite Trading.", + methodology: "Tracks ITP staking vault TVL, auto-compounder vault TVL (6 vaults unwrapping LP tokens on Optimism), dHEDGE vaults managed by the DAO across multiple chains (~$300k AUM), and cbEGGS.finance protocol TVL (ETH backing on Base). cbEGGS is owned by Infinite Trading.", optimism: { - tvl: getAutoCompounderTVL, + tvl: async (api) => { + await getAutoCompounderTVL(api) + await getDhedgeVaultsTVL(api) + return api.getBalances() + }, staking: getStakedTVL }, + arbitrum: { + tvl: getDhedgeVaultsTVL, + }, + polygon: { + tvl: getDhedgeVaultsTVL, + }, base: { - tvl: getCbEggsTVL + tvl: async (api) => { + await getCbEggsTVL(api) + await getDhedgeVaultsTVL(api) + return api.getBalances() + } }, } diff --git a/projects/treasury/infinite.js b/projects/treasury/infinite.js index 9154c8001e4..08a38b5ce4c 100644 --- a/projects/treasury/infinite.js +++ b/projects/treasury/infinite.js @@ -4,97 +4,31 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const TREASURY_1 = "0xb5dB6e5a301E595B76F40319896a8dbDc277CEfB" // Main DAO treasury const TREASURY_2 = "0x1E2cD0E5905AFB73a67c497D82be271Cc65302Eb" // Secondary treasury -// === dHEDGE Factory Contracts (for vault discovery) === -const DHEDGE_FACTORY = { - optimism: "0x5e61a079A178f0E5784107a4963baAe0c5a680c6", - arbitrum: "0xffFb5fB14606EB3a548C113026355020dDF27535", - polygon: "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0", - base: "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F" -} - -// dHEDGE ABIs -const DHEDGE_V2_FACTORY_ABI = "function getManagedPools(address manager) view returns (address[] managedPools)" -const DHEDGE_V2_VAULT_SUMMARY_ABI = "function getFundSummary() view returns (tuple(string name, uint256 totalSupply, uint256 totalFundValue))" - -// Treasury TVL: sum all tokens in treasury multisigs +// Treasury TVL: sum all tokens held in treasury multisig wallets +// This includes any dHEDGE vault tokens the treasury owns (resolveLP unwraps them) const getTreasuryTVL = async (api) => { return sumTokens2({ api, owners: [TREASURY_1, TREASURY_2], - resolveLP: true, // Resolve LP tokens if treasury holds auto-compounder LPs + resolveLP: true, // Resolve LP tokens and dHEDGE vault tokens held by treasury }) } -// dHEDGE managed vaults TVL: Infinite Trading manages dHEDGE vaults across chains -const getDhedgeVaultsTVL = async (api) => { - const { chain } = api - const factory = DHEDGE_FACTORY[chain] - - if (!factory) return - - // Get all vaults managed by TREASURY_1 (the main DAO wallet) - const managedVaults = await api.call({ - abi: DHEDGE_V2_FACTORY_ABI, - target: factory, - params: [TREASURY_1], - }) - - if (!managedVaults || managedVaults.length === 0) return - - // Get total fund value for each vault - const summaries = await api.multiCall({ - abi: DHEDGE_V2_VAULT_SUMMARY_ABI, - calls: managedVaults, - permitFailure: true, - }) - - // Sum up all vault TVLs (totalFundValue is in USD with 18 decimals) - const totalAUM = summaries.reduce((acc, vault) => { - return acc + (vault && vault.totalFundValue ? Number(vault.totalFundValue) : 0) - }, 0) - - // Add as USDT (standard for misrepresented tokens in DeFiLlama) - return { - tether: totalAUM / 1e18 - } -} - module.exports = { - methodology: "Tracks Infinite Trading treasury holdings across multiple chains (Ethereum, Arbitrum, Optimism, Polygon, Base) including direct multisig balances and dHEDGE managed vault AUM (~$300k).", - misrepresentedTokens: true, + methodology: "Tracks Infinite Trading treasury holdings across multiple chains (Ethereum, Arbitrum, Optimism, Polygon, Base) including token balances in multisig wallets. Any dHEDGE vault tokens held by the treasury are automatically unwrapped to show underlying assets.", optimism: { - tvl: async (api) => { - await getTreasuryTVL(api) - const dhedgeTVL = await getDhedgeVaultsTVL(api) - if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) - return api.getBalances() - }, + tvl: getTreasuryTVL, }, ethereum: { tvl: getTreasuryTVL, }, arbitrum: { - tvl: async (api) => { - await getTreasuryTVL(api) - const dhedgeTVL = await getDhedgeVaultsTVL(api) - if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) - return api.getBalances() - }, + tvl: getTreasuryTVL, }, polygon: { - tvl: async (api) => { - await getTreasuryTVL(api) - const dhedgeTVL = await getDhedgeVaultsTVL(api) - if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) - return api.getBalances() - }, + tvl: getTreasuryTVL, }, base: { - tvl: async (api) => { - await getTreasuryTVL(api) - const dhedgeTVL = await getDhedgeVaultsTVL(api) - if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether) - return api.getBalances() - } + tvl: getTreasuryTVL, }, }