Skip to content
Open
116 changes: 113 additions & 3 deletions projects/infinite/index.js
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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
Expand All @@ -20,6 +21,25 @@ 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;
Expand Down Expand Up @@ -67,10 +87,100 @@ 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
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), 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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can users withdraw treasury funds?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, its controlled by the DAO multisig

However anyone with sufficient voting power (staked tokens) can generate a proposal to manage the dao aum.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See our snapshot governance space

And this; infinitetrading.io/staking

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be included in a seperate treasury adapter in that case. TVL is only for withdrawable assets https://github.com/DefiLlama/DefiLlama-Adapters/tree/main/projects/treasury

const dhedgeTVL = await getDhedgeVaultsTVL(api)
if (dhedgeTVL) api.addUSDValue(dhedgeTVL.tether)
return api.getBalances()
},
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()
}
},
}
Loading