From 5b1c23713fe5f0616e869212f3a5a01fcb497c31 Mon Sep 17 00:00:00 2001 From: rohancherukuri14 Date: Mon, 7 Apr 2025 22:42:46 -0400 Subject: [PATCH 1/2] add linea --- projects/theo-network/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/theo-network/index.js b/projects/theo-network/index.js index a02ebfb8e6..d0c63fe5ea 100644 --- a/projects/theo-network/index.js +++ b/projects/theo-network/index.js @@ -4,6 +4,7 @@ const config = { ethereum: {}, arbitrum: {}, base: {}, + linea: {}, } Object.keys(config).forEach(chain => { From a94a111b97f030386f1fda7f30843bf49dd807c5 Mon Sep 17 00:00:00 2001 From: joshhchun Date: Tue, 19 Aug 2025 12:12:12 -0400 Subject: [PATCH 2/2] theo: add thBILL multi-chain supply --- projects/theo-network/index.js | 46 +++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/projects/theo-network/index.js b/projects/theo-network/index.js index d0c63fe5ea..8fcc418549 100644 --- a/projects/theo-network/index.js +++ b/projects/theo-network/index.js @@ -1,21 +1,55 @@ const { getConfig } = require('../helper/cache') +// thBill token addresses +const THBILL = { + ethereum: "0x5FA487BCa6158c64046B2813623e20755091DA0b", + arbitrum: "0xfdd22ce6d1f66bc0ec89b20bf16ccb6670f55a5a", + base: "0xfdd22ce6d1f66bc0ec89b20bf16ccb6670f55a5a", + hyperliquid: "0xfdd22ce6d1f66bc0ec89b20bf16ccb6670f55a5a" +} + +// Chains where your vaults/vaultInfo endpoint applies (skip hyperliquid here) +const CHAINS_WITH_VAULTS = ["ethereum", "arbitrum", "base", "linea"] +const ETH_ADAPTER = "0xfdd22ce6d1f66bc0ec89b20bf16ccb6670f55a5a" + const config = { ethereum: {}, arbitrum: {}, base: {}, linea: {}, + hyperliquid: {} } Object.keys(config).forEach(chain => { module.exports[chain] = { tvl: async (api) => { - const { [chain]: data } = await getConfig('theo-network', "https://vaults.theo.xyz/vaults/vaultInfo"); + // vault balance + if (CHAINS_WITH_VAULTS.includes(chain)) { + const { [chain]: data } = await getConfig('theo-network', "https://vaults.theo.xyz/vaults/vaultInfo"); + + const calls = Object.values(data).map(i => i.contract) + const tokens = Object.values(data).map(i => i.asset) + const bals = await api.multiCall({ abi: 'uint256:totalBalance', calls }) + api.add(tokens, bals) + } + + // thBill balance + const addr = THBILL[chain] + if (!addr) return + - const calls = Object.values(data).map(i => i.contract) - const tokens = Object.values(data).map(i => i.asset) - const bals = await api.multiCall({ abi: 'uint256:totalBalance', calls }) - api.add(tokens, bals) + // for mainnet, subtract balance of adapter to avoid double counting + if (chain === "ethereum") { + const [totalSupply, locked] = await Promise.all([ + api.call({ target: addr, abi: 'erc20:totalSupply' }), + api.call({ target: addr, abi: 'erc20:balanceOf', params: [ETH_ADAPTER] }), + ]) + const effective = totalSupply - locked + if (effective > 0n) api.add(addr, effective) + } else { + const supply = await api.call({ target: addr, abi: 'erc20:totalSupply' }) + api.add(addr, supply) + } } } -}) \ No newline at end of file +})