From e3259e9c2c3276dc5e791b6e1dd5b804c728b082 Mon Sep 17 00:00:00 2001 From: Diego Brando <135213311+DIO1009@users.noreply.github.com> Date: Wed, 30 Sep 2026 14:58:19 +0900 Subject: [PATCH 001/988] Add Story.fun (#21326) Co-authored-by: Claude Opus 5 --- projects/story-fun/index.js | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 projects/story-fun/index.js diff --git a/projects/story-fun/index.js b/projects/story-fun/index.js new file mode 100644 index 00000000000..5b0a65b3ae4 --- /dev/null +++ b/projects/story-fun/index.js @@ -0,0 +1,60 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// Story.fun is a token launchpad on Robinhood Chain. Every launch gets its own bonding curve that +// custodies the quote asset buyers pay in. When a curve sells out the launch graduates: its reserves +// are minted as a full-range Uniswap V4 position and the position NFT is locked forever in the +// LiquidityLocker, so graduated liquidity never leaves the protocol. +// +// Only the quote side is counted. A curve's launch-token balance is unsold supply, and the +// launch-token side of a graduated pool is priced by that same pool, so counting either would report +// the launchpad's own emissions as value locked. +const config = { + robinhood: { + factory: '0x1A9BC7Fd7EE06Fa0477781633223bcC102C08fbd', + receiver: '0x011Df5b627D386B72da589ceAbAE0915Ae0DdEC9', + locker: '0x849187b6C1D2Ab47012689E91C4b0Ec025991D33', + // LaunchFactory deployment block + fromBlock: 75644816, + }, +} + +const TOKEN_LAUNCHED = 'event TokenLaunched(address indexed token, address indexed curve, address indexed creator, bytes32 launchSalt, address quoteAsset, bytes32 quoteConfigHash, uint32 launchConfigId, uint16 curveFeeBps, int24 tickSpacing, address creatorFeeRecipient, uint16 creatorTaxBps, bool buybackEnabled, string name, string symbol, string logo, string description, (string,string,string,string,string,string) socials)' +const V4_POOL_GRADUATED = 'event V4PoolGraduated(address indexed token, address indexed curve, bytes32 indexed poolId, uint256 positionId, uint160 sqrtPriceX96, uint128 liquidity, uint128 quoteAmount, uint96 tokenAmount, uint96 tokenDust, uint256 quoteDust)' + +async function tvl(api) { + const { factory, receiver, locker, fromBlock } = config[api.chain] + + const launches = await getLogs2({ api, factory, eventAbi: TOKEN_LAUNCHED, fromBlock }) + const graduations = await getLogs2({ api, target: receiver, eventAbi: V4_POOL_GRADUATED, fromBlock }) + + // every quote asset the factory has ever launched against; native ETH is the zero address + const quoteAssets = [...new Set(launches.map((log) => log.quoteAsset.toLowerCase()))] + + // a graduated curve has handed everything to the receiver, so only live curves are worth reading + const graduated = new Set(graduations.map((log) => log.curve.toLowerCase())) + const ownerTokens = launches + .filter((log) => !graduated.has(log.curve.toLowerCase())) + .map((log) => [[log.quoteAsset], log.curve]) + + // reserves the factory isolated from a curve that sold out but whose pool creation has not settled yet + ownerTokens.push([quoteAssets, factory]) + await sumTokens2({ api, ownerTokens }) + + const positionIds = [...new Set(graduations.map((log) => log.positionId.toString()))] + if (positionIds.length) + await sumTokens2({ api, owner: locker, uniV4ExtraConfig: { positionIds, whitelistedTokens: quoteAssets } }) + + return api.getBalances() +} + +module.exports = { + // graduated liquidity sits in the Uniswap V4 PoolManager and is already counted as Uniswap V4 TVL + doublecounted: true, + methodology: + 'Counts the quote asset (native ETH) held by every live Story.fun bonding curve, the reserves a sold-out curve has handed to the LaunchFactory while its pool is being created, and the quote side of the full-range Uniswap V4 positions permanently locked in the LiquidityLocker after graduation. Launch tokens are not counted: on a curve they are unsold supply, and in a graduated pool they are priced by that same pool.', +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl } +}) From 1201f468f03f877806c6ae5d6513561218fccdf3 Mon Sep 17 00:00:00 2001 From: Erkan <85198094+0xKann@users.noreply.github.com> Date: Wed, 30 Sep 2026 09:01:14 +0300 Subject: [PATCH 002/988] Add Ensify Protocol (#21294) --- projects/ensify/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/ensify/index.js diff --git a/projects/ensify/index.js b/projects/ensify/index.js new file mode 100644 index 00000000000..cd2206d2a8c --- /dev/null +++ b/projects/ensify/index.js @@ -0,0 +1,14 @@ +const VAULT = '0xA940860e5894A756252F50400014217D0CB4B955' + +async function tvl(api) { + const assets = await api.call({ target: VAULT, abi: 'address[]:allAssets' }) + const totals = await api.multiCall({ target: VAULT, abi: 'function totalAssetsOf(address asset) view returns (uint256)', calls: assets }) + api.add(assets, totals) +} + +module.exports = { + methodology: "TVL is every listed asset users hold in the Ensify vault on Base: the idle balance kept in the vault plus what the vault has deployed to Aave V3 and Morpho vaults, as reported per asset by the vault's totalAssetsOf. The deployed part is also counted in Aave V3's and Morpho's TVL, hence doublecounted.", + doublecounted: true, + start: '2026-09-28', + base: { tvl }, +} From 5b2ae0acbdcaaa4dbda3359b0f354dad571a5821 Mon Sep 17 00:00:00 2001 From: Ludovit Scholtz Date: Wed, 30 Sep 2026 08:04:35 +0200 Subject: [PATCH 003/988] Add Biatec DEX TVL on Algorand (#21296) Co-authored-by: Claude Sonnet 5 Co-authored-by: ccipherx --- projects/biatec-dex/index.js | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 projects/biatec-dex/index.js diff --git a/projects/biatec-dex/index.js b/projects/biatec-dex/index.js new file mode 100644 index 00000000000..599122f84d6 --- /dev/null +++ b/projects/biatec-dex/index.js @@ -0,0 +1,44 @@ +const sdk = require('@defillama/sdk') +const { sumTokens } = require('../helper/chain/algorand') + +// Biatec CLAMM pool provider app; every pool registers a box here +const POOL_PROVIDER_APP_ID = 3074197785 + +async function getPools() { + const boxes = await sdk.chains.algorand.getApplicationBoxesAll({ appId: POOL_PROVIDER_APP_ID }) + const pools = [] + for (const box of boxes) { + const name = Buffer.from(box.name, 'base64') + // pool box: "fc" + poolAppId + assetA + assetB + ... (59 bytes) + if (name.length !== 59 || name.toString('ascii', 0, 2) !== 'fc') continue + pools.push({ + appId: Number(name.readBigUInt64BE(2)), + assetA: name.readBigUInt64BE(10), + assetB: name.readBigUInt64BE(18), + }) + } + return pools +} + +// the algorand helper keys native ALGO as '1' +const assetKey = (assetId) => (assetId === 0n ? '1' : assetId.toString()) + +async function tvl() { + const pools = await getPools() + // only each pool's two registered assets, not the LP token it also holds + const tokensAndOwners = [] + for (const pool of pools) { + const address = sdk.chains.algorand.getApplicationAddress(pool.appId) + tokensAndOwners.push([assetKey(pool.assetA), address]) + tokensAndOwners.push([assetKey(pool.assetB), address]) + } + return sumTokens({ tokensAndOwners }) +} + +module.exports = { + methodology: "Sums each Biatec CLAMM pool's real on-chain asset balances (never its own LP token). Pools are discovered from the pool provider app's box storage, not a hardcoded list.", + timetravel: false, + algorand: { + tvl, + }, +} From d93c23ad86320f063be4b53197c6ac2509ceb24f Mon Sep 17 00:00:00 2001 From: ufgfinancialdefi Date: Wed, 30 Sep 2026 02:06:02 -0400 Subject: [PATCH 004/988] Add UFG treasury adapter (#21300) Co-authored-by: ufgfinancialdefi <324332200+ufgfinancialdefi@users.noreply.github.com> --- projects/ufg/index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 projects/ufg/index.js diff --git a/projects/ufg/index.js b/projects/ufg/index.js new file mode 100644 index 00000000000..a5243ddd21b --- /dev/null +++ b/projects/ufg/index.js @@ -0,0 +1,29 @@ +const { nullAddress } = require('../helper/unwrapLPs') + +const TREASURY_V1 = '0xc7220C3004662ef3942aef43452893086b9D6fB5' +const TREASURY_V2 = '0x8dD84F1901BD74A4D137f0f6a5A3A90E686AAB1D' +const SFRXETH = '0x00000000883279097A49dB1f2af954EAd0C77E3c' + +// Deployment of treasury v2 on 2026-09-23. The v2 reads revert before it. +const V2_START = 1790135441 + +// v1 holds native ETH, v2 holds sfrxETH. A holder burns $UFG for a share of both. +async function tvl(api) { + await api.sumTokens({ owner: TREASURY_V1, tokens: [nullAddress] }) + if (api.timestamp < V2_START) return + return api.sumTokens({ owner: TREASURY_V2, tokens: [SFRXETH] }) +} + +// v2 lends sfrxETH against $UFG collateral. Loans count at principal, as in the contract. +async function borrowed(api) { + if (api.timestamp < V2_START) return + const principal = await api.call({ abi: 'uint256:principalOutstanding', target: TREASURY_V2 }) + api.add(SFRXETH, principal) +} + +module.exports = { + methodology: + 'TVL is the native ETH held by UFG treasury v1 and the sfrxETH held by UFG treasury v2 on Robinhood Chain. Holders of $UFG can burn the token to redeem a pro-rata share of both treasuries. Borrowed is the sfrxETH principal that treasury v2 has lent against $UFG collateral.', + start: '2026-08-30', + robinhood: { tvl, borrowed }, +} From 69d7bed312cfbc9245666651cd86fcc3ff68ce4c Mon Sep 17 00:00:00 2001 From: KalMydas Date: Wed, 30 Sep 2026 08:12:41 +0200 Subject: [PATCH 005/988] Kal Mydas: count both vault generations and both KalSwap markets during migration (#21249) Co-authored-by: ccipherx --- projects/kalmydas/index.js | 83 +++++++++++++++++++++++++++++++++++ projects/treasury/kalmydas.js | 68 +++++++++++++++++++++++----- registries/sumTokens/data3.js | 7 --- 3 files changed, 141 insertions(+), 17 deletions(-) create mode 100644 projects/kalmydas/index.js diff --git a/projects/kalmydas/index.js b/projects/kalmydas/index.js new file mode 100644 index 00000000000..f236325aa41 --- /dev/null +++ b/projects/kalmydas/index.js @@ -0,0 +1,83 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const USDC = ADDRESSES.base.USDC +const WETH = ADDRESSES.optimism.WETH_1 +const KAL = '0xe99556D5594faf533fcB346A8a9B11259D29afA8' + +// KalPool strategy vaults, generations V5_1_4 and V5_2_0 (both live during the migration) +const VAULTS = [ + // V5_1_4 + '0x96869F08F5B5C52664c9620269394eFF4efd065b', // HORIZON + '0x6dd6e7A6154293b22Dcd5d07d8f61F446646B15d', // VALKYRIE + '0x9A9990fdFf702f7aEd10f873eeD2baB60e493038', // REVOLUTION + '0x03FEC25393C38cC5DE1F2D2DB620b8478cAC4Ae0', // TREASURY + '0x55F8D85749EA9C374b3aBFaEF7B07429546F6A97', // ORION + // V5_2_0 + '0xd647F01EDb2e327E4928F84C1be05eaC83c29326', + '0xeC0F2B417741BF827d7ead53f0a9722847b6aB2d', + '0xC04A2FbE7816Db5bF33b45D25c0F813b2BF67717', + '0x887e1787684879Ab4Aa3544C4eAeA394E8da8dBf', // REVOLUTION + '0xf5aC77495227741CeB696d43Cd0fD4Ed83F73Bf8', // TREASURY + '0x9b87C7075ca523a160F6e9657dDEedb263CFa3c2', // ORION + '0x7393819B67A4f70C307831B114Ca5f5e224bebF1', +] + +// KalSwap USDC/WETH market: not farmed with KAL, counted as tvl +const USDC_WETH_PAIR = '0x83c26f5C90B81adDf50845CCFCdcd02B819ADeB5' + +// KalSwap markets paired with KAL, farmed in LiquidityRewards: pool2 +const KAL_PAIRS = [ + '0x3315E6E788E2B30aF8f4c35124695E60D510c31B', // KAL/USDC, KalSwap V2 + '0x1FaC3B6a11C441Dd1535deB4c1140a7D01fB8E98', // KAL/USDC, KalSwap V3 + '0xEA071fa5a8aD4dEa8c672569da366D7d90E5924d', // KAL/WETH +] + +// Aerodrome KAL/USDC pool is counted by Aerodrome; only the LP staked in KalAeroLPStaking is pool2 +const AERO_KAL_USDC = '0x65e8d79D0103A470e92A81F2cDB970bA9a823b9E' +const AERO_LP_STAKING = '0x8E5176e0B020C3a8D33425E2B5b62e12EB39f11d' + +// Single-side KAL staking and veKAL +const STAKING = [ + '0xF392A8F1B6c85f607F988B44EcAE2B4d652585f5', + '0x590f7d2ba77ADac6fC1e3cc2df16781989919529', + '0x58CfcB5A67Aac6255cA13771EbdCFF45bAd5d605', +] + +async function tvl(api) { + // Each vault holds depositors' USDC plus the platform reserve (reserveBalance). + // Part of the reserve can be out with the trading operator (operatorBalance), + // so the reserve still sitting in the vault is reserveBalance - operatorBalance. + // That part is protocol-owned and is reported in the Kal Mydas treasury adapter. + const balances = await api.multiCall({ abi: 'erc20:balanceOf', target: USDC, calls: VAULTS }) + // vaults not yet deployed at this block hold no USDC and revert on the getters, so skip empty ones + const funded = VAULTS.map((vault, i) => ({ vault, held: BigInt(balances[i]) })).filter(v => v.held > 0n) + const calls = funded.map(v => v.vault) + const [reserves, operatorBalances] = await Promise.all([ + api.multiCall({ abi: 'uint256:reserveBalance', calls }), + api.multiCall({ abi: 'uint256:operatorBalance', calls }), + ]) + funded.forEach(({ held }, i) => { + const reserveInVault = BigInt(reserves[i]) - BigInt(operatorBalances[i]) + const userUSDC = held - (reserveInVault > 0n ? reserveInVault : 0n) + if (userUSDC > 0n) api.add(USDC, userUSDC.toString()) + }) + return api.sumTokens({ owner: USDC_WETH_PAIR, tokens: [USDC, WETH] }) +} + +async function pool2(api) { + await api.sumTokens({ owners: KAL_PAIRS, tokens: [USDC, WETH, KAL] }) + // the Aerodrome LP token reverts before the pool was deployed, when it held no USDC + const aeroUSDC = await api.call({ abi: 'erc20:balanceOf', target: USDC, params: AERO_KAL_USDC }) + if (BigInt(aeroUSDC) === 0n) return api.getBalances() + return sumTokens2({ api, owner: AERO_LP_STAKING, tokens: [AERO_KAL_USDC], resolveLP: true }) +} + +module.exports = { + methodology: 'TVL is the USDC deposited by users in the KalPool strategy vaults (vault USDC balance minus the platform reserve still held in the vault, reserveBalance - operatorBalance) plus the USDC and WETH in the KalSwap USDC/WETH market, on Base. Both vault generations (V5_1_4 and V5_2_0) are counted during the migration. The platform reserve is protocol-owned trading capital and is reported in the Kal Mydas treasury. KalSwap markets paired with KAL and the Aerodrome KAL/USDC LP staked in the Kal Mydas Aerodrome LP staking are farmed for KAL rewards and reported under pool2. KAL staked single-side and KAL locked in veKAL are reported under staking.', + base: { + tvl, + pool2, + staking: (api) => api.sumTokens({ owners: STAKING, tokens: [KAL] }), + }, +} diff --git a/projects/treasury/kalmydas.js b/projects/treasury/kalmydas.js index ec047dfb013..a764469f48f 100644 --- a/projects/treasury/kalmydas.js +++ b/projects/treasury/kalmydas.js @@ -1,20 +1,68 @@ const { treasuryExports } = require('../helper/treasury') const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') // Kal Mydas protocol treasury on Base mainnet. // - Gnosis Safe multisig (protocol treasury: USDC, KAL) // - TreasuryRWAV2 (tokenized gold and bitcoin reserve, being funded) // - RainyDayFund (emergency reserve) +// - Protocol KAL held by the presale, airdrop, referral and depositor bonus contracts (ownTokens) +// - Platform reserve held inside the KalPool strategy vaults (reserveBalance - operatorBalance), +// excluded from the Kal Mydas protocol TVL const KAL = '0xe99556D5594faf533fcB346A8a9B11259D29afA8' +const USDC = ADDRESSES.base.USDC -module.exports = treasuryExports({ - base: { - owners: [ - '0x55a7645F04CEbCE3eb706D441cB649fFDe4D5027', // Gnosis Safe multisig - '0x4f1F316e76d8E8637006eF246E9dD6dc3b4680C1', // TreasuryRWAV2 - '0xD1795dD0Cfe169E4dE601469C07E0c4884aD251f', // RainyDayFund - ], - tokens: [ADDRESSES.base.USDC, ADDRESSES.base.WETH], - ownTokens: [KAL], - }, +const VAULTS = [ + '0x96869F08F5B5C52664c9620269394eFF4efd065b', + '0x6dd6e7A6154293b22Dcd5d07d8f61F446646B15d', + '0x9A9990fdFf702f7aEd10f873eeD2baB60e493038', + '0x03FEC25393C38cC5DE1F2D2DB620b8478cAC4Ae0', + '0x55F8D85749EA9C374b3aBFaEF7B07429546F6A97', + '0xd647F01EDb2e327E4928F84C1be05eaC83c29326', + '0xeC0F2B417741BF827d7ead53f0a9722847b6aB2d', + '0xC04A2FbE7816Db5bF33b45D25c0F813b2BF67717', + '0x887e1787684879Ab4Aa3544C4eAeA394E8da8dBf', + '0xf5aC77495227741CeB696d43Cd0fD4Ed83F73Bf8', + '0x9b87C7075ca523a160F6e9657dDEedb263CFa3c2', + '0x7393819B67A4f70C307831B114Ca5f5e224bebF1', +] + +async function vaultReserves(api) { + const balances = await api.multiCall({ abi: 'erc20:balanceOf', target: USDC, calls: VAULTS }) + // vaults not yet deployed at this block hold no USDC and revert on the getters, so skip empty ones + const funded = VAULTS.map((vault, i) => ({ vault, held: BigInt(balances[i]) })).filter(v => v.held > 0n) + const calls = funded.map(v => v.vault) + const [reserves, operatorBalances] = await Promise.all([ + api.multiCall({ abi: 'uint256:reserveBalance', calls }), + api.multiCall({ abi: 'uint256:operatorBalance', calls }), + ]) + funded.forEach(({ held }, i) => { + let reserveInVault = BigInt(reserves[i]) - BigInt(operatorBalances[i]) + if (reserveInVault > held) reserveInVault = held + if (reserveInVault > 0n) api.add(USDC, reserveInVault.toString()) + }) + return api.getBalances() +} + +const exportsObj = treasuryExports({ + base: { + owners: [ + '0x55a7645F04CEbCE3eb706D441cB649fFDe4D5027', // Gnosis Safe multisig + '0x4f1F316e76d8E8637006eF246E9dD6dc3b4680C1', // TreasuryRWAV2 + '0xD1795dD0Cfe169E4dE601469C07E0c4884aD251f', // RainyDayFund + ], + tokens: [ADDRESSES.base.USDC, ADDRESSES.base.WETH], + ownTokens: [KAL], + ownTokenOwners: [ + '0x6466C5042669f8d6D7f0c725B51cD2650d1E1b9A', // KAL presale (unsold KAL) + '0xB04E37e0568873f29f3666E3b94810B6CeA4Ee57', // KAL airdrop reserve + '0xadEd1b00159fABCefd111bA97E64875B8c82a21A', // referral rewards reserve + '0x2F437493a8899bBd3B7dB41597d9f2695B7070c9', // KalPoolRewardsV3, depositor KAL bonus reserve + '0x5dEE301aD9290DC5BAFa8cC6F6e359bDDF5356ea', // KalPoolRewardsV2 (previous generation) + ], + }, }) + +exportsObj.base.tvl = sdk.util.sumChainTvls([exportsObj.base.tvl, vaultReserves]) + +module.exports = exportsObj diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 29003c18f65..7fd1a94b198 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -771,13 +771,6 @@ module.exports = { "tvl": { "owners": ["0x46363C31Be0c677Bd6F3eD429686753794ee8b97"], "tokens": [ADDRESSES.bitrock.BR] }, }, }, - "kalmydas": { - "methodology": "TVL is the sum of tokens (USDC, WETH, KAL) held by the KalSwap liquidity pairs plus the USDC held by the five KalPool strategy vaults (deposits and platform reserve) on Base mainnet. USDC temporarily allocated to the on-chain operator (max 20% of each vault reserve) leaves the vaults while a trade is open and returns on close. KAL staked single-side and KAL locked in veKAL are reported under staking.", - "base": { - "tvl": { "owners": ["0x3315E6E788E2B30aF8f4c35124695E60D510c31B","0xEA071fa5a8aD4dEa8c672569da366D7d90E5924d","0x83c26f5C90B81adDf50845CCFCdcd02B819ADeB5","0x96869F08F5B5C52664c9620269394eFF4efd065b","0x6dd6e7A6154293b22Dcd5d07d8f61F446646B15d","0x9A9990fdFf702f7aEd10f873eeD2baB60e493038","0x03FEC25393C38cC5DE1F2D2DB620b8478cAC4Ae0","0x55F8D85749EA9C374b3aBFaEF7B07429546F6A97"], "tokens": [ADDRESSES.base.USDC,ADDRESSES.optimism.WETH_1,"0xe99556D5594faf533fcB346A8a9B11259D29afA8"] }, - "staking": { "owners": ["0xF392A8F1B6c85f607F988B44EcAE2B4d652585f5","0x58CfcB5A67Aac6255cA13771EbdCFF45bAd5d605"], "tokens": ["0xe99556D5594faf533fcB346A8a9B11259D29afA8"] }, - }, - }, "sfi": { "ethereum": { "tvl": { "owners": ["0xd8831608954c7C4044938aC76E32dA81d692f0a6"], "tokens": ["0x018008bfb33d285247A21d44E50697654f754e63","0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c","0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a"] }, From 870a3cb1dc220281c588049f07b1ffdda8a1be36 Mon Sep 17 00:00:00 2001 From: bzhong <91816179+bzhongy@users.noreply.github.com> Date: Wed, 30 Sep 2026 16:18:04 +1000 Subject: [PATCH 006/988] thetanuts: count WheelVaults on Base, Ethereum, HyperEVM and Robinhood (#21327) Co-authored-by: ccipherx --- projects/thetanuts/index.js | 47 ++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/projects/thetanuts/index.js b/projects/thetanuts/index.js index 56efeb6d727..23375ecf31d 100644 --- a/projects/thetanuts/index.js +++ b/projects/thetanuts/index.js @@ -179,7 +179,8 @@ const univ3nft_arb = '0xC36442b4a4522E871399CD717aBDD847Ab11FE88' const stMatic = '0x83b874c1e09D316059d929da402dcB1A98e92082' module.exports = { - methodology: `Funds deposited into Thetanuts Finance via the Basic Vaults, Lending Market, and AMM are calculated as TVL.`, + methodology: `Funds deposited into Thetanuts Finance via the Basic Vaults, Lending Market, AMM and the WheelVaults (base and quote tokens held by each vault, including its Uniswap V3 positions and Aave deposits) are calculated as TVL. WheelVaults pairing the NUTS token are counted under pool2.`, + doublecounted: true, hallmarks: [ ['2022-03-07', 'Migration from v0 to v1'], ['2022-09-29', 'Migration from v1 to v2'], @@ -331,12 +332,46 @@ const config = { } } -Object.keys(config).forEach(chain => { - const { tokensAndOwners, uniV3Owners } = config[chain] +const NUTS = '0x23f3D4625AEF6f0b84d50dB1d53516e6015c0c9B' +const TOTAL_ASSETS = 'function totalAssets() view returns (uint256 totalBaseAmt, uint256 totalQuoteAmt, uint256 totalValue)' +const M_FACTORY = '0x42c059Bf54553957ca4b8BeA67fcf43424C03A92' +const N_FACTORY = '0x35C452E9f97A75558334E0df305598E930fc0B00' + +const wheelVaultFactories = { + base: [M_FACTORY, N_FACTORY], + ethereum: [M_FACTORY, N_FACTORY], + hyperliquid: [M_FACTORY, N_FACTORY], + robinhood: ['0x32Ca533CE6C107296991bE889551e75892B18e00'], +} + +async function wheelVaultTvl(api, factories, isPool2 = false) { + const counts = await api.multiCall({ abi: 'uint256:vaultCount', calls: factories }) + const calls = [] + factories.forEach((target, i) => { for (let j = 0; j < Number(counts[i]); j++) calls.push({ target, params: [j] }) }) + const vaults = await api.multiCall({ abi: 'function vaults(uint256) view returns (address)', calls }) + if (!vaults.length) return + const [bases, quotes, assets] = await Promise.all([ + api.multiCall({ abi: 'address:base', calls: vaults }), + api.multiCall({ abi: 'address:quote', calls: vaults }), + api.multiCall({ abi: TOTAL_ASSETS, calls: vaults }), + ]) + vaults.forEach((_, i) => { + // vaults pairing the protocol's own token go to pool2 + if ([bases[i], quotes[i]].some(t => t.toLowerCase() === NUTS.toLowerCase()) !== isPool2) return + api.add(bases[i], assets[i].totalBaseAmt) + api.add(quotes[i], assets[i].totalQuoteAmt) + }) +} + +new Set([...Object.keys(config), ...Object.keys(wheelVaultFactories)]).forEach(chain => { + const { tokensAndOwners, uniV3Owners } = config[chain] || {} module.exports[chain] = { tvl: async (api) => { - if (uniV3Owners) await sumTokens2({ api, owners: uniV3Owners, resolveUniV3: true }) - return sumTokens2({ api, tokensAndOwners }) - } + if (uniV3Owners) await sumTokens2({ api, owners: uniV3Owners, resolveUniV3: true }) + if (tokensAndOwners) await sumTokens2({ api, tokensAndOwners }) + if (wheelVaultFactories[chain]) await wheelVaultTvl(api, wheelVaultFactories[chain]) + } } }) + +module.exports.ethereum.pool2 = (api) => wheelVaultTvl(api, wheelVaultFactories.ethereum, true) From 113422761fa5632d2aeaafcd42f274c52a156925 Mon Sep 17 00:00:00 2001 From: Hyperfolio-io Date: Wed, 30 Sep 2026 14:23:45 +0800 Subject: [PATCH 007/988] Add Hyperfolio TVL adapter (#21325) Co-authored-by: ccipherx --- projects/hyperfolio/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/hyperfolio/index.js diff --git a/projects/hyperfolio/index.js b/projects/hyperfolio/index.js new file mode 100644 index 00000000000..5d3642e461f --- /dev/null +++ b/projects/hyperfolio/index.js @@ -0,0 +1,17 @@ +const FARM = '0x210Ce7DCB6a068152163D41CD48c9936B29BAb96' + +const abi = { + getAllPoolIds: 'uint256[]:getAllPoolIds', + getPoolInfo: 'function getPoolInfo(uint256) view returns (address asset, address receiptToken, uint256 apy, uint256 decimals, address vault, bool active, uint256 accRewardPerShare, uint256 lastRewardTime)', +} + +async function tvl(api) { + const pids = await api.call({ abi: abi.getAllPoolIds, target: FARM }) + const pools = await api.multiCall({ abi: abi.getPoolInfo, target: FARM, calls: pids }) + return api.sumTokens({ tokensAndOwners: pools.map(p => [p.asset, p.vault]) }) +} + +module.exports = { + methodology: 'Counts the deposit tokens held by each Hyperfolio pool vault, discovered on-chain from the farm contract.', + hyperliquid: { tvl }, +} From c891a273330bac917d583d286527fd4bb17a94cc Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 30 Sep 2026 14:32:56 +0800 Subject: [PATCH 008/988] fix: include all navi markets for tvl calculation (#21331) Co-authored-by: Claude --- projects/navi/index.js | 59 ++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/projects/navi/index.js b/projects/navi/index.js index 9ec651667a3..0ef4a2c0727 100644 --- a/projects/navi/index.js +++ b/projects/navi/index.js @@ -5,16 +5,51 @@ function getDecimalShifts(dynamicFields){ return fetchURL(`https://coins.llama.fi/prices/current/${dynamicFields.map(c=>`sui:0x${c.fields.value.fields.coin_type}`).join(',')}`).then(r=>r.data.coins) } -const storageId = "0xbb4e2f4b6205c2e2a2db47aeb4f830796ec7c005f88537ee775986639bc442fe" +const NAVI_API = 'https://open-api.naviprotocol.io/api/navi' -async function borrow(api) { - const storageObject = await sui.getObject(storageId); - const reservesId = storageObject.fields.reserves.fields.id.id +// Known market storages, used when the NAVI config API is unavailable +const fallbackStorageIds = [ + "0xbb4e2f4b6205c2e2a2db47aeb4f830796ec7c005f88537ee775986639bc442fe", // main + "0xc2b6a52f0da7f91389eaffe4f68f4cacee43aa616bb8a4371118eafaf07cdd90", // ember + "0x199c1d5c2d58a4b05bbfa2338d02ad2676572a8a59ac148a5475b5c0fc53ed9f", // rwa + "0xdf18372bc9c588b96c7553bc811467a9166ed9be472b40cb45c226175377c558", // sui-eco + "0x51c5ad179214eb5e170dd93ba6f9b15948002caf85f7e2b091ef46d2dc2ce5b6", // sui-usdc + "0x79db6cdbfb59a067be7d78c1003079f56d817ac33b5d372b3165daf09f31ed69", // wbtc-usdc + "0x7db5c000524bfe55bb2bc343886f29eabc38f706dc1655900055fa5b60ee00a5", // xbtc-usdc + "0x35fecf669e7794ad25d289c2a23f065e518351acae09c5032d7237e185257924", // vsui-usdc + "0xafb982de1a436b1cc8a14ecd2d787762599b65d3a6b75b84b10939b1e17d9381", // vsui-sui + "0x6b945adccadf11cd7ec39f8c2c225a4267004a74587871cac86f9fa3dbf3be63", // hasui-sui + "0x2056ca72f7c81c3fb6b3a6eea117368cad7fb0c9caa4e2a7b51ee913e9e5deb9", // high-usdc +] + +// Storage objects of every NAVI lending market, so newly launched markets are picked up automatically +async function getStorageIds() { + try { + const markets = await fetchURL(`${NAVI_API}/markets?env=prod`).then(r => r.data.data.markets) + const configs = await Promise.all(markets.map(m => fetchURL(`${NAVI_API}/config?env=prod&market=${m.key}`).then(r => r.data.data))) + const storageIds = configs.map(c => c.storage).filter(Boolean) + if (storageIds.length) return storageIds + } catch (e) { + console.log('navi: config API unavailable, using fallback storage list', e.message) + } + return fallbackStorageIds +} + +async function getReserves() { + const storageObjects = await sui.getObjects(await getStorageIds()) + const reserves = [] + for (const storageObject of storageObjects) { + const reservesId = storageObject.fields.reserves.fields.id.id + reserves.push(...await sui.getDynamicFieldObjects({ parent: reservesId })) + } + const decimals = await getDecimalShifts(reserves) + return { reserves, decimals } +} - const dynamicFields = await sui.getDynamicFieldObjects({ parent: reservesId }) - const decimals = await getDecimalShifts(dynamicFields) +async function borrow(api) { + const { reserves, decimals } = await getReserves() - dynamicFields.forEach((data) => { + reserves.forEach((data) => { const coin = '0x' + data.fields.value.fields.coin_type const borrowed = data.fields.value.fields.borrow_balance.fields.total_supply * data.fields.value.fields.current_borrow_index / 1e27 if(decimals["sui:"+coin]){ @@ -26,13 +61,9 @@ async function borrow(api) { async function tvl(api) { - const storageObject = await sui.getObject(storageId); - const reservesId = storageObject.fields.reserves.fields.id.id + const { reserves, decimals } = await getReserves() - const dynamicFields = await sui.getDynamicFieldObjects({ parent: reservesId }) - const decimals = await getDecimalShifts(dynamicFields) - - dynamicFields.forEach(object => { + reserves.forEach(object => { const coin = '0x' + object.fields.value.fields.coin_type const total_supply = object.fields.value.fields.supply_balance.fields.total_supply * object.fields.value.fields.current_supply_index / 1e27 const borrowed = object.fields.value.fields.borrow_balance.fields.total_supply * object.fields.value.fields.current_borrow_index / 1e27 @@ -50,4 +81,4 @@ module.exports = { tvl, borrowed: borrow, }, -} \ No newline at end of file +} From 35974b8f0a0df6f3609b4d452af81cc3f50fed70 Mon Sep 17 00:00:00 2001 From: Dani Date: Wed, 30 Sep 2026 08:37:01 +0200 Subject: [PATCH 009/988] loopscale-curation: add Loopscale Asset Curation (resolves #21322) (#21332) Co-authored-by: Luke Co-authored-by: Luke Truitt <38018183+luke-truitt@users.noreply.github.com> Co-authored-by: Luke --- projects/loopscale-curation/index.js | 91 ++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 projects/loopscale-curation/index.js diff --git a/projects/loopscale-curation/index.js b/projects/loopscale-curation/index.js new file mode 100644 index 00000000000..8ef5a81996c --- /dev/null +++ b/projects/loopscale-curation/index.js @@ -0,0 +1,91 @@ +const { PublicKey } = require('@solana/web3.js') +const bs58 = require('bs58').default || require('bs58') +const ADDRESSES = require('../helper/coreAssets.json') +const { getConnection } = require('../helper/solana') + +const EXPONENT_VAULTS_PROGRAM = new PublicKey('sVau1tXvayVWfotzm9Ahcv2qfnnfRWttt78BCnNC6dD') +const STRATEGY_VAULT_DISCRIMINATOR = Buffer.from([98, 228, 39, 201, 116, 210, 39, 11]) +// Loopscale Asset Curation's key in the vault's roles.curator +const LOOPSCALE_CURATOR = 'bs1PuRvB9rBBZkryBjADYvxc2qYh51EVW2fsb1uTiBN' +const LOOPSCALE_CURATOR_BYTES = new PublicKey(LOOPSCALE_CURATOR).toBuffer() + +// Exponent's synthetic quote mints (same mapping as exponent-v2) +const SYNTHETIC_MINT_MAP = { + 'USD1111111111111111111111111111111111111111': ADDRESSES.solana.USDC, + 'USD1111111111111111111111111111111111111119': 'DEkqHyPN7GMRJ5cArtQFAWefqbZb33Hyf6s5iCwjEonT', // USDe +} + +// Layout from the exponent SDK's ExponentStrategyVault codec; enum tags are u8, vec lengths u32 +function decodeVault(data) { + if (!data.subarray(0, 8).equals(STRATEGY_VAULT_DISCRIMINATOR)) + throw new Error('unexpected ExponentStrategyVault discriminator') + + let offset = 8 + const skip = (n) => { offset += n } + const u8 = () => data.readUInt8(offset++) + const u32 = () => { const v = data.readUInt32LE(offset); offset += 4; return v } + const u64 = () => { const v = data.readBigUInt64LE(offset); offset += 8; return v } + const pubkey = () => { const v = new PublicKey(data.subarray(offset, offset + 32)).toString(); offset += 32; return v } + const vec = (readItem) => Array.from({ length: u32() }, () => readItem()) + const priceId = () => { + const kind = u8() + if (kind === 0) skip(8) // Simple(u64) + else if (kind === 1) skip(u32() * 8) // Multiply(vec) + else throw new Error(`unknown Exponent PriceId variant ${kind}`) + } + const strategyPosition = () => { + const kind = u8() + switch (kind) { + case 0: skip(32 + 4 + 32); skip(u32() * 4); priceId(); priceId(); skip(32); break // Orderbook + case 1: skip(32); vec(() => { skip(32); priceId(); skip(8) }); break // TokenAccount + case 2: // Obligation + if (u8() !== 0) throw new Error('unknown Exponent ObligationType variant') + skip(32 + 32); priceId(); vec(() => { skip(32); priceId() }); skip(u32() * 65); skip(1); break + case 3: case 4: skip(32 + 32); priceId(); priceId(); break // YieldPosition, ClmmPosition + case 5: case 6: case 8: skip(32); break // LoopscaleLoan, LoopscaleStrategy, OrcaWhirlpoolPosition + case 7: skip(32 + 32); break // KaminoFarm + case 9: skip(32 + 8); break // LoopscaleVaultStake + default: throw new Error(`unknown Exponent StrategyPosition variant ${kind}`) + } + } + + skip(32 + 32 + 32) // navAumCircuitBreakerState, squadsSettings, squadsVault + vec(() => { skip(32); priceId(); skip(32 + 32 + 8); skip(u32() * 8) }) // tokenEntries + const underlyingMint = pubkey() + skip(32 + 32 + 2 + 32 + 32 + 1) // mintLp, tokenLpEscrow, normalWithdrawalCutBp, feeTreasury, selfAddress, signerBump + const statusFlags = u8() + skip(8) // financials.lpBalance + const aum = u64() + u64() // aumInBase + aumInBaseInPositions + skip(72) // rest of financials + vec(strategyPosition) + skip(8 + 8) // maxAumSupply, seedId + vec(pubkey) // roles.manager + const curators = vec(pubkey) + + return { underlyingMint, statusFlags, aum, curators } +} + +async function tvl(api) { + const accounts = await getConnection().getProgramAccounts(EXPONENT_VAULTS_PROGRAM, { + filters: [{ memcmp: { offset: 0, bytes: bs58.encode(STRATEGY_VAULT_DISCRIMINATOR) } }], + }) + + let vaultCount = 0 + for (const { account } of accounts) { + if (!account.data.includes(LOOPSCALE_CURATOR_BYTES)) continue // skip other curators' vaults before decoding + const { underlyingMint, statusFlags, aum, curators } = decodeVault(account.data) + if (!curators.includes(LOOPSCALE_CURATOR)) continue + vaultCount++ + if (statusFlags === 8) continue // inactive, hidden in the UI (as in exponent-v2) + api.add(SYNTHETIC_MINT_MAP[underlyingMint] || underlyingMint, aum) + } + if (!vaultCount) throw new Error('no Loopscale-curated Exponent vaults found') +} + +module.exports = { + timetravel: false, + doublecounted: true, // vault deposits deploy into Loopscale markets and Exponent, both counted by their own adapters + methodology: + 'TVL is the sum of AUM (idle assets plus deployed positions, denominated in each vault\'s underlying asset) across the Exponent strategy vaults whose curator role is Loopscale Asset Curation, read from the on-chain vault accounts.', + solana: { tvl }, +} From 817b82c1660f7258a598c3c4aee46b7aae093986 Mon Sep 17 00:00:00 2001 From: Dani Date: Wed, 30 Sep 2026 08:39:23 +0200 Subject: [PATCH 010/988] napier: add Robinhood Chain (#21333) Co-authored-by: Ammar Robbani --- projects/napier/v2.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/napier/v2.js b/projects/napier/v2.js index 9b3e95046ee..cee711977e0 100644 --- a/projects/napier/v2.js +++ b/projects/napier/v2.js @@ -55,6 +55,11 @@ const config = { factory: "0x00000081e37a462F3137C944D6bf2527eD6Afb01", fromBlock: 2376497, }, + robinhood: { + factory: "0x0000001afbCA1E8CF82fe458B33C9954A65b987B", + tokiLens: "0x00000031F662013D68E6CD0ceFe97043AE0ac5b8", + fromBlock: 63550958, + }, }; async function tvl(api) { From 579ffe3846f2b84b0bdf8137df18b9deec3b9858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Wed, 30 Sep 2026 02:41:58 -0400 Subject: [PATCH 011/988] Add Monad for Sharpbyte Capital (#21316) --- registries/curators.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/registries/curators.js b/registries/curators.js index 4e5e1b84391..d1a81ead130 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -96,6 +96,11 @@ const configs = { fluent: { upshiftV2: ['0xeaB765200189909c806FD6e20eBb4E57D6703C82'], // Nerona Dollar Yield Strategy }, + monad: { + morphoVaultOwners: [ + '0x07A1eC352EF67BB5b8b75A7fF9540b27f9a53d71', + ], + } } }, }, From 29b823c10195360e61e7bad75510fe3578458ed2 Mon Sep 17 00:00:00 2001 From: Doppi Finance Date: Wed, 30 Sep 2026 15:42:25 +0900 Subject: [PATCH 012/988] update doppi finance tvl address (#21306) --- projects/doppifinance/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/doppifinance/index.js b/projects/doppifinance/index.js index ff81376af29..40267655cc7 100644 --- a/projects/doppifinance/index.js +++ b/projects/doppifinance/index.js @@ -1,9 +1,9 @@ const ADDRESSES = require("../helper/coreAssets.json"); const { sumTokens2 } = require("../helper/unwrapLPs"); -const doppiCore = ['0x13073F01791C01Fd6b73fc1B9558B7944f9a0D7e', '0xa2d49d1c8b89Cd0b11AeA445887661CDcF9e9611', '0x8532f74529F4295f882f73Cd3D3cCfBcD6900e08'] -const doppiLP = ['0x3Df1Eb646f4B39441d73AdbFE6e14710f5877CDE', '0x2deB22F6fCFE371c5024b52045850d9B32d33Bcd', '0x9b0e4260311a8874a0f7EeDB9545e93960e113c6'] -const doppiTraderFactory = ['0x10696950310D6A42C995E293d10c7BaE7cbeF4B8', '0x413136f02F8ab63D07DFD1f561B81E68e7101D7a', '0x2803394A973d22F6bd3Ac541e80B3d599de578A5', '0xc5a5DfF727C1B8a918B175574ed55DDeD7415f44', '0x095e4C543839c3C0403DbC5AA8acC259689A419C', '0xAB0a39Ee19797E273c94737100D811498Bf2e75E'] +const doppiCore = ['0x13073F01791C01Fd6b73fc1B9558B7944f9a0D7e', '0xa2d49d1c8b89Cd0b11AeA445887661CDcF9e9611', '0x8532f74529F4295f882f73Cd3D3cCfBcD6900e08', '0x469362685d424C458e3CeDF5F293a746932bBc26'] +const doppiLP = ['0x3Df1Eb646f4B39441d73AdbFE6e14710f5877CDE', '0x2deB22F6fCFE371c5024b52045850d9B32d33Bcd', '0x9b0e4260311a8874a0f7EeDB9545e93960e113c6', '0x9CaA7f14aafC28Ab6e3e2b47362211c1862D30C6'] +const doppiTraderFactory = ['0x10696950310D6A42C995E293d10c7BaE7cbeF4B8', '0x413136f02F8ab63D07DFD1f561B81E68e7101D7a', '0x2803394A973d22F6bd3Ac541e80B3d599de578A5', '0xc5a5DfF727C1B8a918B175574ed55DDeD7415f44', '0x095e4C543839c3C0403DbC5AA8acC259689A419C', '0xAB0a39Ee19797E273c94737100D811498Bf2e75E', '0x95B6758a05B6CE9aE4E14f579e959eE5471f6d5D', '0x7aF174BEddb1059d6f31a60f35Ea4911D6447A07', '0x2C71cd52B60979126Db275D278612b33e5aAbc1d'] const excludeBots = ['0x3A296c9191e7698091661C337b68b5E7B18Ed610'].map(i => i.toLowerCase()); From 12606bb3f35673d2a26a5a1521852d93a05aa93a Mon Sep 17 00:00:00 2001 From: hattonjey-256 Date: Wed, 30 Sep 2026 03:30:24 -0400 Subject: [PATCH 013/988] Add FAZE launchpad TVL on Arc (#21323) Co-authored-by: ccipherx --- projects/faze/abi.json | 6 ++++ projects/faze/index.js | 55 +++++++++++++++++++++++++++++++++++ projects/faze/positionMath.js | 16 ++++++++++ 3 files changed, 77 insertions(+) create mode 100644 projects/faze/abi.json create mode 100644 projects/faze/index.js create mode 100644 projects/faze/positionMath.js diff --git a/projects/faze/abi.json b/projects/faze/abi.json new file mode 100644 index 00000000000..f29b2b34674 --- /dev/null +++ b/projects/faze/abi.json @@ -0,0 +1,6 @@ +{ + "Launched": "event Launched(address indexed token, address indexed creator, (uint256 bondingTarget,uint16 feeBps,uint16 migrationFeeBps,address migrator,bool active,uint16 launchSellFeeBps,uint32 launchSellFeeDecay,uint16 poolFeeBps,bool compounding,uint16 launchBuyFeeBps,uint32 launchBuyFeeDecay,uint16 compoundCommitBps,bool creatorCurveFees,address quoteToken,uint32 sniperTaxWindow) terms, string name, string symbol, string tokenURI)", + "PoolRegistered": "event PoolRegistered(bytes32 indexed poolId, address indexed asset, address indexed creator, uint16 feeBps, uint16 launchSellFeeBps, uint32 launchSellFeeDecay, uint16 launchBuyFeeBps, uint32 launchBuyFeeDecay, uint16 compoundCommitBps, address quote)", + "Compounded": "event Compounded(bytes32 indexed poolId, int24 tickLower, int24 tickUpper, uint256 quoteAdded, uint128 liquidity)", + "getCoin": "function getCoin(address token) view returns ((address creator,address devBuyer,address migrator,address quoteToken,uint16 feeBps,uint16 migrationFeeBps,bool complete,bool graduated,bool active,bool abandoned,bool creatorCurveFees,uint16 poolFeeBps,uint16 launchSellFeeBps,uint32 launchSellFeeDecay,uint16 launchBuyFeeBps,uint32 launchBuyFeeDecay,uint16 compoundCommitBps,uint32 sniperTaxWindow,uint64 openedAt,uint64 completedAt,uint256 ethOffset,uint256 ethReserve,uint256 tokenReserve,uint256 bondingTarget,uint256 accrued) )" +} diff --git a/projects/faze/index.js b/projects/faze/index.js new file mode 100644 index 00000000000..590bf759c73 --- /dev/null +++ b/projects/faze/index.js @@ -0,0 +1,55 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const ABI = require('./abi.json') +const { quoteAmount } = require('./positionMath') + +// FAZE release 9, September 13, 2026. Verified sources at explorer.arc.io/address/
?tab=contract. +const CURVE = '0x6A62919ccbf0c19e0C4e084F986b582b4492dDA4' +const HOOK = '0x47e7936ae9891e61C5123db720593c05dE7120cc' +const MIGRATOR = '0x7c8dE42426A058B778DCe8530537cd62eF0178C4' +const POSITIONS = '0x6049c9a0e26405C0985f9E3685C87d0aE917f82B' +const VIEW = '0xF3334192D15450CdD385c8B70e03f9A6bD9E673b' +const FAZE = '0x394d38f807ee0027a182216f5e67a15ae441fa2e' +const DEAD = '0x000000000000000000000000000000000000dead' +const START_BLOCK = 20561244 + +async function tvl(api) { + // extraKey keeps the two hook event caches apart; getLogs2 caches per target otherwise + const discover = (target, eventAbi, extraKey) => getLogs2({ api, target, eventAbi, fromBlock: START_BLOCK, extraKey }) + const launches = await discover(CURVE, ABI.Launched, 'launched') + const pools = await discover(HOOK, ABI.PoolRegistered, 'pools') + const compounds = await discover(HOOK, ABI.Compounded, 'compounds') + const coins = launches.length ? await api.multiCall({ target: CURVE, abi: ABI.getCoin, calls: launches.map(l => l.token) }) : [] + const isCore = (asset, quote) => asset.toLowerCase() !== FAZE && quote.toLowerCase() !== FAZE + launches.forEach((l, i) => { + if (isCore(l.token, l.terms.quoteToken)) api.add(l.terms.quoteToken, coins[i].ethReserve) + }) + if (!pools.length) return + + const ids = await api.multiCall({ target: MIGRATOR, abi: 'function positionTokenIds(bytes32) view returns (uint256)', calls: pools.map(p => p.poolId) }) + if (ids.some(id => BigInt(id) === 0n)) throw new Error('FAZE pool missing its graduation NFT') + const owners = await api.multiCall({ target: POSITIONS, abi: 'function ownerOf(uint256) view returns (address)', calls: ids }) + if (owners.some(owner => owner.toLowerCase() !== DEAD)) throw new Error('FAZE graduation NFT is not permanently locked') + const prices = await api.multiCall({ target: VIEW, abi: 'function getSlot0(bytes32) view returns(uint160,int24,uint24,uint24)', calls: pools.map(p => p.poolId) }) + // Migrator mints the full usable range at spacing 200. Hook compound bands use poolId as salt. + const calls = pools.map((p, i) => ({ params: [p.poolId, POSITIONS, -887200, 887200, '0x' + BigInt(ids[i]).toString(16).padStart(64, '0')] })) + const uniqueBands = new Map() + for (const c of compounds) uniqueBands.set(`${c.poolId}:${c.tickLower}:${c.tickUpper}`, c) + const bands = [...uniqueBands.values()] + for (const b of bands) calls.push({ params: [b.poolId, HOOK, Number(b.tickLower), Number(b.tickUpper), b.poolId] }) + const positions = await api.multiCall({ target: VIEW, abi: 'function getPositionInfo(bytes32,address,int24,int24,bytes32) view returns(uint128,uint256,uint256)', calls }) + const byId = new Map(pools.map((p, i) => [p.poolId, { asset: p.asset, quote: p.quote, price: BigInt(prices[i][0]) }])) + function addPosition(p, liquidity, lo, hi) { + if (!p) throw new Error('FAZE compounding position without registered pool') + if (isCore(p.asset, p.quote)) api.add(p.quote, quoteAmount(BigInt(liquidity), p.price, lo, hi, BigInt(p.quote) < BigInt(p.asset)).toString()) + } + pools.forEach((p, i) => addPosition(byId.get(p.poolId), positions[i][0], -887200, 887200)) + bands.forEach((b, i) => addPosition(byId.get(b.poolId), positions[pools.length + i][0], Number(b.tickLower), Number(b.tickUpper))) +} + +module.exports = { + start: '2026-09-13', + timetravel: true, + doublecounted: true, + methodology: 'Real quote reserves on FAZE bonding curves plus the quote side of permanently locked graduation and compounding positions. Excludes virtual reserves, unclaimed fees, minted launch-token inventory, FAZE-denominated quote assets and FAZE own-token pools. Locked positions overlap Uniswap v4 TVL.', + arc: { tvl }, +} diff --git a/projects/faze/positionMath.js b/projects/faze/positionMath.js new file mode 100644 index 00000000000..1bcccee4090 --- /dev/null +++ b/projects/faze/positionMath.js @@ -0,0 +1,16 @@ +// Integer Q96 position valuation; TickMath constants from verified Uniswap v4 source. +const multipliers = [["1", "0xfffcb933bd6fad37aa2d162d1a594001"], ["0x2", "0xfff97272373d413259a46990580e213a"], ["0x4", "0xfff2e50f5f656932ef12357cf3c7fdcc"], ["0x8", "0xffe5caca7e10e4e61c3624eaa0941cd0"], ["0x10", "0xffcb9843d60f6159c9db58835c926644"], ["0x20", "0xff973b41fa98c081472e6896dfb254c0"], ["0x40", "0xff2ea16466c96a3843ec78b326b52861"], ["0x80", "0xfe5dee046a99a2a811c461f1969c3053"], ["0x100", "0xfcbe86c7900a88aedcffc83b479aa3a4"], ["0x200", "0xf987a7253ac413176f2b074cf7815e54"], ["0x400", "0xf3392b0822b70005940c7a398e4b70f3"], ["0x800", "0xe7159475a2c29b7443b29c7fa6e889d9"], ["0x1000", "0xd097f3bdfd2022b8845ad8f792aa5825"], ["0x2000", "0xa9f746462d870fdf8a65dc1f90e061e5"], ["0x4000", "0x70d869a156d2a1b890bb3df62baf32f7"], ["0x8000", "0x31be135f97d08fd981231505542fcfa6"], ["0x10000", "0x9aa508b5b7a84e1c677de54f3e99bc9"], ["0x20000", "0x5d6af8dedb81196699c329225ee604"], ["0x40000", "0x2216e584f5fa1ea926041bedfe98"], ["0x80000", "0x48a170391f7dc42444e8fa2"]].map(([a,b]) => [BigInt(a),BigInt(b)]); +function sqrtTick(t) { + if (!Number.isInteger(t) || Math.abs(t)>887272) throw Error('Invalid tick'); + let ratio=1n<<128n, a=BigInt(Math.abs(t)); + for (const [mask,m] of multipliers) if (a&mask) ratio=ratio*m>>128n; + if (t>0) ratio=((1n<<256n)-1n)/ratio; + return (ratio>>32n)+(ratio% (1n<<32n)?1n:0n); +} +function quoteAmount(liquidity,price,lo,hi,quoteIs0) { + const A=sqrtTick(lo), B=sqrtTick(hi), P=priceB?B:price, Q=1n<<96n; + if (A>=B || liquidity<0n || price<=0n) throw Error('Invalid position'); + return quoteIs0 ? liquidity*Q*(B-P)/B/P : liquidity*(P-A)/Q; +} + +module.exports = { quoteAmount }; From ae8bf1849ef048cc8e6c1ed9903845ef0744f417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Wed, 30 Sep 2026 13:01:00 +0530 Subject: [PATCH 014/988] bonzo: mark the Hedera pool insolvent, 72% of its borrowed is the 07-11 exploit debt (#21308) --- registries/aave.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registries/aave.js b/registries/aave.js index 97e8593e5fd..3ce61647302 100644 --- a/registries/aave.js +++ b/registries/aave.js @@ -80,7 +80,7 @@ const aaveV2Configs = { 'bonzo': { timetravel: false, methodology, - hedera: '0x236897c518996163E7b313aD21D1C9fCC7BA1afc', + hedera: { registry: '0x236897c518996163E7b313aD21D1C9fCC7BA1afc', isInsolvent: true }, }, 'takoTako': { methodology, From 845814c14373d3c0b04dd41539eb4d94ac546f27 Mon Sep 17 00:00:00 2001 From: Parabolarc <132254079+parabolarc@users.noreply.github.com> Date: Wed, 30 Sep 2026 08:41:22 +0100 Subject: [PATCH 015/988] Add Parabolarc TVL on Robinhood (#21319) Co-authored-by: ccipherx --- projects/parabolarc/index.js | 108 ++++++++++++++++++++++++++--------- 1 file changed, 80 insertions(+), 28 deletions(-) diff --git a/projects/parabolarc/index.js b/projects/parabolarc/index.js index 5e07f47a177..c88cfa0a1c5 100644 --- a/projects/parabolarc/index.js +++ b/projects/parabolarc/index.js @@ -1,12 +1,8 @@ const { addUniV4PoolReserves } = require("../helper/uniswapV4"); const { getLogs2 } = require("../helper/cache/getLogs"); -// Arc mainnet 5042. DefiLlama's `arc` chain is this network. -const FACTORY = "0xfB56bEe304c92374D5E08A5AD84540FDd69CdD8e"; -const LOCKER = "0x8a5fc999b47d2DB835153CdB872cbbe6ab562767"; -const START_BLOCK = 22641802; - const STATE_VIEW = "0xF3334192D15450CdD385c8B70e03f9A6bD9E673b"; +const TICK_SPACING = 10; const launchedAbi = "event Launched(address indexed token, address indexed treasury, address indexed creator, address creatorRecipient, uint24 fee)"; @@ -14,42 +10,98 @@ const positionsAbi = "function positions(address) view returns (uint256 tokenId, address treasury, address currency0, address currency1, uint24 fee, int24 tickLower, int24 tickUpper)"; const poolIdAbi = "function poolIdFor(address) view returns (bytes32)"; -async function tvl(api) { - const logs = await getLogs2({ - api, - target: FACTORY, - eventAbi: launchedAbi, - fromBlock: START_BLOCK, - onlyArgs: true, - }); - if (!logs.length) return; +const ARC_SOURCES = [ + { + factory: "0xfB56bEe304c92374D5E08A5AD84540FDd69CdD8e", + locker: "0x8a5fc999b47d2DB835153CdB872cbbe6ab562767", + fromBlock: 22641802, + }, +]; + +const ROBINHOOD_SOURCES = [ + { + factory: "0x130B2E0464304101F06c00c39753f8b49E20965F", + locker: "0xd244b1BeB80594dc862F9eF0104c16766f4ef6AC", + fromBlock: 73808517, + }, + { + factory: "0x9919B35F6a09Ac15af8BA3d3B5B4322C316De582", + locker: "0x85DFeBAa3FcB5d4f95Ed19595c14608e81cc0953", + fromBlock: 73808517, + }, + { + factory: "0x6115288769FddaE13f705f4EB8b4Ac87F9236A4a", + locker: "0xa6e2977d3FdcC95a3344c1b87BB9015884990Ec8", + fromBlock: 73808517, + }, + { + factory: "0xE8dED504EfDCE8d53C5043E9582177A43C8c446F", + locker: "0x9a7d001A924A22508Ef30014818f1567BEE80bAf", + fromBlock: 73808517, + }, + { + factory: "0x10E577e705935Cee523c4ef46b730eE6785f2842", + locker: "0xE5F74621A05A3AdAE13c691f2D809962aB50e26C", + fromBlock: 73808517, + }, +]; + +async function tvlFrom(api, sources) { + const pools = []; + const tokens = []; + + for (const { factory, locker, fromBlock } of sources) { + const logs = await getLogs2({ + api, + target: factory, + eventAbi: launchedAbi, + fromBlock, + onlyArgs: true, + }); + if (!logs.length) continue; - const tokens = logs.map((log) => log.token); - const [positions, poolIds] = await Promise.all([ - api.multiCall({ abi: positionsAbi, target: LOCKER, calls: tokens }), - api.multiCall({ abi: poolIdAbi, target: FACTORY, calls: tokens }), - ]); + const launched = logs.map((log) => log.token); + const [positions, poolIds] = await Promise.all([ + api.multiCall({ abi: positionsAbi, target: locker, calls: launched }), + api.multiCall({ abi: poolIdAbi, target: factory, calls: launched }), + ]); + + launched.forEach((token, i) => { + tokens.push(token); + pools.push({ + id: poolIds[i], + token0: positions[i].currency0, + token1: positions[i].currency1, + spacing: TICK_SPACING, + }); + }); + } + + if (!pools.length) return; await addUniV4PoolReserves({ api, stateView: STATE_VIEW, - pools: tokens.map((_, i) => ({ - id: poolIds[i], - token0: positions[i].currency0, - token1: positions[i].currency1, - spacing: 10, - })), + pools, }); - // Only the quote side counts: a launched token's only market is the pool Parabolarc seeded tokens.forEach((token) => api.removeTokenBalance(token)); } +async function tvlArc(api) { + return tvlFrom(api, ARC_SOURCES); +} + +async function tvlRobinhood(api) { + return tvlFrom(api, ROBINHOOD_SOURCES); +} + module.exports = { methodology: - "TVL is the quote-asset (USDC) side of each Parabolarc Uniswap v4 launch pool, including the locked launch position and the USDC floor. The launched tokens are excluded, since their only market is the pool Parabolarc seeded. Fee revenue held in the per-launch treasuries and the $PARC buyback vault is excluded. Marked doublecounted because the pools sit in the Uniswap v4 PoolManager on Arc and are already inside Uniswap v4's TVL there.", + "TVL is the quote-asset side of each Parabolarc Uniswap v4 launch pool, including the locked launch position and the floor. On Arc that quote is USDC. On Robinhood it is native ETH for the one-pair and multi factories, and for the stock factories it is whichever token each launch is paired against (a Robinhood stock token or another ERC20), including earlier factories that still have live launches. The launched tokens are excluded, since their only market is the pool Parabolarc seeded. Extra multi-quote pools besides the ETH/USDC market, fee treasuries, and the $PARC buyback vault are excluded. Marked doublecounted because the pools sit in the Uniswap v4 PoolManager and are already inside Uniswap v4's TVL on that chain.", start: 1790315996, timetravel: true, doublecounted: true, - arc: { tvl }, + arc: { tvl: tvlArc }, + robinhood: { tvl: tvlRobinhood }, }; From c2099d1b681dc76f6544f2300b3fe7789e6dfcb2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 30 Sep 2026 09:43:48 +0200 Subject: [PATCH 016/988] fix telos --- projects/telos-swap/index.js | 2 +- projects/telosRex.js | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/projects/telos-swap/index.js b/projects/telos-swap/index.js index 7d95cea018b..7e6fb13217e 100644 --- a/projects/telos-swap/index.js +++ b/projects/telos-swap/index.js @@ -1,6 +1,6 @@ const { post } = require('../helper/http') async function tvl(){ - const data = await post("https://mainnet.telos.net/v1/chain/get_table_rows", { + const data = await post("https://telos.greymass.com/v1/chain/get_table_rows", { "json":true,"code":"data.tbn","scope":"data.tbn","table":"tradedata","table_key":"","lower_bound":"","upper_bound":"","index_position":1,"key_type":"","limit":100,"reverse":false,"show_payer":false }) let tvlTlos = 0; diff --git a/projects/telosRex.js b/projects/telosRex.js index 0b3c3177400..4d77e2fd1c6 100644 --- a/projects/telosRex.js +++ b/projects/telosRex.js @@ -1,15 +1,17 @@ -const { get } = require('./helper/http') +const { post } = require('./helper/http') async function tvl() { - const tvlTlos = (await get( - "https://mainnet.telos.net/v2/history/get_deltas?code=eosio.token&scope=eosio.rex&table=accounts", - )).deltas.map(d => d.data.amount); + const { rows } = await post("https://telos.greymass.com/v1/chain/get_table_rows", { + json: true, code: "eosio.token", scope: "eosio.rex", table: "accounts", + }) + const tlos = rows.find(r => r.balance.endsWith(' TLOS')).balance.split(' ')[0] return { - telos: tvlTlos[0], + telos: +tlos, }; } module.exports = { + timetravel: false, telos: { tvl }, }; From 0703eb6c597ce7600a4c6e758a9a2b3cee26a8a6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 30 Sep 2026 12:12:31 +0200 Subject: [PATCH 017/988] blueberry: track monad tvl --- projects/blueberry/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/blueberry/index.js b/projects/blueberry/index.js index be18fd91bd2..261857bddf4 100644 --- a/projects/blueberry/index.js +++ b/projects/blueberry/index.js @@ -31,5 +31,14 @@ module.exports = { const tvlValue = await api.call({ abi: "uint256:tvl", target: BBHLP_VAULT_ROUTER_ADDRESS, }); api.addUSDValue(tvlValue / 1e18) } + }, + monad: { + tvl: async (api) => { + const vaults = [ + '0xC2ddc1004CA0d6cC4bFd1dCD03Dcf855bED8E670', + '0x215394B5677Cb7a18B6fA8cc2cD155C024ee6b2E', + ] + return api.erc4626Sum({calls: vaults, isOG4626: true, }) + } } } From b8c114dde9c1a12f1910668d6c593abbe2634d8c Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 30 Sep 2026 09:22:07 -0400 Subject: [PATCH 018/988] fix stader (#21339) --- projects/stader/index.js | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/projects/stader/index.js b/projects/stader/index.js index 7fac896babb..efc14f62b06 100644 --- a/projects/stader/index.js +++ b/projects/stader/index.js @@ -1,31 +1,9 @@ const { nullAddress, sumTokens2 } = require("../helper/unwrapLPs"); -const { get } = require("../helper/http"); +const { sumTokensExport } = require("../helper/sumTokens"); -const headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36' }; -let _res; - -async function getData() { - if (!_res) _res = await get('https://universe.staderlabs.com/common/tvl', { headers }) - return _res; -} - -async function hbarTvl(api) { - const res = await getData() - if(!res.hedera || !res.hedera.native) throw new Error("Invalid hedera data") - api.add(nullAddress, res.hedera.native * 1e8) -} - -async function maticTvl() { - const res = await getData(); - if(!res.polygon || !res.polygon.native) throw new Error("Invalid polygon data") - api.add(nullAddress, res.polygon.native * 1e18) -} - -async function bscTvl(api) { - const res = await getData(); - if(!res.bnb || !res.bnb.native) throw new Error("Invalid bsc data") - api.add(nullAddress, res.bnb.native * 1e18) -} +// HBARX staking contract, holds the staked HBAR +// https://stader.gitbook.io/stader/hedera/smart-contracts +const HBARX_STAKING = "0.0.1412503"; async function ethTvl(api) { return await api.call({ abi: "uint256:totalAssets", target: "0xcf5ea1b38380f6af39068375516daf40ed70d299" }); @@ -35,16 +13,13 @@ module.exports = { timetravel: false, methodology: "We aggregated the assets staked across Stader staking protocols", /*terra: { tvl },*/ - hedera: { tvl: hbarTvl }, - // its on ethereum because funds are locked there - // ethereum: { tvl: maticTvl }, + hedera: { tvl: sumTokensExport({ owners: [HBARX_STAKING] }) }, fantom: { tvl: () => ({}) }, terra2: { tvl: () => ({}) }, bsc: { tvl: () => ({}), }, near: { tvl: () => ({}) }, ethereum: { tvl: async (api) => { - const res = await getData(); const nodeOperatorRegistry = "0x4f4bfa0861f62309934a5551e0b2541ee82fdcf1"; const nodeOperatorCount = await api.call({ abi: "uint256:totalActiveValidatorCount", @@ -67,9 +42,7 @@ module.exports = { params: [sdBalance], }); - // if(!res.polygon || !res.polygon.native) throw new Error("Invalid polygon data") const balances = { - "polygon": res.polygon.native ?? 0, // temp fix until api error is resolved [nullAddress]: +SDToEth + +(await ethTvl(api)) + +nodeOperatorCount * 4 * 1e18, // 4 ETH per node operator }; From bed5175bcba24c7bcc9174ba50ad03aa6e2c5649 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 30 Sep 2026 10:03:18 -0400 Subject: [PATCH 019/988] fix rhea dex (#21340) --- projects/reffinance.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/projects/reffinance.js b/projects/reffinance.js index 96fb0640e2a..ac860e6252d 100644 --- a/projects/reffinance.js +++ b/projects/reffinance.js @@ -10,12 +10,16 @@ async function tvl() { const balances = {} let poolIndex = 0 const numberOfPools = await call(PROJECT_CONTRACT, 'get_number_of_pools', {}) - const allDclPools = await call(PROJECT_DCL_CONTRACT, 'list_pools', {}); - allDclPools.forEach((dclPoolDetail) => { - const { token_x, token_y, total_order_x, total_order_y, total_x, total_y } = dclPoolDetail; - sumSingleBalance(balances, token_x, BigNumber(total_order_x).plus(total_x).toFixed()); - sumSingleBalance(balances, token_y, BigNumber(total_order_y).plus(total_y).toFixed()); - }) + // list_pools without pagination exceeds the view call gas limit + const { pool_count: numberOfDclPools } = await call(PROJECT_DCL_CONTRACT, 'get_metadata', {}) + for (let dclIndex = 0; dclIndex < +numberOfDclPools; dclIndex += 100) { + const dclPools = await call(PROJECT_DCL_CONTRACT, 'list_pools', { from_index: dclIndex, limit: 100 }) + dclPools.forEach((dclPoolDetail) => { + const { token_x, token_y, total_order_x, total_order_y, total_x, total_y } = dclPoolDetail; + sumSingleBalance(balances, token_x, BigNumber(total_order_x).plus(total_x).toFixed()); + sumSingleBalance(balances, token_y, BigNumber(total_order_y).plus(total_y).toFixed()); + }) + } do { const pools = await call(PROJECT_CONTRACT, 'get_pools', { from_index: poolIndex, limit: 500 }) From c7627b7b813d2e8e8cd04680bf626e48a6c22ddc Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 30 Sep 2026 10:41:47 -0400 Subject: [PATCH 020/988] add juplend market and supervised loan to sentora (#21341) --- projects/sentora/index.js | 41 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/projects/sentora/index.js b/projects/sentora/index.js index e32913091ee..faf4f094ba2 100644 --- a/projects/sentora/index.js +++ b/projects/sentora/index.js @@ -1,4 +1,7 @@ const { getCuratorExport, getMorphoVaults } = require("../helper/curators"); +const { getConfig } = require('../helper/cache') +const { getProvider, getTokenSupplies } = require('../helper/solana') +const { Program } = require("@coral-xyz/anchor"); const ethereumMorphoVaults = [ '0xFC8C624B6080a0a780583799f2A862DE936F6E22', // Sentora x Spark RLUSD vault @@ -54,14 +57,28 @@ const customConfig = { { vault: '0x3cc0d33b1aeac3d23ea89214b3ac5b4607032167', deployBlock: 23682851 }, // Upshift vault BTC { vault: '0xd0271e199f886ff943859579465498b18ecf1e9d', deployBlock: 24241435 }, // Upshift vault ETH { vault: '0xd000E6BcAd5457E8F4de67eDdeFe50BCC4B3d743', deployBlock: 25279501 }, // Upshift Sentora RWA (PYUSD) - ] - } + ], + supervisedLoans: [ + '0xc936e848688c9f035fa0e7a0e4dbcf26a01245f3', // Loan Manager (Position Manager 0xc1d4e31c05457f7a87f49e0ef556977e9e216250) + ], + }, + solana: { + // Earn side of the Sentora-curated market on the JupLend Ethena deployment + juplend: [ + { fToken: '7T1qPZUPdaEhfQ6tXLvFeCoehyDfzdk76XbszbXyqgjx', mint: '2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo' }, // jlePYUSD -> PYUSD + ], + }, } +const JUPLEND_LIQUIDITY_IDL_URL = 'https://raw.githubusercontent.com/jup-ag/jupiter-lend/refs/heads/main/target/idl/liquidity.json' +const JUPLEND_ETHENA_LIQUIDITY_PROGRAM = 'jup6QF1sNDGpkkcu6F4qaFHcRBmnSS1VgyB4uFbBvNS' +const JUPLEND_EXCHANGE_PRICE_PRECISION = 1e12 + const abis = { balanceOf: 'function balanceOf(address _asset_address, address _account) view returns (uint256)', getPositionAssets: 'function getPositionAssets() view returns (address[])', positionConfig: 'function positionConfig() view returns (address rtoken, address basket_handler, address asset_registry, address furnace)', + getMarketParams: 'function getMarketParams() view returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv)', } const curatorExport = getCuratorExport({ @@ -121,7 +138,25 @@ const handlers = { const calls = vaults.filter(v => block >= v.deployBlock).map(v => v.vault) if (!calls.length) return await api.erc4626Sum({ calls, tokenAbi: 'address:asset', balanceAbi: 'uint256:getTotalAssets' }); - } + }, + + async supervisedLoans(api, loanManagers) { + const params = await api.multiCall({ calls: loanManagers, abi: abis.getMarketParams }) + const supplied = await api.multiCall({ calls: loanManagers, abi: 'uint256:getSupply' }) + api.add(params.map(p => p.collateralToken), supplied) + }, + + async juplend(api, markets) { + const idl = await getConfig('jupiter-lend', JUPLEND_LIQUIDITY_IDL_URL) + const program = new Program({ ...idl, address: JUPLEND_ETHENA_LIQUIDITY_PROGRAM }, getProvider()) + const reserves = (await program.account.tokenReserve.all()).map(i => i.account) + const supplies = await getTokenSupplies(markets.map(m => m.fToken)) + markets.forEach(({ fToken, mint }) => { + const reserve = reserves.find(r => r.mint.toBase58() === mint) + if (!reserve || supplies[fToken] === undefined) throw new Error(`juplend: missing data for ${mint}`) + api.add(mint, +supplies[fToken] * +reserve.supplyExchangePrice.toString() / JUPLEND_EXCHANGE_PRICE_PRECISION) + }) + }, } async function customTvl(api) { From b8804e7634db245963a11709fb498df7bc15356a Mon Sep 17 00:00:00 2001 From: vvalecha519 <65174294+vvalecha519@users.noreply.github.com> Date: Wed, 30 Sep 2026 11:16:57 -0400 Subject: [PATCH 021/988] Add Nonce Capital curator adapter (#21290) Co-authored-by: Claude Fable 5.1 Co-authored-by: FelixBruguera --- projects/nonce-capital/index.js | 85 +++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 projects/nonce-capital/index.js diff --git a/projects/nonce-capital/index.js b/projects/nonce-capital/index.js new file mode 100644 index 00000000000..96dcdeaf619 --- /dev/null +++ b/projects/nonce-capital/index.js @@ -0,0 +1,85 @@ +const { getCuratorExport } = require("../helper/curators"); + +// Nonce Capital curates the ether.fi Liquid vaults. +// +// Boring Vaults (Veda). Share tokens move between Ethereum and Optimism through a LayerZero teller +// that burns on the source chain and mints on the destination, so totalSupply * rate on each chain +// is disjoint and the two chains sum to the global vault NAV. +// +// Accountants are listed explicitly (same addresses on both chains) instead of resolving them via +// vault.hook().accountant(): the Liquid USD teller on Ethereum does not expose accountant(), so the +// generic boringVaults helper silently drops that vault. +// +// deployBlocks gate historical runs per chain; each accountant already exists at its vault's deploy block. +const liquidBoringVaults = [ + { vault: '0xf0bb20865277aBd641a307eCe5Ee04E79073416C', accountant: '0x0d05D94a5F1E76C18fbeB7A13d17C8a314088198', deployBlocks: { ethereum: 20014556, optimism: 123081511 } }, // Liquid ETH + { vault: '0x08c6F91e2B681FaF5e17227F2a44C307b3C1364C', accountant: '0xc315D6e14DDCDC7407784e2Caf815d131Bc1D3E7', deployBlocks: { ethereum: 19672709, optimism: 149698252 } }, // Liquid USD + { vault: '0x5f46d540b6eD704C3c8789105F30E075AA900726', accountant: '0xEa23aC6D7D11f6b181d6B98174D334478ADAe6b0', deployBlocks: { ethereum: 21189184, optimism: 149698606 } }, // Liquid BTC +] + +const abis = { + base: 'address:base', + getRate: 'uint256:getRate', + decimals: 'uint8:decimals', + totalSupply: 'uint256:totalSupply', +} + +async function boringVaultTvl(api, vaults) { + if (!vaults.length) return + const accountants = vaults.map(v => v.accountant) + const [assets, rates, decimals, supplies] = await Promise.all([ + api.multiCall({ abi: abis.base, calls: accountants }), + api.multiCall({ abi: abis.getRate, calls: accountants }), + api.multiCall({ abi: abis.decimals, calls: accountants }), + api.multiCall({ abi: abis.totalSupply, calls: vaults.map(v => v.vault) }), + ]) + // getRate() is denominated in the base asset with the accountant's decimals, which equal the share + // token's decimals, so supply * rate / 10^decimals is the NAV in base-asset units. + vaults.forEach((_, i) => api.add(assets[i], BigInt(supplies[i]) * BigInt(rates[i]) / 10n ** BigInt(decimals[i]))) +} + +// Midas tokenized funds: minted 1:1 on deposit and burned on redeem, so totalSupply is the fund's AUM. +const optimismMidasTokens = [ + { token: '0xca5921DF65E2e1b0B98Ae91c0187BA80D4124898', deployBlock: 149938537 }, // Liquid Reserve (USD) + { token: '0x17bC8Ffd82b8a36e737Ca1141C025089589B915e', deployBlock: 152185362 }, // Liquid RWA (USD) +] + +// The Liquid Boring Vaults hold Midas tokens (Liquid USD holds Liquid RWA on Optimism). Their NAV already +// includes those positions, so the vault-held balances are subtracted from the Midas side. +async function removeNestedMidas(api, tokens, vaults) { + if (!tokens.length || !vaults.length) return + const calls = tokens.flatMap(target => vaults.map(v => ({ target, params: [v.vault] }))) + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls }) + api.add(calls.map(c => c.target), balances.map(b => -b)) +} + +const curatorExport = getCuratorExport({ + methodology: 'Count all assets deposited in all vaults curated by Nonce Capital: the ether.fi Liquid Boring Vaults (Ethereum and Optimism) and the Midas-issued Liquid Reserve and Liquid RWA tokens (Optimism). Midas tokens held by the Liquid vaults are excluded, as they are already counted in the vaults\' NAV.', + blockchains: { + ethereum: {}, + optimism: { + // the helper reads totalSupply with permitFailure, so tokens not yet deployed are skipped + midasTokens: optimismMidasTokens.map(t => t.token), + }, + }, +}) + +module.exports = { ...curatorExport } + +for (const chain of ['ethereum', 'optimism']) { + const curatorChain = curatorExport[chain] + module.exports[chain] = { + ...curatorChain, + tvl: async (api) => { + const block = await api.getBlock() + const vaults = liquidBoringVaults.filter(v => block >= v.deployBlocks[chain]) + await curatorChain.tvl(api) + await boringVaultTvl(api, vaults) + if (chain === 'optimism') { + const midasTokens = optimismMidasTokens.filter(t => block >= t.deployBlock).map(t => t.token) + await removeNestedMidas(api, midasTokens, vaults) + } + return api.getBalances() + }, + } +} From f99cd82549264d0582dc264f935adc6ab091ca6c Mon Sep 17 00:00:00 2001 From: routebuilder Date: Wed, 30 Sep 2026 20:43:24 +0200 Subject: [PATCH 022/988] Add Forward Industries SOL (fwdSOL) staking adapter (#21172) Co-authored-by: RuffR1d3r <76077201+RuffR1d3r@users.noreply.github.com> --- registries/solanaStakePool.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registries/solanaStakePool.js b/registries/solanaStakePool.js index 16784253667..fdde15bf012 100644 --- a/registries/solanaStakePool.js +++ b/registries/solanaStakePool.js @@ -126,6 +126,10 @@ const configs = { 'blazestake': { solana: { type: 'staked', address: '6WecYymEARvjG5ZyqkrVQ6YkhPfujNzWpSPwNKXHCbV2' }, }, + 'forward-industries-sol': { + methodology: "TVL is the total amount of SOL staked in the Forward Industries fwdSOL stake pool.", + solana: '2iZHumJq19hyCYkD3xFoZ6dbiFbJ5nqbwALMdJBYQsJa', + }, } module.exports = buildProtocolExports(configs, solanaStakePoolExportFn) From baabd149ce8789b02d08f346e31a3d4de0bebfd4 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Wed, 30 Sep 2026 20:52:17 +0200 Subject: [PATCH 023/988] Add Definity Staked SOL (definSOL) staking adapter (#21176) Co-authored-by: FelixBruguera --- registries/solanaStakePool.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registries/solanaStakePool.js b/registries/solanaStakePool.js index fdde15bf012..aeb4c86f5bf 100644 --- a/registries/solanaStakePool.js +++ b/registries/solanaStakePool.js @@ -130,6 +130,10 @@ const configs = { methodology: "TVL is the total amount of SOL staked in the Forward Industries fwdSOL stake pool.", solana: '2iZHumJq19hyCYkD3xFoZ6dbiFbJ5nqbwALMdJBYQsJa', }, + 'definity-staked-sol': { + methodology: "TVL is the total amount of SOL staked in the Definity definSOL stake pool.", + solana: 'Bvbu55B991evqqhLtKcyTZjzQ4EQzRUwtf9T4CcpMmPL', + }, } module.exports = buildProtocolExports(configs, solanaStakePoolExportFn) From 9095ffdb67026a467aa332db8fdeabb2c695824a Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 30 Sep 2026 15:38:35 -0400 Subject: [PATCH 024/988] Add ShiftDefi (#21346) Co-authored-by: shift-developer-3 Co-authored-by: shift-developer-2 --- projects/shift-defi/index.js | 100 +++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 projects/shift-defi/index.js diff --git a/projects/shift-defi/index.js b/projects/shift-defi/index.js new file mode 100644 index 00000000000..9812e3f8cdf --- /dev/null +++ b/projects/shift-defi/index.js @@ -0,0 +1,100 @@ +const sdk = require("@defillama/sdk"); +const { nullAddress } = require("../helper/tokenMapping"); + +const NAV_DECIMALS = 18n; +const PRINCIPAL_CONTAINER_TYPE = 1; + +const abi = { + getContainers: "function getContainers() view returns (address[] containers, uint256[] weights)", + containerType: "uint8:containerType", + remoteChainId: "uint256:remoteChainId", + isReshuffling: "bool:isReshuffling", + getStrategiesNav: "uint256:getStrategiesNav", + getPreReshufflingSnapshot: "uint256:getPreReshufflingSnapshot", + notion: "address:notion", + decimals: "uint8:decimals", +}; + + +// Chain -> Vault address -> TvlReporter +const vaults = { + ethereum: { + "0x1d71c888961c4600cF0E31F6196b4dA7fE72e4B3": "0x0A4420823e2c415C9D5ABC668b0915b62f7409Fb", + }, +}; + +const chainNamesById = Object.fromEntries( + Object.entries(sdk.providerListJSON ?? {}) + .filter(([, { chainId }]) => chainId) + .map(([name, { chainId }]) => [chainId, name]) +); + +async function getVaultNav(api, vault, tvlReporter) { + const [containersRes, isReshuffling] = await Promise.all([ + api.call({ target: vault, abi: abi.getContainers }), + api.call({ target: vault, abi: abi.isReshuffling }), + ]); + const containers = (containersRes.containers ?? containersRes[0] ?? []).filter( + (c) => c && c !== nullAddress + ); + if (!containers.length) return 0n; + + const containerTypes = await api.multiCall({ abi: abi.containerType, calls: containers }); + const principalContainers = containers.filter( + (_, index) => Number(containerTypes[index]) === PRINCIPAL_CONTAINER_TYPE + ); + const chainIds = new Set(); + + if (principalContainers.length < containers.length) { + chainIds.add(Number(api.chainId)); + } + if (principalContainers.length) { + const remoteChainIds = await api.multiCall({ + abi: abi.remoteChainId, + calls: principalContainers, + }); + remoteChainIds.forEach((chainId) => chainIds.add(Number(chainId))); + } + + const navAbi = isReshuffling ? abi.getPreReshufflingSnapshot : abi.getStrategiesNav; + const navs = await Promise.all([...chainIds].map((chainId) => { + if (chainId === Number(api.chainId)) { + return api.call({ target: tvlReporter, abi: navAbi }); + } + + const chain = chainNamesById[chainId]; + if (!chain) throw new Error(`Unknown chainId ${chainId}`); + const chainApi = new sdk.ChainApi({ chain, timestamp: api.timestamp }); + return chainApi.call({ target: tvlReporter, abi: navAbi }); + })); + return navs.reduce((total, nav) => total + BigInt(nav), 0n); +} + +async function tvl(api) { + await Promise.all( + Object.entries(vaults[api.chain] ?? {}).map(async ([vault, tvlReporter]) => { + const [nav, notion] = await Promise.all([ + getVaultNav(api, vault, tvlReporter), + api.call({ target: vault, abi: abi.notion }), + ]); + const notionDecimals = BigInt(await api.call({ target: notion, abi: abi.decimals })); + const tokenAmount = notionDecimals < NAV_DECIMALS + ? nav / 10n ** (NAV_DECIMALS - notionDecimals) + : nav * 10n ** (notionDecimals - NAV_DECIMALS); + api.add( + notion, + tokenAmount + ); + }) + ); +} + +module.exports = { + doublecounted: true, + methodology: + "Shift DeFi's total protocol TVL is calculated as the sum of the TVLs of all Vaults within the ecosystem. Each Vault's TVL is calculated as the sum of the NAVs of all strategies that make up the Vault's portfolio, as reported on-chain by each chain's TvlReporter. Strategies deposit into Curve and Morpho, so these assets are also counted in those protocols.", +}; + +Object.keys(vaults).forEach((chain) => { + module.exports[chain] = { tvl }; +}); From 91db2aa89eac0aa8f240120d2fa74ac8ac32c761 Mon Sep 17 00:00:00 2001 From: kaiblade Date: Wed, 30 Sep 2026 20:40:43 +0100 Subject: [PATCH 025/988] Add Unitflow Finance TVL adapter (#21317) Co-authored-by: treeoflife2 Co-authored-by: FelixBruguera --- registries/uniswapV2.js | 4 ++++ registries/uniswapV3.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index 6fb7d3b46de..ef247b95e53 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -3227,6 +3227,10 @@ const uniV2Configs = { }, }, }, + 'unitflow-finance-v2': { + methodology: 'Token balances held in every Unitflow v2.5 pair, enumerated from the factory.', + arc: '0xFc1EC6761e246D5cb0c4C22669f8635098B22ba1', + }, } module.exports = buildProtocolExports(uniV2Configs, uniV2ExportFn) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index a862c01ba8e..71d8e7f11c4 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1900,6 +1900,10 @@ const uniV3Configs = { fromBlock: 21118790, }, }, + 'unitflow-finance-v3': { + methodology: 'Token balances held in every Unitflow v3 pool, discovered from the factory PoolCreated events.', + arc: { factory: '0x5bfBCeb73d39F722B1cB83fD2F11736b28c1Be6d', fromBlock: 21068735 }, + }, 'goo-exchange': { start: '2026-09-26', methodology: 'Counts the tokens held by every pool created by the goo exchange factory on Robinhood Chain, found from its PoolCreated events.', From 75cf00ddc0e11a87a2a8b84432e0f6a9cd94ecef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Thu, 1 Oct 2026 01:25:20 +0530 Subject: [PATCH 026/988] isle-finance: TVL reads $0 since 09-28, pool start is now a date string (#21343) --- projects/isle-finance/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/isle-finance/index.js b/projects/isle-finance/index.js index 93c190fe3b5..caa45ca8657 100644 --- a/projects/isle-finance/index.js +++ b/projects/isle-finance/index.js @@ -13,7 +13,7 @@ const CONFIG = { async function tvl(api, pools) { const timestamp = api.timestamp const activePools = pools - .filter(p => !p.start || timestamp >= p.start) + .filter(p => !p.start || timestamp >= Date.parse(p.start) / 1e3) .map(p => p.pool) if (!activePools.length) return From ceca0c0a1924b098ab9b22050f64d73ff07b29f1 Mon Sep 17 00:00:00 2001 From: ZIG-Purgatorian Date: Wed, 30 Sep 2026 23:14:02 +0300 Subject: [PATCH 027/988] Zigchain v5 (#21342) Co-authored-by: Claude Opus 5 --- projects/helper/coreAssets.json | 2 +- projects/helper/tokenMapping.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 246c439b4d6..ea8f703a599 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -2736,7 +2736,7 @@ "WVTCN": "0x1150fd1335b0a53347f8bfb763729a99fbeab2ef" }, "zigchain": { - "uzig": "uzig" + "azig": "azig" }, "monad": { "LBTC": "0xecAc9C5F704e954931349Da37F60E39f515c11c1", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index f41eccfaf7f..61ed7cfc610 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -47,6 +47,11 @@ const fixBalancesTokens = { 'pm.pool.asset.3hjz8rcr3pejdc3msntlvy': { coingeckoId: 'usd-coin', decimals: 0 }, 'pm.pool.asset.1y3flutqcyuf8duew1vj2g': { coingeckoId: 'usd-coin', decimals: 0 }, }, + // ZIGChain v5 migrates the native denom from uzig (6 decimals) to azig (18 decimals); + // azig is not priced under zigchain:azig by the coins service yet + zigchain: { + azig: { coingeckoId: 'zignaly', decimals: 18 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From dc1159b7e3dd0be96331fbbc652cda2bbfff2d7f Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 30 Sep 2026 16:19:17 -0400 Subject: [PATCH 028/988] fix valdora (#21347) --- projects/valdora/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/valdora/index.js b/projects/valdora/index.js index 4dd294724ef..2d8bdfc71bc 100644 --- a/projects/valdora/index.js +++ b/projects/valdora/index.js @@ -35,7 +35,7 @@ async function tvl(api) { const balances = api.getBalances(); const stakerAum = await fetchStakerAUM(); - if (stakerAum) balances['zigchain:uzig'] = stakerAum; + if (stakerAum) balances['zigchain:azig'] = stakerAum; let vaults = []; try { From fee934e4162db64aaff35899bedd65a408c5b7f7 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 30 Sep 2026 16:54:02 -0400 Subject: [PATCH 029/988] fix saturn (#21348) --- projects/saturn-protocol/index.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/projects/saturn-protocol/index.js b/projects/saturn-protocol/index.js index 2ef62d0b208..0b76e033104 100644 --- a/projects/saturn-protocol/index.js +++ b/projects/saturn-protocol/index.js @@ -10,13 +10,28 @@ const PYUSDx = '0xebdb0942ce16386ab90718c7bd10c91cdb66b14d'; const USDC = ADDRESSES.ethereum.USDC; // sUSDat is backed by STRC (Strategy's "Stretch" preferred stock); balances are 6 decimals. const STRC_DECIMALS = 6; +// sUSDat v2 upgrade (2026-09-30): strcBalance() was removed and STRC accounting moved to +// modules: the STRC mirror module and the STRCon module +const V2_UPGRADE_BLOCK = 26091045; async function tvl(api) { // USDat backing: reserve tokens ($M pre-migration, PYUSDx after) + USDC held by the USDat contract. await api.sumTokens({ owner: USDat, tokens: [PYUSDx, M, USDC] }); - // STRC has no on-chain token to price, so value the sUSDat backing via DefiLlama's + + let strcBalance; + if (await api.getBlock() < V2_UPGRADE_BLOCK) { + strcBalance = await api.call({ target: sUSDat, abi: 'uint256:strcBalance' }); + } else { + const [mirror, strcon] = await Promise.all([ + api.call({ target: sUSDat, abi: 'address:strcMirrorModule' }), + api.call({ target: sUSDat, abi: 'address:strconModule' }), + ]); + strcBalance = await api.call({ target: mirror, abi: 'uint256:balance' }); + const strconToken = await api.call({ target: strcon, abi: 'address:ASSET' }); + await api.sumTokens({ owners: [sUSDat, strcon], tokens: [strconToken] }); + } + // Mirrored STRC has no on-chain token to price, so value it via DefiLlama's // tradfi STRC feed (coingecko:llama-stock-strc) rather than Saturn's own oracle. - const strcBalance = await api.call({ target: sUSDat, abi: 'uint256:strcBalance' }); api.addCGToken('llama-stock-strc', Number(strcBalance) / 10 ** STRC_DECIMALS); return api.getBalances(); From 1217cee0f4354ae2c11ec938ac0679548872fa17 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 30 Sep 2026 23:38:19 +0200 Subject: [PATCH 030/988] mark some kava projects as dead --- projects/akiba/index.js | 1 + projects/beekava/index.js | 1 + projects/funbear/index.js | 1 + projects/gamutexchange/index.js | 1 + projects/kaDefi/index.js | 1 + projects/kavastarter/index.js | 1 + projects/kinetix/index.js | 1 + projects/kmex-io/index.js | 1 + projects/pxswap/index.js | 1 + projects/rubyfinance/index.js | 1 + projects/sailing-portfolios/index.js | 1 + projects/scrubinvest/index.js | 14 ++++++++++++-- projects/selfex/index.js | 2 +- projects/weave/index.js | 1 + registries/compound.js | 1 + registries/masterchef.js | 3 +++ registries/sumTokens.js | 11 ++++++++++- registries/sumTokens/data1.js | 2 ++ registries/sumTokens/data3.js | 2 ++ registries/uniswapV2.js | 8 ++++++++ 20 files changed, 51 insertions(+), 4 deletions(-) diff --git a/projects/akiba/index.js b/projects/akiba/index.js index 64aaf634f83..fd0752aee6a 100644 --- a/projects/akiba/index.js +++ b/projects/akiba/index.js @@ -16,6 +16,7 @@ const Contracts = { }; module.exports = { + deadFrom: '2026-09-30', kava: { tvl: sumTokensExport({ owner: Contracts.kava.bank, tokens: [Contracts.kava.wkava, nullAddress] }), staking: sumTokensExport({ owner: Contracts.kava.multiFeeDistribution, tokens: [Contracts.kava.akiba], useDefaultCoreAssets: true, lps: Contracts.kava.lps}), diff --git a/projects/beekava/index.js b/projects/beekava/index.js index 2cb09480f26..a43fff00615 100644 --- a/projects/beekava/index.js +++ b/projects/beekava/index.js @@ -12,6 +12,7 @@ const POL_Pool_Three = "0x8470991Ce998d336146104549A04690082f2B372"; const owners = [POL_Pool_One, POL_Pool_Two, POL_Pool_Three,] module.exports = { + deadFrom: '2026-09-30', kava: { tvl: sumTokensExport({ owners, tokens: [ERC20ContractWkavaAddress] }), pool2: sumTokensExport({ owners, tokens: [WkavaBeekLpAddress], lps: [WkavaBeekLpAddress], useDefaultCoreAssets: true, }), diff --git a/projects/funbear/index.js b/projects/funbear/index.js index 067aaed0a48..8b661dcecf1 100644 --- a/projects/funbear/index.js +++ b/projects/funbear/index.js @@ -11,6 +11,7 @@ async function staking(api) { } module.exports = { + deadFrom: '2026-09-30', methodology: 'TVL counts staked FUNB coins on the platform itself.', kava: { tvl: () => 0, diff --git a/projects/gamutexchange/index.js b/projects/gamutexchange/index.js index 74960ea3687..e8cbc541ea7 100644 --- a/projects/gamutexchange/index.js +++ b/projects/gamutexchange/index.js @@ -1,4 +1,5 @@ module.exports = { + deadFrom: '2026-09-30', kava: { tvl, }, diff --git a/projects/kaDefi/index.js b/projects/kaDefi/index.js index c38d70cbd09..34c3facfd37 100644 --- a/projects/kaDefi/index.js +++ b/projects/kaDefi/index.js @@ -8,6 +8,7 @@ const POL_Pool_One = "0xdf65B85E43dBa1F153325e7e4A0682B7DeBBFe0f"; const POL_Pool_Two = "0x738d2b4b59A0A3AA4086bC44C40a45845bB73FCC"; module.exports = { + deadFrom: '2026-09-30', kava: { tvl: sumTokensExport({ owners: [POL_Pool_One, POL_Pool_Two], tokens: [ERC20ContractWkavaAddress], }), staking: sumTokensExport({ owners: [POL_Pool_One, POL_Pool_Two], tokens: [ERC20ContractKafiAddress], useDefaultCoreAssets: true, lps: [WkavaKafiLpAddress], }), diff --git a/projects/kavastarter/index.js b/projects/kavastarter/index.js index f92076b9654..e09560e3ff2 100644 --- a/projects/kavastarter/index.js +++ b/projects/kavastarter/index.js @@ -11,6 +11,7 @@ const POL_Pool_Two = "0x9aedc0D09E0Ede60Ba5B5F969a955937af024c44"; const POL_Pool_Three = "0x486F6f8cF46EC5CC584ec3f08C494E55a8484111"; module.exports = { + deadFrom: '2026-09-30', kava: { tvl: sumTokensExport({ owners: [POL_Pool_One, POL_Pool_Two], tokens: [WKAVA] }), staking: sumTokensExport({ owner: POL_Pool_Three, tokens: [KAVASTARTER], lps: [KAST_LP], useDefaultCoreAssets: true, }) diff --git a/projects/kinetix/index.js b/projects/kinetix/index.js index 062d667e7cb..2d2cc2e41b6 100644 --- a/projects/kinetix/index.js +++ b/projects/kinetix/index.js @@ -5,6 +5,7 @@ const KAI_ADDRESS_KAVA = "0x52369B1539EA8F4e1eadEEF18D85462Dcf9a3658" const veKAI_ADDRESS_KAVA = "0x2A0A26D08E2F7A8E86431Ddf6910Fe7cD59b9908" module.exports = { + deadFrom: '2026-09-30', kava: { tvl: gmxExports({ vault: "0xa721f9f61CECf902B2BCBDDbd83E71c191dEcd8b", }), staking: staking(veKAI_ADDRESS_KAVA, KAI_ADDRESS_KAVA), diff --git a/projects/kmex-io/index.js b/projects/kmex-io/index.js index bbd6b0e2d4f..c43aa64d1a1 100644 --- a/projects/kmex-io/index.js +++ b/projects/kmex-io/index.js @@ -8,6 +8,7 @@ const kavaKMX = '0x599b05875866ceB7378452D9F432d5377825F44B'; const kavaKMXKAVAPool = '0xA08848E7A4dbaEeE8eeAb93a05F437ed9Efa2162' module.exports = { + deadFrom: '2026-09-30', kava: { staking: sumTokensExport({ owner: kmexStaking, tokens: [kavaKMX],lps: [kavaKMXKAVAPool], useDefaultCoreAssets: true, }), tvl: gmxExports({ vault: kmexVault, }) diff --git a/projects/pxswap/index.js b/projects/pxswap/index.js index c00b7cf1e0f..5ec0243e6d1 100644 --- a/projects/pxswap/index.js +++ b/projects/pxswap/index.js @@ -6,5 +6,6 @@ const contract = "0x638B06F80FB28F109E65C9d5cC585aDf9A0c3f9f" const usdcToken = "0xfa9343c3897324496a05fc75abed6bac29f8a40f" module.exports = { + deadFrom: '2026-09-30', kava: { tvl: sumTokensExport({ owner: contract, tokens: [usdcToken]}) }, } diff --git a/projects/rubyfinance/index.js b/projects/rubyfinance/index.js index 3a1c27f7bdf..7daed905019 100644 --- a/projects/rubyfinance/index.js +++ b/projects/rubyfinance/index.js @@ -14,6 +14,7 @@ const rubyUsdcLp = "0x5FF7D68eE6e5f0bbE211B3c0d010160e3cD27Db9"; const Kavalps = [rubyKavaLp, rshareKavaLp, rubyRshareLp, rubyUsdcLp]; module.exports = { + deadFrom: '2026-09-30', hallmarks: [ ['2022-08-15', "incentives not given"] ], diff --git a/projects/sailing-portfolios/index.js b/projects/sailing-portfolios/index.js index c07de05ebb1..59c5ea6a844 100644 --- a/projects/sailing-portfolios/index.js +++ b/projects/sailing-portfolios/index.js @@ -14,6 +14,7 @@ async function tvl(api) { } module.exports = { + deadFrom: '2026-09-30', kava: { tvl, }, methodology: 'The assets in the balancer are detected and counted.' } diff --git a/projects/scrubinvest/index.js b/projects/scrubinvest/index.js index 9264b058617..47d11dcf8b9 100644 --- a/projects/scrubinvest/index.js +++ b/projects/scrubinvest/index.js @@ -14,7 +14,6 @@ async function tvl(api) { { target: '0x8EEA85dA61b397EaB933C001DAAD6fC1C5A4c67C', params: '0xcf4673F714183C42DADc1B42DAC21BE09cfc3684' }, { target: '0xc28fcef5970fd23e5bfcdc31ce1ba72ef98cc70a', params: '0xef7541FCa94988fA423bC418a854f7967f83a3E0' }, { target: '0x371d33963fb89ec9542a11ccf955b3a90391f99f', params: '0x43Ac7f627e41EBDa7515FEaCa425306AaB9cB602' }, - { target: '0x1E5573b2A7C1D08112d0Ff22e9F2D8EFc9583532', params: '0x9e890FBD4295D92c41fA12a2083b51C387699Fd8' }, { target: '0x8fE243F8B47107c468537D74514d7c52Cd61E937', params: '0x56a9c9230d6D3b7bF147c10fdDBCD8F2eB1a2B6d' }, //NEW LPs 14/07 - GAUGE / CONTRACT { target: '0x5383dEB37479599a33584f7Bbc346ab299e30FF0', params: '0x79eb3848B7B4630D1d883172f8e56B2e8fb18521' }, @@ -65,9 +64,20 @@ async function tvl(api) { }) } +// TIGER/LION LP: both sides are protocol tokens, so it counts as staking rather than tvl +async function staking(api) { + const calls = [ + { target: '0x1E5573b2A7C1D08112d0Ff22e9F2D8EFc9583532', params: '0x9e890FBD4295D92c41fA12a2083b51C387699Fd8' }, // gauge / vault -> vAMM-TIGER/LION (0x78Ef6D3E3d0da9B2248C11BE11743B4C573ADd25) + ] + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls }) + const lps = await api.multiCall({ abi: 'address:stake', calls: calls.map(i => i.target) }) + api.addTokens(lps, bals) + return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true, lps }) +} + module.exports = { - misrepresentedTokens: true, kava: { tvl, + staking, } }; diff --git a/projects/selfex/index.js b/projects/selfex/index.js index 87b66f478c8..bce8c286746 100644 --- a/projects/selfex/index.js +++ b/projects/selfex/index.js @@ -6,8 +6,8 @@ const KFT = "0xa0eeda2e3075092d66384fe8c91a1da4bca21788" const kBRISE = '0xea616011e5ac9a5b91e22cac59b4ec6f562b83f9' module.exports = { + deadFrom: '2026-09-30', misrepresentedTokens: true, - methodology: "Using DefiLlama's SDK for making on-chain calls to Selfex Factory Contract to iterate over Liquidity Pools & count token balances therein.", }; chains.forEach(chain => { diff --git a/projects/weave/index.js b/projects/weave/index.js index a2691b0457f..1ccf21217c0 100644 --- a/projects/weave/index.js +++ b/projects/weave/index.js @@ -14,6 +14,7 @@ async function tvl(api) { } module.exports = { + deadFrom: '2026-09-30', methodology: 'gets the balance of the strategy contract', kava: { tvl, diff --git a/registries/compound.js b/registries/compound.js index 795586f83fc..b9d112b90fa 100644 --- a/registries/compound.js +++ b/registries/compound.js @@ -412,6 +412,7 @@ const configs = { hemi: { comptroller: '0xc2C583093Af9241E17B2Ec51844154468D21bF6F' }, }, 'mare-finance-v2': { + deadFrom: '2026-09-30', methodology: 'Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets', kava: { comptroller: '0xFcD7D41D5cfF03C7f6D573c9732B0506C72f5C72', isInsolvent: true }, }, diff --git a/registries/masterchef.js b/registries/masterchef.js index f38cb8fb882..2502678a37d 100644 --- a/registries/masterchef.js +++ b/registries/masterchef.js @@ -468,6 +468,7 @@ const configs = { bsc: { masterchef: '0x94098E24FCf4701237CF58ef2A222C1cF5003c86', nativeToken: '0xf823f18d13df1ffdced206708d389dd455bb802b' }, }, 'catsapes': { + deadFrom: '2026-09-30', misrepresentedTokens: true, kava: { masterchef: '0x85602B00C9bd973B1Afb66EC140A62480CF812d3' }, }, @@ -569,6 +570,7 @@ const configs = { fantom: { masterchef: '0xF7711748bF74f2dDC261e745Ff43FdD8abfD1200', nativeToken: '0x71BE8F5F245c1F5aa5727DFdB36aAD3C71a4c26b' }, }, 'kafidao': { + deadFrom: '2026-09-30', misrepresentedTokens: true, kava: { masterchef: '0x58a8E42C071b9C9d049F261E75DE5568Ef81a427', nativeToken: '0x254B63C7481A16bC4080f0Ab369320004f79Cca3', useDefaultCoreAssets: true, poolInfoABI: 'function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accKfdPerShare)' }, }, @@ -682,6 +684,7 @@ const configs = { ethpow: { masterchef: '0xC07707C7AC7E383CE344C090F915F0a083764C94', nativeToken: '0x2a0cf46ecaaead92487577e9b737ec63b0208a33', useDefaultCoreAssets: true }, }, 'verified-credits': { + deadFrom: '2026-09-30', misrepresentedTokens: true, kava: { masterchef: '0x0a3b0C346cEE826aa0eBEf78c1eBcB9BE07aD2eb' }, }, diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 4e8fb84a07a..e86153e76e3 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -18,7 +18,7 @@ const covalent = require('./sumTokens/covalent') // { __resolveUnknownTokenLP: true, ... } -> unknownTokens.sumTokensExport (resolves unknown-token LP // pricing via core assets; use for buckets that rely on lps + useDefaultCoreAssets, e.g. migrated // staking/pool2 with LP deposits). Distinct from sumTokens2's own `resolveLP` (known-LP unwrap). -const META = new Set(["methodology","start","timetravel","hallmarks","doublecounted","misrepresentedTokens"]) +const META = new Set(["methodology","start","timetravel","hallmarks","doublecounted","misrepresentedTokens","deadFrom"]) const BUCKET_KEYS = new Set(["tvl","staking","pool2","borrowed","vesting","ownTokens"]) function buildBucket(spec, chain) { @@ -7022,6 +7022,7 @@ const configs = { }, }, "cexdex-stacking": { + deadFrom: '2026-09-30', "kava": { "owner": "0x451c3a3594aEB75EDcb13F132dc11D7d2972861A", "tokens": [ @@ -16344,6 +16345,7 @@ const configs = { }, }, "inbuilt-finance": { + deadFrom: '2026-09-30', "kava": { "tvl": { "owner": "0x68DB81eAB568174D54F3fd0d9e035eDe9AAEd3e2", @@ -16884,6 +16886,7 @@ const configs = { }, }, "kavafc": { + deadFrom: '2026-09-30', "kava": { "staking": { "owner": "0xa07deE8FF35fE2e2961a7e1006EAdA98E24aE82E", @@ -16901,6 +16904,7 @@ const configs = { }, }, "kavalake": { + deadFrom: '2026-09-30', "methodology": "TVL is calculated based on the amount of WKAVA held in the KavaLake liquid staking vault on Kava EVM.", "kava": { "owners": [ @@ -17446,6 +17450,7 @@ const configs = { }, }, "lioncommerce": { + deadFrom: '2026-09-30', "kava": { "staking": { "owner": "0x52b18024e084150e001a34be9c7a41706517d79f", @@ -18028,6 +18033,7 @@ const configs = { }, }, "metaid": { + deadFrom: '2026-09-30', "kava": { "tokensAndOwners": [ [ @@ -18993,6 +18999,7 @@ const configs = { }, }, "multialt-stacking": { + deadFrom: '2026-09-30', "kava": { "owner": "0xFFd33A71411fbA8B989Eca9F99EE7a908a2dEf4F", "tokens": [ @@ -24031,6 +24038,7 @@ const configs = { }, }, "rising-undead": { + deadFrom: '2026-09-30', "kava": { "owner": "0xc732471083342a842a728221878327c8DeE8aEDB", "tokens": [ @@ -27875,6 +27883,7 @@ const configs = { }, }, "traddify": { + deadFrom: '2026-09-30', "methodology": "We count the WKAVA on 0xA7f3d2dEa7a53E7A9FEbBdE5Cf7C69d39D065030", "kava": { "tokens": [ diff --git a/registries/sumTokens/data1.js b/registries/sumTokens/data1.js index 7e9015de39d..c5c8c4f1c72 100644 --- a/registries/sumTokens/data1.js +++ b/registries/sumTokens/data1.js @@ -548,6 +548,7 @@ module.exports = { } }, "privcash": { + deadFrom: '2026-09-30', "kava": { "tokensAndOwners": [ // KAVA: 100 / 1000 / 10000 / 100000 / 1000000 @@ -579,6 +580,7 @@ module.exports = { } }, "mirrosset": { + deadFrom: '2026-09-30', "kava": { "tokensAndOwners": [ ["0xfa9343c3897324496a05fc75abed6bac29f8a40f", "0x587Abb291379Ea84AcE583aB07A13109b9B3F347"], // USDC @ InsurancePool diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 7fd1a94b198..14d22f94a3b 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -391,6 +391,7 @@ module.exports = { }, }, "kinetix-derivatives-v2": { + deadFrom: '2026-09-30', "kava": { "tvl": { "owners": ["0xB5CE30B6EBAA252bDEac2F768EF9b1e4Bdf8d120"], "tokens": [ADDRESSES.null,ADDRESSES.kava.USDt] }, }, @@ -715,6 +716,7 @@ module.exports = { }, }, "stipend": { + deadFrom: "2023-08-01", // abandoned? "kava": { "tvl": { "owners": ["0xfc30fE377f7E333cC1250B7768107a7Da0277c44"], "tokens": [ADDRESSES.kava.WKAVA] }, }, diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index ef247b95e53..6530693aa9d 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -578,6 +578,7 @@ const uniV2Configs = { bsc: '0x73d9f93d53505cb8c4c7f952ae42450d9e859d10', }, 'direct-exchange': { + deadFrom: '2026-09-30', kava: '0xcE08c3d20Ff00a9Cf0D28922768bD606592B5D4C', }, 'diviswap': { @@ -1032,6 +1033,7 @@ const uniV2Configs = { hallmarks: [ ['2022-08-15', "incentives not given"] ], + deadFrom: "2022-08-15", kava: '0xc08BAEA14C14f25bcafe3e3E05550715505eF3dE', }, 'justmoney': { @@ -1042,12 +1044,14 @@ const uniV2Configs = { tron: 'TBfTeNjh7k8PbkTad8z6WS2vqh7SQZUfQ8', }, 'kapaswap': { + deadFrom: '2026-09-30', kava: '0xAb9F1D773Bde5657BC1492dfaF57b0b9EB59FDDc', }, 'kapinus': { bsc: '0x70e881fa43a7124e36639b54162395451cef1922', }, 'kasavadex': { + deadFrom: '2026-09-30', hallmarks: [ ['2022-08-15', "incentives not given"] ], @@ -1070,6 +1074,7 @@ const uniV2Configs = { chz: '0xE2918AA38088878546c1A18F2F9b1BC83297fdD3', }, 'kdex': { + deadFrom: '2026-09-30', kava: '0x9a6d197e85e61c23146F5b7FA55fc8a6EDDD2D57', }, 'kewl': { @@ -1125,6 +1130,7 @@ const uniV2Configs = { era: '0x6167ce530e710e29d0F32CFe50062028800e5918', }, 'kswap': { + deadFrom: '2026-09-30', kava: '0xEFD3ad14E5cF09b0EbE435756337fb2e9D10Dc1a', }, 'kswapfinance': { @@ -1347,6 +1353,7 @@ const uniV2Configs = { polygon: '0x800b052609c355cA8103E06F022aA30647eAd60a', }, 'mversex': { + deadFrom: '2026-09-30', kava: '0x266F951c525130a4E230bB40F0e3525C6C99B9c5', }, 'nanoswap': { @@ -1768,6 +1775,7 @@ const uniV2Configs = { stable: '0x19E10fb5875C4901D9650aFc001197285dBBC060', }, 'sevenswap': { + deadFrom: '2026-09-30', kava: '0x72b97F61fdb9a3aD34cd284B2f9c55d04127019c', }, 'shadow-legacy': { From 651274e05a475eca19df539758b1be404cda2b9a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 1 Oct 2026 00:15:54 +0200 Subject: [PATCH 031/988] track rayls-dex --- registries/uniswapV3.js | 1 + 1 file changed, 1 insertion(+) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 71d8e7f11c4..0417f594bc2 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1677,6 +1677,7 @@ const uniV3Configs = { }, 'xtrade': { xlayer: { factory: '0x612D9EA08be59479B112D8d400C7F0A2E4aD4172', fromBlock: 813172, isAlgebra: true, }, }, 'sheriff-v3': { robinhood: { factory: '0x21Fd9aB06cc927E66013e89b045c26b3eDE7bB20', fromBlock: 1, isAlgebra: true, }, }, + 'rayls-dex': { rls: { factory: '0x3f912b39A89708Db8E10205421d3726e2DF4984D', fromBlock: 946546, isAlgebra: true, }, }, 'zebra-v2': { scroll: { factory: '0x96a7F53f7636c93735bf85dE416A4Ace94B56Bd9', From 1b6be6e29a2170f9a4524dd5eece683ebac37e0d Mon Sep 17 00:00:00 2001 From: KeelLabsYield Date: Thu, 1 Oct 2026 01:25:47 -0600 Subject: [PATCH 032/988] keellabs: add new factories, Base (Aerodrome Slipstream) and Ethereum (#21353) Co-authored-by: KeelLabsYield Co-authored-by: Claude Opus 5.5 --- projects/keellabs/index.js | 46 ++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/projects/keellabs/index.js b/projects/keellabs/index.js index 7c937208470..8691b0141b7 100644 --- a/projects/keellabs/index.js +++ b/projects/keellabs/index.js @@ -15,6 +15,8 @@ const config = { '0x3e682FEC310d297cB109AC0b1Fe53F4EB0C8a5F8', // Keellabs v2 — deployed 2026-08-05 '0x61C6dEc573505125EBc2b7e569250262b8dF33bC', // fresh factory — deployed 2026-08-09 '0xDa877e3A5896dba00309684A5B40441f6A37e6e5', // multi-vault factory — deployed 2026-08-15 + '0xcebfd0ed307e095b320d73fa83b770c693e164c9', // gas-optimized factory — deployed 2026-09-04 + '0x3bfe98518FBE39F368395EdB82a1D6e8A581Fe39', // current factory — deployed 2026-09-30 ], npm: '0xC36442b4a4522E871399CD717aBDD847Ab11FE88', }, @@ -27,6 +29,8 @@ const config = { '0x7c32443061e54681ebc9f8581E4fc2867A2D6384', // Keellabs v2 — deployed 2026-08-05 '0x2fA41b881d194628160d7f95f10442Dc6BC5e06F', // fresh factory — deployed 2026-08-09 '0xc92bf423d730f1CA42F852d5Fc85467A10bCa572', // multi-vault factory — deployed 2026-08-15 + '0xd4be8c553b7b26b3bae22b93498e035a4a923092', // gas-optimized factory — deployed 2026-09-04 + '0x041CA7A5F1113279edEC154B9B31Ee9380d55A70', // current factory — deployed 2026-09-30 ], npm: '0x73991a25C818Bf1f1128dEAaB1492D45638DE0D3', }, @@ -38,6 +42,8 @@ const config = { '0x1E2c70bbEB3A156443B6ECBa23105FedD74a71a8', // Keellabs v2 — deployed 2026-08-05 '0xb2AA23f1664dB2AC87816ad69a2C19f217F57fc4', // fresh factory — deployed 2026-08-09 '0x309b918A4EBf5aB960B7787FE154d10229ED928b', // multi-vault factory — deployed 2026-08-15 + '0xf02a1944b264dad67ed096c00d27c2b6d846faa9', // gas-optimized factory — deployed 2026-09-04 + '0xbE14445dcDab8d00d8497b3BA09CB2bA156353Fc', // current factory — deployed 2026-09-30 ], // PRJX's position manager, not the chain's default Uniswap deployment. npm: '0xeaD19AE861c29bBb2101E834922B2FEee69B9091', @@ -47,10 +53,31 @@ const config = { // listed under `hyperliquid` (where it reads nothing), so BNB TVL was going uncounted. factories: [ '0x52dc92C7e3FdbD4fff7892dFc9DC7bc1d7a01ecf', // multi-vault factory — deployed 2026-08-18 + '0x0982a86fc8e14653f263f1fe08d0f32227e383ff', // gas-optimized factory — deployed 2026-09-04 + '0x1326b172e8419b6057e85fAA3605826b2DddAB60', // current factory — deployed 2026-09-30 ], // PancakeSwap V3's position manager, not the chain's default Uniswap deployment. npm: '0x46A15B0b27311cedF172AB29E4f4766fbE7F4364', }, + base: { + // Base, launched 2026-09-05 on AERODROME SLIPSTREAM (Aerodrome's concentrated-liquidity DEX), + // where the tokenized-stock (Coinbase B20) liquidity lives. Slipstream is a Uniswap-V3 fork + // indexed by tickSpacing instead of fee; its NonfungiblePositionManager exposes the same + // positions()/pool ABI shape, so the V3 NFT unwrap resolves it the same way. + factories: [ + '0xa215f5c5b1A0Fc322376593F75fA422fcEB6712d', // Slipstream factory — deployed 2026-09-05 + ], + // Aerodrome Slipstream's NonfungiblePositionManager (the NEW deployment, where the stock pools + // are), not the default Uniswap one. + npm: '0xe1f8cd9AC4e4A65F54f38a5CdAfCA44f6dD68b53', + }, + ethereum: { + // Ethereum mainnet, launched 2026-09-30 on Uniswap V3. + factories: [ + '0xcc5E6AE42dD0D3DB2aD9016994cFEf460d05E781', // factory — deployed 2026-09-30 + ], + npm: '0xC36442b4a4522E871399CD717aBDD847Ab11FE88', + }, } async function tvl(api) { @@ -71,21 +98,32 @@ async function tvl(api) { // bag — both are user funds held by the vault and withdrawable by its owner). const ownerTokens = vaults.map((v, i) => [[token0s[i], token1s[i]], v]) - // ...plus the token0/token1 backing each vault's open Uniswap V3 position. + // ...plus the token0/token1 backing each vault's open concentrated-liquidity position. + // + // Base runs on Aerodrome SLIPSTREAM, a Uniswap-V3 fork indexed by tickSpacing (not fee). Its NFT + // positions must be resolved with DefiLlama's Slipstream-v3 resolver, NOT the generic Uniswap-v3 + // one (which derives the pool by fee and would miss the position). DefiLlama already ships our NPM + // (0xe1f8cd9A…) as the default Slipstream-v3 NFT on base, so no extra config is needed — and + // passing `uniV3ExtraConfig` here would wrongly trigger the Uniswap-v3 path too. The other chains + // are Uniswap/PancakeSwap V3, whose NPM is non-default and must be passed explicitly. + const slip = api.chain === 'base' return sumTokens2({ api, ownerTokens, owners: vaults, - resolveUniV3: true, - uniV3ExtraConfig: { nftAddress: npm }, + ...(slip + ? { resolveSlipstreamV3: true } + : { resolveUniV3: true, uniV3ExtraConfig: { nftAddress: npm } }), }) } module.exports = { methodology: - "Enumerates every vault created by KeelLabs' VaultFactory on each chain, then sums the vault's idle token0/token1 balances (including the DCA reserve and the keeper gas budget, both owner-withdrawable) plus the underlying token0/token1 amounts of its open Uniswap V3 concentrated-liquidity position. All values are read on-chain; no external APIs.", + "Enumerates every vault created by KeelLabs' VaultFactory on each chain, then sums the vault's idle token0/token1 balances (including the DCA reserve and the keeper gas budget, both owner-withdrawable) plus the underlying token0/token1 amounts of its open concentrated-liquidity position — Uniswap V3 on Arbitrum/Robinhood/Ethereum, PancakeSwap V3 on BNB, PRJX on HyperEVM, and Aerodrome Slipstream on Base. All values are read on-chain; no external APIs.", arbitrum: { tvl }, robinhood: { tvl }, hyperliquid: { tvl }, bsc: { tvl }, + base: { tvl }, + ethereum: { tvl }, } From d28a9330bedecd862c24b69ae24a2db19d067ce3 Mon Sep 17 00:00:00 2001 From: CrossbowPleb Date: Thu, 1 Oct 2026 09:29:05 +0200 Subject: [PATCH 033/988] Add Crossbow (Robinhood Chain) (#21251) Co-authored-by: Rankko.eth <81077553+Techniciann9ne@users.noreply.github.com> Co-authored-by: ccipherx --- projects/crossbow/index.js | 132 +++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 projects/crossbow/index.js diff --git a/projects/crossbow/index.js b/projects/crossbow/index.js new file mode 100644 index 00000000000..7d62f63e7c4 --- /dev/null +++ b/projects/crossbow/index.js @@ -0,0 +1,132 @@ +const { ethers } = require('ethers') +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2, addUniV3LikePosition, unwrapSlipstreamNFT } = require('../helper/unwrapLPs') + +// ManifoldFactoryRH - deploys one vault per depositor +const FACTORY = '0x27658bD271449cD7467Cdb0FD6E6C32F789E9eFB' +const FROM_BLOCK = 64574208 +const VAULT_DEPLOYED = 'event VaultDeployed(address indexed core, address indexed vaultOwner, uint256 indexed genId, bytes32 salt)' + +const STATE_VIEW = '0xf3334192d15450cdd385c8b70e03f9a6bd9e673b' // Uniswap v4 StateView +const SLIPSTREAM_NFPM = '0x07F44c47743A2f36414A82b9F558ECFCf0EEdCEf' // up. CL position manager + +const abi = { + getPositions: 'function getPositions() view returns (uint256[])', + positionFamily: 'function positionFamily(uint256) view returns (uint16)', + positionNfpm: 'function positionNfpm(uint256) view returns (address)', + alienRefOf: 'function alienRefOf(uint256) view returns (bytes)', + lensForFamily: 'function lensForFamily(uint16) view returns (address)', + decode: 'function decode(address nfpm, bytes ref) view returns (bytes32 poolKey, address currency0, address currency1, uint24 fee, int24 tickLower, int24 tickUpper, uint256 a, uint256 b, uint256 c)', + erc6909Balance: 'function balanceOf(address owner, uint256 id) view returns (uint256)', + slot0v4: 'function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)', + slipPositions: 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 f0, uint256 f1, uint128 o0, uint128 o1)', + clGetPool: 'function getPool(address tokenA, address tokenB, int24 tickSpacing) view returns (address)', + slot0v3: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 obsIndex, uint16 obsCard, uint16 obsCardNext, bool unlocked)', +} + +const coder = ethers.AbiCoder.defaultAbiCoder() +// Hook-side positions are ERC-6909 ids keyed by pool and range. +const rangeId = (poolKey, tickLower, tickUpper) => + ethers.keccak256(coder.encode(['bytes32', 'int24', 'int24'], [poolKey, tickLower, tickUpper])) + +// Settlement assets a vault can hold without any position open against them. +// Everything else the vaults deal in is discovered from their own positions +// rather than hardcoded, so a new listing needs no change here. +const BASE_TOKENS = [ + '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168', // USDG + '0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73', // WETH +] + +async function tvl(api) { + const logs = await getLogs({ + api, target: FACTORY, eventAbi: VAULT_DEPLOYED, onlyArgs: true, fromBlock: FROM_BLOCK, + }) + const vaults = [...new Set(logs.map(l => l.core))] + + const tokens = new Set(BASE_TOKENS) + const positionSets = await api.multiCall({ abi: abi.getPositions, calls: vaults }) + const items = [] + positionSets.forEach((ids, i) => ids.forEach(id => items.push({ vault: vaults[i], id }))) + + if (items.length) { + const [families, nfpms] = await Promise.all([ + api.multiCall({ abi: abi.positionFamily, calls: items.map(p => ({ target: p.vault, params: [p.id] })) }), + api.multiCall({ abi: abi.positionNfpm, calls: items.map(p => ({ target: p.vault, params: [p.id] })) }), + ]) + items.forEach((p, i) => { p.family = +families[i]; p.nfpm = nfpms[i] }) + + const [slipTokens, hookTokens] = [ + await addSlipstreamPositions(api, items.filter(p => p.nfpm.toLowerCase() === SLIPSTREAM_NFPM.toLowerCase())), + await addHookPositions(api, items.filter(p => p.nfpm.toLowerCase() !== SLIPSTREAM_NFPM.toLowerCase())), + ] + slipTokens.concat(hookTokens).forEach(t => tokens.add(t)) + } + + // Vaults with no open positions can still hold idle balances, so this runs + // regardless of whether any positions were found. + await sumTokens2({ api, owners: vaults, tokens: [...tokens] }) +} + +// up. concentrated liquidity. Position ids come from the vault, so gauge-staked +// positions count even though the gauge holds the NFT. +async function addSlipstreamPositions(api, items) { + if (!items.length) return [] + const positionIds = items.map(p => p.id) + await unwrapSlipstreamNFT({ api, positionIds, nftAddress: SLIPSTREAM_NFPM }) + const positions = await api.multiCall({ abi: abi.slipPositions, target: SLIPSTREAM_NFPM, calls: positionIds }) + return positions.flatMap(p => [p.token0, p.token1]) +} + +// Uniswap v4 hook pools. Each position carries an encoded reference that the +// family's lens resolves into a pool key and tick range; the vault's share of +// that range is its ERC-6909 balance on the hook, which already includes staked shares. +async function addHookPositions(api, items) { + if (!items.length) return [] + // The lens registry is per-vault state, so it has to be read against the + // vault that holds the position rather than against any one of them. + const lenses = await api.multiCall({ + abi: abi.lensForFamily, calls: items.map(p => ({ target: p.vault, params: [p.family] })), + }) + items.forEach((p, i) => { p.lens = lenses[i] }) + + // A family with no registered lens cannot be valued, and skipping it would + // understate TVL silently, so fail loudly instead. + const missing = items.filter(p => p.lens === ethers.ZeroAddress) + if (missing.length) + throw new Error(`crossbow: no lens for position family ${[...new Set(missing.map(p => p.family))].join(', ')}`) + const withLens = items + + const refs = await api.multiCall({ + abi: abi.alienRefOf, calls: withLens.map(p => ({ target: p.vault, params: [p.id] })), + }) + const decoded = await api.multiCall({ + abi: abi.decode, + calls: withLens.map((p, i) => ({ target: p.lens, params: [p.nfpm, refs[i]] })), + }) + + const resolved = withLens.map((p, i) => ({ ...p, d: decoded[i] })) + const ids = resolved.map(p => rangeId(p.d.poolKey, p.d.tickLower, p.d.tickUpper)) + // stake() leaves the ERC-6909 balance in place - withdraw takes balanceOf minus + // staked - so balanceOf already covers staked shares and must not be added to. + const [shares, slot0s] = await Promise.all([ + api.multiCall({ abi: abi.erc6909Balance, calls: resolved.map((p, i) => ({ target: p.nfpm, params: [p.vault, ids[i]] })) }), + api.multiCall({ abi: abi.slot0v4, target: STATE_VIEW, calls: resolved.map(p => p.d.poolKey) }), + ]) + + resolved.forEach((p, i) => { + const liquidity = BigInt(shares[i]) + if (!liquidity) return + addUniV3LikePosition({ + api, token0: p.d.currency0, token1: p.d.currency1, liquidity: liquidity.toString(), + tickLower: +p.d.tickLower, tickUpper: +p.d.tickUpper, tick: +slot0s[i].tick, + }) + }) + return resolved.flatMap(p => [p.d.currency0, p.d.currency1]) +} + +module.exports = { + methodology: + 'Vaults are enumerated from the ManifoldFactoryRH VaultDeployed event. Each vault reports its open positions; up. concentrated-liquidity positions are valued from the position manager by token id, and Uniswap v4 hook positions are resolved through the per-family lens into a pool key and tick range, with the vault\'s liquidity read as its ERC-6909 balance on the hook, which already includes staked shares. Idle balances held by the vaults are added for every token their own positions reference, plus the chain\'s settlement assets. Doublecounted against the underlying DEXs.', + doublecounted: true, + robinhood: { tvl }, +} From 2a6d7ac61cfce602fbafb94e6922901c07300873 Mon Sep 17 00:00:00 2001 From: jeffyanta Date: Thu, 1 Oct 2026 03:32:40 -0400 Subject: [PATCH 034/988] Add Flipcash TVL adapter (#21345) Co-authored-by: Claude Opus 5.5 --- projects/flipcash/index.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 projects/flipcash/index.js diff --git a/projects/flipcash/index.js b/projects/flipcash/index.js new file mode 100644 index 00000000000..829aaa4d214 --- /dev/null +++ b/projects/flipcash/index.js @@ -0,0 +1,38 @@ +const { PublicKey } = require('@solana/web3.js') +const { getConnection, getTokenAccountBalances } = require('../helper/solana') + +const PROGRAM_ID = new PublicKey('ccJYP5gjZqcEHaphcxAZvkxCrnTVfYMjyhSYkpQtf8Z') +const LIQUIDITY_POOL_SIZE = 216 +const LIQUIDITY_POOL_DISCRIMINATOR = 'LQM2cdzDY3' // base58 of [2, 0, 0, 0, 0, 0, 0, 0] +const VAULT_B_OFFSET = 168 // vault_b (USDF), immediately followed by fees_accumulated (u64) + +async function tvl(api) { + const pools = await getConnection().getProgramAccounts(PROGRAM_ID, { + filters: [ + { dataSize: LIQUIDITY_POOL_SIZE }, + { memcmp: { offset: 0, bytes: LIQUIDITY_POOL_DISCRIMINATOR } }, + ], + dataSlice: { offset: VAULT_B_OFFSET, length: 40 }, + }) + + const vaults = pools.map(({ account }) => ({ + tokenAccount: new PublicKey(account.data.subarray(0, 32)).toBase58(), + feesAccumulated: account.data.readBigUInt64LE(32), + })) + + const balances = await getTokenAccountBalances(vaults.map(v => v.tokenAccount), { individual: true }) + + // Unburned sell fees sit in the base vault until BurnFees is called and are not backing the curve. + // Floor at zero: pools that sold under pre-Feb 2026 fee rounding can record fees above their balance. + balances.forEach(({ mint, amount }, i) => { + const backing = BigInt(amount) - vaults[i].feesAccumulated + if (backing > 0n) api.add(mint, backing.toString()) + }) +} + +module.exports = { + timetravel: false, + methodology: + 'TVL is the USDF held in the base vault of every Flipcash bonding curve liquidity pool on Solana, excluding accumulated sell fees awaiting burn. Currency tokens held in the pools are excluded, since they are issued by the protocol.', + solana: { tvl }, +} From 7a5cde343723b37471e3c84c3e1a8fd9cd495382 Mon Sep 17 00:00:00 2001 From: "tian7.eth" Date: Thu, 1 Oct 2026 15:34:18 +0800 Subject: [PATCH 035/988] Add Holi TVL adapter (#21350) Co-authored-by: tian7.eth Co-authored-by: ccipherx --- projects/holi/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/holi/index.js diff --git a/projects/holi/index.js b/projects/holi/index.js new file mode 100644 index 00000000000..72db8107e70 --- /dev/null +++ b/projects/holi/index.js @@ -0,0 +1,19 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { staking } = require('../helper/staking') + +const PRE_GENESIS_FARM = '0x58711b4AA9cc0730b3602C29299f6cfCA23b6337' +const SHYT = '0x0105Bf7d7e7d883145806a1e5664470Ee2d1518e' + +async function tvl(api) { + const tokens = await api.fetchList({ target: PRE_GENESIS_FARM, lengthAbi: 'poolCount', itemAbi: 'function pools(uint256) view returns (address token)' }) + return sumTokens2({ api, owner: PRE_GENESIS_FARM, tokens, blacklistedTokens: [SHYT] }) +} + +module.exports = { + methodology: 'TVL is the value of ERC-20 assets deposited into Holi Pre-Genesis Farm on Robinhood Chain. SHYT deposits are counted under staking.', + start: '2026-09-29', + robinhood: { + tvl, + staking: staking(PRE_GENESIS_FARM, SHYT), + }, +} From 9637f6c10d1203a680a1345dd65ad0bac7d71d01 Mon Sep 17 00:00:00 2001 From: 0xSigil Date: Thu, 1 Oct 2026 17:02:36 +0900 Subject: [PATCH 036/988] Add Faiyah Staking TVL adapter on Xphere. (#21324) --- projects/faiyah-staking/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/faiyah-staking/index.js diff --git a/projects/faiyah-staking/index.js b/projects/faiyah-staking/index.js new file mode 100644 index 00000000000..e52e6126599 --- /dev/null +++ b/projects/faiyah-staking/index.js @@ -0,0 +1,31 @@ +const sdk = require('@defillama/sdk') +const { nullAddress } = require('../helper/tokenMapping') + +const FACTORY = '0x95c8853e6bD1DBCE2428Aa6953eb7680261F22fe' + +// A same-token pool holds its reward bucket next to the principal and can pay rewards out of +// principal when the bucket runs dry, so count what the pool holds, capped at what users staked. +const held = (bal, staked) => (BigInt(bal) < BigInt(staked) ? bal : staked) + +async function tvl(api) { + const pools = await api.fetchList({ lengthAbi: 'uint256:idCounter', itemAbi: 'function allPools(uint256) view returns (address)', target: FACTORY }) + const tokens = await api.multiCall({ abi: 'address:stakingToken', calls: pools }) + const staked = await api.multiCall({ abi: 'uint256:totalStaked', calls: pools }) + + const native = pools.filter((_, i) => tokens[i] === nullAddress) + const { output: nativeBals } = await sdk.api.eth.getBalances({ targets: native, chain: api.chain, block: api.block }) + const erc20Bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: pools.map((p, i) => ({ target: tokens[i], params: p })).filter(({ target }) => target !== nullAddress) }) + + let n = 0, e = 0 + pools.forEach((_, i) => { + const token = tokens[i] + api.add(token, held(token === nullAddress ? nativeBals[n++].balance : erc20Bals[e++], staked[i])) + }) +} + +module.exports = { + methodology: + 'Sums every token users have staked in the staking pools on Xphere. Each pool counts the lesser of its token balance and its recorded stake, which leaves out the reward funds an admin deposits and any principal already paid out as rewards.', + start: '2026-04-24', + xp: { tvl }, +} From fe84914d227a2592e00a8b0083b42f90080bc13e Mon Sep 17 00:00:00 2001 From: Danny Plainview <140389355+0xplainview@users.noreply.github.com> Date: Thu, 1 Oct 2026 04:14:02 -0500 Subject: [PATCH 037/988] Add moto.fun (Motoswap launchpad) (#21329) --- projects/moto-fun/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/moto-fun/index.js diff --git a/projects/moto-fun/index.js b/projects/moto-fun/index.js new file mode 100644 index 00000000000..0a55e6d7585 --- /dev/null +++ b/projects/moto-fun/index.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// moto.fun, the token launchpad of Motoswap, on Ethereum mainnet (live since 2026-09-28). +// One contract, the LaunchpadCurve (UUPS proxy), holds every coin's bonding curve and the ETH it has raised. +// Fees are paid out on every trade (protocol leg to the Motoswap fee collector, creator leg to the creator fee vault), +// so the curve's native balance is the sum of the ETH reserves of the coins still on their curves. +// At graduation the ETH moves into Motoswap pairs with the LP burned; that liquidity is counted in the Motoswap adapter. + +const CURVE = '0xb65b67e986d7B097652920d72202F2c78319BC2C' + +async function tvl(api) { + return api.sumTokens({ owner: CURVE, tokens: [ADDRESSES.null] }) +} + +module.exports = { + methodology: + 'TVL is the ETH held by the moto.fun bonding curve contract for coins that have not graduated yet. ' + + 'Graduated coins trade on Motoswap pairs, which are counted in the Motoswap adapter.', + start: '2026-09-28', // block 26075263 + ethereum: { tvl }, +} From eac60ae675131715857607c24bf61593ddb642ae Mon Sep 17 00:00:00 2001 From: AevaChain <333018100+AevaChain@users.noreply.github.com> Date: Thu, 1 Oct 2026 11:18:21 +0200 Subject: [PATCH 038/988] Add Aeva Bridge TVL on Robinhood (#21338) Co-authored-by: ccipherx --- projects/aeva-bridge/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/aeva-bridge/index.js diff --git a/projects/aeva-bridge/index.js b/projects/aeva-bridge/index.js new file mode 100644 index 00000000000..e51e7ed1c39 --- /dev/null +++ b/projects/aeva-bridge/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking') + +// Hyperlane HypERC20Collateral routers (core 12.1.0) holding the bridged collateral on Robinhood Chain +const AEVA = '0xe8729Dc9dCA85167e06b7E9c66a58b22457c5F30' +const AEVA_ROUTER = '0xA880B6e6511DAF5A0Bdde96EE8b36D8004D9D7eD' +const USDG_ROUTER = '0x856a649A84C8c6bB1e2541097bB293af5DD57857' + +module.exports = { + methodology: "TVL counts the USDG locked in the Aeva bridge's Hyperlane collateral router on Robinhood Chain, which backs aeUSD on Aeva Mainnet. $AEVA locked in the AEVA router is Aeva's own token and is counted under staking.", + start: '2026-09-28', + robinhood: { + tvl: (api) => api.sumTokens({ owner: USDG_ROUTER, tokens: [ADDRESSES.robinhood.USDG] }), + staking: staking(AEVA_ROUTER, AEVA), + }, +} From 196e1786110880082da9604fca274b2e05a357e2 Mon Sep 17 00:00:00 2001 From: bruno <52743786+Bruno12221@users.noreply.github.com> Date: Thu, 1 Oct 2026 11:19:51 +0200 Subject: [PATCH 039/988] Add zk.money TVL adapter (#21335) --- projects/zk-money/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/zk-money/index.js diff --git a/projects/zk-money/index.js b/projects/zk-money/index.js new file mode 100644 index 00000000000..b0f77d39898 --- /dev/null +++ b/projects/zk-money/index.js @@ -0,0 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const PORTAL = '0xdf410ad448A0f7165181FBdB32f8896f4a0d9449' + +module.exports = { + start: '2026-09-25', + methodology: 'TVL is the DAI held in zk.money\'s Ethereum portal, which backs private DAI balances on Aztec. USDC and USDT deposits are swapped to DAI before entering the portal.', + ethereum: { + tvl: sumTokensExport({ owner: PORTAL, tokens: [ADDRESSES.ethereum.DAI] }), + }, +} From 60b58b6dcfdb291fa99bd27d7524ae2169bb5421 Mon Sep 17 00:00:00 2001 From: Alfu Date: Thu, 1 Oct 2026 12:27:59 +0200 Subject: [PATCH 040/988] infiniFi: add Base and Monad TVL (#21309) --- projects/infiniFi/index.js | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/projects/infiniFi/index.js b/projects/infiniFi/index.js index b5125408f5a..8b27c5a3e36 100644 --- a/projects/infiniFi/index.js +++ b/projects/infiniFi/index.js @@ -1,4 +1,14 @@ -const registry = '0x7A5C5dbA4fbD0e1e1A2eCDBe752fAe55f6E842B3' +const accounting = { + ethereum: '0x7A5C5dbA4fbD0e1e1A2eCDBe752fAe55f6E842B3', + base: '0x2ED079F04211baDA1a4e53F01782217334Cc28ce', + monad: '0x386DfFb5a31588aB56Df20C54Ec649F3B554362C', +} + +// L1 mirror farms for Outland Base / Monad — assets are counted on those L2 chains +const ethereumOutlandMirrorFarms = new Set([ + '0xbD6c2d1C4809a5D8847FbA3a3cf7d6BDf6b6C3bA', + '0xA7c1DAEAA5D97e1319B4Ff6Cdf658F5C4582A27E', +].map((a) => a.toLowerCase())) const abis = { farmRegistry: 'address:farmRegistry', @@ -8,11 +18,16 @@ const abis = { } const tvl = async (api) => { - const farmsRegistry = await api.call({ abi: abis.farmRegistry, target: registry }) - const farms = await api.call({ abi: abis.getFarms, target: farmsRegistry }) + const farmsRegistry = await api.call({ abi: abis.farmRegistry, target: accounting[api.chain] }) + let farms = await api.call({ abi: abis.getFarms, target: farmsRegistry }) + // exclude L1 mirror farms if on Ethereum + if(api.chain === 'ethereum') { + farms = farms.filter((farm) => !ethereumOutlandMirrorFarms.has(farm.toLowerCase())) + } + const [balances, tokens] = await Promise.all([ - await api.multiCall({ calls: farms, abi: abis.assets }), - await api.multiCall({ calls: farms, abi: abis.assetToken }) + api.multiCall({ calls: farms, abi: abis.assets }), + api.multiCall({ calls: farms, abi: abis.assetToken }), ]) farms.forEach((_, i) => { @@ -21,6 +36,10 @@ const tvl = async (api) => { } module.exports = { - methodology: 'TVL of the protocol is the value of all asssets deposited in the protocol kept in the accounting contract', - ethereum: { tvl } -} \ No newline at end of file + methodology: + 'Sums assets() across farms registered in each chain Accounting contract. On Ethereum, L1 Outland mirror farms for Base and Monad are excluded because the same assets are counted on those L2 chains.', +} + +Object.keys(accounting).forEach((chain) => { + module.exports[chain] = { tvl } +}) From 4b159027129fd5c5967ba0e9e5e8f1ec8d780da3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 1 Oct 2026 13:21:19 +0200 Subject: [PATCH 041/988] update bitget --- projects/bitget/index.js | 251 ++++++++++++++------------------------- 1 file changed, 89 insertions(+), 162 deletions(-) diff --git a/projects/bitget/index.js b/projects/bitget/index.js index 29470f54032..dca96d7142c 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -3,98 +3,91 @@ const { mergeExports, getStakedEthTVL } = require("../helper/utils"); const { cexExports } = require("../helper/cex"); const bitcoinAddressBook = require("../helper/bitcoin-book/index.js"); +const evmOwners = [ + "0x0639556f03714a74a5feeaf5736a4a64ff70d206", + "0x149ded7438caf5e5bfdc507a6c25436214d445e1", + "0x3a7d1a8c3a8dc9d48a68e628432198a2ead4917c", + "0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689", + "0xa316c725bc8401c97d6d96f283c14b827541744e", + "0xc43999113f8fe724d91356c26105def1449ebdfd", + "0x8911b8f5127eec40c14e1ad0500dc4dbd279d7a7", + "0x1ff33329a8f8c1927131cbb72362b00abeea02d3", + "0x5bdf85216ec1e38d6458c870992a69e38e03f7ef", + "0x80097a87a7dcde470e34c10b5cceb85abf83b531", + "0xe4786cfe980ef5a6428a2fffafabf24f1fc79b64", + "0x4c1d7de286d7c20df5f2ba44b3bc706c1e03bf13", + "0xac65bdf867103ae2c3a75cdd4b68f9d7178c604f", + "0x14b5f559c27bc00c39f668a88471498d68d18768", + "0xe7b3b0a59b026ec1fef16561daf93672a61bafec", + "0x1ab4973a48dc892cd9971ece8e01dcc7688f8f23", + "0x1084203d70950bd7a93aef75eb32a51df2422a07", + "0xbcf6011192399df75a96b0a4ce47c4820853e9e5", + "0x864a7fa57e0f8902a2de4892e925f1272edbe3fa", + "0xffa8db7b38579e6a2d14f9b347a9ace4d044cd54", + "0x092fe28430bade62c7c044b9c77d0aaa06241319", + "0x934186fd8352fa734eb0df82e8863e6449193294", + "0x1ae3739e17d8500f2b2d80086ed092596a116e0b", + "0x2bf7494111a59bd51f731dcd4873d7d71f8feeec", + "0x31a36512d4903635b7dd6828a934c3915a5809be", + "0x461f6dcdd5be42d41fe71611154279d87c06b406", + "0x9e00816f61a709fa124d36664cd7b6f14c13ee05", + "0xdfe4b89cf009bffa33d9bca1f19694fc2d4d943d", + "0xe2b406ec9227143a8830229eeb3eb6e24b5c60be", + "0xe6a421f24d330967a3af2f4cdb5c34067e7e4d75", + "0xe80623a9d41f2f05780d9cd9cea0f797fd53062a", + "0xf646d9b7d20babe204a89235774248ba18086dae", + "0x1d5ba5414f2983212e03bf7725add9eb4cdb00dc", + "0x51971c86b04516062c1e708cdc048cb04fbe959f", + "0x5051e9860c1889eb1bfa394365364b3dd61787f1", + "0x731309e453972598ea05d706c6ee6c3c21ab4d2a", + "0x842ea89f73add9e4fe963ae7929fdc1e80acdb52", + "0x1a96e5da1315efcf9b75100f5757d5e8b76abb0c", + "0x4dfc15890972ecea7a213bda2b478dabc382e7a1", + "0x70213959a644baa94840bbfb4129550bceceb3c2", + "0x54a679e853281a440911f72eae0e24107e9413dc", + "0x0edd5b0de0fe748be331186bf0aa878f47f601db", + "0x4121217c238db06e942f3d87371106d30d0f8c84", + "0xed470553f61f23cd30ccf51ab066dc1598ed0c4f", + "0x59708733fbbf64378d9293ec56b977c011a08fd2", + "0xaab0039de2a8dba8696ee4d42c0d1aa30d7e1059", + "0xf207b2f9f9417fc73cad069f7aa5ae1c6a5b428d", + "0x4d216d2682f3997f6c19420beee4530d08d0ea5f", + "0xdbe46a02322e636b92296954637e1d7db9d5ed26", + "0xbff5092f83bd810e0926068b89633bf66eaa037b", + "0x3c2a309d9005433c1bc2c92ef1be06489e5bf258", + "0xe368759445438b8ec4e50bf4094e939341174e62", + "0x2dd64ee5ea8706097a5674154288989e3dbe3a05", + "0xa700c091687afbfada6b84b5e02a5e672ee35597", + "0xd509ff5d6e530401b53cc7d3b80607824d85ff60", + "0x255e91ab794da40d39a5aceff20d98841df873af", + "0x9756b4eedc434ca23dffd209c8ea01d4c95ff881", + "0x9a449ef3665f60af503ea5b8ef5191aeb315b809", + "0x58751ce78f174b58b8f5e345244984a78524a899", + "0x9f199b93ae33c330880bdb31422fca37c6d3fb14", + "0x9c9c8f4f33679ce7f2c46cbf8ab4feb4cf45fe46", + "0x8028270e06fca18e212306a7c93bfee52b440fc5", + "0x0635ac6675e05c7f58383493bb7d1a513cd65688", + "0x1d774ed0a7b897aaae3526f07e487c5f9540f55d", + "0xec96bbbe895301710a89a06546264ebb4f0cc546", + "0x95ccca6d1859ae5670c2213940c96dcb2e177fcb", + "0x26209d9f0dc3ac0129c3fb1badabfeb9ee728c66", + "0xadfffc33cdc9970349cbcea3d73ec343d6ed116d", + "0x81fb786799ebacc67abc0abaf5589aa0d7773fa0", + "0xf2c1a45ec2013c686c9568a4f250158c425e4373", + "0x0c4681e6c0235179ec3d4f4fc4df3d14fdd96017", + "0x9b0cb31f3e9232196aeaa7cac03ea95c5a4f0e35", + "0xed9ab5bc05a0152b9dc2f7902e8369af7bc18771", + "0x15560877043a89358f59b3896dfac2a3e1212658", + "0xb41cc5c62fe06eecb096fd55d70cf813fbd9a3e1", + "0x7c539b00719ec375a016032cc3a5b1f8e3a2f31e", + "0x8a4af9f649434350f795fa7ba7edfb5404b9b078", + "0xb3e8a3b17c50f077685bcdef2ca496e54d91c4bd", + "0x4cad1efbfd5f0848e0c3c14fab23f92b2fa81f17", +] + +const evmChains = ["bsc","ethereum","arbitrum","optimism","era","fantom","cronos","avax","polygon","metis","kava","klaytn","base","hyperliquid","sonic"] + const config = { - bsc: { - owners: [ - "0x0639556F03714A74a5fEEaF5736a4A64fF70D206", - "0x149ded7438caf5e5bfdc507a6c25436214d445e1", - "0x3a7d1a8c3a8dc9d48a68e628432198a2ead4917c", - "0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689", - "0xa316c725bc8401c97d6d96f283c14b827541744e", - "0xc43999113f8fe724d91356c26105def1449ebdfd", - "0x8911b8f5127eec40c14e1ad0500dc4dbd279d7a7", - "0x1ff33329a8f8c1927131cbb72362b00abeea02d3", - "0x5bdf85216ec1e38d6458c870992a69e38e03f7ef", - "0x80097a87a7dcde470e34c10b5cceb85abf83b531", - "0xe4786cfe980ef5a6428a2fffafabf24f1fc79b64", - "0x4c1d7de286d7c20df5f2ba44b3bc706c1e03bf13", - "0xac65bdf867103ae2c3a75cdd4b68f9d7178c604f", - "0x14b5f559c27bc00c39f668a88471498d68d18768", - "0xe7b3b0a59b026ec1fef16561daf93672a61bafec", - "0x1ab4973a48dc892cd9971ece8e01dcc7688f8f23", - "0x1084203d70950bd7a93aef75eb32a51df2422a07", - "0xbcf6011192399df75a96b0a4ce47c4820853e9e5", - "0x864a7fa57e0f8902a2de4892e925f1272edbe3fa", - "0xffa8db7b38579e6a2d14f9b347a9ace4d044cd54", - "0x092fe28430bade62c7c044b9c77d0aaa06241319", - "0x934186fd8352fa734eb0df82e8863e6449193294", - ], - }, - ethereum: { - owners: [ - "0x0639556F03714A74a5fEEaF5736a4A64fF70D206", - "0x1Ae3739E17d8500F2b2D80086ed092596A116E0b", - "0x2bf7494111a59bD51f731DCd4873D7d71F8feEEC", - "0x31a36512d4903635b7dd6828a934c3915a5809be", - "0x461f6dCdd5Be42D41FE71611154279d87c06B406", - "0x5bdf85216ec1e38d6458c870992a69e38e03f7ef", - "0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689", - "0x9E00816F61a709fa124D36664Cd7b6f14c13eE05", - "0xdFE4B89cf009BFfa33D9BCA1f19694FC2d4d943d", - "0xe2b406ec9227143a8830229eeb3eb6e24b5c60be", - "0xe6a421f24d330967a3af2f4cdb5c34067e7e4d75", - "0xe80623a9d41f2f05780d9cd9cea0f797fd53062a", - "0xf646d9B7d20BABE204a89235774248BA18086dae", - "0x1d5ba5414f2983212e03bf7725add9eb4cdb00dc", //add on 12/01/2024 - "0x51971c86b04516062c1e708cdc048cb04fbe959f", //add on 12/01/2024 - "0x5051e9860c1889eb1bfa394365364b3dd61787f1", //add on 12/01/2024 - "0x731309e453972598ea05d706c6ee6c3c21ab4d2a", //add on 12/01/2024 - "0x842ea89f73add9e4fe963ae7929fdc1e80acdb52", //add on 12/01/2024 - "0x1a96e5da1315efcf9b75100f5757d5e8b76abb0c", //add on 12/01/2024 - "0x4dfc15890972ecea7a213bda2b478dabc382e7a1", //add on 12/01/2024 - "0x70213959a644baa94840bbfb4129550bceceb3c2", // add on 27/05/2024 - "0x54a679e853281a440911f72eae0e24107e9413dc", // add on 27/05/2024 - "0x1ab4973a48dc892cd9971ece8e01dcc7688f8f23", // add on 27/05/2024 - "0x0edd5b0de0fe748be331186bf0aa878f47f601db", // add on 27/05/2024 - "0x4121217c238db06e942f3d87371106d30d0f8c84", // add on 27/05/2024 - "0xed470553f61f23cd30ccf51ab066dc1598ed0c4f", // add on 27/05/2024 - "0x59708733fbbf64378d9293ec56b977c011a08fd2", // add on 27/05/2024 - "0xaab0039de2a8dba8696ee4d42c0d1aa30d7e1059", // add on 27/05/2024 - "0xf207b2f9f9417fc73cad069f7aa5ae1c6a5b428d", // add on 27/05/2024 - "0x4d216d2682f3997f6c19420beee4530d08d0ea5f", // add on 27/05/2024 - "0xdbe46a02322e636b92296954637e1d7db9d5ed26", // add on 27/05/2024 - "0xbff5092f83bd810e0926068b89633bf66eaa037b", - "0x80097a87a7dcde470e34c10b5cceb85abf83b531", - "0xe4786cfe980ef5a6428a2fffafabf24f1fc79b64", - "0x4c1d7de286d7c20df5f2ba44b3bc706c1e03bf13", - "0xac65bdf867103ae2c3a75cdd4b68f9d7178c604f", - "0x14b5f559c27bc00c39f668a88471498d68d18768", - "0xe7b3b0a59b026ec1fef16561daf93672a61bafec", - "0x3c2a309d9005433c1bc2c92ef1be06489e5bf258", - "0xe368759445438b8ec4e50bf4094e939341174e62", - "0x2dd64ee5ea8706097a5674154288989e3dbe3a05", - "0xa700c091687afbfada6b84b5e02a5e672ee35597", - "0xd509ff5d6e530401b53cc7d3b80607824d85ff60", - "0x255e91ab794da40d39a5aceff20d98841df873af", - "0x9756b4eedc434ca23dffd209c8ea01d4c95ff881", - "0x9a449ef3665f60af503ea5b8ef5191aeb315b809", - "0x58751ce78f174b58b8f5e345244984a78524a899", - "0x9f199b93ae33c330880bdb31422fca37c6d3fb14", - "0x9c9c8f4f33679ce7f2c46cbf8ab4feb4cf45fe46", - "0x8028270e06fca18e212306a7c93bfee52b440fc5", - "0x0635ac6675e05c7f58383493bb7d1a513cd65688", - "0x1D774ed0A7b897aAaE3526F07e487C5F9540F55D", - "0xffa8db7b38579e6a2d14f9b347a9ace4d044cd54", - "0x5bdf85216ec1e38d6458c870992a69e38e03f7ef", - "0xec96bbbe895301710a89a06546264ebb4f0cc546", - "0x95ccca6d1859ae5670c2213940c96dcb2e177fcb", - "0x26209d9f0dc3ac0129c3fb1badabfeb9ee728c66", - "0xadfffc33cdc9970349cbcea3d73ec343d6ed116d", - ], - blacklistedTokens: [ - "0x19de6b897ed14a376dda0fe53a5420d2ac828a28", // old bitget token - ] - }, tron: { owners: [ "TAa8e7U7seCy7NcZ52xYVQXXybFfwvsUxz", @@ -131,59 +124,6 @@ const config = { bitcoin: { owners: bitcoinAddressBook.bitget, }, - arbitrum: { - owners: [ - "0x0639556F03714A74a5fEEaF5736a4A64fF70D206", - "0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689", - "0x5bdf85216ec1e38d6458c870992a69e38e03f7ef", //add on 12/01/2024 - "0x14b5f559c27bc00c39f668a88471498d68d18768", - "0x81fb786799ebacc67abc0abaf5589aa0d7773fa0", - "0xf2c1a45ec2013c686c9568a4f250158c425e4373", - "0xe7b3b0a59b026ec1fef16561daf93672a61bafec", - "0x0c4681e6c0235179ec3d4f4fc4df3d14fdd96017", - "0x1ab4973a48dc892cd9971ece8e01dcc7688f8f23", - "0xffa8db7b38579e6a2d14f9b347a9ace4d044cd54", - ], - }, - optimism: { - owners: [ - "0x0639556F03714A74a5fEEaF5736a4A64fF70D206", - "0x5bdf85216ec1e38d6458c870992a69e38e03f7ef", - "0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689", - "0x14b5f559c27bc00c39f668a88471498d68d18768", - "0xe7b3b0a59b026ec1fef16561daf93672a61bafec", - "0x1ab4973a48dc892cd9971ece8e01dcc7688f8f23", - ], - }, - era: { - owners: ["0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689"], - }, - fantom: { - owners: ["0x5bdf85216ec1e38d6458c870992a69e38e03f7ef"], - }, - cronos: { - owners: ["0x0639556F03714A74a5fEEaF5736a4A64fF70D206"], - }, - avax: { - owners: [ - "0x0639556F03714A74a5fEEaF5736a4A64fF70D206", - "0x5bdf85216ec1e38d6458c870992a69e38e03f7ef", - "0xe7b3b0a59b026ec1fef16561daf93672a61bafec", - "0x1ab4973a48dc892cd9971ece8e01dcc7688f8f23", - ], - }, - polygon: { - owners: [ - "0x0639556F03714A74a5fEEaF5736a4A64fF70D206", - "0x5bdf85216ec1e38d6458c870992a69e38e03f7ef", - "0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689", - "0x14b5f559c27bc00c39f668a88471498d68d18768", - "0xe7b3b0a59b026ec1fef16561daf93672a61bafec", - "0x1ab4973a48dc892cd9971ece8e01dcc7688f8f23", - "0x9b0cb31f3e9232196aeaa7cac03ea95c5a4f0e35", - "0xffa8db7b38579e6a2d14f9b347a9ace4d044cd54", - ], - }, ripple: { owners: [ "r3AEihLNr81VYUf5PdfH5wLPqtJJyJs6yY", @@ -215,12 +155,6 @@ const config = { 'DTHZron9cR6WstH6VcdsVZwSbVDEnFKkGQ', ], }, - metis: { - owners: ["0x5bdf85216ec1e38d6458c870992a69e38e03f7ef"], - }, - kava: { - owners: ["0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689"], - }, starknet: { owners: [ "0x0299b9008e2d3fa88de6d06781fc9f32f601b2626cb0efa8e8c19f2b17837ed1", @@ -283,18 +217,6 @@ const config = { "UQCe6OZlNFHXWBai5V3CzYsdO68yZR2GMdMYWO6NJ1wYi5PA", // add on 18/09/2026 ], }, - klaytn: { - owners: ['0x0639556f03714a74a5feeaf5736a4a64ff70d206',], - }, - base: { - owners: ['0xffa8db7b38579e6a2d14f9b347a9ace4d044cd54',], - }, - hyperliquid: { - owners: ['0xffa8db7b38579e6a2d14f9b347a9ace4d044cd54',], - }, - sonic: { - owners: ['0xffa8db7b38579e6a2d14f9b347a9ace4d044cd54',], - }, cardano: { owners: [ "Ae2tdPwUPEZKnykUqXyYQxqJSnADNkm4ELUnyqZUBHcCrNJVDqozLYCt9Jv", @@ -311,6 +233,11 @@ const config = { }, }; +evmChains.forEach(chain => { config[chain] = { owners: [...evmOwners] } }) +config.ethereum.blacklistedTokens = [ + "0x19de6b897ed14a376dda0fe53a5420d2ac828a28", // old bitget token +] + const withdrawalAddresses = [ '0x334cf9ceef9178c7a9bb5495ac8790e9bed316a3', '0x1d5ba5414f2983212e03bf7725add9eb4cdb00dc', From b0cce9a35fca3cc826582f6c1031ee0e7cdb191e Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 1 Oct 2026 07:25:14 -0400 Subject: [PATCH 042/988] add missing chains and tokens to flap (#21356) --- registries/sumTokens.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index e86153e76e3..1fd9fdadbb8 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -14625,8 +14625,21 @@ const configs = { "owners": [ "0xe2ce6ab80874fa9fa2aae65d277dd6b8e65c9de0" ], + "fetchCoValentTokens": true + }, + "base": { + "owners": [ + "0x0000BC1c4fD15Dd79029AF8F5d77D68ae4490000" + ], + "fetchCoValentTokens": true + }, + "robinhood": { + "owner": "0x26605f322f7fF986f381bB9A6e3f5DAb0bEaEb09", "tokens": [ - ADDRESSES.null + ADDRESSES.null, + ADDRESSES.robinhood.WETH, + ADDRESSES.robinhood.USDG, + ADDRESSES.robinhood.USDe ] }, "xlayer": { @@ -14637,6 +14650,13 @@ const configs = { ADDRESSES.stable.USDT0 ] }, + "monad": { + "owner": "0x30e8ee7b5881bf2E158A0514f2150aabe2c68b23", + "tokens": [ + ADDRESSES.null, + ADDRESSES.monad.USDC + ] + } }, "flare-loans": { "methodology": "We count all WSGB on 0xFa21A4ABD1a58CefAB79CFd597aCcc314403eE9f and all EXFI on 0x4595fc96262057f9b0d4276ff04de8f2f44e612e, which are backing the stablecoin", From ee7625cebc3590bb306a7189c2eb9931eb0c8298 Mon Sep 17 00:00:00 2001 From: i own ducks <111690356+iownducks@users.noreply.github.com> Date: Thu, 1 Oct 2026 17:39:39 +0500 Subject: [PATCH 043/988] Add BTB Finance (#21312) Co-authored-by: FelixBruguera --- projects/btb-finance/index.js | 151 ++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 projects/btb-finance/index.js diff --git a/projects/btb-finance/index.js b/projects/btb-finance/index.js new file mode 100644 index 00000000000..9f524b68565 --- /dev/null +++ b/projects/btb-finance/index.js @@ -0,0 +1,151 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2, unwrapSlipstreamNFT, unwrapUniswapV3NFT } = require('../helper/unwrapLPs') + +// BTB Finance auto-rebalance. Every user gets their own smart wallet (BTB Smart Account V6), created by a BTB +// factory; the BTB agent keeps the positions inside it in range. Nothing is pooled: TVL is the sum of what those +// wallets hold, read on chain. +// +// Wallets come from the factories' AccountCreated events. A wallet's positions are the LP NFTs it holds plus those +// staked for it. Held NFTs are enumerated from each position manager. On Base (log indexer) the gauges a wallet +// staked into are the Aerodrome gauges it sent NFTs to, and each returns the wallet's staked ids; on Robinhood Chain +// they are read directly: the Giga farm lists each staker's NFTs, and every UP gauge (listed by the UP voter) +// returns each wallet's staked ids. Loose tokens in the wallets count too. + +const TRANSFER = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' +const transferAbi = 'event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)' +const createdAbiV1 = 'event AccountCreated(address indexed owner, address indexed account)' +const createdAbi = 'event AccountCreated(address indexed owner, address indexed account, address implementation)' + +const config = { + base: { + factories: [ + { address: '0xE10280d01F95bC88DA149a224e68debc0721f8E6', fromBlock: 51697142, eventAbi: createdAbiV1 }, + { address: '0xc922eb8dCF5D61CEeFaeCe86265F5f0D6dC0EC77', fromBlock: 51803585, eventAbi: createdAbi }, + ], + uniV3: ['0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1'], // Uniswap V3 + slipstream: [ + '0x827922686190790b37229fd06084350e74485b72', // Aerodrome Slipstream + '0xa990C6a764b73BF43cee5Bb40339c3322FB9D55F', // Aerodrome Slipstream (gauge caps) + '0xe1f8cd9AC4e4A65F54f38a5CdAfCA44f6dD68b53', // Aerodrome Slipstream (newest) + ], + algebra: [], + farms: [], + gaugeVoter: '0x16613524e02ad97eDfeF371bC883F2F5d6C480A5', // Aerodrome voter, for gauges found from logs + tokens: [ + '0x4200000000000000000000000000000000000006', // WETH + '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC + '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', // cbBTC + '0x940181a94A35A4569E4529A3CDfB74e38FD98631', // AERO + ], + }, + robinhood: { + factories: [ + { address: '0xE10280d01F95bC88DA149a224e68debc0721f8E6', fromBlock: 71000867, eventAbi: createdAbiV1 }, + { address: '0xc922eb8dCF5D61CEeFaeCe86265F5f0D6dC0EC77', fromBlock: 72794809, eventAbi: createdAbi }, + ], + uniV3: [ + '0x73991a25C818Bf1f1128dEAaB1492D45638DE0D3', // Uniswap V3 + '0xA79F5775b0B49E51202c48DDF03F380FaA96f641', // Giga V3 + ], + slipstream: ['0x07F44c47743A2f36414A82b9F558ECFCf0EEdCEf'], // UP + algebra: ['0xe62a5F67516dBDBA2Aa28b1512C8Ff44E42cB5c3'], // Alandale (Algebra Integral) + farms: [{ chef: '0x60380925A8b1007F70f60A6A42bffE391374B09a', nft: '0xA79F5775b0B49E51202c48DDF03F380FaA96f641' }], // Giga farm + voters: [{ voter: '0x7F749fDD351C1Ceed82d76d7699CB631Eb8332a7', nft: '0x07F44c47743A2f36414A82b9F558ECFCf0EEdCEf' }], // UP gauges + tokens: [ + '0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73', // WETH + '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168', // USDG + '0x5BaaeC1B70864f01dbdb747358FF59F2E2cCF7D5', // GIGA + '0x57C0E45cB534413D1C20A4240955d6bB250BB4F1', // UP + '0xD1e861CC5Eee7eA88649206b74504D78CCD7AEeA', // LUTE + '0x39dbed3a2bd333467115de45665cc57f813c4571', // PONS + ], + }, +} + +// A few blocks behind the head, so a lagging RPC in the pool never sees a range past its own latest block. +async function safeToBlock(api) { + return (await api.getBlock()) - 20 +} + +async function wallets(api, { factories }, toBlock) { + const lists = await Promise.all(factories.map(({ address, fromBlock, eventAbi }) => + getLogs({ api, target: address, eventAbi, fromBlock, toBlock, onlyArgs: true }))) + return [...new Set(lists.flat().map(l => l.account.toLowerCase()))] +} + +// Base: a wallet only lets an NFT leave to its owner or to a farm that stakes it, so the gauges it staked into are +// the voter's gauges among the contracts it sent NFTs to. Each of those gauges returns the wallet's staked ids. +async function stakedFromLogs(api, nft, voter, owners, fromBlock, toBlock) { + // One query for all wallets: the sender topic matches any of them. + const logs = await getLogs({ + api, target: nft, eventAbi: transferAbi, onlyArgs: true, fromBlock, toBlock, + topics: [TRANSFER, owners.map(o => '0x' + o.slice(2).padStart(64, '0'))], + extraKey: `btb-sent-${owners.length}`, + }) + const pairs = [...new Set(logs.map(l => `${l.from.toLowerCase()}:${l.to.toLowerCase()}`))].map(p => p.split(':')) + const recipients = [...new Set(pairs.map(([, to]) => to))] + if (!recipients.length) return [] + const isGauge = await api.multiCall({ abi: 'function isGauge(address) view returns (bool)', target: voter, calls: recipients }) + const gauges = new Set(recipients.filter((_, i) => isGauge[i])) + const calls = pairs.filter(([, to]) => gauges.has(to)).map(([owner, target]) => ({ target, params: [owner] })) + const staked = await api.multiCall({ abi: 'function stakedValues(address) view returns (uint256[])', calls }) + return staked.flat().map(String) +} + +// NFT ids an ERC721-enumerable contract lists for each owner (a position manager, or a farm that tracks stakers). +async function enumerated(api, target, owners) { + const counts = await api.multiCall({ abi: 'erc20:balanceOf', target, calls: owners }) + const calls = [] + owners.forEach((owner, i) => { for (let j = 0; j < Number(counts[i]); j++) calls.push({ params: [owner, j] }) }) + return api.multiCall({ abi: 'function tokenOfOwnerByIndex(address, uint256) view returns (uint256)', target, calls }) +} + +// Positions staked for the wallets in any gauge a Solidly-style voter lists. +async function stakedInGauges(api, voter, owners) { + const pools = await api.fetchList({ lengthAbi: 'uint256:length', itemAbi: 'function pools(uint256) view returns (address)', target: voter }) + const gauges = (await api.multiCall({ abi: 'function gauges(address) view returns (address)', target: voter, calls: pools })) + .filter(g => g && g !== '0x0000000000000000000000000000000000000000') + const calls = gauges.flatMap(target => owners.map(owner => ({ target, params: [owner] }))) + const staked = await api.multiCall({ abi: 'function stakedValues(address) view returns (uint256[])', calls, permitFailure: true }) + return staked.flat().filter(id => id != null).map(String) +} + +async function tvl(api) { + const cfg = config[api.chain] + const toBlock = await safeToBlock(api) + const owners = await wallets(api, cfg, toBlock) + if (!owners.length) return {} + const fromBlock = Math.min(...cfg.factories.map(f => f.fromBlock)) + + const idsFor = async (nft, { gauges = false } = {}) => { + const ids = (await enumerated(api, nft, owners)).map(String) + if (gauges && cfg.gaugeVoter) ids.push(...await stakedFromLogs(api, nft, cfg.gaugeVoter, owners, fromBlock, toBlock)) + const farm = cfg.farms.find(f => f.nft.toLowerCase() === nft.toLowerCase()) + if (farm) ids.push(...(await enumerated(api, farm.chef, owners)).map(String)) + const voter = cfg.voters?.find(v => v.nft.toLowerCase() === nft.toLowerCase()) + if (voter) ids.push(...await stakedInGauges(api, voter.voter, owners)) + return [...new Set(ids)] + } + + for (const nft of cfg.uniV3) { + const positionIds = await idsFor(nft) + if (positionIds.length) await unwrapUniswapV3NFT({ api, nftAddress: nft, uniV3ExtraConfig: { positionIds } }) + } + for (const nft of cfg.algebra) { + const positionIds = await idsFor(nft) + if (positionIds.length) await unwrapUniswapV3NFT({ api, nftAddress: nft, uniV3ExtraConfig: { positionIds }, isAlgebra: true }) + } + for (const nft of cfg.slipstream) { + const positionIds = await idsFor(nft, { gauges: true }) + if (positionIds.length) await unwrapSlipstreamNFT({ api, nftAddress: nft, positionIds }) + } + return sumTokens2({ api, owners, tokens: cfg.tokens }) +} + +module.exports = { + doublecounted: true, + methodology: 'Sums the concentrated liquidity positions (held or staked in a gauge or farm) and tokens held by every BTB Finance auto-rebalance smart wallet. Wallets are found from the BTB factories\' AccountCreated events; each user owns their own wallet and nothing is pooled.', + start: '2026-09-23', +} + +Object.keys(config).forEach(chain => { module.exports[chain] = { tvl } }) From b496eb80cc4650c2c77c96a4db70f456a36d67f3 Mon Sep 17 00:00:00 2001 From: Fuci Date: Thu, 1 Oct 2026 20:49:33 +0700 Subject: [PATCH 044/988] feat(fuci): add TVL (FuciEscrow on Arc) (#21314) Co-authored-by: Fuci Co-authored-by: FelixBruguera --- registries/sumTokens.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 1fd9fdadbb8..ec774e27689 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -14903,6 +14903,16 @@ const configs = { ] }, }, + "fuci": { + "methodology": "TVL is the USDC held by the FuciEscrow contract on Arc: USDC locked for open jobs between clients and AI agents, plus settled payouts waiting to be withdrawn.", + "start": "2026-09-29", + "arc": { + "owner": "0xb30d1c83454260614ccf06ae0f3c1af8b47515b1", + "tokens": [ + ADDRESSES.arc.USDC + ] + }, + }, "gainsNetwork": { "hallmarks": [ [ From 1504f32b180dab2340328b815cd75c6ed6e3f460 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 1 Oct 2026 10:39:20 -0400 Subject: [PATCH 045/988] add cronos rpcs (#21359) --- projects/helper/env.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/env.js b/projects/helper/env.js index ede6719a796..88111056133 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -80,6 +80,7 @@ const DEFAULTS = { ARC_RPC_MULTICALL_V3: '0xcA11bde05977b3631167028862bE2a173976CA11', ARC_MULTICALL_CHUNK_SIZE: '50', RLS_ARCHIVAL_RPC: 'https://mainnet-archive.rayls.com', + CRONOS_RPC: 'https://evm.cronos.org,https://rpc.vvs.finance,https://cronos.drpc.org,https://cronos.rpc.sentio.xyz,https://evm-cronos.crypto.org', // chains with no provider in the SDK providers list (chainid.network RPCs) AREA_RPC: 'https://mainnet-rpc.areum.network,https://mainnet-rpc2.areum.network', // Areum Network, chainId 463 BCYPHER_RPC: 'https://mainapi.bchscan.io', // BC Hyper Chain, chainId 3030 From c94f6eb513963384c081724929f5a63a70793073 Mon Sep 17 00:00:00 2001 From: AshDown1 Date: Fri, 2 Oct 2026 01:29:21 +1000 Subject: [PATCH 046/988] Add TRUSS LP (#21334) Co-authored-by: FelixBruguera --- projects/truss-lp/index.js | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 projects/truss-lp/index.js diff --git a/projects/truss-lp/index.js b/projects/truss-lp/index.js new file mode 100644 index 00000000000..2b44ad1626c --- /dev/null +++ b/projects/truss-lp/index.js @@ -0,0 +1,56 @@ +// TRUSS LP - automated concentrated-liquidity vaults on Aerodrome Slipstream (Base) +// TVL = idle token0/token1 held by every vault + every Slipstream position the +// AerodromeAtomicV3 contract has staked in a gauge on the vaults' behalf. +const { sumTokens2, unwrapSlipstreamNFT } = require('../helper/unwrapLPs') + +const FACTORY = '0x65Ab206bc394a2DA6bd687Ba99ABad1Bd6f2dB2f' // LPVaultFactoryV3 +const ATOMIC = '0x57Ab7cADE09605149d5a00Cd6Fa71588C164122b' // AerodromeAtomicV3 (stakes positions for vaults) +const VOTER = '0x16613524e02ad97eDfeF371bC883F2F5d6C480A5' // Aerodrome Voter + +const abi = { + vaultCount: 'uint256:vaultCount', + allVaults: 'function allVaults(uint256) view returns (address)', + gauges: 'function gauges(address) view returns (address)', + stakedValues: 'function stakedValues(address depositor) view returns (uint256[])', +} + +async function tvl(api) { + const n = await api.call({ target: FACTORY, abi: abi.vaultCount }) + const vaults = await api.multiCall({ target: FACTORY, abi: abi.allVaults, calls: [...Array(Number(n)).keys()] }) + if (!vaults.length) return + + const pools = await api.multiCall({ abi: 'address:pool', calls: vaults }) + const token0s = await api.multiCall({ abi: 'address:token0', calls: vaults }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: vaults }) + + // 1) idle tokens sitting in each vault + const tokensAndOwners = [] + vaults.forEach((v, i) => { tokensAndOwners.push([token0s[i], v], [token1s[i], v]) }) + await sumTokens2({ api, tokensAndOwners }) + + // 2) staked Slipstream positions (held by the atomic in each pool's gauge) + const uniqPools = [...new Set(pools.map(p => p.toLowerCase()))] + const gauges = await api.multiCall({ target: VOTER, abi: abi.gauges, calls: uniqPools }) + const live = uniqPools.map((p, i) => ({ pool: p, gauge: gauges[i] })) + .filter(x => x.gauge && x.gauge !== '0x0000000000000000000000000000000000000000') + if (!live.length) return + + const nfpms = await api.multiCall({ abi: 'address:nft', calls: live.map(x => x.gauge) }) + const staked = await api.multiCall({ abi: abi.stakedValues, calls: live.map(x => ({ target: x.gauge, params: [ATOMIC] })) }) + + // gauges of different pools can share a position manager, so group the staked ids by manager + const idsByNfpm = {} + nfpms.forEach((nfpm, i) => { + const key = nfpm.toLowerCase() + idsByNfpm[key] = (idsByNfpm[key] || []).concat(staked[i].map(String)) + }) + for (const [nftAddress, positionIds] of Object.entries(idsByNfpm)) { + if (positionIds.length) await unwrapSlipstreamNFT({ api, nftAddress, positionIds }) + } +} + +module.exports = { + methodology: 'TVL is the value of all tokens held by TRUSS LP vaults: idle token balances in each vault plus the underlying tokens of every Aerodrome Slipstream position staked in a gauge on the vaults\' behalf.', + start: '2026-09-25', + base: { tvl }, +} From a99bdfe896b40550fd1f8561c187bdf88e5c1f7e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 1 Oct 2026 20:51:30 +0200 Subject: [PATCH 047/988] refactor ensuro --- projects/ensuro/index.js | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/projects/ensuro/index.js b/projects/ensuro/index.js index a26bc01c27a..57ac68c99db 100644 --- a/projects/ensuro/index.js +++ b/projects/ensuro/index.js @@ -65,35 +65,21 @@ const addressBook = { } }; -const normalize = i => i.toLowerCase() - -async function unwrap4626Tokens({ api, tokensAndOwners, }) { - const tokens = tokensAndOwners.map(i => i[0]) - const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokensAndOwners.map(i => ({ target: i[0], params: i[1] })), }) - const assets = (await api.multiCall({ abi: 'address:asset', calls: tokens, })).map(normalize) - const balsInAssets = await api.multiCall({ abi: 'function convertToAssets(uint256) view returns (uint256)', calls: tokensAndOwners.map((i, idx) => ({ target: i[0], params: bals[idx] })), }) - api.addTokens(assets, balsInAssets) - return api.getBalances() -} - async function tvl(api) { const addresses = addressBook[api.chain]; // Most of the reserves can only have USDC - const ownerTokens = addresses.reserves.map(i => [[normalize(addresses.usdc)], i.address]) + const ownerTokens = addresses.reserves.map(i => [[addresses.usdc], i.address]) // The MSV also has AAVE USDC and OpenEden's USDO if (api.chain === "ethereum" ) { - ownerTokens.push([[normalize(addresses.usdc), normalize(addresses.aave_v3_usdc), normalize(addresses.usdo), normalize(addresses.comp_inst_usdc)], addresses.msv]); + ownerTokens.push([[addresses.usdc, addresses.aave_v3_usdc, addresses.usdo, addresses.comp_inst_usdc], addresses.msv]); } else { - ownerTokens.push([[normalize(addresses.usdc), normalize(addresses.aave_v3_usdc)], addresses.msv]); + ownerTokens.push([[addresses.usdc, addresses.aave_v3_usdc], addresses.msv]); } // Also Morpho vaults - for (const vault of addresses.morpho_vaults) { - await unwrap4626Tokens({api, tokensAndOwners: [[normalize(vault), normalize(addresses.msv)]] }); - } - if (addresses.ipor_fusion_vault !== undefined) { - await unwrap4626Tokens({api, tokensAndOwners: [[normalize(addresses.ipor_fusion_vault), normalize(addresses.msv)]] }); - } + ownerTokens.push([addresses.morpho_vaults, addresses.msv]) + if (addresses.ipor_fusion_vault) + ownerTokens.push([[addresses.ipor_fusion_vault], addresses.msv]) return sumTokens2({ api, ownerTokens}); } From fedf494d5d900b767808e4c74402d9cf6e15b315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Thu, 1 Oct 2026 15:12:40 -0400 Subject: [PATCH 048/988] Add Neverland's missing isolated markets (#21361) --- registries/aaveV3.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/registries/aaveV3.js b/registries/aaveV3.js index 0c284b47bf4..134dd579e45 100644 --- a/registries/aaveV3.js +++ b/registries/aaveV3.js @@ -111,6 +111,8 @@ const configs = { poolDatas: [ '0xfd0b6b6F736376F7B99ee989c749007c7757fDba', // canonical market (multi-reserve) '0xeEb78818C026A3c1b82804627d101e27Ce5E60CB', // isolated market (AUSD + PT-AUSD tokens) + '0xD2638FB3b0b5cb81a6Cdc856Cb72f95CB4103C43', // isolated market (WMON + PT-shMON tokens) + '0x5Db4aE52ec0Ac110c10e11580E6A85D66179ccb4', // isolated market (syzUSD + USDC + USDT0 + AUSD tokens) ], staking: ['0xBB4738D05AD1b3Da57a4881baE62Ce9bb1eEeD6C', '0xAD96C3dffCD6374294e2573A7fBBA96097CC8d7c'], // dustLock, DUST }, From 88363d0d71c245da66927ad996850717c5adfffc Mon Sep 17 00:00:00 2001 From: hattonjey-256 Date: Thu, 1 Oct 2026 15:16:29 -0400 Subject: [PATCH 049/988] Refactor FAZE TVL adapter into one file (#21363) --- projects/faze/abi.json | 6 ------ projects/faze/index.js | 23 ++++++++++++++++++++--- projects/faze/positionMath.js | 16 ---------------- 3 files changed, 20 insertions(+), 25 deletions(-) delete mode 100644 projects/faze/abi.json delete mode 100644 projects/faze/positionMath.js diff --git a/projects/faze/abi.json b/projects/faze/abi.json deleted file mode 100644 index f29b2b34674..00000000000 --- a/projects/faze/abi.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Launched": "event Launched(address indexed token, address indexed creator, (uint256 bondingTarget,uint16 feeBps,uint16 migrationFeeBps,address migrator,bool active,uint16 launchSellFeeBps,uint32 launchSellFeeDecay,uint16 poolFeeBps,bool compounding,uint16 launchBuyFeeBps,uint32 launchBuyFeeDecay,uint16 compoundCommitBps,bool creatorCurveFees,address quoteToken,uint32 sniperTaxWindow) terms, string name, string symbol, string tokenURI)", - "PoolRegistered": "event PoolRegistered(bytes32 indexed poolId, address indexed asset, address indexed creator, uint16 feeBps, uint16 launchSellFeeBps, uint32 launchSellFeeDecay, uint16 launchBuyFeeBps, uint32 launchBuyFeeDecay, uint16 compoundCommitBps, address quote)", - "Compounded": "event Compounded(bytes32 indexed poolId, int24 tickLower, int24 tickUpper, uint256 quoteAdded, uint128 liquidity)", - "getCoin": "function getCoin(address token) view returns ((address creator,address devBuyer,address migrator,address quoteToken,uint16 feeBps,uint16 migrationFeeBps,bool complete,bool graduated,bool active,bool abandoned,bool creatorCurveFees,uint16 poolFeeBps,uint16 launchSellFeeBps,uint32 launchSellFeeDecay,uint16 launchBuyFeeBps,uint32 launchBuyFeeDecay,uint16 compoundCommitBps,uint32 sniperTaxWindow,uint64 openedAt,uint64 completedAt,uint256 ethOffset,uint256 ethReserve,uint256 tokenReserve,uint256 bondingTarget,uint256 accrued) )" -} diff --git a/projects/faze/index.js b/projects/faze/index.js index 590bf759c73..5d456ba736b 100644 --- a/projects/faze/index.js +++ b/projects/faze/index.js @@ -1,6 +1,24 @@ const { getLogs2 } = require('../helper/cache/getLogs') -const ABI = require('./abi.json') -const { quoteAmount } = require('./positionMath') +const ABI = { + "Launched": "event Launched(address indexed token, address indexed creator, (uint256 bondingTarget,uint16 feeBps,uint16 migrationFeeBps,address migrator,bool active,uint16 launchSellFeeBps,uint32 launchSellFeeDecay,uint16 poolFeeBps,bool compounding,uint16 launchBuyFeeBps,uint32 launchBuyFeeDecay,uint16 compoundCommitBps,bool creatorCurveFees,address quoteToken,uint32 sniperTaxWindow) terms, string name, string symbol, string tokenURI)", + "PoolRegistered": "event PoolRegistered(bytes32 indexed poolId, address indexed asset, address indexed creator, uint16 feeBps, uint16 launchSellFeeBps, uint32 launchSellFeeDecay, uint16 launchBuyFeeBps, uint32 launchBuyFeeDecay, uint16 compoundCommitBps, address quote)", + "Compounded": "event Compounded(bytes32 indexed poolId, int24 tickLower, int24 tickUpper, uint256 quoteAdded, uint128 liquidity)", + "getCoin": "function getCoin(address token) view returns ((address creator,address devBuyer,address migrator,address quoteToken,uint16 feeBps,uint16 migrationFeeBps,bool complete,bool graduated,bool active,bool abandoned,bool creatorCurveFees,uint16 poolFeeBps,uint16 launchSellFeeBps,uint32 launchSellFeeDecay,uint16 launchBuyFeeBps,uint32 launchBuyFeeDecay,uint16 compoundCommitBps,uint32 sniperTaxWindow,uint64 openedAt,uint64 completedAt,uint256 ethOffset,uint256 ethReserve,uint256 tokenReserve,uint256 bondingTarget,uint256 accrued) )" +} +// Integer Q96 position valuation; TickMath constants from verified Uniswap v4 source. +const multipliers = [["1", "0xfffcb933bd6fad37aa2d162d1a594001"], ["0x2", "0xfff97272373d413259a46990580e213a"], ["0x4", "0xfff2e50f5f656932ef12357cf3c7fdcc"], ["0x8", "0xffe5caca7e10e4e61c3624eaa0941cd0"], ["0x10", "0xffcb9843d60f6159c9db58835c926644"], ["0x20", "0xff973b41fa98c081472e6896dfb254c0"], ["0x40", "0xff2ea16466c96a3843ec78b326b52861"], ["0x80", "0xfe5dee046a99a2a811c461f1969c3053"], ["0x100", "0xfcbe86c7900a88aedcffc83b479aa3a4"], ["0x200", "0xf987a7253ac413176f2b074cf7815e54"], ["0x400", "0xf3392b0822b70005940c7a398e4b70f3"], ["0x800", "0xe7159475a2c29b7443b29c7fa6e889d9"], ["0x1000", "0xd097f3bdfd2022b8845ad8f792aa5825"], ["0x2000", "0xa9f746462d870fdf8a65dc1f90e061e5"], ["0x4000", "0x70d869a156d2a1b890bb3df62baf32f7"], ["0x8000", "0x31be135f97d08fd981231505542fcfa6"], ["0x10000", "0x9aa508b5b7a84e1c677de54f3e99bc9"], ["0x20000", "0x5d6af8dedb81196699c329225ee604"], ["0x40000", "0x2216e584f5fa1ea926041bedfe98"], ["0x80000", "0x48a170391f7dc42444e8fa2"]].map(([a,b]) => [BigInt(a),BigInt(b)]); +function sqrtTick(t) { + if (!Number.isInteger(t) || Math.abs(t)>887272) throw Error('Invalid tick'); + let ratio=1n<<128n, a=BigInt(Math.abs(t)); + for (const [mask,m] of multipliers) if (a&mask) ratio=ratio*m>>128n; + if (t>0) ratio=((1n<<256n)-1n)/ratio; + return (ratio>>32n)+(ratio% (1n<<32n)?1n:0n); +} +function quoteAmount(liquidity,price,lo,hi,quoteIs0) { + const A=sqrtTick(lo), B=sqrtTick(hi), P=priceB?B:price, Q=1n<<96n; + if (A>=B || liquidity<0n || price<=0n) throw Error('Invalid position'); + return quoteIs0 ? liquidity*Q*(B-P)/B/P : liquidity*(P-A)/Q; +} // FAZE release 9, September 13, 2026. Verified sources at explorer.arc.io/address/
?tab=contract. const CURVE = '0x6A62919ccbf0c19e0C4e084F986b582b4492dDA4' @@ -48,7 +66,6 @@ async function tvl(api) { module.exports = { start: '2026-09-13', - timetravel: true, doublecounted: true, methodology: 'Real quote reserves on FAZE bonding curves plus the quote side of permanently locked graduation and compounding positions. Excludes virtual reserves, unclaimed fees, minted launch-token inventory, FAZE-denominated quote assets and FAZE own-token pools. Locked positions overlap Uniswap v4 TVL.', arc: { tvl }, diff --git a/projects/faze/positionMath.js b/projects/faze/positionMath.js deleted file mode 100644 index 1bcccee4090..00000000000 --- a/projects/faze/positionMath.js +++ /dev/null @@ -1,16 +0,0 @@ -// Integer Q96 position valuation; TickMath constants from verified Uniswap v4 source. -const multipliers = [["1", "0xfffcb933bd6fad37aa2d162d1a594001"], ["0x2", "0xfff97272373d413259a46990580e213a"], ["0x4", "0xfff2e50f5f656932ef12357cf3c7fdcc"], ["0x8", "0xffe5caca7e10e4e61c3624eaa0941cd0"], ["0x10", "0xffcb9843d60f6159c9db58835c926644"], ["0x20", "0xff973b41fa98c081472e6896dfb254c0"], ["0x40", "0xff2ea16466c96a3843ec78b326b52861"], ["0x80", "0xfe5dee046a99a2a811c461f1969c3053"], ["0x100", "0xfcbe86c7900a88aedcffc83b479aa3a4"], ["0x200", "0xf987a7253ac413176f2b074cf7815e54"], ["0x400", "0xf3392b0822b70005940c7a398e4b70f3"], ["0x800", "0xe7159475a2c29b7443b29c7fa6e889d9"], ["0x1000", "0xd097f3bdfd2022b8845ad8f792aa5825"], ["0x2000", "0xa9f746462d870fdf8a65dc1f90e061e5"], ["0x4000", "0x70d869a156d2a1b890bb3df62baf32f7"], ["0x8000", "0x31be135f97d08fd981231505542fcfa6"], ["0x10000", "0x9aa508b5b7a84e1c677de54f3e99bc9"], ["0x20000", "0x5d6af8dedb81196699c329225ee604"], ["0x40000", "0x2216e584f5fa1ea926041bedfe98"], ["0x80000", "0x48a170391f7dc42444e8fa2"]].map(([a,b]) => [BigInt(a),BigInt(b)]); -function sqrtTick(t) { - if (!Number.isInteger(t) || Math.abs(t)>887272) throw Error('Invalid tick'); - let ratio=1n<<128n, a=BigInt(Math.abs(t)); - for (const [mask,m] of multipliers) if (a&mask) ratio=ratio*m>>128n; - if (t>0) ratio=((1n<<256n)-1n)/ratio; - return (ratio>>32n)+(ratio% (1n<<32n)?1n:0n); -} -function quoteAmount(liquidity,price,lo,hi,quoteIs0) { - const A=sqrtTick(lo), B=sqrtTick(hi), P=priceB?B:price, Q=1n<<96n; - if (A>=B || liquidity<0n || price<=0n) throw Error('Invalid position'); - return quoteIs0 ? liquidity*Q*(B-P)/B/P : liquidity*(P-A)/Q; -} - -module.exports = { quoteAmount }; From 5f5ba880dbe4bf9f76d0c528ca5e6d49ac06abb0 Mon Sep 17 00:00:00 2001 From: Miller Outbit Date: Fri, 2 Oct 2026 02:34:28 +0700 Subject: [PATCH 050/988] outbidfun.lol - read CoinFactories from the protocol registry (#21337) Co-authored-by: Miller Outbid --- projects/outbidfun/index.js | 49 ++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/projects/outbidfun/index.js b/projects/outbidfun/index.js index eff41f9c9f0..40a2e6f13e2 100644 --- a/projects/outbidfun/index.js +++ b/projects/outbidfun/index.js @@ -1,4 +1,6 @@ +const sdk = require('@defillama/sdk') const { getLogs2 } = require('../helper/cache/getLogs') +const { getConfig } = require('../helper/cache') // outbidfun.lol (outbidfun.lol) — bonding-curve token launchpad on Robinhood Chain (4663). // Every coin is its own contract and custodies its curve's reserve in the asset its creator @@ -10,22 +12,51 @@ const { getLogs2 } = require('../helper/cache/getLogs') // inventory of its own coin to exclude, and fees leave it on every trade. Graduated coins are // skipped: their reserve is in the pool. // -// Two factories, both live (https://github.com/outbidfun/outbidfun-contracts/blob/main/DEPLOYMENTS.md): -// the first (27 September 2026), whose coins keep trading on their curves, and the one on the -// constant-product curve that replaced it for new launches on 28 September 2026. -const FACTORIES = [ - { target: '0xDadC43dbf60eA5d4598C39500Ede46De6A14c0d0', fromBlock: 73821560 }, - { target: '0xDD0e33a1d5452275E563020F58fC989f26B74CF6', fromBlock: 74842311 }, -] +// The factories come from the protocol's own registry: ProtocolRegistry +// (contracts/ProtocolRegistry.sol in https://github.com/outbidfun/outbidfun-contracts), which the +// team registers every contract in as it deploys it, so a new launchpad needs no change here. It +// is append-only and not upgradeable: an entry is never removed or changed, and each carries the +// block its contract was deployed in, before which it emits nothing. So the registry is read at the +// latest block even for a past day's TVL: a factory registered later has no coins before then. +// Today it lists two factories, both live: the first (27 September 2026), whose coins keep trading +// on their curves, and the one on the constant-product curve that replaced it for new launches on +// 28 September 2026. +// https://robinhoodchain.blockscout.com/address/0xe474680846735dab1c5E2EA1C56b2B12c64aaC1f +const REGISTRY = '0xe474680846735dab1c5E2EA1C56b2B12c64aaC1f' +// `entries(bytes32 kind) returns ((address target, uint64 fromBlock)[])`, as a JSON ABI: the SDK +// does not parse a tuple array from a human-readable one. +const ENTRIES = { + type: 'function', + name: 'entries', + stateMutability: 'view', + inputs: [{ name: 'kind', type: 'bytes32' }], + outputs: [{ name: '', type: 'tuple[]', components: [{ name: 'target', type: 'address' }, { name: 'fromBlock', type: 'uint64' }] }], +} +// The kind factories are registered as: 'CoinFactory', its ASCII as a bytes32. +const COIN_FACTORY = '0x' + Buffer.from('CoinFactory', 'ascii').toString('hex').padEnd(64, '0') const MEMECOIN_DEPLOYED = 'event MemeCoinDeployed(address indexed creator, address indexed memecoin, address indexed quoteAsset)' +/** Every CoinFactory the protocol has had, each with the block it was deployed in. */ +async function factories(chain) { + const list = await getConfig(`outbidfun/registry/${chain}`, undefined, { + fetcher: async () => { + const entries = await new sdk.ChainApi({ chain }).call({ target: REGISTRY, abi: ENTRIES, params: [COIN_FACTORY] }) + if (!entries.length) throw new Error('outbidfun: the registry lists no CoinFactory') + return entries.map((entry) => ({ target: entry.target, fromBlock: Number(entry.fromBlock) })) + }, + }) + // getConfig answers a failed read with the last list it cached, or with {} where there is none. + if (!Array.isArray(list) || !list.length) throw new Error('outbidfun: could not read the CoinFactories from the registry') + return list +} + /** * Sums the reserve asset held by every coin whose bonding curve is still live (`cap()` > 0). * @param {import('@defillama/sdk').ChainApi} api */ async function tvl(api) { const logs = (await Promise.all( - FACTORIES.map(({ target, fromBlock }) => getLogs2({ api, target, fromBlock, eventAbi: MEMECOIN_DEPLOYED })) + (await factories(api.chain)).map(({ target, fromBlock }) => getLogs2({ api, target, fromBlock, eventAbi: MEMECOIN_DEPLOYED })) )).flat() const caps = await api.multiCall({ abi: 'uint96:cap', calls: logs.map((log) => log.memecoin) }) const tokensAndOwners = logs @@ -35,7 +66,7 @@ async function tvl(api) { } module.exports = { - methodology: 'Reserve assets (WETH, USDG and other listed assets) held by every outbidfun.lol coin whose bonding curve is still live, found from the MemeCoinDeployed events of both CoinFactories (the first, and the one on the constant-product curve that replaced it for new launches on 28 September 2026). Graduated coins, whose reserve has moved into a locked Uniswap V3 pool, are excluded, as are the launched coins themselves.', + methodology: 'Reserve assets (WETH, USDG and other listed assets) held by every outbidfun.lol coin whose bonding curve is still live, found from the MemeCoinDeployed events of every CoinFactory registered in the protocol registry (today the first, and the one on the constant-product curve that replaced it for new launches on 28 September 2026). Graduated coins, whose reserve has moved into a locked Uniswap V3 pool, are excluded, as are the launched coins themselves.', start: '2026-09-27', robinhood: { tvl }, } From 2f7f109e625986ade89e70c3d1af788f5cb7c566 Mon Sep 17 00:00:00 2001 From: Kaleido Fianance Date: Thu, 1 Oct 2026 20:37:57 +0100 Subject: [PATCH 051/988] add Kaleido (swap + lending) on Arc (#21336) Co-authored-by: Kaleido Co-authored-by: FelixBruguera --- projects/kaleido-lending/index.js | 28 ++++++++++++++ projects/kaleido-swap/index.js | 62 +++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 projects/kaleido-lending/index.js create mode 100644 projects/kaleido-swap/index.js diff --git a/projects/kaleido-lending/index.js b/projects/kaleido-lending/index.js new file mode 100644 index 00000000000..3f10c3119e9 --- /dev/null +++ b/projects/kaleido-lending/index.js @@ -0,0 +1,28 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +// Kaleido lending: a peer-to-peer market on an EIP-2535 diamond. Borrowers post collateral (EURC, cirBTC), +// lenders list native USDC; the diamond holds both until loans are drawn/repaid. +const DIAMOND = '0xE4e7f16DB22e6bb2E505fbC504d7B2B4B995A6E3' +const SENTINEL = '0x0000000000000000000000000000000000000001' // how the market registers native USDC + +const abi = { + getAllCollateralToken: 'function getAllCollateralToken() view returns (address[])', + getLoanableAssets: 'function getLoanableAssets() view returns (address[])', +} + +async function tvl(api) { + const [collateral, loanable] = await Promise.all([ + api.call({ target: DIAMOND, abi: abi.getAllCollateralToken }), + api.call({ target: DIAMOND, abi: abi.getLoanableAssets }), + ]) + const all = [...collateral, ...loanable].map(t => t.toLowerCase()) + const tokens = [...new Set(all.map(t => (t === SENTINEL ? nullAddress : t)))] + return sumTokens2({ api, owner: DIAMOND, tokens }) +} + +module.exports = { + methodology: + 'TVL is the collateral and the lender-listed funds held by the Kaleido lending contract on Arc. Native USDC (the chain\'s gas token) is counted from the contract\'s native balance. Funds already lent out are not counted.', + start: '2026-09-29', + arc: { tvl }, +} diff --git a/projects/kaleido-swap/index.js b/projects/kaleido-swap/index.js new file mode 100644 index 00000000000..1c3138f1aa6 --- /dev/null +++ b/projects/kaleido-swap/index.js @@ -0,0 +1,62 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// Kaleido swap: Uniswap-V3-style pools created by Kaleido's own factory on Arc. +const FACTORY = '0xbB74f2319494461B2591F8fbF126654Dd4c2a649' +const LENDING = '0xE4e7f16DB22e6bb2E505fbC504d7B2B4B995A6E3' // Kaleido lending market; its registered tokens are the ones Kaleido pools are made of + +// The pools' quote asset is a WETH9 deployed on Arc that wraps native USDC 1:1 (18 decimals). It has no price +// of its own, so its balance is counted as native USDC below. +const WRAPPED_NATIVE = '0x8c6c0A4C5500c2bC196383B4D85feb7f08a5C75b' + +const FEES = [100, 500, 3000, 10000] +const ZERO = '0x0000000000000000000000000000000000000000' +const SENTINEL = '0x0000000000000000000000000000000000000001' + +// Pools are found with the factory's getPool for every pair of known Arc tokens (DefiLlama's Arc core assets plus +// every token the Kaleido lending market has registered), in one batched call. Event logs are not used: Arc's public +// RPCs rate-limit or prune getLogs over long ranges. +async function tokenSet(api) { + const [collateral, loanable] = await Promise.all([ + api.call({ target: LENDING, abi: 'function getAllCollateralToken() view returns (address[])' }), + api.call({ target: LENDING, abi: 'function getLoanableAssets() view returns (address[])' }), + ]) + const all = [WRAPPED_NATIVE, ...Object.values(ADDRESSES.arc), ...collateral, ...loanable] + .map(t => t.toLowerCase()) + .filter(t => t !== SENTINEL && t !== ZERO) + return [...new Set(all)] +} + +async function tvl(api) { + const tokens = await tokenSet(api) + const calls = [] + for (let i = 0; i < tokens.length; i++) + for (let j = i + 1; j < tokens.length; j++) + for (const fee of FEES) calls.push({ params: [tokens[i], tokens[j], fee], pair: [tokens[i], tokens[j]] }) + + const found = await api.multiCall({ + abi: 'function getPool(address,address,uint24) view returns (address)', + target: FACTORY, + calls: calls.map(c => ({ params: c.params })), + }) + const ownerTokens = [] + found.forEach((pool, i) => { + if (pool && pool.toLowerCase() !== ZERO) ownerTokens.push([calls[i].pair, pool]) + }) + + const balances = await sumTokens2({ api, ownerTokens, resolveLP: false }) + + const key = Object.keys(balances).find(k => k.toLowerCase() === `arc:${WRAPPED_NATIVE.toLowerCase()}`) + if (key) { + const raw = BigInt(balances[key].toString()) + api.removeTokenBalance(WRAPPED_NATIVE) + api.add(ADDRESSES.null, raw) + } + return api.getBalances() +} + +module.exports = { + methodology: 'TVL is the token balances held by the pools created by the Kaleido V3 factory on Arc.', + start: '2026-09-29', + arc: { tvl }, +} From f2f4b62c6921eabfc2da32df7b0b8b766f382bb7 Mon Sep 17 00:00:00 2001 From: manhdd-cyberk Date: Fri, 2 Oct 2026 04:07:41 +0700 Subject: [PATCH 052/988] Add Arrowfarm (Robinhood Chain) (#21354) Co-authored-by: FelixBruguera --- projects/arrowfarm/index.js | 84 +++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 projects/arrowfarm/index.js diff --git a/projects/arrowfarm/index.js b/projects/arrowfarm/index.js new file mode 100644 index 00000000000..3a02d009936 --- /dev/null +++ b/projects/arrowfarm/index.js @@ -0,0 +1,84 @@ +const { getLogs } = require('../helper/cache/getLogs'); + +// The factory has no enumeration getter, only a creation event, so the +// event log is how vaults are discovered. +const FACTORY = '0x086d837E84A59aB0E91861A773c8130ce4265440'; +const FACTORY_DEPLOY_BLOCK = 67633904; + +// The vault factory is permissionless and a vault reports whatever its strategy +// returns, so only vaults whose strategy came from Arrowfarm's strategy factory +// are counted. +const STRATEGY_FACTORY = '0xd626504db63FBe10Ea98a99f52717c5315e9eD46'; +const STRATEGY_FACTORY_DEPLOY_BLOCK = 67634274; + +// Platform token, used only to route its own pool to pool2 instead of tvl. +const ARROWFARM = '0x416d0c4b431cfa33b4a4974e3dfc9f5089137148'; + +const wantsAbi = 'function wants() view returns (address token0, address token1)'; +const balancesAbi = 'function balances() view returns (uint256 amount0, uint256 amount1)'; + +// balances() is the vault's own accounting of what it holds in its LP +// position plus idle balance; a plain balanceOf would miss the deployed +// share. +async function getVaultBalances(api) { + const logs = await getLogs({ + api, + target: FACTORY, + eventAbi: 'event ProxyCreated(address proxy)', + fromBlock: FACTORY_DEPLOY_BLOCK, + onlyArgs: true, + }); + const strategyLogs = await getLogs({ + api, + target: STRATEGY_FACTORY, + eventAbi: 'event ProxyCreated(string strategyName, address proxy)', + fromBlock: STRATEGY_FACTORY_DEPLOY_BLOCK, + onlyArgs: true, + }); + const strategies = new Set(strategyLogs.map((log) => log.proxy.toLowerCase())); + + const allVaults = logs.map((log) => log.proxy); + const vaultStrategies = await api.multiCall({ abi: 'address:strategy', calls: allVaults }); + const vaults = allVaults.filter((_, i) => strategies.has(vaultStrategies[i].toLowerCase())); + if (vaults.length === 0) return []; + + const [wants, balances] = await Promise.all([ + api.multiCall({ abi: wantsAbi, calls: vaults }), + api.multiCall({ abi: balancesAbi, calls: vaults }), + ]); + + return vaults.map((_, i) => ({ wants: wants[i], balances: balances[i] })); +} + +async function tvl(api) { + const vaults = await getVaultBalances(api); + vaults.forEach(({ wants, balances }) => { + const { token0, token1 } = wants; + const { amount0, amount1 } = balances; + if (token0.toLowerCase() === ARROWFARM || token1.toLowerCase() === ARROWFARM) return; + api.add(token0, amount0); + api.add(token1, amount1); + }); +} + +// Own-token pools go to pool2, not base tvl, per DefiLlama convention. +async function pool2(api) { + const vaults = await getVaultBalances(api); + vaults.forEach(({ wants, balances }) => { + const { token0, token1 } = wants; + const { amount0, amount1 } = balances; + if (token0.toLowerCase() !== ARROWFARM && token1.toLowerCase() !== ARROWFARM) return; + api.add(token0, amount0); + api.add(token1, amount1); + }); +} + +module.exports = { + doublecounted: true, + methodology: + "TVL sums each ArrowVaultConcLiq vault's token0/token1 balances() on Robinhood Chain, with vaults discovered from the vault factory's ProxyCreated logs so new vaults are picked up automatically. The ARROWFARM-USDG vault is reported under pool2 instead of base TVL, per convention for a protocol's own-token pools.", + robinhood: { + tvl, + pool2, + }, +}; From d2d06cbced789611b3304d383ebc9fe7fb4563d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Mendes?= <43360747+mendesfabio@users.noreply.github.com> Date: Thu, 1 Oct 2026 18:18:12 -0300 Subject: [PATCH 053/988] Add Orbio staking TVL (#21360) Co-authored-by: FelixBruguera --- registries/stakingOnly.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registries/stakingOnly.js b/registries/stakingOnly.js index d5dc03de138..dbc04d525ad 100644 --- a/registries/stakingOnly.js +++ b/registries/stakingOnly.js @@ -177,6 +177,10 @@ const configs = { staking: ['0x321b7ff75154472B18EDb199033fF4D116F340Ff', '0xacfE6019Ed1A7Dc6f7B508C02d1b04ec88cC21bf'], }, }, + 'orbio': { + methodology: 'Counts ORBIO tokens deposited in the Orbio staking contract on Robinhood Chain.', + robinhood: { staking: ['0xe0710011278bfb63e57c5f227e5980984b1eddca', '0xaa07a0e9209e16ac99708c3ec70159c6ef3128a3'] }, + }, 'capminal': { methodology: 'Counts CAP held in the ScapStaking contract on Base, including staked and unbonding principal plus funded but unclaimed CAP rewards.', start: '2026-05-30', From 6d29b6b4ecd2584fd11f79b42cacdd7e25b408a1 Mon Sep 17 00:00:00 2001 From: Dani Date: Fri, 2 Oct 2026 10:13:36 +0200 Subject: [PATCH 054/988] fix: navi, faiyah-staking, puzzle-ranges (#21368) --- projects/faiyah-staking/index.js | 15 +++---------- projects/navi/index.js | 36 +++++++++++--------------------- projects/puzzle-ranges/index.js | 11 +++------- 3 files changed, 18 insertions(+), 44 deletions(-) diff --git a/projects/faiyah-staking/index.js b/projects/faiyah-staking/index.js index e52e6126599..fb68c506c52 100644 --- a/projects/faiyah-staking/index.js +++ b/projects/faiyah-staking/index.js @@ -1,6 +1,3 @@ -const sdk = require('@defillama/sdk') -const { nullAddress } = require('../helper/tokenMapping') - const FACTORY = '0x95c8853e6bD1DBCE2428Aa6953eb7680261F22fe' // A same-token pool holds its reward bucket next to the principal and can pay rewards out of @@ -12,15 +9,9 @@ async function tvl(api) { const tokens = await api.multiCall({ abi: 'address:stakingToken', calls: pools }) const staked = await api.multiCall({ abi: 'uint256:totalStaked', calls: pools }) - const native = pools.filter((_, i) => tokens[i] === nullAddress) - const { output: nativeBals } = await sdk.api.eth.getBalances({ targets: native, chain: api.chain, block: api.block }) - const erc20Bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: pools.map((p, i) => ({ target: tokens[i], params: p })).filter(({ target }) => target !== nullAddress) }) - - let n = 0, e = 0 - pools.forEach((_, i) => { - const token = tokens[i] - api.add(token, held(token === nullAddress ? nativeBals[n++].balance : erc20Bals[e++], staked[i])) - }) + // native (null address) and ERC20 balances, in pool order + const bals = await api.getTokenBalances({ tokensAndOwners: pools.map((pool, i) => [tokens[i], pool]) }) + pools.forEach((_, i) => api.add(tokens[i], held(bals[i], staked[i]))) } module.exports = { diff --git a/projects/navi/index.js b/projects/navi/index.js index 0ef4a2c0727..f50ca7958d2 100644 --- a/projects/navi/index.js +++ b/projects/navi/index.js @@ -1,5 +1,6 @@ const sui = require("../helper/chain/sui") const { fetchURL } = require('../helper/utils') +const { getConfig } = require('../helper/cache') function getDecimalShifts(dynamicFields){ return fetchURL(`https://coins.llama.fi/prices/current/${dynamicFields.map(c=>`sui:0x${c.fields.value.fields.coin_type}`).join(',')}`).then(r=>r.data.coins) @@ -7,32 +8,19 @@ function getDecimalShifts(dynamicFields){ const NAVI_API = 'https://open-api.naviprotocol.io/api/navi' -// Known market storages, used when the NAVI config API is unavailable -const fallbackStorageIds = [ - "0xbb4e2f4b6205c2e2a2db47aeb4f830796ec7c005f88537ee775986639bc442fe", // main - "0xc2b6a52f0da7f91389eaffe4f68f4cacee43aa616bb8a4371118eafaf07cdd90", // ember - "0x199c1d5c2d58a4b05bbfa2338d02ad2676572a8a59ac148a5475b5c0fc53ed9f", // rwa - "0xdf18372bc9c588b96c7553bc811467a9166ed9be472b40cb45c226175377c558", // sui-eco - "0x51c5ad179214eb5e170dd93ba6f9b15948002caf85f7e2b091ef46d2dc2ce5b6", // sui-usdc - "0x79db6cdbfb59a067be7d78c1003079f56d817ac33b5d372b3165daf09f31ed69", // wbtc-usdc - "0x7db5c000524bfe55bb2bc343886f29eabc38f706dc1655900055fa5b60ee00a5", // xbtc-usdc - "0x35fecf669e7794ad25d289c2a23f065e518351acae09c5032d7237e185257924", // vsui-usdc - "0xafb982de1a436b1cc8a14ecd2d787762599b65d3a6b75b84b10939b1e17d9381", // vsui-sui - "0x6b945adccadf11cd7ec39f8c2c225a4267004a74587871cac86f9fa3dbf3be63", // hasui-sui - "0x2056ca72f7c81c3fb6b3a6eea117368cad7fb0c9caa4e2a7b51ee913e9e5deb9", // high-usdc -] - // Storage objects of every NAVI lending market, so newly launched markets are picked up automatically async function getStorageIds() { - try { - const markets = await fetchURL(`${NAVI_API}/markets?env=prod`).then(r => r.data.data.markets) - const configs = await Promise.all(markets.map(m => fetchURL(`${NAVI_API}/config?env=prod&market=${m.key}`).then(r => r.data.data))) - const storageIds = configs.map(c => c.storage).filter(Boolean) - if (storageIds.length) return storageIds - } catch (e) { - console.log('navi: config API unavailable, using fallback storage list', e.message) - } - return fallbackStorageIds + const storageIds = await getConfig('navi/storage-ids', undefined, { + fetcher: async () => { + const markets = await fetchURL(`${NAVI_API}/markets?env=prod`).then(r => r.data.data.markets) + const configs = await Promise.all(markets.map(m => fetchURL(`${NAVI_API}/config?env=prod&market=${m.key}`).then(r => r.data.data))) + const ids = configs.map(c => c.storage).filter(Boolean) + if (!ids.length) throw new Error('navi: empty market config') // keeps the last cached list + return ids + }, + }) + if (!Array.isArray(storageIds) || !storageIds.length) throw new Error('navi: no market storage ids') + return storageIds } async function getReserves() { diff --git a/projects/puzzle-ranges/index.js b/projects/puzzle-ranges/index.js index cb600df41ff..1f01407554e 100644 --- a/projects/puzzle-ranges/index.js +++ b/projects/puzzle-ranges/index.js @@ -44,12 +44,7 @@ async function tvl(api) { module.exports = { methodology: 'TVL is the sum of the actual token balances (balancesRaw) the Ranges Vault holds for every pool listed by the RangePoolFactory, read with vault.getPoolTokenInfo. BPTs of range pools held by other range pools are excluded so that the underlying assets of a nested pool are not counted twice.', - ethereum: { - tvl, - start: '2026-02-28', - }, - robinhood: { - tvl, - start: '2026-09-08', - }, + start: '2026-02-28', + ethereum: { tvl }, + robinhood: { tvl }, } From ce3b65c828502fd2571e8f28251b4f9b1a232e31 Mon Sep 17 00:00:00 2001 From: KalMydas Date: Fri, 2 Oct 2026 10:14:34 +0200 Subject: [PATCH 055/988] Kal Mydas treasury: fix failing tvl (disable Ankr lookup) (#21349) Co-authored-by: ccipherx --- projects/treasury/kalmydas.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/treasury/kalmydas.js b/projects/treasury/kalmydas.js index a764469f48f..5b455877367 100644 --- a/projects/treasury/kalmydas.js +++ b/projects/treasury/kalmydas.js @@ -51,7 +51,8 @@ const exportsObj = treasuryExports({ '0x4f1F316e76d8E8637006eF246E9dD6dc3b4680C1', // TreasuryRWAV2 '0xD1795dD0Cfe169E4dE601469C07E0c4884aD251f', // RainyDayFund ], - tokens: [ADDRESSES.base.USDC, ADDRESSES.base.WETH], + tokens: [ADDRESSES.null, ADDRESSES.base.USDC, ADDRESSES.base.WETH], + fetchCoValentTokens: false, ownTokens: [KAL], ownTokenOwners: [ '0x6466C5042669f8d6D7f0c725B51cD2650d1E1b9A', // KAL presale (unsold KAL) From 18790edddc54f0695540a519303428ac1044481d Mon Sep 17 00:00:00 2001 From: devMoneyfi Date: Fri, 2 Oct 2026 16:10:40 +0700 Subject: [PATCH 056/988] chore(moneyfi): remove Core TVL tracking (#21367) Co-authored-by: ccipherx --- projects/moneyfi/index.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/projects/moneyfi/index.js b/projects/moneyfi/index.js index a22519f9701..9ddd9ba22bb 100644 --- a/projects/moneyfi/index.js +++ b/projects/moneyfi/index.js @@ -52,11 +52,11 @@ const config = { strategies: ["0x2840f364E1cB5f83B6158618E7aaFb0a0AEb6736"], }, - core: { - fundVault: "0x3448263b315E73bCAfC28296a41FE80E4Ae49AD6", - dexBridgeVault: "0x1B92EF64d4197690F9B8758f122585edc89d67C6", - strategies: ["0x948e4B1F0A199d6C27CD1118483a45843222F60C"], - }, + // core: { + // fundVault: "0x3448263b315E73bCAfC28296a41FE80E4Ae49AD6", + // dexBridgeVault: "0x1B92EF64d4197690F9B8758f122585edc89d67C6", + // strategies: ["0x948e4B1F0A199d6C27CD1118483a45843222F60C"], + // }, soneium: { fundVault: "0x1a842A4F6C9FaDA6230581cAfBE6619D4B3aBA7d", @@ -88,10 +88,10 @@ const stablecoins = { ADDRESSES.optimism.USDC_CIRCLE, // USDC ADDRESSES.optimism.USDT, // USDT ], - core: [ - ADDRESSES.core.USDC, // USDC - ADDRESSES.core.USDT, // USDT - ], + // core: [ + // ADDRESSES.core.USDC, // USDC + // ADDRESSES.core.USDT, // USDT + // ], soneium: [ ADDRESSES.soneium.USDC, // USDC "0x102d758f688a4C1C5a80b116bD945d4455460282", // USDT @@ -133,9 +133,10 @@ chainExports.aptos = { }, }; +chainExports.core = { tvl: () => ({}) }; + module.exports = { ...chainExports, - timetravel: true, methodology: "TVL counts stablecoins in fundVault, dexBridgeVault, and all strategies contracts.", }; From 02261a4139efe75e6e507e02265b90cd4f5cb412 Mon Sep 17 00:00:00 2001 From: Andrew <121315827+Kittrian@users.noreply.github.com> Date: Fri, 2 Oct 2026 04:14:17 -0500 Subject: [PATCH 057/988] Add QuantumPools (Robinhood) (#21366) Co-authored-by: Cursor Agent Co-authored-by: Andrew Co-authored-by: ccipherx --- registries/sumTokens.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index ec774e27689..cf7288e579d 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -23348,6 +23348,15 @@ const configs = { ] }, }, + "quantumpools": { + "methodology": "TVL is the value of every Uniswap V3 concentrated-liquidity position held by the QuantumPools vault, unwrapped to underlying token amounts at the current pool tick.", + "doublecounted": true, + "start": "2026-09-28", + "robinhood": { + "owner": "0x5433f385F538Fa11b8A25B82230a306d25dF8EB3", + "resolveUniV3": true + }, + }, "quenta": { "methodology": "The calculation method for Quenta's TVL is the total value of all stablecoins (ioUSDC, ioUSDT) staked in the USDQ contract.", "iotex": { From 0e5147ee63964b65d3082c1c973138b6be3511e6 Mon Sep 17 00:00:00 2001 From: Dev1 <116736834+Developer-No-1@users.noreply.github.com> Date: Fri, 2 Oct 2026 17:17:16 +0800 Subject: [PATCH 058/988] basedbid: count LP in lock contracts, add Arc, PancakeSwap Infinity on Robinhood, any quote token (#21352) Co-authored-by: Felix Bruguera Co-authored-by: RohanNero <100052099+RohanNero@users.noreply.github.com> Co-authored-by: ccipherx --- projects/basedbid/index.js | 240 ++++++++++++++++++++++++++++--------- 1 file changed, 181 insertions(+), 59 deletions(-) diff --git a/projects/basedbid/index.js b/projects/basedbid/index.js index b2efcbb82fa..967cc5b759d 100644 --- a/projects/basedbid/index.js +++ b/projects/basedbid/index.js @@ -1,4 +1,5 @@ const ethers = require('ethers') +const sdk = require('@defillama/sdk') const { PublicKey } = require('@solana/web3.js') const { Program } = require('@project-serum/anchor') const ADDRESSES = require('../helper/coreAssets.json') @@ -14,6 +15,7 @@ const BASED_BID = { bsc: '0x920b4Ee4970CFE1ef523a0679200f9d9b2F87B2c', base: '0x0F2C33F406D58144Dec03FCdb69571249F0b0286', robinhood: '0x6EC95a3C6C7b8368C9bF37Ff664672E55df3550d', + arc: '0x50C5939990CE22C5CF967cAB42a488eEa11945cB', } const USD1_ETH_BSC = ADDRESSES.bsc.USD1 @@ -44,6 +46,12 @@ const TRACKED_TOKENS = { ADDRESSES.robinhood.WETH, ADDRESSES.robinhood.USDG, ], + // Arc: native USDC (eth_getBalance, 18 decimals) and the 0x3600 ERC-20 (6 decimals) are one balance; count it once. + arc: [ + ADDRESSES.arc.USDC, + ADDRESSES.arc.EURC, + ADDRESSES.arc.WETH, + ], } const WRAPPED_NATIVE = { @@ -51,6 +59,7 @@ const WRAPPED_NATIVE = { bsc: ADDRESSES.bsc.WBNB, base: ADDRESSES.base.WETH, robinhood: ADDRESSES.robinhood.WETH, + arc: ADDRESSES.arc.USDC, } const SOL_PROGRAM_ID = new PublicKey('CuodpYRDz4k87K6ZUFxk7X8JkVv5dNVZAcTQX2TEzTef') @@ -69,6 +78,7 @@ const TRACKED_TOKENS_SOL = [ const PANCAKE_V3_NFT = '0x46A15B0b27311cedF172AB29E4f4766fbE7F4364' +// Uniswap V3 + PancakeSwap V3 NonfungiblePositionManagers (ERC721Enumerable). const UNIV3_LIKE_NFTS = { ethereum: [ '0xC36442b4a4522E871399CD717aBDD847Ab11FE88', @@ -86,32 +96,35 @@ const UNIV3_LIKE_NFTS = { '0x73991a25c818bf1f1128deaab1492d45638de0d3', PANCAKE_V3_NFT, ], + arc: [ + '0x39654a85a4c05127f5fd6ed22caec077a0fb1377', // no PancakeSwap deployment on Arc + ], } -// Uniswap V4 position managers (NFT = position manager; poolId = tokenId) +// Uniswap V4 position managers (NFT = position manager; poolId = tokenId). +// StateView addresses come from the helper defaults (robinhood + arc included). const UNIV4_POSM = { ethereum: '0xbD216513d74C8cf14cf4747E6AaA6420FF64ee9e', bsc: '0x7A4a5c919aE2541AeD11041A1AEeE68f1287f95b', base: '0x7C5f5A4bBd8fD63184577525326123B519429bDc', robinhood: '0x58daec3116aae6d93017baaea7749052e8a04fa7', + arc: '0x6049c9a0e26405c0985f9e3685c87d0ae917f82b', } -const UNIV4_STATE_VIEW = { - robinhood: '0xF3334192D15450CdD385c8B70e03f9A6bD9E673b', -} - -// PancakeSwap Infinity CL position managers (BSC + Base) -const PCS_INFINITY_POSM = '0x55f4c8aba71a1e923edc303eb4feff14608cc226' - +// PancakeSwap Infinity CL position managers + pool managers (BSC, Base, Robinhood). const PCS_INFINITY = { bsc: { - posm: PCS_INFINITY_POSM, + posm: '0x55f4c8aba71a1e923edc303eb4feff14608cc226', poolManager: '0xa0FfB9c1CE1Fe56963B0321B32E7A0302114058b', }, base: { - posm: PCS_INFINITY_POSM, + posm: '0x55f4c8aba71a1e923edc303eb4feff14608cc226', poolManager: '0xa0FfB9c1CE1Fe56963B0321B32E7A0302114058b', }, + robinhood: { + posm: '0xeaEA9253A0b75B936a965DbD35B2a3F01831DE74', + poolManager: '0xeE04c68742e6Bf434bE8039580D2e89BBE55bc6f', + }, } const GET_MEME_TOKEN_LIST_ABI = 'function getMemeTokenList() view returns (address[])' @@ -123,9 +136,14 @@ const V4_HOOK_DATA_TUPLE = 'tuple(bool hasV4Hook, tuple(uint16 liquidityFeeBps, uint16 buybackFeeBps, uint16 rewardFeeBps, address[] customWallets, uint16[] customWalletBps) hookFeeDistributionConfig, uint256 feeThreshold, address rewardToken, tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) rewardPoolKey, uint8 feeKind, uint24 staticPoolFeeBpsBuy, uint24 staticPoolFeeBpsSell, uint24 hookFeeBpsBuy, uint24 hookFeeBpsSell, tuple(uint24 minBaseFeeBpsBuy, uint24 minBaseFeeBpsSell, uint24 maxBaseFeeBpsBuy, uint24 maxBaseFeeBpsSell, uint32 baseFeeFactorBuy, uint32 baseFeeFactorSell, uint24 defaultBaseFeeBpsBuy, uint24 defaultBaseFeeBpsSell, uint32 surgeDecayPeriodSeconds, uint32 surgeMultiplierPpm, bool perSwapMode, uint32 capAutoTuneStepPpm, uint32 capAutoTuneIntervalSeconds) dynamicFeeConfig, tuple(uint16[] buyFeesBps, uint16[] sellFeesBps, uint256[] buyFeeTierAmountLevels, uint256[] sellFeeTierAmountLevels) tieredFeeConfig, uint48 protectPeriod, uint256 maxBuyPerOrigin, bool isAntiSandwich, uint32 cooldownSeconds, uint24 penaltyFeeBps, tuple(uint32 volumeIntervalSeconds, uint256[] volumeLevels, uint16[] volumeMultiplierBps) volumeConfig)' const GET_FLASH_POOL_DATA_ABI = `function getFlashLaunchV4PoolData(address tokenAddress) view returns (tuple(address owner, bool isTokenBurn, uint8 _padding1, address baseToken, uint8 _padding2, bytes32 subBoard, string metaData, address positionManager, uint8 _padding3, uint256 poolId, address hooks, ${V4_HOOK_DATA_TUPLE} v4HookData))` +const GET_FLASH_V3_TOKEN_COUNT_ABI = 'function getTokenCountForFlashLaunchV3() view returns (uint256)' +const GET_FLASH_V3_TOKEN_ABI = 'function getTokenForFlashLaunchV3(uint256 index) view returns (address token)' const GET_LIQUIDITY_V4_LIST_ABI = 'function getLiquidityV4List() view returns (address[] tokens)' const GET_LIQUIDITY_V4_POOL_DATA_ABI = `function getLiquidityV4Pooldata(address token) view returns (tuple(address owner, bool isTokenBurn, address baseToken, bytes32 subBoard, string metaData, address positionManager, uint256 poolId, address hooks, ${V4_HOOK_DATA_TUPLE} v4HookData, tuple(bool isWhitelist, uint256 maxBuyPerOrigin) whitelistOption) poolData)` +const GET_LP_LOCK_ABI = 'function getLpLock(address positionManager) view returns (address)' +const FEE_RECEIVER_OF_ABI = 'function feeReceiverOf(uint256 tokenId) view returns (address)' +const TOKEN_OF_OWNER_BY_INDEX_ABI = 'function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)' const PCS_INFINITY_POSITIONS_ABI = 'function positions(uint256) view returns ((address currency0, address currency1, address hooks, address poolManager, uint24 fee, bytes32 parameters) poolKey, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, address subscriber)' @@ -143,8 +161,8 @@ function isUniV4Posm(chain, positionManager) { } function isPcsInfinityPosm(chain, positionManager) { - if (!PCS_INFINITY[chain]) return false - return lc(positionManager) === lc(PCS_INFINITY_POSM) + const cfg = PCS_INFINITY[chain] + return !!cfg && lc(positionManager) === lc(cfg.posm) } function poolIdIsActive(poolId) { @@ -155,6 +173,37 @@ function poolIdIsActive(poolId) { } } +// LP NFTs minted by based.bid are deposited into permanent lock contracts (one lock per +// position manager, registered on the diamond through LpLockFacet). Earlier positions were +// migrated into the locks as well, so the locks are the custodians of the LP; the diamond is +// kept as a fallback owner for positions on a position manager without a registered lock. +async function getLpCustodians(api) { + const chain = api.chain + const basedBid = BASED_BID[chain] + const positionManagers = getUniqueAddresses([ + ...(UNIV3_LIKE_NFTS[chain] || []), + UNIV4_POSM[chain], + PCS_INFINITY[chain]?.posm, + ].filter(Boolean), chain) + + const locks = await api.multiCall({ + abi: GET_LP_LOCK_ABI, + target: basedBid, + calls: positionManagers, + }) + + const lockOf = {} + positionManagers.forEach((pm, i) => { + const lock = locks[i] + if (lock && lc(lock) !== ADDRESSES.null) lockOf[lc(pm)] = lc(lock) + }) + + return { + lockOf, + ownersFor: (positionManager) => getUniqueAddresses([basedBid, lockOf[lc(positionManager)]].filter(Boolean), chain), + } +} + function registerPosition({ uniV4ByNft, pcsInfinityIds }, chain, positionManager, poolId) { if (!positionManager || !poolIdIsActive(poolId)) return const id = String(poolId) @@ -170,26 +219,32 @@ function registerPosition({ uniV4ByNft, pcsInfinityIds }, chain, positionManager } } -async function getOwnedPositionIds(api, nftAddress, positionIds, owner) { - if (!nftAddress || !positionIds.length) return [] +async function getOwnedPositionIds(api, nftAddress, positionIds, owners) { + if (!nftAddress || !positionIds.length || !owners.length) return [] - const owners = await api.multiCall({ + const holders = await api.multiCall({ abi: OWNER_OF_ABI, target: nftAddress, calls: positionIds, permitFailure: true, }) - const expectedOwner = lc(owner) + const accepted = new Set(owners.map(lc)) - return positionIds.filter((_, i) => lc(owners[i]) === expectedOwner) + return positionIds.filter((_, i) => accepted.has(lc(holders[i]))) } -async function collectV4PositionsFromContract(api) { +async function readRegistry(api, custodians) { const chain = api.chain const basedBid = BASED_BID[chain] const uniV4ByNft = {} const pcsInfinityIds = new Set() const ctx = { uniV4ByNft, pcsInfinityIds } + // Tokens launched through based.bid (never counted) and the quote tokens they are paired with. + // Projects can launch against any quote token, so the quote side is not limited to a fixed list. + const launchedTokens = new Set() + const quoteTokens = new Set() + const addLaunched = (token) => { if (token) launchedTokens.add(lc(token)) } + const addQuote = (token) => { if (token) quoteTokens.add(lc(token)) } const memeTokens = await api.call({ target: basedBid, @@ -203,8 +258,10 @@ async function collectV4PositionsFromContract(api) { calls: memeTokens, permitFailure: true, }) + memeTokens.forEach(addLaunched) memeDataList.forEach((data) => { if (!data) return + addQuote(data.initialData?.baseTokenForPair) const dexes = data.initialData?.dex ?? [] dexes.forEach((dex) => { registerPosition(ctx, chain, dex.routerOrPositionManager, dex.poolId) @@ -230,8 +287,10 @@ async function collectV4PositionsFromContract(api) { calls: flashTokens.filter(Boolean), permitFailure: true, }) + flashTokens.forEach(addLaunched) poolDataList.forEach((poolData) => { if (!poolData) return + addQuote(poolData.baseToken) registerPosition(ctx, chain, poolData.positionManager, poolData.poolId) }) } @@ -248,25 +307,72 @@ async function collectV4PositionsFromContract(api) { calls: liquidityV4Tokens, permitFailure: true, }) + liquidityV4Tokens.forEach(addLaunched) liquidityV4PoolDataList.forEach((poolData) => { if (!poolData) return + addQuote(poolData.baseToken) registerPosition(ctx, chain, poolData.positionManager, poolData.poolId) }) } + // Flash launches on V3-style DEXes: the LP NFTs are enumerated from the position managers, + // only the launched token list is needed here. + const flashV3Count = Number(await api.call({ + target: basedBid, + abi: GET_FLASH_V3_TOKEN_COUNT_ABI, + }) || 0) + + if (flashV3Count > 0) { + const flashV3Tokens = await api.multiCall({ + target: basedBid, + abi: GET_FLASH_V3_TOKEN_ABI, + calls: Array.from({ length: flashV3Count }, (_, i) => ({ params: [i] })), + }) + flashV3Tokens.forEach(addLaunched) + } + + // Keep only positions actually held by the lock contract (or the diamond itself). const verifiedUniV4ByNft = {} for (const [nftAddress, ids] of Object.entries(uniV4ByNft)) { - const ownedIds = await getOwnedPositionIds(api, nftAddress, [...ids], basedBid) + const ownedIds = await getOwnedPositionIds(api, nftAddress, [...ids], custodians.ownersFor(nftAddress)) if (ownedIds.length) verifiedUniV4ByNft[nftAddress] = ownedIds } + const pcsPosm = PCS_INFINITY[chain]?.posm return { + launchedTokens: [...launchedTokens], + quoteTokens: [...quoteTokens].filter((token) => !launchedTokens.has(token)), uniV4ByNft: verifiedUniV4ByNft, - pcsInfinityIds: await getOwnedPositionIds(api, PCS_INFINITY_POSM, [...pcsInfinityIds], basedBid), + pcsInfinityIds: pcsPosm + ? await getOwnedPositionIds(api, pcsPosm, [...pcsInfinityIds], custodians.ownersFor(pcsPosm)) + : [], + } +} + +// Locks are permissionless and shared across diamonds: count a locked position only if this diamond is its fee receiver. +async function getV3PositionIds(api, nftAddress, custodians) { + const basedBid = lc(BASED_BID[api.chain]) + const lock = custodians.lockOf[lc(nftAddress)] + const ids = [] + for (const owner of custodians.ownersFor(nftAddress)) { + const count = Number(await api.call({ abi: 'erc20:balanceOf', target: nftAddress, params: [owner] })) + if (!count) continue + const ownerIds = await api.multiCall({ + abi: TOKEN_OF_OWNER_BY_INDEX_ABI, + target: nftAddress, + calls: Array.from({ length: count }, (_, i) => ({ params: [owner, i] })), + }) + if (lc(owner) !== lock) { + ids.push(...ownerIds) + continue + } + const receivers = await api.multiCall({ abi: FEE_RECEIVER_OF_ABI, target: lock, calls: ownerIds }) + ids.push(...ownerIds.filter((_, i) => lc(receivers[i]) === basedBid)) } + return ids } -async function unwrapUniV4Positions(api, uniV4ByNft) { +async function unwrapUniV4Positions(api, uniV4ByNft, launchedTokens) { for (const [nftAddress, positionIds] of Object.entries(uniV4ByNft)) { if (!positionIds.length) continue await sumTokens2({ @@ -274,14 +380,13 @@ async function unwrapUniV4Positions(api, uniV4ByNft) { uniV4ExtraConfig: { nftAddress, positionIds, - stateViewer: UNIV4_STATE_VIEW[api.chain], }, - uniV3WhitelistedTokens: TRACKED_TOKENS[api.chain], + blacklistedTokens: launchedTokens, }) } } -async function unwrapPancakeInfinityCL(api, positionIds) { +async function unwrapPancakeInfinityCL(api, positionIds, launchedTokens) { const cfg = PCS_INFINITY[api.chain] if (!cfg || !positionIds.length) return @@ -313,8 +418,7 @@ async function unwrapPancakeInfinityCL(api, positionIds) { }) const wrappedNative = WRAPPED_NATIVE[api.chain] - const allow = new Set(TRACKED_TOKENS[api.chain].map(lc)) - const memeSides = new Set() + const launched = new Set(launchedTokens) validIdx.forEach((i, j) => { const pos = positions[i] @@ -324,8 +428,10 @@ async function unwrapPancakeInfinityCL(api, positionIds) { const token0 = pos.poolKey.currency0 === ADDRESSES.null ? wrappedNative : pos.poolKey.currency0 const token1 = pos.poolKey.currency1 === ADDRESSES.null ? wrappedNative : pos.poolKey.currency1 + // Compute both sides on a scratch api, then keep only the quote (non-launched) side. + const scratch = new sdk.ChainApi({ chain: api.chain }) addUniV3LikePosition({ - api, + api: scratch, token0, token1, liquidity: pos.liquidity, @@ -333,35 +439,41 @@ async function unwrapPancakeInfinityCL(api, positionIds) { tickUpper: Number(pos.tickUpper), tick: Number(slot.tick), }) - - if (!allow.has(lc(token0))) memeSides.add(lc(token0)) - if (!allow.has(lc(token1))) memeSides.add(lc(token1)) + Object.entries(scratch.getBalances()).forEach(([key, amount]) => { + const token = key.slice(key.indexOf(':') + 1) + if (!launched.has(lc(token))) api.add(token, amount) + }) }) - - memeSides.forEach((token) => api.removeTokenBalance(token)) } -async function addEvmLpPositions(api) { +async function tvl(api) { const owner = BASED_BID[api.chain] - - // Uniswap V3 + PancakeSwap V3 LP NFTs (ERC721Enumerable on the NFT manager). + const custodians = await getLpCustodians(api) + const { launchedTokens, quoteTokens, uniV4ByNft, pcsInfinityIds } = await readRegistry(api, custodians) + + // Native coin, core assets and every quote token used by a listed project, held directly by + // based.bid (e.g. funds raised by launches that are still on the bonding curve). + let tokens = getUniqueAddresses([...(TRACKED_TOKENS[api.chain] || []), ...quoteTokens], api.chain) + if (api.chain === 'arc') tokens = tokens.filter((token) => token !== ADDRESSES.null) + await sumTokens2({ api, owner, tokens, blacklistedTokens: launchedTokens }) + + // Uniswap V3 + PancakeSwap V3 LP NFTs (ERC721Enumerable on the NFT manager), held by the + // lock contract registered for that position manager (diamond as fallback). Every token + // except the launched ones counts, so any quote token is tracked. for (const nftAddress of UNIV3_LIKE_NFTS[api.chain] || []) { - await sumTokens2({ api, owner, uniV3ExtraConfig: { nftAddress }, uniV3WhitelistedTokens: TRACKED_TOKENS[api.chain] }) + const positionIds = await getV3PositionIds(api, nftAddress, custodians) + if (!positionIds.length) continue + await sumTokens2({ + api, + uniV3ExtraConfig: { nftAddress, positionIds }, + blacklistedTokens: launchedTokens, + }) } - // Uniswap V4 + PancakeSwap Infinity CL — position managers and tokenIds - // come from the based.bid registry (meme + flash launch pools). - const { uniV4ByNft, pcsInfinityIds } = await collectV4PositionsFromContract(api) - await unwrapUniV4Positions(api, uniV4ByNft) - await unwrapPancakeInfinityCL(api, pcsInfinityIds) -} - -async function tvl(api) { - const owner = BASED_BID[api.chain] - - // Native coin + stablecoins held directly by based.bid. - await sumTokens2({ api, owner, tokens: TRACKED_TOKENS[api.chain] || [] }) - await addEvmLpPositions(api) + // Uniswap V4 + PancakeSwap Infinity CL: position managers and tokenIds + // come from the based.bid registry (meme + flash launch + manual liquidity pools). + await unwrapUniV4Positions(api, uniV4ByNft, launchedTokens) + await unwrapPancakeInfinityCL(api, pcsInfinityIds, launchedTokens) } function deriveMeteoraPositionPda(nftMint) { @@ -410,7 +522,7 @@ function allocateShare(amount, shareNum, shareDen) { return (amount * shareNum) / shareDen } -async function addMeteoraPositions(api, lockPdas) { +async function addMeteoraPositions(api, lockPdas, quoteMints) { const meteoraLocks = lockPdas.filter((l) => Number(l.account.dex) === METEORA_DEX && l.account.feeNftMint) if (!meteoraLocks.length) return @@ -429,7 +541,7 @@ async function addMeteoraPositions(api, lockPdas) { }) if (!decodedPositions.length) return - const allow = new Set(TRACKED_TOKENS_SOL) + const allow = new Set(quoteMints) const poolAccounts = await connection.getMultipleAccountsInfo(poolIds) poolAccounts.forEach((acc, i) => { @@ -456,7 +568,7 @@ function getClmmPositionPda(nftMint) { )[0] } -async function addRaydiumClmmPositions(api, lockPdas) { +async function addRaydiumClmmPositions(api, lockPdas, quoteMints) { const nftMints = lockPdas .filter((l) => Number(l.account.dex) !== METEORA_DEX && l.account.feeNftMint) .map((l) => l.account.feeNftMint) @@ -488,7 +600,7 @@ async function addRaydiumClmmPositions(api, lockPdas) { }) } - const allow = new Set(TRACKED_TOKENS_SOL) + const allow = new Set(quoteMints) const memeMints = new Set() positions.forEach((position) => { @@ -512,10 +624,10 @@ async function addRaydiumClmmPositions(api, lockPdas) { memeMints.forEach((mint) => api.removeTokenBalance(mint)) } -async function addTreasuryLockBalances(api, treasury, lock) { +async function addTreasuryLockBalances(api, treasury, lock, quoteMints) { const connection = getConnection() const owners = [treasury, lock] - const splMints = TRACKED_TOKENS_SOL.filter((m) => m !== ADDRESSES.solana.SOL) + const splMints = quoteMints.filter((m) => m !== ADDRESSES.solana.SOL) for (const owner of owners) { const lamports = await connection.getBalance(new PublicKey(owner)) @@ -555,22 +667,32 @@ async function solanaTvl(api) { program.account.memeTokenData.all() ]) - await addTreasuryLockBalances(api, appStorage.treasury, appStorage.lock) + // Projects can launch against any quote token: track the core assets plus every quote + // mint used by a listed project. + const quoteMints = [...new Set([ + ...TRACKED_TOKENS_SOL, + ...memeTokens + .map(({ account }) => account.initialData.baseTokenForPair.toBase58()) + .filter((mint) => mint !== SOL_EMPTY_ACCOUNT), + ])] + + await addTreasuryLockBalances(api, appStorage.treasury, appStorage.lock, quoteMints) addBondingCurveReserves(api, memeTokens) const lockPdas = await program.account.lockPda.all() - await addMeteoraPositions(api, lockPdas) - await addRaydiumClmmPositions(api, lockPdas) + await addMeteoraPositions(api, lockPdas, quoteMints) + await addRaydiumClmmPositions(api, lockPdas, quoteMints) } module.exports = { timetravel: false, doublecounted: true, - methodology: 'TVL includes (1) native coin and USDT/USDC/USD1/wrapped-native balances at the based.bid contract (EVM) or treasury/lock accounts (Solana), (2) active bonding-curve collateral on Solana, and (3) LP positions: Uniswap V3, Uniswap V4, PancakeSwap V3, and PancakeSwap Infinity CL positions owned by based.bid (EVM), plus Meteora DAMM v2 and Raydium CLMM positions controlled by based.bid lock PDAs (Solana).', + methodology: 'TVL includes (1) balances of the native coin, core assets and every quote token used by a listed project at the based.bid contract (EVM) or treasury/lock accounts (Solana), (2) active bonding-curve collateral on Solana, and (3) the quote-token side of LP positions (tokens launched on based.bid are excluded): Uniswap V3, Uniswap V4, PancakeSwap V3, and PancakeSwap Infinity CL positions held by the based.bid LP lock contracts (permanent lockers registered on the based.bid contract per position manager) on EVM, plus Meteora DAMM v2 and Raydium CLMM positions controlled by based.bid lock PDAs (Solana).', ethereum: { tvl }, bsc: { tvl }, base: { tvl }, robinhood: { tvl }, + arc: { tvl }, megaeth: { tvl: () => ({}) }, solana: { tvl: solanaTvl }, } From 43ea624a9009436d136731d2af9cef4a028425d9 Mon Sep 17 00:00:00 2001 From: Will Hankins Date: Fri, 2 Oct 2026 02:23:11 -0700 Subject: [PATCH 059/988] Add SundaeSwap V4 TVL adapter (#21365) Co-authored-by: ccipherx --- registries/sumTokens.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index cf7288e579d..4d134ce52c6 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -26897,6 +26897,14 @@ const configs = { ] }, }, + "sundaeswap-v4": { + "methodology": "Counts the tokens held in SundaeSwap V4 pool UTxOs at the V4 pool script address.", + "cardano": { + "owners": [ + "addr1zysundaev4jxq60ehm8tlz6v8nk6lpxpnvgfa2jeszs55f4uzrlrz2kdd83wzt9u9n9qt2swgvhrmmn96k55nq6yuj4qeujly6" + ] + }, + }, "sunperp": { "methodology": "TVL includes Vault Contract and MPC Wallet assets", "tron": { From 1beab1656778f3c9b88069461abf925e8296c9f1 Mon Sep 17 00:00:00 2001 From: moneyzava-byte Date: Fri, 2 Oct 2026 06:43:51 -0600 Subject: [PATCH 060/988] add zAVA (#21362) Co-authored-by: FelixBruguera --- registries/sumTokens/data3.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 14d22f94a3b..bd9f5472e33 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1033,4 +1033,13 @@ module.exports = { ] }, }, + "zava": { + "methodology": "TVL is the AVAX held by the zAVA Mine contract.", + "avax": { + "owner": "0xB9D7517bC53D0F0F5e6E7C0030979Dd67de85128", // Mine + "tokens": [ + ADDRESSES.null + ] + }, + }, } From 74e6af26cb5dda263d829f4b4348b5346a2a357d Mon Sep 17 00:00:00 2001 From: octoman-molina Date: Fri, 2 Oct 2026 08:49:09 -0400 Subject: [PATCH 061/988] Add JUSD Finance (#21313) Co-authored-by: Claude --- projects/jusd-finance/index.js | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 projects/jusd-finance/index.js diff --git a/projects/jusd-finance/index.js b/projects/jusd-finance/index.js new file mode 100644 index 00000000000..4eb2be44252 --- /dev/null +++ b/projects/jusd-finance/index.js @@ -0,0 +1,56 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// JUSD deploys USDC into curated credit strategies, issued through two vaults: +// Accountable on Ethereum and Venzo on Arbitrum. +// tvl: USDC held idle in each vault. borrowed: the rest of each vault's assets +// (its share supply valued with convertToAssets), i.e. USDC lent to the strategy +// borrower or deployed off chain. On Arbitrum most shares tokenize an existing +// off-chain strategy position, evidenced by the issuer's proof of reserves. +const VAULTS = { + ethereum: [ + '0x2B5895b716311A1eaC8f93fB88C56aF9eC8C1A69', // JUSD Credit Vault (Accountable) + ], + arbitrum: [ + '0x9519217E8926A2B39BAcD2d6EC3EfD02503595E2', // JPEG Fixed-Rate Credit (Venzo) + ], +} + +// Native USDC on both chains (the Arbitrum vault holds native USDC, not bridged USDC.e) +const USDC = { + ethereum: ADDRESSES.ethereum.USDC, + arbitrum: ADDRESSES.arbitrum.USDC_CIRCLE, +} + +async function vaultState(api) { + const vaults = VAULTS[api.chain] + const usdc = USDC[api.chain] + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: vaults }) + const [assets, idle] = await Promise.all([ + api.multiCall({ + abi: 'function convertToAssets(uint256) view returns (uint256)', + calls: vaults.map((vault, i) => ({ target: vault, params: [supplies[i]] })), + }), + api.multiCall({ abi: 'erc20:balanceOf', calls: vaults.map((vault) => ({ target: usdc, params: [vault] })) }), + ]) + return { usdc, assets, idle } +} + +async function tvl(api) { + const { usdc, idle } = await vaultState(api) + idle.forEach((amount) => api.add(usdc, amount)) +} + +async function borrowed(api) { + const { usdc, assets, idle } = await vaultState(api) + assets.forEach((amount, i) => { + const lent = BigInt(amount) - BigInt(idle[i]) + if (lent > 0n) api.add(usdc, lent.toString()) + }) +} + +module.exports = { + methodology: 'TVL is the USDC held idle in the two JUSD vaults, the Accountable vault on Ethereum and the Venzo vault on Arbitrum. Borrowed is the rest of each vault\'s assets, its share supply valued in USDC with convertToAssets(), which is USDC lent to the strategy borrower or deployed off chain. The Ethereum vault is also part of Accountable, so this listing is marked as double counted.', + doublecounted: true, + ethereum: { tvl, borrowed }, + arbitrum: { tvl, borrowed }, +} From ac6bd89ee4ec6baf4d8e655f14f63cf13ccac116 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 2 Oct 2026 15:00:57 +0100 Subject: [PATCH 062/988] origyn staking (#21372) --- projects/origyn/index.js | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/projects/origyn/index.js b/projects/origyn/index.js index 312de821f65..2e0ef732261 100644 --- a/projects/origyn/index.js +++ b/projects/origyn/index.js @@ -1,37 +1,15 @@ -const { toUSDTBalances } = require("../helper/balances"); const { get } = require('../helper/http') async function staking(api) { - // Get the total supply in OGY - // Ref: https://github.com/ORIGYN-SA/origyn-sns/blob/master/backend/canisters/token_metrics/impl/src/queries/http_request.rs#L40 - const totalSupplyUrl = 'https://juolv-3yaaa-aaaal-ajc6a-cai.raw.icp0.io/total-supply'; - const totalSupply = await get(totalSupplyUrl); - - // Get the circulating supply in OGY - // Ref: https://github.com/ORIGYN-SA/origyn-sns/blob/master/backend/canisters/token_metrics/impl/src/queries/http_request.rs#L43 - const circulatingSupplyUrl = 'https://juolv-3yaaa-aaaal-ajc6a-cai.raw.icp0.io/circulating-supply'; - const circulatingSupply = await get(circulatingSupplyUrl); + // Total OGY staked in SNS governance neurons, in e8s + // Ref: https://gateway.origyn.com/docs/#/Tokens/get_origyn_governance_stats + const { total_staked } = await get('https://gateway.origyn.com/v1/tokens/OGY/governance/stats'); - // The token value locked is the locked supply - // total supply - circulating supply - const tokenTvl = (totalSupply - circulatingSupply); - - api.addCGToken('origyn-foundation', tokenTvl) -} - -async function tvl() { - // Get the total value of ORIGYN Certificates - // Ref: https://github.com/ORIGYN-SA/origyn-sns/blob/master/backend/canisters/collection_index/impl/src/queries/http_request.rs#L29 - const collectionIndexUrl = 'https://leqqw-uaaaa-aaaaj-azsba-cai.raw.icp0.io/stats'; - const collectionIndexData = await get(collectionIndexUrl); - const collectionTvl = collectionIndexData.total_value_locked; - - return toUSDTBalances(collectionTvl); + api.addCGToken('origyn-foundation', Number(total_staked) / 1e8) } module.exports = { timetravel: false, - misrepresentedTokens: true, - methodology: "TVL the total locked value of staked tokens and the total asset value of ORIGYN certificates.", - icp: { tvl, staking }, + methodology: "Staking counts OGY staked in ORIGYN SNS governance neurons. Certified asset value is tracked as RWA, not TVL.", + icp: { tvl: () => ({}), staking }, } From ed0271efa69a69a3fe8cb3bb1e60a6f1d8c39a7f Mon Sep 17 00:00:00 2001 From: Danny Plainview <140389355+0xplainview@users.noreply.github.com> Date: Fri, 2 Oct 2026 14:28:55 -0500 Subject: [PATCH 063/988] Motoswap AMM (uniswapV2 registry) and farm module update (#21328) --- projects/moto-fun/index.js | 2 +- projects/motoswap/index.js | 15 ++++++++------- registries/uniswapV2.js | 5 +++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/projects/moto-fun/index.js b/projects/moto-fun/index.js index 0a55e6d7585..1b85d6aa32a 100644 --- a/projects/moto-fun/index.js +++ b/projects/moto-fun/index.js @@ -16,6 +16,6 @@ module.exports = { methodology: 'TVL is the ETH held by the moto.fun bonding curve contract for coins that have not graduated yet. ' + 'Graduated coins trade on Motoswap pairs, which are counted in the Motoswap adapter.', - start: '2026-09-28', // block 26075263 + start: '2026-09-28', // curve deployed at block 26075451 (2026-09-28 10:47 UTC); earlier blocks read 0 ETH ethereum: { tvl }, } diff --git a/projects/motoswap/index.js b/projects/motoswap/index.js index 5f8665faf36..25a96347a58 100644 --- a/projects/motoswap/index.js +++ b/projects/motoswap/index.js @@ -1,11 +1,11 @@ const { sumTokens2 } = require('../helper/unwrapLPs') // Motoswap on Ethereum mainnet. -// MOTO launched on 2026-09-14 together with the Vampire Attack liquidity mining campaign (VampChef). -// The Motoswap DEX (Uniswap v2 style factory) opens on 2026-09-28; a dexFactory section will be added then. +// MOTO launched on 2026-09-14 together with the launch farming campaign (VampChef), which ended on 2026-09-28. +// The Motoswap DEX opened on 2026-09-28; its liquidity is tracked in the uniswapV2 registry as motoswap-amm. const MOTO = '0xBd965230588EAA536dE6aA45E8ebbc01638535e0' -const VAMP_CHEF = '0x51e648f08a9a08A724591938d9cbc483C809aCA4' // Vampire Attack MasterChef style farm (proxy) +const VAMP_CHEF = '0x51e648f08a9a08A724591938d9cbc483C809aCA4' // launch farming MasterChef style farm (proxy) const MOTO_STAKING = '0xCE88F2C6B49EfBb92555eE5475311f0e250C2528' // lock MOTO for revenue share (proxy) // Excluded on purpose (protocol owned, not user deposits): @@ -31,7 +31,7 @@ function isMoto(token) { return token.toLowerCase() === MOTO.toLowerCase() } -// Vampire Attack: LP tokens staked in the chef. The pairs contain MOTO, so this is pool2. +// Launch farming: LP tokens staked in the chef. The pairs contain MOTO, so this is pool2. async function pool2(api) { const pools = await getStakedPools(api) pools @@ -49,19 +49,20 @@ async function staking(api) { return sumTokens2({ api, owner: MOTO_STAKING, tokens: [MOTO] }) } -// No DEX liquidity to count until the Motoswap factory opens on 2026-09-28. +// DEX liquidity is counted in the motoswap-amm listing (registries/uniswapV2.js), not here. async function tvl() { return {} } module.exports = { methodology: - 'Vampire Attack: Uniswap v2 LP tokens staked in the Motoswap farm contract are counted as pool2 (the pairs contain MOTO). ' + + 'Launch farming: Uniswap v2 LP tokens staked in the Motoswap launch farm are counted as pool2 (the pairs contain MOTO). ' + 'MOTO staked single sided in the farm and MOTO locked in MotoStaking are counted as staking. ' + 'Staked amounts are read from the farm pool accounting (lpSupply), so the MOTO reward budget held by the farm is excluded. ' + 'Treasury vesting and reward escrow contracts are protocol owned and excluded. ' + - 'Liquidity in Motoswap DEX pairs will be counted as tvl once the DEX opens on 2026-09-28.', + 'Liquidity in Motoswap DEX pairs is counted in the Motoswap AMM listing.', start: '2026-09-14', // 2026-09-14, block 25977433 + hallmarks: [['2026-09-28', 'DEX launch; launch farming ended']], ethereum: { tvl, staking, diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index 6530693aa9d..ab14cbf1d81 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -3235,6 +3235,11 @@ const uniV2Configs = { }, }, }, + 'motoswap-amm': { + start: '2026-09-29', // factory deployed at block 26075263 (2026-09-28 10:09 UTC), so 2026-09-29 is the first daily snapshot where it exists + methodology: 'Value of the tokens in Motoswap pairs, enumerated from the factory. Motoswap LP tokens staked in the Motoswap farms are not added again.', + ethereum: '0x81C9CBC47d700dA1777aBd831D8dA3f526DfAe24', + }, 'unitflow-finance-v2': { methodology: 'Token balances held in every Unitflow v2.5 pair, enumerated from the factory.', arc: '0xFc1EC6761e246D5cb0c4C22669f8635098B22ba1', From 8c84fdda3ed85f00920123f9286fd74b334bf02c Mon Sep 17 00:00:00 2001 From: moreno-g Date: Sat, 3 Oct 2026 19:54:52 +0200 Subject: [PATCH 064/988] aerodrome-CL: stop double counting Arc (already tracked by aero-lite) (#21381) Co-authored-by: Claude Opus 5.5 --- projects/aerodrome-CL/index.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/projects/aerodrome-CL/index.js b/projects/aerodrome-CL/index.js index 65cf9600612..f17e10bf087 100644 --- a/projects/aerodrome-CL/index.js +++ b/projects/aerodrome-CL/index.js @@ -16,13 +16,6 @@ const config = { ], blacklistedTokens: ['0xdbfefd2e8460a6ee4955a68582f85708baea60a3'], }, - arc: { - factories: [ - '0xb89Df768aF2CFE637ceB352c587Fe8edAf491d03', // CL - // '0xaEd253F1aD84d99f2165256D701b2b481DD4CC16', // stable - // '0x9bc8b3F60D349d687Fb44A018967025E3741F9a5', // volatile - ], - }, } const exportsList = [] From e43a3bf36209d53c339a29ba5be0aaf96bbc3318 Mon Sep 17 00:00:00 2001 From: Andrew <121315827+Kittrian@users.noreply.github.com> Date: Sat, 3 Oct 2026 13:04:12 -0500 Subject: [PATCH 065/988] QuantumPools: add Base vault to TVL (#21378) Co-authored-by: Claude Opus 5.5 (1M context) --- registries/sumTokens.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 4d134ce52c6..adbba69e514 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -23349,13 +23349,17 @@ const configs = { }, }, "quantumpools": { - "methodology": "TVL is the value of every Uniswap V3 concentrated-liquidity position held by the QuantumPools vault, unwrapped to underlying token amounts at the current pool tick.", + "methodology": "TVL is the value of every Uniswap V3 concentrated-liquidity position held by the QuantumPools vaults on Base and Robinhood Chain, unwrapped to underlying token amounts at the current pool tick.", "doublecounted": true, "start": "2026-09-28", "robinhood": { "owner": "0x5433f385F538Fa11b8A25B82230a306d25dF8EB3", "resolveUniV3": true }, + "base": { + "owner": "0x9597f68203d1bc85744A5Fc11D890aA7777e386B", + "resolveUniV3": true + }, }, "quenta": { "methodology": "The calculation method for Quenta's TVL is the total value of all stablecoins (ioUSDC, ioUSDT) staked in the USDQ contract.", From 7eee07d9d15bf350cd734dd5f4ae8fe3dba74be8 Mon Sep 17 00:00:00 2001 From: Olddies Date: Sat, 3 Oct 2026 20:15:04 +0200 Subject: [PATCH 066/988] Add MonLock (Monad launchpad) TVL adapter (#21376) Co-authored-by: Olddies710 <6624069+Olddies710@users.noreply.github.com> --- projects/monlock/index.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 projects/monlock/index.js diff --git a/projects/monlock/index.js b/projects/monlock/index.js new file mode 100644 index 00000000000..dcc3146f82a --- /dev/null +++ b/projects/monlock/index.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') + +// Every MonLock launch has its own bonding curve contract, which holds the MON raised until the curve sells out. +// Then the liquidity moves to a Uniswap v4 pool, where it is locked and counted under Uniswap v4, not here. +const FACTORY = '0x3Ec6905A80A8E981159fF7EA1Ee48C60eD737920' +const FROM_BLOCK = 109741113 + +const TokenCreated = 'event TokenCreated(address indexed token, address indexed curve, address indexed creator, address deployer, uint32 presetId, string name, string symbol, string metadataURI, bytes context)' + +async function tvl(api) { + const logs = await getLogs2({ api, target: FACTORY, fromBlock: FROM_BLOCK, eventAbi: TokenCreated }) + return api.sumTokens({ owners: logs.map((log) => log.curve), tokens: [ADDRESSES.null] }) +} + +module.exports = { + methodology: 'Counts the MON held by the bonding curves of the tokens launched on MonLock. When a curve sells out, its liquidity moves to a Uniswap v4 pool, which is counted under Uniswap v4.', + start: '2026-10-01', + monad: { tvl }, +} From 7109dc379e5e352093561d2088cae2859a61e8ac Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 3 Oct 2026 21:23:19 +0200 Subject: [PATCH 067/988] overnight is dead --- projects/overnight-fi/index.js | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/projects/overnight-fi/index.js b/projects/overnight-fi/index.js index 032ac286017..35e441001c7 100644 --- a/projects/overnight-fi/index.js +++ b/projects/overnight-fi/index.js @@ -1,5 +1,4 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { unwrapSlipstreamNFT } = require('../helper/unwrapLPs') const CONFIG = { optimism: { @@ -96,34 +95,9 @@ const CONFIG = { }, } -const abi = { - strategyAssets: "function strategyAssets() view returns ((address strategy, uint256 netAssetValue, uint256 liquidationValue)[])" -} - const tvl = async (api) => { const { m2ms, assets } = CONFIG[api.chain] - const strategyAssetss = await api.multiCall({ calls: m2ms, abi: abi.strategyAssets }) - - m2ms.forEach((_, i) => { - const strategyAssets = strategyAssetss[i] - strategyAssets.forEach(({ strategy, netAssetValue }) => { - // we exclude the aerodrome position which is 99% USDC+ - if (api.chain === 'base' && m2ms[i] === '0x96aa0bBe4D0dea7C4AF4739c53dBFA0300262253') - if (strategy.toLowerCase() !== '0x744a222750A0681FB2f7167bDD00E2Ba611F89A9'.toLowerCase()) return; - api.add(assets[i], netAssetValue) - }) - }) - - /* if (api.chain === 'base') { - // unwrap aerodrome positions - const strategy = '0xcc9c1edae4D3b8d151Ebc56e749aD08b09f50248' - const CLGauge = '0xd030df11fa453a222782f6458cc71954a48ea104' - const positionIds = await api.call({ target: CLGauge, abi: 'function stakedValues(address) view returns (uint256[])', params: strategy }) - const nftAddress = await api.call({ abi: 'address:nft', target: CLGauge}) - - await unwrapSlipstreamNFT({ api, positionIds, nftAddress, }) - api.removeTokenBalance('0x85483696Cc9970Ad9EdD786b2C5ef735F38D156f') - } */ + return api.sumTokens({ owners: m2ms, tokens: assets, }) } Object.keys(CONFIG).forEach((chain) => { From 04f12b73a26de05a03150a9e75e7c32bd1bd6517 Mon Sep 17 00:00:00 2001 From: StelX Date: Sat, 3 Oct 2026 20:28:42 +0100 Subject: [PATCH 068/988] Add STELX (shielded pools on Robinhood Chain) (#21374) Co-authored-by: STELX Dev <332953783+StealthXchange@users.noreply.github.com> Co-authored-by: FelixBruguera --- projects/stelx/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/stelx/index.js diff --git a/projects/stelx/index.js b/projects/stelx/index.js new file mode 100644 index 00000000000..25374c5970d --- /dev/null +++ b/projects/stelx/index.js @@ -0,0 +1,27 @@ +const { staking } = require('../helper/staking') + +// STELX: shielded pools on Robinhood Chain. A pool holds every deposit still inside it; its token +// set is fixed at deployment and readable from the pool itself (supportedTokens). +const POOL = '0x7005aA5deaF8433d72fdc6B56a7ccC225F51FB5C' // WETH, USDG and tokenized stocks, one anonymity set +const STELX_POOL = '0x0913A0144D5e23409334cFcADa924C7b1f4e4026' // the STELX token's own pool +const STELX = '0x7a8cda6a1cab3e5146cd13cb623a3bb284fb4ad1' + +const TOKEN_COUNT = 197 + +async function tvl(api) { + const tokens = await api.multiCall({ + abi: 'function supportedTokens(uint256) view returns (address)', + target: POOL, + calls: [...Array(TOKEN_COUNT).keys()], + }) + return api.sumTokens({ owner: POOL, tokens: tokens }) +} + +module.exports = { + methodology: 'TVL is the balance of every supported token held by the STELX shielded pool on Robinhood Chain (WETH, USDG and tokenized stocks). STELX held by the STELX token pool is counted under staking.', + start: '2026-09-24', + robinhood: { + tvl, + staking: staking(STELX_POOL, STELX), + }, +} From 20a17c6576fc6f843801e446a87924b8da00483b Mon Sep 17 00:00:00 2001 From: Cucu Cahman G Date: Sun, 4 Oct 2026 02:53:07 +0700 Subject: [PATCH 069/988] Add ADEXTO TVL (#21373) Co-authored-by: 0xcuy Co-authored-by: FelixBruguera --- projects/adexto/index.js | 54 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 projects/adexto/index.js diff --git a/projects/adexto/index.js b/projects/adexto/index.js new file mode 100644 index 00000000000..d2bbd585142 --- /dev/null +++ b/projects/adexto/index.js @@ -0,0 +1,54 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// ADEXTO (https://adexto.xyz) opens every market as one bonding curve that trades the token against the +// chain's native coin and never graduates or migrates. Contracts: https://github.com/0xcuy/adexto/tree/main/contracts + +// Every ADEXTO factory generation, mapped to its deploy block. Each factory lists its launches on chain in +// allProjects / totalProjectsCount, and is skipped at blocks before it existed. +const config = { + '0g': { + '0xaA85bc0cceB35B524b6BB730612540Fb88df0f8e': 43173642, // 0.10.0 + '0x51c4168226463F7e5A141e1c6D30520734BC840a': 43704079, // 0.11.0 + '0x06C80fD2d5d9365C20aC468c15874DBE748877e2': 45602744, // 0.12.0 + '0xEBbE0fB112859b57A0ad1afbeD4978e43dC96c5D': 45793987, // 1.0.0 + }, + monad: { + '0x5800e9715a47a598fce9bc3B65a95FD6BeBf76A3': 102583076, // 0.11.0 + '0xcA9c77f050CD1e0685b03D0236579966DA9B39B9': 108871845, // 0.12.0 + '0x3dFcBEd7dd889F465cC9f75c430B43Ef873b6056': 109440540, // 1.0.0 + }, + base: { + '0x216E7880D64D94335B583c539802d3e61958d4A2': 50971523, // 0.11.0 + '0xe5B9555fbbcE72A5739dD29c3939A23fd230136F': 51922828, // 0.12.0 + '0xF5f904ca7763Fc6755bbCe5466a9DBd4C15c2708': 52008858, // 1.0.0 + }, + arbitrum: { + '0xE17f1027FC5f294327D701829baeD9d6519e922C': 502476317, // 0.11.0 + '0x75EeDEd196D2BE283d815D52F617eB70bCe865bC': 509845969, // 0.12.0 + '0x79DF3671e7e7456832C84a34c2bC0DB7871C0E0E': 510474755, // 1.0.0 + }, + robinhood: { + '0x8e63e117E71A80Cfc10fDF375F079e2e29cd7D7D': 76864198, // 1.0.0, the only generation on Robinhood Chain + }, +} + +const ALL_PROJECTS = 'function allProjects(uint256) view returns (address token, address curve)' + +module.exports = { + methodology: 'Native coin (ETH, MON or 0G) held by ADEXTO bonding curves, which are listed by each factory generation. This includes creator and protocol fees not yet claimed. The unsold market tokens the curves hold are not counted.', +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { + tvl: async (api) => { + const block = await api.getBlock() + const factories = Object.entries(config[chain]).filter(([, deployBlock]) => block >= deployBlock).map(([factory]) => factory) + const curves = [] + for (const factory of factories) { + const projects = await api.fetchList({ target: factory, lengthAbi: 'totalProjectsCount', itemAbi: ALL_PROJECTS }) + curves.push(...projects.map((project) => project.curve)) + } + return api.sumTokens({ owners: curves, tokens: [ADDRESSES.null] }) + }, + } +}) From 0a1fbca3174ab4adb70f92d615d23d15a119a799 Mon Sep 17 00:00:00 2001 From: handshakeotc Date: Sat, 3 Oct 2026 23:26:37 +0200 Subject: [PATCH 070/988] Add Handshake OTC (#21357) Co-authored-by: handshakeotc <336468717+handshakeotc@users.noreply.github.com> Co-authored-by: FelixBruguera --- projects/handshake-otc/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/handshake-otc/index.js diff --git a/projects/handshake-otc/index.js b/projects/handshake-otc/index.js new file mode 100644 index 00000000000..64833fad52f --- /dev/null +++ b/projects/handshake-otc/index.js @@ -0,0 +1,27 @@ +// Handshake OTC: firm OTC offers settled on-chain. Each factory creates one board per token pair; a board holds the +// tokens of its open offers in escrow (sell offers the base token, buy offers the quote token) until they are +// taken or cancelled. TVL is what the boards hold. + +const factories = { + ethereum: '0x8308a7c85287b1a0ba6c249b743273e0880244f4', + arbitrum: '0xfbbc5dfb448aab524d98688fbd76ae54dfd7cc59', + base: '0xb4b2debbbf362ce795ad993688587bf30cb9f826', + hyperliquid: '0xb4b2debbbf362ce795ad993688587bf30cb9f826', +} + +async function tvl(api) { + const boards = await api.fetchList({ lengthAbi: 'uint256:boardCount', itemAbi: 'function boards(uint256) view returns (address)', target: factories[api.chain] }) + const bases = await api.multiCall({ abi: 'address:base', calls: boards }) + const quotes = await api.multiCall({ abi: 'address:quote', calls: boards }) + const tokensAndOwners = boards.flatMap((board, i) => [[bases[i], board], [quotes[i], board]]) + // Anyone can create a board for any token pair, so a token whose balanceOf reverts counts as zero instead of + // failing the whole chain. + return api.sumTokens({ tokensAndOwners, permitFailure: true }) +} + +module.exports = { + methodology: 'Tokens held in escrow by the Handshake OTC boards: the base tokens of open sell offers and the quote tokens of open buy offers.', + start: '2026-09-30', +} + +Object.keys(factories).forEach((chain) => { module.exports[chain] = { tvl } }) From 99641d152ecf129f9674c80d7cbc0163406f447a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 3 Oct 2026 23:28:35 +0200 Subject: [PATCH 071/988] refactor tezos projects --- projects/crunchynetwork-wtz/index.js | 48 +++---- projects/crunchynetwork/index.js | 91 ++++++------- projects/dexter-tezos/index.js | 15 ++- projects/kolibri/index.js | 47 +++---- projects/matterdefi/index.js | 188 ++++++++------------------- projects/plenty/index.js | 24 +++- projects/youves/index.js | 60 ++++----- 7 files changed, 185 insertions(+), 288 deletions(-) diff --git a/projects/crunchynetwork-wtz/index.js b/projects/crunchynetwork-wtz/index.js index 2d02f2ced04..89f08ef3ef4 100644 --- a/projects/crunchynetwork-wtz/index.js +++ b/projects/crunchynetwork-wtz/index.js @@ -1,36 +1,24 @@ -const { get } = require('../helper/http') -const { RPC_ENDPOINT } = require('../helper/chain/tezos') +const { getTezosBalance } = require('../helper/chain/tezos') -async function fetchWtzTvl() { - const wtzContracts = [ - "KT1BB3oNr5vUSw1CuPNb2zpYEVp376XrXWaJ", - "KT1H25LW5k4HQGm9hmNXzaxf3nqjsAEhQPah", - "KT1LpGZnT6dj6STSxHXmvSPqx39ZdPXAMpFz", - "KT1NBgqqJacbdoeNAg9MvrgPT9h6q6AGWvFA", - "KT1NGTDBKDPMrAYEufb72CLwuQJ7jU7jL6jD" - ]; - - // Use Promise.all to fetch all wtz contract balances concurrently - const balances = await Promise.all(wtzContracts.map(async (contract) => { - const balance = await get(RPC_ENDPOINT + `/v1/accounts/${contract}/balance`); - return balance; - })); - - const totalBalance = balances.reduce((total, balance) => total + balance, 0); - return totalBalance; - -} +const wtzContracts = [ + "KT1BB3oNr5vUSw1CuPNb2zpYEVp376XrXWaJ", + "KT1H25LW5k4HQGm9hmNXzaxf3nqjsAEhQPah", + "KT1LpGZnT6dj6STSxHXmvSPqx39ZdPXAMpFz", + "KT1NBgqqJacbdoeNAg9MvrgPT9h6q6AGWvFA", + "KT1NGTDBKDPMrAYEufb72CLwuQJ7jU7jL6jD", +] async function tvl() { - const wtzTvl = await fetchWtzTvl(); - return { - tezos: wtzTvl / 1e6 - }; + let tezos = 0 + for (const contract of wtzContracts) + tezos += await getTezosBalance(contract) + return { tezos } } module.exports = { - timetravel: false, - tezos: { - tvl - } -}; \ No newline at end of file + deadFrom: "2026-01-01", // abandoned + timetravel: false, + tezos: { + tvl + } +} diff --git a/projects/crunchynetwork/index.js b/projects/crunchynetwork/index.js index 8ed5a830261..5a89946479e 100644 --- a/projects/crunchynetwork/index.js +++ b/projects/crunchynetwork/index.js @@ -1,71 +1,58 @@ -const { get } = require('../helper/http') -const { RPC_ENDPOINT } = require('../helper/chain/tezos') -const { PromisePool } = require('@supercharge/promise-pool') +const sdk = require('@defillama/sdk') +const { getStorage } = require('../helper/chain/tezos') -// crunchy farm address KT1KnuE87q1EKjPozJ5sRAjQA24FPsP57CE3 -// TVL = sum(crunchFarm.poolBalance / quipuLP.total_supply * quipuLP.tez_pool * 2 * XTZUSD) -async function fetchFarmsTvl() { - const farms = await get(RPC_ENDPOINT + '/v1/contracts/KT1KnuE87q1EKjPozJ5sRAjQA24FPsP57CE3/bigmaps/farms/keys?limit=1000') - const items = farms.map(farm => [farm.value.poolToken.address, farm.value.poolBalance]).filter(item => item[1] !== "0") - return getAllLPToTez(items); -} +const tezos = sdk.chains.tezos -// crunchy farm v2 address KT1L1WZgdsfjEyP5T4ZCYVvN5vgzrNbu18kX +const getBigMapValues = (contract, path) => tezos.tzktAll({ path: `/v1/contracts/${contract}/bigmaps/${path}/keys`, params: { active: true, select: 'value' } }) + +// crunchy farm address KT1KnuE87q1EKjPozJ5sRAjQA24FPsP57CE3 // TVL = sum(crunchFarm.poolBalance / quipuLP.total_supply * quipuLP.tez_pool * 2 * XTZUSD) -async function fetchFarmsV2Tvl() { - const farms = await get(RPC_ENDPOINT + '/v1/contracts/KT1L1WZgdsfjEyP5T4ZCYVvN5vgzrNbu18kX/bigmaps/farms/keys?limit=1000') - const items = farms.map(farm => [farm.value.poolToken.address, farm.value.poolBalance]).filter(item => item[1] !== "0") - return getAllLPToTez(items); +async function fetchFarmsTvl(farmContract) { + const farms = await getBigMapValues(farmContract, 'farms') + const items = farms.map(farm => [farm.poolToken.address, farm.poolBalance]).filter(item => item[1] !== "0") + return getAllLPToTez(items) } // crunchy freezer address KT1LjcQ4h5hCy9RcveFz9Pq8LtmF6oun7vNd // TVL = sum(cruchFreezer.amountLocked / quipuLP.total_supply * quipuLP.tez_pool * 2 * XTZUSD) async function fetchDeepFreezersTvl() { - const freezers = await get(RPC_ENDPOINT + '/v1/contracts/KT1LjcQ4h5hCy9RcveFz9Pq8LtmF6oun7vNd/bigmaps/locks/keys?limit=1000') - const items = freezers.map(freezer => [freezer.value.token.address, freezer.value.amountLocked]); - return getAllLPToTez(items); + const freezers = await getBigMapValues('KT1LjcQ4h5hCy9RcveFz9Pq8LtmF6oun7vNd', 'locks') + const items = freezers.map(freezer => [freezer.token.address, freezer.amountLocked]) + return getAllLPToTez(items) } async function getAllLPToTez(items) { - const { results, errors } = await PromisePool.withConcurrency(10) - .for(items) - .process(async ([lpTokenAddress, lpTokens]) => lpToTez(lpTokenAddress, lpTokens)) - - if (errors && errors.length) - throw errors[0] - - return results.reduce((previous, current) => previous +current, 0) * 2 + // the same LP shows up in many farms / locks, so read each pool storage once + const storages = {} + let sum = 0 + for (const [lpTokenAddress, lpTokens] of items) { + if (lpTokens === "0") continue + if (!storages[lpTokenAddress]) storages[lpTokenAddress] = await getStorage(lpTokenAddress) + sum += lpToTez(storages[lpTokenAddress], lpTokens) + } + return sum * 2 } -async function lpToTez(lpTokenAddress, lpTokens) { - if (lpTokens === "0") { - return 0 - } - - const tokenStorage = await get(RPC_ENDPOINT + `/v1/contracts/${lpTokenAddress}/storage?limit=1000`); - if (!tokenStorage.dex_lambdas) - return 0 - - - const tokenBalance = lpTokens - const tokenTotalSupply = tokenStorage.storage.total_supply - const lpTezValue = tokenStorage.storage.tez_pool - if (!lpTezValue || !tokenBalance || !tokenTotalSupply) return 0 - return lpTezValue * tokenBalance /tokenTotalSupply +function lpToTez(tokenStorage, lpTokens) { + if (!tokenStorage.dex_lambdas) return 0 // not a quipuswap v1 pool + const tokenTotalSupply = tokenStorage.storage.total_supply + const lpTezValue = tokenStorage.storage.tez_pool + if (!lpTezValue || !lpTokens || !tokenTotalSupply) return 0 + return lpTezValue * lpTokens / tokenTotalSupply } async function tvl() { - const farmsTvl = await fetchFarmsTvl(); - const farmsV2Tvl = await fetchFarmsV2Tvl(); - const deepFreezersTvl = await fetchDeepFreezersTvl(); - return { - tezos: (farmsTvl + farmsV2Tvl + deepFreezersTvl ) / 1e6 - }; + const farmsTvl = await fetchFarmsTvl('KT1KnuE87q1EKjPozJ5sRAjQA24FPsP57CE3') + const farmsV2Tvl = await fetchFarmsTvl('KT1L1WZgdsfjEyP5T4ZCYVvN5vgzrNbu18kX') + const deepFreezersTvl = await fetchDeepFreezersTvl() + return { + tezos: (farmsTvl + farmsV2Tvl + deepFreezersTvl) / 1e6 + } } module.exports = { - timetravel: false, - tezos: { - tvl - } -}; \ No newline at end of file + timetravel: false, + tezos: { + tvl + } +} diff --git a/projects/dexter-tezos/index.js b/projects/dexter-tezos/index.js index a4333aaad93..4209bad3a8b 100644 --- a/projects/dexter-tezos/index.js +++ b/projects/dexter-tezos/index.js @@ -1,9 +1,9 @@ -const { get } = require('../helper/http') +const sdk = require('@defillama/sdk') + +const tezos = sdk.chains.tezos async function tvl(api) { const tsString = new Date(api.timestamp * 1000).toISOString() - const addBal = bal => api.add('coingecko:tezos', bal * 2/ 1e6, { skipChain: true }) - const getBal = async (address) => get(`https://api.tzkt.io/v1/accounts/${address}/balance_history/${tsString}`) const owners = [ 'KT1Puc9St8wdNoGtLiD2WXaHbWU7styaxYhD', @@ -18,8 +18,11 @@ async function tvl(api) { if (api.timestamp < 1613861579 && api.timestamp > 1612738379) owners.push('KT1Xf2Cwwwh67Ycu7E9yd3UhsABQC4YZPkab') - - await Promise.all(owners.map(i => getBal(i).then(addBal))) + // pools are XTZ/token 50:50, so the XTZ side is doubled + for (const owner of owners) { + const bal = await tezos.tzkt({ path: `/v1/accounts/${owner}/balance_history/${tsString}` }) + api.add('coingecko:tezos', bal * 2 / 1e6, { skipChain: true }) + } return api.getBalances() } @@ -28,4 +31,4 @@ module.exports = { tezos: { tvl, } -} \ No newline at end of file +} diff --git a/projects/kolibri/index.js b/projects/kolibri/index.js index b0083ea5dc7..d3d1f913344 100644 --- a/projects/kolibri/index.js +++ b/projects/kolibri/index.js @@ -1,31 +1,32 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const BigNumber = require("bignumber.js"); -const { toUSDTBalances } = require('../helper/balances'); -const { get } = require("../helper/http"); -const { getConfig } = require('../helper/cache') +const sdk = require('@defillama/sdk') +const { getStorage, getTokenBalances } = require('../helper/chain/tezos') -const tvlUrl = 'https://kolibri-data.s3.amazonaws.com/mainnet/totals.json'; +const tezos = sdk.chains.tezos -async function tvl() { - const url = 'https://kolibri-data.s3.amazonaws.com/mainnet/oven-data.json' - await getConfig('kolibri', url) - const { allOvenData } = await get(url) - const filtered = allOvenData.filter(oven => !oven.isLiquidated && +oven.balance > 1e5) - return { - tezos: filtered.reduce((tvl, oven) => tvl + +oven.balance / 1e6, 0) - } +const OVEN_FACTORY = 'KT1Mgy95DVzqVBNYhsW93cyHuB57Q94UFhrh' +const KUSD_XTZ_QUIPU_LP = 'KT1K4EwTpbvYN9agJdjpyJm4ZZdhpUNKB3F6' +const KUSD_LP_FARM = 'KT1RB179ddATKbCi7E8ben91bo2hqRRPrNQf' // kUSD LP - kDAO farming + +// every oven is originated by the oven factory and holds its XTZ collateral directly +async function tvl(api) { + const ovens = await tezos.tzktAll({ path: '/v1/contracts', params: { creator: OVEN_FACTORY, 'balance.gt': 1e5, select: 'balance' } }) + ovens.forEach(balance => api.add('coingecko:tezos', balance / 1e6, { skipChain: true })) } -async function pool2() { - const usd_amount = (await get(tvlUrl)).quipuswapFarmBalanceUSD - return { - [ADDRESSES.tezos.USDT_cg]: BigNumber(usd_amount).toFixed(0) - }; +async function pool2(api) { + const farmLp = (await getTokenBalances(KUSD_LP_FARM, false, { transformAddress: i => i }))[KUSD_XTZ_QUIPU_LP] + if (!farmLp) return + const { storage } = await getStorage(KUSD_XTZ_QUIPU_LP) + const ratio = farmLp / storage.total_supply + api.add('coingecko:tezos', storage.tez_pool * ratio / 1e6, { skipChain: true }) + api.add(storage.token_address, storage.token_pool * ratio) } + module.exports = { - methodology: 'TVL counts the XTZ tokens that are deposited to mint kUSD, and kUSD in the liquidity pool. Borrowed tokens are not counted.', + timetravel: false, + methodology: 'TVL counts the XTZ deposited in ovens to mint kUSD. Pool2 counts the kUSD/XTZ Quipuswap LP staked in the kDAO farm. Borrowed tokens are not counted.', tezos: { tvl, - pool2 - } -}; + pool2, + }, +} diff --git a/projects/matterdefi/index.js b/projects/matterdefi/index.js index f153a9a2be1..5cde329bcae 100644 --- a/projects/matterdefi/index.js +++ b/projects/matterdefi/index.js @@ -1,143 +1,61 @@ -const BigNumber = require("bignumber.js"); -const { RPC_ENDPOINT } = require('../helper/chain/tezos'); -const { PromisePool } = require('@supercharge/promise-pool'); -const { get } = require('../helper/http') +const sdk = require('@defillama/sdk') +const { getTokenBalances, getStorage, getBigMapById } = require('../helper/chain/tezos') -const SPICY_URL = 'https://spicya.sdaotools.xyz/api/rest'; -const MATTER_CORE = 'KT1K4jn23GonEmZot3pMGth7unnzZ6EaMVjY'; -const MATTER_LIVE = 'KT1FYct7DUK1mUkk9BPJEg7AeH7Fq3hQ9ah3'; +const tezos = sdk.chains.tezos -async function fetchTokenBalances(account) { - return (await get(`${RPC_ENDPOINT}/v1/tokens/balances?account=${account}&limit=100&select=balance,token.id%20as%20id,token.contract%20as%20contract,token.standard%20as%20standard,token.tokenId%20as%20token_id`)); -} - -async function fetchSupply (contract, id) { - const req = id ? `/v1/tokens/?contract=${contract}&tokenId=${id}` : `/v1/tokens/?contract=${contract}`; - const supply = (await get(`${RPC_ENDPOINT}${req}`)); - - return new BigNumber(supply[0].totalSupply); -} - -let _spicePools, _spiceTokens - -async function fetchSpicyPools() { - if (!_spicePools) _spicePools = get(`${SPICY_URL}/PoolListAll/`) - const spicyPools = (await _spicePools).pair_info; - - return spicyPools.map(token => ({ contract: token.contract, reservextz: token.reservextz })); -} - -async function fetchSpicyTokens() { - if (!_spiceTokens) _spiceTokens = get(`${SPICY_URL}/TokenList`) - return (await _spiceTokens).tokens; -} - -async function lpToTez(farm) { - if(!farm.totalBalance) { - return farm.reserveXtz.multipliedBy(farm.balance); - } else { - const tezPerLp = farm.reserveXtz.dividedBy(farm.totalBalance.shiftedBy(-18)); - - return tezPerLp.multipliedBy(farm.balance.shiftedBy(-18)); - } -} - -async function matchToMatter (token, pools, tokens) { - const match = pools.find(pool => pool.contract == token.contract.address) - - if(match) { - token.totalBalance = await fetchSupply(token.contract.address); - token.reserveXtz = new BigNumber(match.reservextz); - token.balance = new BigNumber(token.balance); - - return token; - } else { - const tokenData = tokens.find(t => t.tag == `${token.contract.address}:${token.token_id}`); - - if(tokenData) { - token.reserveXtz = new BigNumber(tokenData.derivedxtz); - token.balance = new BigNumber(token.balance).shiftedBy(-tokenData.decimals); - - return token; +const MATTER_TOKEN = 'KT1K4jn23GonEmZot3pMGth7unnzZ6EaMVjY' +const MATTER_CORE = 'KT1K4jn23GonEmZot3pMGth7unnzZ6EaMVjY' +const MATTER_LIVE = 'KT1FYct7DUK1mUkk9BPJEg7AeH7Fq3hQ9ah3' +const SPICY_FACTORY = 'KT1PwoZxyv4XkPEGnTqWYvjA1UYiPTgAGyqL' + +const getSpicyToken = ({ token_id, fa2_address }) => fa2_address + (token_id && token_id !== '0' ? `-${token_id}` : '') + +let _data +async function getData() { + if (!_data) _data = _getData() + return _data + + async function _getData() { + // spicyswap pairs are FA2 contracts that are also their own LP token + const { pairs } = await getStorage(SPICY_FACTORY) + const spicyPairs = new Set(Object.values(await getBigMapById(pairs)).map(i => i.contract)) + const holdings = {} + for (const owner of [MATTER_CORE, MATTER_LIVE]) { + const bals = await getTokenBalances(owner, false, { transformAddress: i => i }) + Object.entries(bals).forEach(([token, bal]) => holdings[token] = (holdings[token] ?? 0) + +bal) } + const res = { tvl: {}, pool2: {}, staking: {} } + const add = (bucket, token, bal) => sdk.util.sumSingleBalance(res[bucket], 'tezos:' + token, bal) + + for (const [token, bal] of Object.entries(holdings)) { + if (token === MATTER_TOKEN) { + add('staking', token, bal) + continue + } + if (!spicyPairs.has(token)) { + add('tvl', token, bal) + continue + } + const { token0, token1, reserve0, reserve1 } = await getStorage(token) + const supply = await tezos.getTokenTotalSupply({ contract: token, tokenId: 0 }) + if (!+supply) continue + const ratio = bal / supply + const t0 = getSpicyToken(token0) + const t1 = getSpicyToken(token1) + const bucket = [t0, t1].includes(MATTER_TOKEN) ? 'pool2' : 'tvl' + add(bucket, t0, reserve0 * ratio) + add(bucket, t1, reserve1 * ratio) + } + return res } } -async function fetchSpicyPoolsAndMatch (spicyPools, spicyTokens, match) { - const { results, errors } = await PromisePool.withConcurrency(10) - .for(match) - .process(async (token) => matchToMatter(token, spicyPools, spicyTokens)) - - if (errors && errors.length) { - throw errors[0]; - } - - return results.filter(result => result); -} - -async function fetchCoreFarmsTvl(farms) { - const { results, errors } = await PromisePool.withConcurrency(10) - .for(farms) - .process(async (farm) => lpToTez(farm)) - - if (errors && errors.length) { - throw errors[0] - } - - return results.reduce((previous, current) => previous.plus(current)) -} - -const MATTER_TOKEN = 'KT1K4jn23GonEmZot3pMGth7unnzZ6EaMVjY' - -async function tvl() { - //fetch initial matter data - const spicyPools = await fetchSpicyPools(); - const spicyTokens = await fetchSpicyTokens(); - const matterCoreBalances = await fetchTokenBalances(MATTER_CORE); - const matterLiveBalances = await fetchTokenBalances(MATTER_LIVE); - - //fetch farm info - const coreToMatter = await fetchSpicyPoolsAndMatch(spicyPools, spicyTokens, matterCoreBalances.filter(i => i.contract.address !== MATTER_TOKEN)); - const liveToMatter = await fetchSpicyPoolsAndMatch(spicyPools, spicyTokens, matterLiveBalances.filter(i => i.contract.address !== MATTER_TOKEN)); - - //calculate TVL - const coreFarmsTvl = await fetchCoreFarmsTvl(coreToMatter); - const liveFarmsTvl = await fetchCoreFarmsTvl(liveToMatter); - - return { - tezos: coreFarmsTvl.plus(liveFarmsTvl).toFixed(0) - }; -} - -async function staking() { - //fetch initial matter data - const spicyPools = await fetchSpicyPools(); - const spicyTokens = await fetchSpicyTokens(); - const matterCoreBalances = await fetchTokenBalances(MATTER_CORE); - const matterLiveBalances = await fetchTokenBalances(MATTER_LIVE); - - //fetch farm info - const coreToMatter = await fetchSpicyPoolsAndMatch(spicyPools, spicyTokens, matterCoreBalances.filter(i => i.contract.address === MATTER_TOKEN)); - const liveToMatter = await fetchSpicyPoolsAndMatch(spicyPools, spicyTokens, matterLiveBalances.filter(i => i.contract.address === MATTER_TOKEN)); - - //calculate TVL - const coreFarmsTvl = await fetchCoreFarmsTvl(coreToMatter); - const liveFarmsTvl = await fetchCoreFarmsTvl(liveToMatter); - - return { - tezos: coreFarmsTvl.plus(liveFarmsTvl).toFixed(0) - }; -} - module.exports = { - misrepresentedTokens: true, - timetravel: false, - methodology: ` - TVL counts the liquidity of both Matter Core & Matter Live farms. - Tokens held in Matter's contract are pulled from TZKT API & relevant pool data is retrieved using SpicySwap API: ${SPICY_URL}. - `, - tezos: { - tvl, - staking, - } + timetravel: false, + methodology: 'TVL counts the tokens staked in Matter Core & Matter Live farms, with SpicySwap LP tokens resolved to their underlying reserves on chain. LPs containing MTTR are counted as pool2, staked MTTR as staking.', + tezos: { + tvl: async () => (await getData()).tvl, + pool2: async () => (await getData()).pool2, + staking: async () => (await getData()).staking, + } } diff --git a/projects/plenty/index.js b/projects/plenty/index.js index 612b82c3076..4281db4f618 100644 --- a/projects/plenty/index.js +++ b/projects/plenty/index.js @@ -1,11 +1,25 @@ +const sdk = require('@defillama/sdk') const { sumTokens2, } = require('../helper/chain/tezos') -const { getConfig } = require("../helper/cache") -const API_URL = 'https://config.mainnet.plenty.network/pools' +const tezos = sdk.chains.tezos + +// Plenty Network pools are originated by these factories / the team deployer; the type hashes +// below are the volatile, stable and tez swap pool contracts (everything gauged by the Voter is one of these) +const poolCreators = [ + 'KT1McWUGBxEP92a4CpKo3tzfARF6bM2sw5ff', // volatile swap factory + 'KT1LLaqPmDnVdBP1zxEEpPvy3py4Uk4Bymag', // stable swap factory + 'KT1FG1fFEBv7amGagLeXpCytFwiQAfYmkgFb', // tez swap factory + 'tz1NbDzUQCcV2kp3wxdVHVSZEDeq2h97mweW', // deployer of the early pools +] +const poolTypeHashes = [896241296, 1278110930, 1973461520, -1622367811, -509362075, -1446613519] const tvl = async () => { - const data = await getConfig('tezos/plenty', API_URL) - return sumTokens2({ owners: Object.keys(data), includeTezos: true, }) + const owners = [] + for (const creator of poolCreators) { + const pools = await tezos.tzktAll({ path: '/v1/contracts', params: { creator, 'typeHash.in': poolTypeHashes.join(','), select: 'address' } }) + owners.push(...pools) + } + return sumTokens2({ owners, includeTezos: true, }) } module.exports = { @@ -13,4 +27,4 @@ module.exports = { misrepresentedTokens: true, start: '2023-01-01', tezos: { tvl }, -} \ No newline at end of file +} diff --git a/projects/youves/index.js b/projects/youves/index.js index cf52c6d40ad..5f0a28862c2 100644 --- a/projects/youves/index.js +++ b/projects/youves/index.js @@ -1,12 +1,9 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { GraphQLClient, gql } = require("graphql-request"); const sdk = require("@defillama/sdk") const { addDexPosition, resolveLPPosition, getStorage, usdtAddressTezos, } = require('../helper/chain/tezos') const { dexes, farms } = require('./data') const { PromisePool } = require('@supercharge/promise-pool'); -let graphQLClient -const indexer = "https://indexer.youves.com/v1/graphql" const engines = { uUSDTezosV1: 'KT1FFE2LC5JpVakVjHm5mM36QVp2p3ZzH4hH', uUSDTezosV3: 'KT1DHndgk8ah1MLfciDnCV2zPJrVbnnAH9fd', @@ -29,21 +26,11 @@ const uDEFI_TOKEN = 'KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW-1' const tzBTC_TOKEN = ADDRESSES.tezos.tzBTC +// sum of collateral recorded per vault in the engine's vault_contexts big map async function fetchBalance(balances, token, engineAddress, decimals = 0, sharePrice) { - const query = gql` -{ - vault_aggregate(where: { engine_contract_address: { _eq: "${engineAddress}" } }) { - aggregate { - sum { - balance - } - } - } -} -` - - const oracleData = await graphQLClient.request(query) - let balance = oracleData["vault_aggregate"]["aggregate"]["sum"]["balance"] / 10 ** decimals + const { vault_contexts } = await getStorage(engineAddress) + const vaults = await sdk.chains.tezos.getBigMapKeys({ id: vault_contexts, select: 'value' }) + let balance = vaults.reduce((sum, vault) => sum + +vault.balance, 0) / 10 ** decimals if (token === 'tzbtc-lp') { const balancetZ = balance * sharePrice.xtzPool / sharePrice.lqtTotal @@ -62,25 +49,26 @@ async function getTzBTCLPSharePrice() { } async function tvl() { - graphQLClient = new GraphQLClient(indexer); const balances = {} const sharePrice = await getTzBTCLPSharePrice() - await Promise.all([ - // fetchBalance(balances, ADDRESSES.tezos.uUSD, engines.uDefiuUSDV2, 0), // disabling this because backing of uUSD is already counted in tvl - fetchBalance(balances, usdtAddressTezos, engines.uUSDUSDtV3, 0), - fetchBalance(balances, tzBTC_TOKEN, engines.uUSDtzBTCV2, 0), - fetchBalance(balances, tzBTC_TOKEN, engines.uUSDtzBTCV3, 0), - fetchBalance(balances, 'tezos', engines.uUSDTezosV1, 6), - fetchBalance(balances, 'tezos', engines.uUSDTezosV3, 6), - fetchBalance(balances, 'tezos', engines.uBTCTezosV2, 6), - fetchBalance(balances, 'tezos', engines.uBTCTezosV3, 6), - fetchBalance(balances, 'tezos', engines.uDefitzV2, 6), - fetchBalance(balances, 'tzbtc-lp', engines.uUSDtzBTCLPV2, 0, sharePrice), - fetchBalance(balances, 'tzbtc-lp', engines.uUSDtzBTCLPV3, 0, sharePrice), - fetchBalance(balances, 'tzbtc-lp', engines.uBTCtzBTCLPV2, 0, sharePrice), - fetchBalance(balances, 'tzbtc-lp', engines.uBTCtzBTCLPV3, 0, sharePrice), - fetchBalance(balances, 'tzbtc-lp', engines.uDefitzBTCLPV2, 0, sharePrice), - ]) + const vaults = [ + // [ADDRESSES.tezos.uUSD, engines.uDefiuUSDV2, 0], // disabling this because backing of uUSD is already counted in tvl + [usdtAddressTezos, engines.uUSDUSDtV3, 0], + [tzBTC_TOKEN, engines.uUSDtzBTCV2, 0], + [tzBTC_TOKEN, engines.uUSDtzBTCV3, 0], + ['tezos', engines.uUSDTezosV1, 6], + ['tezos', engines.uUSDTezosV3, 6], + ['tezos', engines.uBTCTezosV2, 6], + ['tezos', engines.uBTCTezosV3, 6], + ['tezos', engines.uDefitzV2, 6], + ['tzbtc-lp', engines.uUSDtzBTCLPV2, 0], + ['tzbtc-lp', engines.uUSDtzBTCLPV3, 0], + ['tzbtc-lp', engines.uBTCtzBTCLPV2, 0], + ['tzbtc-lp', engines.uBTCtzBTCLPV3, 0], + ['tzbtc-lp', engines.uDefitzBTCLPV2, 0], + ] + for (const [token, engine, decimals] of vaults) + await fetchBalance(balances, token, engine, decimals, sharePrice) return balances } @@ -96,10 +84,8 @@ async function pool2() { .for(youvesLPs) .process(account => addDexPosition({ balances, account })) - const promises = [] for (const { farmContract, contractAddress } of eligibleFarms) - promises.push(resolveLPPosition({ balances, lpToken: contractAddress, owner: farmContract, ignoreList: youvesLPs })) - await Promise.all(promises) + await resolveLPPosition({ balances, lpToken: contractAddress, owner: farmContract, ignoreList: youvesLPs }) return balances } From 61721865cc21cb4f783b048514fafa26c2bf9d5c Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Sun, 4 Oct 2026 14:14:07 -0400 Subject: [PATCH 072/988] add missing ladder managers to delta (#21387) --- projects/delta-liquidity/index.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/projects/delta-liquidity/index.js b/projects/delta-liquidity/index.js index 3fcd0277a1f..2388d90e40d 100644 --- a/projects/delta-liquidity/index.js +++ b/projects/delta-liquidity/index.js @@ -4,9 +4,20 @@ const ADDRESSES = require('../helper/coreAssets.json') // Delta v3 (live stack) const VAULT_FACTORY = '0x68EDc4948F60D21c4a7Dcbb8Ed4500cE6D0b153c' -const LADDER_MANAGER = '0x64680254BF644BBdDe394b95129895c13317FeD4' -const LADDER_MANAGER_V2 = '0xC5941433114BB47a9733CB31a0A3A3dBfF45B418' -const LADDER_MANAGERS = [LADDER_MANAGER, LADDER_MANAGER_V2] +// DeltaLadderManager v1..v9 + DeltaRangeOrderManager (https://deltaliquidity.app/docs) +const LADDER_MANAGER_CONFIGS = [ + { address: '0x64680254BF644BBdDe394b95129895c13317FeD4', fromBlock: 29958861 }, // v1 + { address: '0xC5941433114BB47a9733CB31a0A3A3dBfF45B418', fromBlock: 37292861 }, // v2 + { address: '0x5cA6214227D1195c4b7b4B96847b8966c688295D', fromBlock: 43637319 }, // v3 + { address: '0xAC6a35D097bB230EB9966dDd8E5970055a622D98', fromBlock: 47955644 }, // v4 + { address: '0x077AF3f17C0ef7Bb04A9882e1955e9C23D2F9e91', fromBlock: 49481958 }, // v5 + { address: '0xf321ED71750C3E627a0f435C8950429f231E3497', fromBlock: 51528669 }, // v6 + { address: '0x56Bf0F5B26d888b989a9A20eC2164F0CA560836c', fromBlock: 52778747 }, // v7 + { address: '0xbCb96b15dC2246D242c879316c86e25e846ad5FB', fromBlock: 57152395 }, // v8 + { address: '0x83551A233f6D7b3cb4dEFBF55AbFD887C6811ce4', fromBlock: 62065759 }, // v9 + { address: '0x24F4A03352e9fACd1005Aa35A7822c83A140F7f7', fromBlock: 70055277 }, // DeltaRangeOrderManager +] +const LADDER_MANAGERS = LADDER_MANAGER_CONFIGS.map(i => i.address) const ROUTER_V3 = '0x46dFEa430d1F069C129E26445319562e29f39C47' // Delta v2 (legacy stack, still active) @@ -18,7 +29,6 @@ const NPM = '0x73991a25C818Bf1f1128dEAaB1492D45638DE0D3' // UniswapV3 Nonfungibl const V4_POSM = '0x58daec3116aae6D93017bAAea7749052E8a04fA7' // UniswapV4 PositionManager const V4_STATE_VIEW = '0xF3334192D15450CdD385c8B70e03f9A6bD9E673b' const DELTA = '0xe8ffd7e24187F72afB08d75B1bb13088A989a791' -const LADDER_DEPLOY_BLOCK = 29958000 async function getOwnersAndTokens(api) { // Delta vaults (each vault custodies one Uniswap v3 position NFT) @@ -42,12 +52,12 @@ async function getOwnersAndTokens(api) { // No v4 subgraph on this chain, so position ids are enumerated from each // manager's own events, then filtered to those the manager still holds. let candidateIds = [] - for (const target of LADDER_MANAGERS) { + for (const { address: target, fromBlock } of LADDER_MANAGER_CONFIGS) { const opened = await getLogs2({ api, target, eventAbi: 'event ManagedOpenV4(address indexed owner, bytes32 indexed poolId, uint256[] tokenIds)', - fromBlock: LADDER_DEPLOY_BLOCK, + fromBlock, extraKey: 'managed-open-v4', }) candidateIds.push(...opened.flatMap(i => i.tokenIds.map(j => j.toString()))) From 4c7666e7cc776f0b8d23e6b57ddcae2e1bfe8c1d Mon Sep 17 00:00:00 2001 From: bz <174076068+bzcrystal@users.noreply.github.com> Date: Mon, 5 Oct 2026 00:33:30 -0700 Subject: [PATCH 073/988] Add Crystal Exchange (Monad) TVL (#21389) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/crystal/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/crystal/index.js diff --git a/projects/crystal/index.js b/projects/crystal/index.js new file mode 100644 index 00000000000..cf6f9d3ad56 --- /dev/null +++ b/projects/crystal/index.js @@ -0,0 +1,26 @@ +const CRYSTAL = "0x508254c838B2e936B0631440c5C6E3AB3a4a98BD" + +const abi = { + allMarketsLength: "uint256:allMarketsLength", + allMarkets: "function allMarkets(uint256) view returns (address)", + wasLaunchpad: "function wasLaunchpad(address) view returns (bool)", + launchpadTokenToMarket: "function launchpadTokenToMarket(address) view returns (uint112 virtualNativeReserve, uint112 virtualTokenReserve, uint256 k, address creator)", + getMarket: "function getMarket(address) view returns ((address quoteAsset,address baseAsset,uint256 marketType,uint256 highestBid,uint256 lowestAsk,uint256 scaleFactor,uint256 tickSize,uint256 maxPrice,uint256 minSize,uint256 takerFee,uint256 makerRebate,uint256 reserveQuote,uint256 reserveBase,bool isAMMEnabled))", +} + +async function tvl(api) { + const len = Number(await api.call({ target: CRYSTAL, abi: abi.allMarketsLength })) + const markets = await api.multiCall({ target: CRYSTAL, abi: abi.allMarkets, calls: Array.from({ length: len }, (_, i) => i.toString()) }) + const infos = await api.multiCall({ target: CRYSTAL, abi: abi.getMarket, calls: markets }) + const graduated = await api.multiCall({ target: CRYSTAL, abi: abi.wasLaunchpad, calls: markets }) + const curves = await api.multiCall({ target: CRYSTAL, abi: abi.launchpadTokenToMarket, calls: infos.map(i => i.baseAsset) }) + // launchpad tokens never count, whether still on the curve or graduated + const launched = new Set(infos.filter((_, i) => graduated[i] || curves[i].virtualTokenReserve != 0).map(i => i.baseAsset.toLowerCase())) + const tokens = new Set(infos.flatMap(i => [i.quoteAsset, i.baseAsset]).map(t => t.toLowerCase()).filter(t => !launched.has(t))) + return api.sumTokens({ owner: CRYSTAL, tokens: [...tokens] }) +} + +module.exports = { + methodology: "TVL is the sum of ERC20 balances held by the Crystal singleton contract (orderbook deposits, AMM reserves and MON raised on launchpad bonding curves) across the quote and base assets of every market. Tokens created on the Crystal launchpad are excluded both on the bonding curve and after graduation, so launchpad markets count only their MON side. Balances are read with balanceOf rather than Market.reserveQuote/reserveBase, which hold virtual reserves for pre-graduation markets.", + monad: { tvl }, +} From 0729a3712cdaf944e5b038ac7fec541882991bcb Mon Sep 17 00:00:00 2001 From: Dani Date: Mon, 5 Oct 2026 09:34:48 +0200 Subject: [PATCH 074/988] add Payy (#21392) --- registries/sumTokens.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index adbba69e514..b6bac177858 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -22140,6 +22140,35 @@ const configs = { ] }, }, + "payy": { + "methodology": "TVL is the USDC locked in the Payy Network rollup bridge contracts, which back users' private USDC notes on the Payy L2. Counts the current Ethereum rollup and the two earlier Polygon rollups it migrated from.", + "start": "2024-02-27", + "hallmarks": [ + [ + "2026-02-17", + "Rollup migrated from Polygon to Ethereum" + ], + [ + "2026-09-24", + "Ethereum rollup exploited, ~$1.92M USDC drained" + ] + ], + "ethereum": { + "owner": "0x367c1eaf14aa06b78ce76bd0243297de79d85270", + "tokens": [ + ADDRESSES.ethereum.USDC + ] + }, + "polygon": { + "owners": [ + "0x4cbb5041df8d815d752239960fba5e155ba2687e", + "0xcd92281548df923141fd9b690c7c8522e12e76e6" + ], + "tokens": [ + ADDRESSES.polygon.USDC_CIRCLE + ] + }, + }, "peakdefi": { "start": "2020-12-08", "bsc": { From 27684f2217e221441594768e8b5daeed19d130b6 Mon Sep 17 00:00:00 2001 From: 0xKaya Date: Mon, 5 Oct 2026 02:35:34 -0500 Subject: [PATCH 075/988] Add StonkPress (Robinhood Chain) (#21385) Co-authored-by: 0xKaya <218581356+0xKaya@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- projects/stonkpress/index.js | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 projects/stonkpress/index.js diff --git a/projects/stonkpress/index.js b/projects/stonkpress/index.js new file mode 100644 index 00000000000..296876fa269 --- /dev/null +++ b/projects/stonkpress/index.js @@ -0,0 +1,41 @@ +const { unknownTombs } = require('../helper/unknownTokens') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// StonkPress on Robinhood Chain: PAPER targets 0.0001 SPY, PLATE is the share token. +const PAPER = '0x008dd62dd934f3ffdc0986ba5316c78ae51cb1c9' +const PLATE = '0x5b00c30098216a00905ee3fb5bda413006418bb6' +const SPY = '0x117cc2133c37b721f49de2a7a74833232b3b4c0c' +const PAPER_SPY_LP = '0x6178406c433c70b006e2f81a79a5d98bf5b0af85' +const PLATE_SPY_LP = '0x73c4aae208080d94e97a0abe80f140a140846cc8' +const GENESIS_POOL = '0x935661973d9379b792bcb110d1eebd05034b838f' // pays PAPER +const REWARD_POOL = '0x55d8c2eb48cdcc1835dd38568f22feb6a0893d35' // pays oPLATE +const MASONRY = '0x8235508a182913b7eee538051d65ffd40dfe44bd' // PLATE staking + +const POOL_INFO = { + [GENESIS_POOL]: 'function poolInfo(uint256) view returns (address token, uint256 depFee, uint256 allocPoint, uint256 lastRewardTime, uint256 accPaperPerShare, bool isStarted, uint256 totalStaked, (bool isGauge, address gauge, address[] rewardTokens) gaugeInfo, uint256 poolPaperPerSec)', + [REWARD_POOL]: 'function poolInfo(uint256) view returns (address token, uint256 depFee, uint256 allocPoint, uint256 lastRewardTime, uint256 accGpaperPerShare, bool isStarted, uint256 totalStaked, (bool isGauge, address gauge, uint8 gaugeDex) gaugeInfo, uint256 poolGpaperPerSec)', +} +const PROTOCOL_TOKENS = [PAPER, PLATE, PAPER_SPY_LP, PLATE_SPY_LP] + +// Single-asset deposits (SPY, WETH, USDG and partner tokens) in both pools. PAPER, PLATE and their +// SPY LPs are left to pool2 and staking; this also drops the PAPER rewards the Genesis pool holds. +async function tvl(api) { + const tokensAndOwners = [] + for (const pool of [GENESIS_POOL, REWARD_POOL]) { + const infos = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: POOL_INFO[pool], target: pool }) + infos.forEach(({ token }) => tokensAndOwners.push([token, pool])) + } + return sumTokens2({ api, tokensAndOwners, blacklistedTokens: PROTOCOL_TOKENS }) +} + +module.exports = unknownTombs({ + token: [PAPER], + shares: [PLATE], + rewardPool: [GENESIS_POOL, REWARD_POOL], + masonry: [MASONRY], + lps: [PAPER_SPY_LP, PLATE_SPY_LP], + coreAssets: [SPY], + chain: 'robinhood', +}) +module.exports.robinhood.tvl = tvl +module.exports.methodology = 'TVL is single-asset deposits (SPY, WETH, USDG and partner tokens) in the Genesis and reward pools. Pool2 is PAPER/SPY and PLATE/SPY LP staked in those pools, and staking is PLATE in the Masonry; PAPER and PLATE are valued through their SPY pairs.' From 2f7ded424ef1e8d4ebb6257b78c18efd69dd1e62 Mon Sep 17 00:00:00 2001 From: zipcoincash Date: Mon, 5 Oct 2026 09:44:13 +0200 Subject: [PATCH 076/988] Add zipcoin (#21384) Co-authored-by: zipcoincash Co-authored-by: ccipherx --- projects/zipcoin/index.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 projects/zipcoin/index.js diff --git a/projects/zipcoin/index.js b/projects/zipcoin/index.js new file mode 100644 index 00000000000..355e6f4110f --- /dev/null +++ b/projects/zipcoin/index.js @@ -0,0 +1,35 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// zipcoin runs its own Privacy Pools Entrypoint on Ethereum; today its only registered pool holds the ZC token. +// https://github.com/zipcoincash/zipcoin, https://www.zipcoin.cash/docs +const ENTRYPOINT = '0x7a8DA01D241C3cFcF7803cdB007EcE5663749193' +const ZC = '0x4E67DB19044549fF420860834c91b45BaD298722' +const FROM_BLOCK = 26069641 // first PoolRegistered on the Entrypoint, 2026-09-27 + +const poolRegisteredEvent = 'event PoolRegistered(address _pool, address _asset, uint256 _scope)' + +// Every pool ever registered: removePool only drops the Entrypoint config, deposits stay withdrawable in the pool. +async function registeredPools(api) { + const logs = await getLogs2({ api, target: ENTRYPOINT, eventAbi: poolRegisteredEvent, fromBlock: FROM_BLOCK }) + return logs.map(log => [log._asset.toLowerCase(), log._pool]) +} + +// Deposits of any asset other than zipcoin's own token. +async function tvl(api) { + const tokensAndOwners = (await registeredPools(api)).filter(([asset]) => asset !== ZC.toLowerCase()) + return sumTokens2({ api, tokensAndOwners }) +} + +// ZC deposited by users into the ZC privacy pool. +async function staking(api) { + const tokensAndOwners = (await registeredPools(api)).filter(([asset]) => asset === ZC.toLowerCase()) + return sumTokens2({ api, tokensAndOwners }) +} + +module.exports = { + methodology: + 'Balances of the Privacy Pool contracts registered on the zipcoin Entrypoint, read on chain. Users deposit into a pool and withdraw with a zero-knowledge proof; the pool holds the deposits and nothing is lent or rehypothecated. The ZC token is the protocol\'s own token, so ZC deposited into the ZC pool is counted under staking; pools of any other asset count as TVL.', + start: '2026-09-27', + ethereum: { tvl, staking }, +} From 15b2216b1d22a35c3bc330551f5d33e3ca12d620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Mon, 5 Oct 2026 03:46:55 -0400 Subject: [PATCH 077/988] Add more Hyperithm's Accountable vaults on Monad (#21315) Co-authored-by: ccipherx --- projects/hyperithm/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/hyperithm/index.js b/projects/hyperithm/index.js index 6d5a2c7ce0b..767b5f76a8b 100644 --- a/projects/hyperithm/index.js +++ b/projects/hyperithm/index.js @@ -64,9 +64,11 @@ const vaultConfigs = { midasTokens: [ '0xd90F6bFEd23fFDE40106FC4498DD2e9EDB95E4e7', // mHYPER ], + // aHyperBTC/aHYPER looping vaults excluded: their NAV is aHyperBTC/aHYPER shares already counted here accountableVaults: [ '0xC6De1DC0B59682bE906E5BcA14E385E74EE88168', // Hyperithm Delta Neutral cbBTC (aHyperBTC) '0x7Cd231120a60F500887444a9bAF5e1BD753A5e59', // Hyperithm Delta Neutral USD (aHYPER) + '0x1a5b77cEf5e4B6F806aEac6f6eA9213a617dc7E3', // Saturn PT-USDat Loop Vault (aPTUSDat) ], }, katana: { From d6848f24494f869fa15193b6dd086c74443100d1 Mon Sep 17 00:00:00 2001 From: TartSwap Date: Mon, 5 Oct 2026 10:49:01 +0300 Subject: [PATCH 078/988] tartswap: count partner vaults and third-party farm LP as tvl; own-token LP stays pool2 (#21234) Co-authored-by: tartswap --- projects/tartswap/index.js | 208 ++++++++++++++++++++++++------------- 1 file changed, 135 insertions(+), 73 deletions(-) diff --git a/projects/tartswap/index.js b/projects/tartswap/index.js index 910652ddc94..15f5af24140 100644 --- a/projects/tartswap/index.js +++ b/projects/tartswap/index.js @@ -8,8 +8,8 @@ const ADDRESSES = require('../helper/coreAssets.json') * --------------------------------------------------------------------------- * WHAT THIS PROTOCOL ACTUALLY IS (read this before changing the buckets) * --------------------------------------------------------------------------- - * TartSwap ships four user-facing products on BSC. Only three of them hold - * value in TartSwap-owned contracts: + * TartSwap ships five user-facing products on BSC. Four of them hold value in + * TartSwap-owned contracts: * * 1. "Swap" — TartSwapRouterV2 (0xBd9Ab5...840F) is a FEE-TAKING WRAPPER over * PancakeSwap V2, NOT an AMM. Verified on-chain: the router exposes @@ -21,35 +21,38 @@ const ADDRESSES = require('../helper/coreAssets.json') * sum. Every "TartSwap pool" a user sees in the UI is a PancakeSwap V2 * pair, already counted in PancakeSwap's TVL. Counting those here would * be straight double counting, so this adapter deliberately does not. - * (A native `TartSwapV2Factory` exists in the team's repo but is NOT - * deployed to mainnet — see README, "if the native AMM ships".) + * Volume and fees of the router live in the dimension-adapters repo + * (aggregators/tartswap, fees/tartswap). * * 2. "OTC desk" — TartSwapOTC, a trustless P2P escrow. A maker locks the asset * they are selling until a taker fills or the maker cancels. The owner can - * never touch escrowed funds. This is genuine, non-double-counted TVL. + * never touch escrowed funds. * * 3. "StakinGames" — FastRoundArena V2, a parimutuel round engine that escrows * real USDT staked by players, plus SeederRewards, which escrows the * founder-bonus credits already owed to specific players. * - * 4. "Staking / Farms" — the protocol's own tokens (TART, launched 2026-08-31, - * and CREPE) locked in their staking vaults, and PancakeSwap LP tokens - * deposited into TartSwap's farm (incl. the TART/WBNB pair, pid 6). + * 4. "Staking / Farms" — the protocol's own tokens (TART, listed 2026-08-31, + * and CREPE) locked in their staking vaults, PancakeSwap LP tokens + * deposited into TartSwap's farm (incl. the TART/WBNB pair, pid 6), and + * partner staking vaults where users lock a partner's token to earn TART. * * --------------------------------------------------------------------------- * BUCKETS * --------------------------------------------------------------------------- - * tvl — third-party assets escrowed in TartSwap contracts (OTC legs, game - * collateral, seeder liability). Counted once, no overlap with any - * other protocol. + * tvl — third-party assets deposited in TartSwap contracts: OTC escrow + * legs (offers selling TART/CREPE are skipped - the own token is + * never tvl), game collateral + seeder liability, partner-token + * stakes in the partner vaults, and LP tokens in the farm whose + * pair does NOT contain TART or CREPE. Counted once per contract. + * Those farm LPs are PancakeSwap V2 pairs that PancakeSwap's TVL + * already counts, hence `doublecounted: true` on the export. * staking — TartSwap's own tokens (TART and CREPE) locked by users in their - * staking vaults and the CREPE single-token pools. DefiLlama's + * staking vaults and the single-token staking pools. DefiLlama's * `staking` bucket is exactly "the protocol's own token staked in * the protocol", so this belongs here and NOT in `tvl`. - * pool2 — LP tokens users deposited into TartSwap's farm. The underlying - * pairs are PancakeSwap's, so these must stay out of `tvl`; `pool2` - * is reported separately by DefiLlama and does not inflate the - * headline TVL number. + * pool2 — LP tokens of pairs that contain TART or CREPE deposited into the + * farm (own-token liquidity incentives). * * DELIBERATELY EXCLUDED (protocol revenue / treasury, never user TVL): * GameFeeSplitter 0xcf86404855c21964d6663960BF5AeeB76CD83818 — game fee wallet; @@ -58,8 +61,9 @@ const ADDRESSES = require('../helper/coreAssets.json') * TartFeeConverterV2 0xDeA32774f6d8d2170192275C23Aec2f3bc1492Bd — fee -> CREPE buys. * TartFeeCollector 0xfa261c02b023b8a01F4Fc25Cca658757ddA48521 * Treasury / Reserve / INCOME EOAs. - * Vault reward reserve — undistributed rewards are protocol-owned until - * streamed, so `totalStaked()` is used instead of `balanceOf(vault)`. + * Vault reward reserves — undistributed rewards are protocol-owned until + * streamed, so `totalStaked()` is used instead of `balanceOf(vault)`; the + * TART reward budget parked in a partner vault is excluded the same way. */ const { sumTokens2 } = require('../helper/unwrapLPs') @@ -69,22 +73,26 @@ const { sumTokens2 } = require('../helper/unwrapLPs') // CREPE — the original reward token. // TART — the protocol token, listed on PancakeSwap 2026-08-31. // These are the only tokens this adapter has to name explicitly: every other -// asset (OTC legs, game collateral, farm LPs) is discovered from chain state at -// call time. The game collateral is BSC-USD/USDT +// asset (OTC legs, game collateral, farm LPs, partner stakes) is discovered from +// chain state at call time. The game collateral is BSC-USD/USDT // 0x55d398326f99059fF775485246999027B3197955, read from the arena rather than // hardcoded. const CREPE = '0xeb2B7d5691878627eff20492cA7c9a71228d931D' const TART = '0x7AB8d02CBb51Ff7223fDe700eAaa2a91Bf750314' const OWN_TOKENS = new Set([CREPE.toLowerCase(), TART.toLowerCase()]) +const isOwnToken = (token) => OWN_TOKENS.has(String(token).toLowerCase()) // -- TartSwap contracts (all verified on BscScan, all chainId 56) -------------- -const OTC_DESK = '0x22E6B727286c02C5251682b1A1a65FdE71296Add' // P2P escrow desk +const OTC_DESKS = ['0x22E6B727286c02C5251682b1A1a65FdE71296Add'] // P2P escrow desk(s) const FAST_ROUND_ARENA = '0xbB512254A54067bB16eF10553F86C944B8a2B733' // parimutuel escrow const SEEDER_REWARDS = '0x1898b5aA0cB9184750C19Da0A79c61c211D20363' // seeder-bonus liability const STAKING_VAULT = '0x20940d3573F1629F6c5226C2DDa2e9a28b364B33' // CREPE lock vault const TART_STAKING_VAULT = '0x038C92ac8269c9A648BA06e434056706Bc7832cE' // TART tiered vault const STAKING_V3 = '0x44eFB1281cD682fC889F99b63A2dFD75fF89b689' // CREPE single-token pools const LP_FARM = '0x4f6Eb30a521E5F5FDE2BD433cDc805962902F316' // LP farm (TART/WBNB = pid 6) +// TartPartnerStakingVault: users stake a partner's token (SHIB for the first +// campaign) and earn TART from a fixed budget the protocol pre-funds. +const PARTNER_VAULTS = ['0xbc8f650EB1991C8AA5309f2b0d8693aF2Ec90dF6'] const abi = { // TartSwapOTC @@ -95,13 +103,15 @@ const abi = { collateralToken: 'address:collateralToken', // SeederRewards totalOwed: 'uint256:totalOwed', - // TartStakingVault + // TartStakingVault / TartPartnerStakingVault totalStaked: 'uint256:totalStaked', stakingToken: 'address:stakingToken', // TartLPFarm / TartStakingV3 (identical pool ABI) poolLength: 'uint256:poolLength', pools: 'function pools(uint256) view returns (address stakeToken, address rewardToken, uint256 rewardPerSecond, uint64 startTime, uint64 endTime, uint64 lockDuration, uint64 lastRewardTime, uint256 accRewardPerShare, uint256 totalStaked, bool active)', + token0: 'address:token0', + token1: 'address:token1', } const OFFER_STATUS_OPEN = 1 @@ -113,34 +123,38 @@ const OFFER_STATUS_OPEN = 1 * book), never from a hardcoded token list — makers may list any BEP-20. We then * read the desk's real balances for those tokens, which equals the escrow: the * fill fee is forwarded to the treasury inside the same transaction, so the - * contract never retains protocol revenue. + * contract never retains protocol revenue. Offers that sell TART or CREPE are + * skipped: the protocol's own token does not count as tvl. */ async function addOtcEscrow(api) { - const offerCount = await api.call({ abi: abi.offerCount, target: OTC_DESK }) - if (!Number(offerCount)) return + for (const desk of OTC_DESKS) { + const offerCount = await api.call({ abi: abi.offerCount, target: desk }) + if (!Number(offerCount)) continue - // Offer ids are 1-based: the contract assigns `id = ++offerCount`, so valid ids - // run 1..offerCount and id 0 is never used. - const offers = await api.multiCall({ - abi: abi.offers, - target: OTC_DESK, - calls: Array.from({ length: Number(offerCount) }, (_, i) => i + 1), - }) + // Offer ids are 1-based: the contract assigns `id = ++offerCount`, so valid ids + // run 1..offerCount and id 0 is never used. + const offers = await api.multiCall({ + abi: abi.offers, + target: desk, + calls: Array.from({ length: Number(offerCount) }, (_, i) => i + 1), + }) - // Only Open offers still hold collateral. Filled/Cancelled offers have already - // paid out, and an expired-but-unreclaimed offer is still Open and still funded. - const escrowedTokens = new Set() - for (const offer of offers) { - if (Number(offer.status) !== OFFER_STATUS_OPEN) continue - if (!Number(offer.sellRemaining)) continue - // sellToken == address(0) means the maker escrowed native BNB. - escrowedTokens.add(offer.sellToken) - } - if (!escrowedTokens.size) return + // Only Open offers still hold collateral. Filled/Cancelled offers have already + // paid out, and an expired-but-unreclaimed offer is still Open and still funded. + const escrowedTokens = new Set() + for (const offer of offers) { + if (Number(offer.status) !== OFFER_STATUS_OPEN) continue + if (!Number(offer.sellRemaining)) continue + if (isOwnToken(offer.sellToken)) continue + // sellToken == address(0) means the maker escrowed native BNB. + escrowedTokens.add(offer.sellToken) + } + if (!escrowedTokens.size) continue - // permitFailure: a maker can escrow any BEP-20, so one non-standard token must not - // abort the whole TVL read - a failed balance read contributes zero instead. - return sumTokens2({ api, owner: OTC_DESK, tokens: [...escrowedTokens], permitFailure: true }) + // permitFailure: a maker can escrow any BEP-20, so one non-standard token must not + // abort the whole TVL read - a failed balance read contributes zero instead. + await sumTokens2({ api, owner: desk, tokens: [...escrowedTokens], permitFailure: true }) + } } /** @@ -171,17 +185,73 @@ async function addGamesEscrow(api) { api.add(collateral, owed) } +/** + * Partner staking vaults: `totalStaked()` of the partner token (user principal). + * The vault's TART balance is the pre-funded reward budget and is protocol-owned + * until harvested, so it is not counted anywhere. A vault whose stake token is + * an own token would be `staking`, so it is routed by bucket. + */ +async function addPartnerVaults(api, bucket) { + const [stakingTokens, totals] = await Promise.all([ + api.multiCall({ abi: abi.stakingToken, calls: PARTNER_VAULTS }), + api.multiCall({ abi: abi.totalStaked, calls: PARTNER_VAULTS }), + ]) + stakingTokens.forEach((token, i) => { + const own = isOwnToken(token) + if ((bucket === 'staking') !== own) return + api.add(token, totals[i]) + }) +} + /** Enumerate a farm/staking contract's pools (shared ABI). */ function getPools(api, target) { return api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.pools, target }) } +/** + * Splits the funded, non-own-token pools of a farm/staking contract into LPs + * whose pair contains TART/CREPE (pool2) and third-party LPs (tvl). Pair + * membership is read from the LP itself (`token0/token1`). Every funded stake + * token of that kind is a PancakeSwap V2 pair; a failed read aborts the run + * instead of guessing a bucket. + */ +async function classifyPools(api, target) { + const pools = await getPools(api, target) + const funded = pools.filter((pool) => !isOwnToken(pool.stakeToken) && Number(pool.totalStaked) > 0) + const stakeTokens = funded.map((pool) => pool.stakeToken) + const [token0s, token1s] = await Promise.all([ + api.multiCall({ abi: abi.token0, calls: stakeTokens }), + api.multiCall({ abi: abi.token1, calls: stakeTokens }), + ]) + const ownLps = [] + const thirdPartyLps = [] + stakeTokens.forEach((token, i) => { + if (isOwnToken(token0s[i]) || isOwnToken(token1s[i])) return ownLps.push(token) + thirdPartyLps.push(token) + }) + return { ownLps, thirdPartyLps } +} + // ----------------------------------------------------------------------------- -// tvl — third-party assets escrowed in TartSwap contracts, counted exactly once. +// tvl — third-party assets deposited in TartSwap contracts, counted exactly once. // ----------------------------------------------------------------------------- async function tvl(api) { await addOtcEscrow(api) await addGamesEscrow(api) + await addPartnerVaults(api, 'tvl') + + // Farm/staking pools holding third-party LPs (pair without TART/CREPE). The + // LP is unwrapped to its underlying reserves; PancakeSwap's TVL counts the + // same reserves, so the adapter is exported with `doublecounted: true`. + const [farm, stakingPools] = await Promise.all([classifyPools(api, LP_FARM), classifyPools(api, STAKING_V3)]) + await sumTokens2({ + api, + ownerTokens: [ + [farm.thirdPartyLps, LP_FARM], + [stakingPools.thirdPartyLps, STAKING_V3], + ], + resolveLP: true, + }) return api.getBalances() } @@ -200,57 +270,49 @@ async function staking(api) { } // StakingV3 custom pools: only own-token pools belong in `staking`. Any pool - // whose stake token is not CREPE/TART is an LP pool and is picked up by pool2(). + // whose stake token is not CREPE/TART is picked up by tvl()/pool2(). const pools = await getPools(api, STAKING_V3) for (const pool of pools) { - if (!OWN_TOKENS.has(pool.stakeToken.toLowerCase())) continue + if (!isOwnToken(pool.stakeToken)) continue api.add(pool.stakeToken, pool.totalStaked) } + await addPartnerVaults(api, 'staking') return api.getBalances() } // ----------------------------------------------------------------------------- -// pool2 — LP tokens users deposited into TartSwap's farm. +// pool2 — LP tokens of TART/CREPE pairs users deposited into TartSwap's farm. // -// These are PancakeSwap V2 LPs, so the underlying reserves are already inside -// PancakeSwap's TVL. Reporting them under `pool2` (which DefiLlama keeps out of -// the headline TVL) credits TartSwap for the locked LP without double counting. +// These are PancakeSwap V2 LPs of the protocol's own token, so they belong in +// `pool2`, which DefiLlama keeps out of the headline TVL. // ----------------------------------------------------------------------------- async function pool2(api) { - const [farmPools, stakingPools] = await Promise.all([ - getPools(api, LP_FARM), - getPools(api, STAKING_V3), - ]) - - // Skip own-token pools (they are `staking`) and empty pools. Dropping empty - // pools is safe because `totalStaked` is read at the same block as the - // balances, and it keeps LP resolution from touching retired pools whose - // stake token is a non-standard pair contract. - const isFundedLp = (pool) => - !OWN_TOKENS.has(pool.stakeToken.toLowerCase()) && Number(pool.totalStaked) > 0 - const farmLps = farmPools.filter(isFundedLp).map((pool) => pool.stakeToken) - const stakingLps = stakingPools.filter(isFundedLp).map((pool) => pool.stakeToken) - + const [farm, stakingPools] = await Promise.all([classifyPools(api, LP_FARM), classifyPools(api, STAKING_V3)]) return sumTokens2({ api, ownerTokens: [ - [farmLps, LP_FARM], - [stakingLps, STAKING_V3], + [farm.ownLps, LP_FARM], + [stakingPools.ownLps, STAKING_V3], ], resolveLP: true, }) } module.exports = { + // The farm LPs counted in tvl are PancakeSwap V2 pairs that PancakeSwap's + // TVL already counts. + doublecounted: true, methodology: 'Counts assets held in TartSwap-owned contracts on BNB Smart Chain. ' + - 'TVL: (a) tokens escrowed by makers in the TartSwapOTC peer-to-peer desk for offers that are still open, ' + - '(b) USDT collateral escrowed by players in the FastRoundArena parimutuel game engine (open, locked and unclaimed-resolved rounds), and ' + - '(c) the SeederRewards outstanding liability (totalOwed), i.e. game bonus credits already booked to specific players that the protocol can never reclaim. ' + + 'TVL: (a) third-party tokens escrowed by makers in the TartSwapOTC peer-to-peer desk for offers that are still open (offers selling TART or CREPE are not counted), ' + + '(b) USDT collateral escrowed by players in the FastRoundArena parimutuel game engine (open, locked and unclaimed-resolved rounds), ' + + '(c) the SeederRewards outstanding liability (totalOwed), i.e. game bonus credits already booked to specific players that the protocol can never reclaim, ' + + '(d) partner tokens staked in TartPartnerStakingVault contracts (totalStaked), and ' + + '(e) PancakeSwap V2 LP tokens deposited in the TartSwap farm and staking-pool contracts (TartLPFarm, TartStakingV3) whose pair does not contain TART or CREPE, unwrapped to their underlying reserves; PancakeSwap already counts those reserves, so the adapter is flagged as double counted. ' + 'Staking: TartSwap\'s own tokens locked by users - TART (the protocol token, listed 2026-08-31) in its tiered staking vault and CREPE in the TartStakingVault and the CREPE single-token staking pools; each vault\'s undistributed reward reserve is excluded because it is protocol-owned until streamed. ' + - 'Pool2: LP tokens users deposited into the TartSwap farm (incl. the TART/WBNB PancakeSwap pair). ' + - 'The TartSwap swap router is a fee-taking wrapper around PancakeSwap V2 rather than an AMM of its own, so it holds no liquidity and no pair reserves are counted here - that liquidity already belongs to PancakeSwap. ' + + 'Pool2: LP tokens of TART/CREPE pairs deposited into the same farm and staking-pool contracts (e.g. the TART/WBNB PancakeSwap pair). ' + + 'The TartSwap swap router is a fee-taking wrapper around PancakeSwap V2 rather than an AMM of its own, so it holds no liquidity and the pairs it routes through are not counted - that liquidity belongs to PancakeSwap. The only pair reserves counted are the share behind the LP tokens users deposited, as described in (e) and under Pool2. ' + 'Fee and treasury contracts (GameFeeSplitter, TartFeeDistributor, TartFeeConverter, TartFeeCollector, treasury and reserve wallets) are protocol revenue and are excluded.', // Earliest TartSwap contract in this adapter: TartStakingVault, deployed // 2026-06-29T15:33:46Z on BSC mainnet. From a1ac7003c6a509cf6c98149772678b1424270957 Mon Sep 17 00:00:00 2001 From: Abyss <322263618+abysshopper@users.noreply.github.com> Date: Mon, 5 Oct 2026 02:49:35 -0500 Subject: [PATCH 079/988] Add Abyss DEX TVL adapter on Robinhood (#21386) Co-authored-by: ccipherx --- registries/uniswapV3.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 0417f594bc2..b9e1f257e55 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1911,6 +1911,10 @@ const uniV3Configs = { // Uniswap V3 fork; pools are CREATE2'd by a separate pool deployer but PoolCreated is emitted by the factory robinhood: { factory: '0x221A6239E40709792b0d4bdc140fA36158CD41C7', fromBlock: 73266708 }, }, + 'abyss-dex': { + methodology: 'TVL is the sum of both underlying ERC20 balances held by Abyss pools on Robinhood. Pools are discovered from factory PoolCreated events. Separate treasury and fee-vault holdings are excluded.', + robinhood: { factory: '0xe7feF2BC860B25bbdEB6F6AB96d88bAAa77ddad7', fromBlock: 50161538 }, + }, } module.exports = buildProtocolExports(uniV3Configs, uniV3Export) From 67e62fe5c1151c1495251d2241b06fc6982a5b87 Mon Sep 17 00:00:00 2001 From: Dani Date: Mon, 5 Oct 2026 09:52:16 +0200 Subject: [PATCH 080/988] feat: Orion Finance TVL (#21393) Co-authored-by: matteoettam09 --- projects/orion-finance/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/orion-finance/index.js diff --git a/projects/orion-finance/index.js b/projects/orion-finance/index.js new file mode 100644 index 00000000000..333cfe0077e --- /dev/null +++ b/projects/orion-finance/index.js @@ -0,0 +1,17 @@ +const ORION_CONFIG = '0xAba49f4eb48659fCb1f891b55D7a7b835C05af5E' + +async function tvl(api) { + const [transparent, encrypted] = await api.multiCall({ + target: ORION_CONFIG, + abi: 'function getAllOrionVaults(uint8) view returns (address[])', + calls: [0, 1], + }) + const decommissioned = await api.call({ target: ORION_CONFIG, abi: 'address[]:getAllDecommissionedVaults' }) + return api.erc4626Sum2({ calls: [...transparent, ...encrypted, ...decommissioned] }) +} + +module.exports = { + methodology: + 'TVL is the sum of accounted ERC-4626 totalAssets() (underlying notional AUM, not vault-contract token balances) across active vaults from OrionConfig.getAllOrionVaults(0) and getAllOrionVaults(1), plus getAllDecommissionedVaults. Excludes pending deposits, pendingVaultFees, and pendingProtocolFees.', + ethereum: { tvl }, +} From 58750184f3403e5cf19543be9a988d57a938bff0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 5 Oct 2026 10:21:37 +0200 Subject: [PATCH 081/988] fix boken --- projects/ember-protocol/index.js | 3 ++- projects/helper/deadChains.js | 2 ++ projects/more-vaults/index.js | 4 ++-- projects/perma-pod/index.js | 7 ++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/projects/ember-protocol/index.js b/projects/ember-protocol/index.js index 0b702ca4c8b..da4260222fa 100644 --- a/projects/ember-protocol/index.js +++ b/projects/ember-protocol/index.js @@ -22,7 +22,8 @@ async function suiTvl(api) { for (const vault of Object.values(vaults)) { const suiVault = vault.detailsByChain[SUI_CHAIN_IDENTIFIER]; - if (!suiVault || blacklistedVaults.includes(suiVault.address)) { + // skip vaults whose receipt coin is not a coin type (malformed api entry, makes get_vault_tvl abort) + if (!suiVault || blacklistedVaults.includes(suiVault.address) || !suiVault.receiptCoin?.address?.includes('::')) { continue; } const vaultTvl = await sui.query({ diff --git a/projects/helper/deadChains.js b/projects/helper/deadChains.js index 6d785a8f97b..98b8296cd16 100644 --- a/projects/helper/deadChains.js +++ b/projects/helper/deadChains.js @@ -14,5 +14,7 @@ module.exports = [ 'hoo', 'rari', 'nova', + 'csc', // CoinEx Smart Chain shut down 2026-09-29: https://www.coinex.org/?lang=en_US + 'shimmer_evm', // ShimmerEVM stopped block production 2026-09-30: https://shimmer.network/ ...sdk.chainUtils.getDeadChains() ] \ No newline at end of file diff --git a/projects/more-vaults/index.js b/projects/more-vaults/index.js index 50773335fd6..1bbf9c931b6 100644 --- a/projects/more-vaults/index.js +++ b/projects/more-vaults/index.js @@ -27,7 +27,7 @@ async function tvl(api) { }); const allVaults = vaultArrays.flat(); if (allVaults.length) { - await api.erc4626Sum({ calls: allVaults, tokenAbi: 'address:asset', balanceAbi: 'uint256:totalAssets' }); + await api.erc4626Sum({ calls: allVaults, tokenAbi: 'address:asset', balanceAbi: 'uint256:totalAssets', permitFailure: true }); } } @@ -45,7 +45,7 @@ async function tvl(api) { // Spoke vaults report TVL to the hub via cross-chain messages, only count hubs to avoid double-counting const hubVaults = allVaults.filter((_, i) => isHubResults[i]); if (hubVaults.length) { - await api.erc4626Sum({ calls: hubVaults, tokenAbi: 'address:asset', balanceAbi: 'uint256:totalAssets' }); + await api.erc4626Sum({ calls: hubVaults, tokenAbi: 'address:asset', balanceAbi: 'uint256:totalAssets', permitFailure: true }); } } } diff --git a/projects/perma-pod/index.js b/projects/perma-pod/index.js index 2ebf15b44a6..498de2d6b70 100644 --- a/projects/perma-pod/index.js +++ b/projects/perma-pod/index.js @@ -2,7 +2,7 @@ const { queryContract } = require('../helper/chain/cosmos'); const BigNumber = require('bignumber.js'); const redBanks = [ - 'zig1s3frrzltqaxvuzffvxg89uuad6nkcyqe3ucvrahynznaek3mhe4s75puyu', // Main market + // 'zig1s3frrzltqaxvuzffvxg89uuad6nkcyqe3ucvrahynznaek3mhe4s75puyu', // Main market - migrated to a residual-sweeper after the hack, bank balance is empty 'zig1smfzazs6eg86vz23p8t7dk3gr4nnwr5m40yae9cl2m7erx3rnm2sxecuyc', // BTC market ]; @@ -55,9 +55,6 @@ module.exports = { methodology: "Sum token balances by querying the total deposit amount for each asset across the Main and Solv red banks.", zigchain: { tvl, - borrowed: () => ({}), // hacked + borrowed, }, - hallmarks: [ - ['2025-11-16', 'Launch on ZigChain'], - ], }; From 170ad673696eeca4baf9f027dce762df8a700f12 Mon Sep 17 00:00:00 2001 From: Mercurifi Date: Mon, 5 Oct 2026 11:49:07 +0300 Subject: [PATCH 082/988] mercurifi: split TVL into mercurifi-launchpad (curves) and mercurifi-dex (locked v4 positions) (#21351) Co-authored-by: mercurifinance Co-authored-by: ccipherx --- projects/mercurifi-launchpad/index.js | 40 +++++++++++++++++++++++++++ projects/mercurifi/index.js | 29 ++++++------------- 2 files changed, 49 insertions(+), 20 deletions(-) create mode 100644 projects/mercurifi-launchpad/index.js diff --git a/projects/mercurifi-launchpad/index.js b/projects/mercurifi-launchpad/index.js new file mode 100644 index 00000000000..18b49463f22 --- /dev/null +++ b/projects/mercurifi-launchpad/index.js @@ -0,0 +1,40 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// Mercurifi Launchpad (launch.mercuri.finance), a bonding-curve launchpad on Arc: a launch deploys a token and +// its own bonding curve, and the token trades against that curve priced in USDC, which is also Arc's gas +// token. The buy that sells the curve out opens a Uniswap V4 pool at the curve's last price in the same +// transaction; the locked pool positions are the Mercurifi Trade listing (projects/mercurifi), not counted +// here. Contracts: https://github.com/mercuri-finance/mercuri-launch-contracts +const FACTORY = '0x8f5DfA0c48E14cCD03AE01795B8a95759BA859EB' +const FACTORY_BLOCK = 22060881 // LaunchFactory deployment +// A curve holds its reserve as the chain's gas token (native USDC, 18 decimals). +const NATIVE_USDC = ADDRESSES.null +const PHASE_GRADUATED = 2 // BondingCurve.Phase: Trading, GraduationPending, Graduated + +/** + * Sums the native USDC still sitting in bonding curves that have not graduated. + * + * @param {Object} api - the adapter's chain API for this block and chain + * @returns {Promise} the balances object, or undefined when nothing has launched yet + */ +async function tvl(api) { + const launches = await getLogs2({ + api, target: FACTORY, fromBlock: FACTORY_BLOCK, + eventAbi: 'event TokenCreated(address indexed token, address indexed curve, address indexed creator, address deployer, string name, string symbol, string metadataURI, bytes32 configHash, (uint256,uint256,uint256,uint256,uint256,uint256,uint16,uint16,uint16,uint16,uint32) config)', + }) + if (!launches.length) return + + // A graduated curve keeps nothing: it hands its reserve to the pool and forwards the remainder, so it is + // skipped rather than summed as zero. + const phases = await api.multiCall({ abi: 'uint8:phase', calls: launches.map(i => i.curve) }) + const liveCurves = launches.filter((_, i) => +phases[i] !== PHASE_GRADUATED).map(i => i.curve) + return sumTokens2({ api, owners: liveCurves, tokens: [NATIVE_USDC] }) +} + +module.exports = { + methodology: 'TVL is the native USDC held by bonding curves that have not graduated. Launched tokens and unclaimed fees are excluded; the Uniswap V4 positions locked at graduation are counted under Mercurifi Trade.', + start: '2026-09-21', + arc: { tvl }, +} diff --git a/projects/mercurifi/index.js b/projects/mercurifi/index.js index d201137d54a..4e3d9f26194 100644 --- a/projects/mercurifi/index.js +++ b/projects/mercurifi/index.js @@ -2,27 +2,22 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getLogs2 } = require('../helper/cache/getLogs') const { sumTokens2 } = require('../helper/unwrapLPs') -// mercurifi Launch, a bonding-curve launchpad on Arc: a launch deploys a token and its own bonding curve, and the token trades -// against that curve priced in USDC, which is also Arc's gas token. The buy that sells the curve out opens a -// Uniswap V4 pool at the curve's last price in the same transaction and sends the full-range position to the -// LiquidityLocker, which has no withdrawal path. +// Mercurifi Trade (trade.mercuri.finance), a hook-based AMM on Arc: tokens that graduate from the Mercurifi +// Launchpad trade in Uniswap V4 pools opened at graduation, where the protocol's immutable LaunchHook charges +// the fee. The graduation transaction sends the full-range position to the LiquidityLocker, which has no +// withdrawal path. Curves that have not graduated are the launchpad listing (projects/mercurifi-launchpad). // Contracts: https://github.com/mercuri-finance/mercuri-launch-contracts const FACTORY = '0x8f5DfA0c48E14cCD03AE01795B8a95759BA859EB' const LIQUIDITY_LOCKER = '0x278e5162074BC4fc98e91E90857FDbc374d1f391' const POSITION_MANAGER = '0x6049c9a0e26405C0985f9E3685C87d0aE917f82B' // Uniswap V4 PositionManager on Arc const STATE_VIEW = '0xF3334192D15450CdD385c8B70e03f9A6bD9E673b' // Uniswap V4 StateView on Arc const FACTORY_BLOCK = 22060881 // LaunchFactory deployment -// A curve holds its reserve as the chain's gas token (native USDC, 18 decimals); the Uniswap V4 pools hold -// USDC through its ERC-20 interface (6 decimals). -const NATIVE_USDC = ADDRESSES.null -const PHASE_GRADUATED = 2 // BondingCurve.Phase: Trading, GraduationPending, Graduated /** - * Sums what the protocol holds on Arc: the native USDC still sitting in bonding curves that have not - * graduated, plus the USDC side of the Uniswap V4 positions locked in the LiquidityLocker. + * Sums the USDC side of the Uniswap V4 positions permanently locked in the LiquidityLocker. * * @param {Object} api - the adapter's chain API for this block and chain - * @returns {Promise} the balances object, or undefined when nothing has launched yet + * @returns {Promise} the balances object, or undefined while no token has graduated */ async function tvl(api) { const launches = await getLogs2({ @@ -31,14 +26,8 @@ async function tvl(api) { }) if (!launches.length) return - // 1. USDC still held by curves that have not graduated. A graduated curve keeps nothing: it hands its - // reserve to the pool and forwards the remainder, so it is skipped rather than summed as zero. - const phases = await api.multiCall({ abi: 'uint8:phase', calls: launches.map(i => i.curve) }) - const liveCurves = launches.filter((_, i) => +phases[i] !== PHASE_GRADUATED).map(i => i.curve) - await sumTokens2({ api, owners: liveCurves, tokens: [NATIVE_USDC] }) - - // 2. USDC side of the permanently locked Uniswap V4 positions. The locker records the position it holds for - // each token, so the ids are read from it rather than enumerated from PositionManager Transfer events. + // The locker records the position it holds for each token, so the ids are read from it rather than + // enumerated from PositionManager Transfer events. const positions = await api.multiCall({ target: LIQUIDITY_LOCKER, abi: 'function positionOf(address) view returns (uint256)', calls: launches.map(i => i.token), @@ -54,7 +43,7 @@ async function tvl(api) { module.exports = { doublecounted: true, // the locked positions already sit inside Uniswap V4's TVL on Arc - methodology: 'TVL is the native USDC held by bonding curves that have not graduated, plus the USDC side of the Uniswap V4 positions permanently locked in the LiquidityLocker, whose token ids are read from the locker itself. Launched tokens and unclaimed fees are excluded. Marked doublecounted because the locked positions are already counted in Uniswap V4 TVL on Arc.', + methodology: 'TVL is the USDC side of the Uniswap V4 positions permanently locked in the LiquidityLocker, whose token ids are read from the locker itself. Launched tokens and unclaimed fees are excluded. Marked doublecounted because the locked positions are already counted in Uniswap V4 TVL on Arc.', start: '2026-09-21', arc: { tvl }, } From 732dad1ffe00f7b1a727f1c7ec258fc554f23999 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 5 Oct 2026 11:29:07 +0200 Subject: [PATCH 083/988] update bitget --- projects/bitget/index.js | 13 +++++++++++-- projects/helper/cex.js | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/projects/bitget/index.js b/projects/bitget/index.js index dca96d7142c..8a7c2fe3978 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -83,9 +83,10 @@ const evmOwners = [ "0x8a4af9f649434350f795fa7ba7edfb5404b9b078", "0xb3e8a3b17c50f077685bcdef2ca496e54d91c4bd", "0x4cad1efbfd5f0848e0c3c14fab23f92b2fa81f17", + "0xa4856e07d14045014b2c3fece5460bd37b310f10", // add on 05/10/2026 ] -const evmChains = ["bsc","ethereum","arbitrum","optimism","era","fantom","cronos","avax","polygon","metis","kava","klaytn","base","hyperliquid","sonic"] +const evmChains = ["bsc","ethereum","arbitrum","optimism","era","fantom","cronos","avax","polygon","metis","kava","klaytn","base","hyperliquid","sonic","morph"] const config = { tron: { @@ -129,6 +130,7 @@ const config = { "r3AEihLNr81VYUf5PdfH5wLPqtJJyJs6yY", "rGDreBvnHrX1get7na3J4oowN19ny4GzFn", "rwTTsHVUDF8Ub2nzV2oAeWxfJzUvobXLEf", + "rMCVBYFYtVJy6F4gUSd7RrM8GXApM6MNDN", // add on 05/10/2026 ], }, solana: { @@ -153,6 +155,12 @@ const config = { doge: { owners: [ 'DTHZron9cR6WstH6VcdsVZwSbVDEnFKkGQ', + 'DRoaiomCBuDGEpZGw2d2xmXP9ffKcfhuuQ', // add on 05/10/2026 + ], + }, + near: { + owners: [ + '241754260760e04e3a90acf27b1c54296b81e52a3b21fab8347ae88066946092', // add on 05/10/2026 ], }, starknet: { @@ -215,6 +223,7 @@ const config = { "EQAXl6XExQorMSzpkn_28S79OwtY_zEURRGMLS5kMStdeQng", "EQBggwBbNUqxxHhaqM6Ck-5cnBgukkjyfpyQdPNcFjQggwrJ", "UQCe6OZlNFHXWBai5V3CzYsdO68yZR2GMdMYWO6NJ1wYi5PA", // add on 18/09/2026 + "UQCK-8sWM1jrIL4a6bYQopOAONhKEIfn9JzMv4BG9ZyFn5M9", // add on 05/10/2026 ], }, cardano: { @@ -246,4 +255,4 @@ const withdrawalAddresses = [ module.exports = mergeExports([ cexExports(config), { ethereum: { tvl: getStakedEthTVL({ withdrawalAddresses: withdrawalAddresses, size: 200, sleepTime: 20_000, proxy: true }) } }, -]) +]) \ No newline at end of file diff --git a/projects/helper/cex.js b/projects/helper/cex.js index f4e3f6ecd84..619b1efd6eb 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -293,6 +293,11 @@ const defaultTokens = { '0xabc9547b534519ff73921b1fba6e672b5f58d083', // WOO ADDRESSES.avax.USDC_e, //USDC.e ], + morph: [ + nullAddress, + ...Object.values(ADDRESSES.morph), + '0x389C08Bc23A7317000a1FD76c7c5B0cb0b4640b5', // BGB + ], near: [ 'usdt.tether-token.near', ], From 079d0fa479bf6ee658d8c8d5f40a28921916a489 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 5 Oct 2026 10:44:27 -0400 Subject: [PATCH 084/988] fix valdora vaults (#21401) --- projects/valdora/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/projects/valdora/index.js b/projects/valdora/index.js index 2d8bdfc71bc..5ef3edc0361 100644 --- a/projects/valdora/index.js +++ b/projects/valdora/index.js @@ -1,9 +1,15 @@ const { queryContract, endPoints } = require('../helper/chain/cosmos'); const { transformBalances } = require('../helper/portedTokens'); const { get } = require('../helper/http'); +const { getConfig } = require('../helper/cache'); const VALDORA_STAKER_CONTRACT = 'zig18nnde5tpn76xj3wm53n0tmuf3q06nruj3p6kdemcllzxqwzkpqzqk7ue55'; const VAULTS_API = 'https://valdora.finance/api/vaults'; +const FALLBACK_VAULTS = [ + 'zig1h3au5n3lsyqm32ydz3usgy7r9z7wpx4gttcxmypfecz29adtu64svluenp', + 'zig1mayx7wkzensav40j3qc8c5lh6s884jlhsu0c0js058t4u9xcg0mql58gkq', + 'zig1m526fltgrf70qdsufx9k9fdl4x07usjlydcn32jn83fs6za9c5cswd9grk', +]; async function fetchStakerAUM() { const { funds_raised } = await queryContract({ @@ -37,13 +43,8 @@ async function tvl(api) { const stakerAum = await fetchStakerAUM(); if (stakerAum) balances['zigchain:azig'] = stakerAum; - let vaults = []; - try { - const payload = await get(VAULTS_API); - vaults = Array.isArray(payload) ? payload : []; - } catch (_) { - vaults = []; - } + const payload = await getConfig('valdora/vaults', VAULTS_API); + const vaults = Array.isArray(payload) && payload.length ? payload : FALLBACK_VAULTS.map(address => ({ address })); const results = await Promise.all( vaults.map(v => fetchVaultBalance(v.address).catch(() => null)) ); From 9d910b8b7a257a9c7f7c23b4353f0e0153c08c5d Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 5 Oct 2026 12:03:59 -0400 Subject: [PATCH 085/988] Add Latch protocol (#21403) Co-authored-by: OxForged Co-authored-by: Claude Opus 5.5 --- projects/latch-protocol/index.js | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 projects/latch-protocol/index.js diff --git a/projects/latch-protocol/index.js b/projects/latch-protocol/index.js new file mode 100644 index 00000000000..f1762d49f37 --- /dev/null +++ b/projects/latch-protocol/index.js @@ -0,0 +1,45 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getLogs2 } = require("../helper/cache/getLogs"); +const { nullAddress } = require("../helper/tokenMapping"); + +// PancakeSwap Infinity fork: a single Vault holds every pool's tokens, the pool managers hold nothing +const vault = "0xaC44C903CE3d89054fD5b70e0E396f26b214CBE3"; +const managers = [ + { address: "0x3d4afd3190b1e5036e410abb576f99c02D6fBb20", eventAbi: "event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint160 sqrtPriceX96, int24 tick)" }, // CLPoolManager + { address: "0xbD6274D94102C3fCafE043f8EF7C7F33f33B255A", eventAbi: "event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint24 activeId)" }, // BinPoolManager +]; + +const config = { + robinhood: { + fromBlock: 74031752, + blacklistedTokens: [ + "0x2A21c0826848f2D597B7C87A4B931dE1407958A6", // LTT1 test token + "0xa29927045BDFfd61B8F539D491085F1b6f7A8bE4", // LTT2 test token + ], + }, + base: { fromBlock: 51856707 }, +}; + +async function tvl(api) { + const { fromBlock, blacklistedTokens = [] } = config[api.chain]; + const tokens = new Set(); + const hookTokens = {}; + for (const { address, eventAbi } of managers) { + const logs = await getLogs2({ api, target: address, fromBlock, eventAbi }); + logs.forEach(({ currency0, currency1, hooks }) => { + tokens.add(currency0); + tokens.add(currency1); + if (hooks === nullAddress) return; + hookTokens[hooks] = hookTokens[hooks] || new Set(); + hookTokens[hooks].add(currency0).add(currency1); + }); + } + const ownerTokens = [[[...tokens], vault], ...Object.entries(hookTokens).map(([hook, t]) => [[...t], hook])]; + return sumTokens2({ api, ownerTokens, blacklistedTokens, permitFailure: true }); +} + +module.exports = { + methodology: "TVL is the Vault's balance of every token in a pool initialized on the CL or Bin pool manager, plus any balance held by each pool's hook contract.", + robinhood: { tvl, start: "2026-09-27" }, + base: { tvl, start: "2026-09-27" }, +}; From 0a8101e4004756622780afcb15b8bdd7d54228fd Mon Sep 17 00:00:00 2001 From: Nullmask Date: Mon, 5 Oct 2026 20:25:25 +0400 Subject: [PATCH 086/988] Add Nullmask (TVL + treasury) (#21369) Co-authored-by: FelixBruguera --- registries/sumTokens.js | 4 ++++ registries/treasury.js | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index b6bac177858..c49d1d18a60 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -20647,6 +20647,10 @@ const configs = { } }, }, + "nullmask": { + start: '2026-10-01', + ethereum: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT] }, + }, "numbers": { "misrepresentedTokens": true, "methodology": "Core TVL = non‑NUM assets (USDC on Ethereum, BUSD on BSC) derived from unwrapping the LP tokens staked in the farm contracts. 'staking' tracks single‑asset NUM staking and 'pool2' tracks full NUM‑LP staking. NUM itself is excluded from core TVL to avoid double counting.", diff --git a/registries/treasury.js b/registries/treasury.js index 1a710a67407..b45f3843c08 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -4114,6 +4114,19 @@ const configs = { }, }, }, + 'treasury/nullmask': { + ethereum: { + owners: ['0xDD85F4AfDE114dc7c480b012Feaa83152a0C0D09'], // pool treasury(), receives swept protocol fees + tokens: [nullAddress, ADDRESSES.ethereum.USDT], + }, + solana: { + owners: [ + 'GRbpmTbmDeGn8BXHXb1jfEeUT6sGAt7Da44YpWxCS8nr', // ops wallet + 'FrXTvkebakR2oNctgsHz1yeijmu9wTZifL3FmffJP5xJ', // team wallet + ], + ownTokens: ['HuAXPyDWDaMYFKuwQHpqL1oPnj93zdzWmtvFGzCeCUa7'], // MASK + }, + }, 'treasury/neutra-finance': { arbitrum: { tokens: [ From b0c4dc060106267beead430747897fc4c93c87ba Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 5 Oct 2026 20:05:29 +0200 Subject: [PATCH 087/988] update re7 --- registries/curators.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/registries/curators.js b/registries/curators.js index d1a81ead130..980865b0cf2 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -978,6 +978,9 @@ const configs = { '0x46BA7bCD764a692208781B0Fdc642E272ee597bC', '0xE86399fE6d7007FdEcb08A2ee1434Ee677a04433', ], + morpho: [ + '0x5E2339BCb89B42782CEE454B46C7C6f88c0E4f83', // Aerie x Plume USDC Core (Morpho V2) + ], eulerVaultOwners: [ '0xa563FEEA4028FADa193f1c1F454d446eEaa6cfD7', '0x46BA7bCD764a692208781B0Fdc642E272ee597bC', From 6556d1029aede1c269c71ce4697db66c098814c9 Mon Sep 17 00:00:00 2001 From: avral Date: Tue, 6 Oct 2026 01:24:24 +0700 Subject: [PATCH 088/988] alcor: add Proton and Telos, full token lists; split liquid staking (#21371) --- projects/alcor-liquid-staking/index.js | 11 ++++ projects/alcor/index.js | 87 +++++++++++++++++++------- projects/helper/chain/eos.js | 1 + 3 files changed, 78 insertions(+), 21 deletions(-) create mode 100644 projects/alcor-liquid-staking/index.js diff --git a/projects/alcor-liquid-staking/index.js b/projects/alcor-liquid-staking/index.js new file mode 100644 index 00000000000..f66ead6e150 --- /dev/null +++ b/projects/alcor-liquid-staking/index.js @@ -0,0 +1,11 @@ +const { get_account_tvl } = require("../helper/chain/eos"); + +// Alcor Liquid Staking: WAX staked through liquid.alcor, represented by LSW (lsw.alcor). +async function wax() { + return await get_account_tvl(["liquid.alcor"], [["eosio.token", "WAX", "wax"]], "wax"); +} + +module.exports = { + methodology: `TVL is the WAX held and staked (CPU/NET, plus pending refunds) by the liquid.alcor contract.`, + wax: { tvl: wax }, +} diff --git a/projects/alcor/index.js b/projects/alcor/index.js index b8b614282e8..9377509b50f 100644 --- a/projects/alcor/index.js +++ b/projects/alcor/index.js @@ -1,36 +1,81 @@ const { get_account_tvl } = require("../helper/chain/eos"); -// Alcor -// https://eos.alcor.exchange/ +// Alcor Exchange: concentrated liquidity AMM (swap.alcor), orderbook (eostokensdex / +// alcordexmain / alcor) and OTC (alcorotcswap / alcorotc). TVL is what these contracts +// hold. Bridged tokens backed 1:1 (wrap.alcor, eth.token, xtokens, ibc.wt.*) are priced +// as their origin asset. + +// https://alcor.exchange/v/eos async function eos() { - const accounts = ["swap.alcor", "eostokensdex"]; + const accounts = ["swap.alcor", "eostokensdex", "alcorotcswap"]; const tokens = [ - ["eosio.token", "EOS", "eos"], - ["tethertether", "USDT", "tether"], + ["eosio.token", "EOS", "eos"], + ["core.vaulta", "A", "vaulta"], + ["tethertether", "USDT", "tether"], + ["ibc.wt.wax", "WAX", "wax"], ]; - return await get_account_tvl(accounts, tokens); + return await get_account_tvl(accounts, tokens, "eos"); } -// Alcor -// https://wax.alcor.exchange +// https://alcor.exchange/v/wax async function wax() { - const accounts = ["swap.alcor", "alcordexmain", "liquid.alcor"]; + const accounts = ["swap.alcor", "alcordexmain", "alcorotcswap"]; const tokens = [ - ["eosio.token", "WAX", "wax"], - ["alien.worlds", "TLM", "alien-worlds"], - ["token.rfox", "USD", "redfox-labs"], - ["usdt.alcor", "USDT", "usdt-alcor"], - ["token.fusion", "LSWAX", "waxfusion-staked-wax"], + ["eosio.token", "WAX", "wax"], + ["alien.worlds", "TLM", "alien-worlds"], + ["token.fusion", "LSWAX", "waxfusion-staked-wax"], + ["wuffi", "WUF", "wuffi"], + ["usdt.alcor", "USDT", "alcor-ibc-bridged-usdt-wax"], + ["wrap.alcor", "USDT", "tether"], + ["wrap.alcor", "USDC", "usd-coin"], + ["wrap.alcor", "ETH", "ethereum"], + ["eth.token", "WAXUSDC", "usd-coin"], + ["eth.token", "WAXUSDT", "tether"], + ["eth.token", "WAXWBTC", "wrapped-bitcoin"], + ["ibc.wt.eos", "EOS", "eos"], + ["ibc.wt.tlos", "TLOS", "telos"], ]; return await get_account_tvl(accounts, tokens, "wax"); } +// https://alcor.exchange/v/telos +async function telos() { + const accounts = ["swap.alcor", "eostokensdex", "alcorotcswap"]; + const tokens = [ + ["eosio.token", "TLOS", "telos"], + ["wrap.alcor", "USDT", "tether"], + ["wrap.alcor", "USDC", "usd-coin"], + ["wrap.alcor", "ETH", "ethereum"], + ["wrap.alcor", "WAX", "wax"], + ["ibc.wt.eos", "EOS", "eos"], + ]; + return await get_account_tvl(accounts, tokens, "telos"); +} + +// https://alcor.exchange/v/proton +async function proton() { + const accounts = ["swap.alcor", "alcor", "alcorotc"]; + const tokens = [ + ["eosio.token", "XPR", "proton"], + ["xtokens", "XUSDC", "usd-coin"], + ["xtokens", "XUSDT", "tether"], + ["xtokens", "XBTC", "bitcoin"], + ["xtokens", "XETH", "ethereum"], + ["xtokens", "XMT", "metal"], + ["xtokens", "XXRP", "ripple"], + ["xtokens", "XXLM", "stellar"], + ["xtokens", "XPAX", "paxos-standard"], + ["xtokens", "METAL", "metal-blockchain"], + ["xmd.token", "XMD", "metal-dollar"], + ["loan.token", "LOAN", "proton-loan"], + ]; + return await get_account_tvl(accounts, tokens, "proton"); +} + module.exports = { - methodology: `Alcor TVL is achieved by querying token balances from Swap & Limit smart contract(s).`, - eos: { - tvl: eos - }, - wax: { - tvl: wax - }, + methodology: `TVL is the token balances of Alcor's AMM (swap.alcor), orderbook and OTC contracts. Bridged tokens backed 1:1 are priced as their origin asset.`, + eos: { tvl: eos }, + wax: { tvl: wax }, + telos: { tvl: telos }, + proton: { tvl: proton }, } diff --git a/projects/helper/chain/eos.js b/projects/helper/chain/eos.js index a929683cb3c..eb0b23121e1 100644 --- a/projects/helper/chain/eos.js +++ b/projects/helper/chain/eos.js @@ -8,6 +8,7 @@ const RPC_ENDPOINTS = { // 'eos': 'https://eos-mainnet.gateway.tatum.io', 'wax': 'https://wax.greymass.com', 'telos': 'https://telos.greymass.com', + 'proton': 'https://proton.greymass.com', } async function getEosBalance(account_name, chain = "eos") { From f2ee3207fa5748aeb6cb52fe05ee906ddc993446 Mon Sep 17 00:00:00 2001 From: solonlend Date: Tue, 6 Oct 2026 04:09:27 +0900 Subject: [PATCH 089/988] SolonPad: add V3 contracts, staking and pool2 (#21382) Co-authored-by: solonlend Co-authored-by: FelixBruguera --- projects/solonpad-v3/index.js | 36 +++++++++++++++++ projects/solonpad/index.js | 73 ++++++++++++++++++++++++++++------- registries/sumTokens/data3.js | 12 ++++++ 3 files changed, 106 insertions(+), 15 deletions(-) create mode 100644 projects/solonpad-v3/index.js diff --git a/projects/solonpad-v3/index.js b/projects/solonpad-v3/index.js new file mode 100644 index 00000000000..f3121a8658d --- /dev/null +++ b/projects/solonpad-v3/index.js @@ -0,0 +1,36 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const POSITION_MANAGER = '0x6049c9a0e26405C0985f9E3685C87d0aE917f82B' // Uniswap V4 PositionManager on Arc +const STATE_VIEW = '0xF3334192D15450CdD385c8B70e03f9A6bD9E673b' // Uniswap V4 StateView on Arc +const USDC = ADDRESSES.null // native USDC (gas token, 18 decimals) +const V3_LP_LOCKER = '0x09650Be5c4866971aBbD5C9e92AE495A118fD13F' +const V3_DEPLOY_BLOCK = 23985516 +const TRANSFER_TOPIC = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' + +async function tvl(api) { + // The V4 PositionManager has no enumeration, so token ids come from Transfer logs and are re-verified with ownerOf + const transfers = await getLogs2({ + api, target: POSITION_MANAGER, fromBlock: V3_DEPLOY_BLOCK, extraKey: 'solonpad-v3-locker', + eventAbi: 'event Transfer(address indexed from, address indexed to, uint256 indexed id)', + topics: [TRANSFER_TOPIC, null, '0x' + V3_LP_LOCKER.slice(2).toLowerCase().padStart(64, '0')], + }) + const ids = [...new Set(transfers.map(i => i.id.toString()))] + const owners = await api.multiCall({ target: POSITION_MANAGER, abi: 'function ownerOf(uint256) view returns (address)', calls: ids, permitFailure: true }) + const positionIds = ids.filter((_, i) => owners[i]?.toLowerCase() === V3_LP_LOCKER.toLowerCase()) + if (!positionIds.length) return + + // Stock-quoted launches (NVDA.sol, AAPL.sol, TSLA.sol) are not counted here: their backing is counted under solon-stocks + return sumTokens2({ + api, resolveUniV4: true, + uniV4ExtraConfig: { positionIds, nftAddress: POSITION_MANAGER, stateViewer: STATE_VIEW, whitelistedTokens: [USDC] }, + }) +} + +module.exports = { + methodology: 'TVL is the USDC side of the launch positions permanently locked in the V3LPLocker, enumerated from PositionManager Transfer events and re-verified with ownerOf. Launched tokens are not counted. The stock-token side of stock-quoted launches is not counted here, since the stock backing those tokens is counted under Solon Stocks. Marked doublecounted because the locked positions already sit inside Uniswap V4 TVL on Arc.', + doublecounted: true, + start: '2026-10-03', + arc: { tvl }, +} diff --git a/projects/solonpad/index.js b/projects/solonpad/index.js index 240981ff428..dd3799fe0f9 100644 --- a/projects/solonpad/index.js +++ b/projects/solonpad/index.js @@ -7,20 +7,28 @@ const FEE_SPLITTER = '0xd6b05564cea990b69abf10b433279093758e2a54' const POSITION_MANAGER = '0x6049c9a0e26405C0985f9E3685C87d0aE917f82B' // Uniswap V4 PositionManager on Arc const STATE_VIEW = '0xF3334192D15450CdD385c8B70e03f9A6bD9E673b' // Uniswap V4 StateView on Arc const USDC = ADDRESSES.null // native USDC (gas token, 18 decimals) +const SOLON = '0xd36687146385F7Dc84A18FEA3D00319d39D6d1a0' const TRANSFER_TOPIC = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' -async function tvl(api) { - // 1. Quote asset held by live (non-graduated) bonding curves, read as balances. - const launches = await getLogs2({ - api, target: FACTORY, fromBlock: 21134269, - eventAbi: 'event TokenLaunched(address indexed token, address indexed curve, address indexed deployer, address pairToken, uint256 launchConfigId, uint256 graduationThreshold)', - }) - const graduated = await api.multiCall({ abi: 'bool:graduated', calls: launches.map(i => i.curve) }) - const tokensAndOwners = launches.filter((_, i) => !graduated[i]).map(i => [i.pairToken, i.curve]) - await sumTokens2({ api, tokensAndOwners }) +// Solon .sol stock tokens: their backing is counted under solon-stocks +const SOLON_STOCKS = new Set([ + '0x2312290792Cf429605D09A42Fa43dAB810486c18', // NVDA.sol + '0x785415d2994222533E3A0ECa9FE95Cc41623d9cf', // AAPL.sol + '0xAF91A1f046d7ab339b7FF71C0f4D9c166eB1f308', // TSLA.sol +].map(i => i.toLowerCase())) - // 2. USDC side of the permanently locked Uniswap V4 launch positions held by the FeeSplitter. - // The V4 PositionManager has no enumeration, so token ids come from Transfer logs and are re-verified with ownerOf. +const SOLON_STAKING = [ + '0xd20A87639B5a3e86a815627e468072C3a3276172', // SolonStakingV2 + '0xB3E0b89b3Ba098D83072dd60c1946CFB3231688f', // original SOLON staking pool +] + +const positionInfoAbi = 'function getPoolAndPositionInfo(uint256) view returns ((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) poolKey, uint256 info)' + +const isSolonPool = ({ currency0, currency1 }) => [currency0, currency1].some(i => i.toLowerCase() === SOLON.toLowerCase()) + +// Launch positions held by the FeeSplitter, split into the SOLON/USDC pool (pool2) and the other launches (tvl). +// The V4 PositionManager has no enumeration, so token ids come from Transfer logs and are re-verified with ownerOf. +async function feeSplitterPositions(api) { const transfers = await getLogs2({ api, target: POSITION_MANAGER, fromBlock: 21153856, eventAbi: 'event Transfer(address indexed from, address indexed to, uint256 indexed id)', @@ -29,16 +37,51 @@ async function tvl(api) { const ids = [...new Set(transfers.map(i => i.id.toString()))] const owners = await api.multiCall({ target: POSITION_MANAGER, abi: 'function ownerOf(uint256) view returns (address)', calls: ids, permitFailure: true }) const positionIds = ids.filter((_, i) => owners[i]?.toLowerCase() === FEE_SPLITTER) - if (!positionIds.length) return + if (!positionIds.length) return { solon: [], others: [] } + const infos = await api.multiCall({ target: POSITION_MANAGER, abi: positionInfoAbi, calls: positionIds }) + return { + solon: positionIds.filter((_, i) => isSolonPool(infos[i].poolKey)), + others: positionIds.filter((_, i) => !isSolonPool(infos[i].poolKey)), + } +} +function addV4Positions(api, positionIds, whitelistedTokens) { + if (!positionIds.length) return return sumTokens2({ api, resolveUniV4: true, - uniV4ExtraConfig: { positionIds, nftAddress: POSITION_MANAGER, stateViewer: STATE_VIEW, whitelistedTokens: [USDC] }, + uniV4ExtraConfig: { positionIds, nftAddress: POSITION_MANAGER, stateViewer: STATE_VIEW, whitelistedTokens }, }) } +async function tvl(api) { + // 1. Quote asset held by live (non-graduated) bonding curves, read as balances. + const launches = await getLogs2({ + api, target: FACTORY, fromBlock: 21134269, + eventAbi: 'event TokenLaunched(address indexed token, address indexed curve, address indexed deployer, address pairToken, uint256 launchConfigId, uint256 graduationThreshold)', + }) + const graduated = await api.multiCall({ abi: 'bool:graduated', calls: launches.map(i => i.curve) }) + const tokensAndOwners = launches + .filter((i, idx) => !graduated[idx] && !SOLON_STOCKS.has(i.pairToken.toLowerCase())) + .map(i => [i.pairToken, i.curve]) + await sumTokens2({ api, tokensAndOwners }) + + // 2. USDC side of the permanently locked launch positions held by the FeeSplitter (the SOLON/USDC pool is pool2). + const { others } = await feeSplitterPositions(api) + await addV4Positions(api, others, [USDC]) +} + +async function staking(api) { + const staked = await api.multiCall({ abi: 'uint256:totalStaked', calls: SOLON_STAKING }) + staked.forEach(i => api.add(SOLON, i)) +} + +async function pool2(api) { + const { solon } = await feeSplitterPositions(api) + await addV4Positions(api, solon, []) +} + module.exports = { - methodology: 'TVL is the quote asset (native USDC) held by non-graduated bonding curves plus the USDC side of the permanently locked Uniswap V4 launch positions held by the FeeSplitter, enumerated from PositionManager Transfer events and re-verified with ownerOf. Launched tokens and uncollected trading fees are excluded. Marked doublecounted because the locked positions already sit inside Uniswap V4 TVL on Arc.', + methodology: 'TVL is the quote asset (native USDC) held by non-graduated bonding curves plus the USDC side of the permanently locked Uniswap V4 launch positions held by the FeeSplitter, enumerated from PositionManager Transfer events and re-verified with ownerOf. Launched tokens and uncollected trading fees are excluded. Staking is the SOLON staked in SolonStakingV2 and the original SOLON staking pool (principal only). Pool2 is both sides of the protocol-owned, permanently locked SOLON/USDC pool. Marked doublecounted because the locked positions already sit inside Uniswap V4 TVL on Arc.', doublecounted: true, - arc: { tvl }, + arc: { tvl, staking, pool2 }, } diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index bd9f5472e33..f7e0e47f65b 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1033,6 +1033,18 @@ module.exports = { ] }, }, + "solon-stocks": { + "methodology": "TVL is the Robinhood Chain stock tokens (NVDA, AAPL, TSLA) held by the Solon ReserveVault, which backs the .sol stock tokens minted on Arc 1:1. The .sol tokens on Arc are not counted.", + "start": "2026-10-03", + "robinhood": { + "owner": "0x3504aA69ca9C5A5Bc3dA312a6c761e9633251cFc", // ReserveVault + "tokens": [ + "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC", // NVDA + "0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9", // AAPL + "0x322F0929c4625eD5bAd873c95208D54E1c003b2d", // TSLA + ] + }, + }, "zava": { "methodology": "TVL is the AVAX held by the zAVA Mine contract.", "avax": { From 8894d7f7d988774a587127e7c940d57d9d9020c1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 5 Oct 2026 21:46:46 +0200 Subject: [PATCH 090/988] mangrove is dead --- projects/mangrove/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/mangrove/index.js b/projects/mangrove/index.js index ef3223c0848..1651bd6902e 100644 --- a/projects/mangrove/index.js +++ b/projects/mangrove/index.js @@ -59,6 +59,7 @@ module.exports = { methodology: "TVL is calculated by getting the total promised liquidity on the orderbook on a specific block.", start: '2024-02-27', + deadFrom: '2025-02-27', }; for (const chain in mgvReaders) { From f150d7bfb5a6e5e4eb190bd0371341d048ee2983 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 5 Oct 2026 16:40:16 -0400 Subject: [PATCH 091/988] Add Peddlequest (#21408) Co-authored-by: OxForged --- registries/sumTokens/data3.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index f7e0e47f65b..daa441425b8 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1045,6 +1045,26 @@ module.exports = { ] }, }, + "peddlequest": { + "methodology": "Reward pools that quest creators have deposited into the PeddlesQuestEscrow contract and that have not yet been claimed by winners or swept after the claim deadline. Counts the escrow's balance of the chain's gas token and of every allow-listed reward token. On Arc the gas token is USDC, so only the native balance is read.", + "start": "2026-10-02", + "base": { + "owner": "0x16267bE6D067b3d411bf779B5aD041f9eba4CadE", // PeddlesQuestEscrow + "tokens": [ADDRESSES.null, ADDRESSES.base.USDC] + }, + "bsc": { + "owner": "0x16267bE6D067b3d411bf779B5aD041f9eba4CadE", // PeddlesQuestEscrow + "tokens": [ADDRESSES.null, ADDRESSES.bsc.USDT, ADDRESSES.bsc.USDC] + }, + "robinhood": { + "owner": "0x16267bE6D067b3d411bf779B5aD041f9eba4CadE", // PeddlesQuestEscrow + "tokens": [ADDRESSES.null] + }, + "arc": { + "owner": "0x16267bE6D067b3d411bf779B5aD041f9eba4CadE", // PeddlesQuestEscrow + "tokens": [ADDRESSES.null] + } + }, "zava": { "methodology": "TVL is the AVAX held by the zAVA Mine contract.", "avax": { From 52e931bf5080bdb9ba7b6f07e5ad16912e8c4776 Mon Sep 17 00:00:00 2001 From: kpk-giel Date: Tue, 6 Oct 2026 08:25:32 +0100 Subject: [PATCH 092/988] k3: drop the closed NUSD pre-deposit vault (#21416) Co-authored-by: Claude Opus 5.5 --- projects/k3/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/k3/index.js b/projects/k3/index.js index 76546270eb7..cacfacbfd69 100644 --- a/projects/k3/index.js +++ b/projects/k3/index.js @@ -28,7 +28,6 @@ const configs = { "0xb072b2779F1EF1A6A9D2d5fAa1766F341B92aB3a", // Euler Earn: K3 Capital Earn USDT "0x50bd66d59911f5e086ec87ae43c811e0d059dd11", "0xf5503d3d4bd254c2c17690eed523bcb2935db6de", - "0x866C6c6627303Be103814150fC0e886BE5D9ea83", "0xe1B4d34E8754600962Cd944B535180Bd758E6c2e", "0x3b3bDAA4462851621818D2CEBC835E077587147A", "0x8f47D9D9d5A8202a5a37c4E41fbDd3146D88A579", From 4337c6dca30e8b5c74055da6025a166aec303b04 Mon Sep 17 00:00:00 2001 From: kpk-giel Date: Tue, 6 Oct 2026 08:27:53 +0100 Subject: [PATCH 093/988] sentora: stop counting sentUSD twice (#21415) Co-authored-by: Claude Opus 5.5 --- projects/sentora/index.js | 47 ++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/projects/sentora/index.js b/projects/sentora/index.js index faf4f094ba2..4adfc1009af 100644 --- a/projects/sentora/index.js +++ b/projects/sentora/index.js @@ -46,6 +46,16 @@ const nestedMorphoHolders = [ '0x264f0dd8f4183ea93b3c51b9f0e02375f88b8c2c', ] +const ethereumBoringVaults = [ + '0x9761ddf8e79930b334f1be1bd93abe3695061cca', // kraken earn vault + '0x7dee0120739b7ec048b469939efb178adbbb19b2', // kraken earnBTC vault + '0xdbd87325d7b1189dcc9255c4926076ff4a96a271', // boostedUSDC + '0xcaae49fb7f74ccfbe8a05e6104b01c097a78789f', // balancedUSDC + '0x13cc1b39cb259ba10cd174eae42012e698ed7c51', // lombard vault + '0x63d124cf1afc22f0ccea376168200508d2a0868e', // kraken beHolder + '0xf15351a0d66743e09457c45eae88df34fcee8cb7', // kraken beHolder ETH +] + const customConfig = { ethereum: { etherfi: [ @@ -91,15 +101,7 @@ const curatorExport = getCuratorExport({ ], morpho: ethereumMorphoVaults, morphoVaultOwners: ethereumMorphoVaultOwners, - boringVaults: [ - '0x9761ddf8e79930b334f1be1bd93abe3695061cca', // kraken earn vault - '0x7dee0120739b7ec048b469939efb178adbbb19b2', // kraken earnBTC vault - '0xdbd87325d7b1189dcc9255c4926076ff4a96a271', // boostedUSDC - '0xcaae49fb7f74ccfbe8a05e6104b01c097a78789f', // balancedUSDC - '0x13cc1b39cb259ba10cd174eae42012e698ed7c51', // lombard vault - '0x63d124cf1afc22f0ccea376168200508d2a0868e', // kraken beHolder - '0xf15351a0d66743e09457c45eae88df34fcee8cb7', // kraken beHolder ETH - ], + boringVaults: ethereumBoringVaults, }, ink: { boringVaults: [ @@ -180,6 +182,28 @@ async function subtractNestedMorphoShares(api) { api.add(assets, amounts.map(a => -a)) } +// The Veda vaults also hold shares of Sentora's own Upshift vaults (Advanced Strategies USDC holds sentUSD, +// the Upshift USD share token). Those shares sit in the Veda vault's NAV and in the Upshift vault's +// getTotalAssets(), so they are subtracted from the Upshift side, valued at the Upshift share price. +async function subtractNestedUpshiftShares(api) { + const block = await api.getBlock() + const vaults = customConfig.ethereum.upshift.filter(v => block >= v.deployBlock).map(v => v.vault) + if (!vaults.length) return + const holders = [...new Set([...ethereumBoringVaults, ...nestedMorphoHolders].map(a => a.toLowerCase()))] + const [lpTokens, assets, totalAssets] = await Promise.all([ + api.multiCall({ abi: 'address:lpTokenAddress', calls: vaults }), + api.multiCall({ abi: 'address:asset', calls: vaults }), + api.multiCall({ abi: 'uint256:getTotalAssets', calls: vaults }), + ]) + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: lpTokens }) + const pairs = vaults.flatMap((_, i) => holders.map(holder => ({ i, holder }))) + const shares = await api.multiCall({ abi: 'erc20:balanceOf', calls: pairs.map(({ i, holder }) => ({ target: lpTokens[i], params: [holder] })) }) + pairs.forEach(({ i }, k) => { + if (BigInt(shares[k]) === 0n || BigInt(supplies[i]) === 0n) return + api.add(assets[i], -(BigInt(shares[k]) * BigInt(totalAssets[i]) / BigInt(supplies[i]))) + }) +} + module.exports = { timetravel: false, ...curatorExport } for (const chain of Object.keys(customConfig)) { @@ -189,7 +213,10 @@ for (const chain of Object.keys(customConfig)) { tvl: async (api) => { if (curatorChain?.tvl) await curatorChain.tvl(api) await customTvl(api) - if (chain === 'ethereum') await subtractNestedMorphoShares(api) + if (chain === 'ethereum') { + await subtractNestedMorphoShares(api) + await subtractNestedUpshiftShares(api) + } }, } } From 819db2dc4a0c20ec2b238780286cc5eea5ca79b7 Mon Sep 17 00:00:00 2001 From: burhanuddin03 <44511968+burhanuddin03@users.noreply.github.com> Date: Tue, 6 Oct 2026 12:37:53 +0500 Subject: [PATCH 094/988] add monad support in ember (#21409) Co-authored-by: Burhanuddin --- projects/ember-protocol/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/ember-protocol/index.js b/projects/ember-protocol/index.js index da4260222fa..5fc25516890 100644 --- a/projects/ember-protocol/index.js +++ b/projects/ember-protocol/index.js @@ -9,6 +9,7 @@ const SUI_CHAIN_IDENTIFIER = "sui"; const ETHEREUM_CHAIN_IDENTIFIER = "ethereum"; const PHAROS_CHAIN_IDENTIFIER = "pharos"; const BASE_CHAIN_IDENTIFIER = "base"; +const MONAD_CHAIN_IDENTIFIER = "monad"; // there are only one deposit address const blacklistedVaults = [ @@ -64,5 +65,8 @@ module.exports = { }, base: { tvl: (api) => evmTvl(api, BASE_CHAIN_IDENTIFIER), + }, + monad: { + tvl: (api) => evmTvl(api, MONAD_CHAIN_IDENTIFIER), } }; From c7afde0174cf58ab88b4052de89dc343194bc494 Mon Sep 17 00:00:00 2001 From: Vailox <249780885+vailox@users.noreply.github.com> Date: Tue, 6 Oct 2026 10:56:47 +0200 Subject: [PATCH 095/988] Add Vailox TVL (#21398) --- projects/vailox/index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 projects/vailox/index.js diff --git a/projects/vailox/index.js b/projects/vailox/index.js new file mode 100644 index 00000000000..f91207b33ef --- /dev/null +++ b/projects/vailox/index.js @@ -0,0 +1,29 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// Vailox: P2P crypto <-> fiat marketplace. Sellers lock stablecoins in the VailoxEscrow contract until the buyer's fiat +// payment is confirmed. The contract also holds protocol fees from completed trades (feesAvailable) until the owner +// withdraws them; those are not user deposits, so they are subtracted from the escrow balance. +const EVM_ESCROW = '0x8Da513d9B614D0a473eAf294E3e531Cd4EEa9984' // same CREATE2 address on every EVM chain + +const config = { + ethereum: { escrow: EVM_ESCROW, tokens: [ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT] }, + polygon: { escrow: EVM_ESCROW, tokens: [ADDRESSES.polygon.USDC_CIRCLE, ADDRESSES.polygon.USDT] }, + arbitrum: { escrow: EVM_ESCROW, tokens: [ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.USDT] }, + base: { escrow: EVM_ESCROW, tokens: [ADDRESSES.base.USDC] }, + bsc: { escrow: EVM_ESCROW, tokens: [ADDRESSES.bsc.USDC, ADDRESSES.bsc.USDT] }, + tron: { escrow: 'TKTF8R8bak9oN1tDch6CFVyMWSakfRRZLK', tokens: [ADDRESSES.tron.USDT] }, +} + +async function tvl(api) { + const { escrow, tokens } = config[api.chain] + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map((token) => ({ target: token, params: [escrow] })) }) + const fees = await api.multiCall({ abi: 'function feesAvailable(address) view returns (uint256)', calls: tokens.map((token) => ({ target: escrow, params: [token] })) }) + tokens.forEach((token, i) => api.add(token, (BigInt(balances[i]) - BigInt(fees[i])).toString())) +} + +module.exports = { + methodology: 'Stablecoins locked in the VailoxEscrow contract for open P2P trades (seller deposit plus the seller fee held until release). Protocol fees already earned and awaiting withdrawal (feesAvailable) are excluded.', + start: '2025-12-20', +} + +Object.keys(config).forEach((chain) => { module.exports[chain] = { tvl } }) From 283b28382d255ad9511c2cb58bb6332898f6ec24 Mon Sep 17 00:00:00 2001 From: marketingchance Date: Tue, 6 Oct 2026 11:59:14 +0300 Subject: [PATCH 096/988] Add Chance (Robinhood Chain) (#21396) Co-authored-by: marketingchance Co-authored-by: ccipherx --- registries/sumTokens.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index c49d1d18a60..2a5b5aabd5b 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -7145,6 +7145,36 @@ const configs = { ] }, }, + "chance": { + "methodology": "Counts prize deposits and unsettled entry payments escrowed in the Chance InstantWin and MultiWin game contracts (current and previous deployments) on Robinhood Chain. CHANCE, the protocol's own token, posted as prizes is counted under staking.", + "start": "2026-09-24", + "robinhood": { + "tvl": { + "owners": [ + "0xfB9017fd176747Dd7D67dA2CF05E7735543ec5F9", + "0x1cF459104a2E0E5806a2c28722a1Fab4e5585Cc1", + "0x90Ca273088097f6B4b4869D597A74b6d4F7b102f", + "0xE504a0b1AAa95F80221CEEd0eFf44Ba85beAd798" + ], + "tokens": [ + ADDRESSES.robinhood.USDG, + "0x020bfc650a365f8bb26819deaabf3e21291018b4", // CASHCAT + "0x98096d17e191b3da1d5f99a6d7b3584351b11e18" // BONER + ] + }, + "staking": { + "__staking": [ + [ + "0xfB9017fd176747Dd7D67dA2CF05E7735543ec5F9", + "0x1cF459104a2E0E5806a2c28722a1Fab4e5585Cc1", + "0x90Ca273088097f6B4b4869D597A74b6d4F7b102f", + "0xE504a0b1AAa95F80221CEEd0eFf44Ba85beAd798" + ], + "0x500d15e7c0d0e99ac4aae2a40d8738ba1b3167c9" // CHANCE + ] + } + }, + }, "chaotic": { "moonriver": { "owner": "0x78D4664408c06F2BeDc4f108f3Fc8f0AB017a0AE", From bcfec5542590131871ff1f11663e5b4aa9ac4211 Mon Sep 17 00:00:00 2001 From: Lethale Date: Tue, 6 Oct 2026 10:59:16 +0200 Subject: [PATCH 097/988] Add Mog TVL adapter (#21397) Co-authored-by: Lethale <175728510+lethaale@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/mog/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/mog/index.js diff --git a/projects/mog/index.js b/projects/mog/index.js new file mode 100644 index 00000000000..03d137afc22 --- /dev/null +++ b/projects/mog/index.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// MogCore custodies every USDG the venue holds: trader balances, margin in +// escrow and the treasury. Unpaid fee accruals to the buyback and operator payees +// are junior claims paid only from surplus, so they are not netted out. +const MOG_CORE = '0x11C0C0007abeD9eF5dFa3dF1d726B4FD271C52EA' +// operator Safe, recipient of every OpenFeeReleased; no getter on MogCore +const OPERATOR = '0x67F9061efcE4e9BbD12e7De74debBE0896823bc6' + +async function tvl(api) { + const USDG = ADDRESSES.robinhood.USDG + const held = await api.call({ target: USDG, abi: 'erc20:balanceOf', params: [MOG_CORE] }) + const buyback = await api.call({ target: MOG_CORE, abi: 'address:buyback' }) + const fees = await api.multiCall({ target: MOG_CORE, abi: 'function free(address) view returns (uint256)', calls: [OPERATOR, buyback] }) + // free() is 18-decimal wad, USDG has 6 decimals + const paidFees = fees.reduce((sum, f) => sum + BigInt(f), 0n) / 10n ** 12n + api.add(USDG, BigInt(held) - paidFees) +} + +module.exports = { + methodology: + 'TVL is the USDG held by the MogCore contract: trader balances, trader margin in escrow, ' + + 'and the venue treasury. Fees already paid out to the operator and buyback wallets but not yet withdrawn are excluded. MOG tokens are not counted.', + start: '2026-09-19', // MogCore deployed 2026-09-18 11:46 UTC + robinhood: { tvl }, +} From 82c4ab0ecbc2084ae6f5a6e6dec63ee18be9d6d4 Mon Sep 17 00:00:00 2001 From: Cynan Rhodes Date: Tue, 6 Oct 2026 11:31:21 +0200 Subject: [PATCH 098/988] Add GVNR Diamond Hands TVL adapter (#21402) Co-authored-by: Claude Opus 5.5 --- projects/diamond-hands/index.js | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 projects/diamond-hands/index.js diff --git a/projects/diamond-hands/index.js b/projects/diamond-hands/index.js new file mode 100644 index 00000000000..232b653043b --- /dev/null +++ b/projects/diamond-hands/index.js @@ -0,0 +1,50 @@ +const sdk = require('@defillama/sdk') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens } = require('../helper/chain/bitcoin') + +// Diamond Hands: BTC-collateralised loans that mint the UCD stablecoin on Ethereum. +// Each loan's BTC sits in its own native Bitcoin vault address, recorded on-chain in the +// PositionManager core module. USDC deposited into the UCD Peg Stability Module is held on Ethereum. +const POSITION_MANAGER = '0x12A1836e56139ccaD8722B89519d84233efc224B' +const PSM = '0xfE0C14B4E614f40Bf58845b4B04CeD17fd116532' + +const PAGE_SIZE = 200 +// LoanStatus enum: LIQUIDATED = 5. A liquidated vault no longer holds loan collateral. +const LIQUIDATED = 5 + +const abi = { + core: 'address:core', + getTotalPositions: 'uint256:getTotalPositions', + getPositionIds: 'function getPositionIds(uint256 offset, uint256 limit) view returns (bytes32[])', + getPositionStatus: 'function getPositionStatus(bytes32 positionId) view returns (uint8)', + getVaultAddress: 'function getVaultAddress(bytes32 positionId) view returns (string)', +} + +async function getVaultAddresses() { + const api = new sdk.ChainApi({ chain: 'ethereum' }) + const core = await api.call({ target: POSITION_MANAGER, abi: abi.core }) + const total = Number(await api.call({ target: core, abi: abi.getTotalPositions })) + + const ids = [] + for (let offset = 0; offset < total; offset += PAGE_SIZE) + ids.push(...await api.call({ target: core, abi: abi.getPositionIds, params: [offset, PAGE_SIZE] })) + + const statuses = await api.multiCall({ target: core, abi: abi.getPositionStatus, calls: ids }) + const openIds = ids.filter((_, i) => Number(statuses[i]) !== LIQUIDATED) + return api.multiCall({ target: core, abi: abi.getVaultAddress, calls: openIds }) +} + +async function bitcoinTvl() { + return sumTokens({ owners: await getVaultAddresses() }) +} + +async function ethereumTvl(api) { + return api.sumTokens({ owner: PSM, tokens: [ADDRESSES.ethereum.USDC] }) +} + +module.exports = { + timetravel: false, + methodology: 'BTC TVL is the balance of the native Bitcoin vault of every position that has not been liquidated, including positions still pending deposit, with vault addresses read from the Diamond Hands PositionManager on Ethereum. Ethereum TVL is the USDC held by the UCD Peg Stability Module, most of it deposited by the protocol. Minted UCD is not counted.', + bitcoin: { tvl: bitcoinTvl }, + ethereum: { tvl: ethereumTvl }, +} From 98184824592608aa721484d6b80a7a9559423bff Mon Sep 17 00:00:00 2001 From: Dani Date: Tue, 6 Oct 2026 11:40:17 +0200 Subject: [PATCH 099/988] Add Titan Locker (Robinhood Chain) (#21423) Co-authored-by: phineaseth --- projects/titan-locker/index.js | 106 +++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 projects/titan-locker/index.js diff --git a/projects/titan-locker/index.js b/projects/titan-locker/index.js new file mode 100644 index 00000000000..042bc6deddd --- /dev/null +++ b/projects/titan-locker/index.js @@ -0,0 +1,106 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, unwrapUniswapV4NFTs } = require('../helper/unwrapLPs') + +/* Titan Locker, a token, LP, Uniswap V3/V4 position and vesting locker on + * Robinhood Chain. + * + * Every lock is its own contract, created by a manager. TVL is the core-asset + * side of what those lock contracts hold right now: ERC-20 and Uniswap V2 LP + * balances read with balanceOf, and each lock's recorded Uniswap V3 or V4 + * position while the lock still owns it. A withdrawn lock holds nothing, so it + * stops counting on its own. + * + * Lock ids run 0..tokenLockerCount-1 (the managers post-increment from 0). + */ + +const LOCK_DATA_V1 = + 'function getTokenLockData(uint40) view returns (bool isLpToken, uint40 id, address contractAddress, address lockOwner, address token, address createdBy, uint40 createdAt, uint40 unlockTime, uint256 balance, uint256 totalSupply)' +const LOCK_DATA_V2 = + 'function getTokenLockData(uint40) view returns (uint8 kind, uint40 id, address contractAddress, address lockOwner, address asset, uint256 tokenId, address createdBy, uint40 createdAt, uint40 unlockTime, uint256 balance)' + +// LockKind in ITitanLockerManagerV2: ERC20, UNIV3, UNIV4, ERC20_VESTING +const UNIV3 = 1 +const UNIV4 = 2 + +// any other leg is the locking team's own token +const QUOTE_TOKENS = new Set( + [ADDRESSES.null, ADDRESSES.robinhood.WETH, ADDRESSES.robinhood.USDG, ADDRESSES.robinhood.USDe].map((t) => t.toLowerCase()) +) + +const config = { + robinhood: { + v1: ['0x713E56CeE7060F01F710bF26Aff988264dcfb311'], + v2: [ + '0x26b0654a0756dcd036d4e7215324f3d2be34d79e', // V2 + '0x102a70bDA2C833b3483A2eE55C14c7ea0fb7A01B', // V2.1 + '0x4E907349FA31f9e42F0bf0E2E2fd09e6E1E2dB9d', // V2.1 vault (Titan.fun launch locks) + ], + }, +} + +async function readLocks(api, managers, abi) { + if (!managers.length) return [] + const counts = await api.multiCall({ abi: 'function tokenLockerCount() view returns (uint40)', calls: managers }) + const calls = managers.flatMap((target, i) => Array.from({ length: Number(counts[i]) }, (_, id) => ({ target, params: [id] }))) + // A lock record reads its token's balanceOf live, so a token whose balanceOf reverts fails only its + // own record. Skip that record rather than fail the whole adapter. + const locks = await api.multiCall({ abi, calls, permitFailure: true }) + return locks.filter(Boolean) +} + +// A position id outlives its lock, and a lock's owner can rescue stray NFTs sent to it, so count only +// each lock's recorded position, and only while the lock still owns it. +async function lockedPositionIds(api, nftAddress, positions) { + const owners = await api.multiCall({ + abi: 'function ownerOf(uint256) view returns (address)', + calls: positions.map((p) => ({ target: nftAddress, params: [p.id] })), + permitFailure: true, + }) + return positions.filter((p, i) => owners[i]?.toLowerCase() === p.lock.toLowerCase()).map((p) => p.id) +} + +async function tvl(api) { + const { v1 = [], v2 = [] } = config[api.chain] + const ownerTokens = [] + const v3Positions = {} // position manager -> [{ id, lock }] + const v4Positions = {} + + for (const lock of await readLocks(api, v1, LOCK_DATA_V1)) ownerTokens.push([[lock.token], lock.contractAddress]) + + for (const lock of await readLocks(api, v2, LOCK_DATA_V2)) { + const kind = Number(lock.kind) + const position = { id: lock.tokenId, lock: lock.contractAddress } + if (kind === UNIV3) (v3Positions[lock.asset] ??= []).push(position) + else if (kind === UNIV4) (v4Positions[lock.asset] ??= []).push(position) + else ownerTokens.push([[lock.asset], lock.contractAddress]) + } + + await sumTokens2({ api, ownerTokens, resolveLP: true }) + + for (const [nftAddress, positions] of Object.entries(v3Positions)) { + const positionIds = await lockedPositionIds(api, nftAddress, positions) + if (positionIds.length) await sumTokens2({ api, resolveUniV3: true, uniV3ExtraConfig: { nftAddress, positionIds } }) + } + + for (const [nftAddress, positions] of Object.entries(v4Positions)) { + const positionIds = await lockedPositionIds(api, nftAddress, positions) + // unwrapUniswapV4NFTs returns its own balances object rather than adding to api, so add it in. + if (positionIds.length) api.addBalances(await unwrapUniswapV4NFTs({ api, nftAddress, uniV4ExtraConfig: { positionIds } })) + } + + for (const key of Object.keys(api.getBalances())) { + if (!QUOTE_TOKENS.has(key.split(':').pop().toLowerCase())) api.removeTokenBalance(key) + } +} + +module.exports = { + methodology: + 'Counts the assets held by every Titan Locker lock contract on Robinhood Chain. Each lock is its own ' + + 'contract created by a Titan Locker manager; lock records are read on chain to find each lock contract and its asset. ' + + 'ERC-20 and Uniswap V2 LP balances are read with balanceOf (LP tokens are unwrapped into their underlying tokens), ' + + 'and each lock\'s recorded Uniswap V3 or V4 position is valued from its liquidity while the lock still owns it. ' + + 'Only the ETH, WETH, USDG and USDe side is counted; locked project tokens and the project-token legs of LP positions are excluded. ' + + 'Withdrawn locks hold nothing and stop counting automatically.', + doublecounted: true, + robinhood: { tvl }, +} From 88b0e32fe9505759832a4211791cb93722f9a2f9 Mon Sep 17 00:00:00 2001 From: Scoutr <172737623+0xScoutr@users.noreply.github.com> Date: Tue, 6 Oct 2026 06:46:53 -0300 Subject: [PATCH 100/988] add BitSafe CBTC (#21407) Co-authored-by: Scoutr <0xScoutr@users.noreply.github.com> Co-authored-by: ccipherx --- projects/helper/bitcoin-book/fetchers.js | 20 ++++++++++++++++++++ registries/bitcoin.js | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/projects/helper/bitcoin-book/fetchers.js b/projects/helper/bitcoin-book/fetchers.js index ff29e5a937e..f580f6de7a5 100644 --- a/projects/helper/bitcoin-book/fetchers.js +++ b/projects/helper/bitcoin-book/fetchers.js @@ -417,4 +417,24 @@ module.exports = { ) return reserveAddresses.map(r => r.address).filter(Boolean) }, + bitsafeCBTC: async () => { + // BitSafe publishes the CBTC (Canton) reserve addresses through its public API. Balances are NOT read + // from that API: the addresses are only enumerated here and their BTC is read from the Bitcoin chain. + const API_URL = 'https://api.mainnet.bitsafe.finance/cbtc/v1/address-calculation-data' + const owners = await getConfig('bitsafe/cbtc-reserve-addresses', undefined, { + fetcher: async () => { + const data = await get(API_URL) + if (data?.status !== 'ready' || data.bitcoin_network !== 'bitcoin') + throw new Error('bitsafe cbtc: address feed is not ready for bitcoin mainnet') + const chain = (data.chains ?? []).find(c => c.chain === 'canton-mainnet') + const addresses = (chain?.addresses ?? []).map(a => a.address_for_verification) + if (!addresses.length) throw new Error('bitsafe cbtc: feed returned no reserve addresses') + // a partial reserve list would understate TVL, so one bad entry fails the whole fetch + if (!addresses.every(isValidBitcoinAddress)) throw new Error('bitsafe cbtc: feed returned an invalid bitcoin address') + return [...new Set(addresses)] + } + }) + if (!Array.isArray(owners) || !owners.length) throw new Error('bitsafe cbtc: no reserve addresses available') + return owners + }, } diff --git a/registries/bitcoin.js b/registries/bitcoin.js index eacb32778aa..3fc5b67db34 100644 --- a/registries/bitcoin.js +++ b/registries/bitcoin.js @@ -36,6 +36,10 @@ const configs = { bitcoin: 'bitgetBtc', methodology: "bgBTC, BitGet Wrapped Bitcoin", }, + "bitsafe-cbtc": { + bitcoin: 'bitsafeCBTC', + methodology: "TVL is the BTC held in the CBTC reserve addresses that BitSafe publishes through its public address API, read from the Bitcoin blockchain at run time. CBTC is BitSafe's Bitcoin-backed token on the Canton Network.", + }, "btnx": { bitcoin: 'btnx', timetravel: false, From 367f81e6a5155da8af6dbec2ed7b942bf3eebb12 Mon Sep 17 00:00:00 2001 From: bruno <52743786+Bruno12221@users.noreply.github.com> Date: Tue, 6 Oct 2026 12:48:15 +0200 Subject: [PATCH 101/988] Add Statics Protocol TVL adapter (#21420) --- projects/statics/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/statics/index.js diff --git a/projects/statics/index.js b/projects/statics/index.js new file mode 100644 index 00000000000..f3f832c039e --- /dev/null +++ b/projects/statics/index.js @@ -0,0 +1,28 @@ +const { addUniV4PoolReserves } = require('../helper/uniswapV4') + +const STATICS = '0x2d8d6F4A93AcD7a916A5a654ec8b690bA3B3EAdd' +const WETH = '0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73' +const GENESIS_VAULT = '0x8AAAF9a22f439589987B8f1e69d79ca4f648C297' +const STATE_VIEW = '0xF3334192D15450CdD385c8B70E03f9a6Bd9E673b' + +const CANONICAL_POOL = { + id: '0xe79228d6cae086a58bf5b22220b454e5d1ca4f13da767ea5bbe032d5a1e82e8a', + token0: WETH, + token1: STATICS, + spacing: 100, +} + +async function tvl(api) { + const reserveETH = await api.call({ target: GENESIS_VAULT, abi: 'uint256:reserveETH' }) + + await addUniV4PoolReserves({ api, pools: [CANONICAL_POOL], stateView: STATE_VIEW }) + api.removeTokenBalance(STATICS) + api.addGasToken(reserveETH) +} + +module.exports = { + methodology: 'TVL is the WETH side of the permanent canonical STATICS/WETH Uniswap v4 market plus the native ETH reserve backing circulating Statics Operators. The STATICS side of the market and STATICS Operator backing are excluded as protocol-owned token value. The pool liquidity is also counted by the Uniswap v4 adapter.', + doublecounted: true, + start: 1787875200, + robinhood: { tvl }, +} From e877e64070d6c33fa8babb8faf2db3a85aff59c7 Mon Sep 17 00:00:00 2001 From: hattonjey-256 Date: Tue, 6 Oct 2026 09:07:47 -0400 Subject: [PATCH 102/988] Fix FAZE TVL to include own-pool quote reserves (#21418) --- projects/faze/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/faze/index.js b/projects/faze/index.js index 5d456ba736b..29acdfa8df2 100644 --- a/projects/faze/index.js +++ b/projects/faze/index.js @@ -37,9 +37,9 @@ async function tvl(api) { const pools = await discover(HOOK, ABI.PoolRegistered, 'pools') const compounds = await discover(HOOK, ABI.Compounded, 'compounds') const coins = launches.length ? await api.multiCall({ target: CURVE, abi: ABI.getCoin, calls: launches.map(l => l.token) }) : [] - const isCore = (asset, quote) => asset.toLowerCase() !== FAZE && quote.toLowerCase() !== FAZE + const isCoreQuote = (quote) => quote.toLowerCase() !== FAZE launches.forEach((l, i) => { - if (isCore(l.token, l.terms.quoteToken)) api.add(l.terms.quoteToken, coins[i].ethReserve) + if (isCoreQuote(l.terms.quoteToken)) api.add(l.terms.quoteToken, coins[i].ethReserve) }) if (!pools.length) return @@ -58,7 +58,7 @@ async function tvl(api) { const byId = new Map(pools.map((p, i) => [p.poolId, { asset: p.asset, quote: p.quote, price: BigInt(prices[i][0]) }])) function addPosition(p, liquidity, lo, hi) { if (!p) throw new Error('FAZE compounding position without registered pool') - if (isCore(p.asset, p.quote)) api.add(p.quote, quoteAmount(BigInt(liquidity), p.price, lo, hi, BigInt(p.quote) < BigInt(p.asset)).toString()) + if (isCoreQuote(p.quote)) api.add(p.quote, quoteAmount(BigInt(liquidity), p.price, lo, hi, BigInt(p.quote) < BigInt(p.asset)).toString()) } pools.forEach((p, i) => addPosition(byId.get(p.poolId), positions[i][0], -887200, 887200)) bands.forEach((b, i) => addPosition(byId.get(b.poolId), positions[pools.length + i][0], Number(b.tickLower), Number(b.tickUpper))) @@ -67,6 +67,6 @@ async function tvl(api) { module.exports = { start: '2026-09-13', doublecounted: true, - methodology: 'Real quote reserves on FAZE bonding curves plus the quote side of permanently locked graduation and compounding positions. Excludes virtual reserves, unclaimed fees, minted launch-token inventory, FAZE-denominated quote assets and FAZE own-token pools. Locked positions overlap Uniswap v4 TVL.', + methodology: 'Real quote reserves on FAZE bonding curves plus the quote side of permanently locked graduation and compounding positions. Excludes virtual reserves, unclaimed fees, minted launch-token inventory and FAZE-denominated quote assets. Includes eligible quote reserves in FAZE own-token pools. Locked positions overlap Uniswap v4 TVL.', arc: { tvl }, } From 7aa347a724c069f93a1f67b801815da17dbff1b7 Mon Sep 17 00:00:00 2001 From: bheluga Date: Tue, 6 Oct 2026 19:02:21 +0530 Subject: [PATCH 103/988] fix uni tvl on xlayer (#21431) --- projects/helper/coreAssets.json | 28 +++++++++++++++++++++++++++- projects/uniswap-v4/index.js | 8 +++++--- projects/uniswap/index.js | 6 +++++- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index ea8f703a599..95745a007df 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1959,7 +1959,33 @@ "WETH": "0x5A77f1443D16ee5761d310e38b62f77f726bC71c", "USDT": "0x1E4a5963aBFD975d8c9021ce480b42188849D41d", "USDC": "0x74b7f16337b8972027f6196a17a631ac6de26d22", - "USDT0": "0x779ded0c9e1022225f8e0630b35a9b54be713736" + "USDT0": "0x779ded0c9e1022225f8e0630b35a9b54be713736", + "wQQQx": "0x4c1ae29c159838fc1b224636e28e086eb69101f7", + "wSPCXx": "0x8e2eed8b8b5e13ea7bf38e50d7821d2c57309072", + "wSPYx": "0xe7e553cd128f0011777323a0b44a7b96ea1cb540", + "wNVDAx": "0xa8ddb5cd96b5222afe198316e9a57caa642850d5", + "wTSLAx": "0xc3fdbe3a68ee5de461d30415a8165cf9aefe1171", + "wGOOGLx": "0xf8c5308f80e459bb53d9ebe689854d9cbb2caa6f", + "wAAPLx": "0x943bf64d566c32a2bcd41ac92fb63c111cc9de8f", + "wCRCLx": "0xb11134f14d5b94db60d4599dfdc3bf1bba2150e8", + "wXIAOx": "0x076cf393e701839fc7a5832d2c68aafa235682ae", + "wPOPMTx": "0x4ebf5fd25b02022afad96e2fa25da54a246fded0", + "wGMEx": "0x459d3ae62b86cc6125e06260dddfd3afed24a877", + "wMETAx": "0xe840946ffebcd66b7c4e95095effafadfa0d0e56", + "wTCENTx": "0x41333df9e7639188bbfca5522dc4844398af9f9e", + "wDELLx": "0x04db4384013664baa627c1a3fa4ff0c50f37cfd3", + "wORCLx": "0x1349456830ddc3d8599e4d6a63698883eca67ada", + "wCOINx": "0x44c7ed7ffdf8465c9d27f60aec845eed3d49d56e", + "wAMZNx": "0x910cabde3eba7fc1ce64fd14bd680b9f60fa0f90", + "wHOODx": "0x59801175a9b2248f9bf4ba7f82e17045c4672ec8", + "wINTCx": "0x33aa35b0271fffe2048cc093ab7fe60931786719", + "wMEITx": "0xad1b65c8556957cf23d1b5e9accdc449b415fa97", + "wBMNRx": "0xdad5623b32c81aeaa75478fcfe934e9e97018c58", + "wSNDKx": "0x75e82e2884ea10f72fca777449b73377f4646219", + "wMUx": "0xe2047ee3bddb5c99ae428ab83df63f8730698e30", + "wIWMx": "0x25d218f19b706c8680aa26fb64e676cf84b58f65", + "wSKHYx": "0x6215a58ed045d71f2561aaabe54f4c885c522998", + "wMSFTx": "0x166fbe68274b6a47e025f4ba17388c539f1fa1d0" }, "genesys": { "WGSYS": "0xAa7aE83eb30DDdd14A017D4222121776317EA8Ba" diff --git a/projects/uniswap-v4/index.js b/projects/uniswap-v4/index.js index c3642b14e42..66f6a54e182 100644 --- a/projects/uniswap-v4/index.js +++ b/projects/uniswap-v4/index.js @@ -54,7 +54,8 @@ const config = { arc: { factory: "0x8366a39cc670b4001a1121b8f6a443a643e40951", fromBlock: 1946500 }, } const subgraphs = { - xlayer: {endpoint: '2fc6nFafrPs4xybzHMnmD48qgUYoHTizhDk1mCJJUDjD', factory: '0x360E68faCcca8cA495c1B759Fd9EEe466db9FB32' } + // the xlayer subgraph has no price for xStocks, so their pools read $0 TVL there and the $100 filter drops them + xlayer: {endpoint: '2fc6nFafrPs4xybzHMnmD48qgUYoHTizhDk1mCJJUDjD', factory: '0x360E68faCcca8cA495c1B759Fd9EEe466db9FB32', noTvlFilter: true } } // On Arc, USDC is the gas token and the ERC-20 at 0x3600... reads the same balance as the native coin. @@ -82,13 +83,14 @@ function processResult(api, results, factory, blacklistedTokens = []) { } Object.keys(subgraphs).forEach(chain => { - const { endpoint, factory } = subgraphs[chain] + const { endpoint, factory, noTvlFilter } = subgraphs[chain] module.exports[chain] = { tvl: async (api) => { if (!getEnv('IS_RUN_FROM_CUSTOM_JOB')) throw new Error('This job is not meant to be run directly, please use the custom job feature') + const tvlFilter = noTvlFilter ? '' : 'totalValueLockedUSD_gt: 100' const query = ` query poolQuery($lastId: String, $block: Int) { - pools(block: { number: $block} first: 1000 where: {id_gt: $lastId totalValueLockedUSD_gt: 100} subgraphError: allow) { + pools(block: { number: $block} first: 1000 where: {id_gt: $lastId ${tvlFilter}} subgraphError: allow) { id token0 { id diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 3bdfcec800f..bc98c8dae83 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -23,13 +23,17 @@ const blacklists = { polygon: ['0x8d52c2d70a7c28a9daac2ff12ad9bfbf041cd318', '0x1f98431c8ad98523631ae4a59f267346ea31f984', '0xd5302a8ead77b85ea3326b45f4714e0b3432b233', '0xc951ab482ff11d8df636742e1f1c3fc8037427a9', '0xbF7970D56a150cD0b60BD08388A4A75a27777777'], } +// the xlayer subgraph has no price for xStocks or xBTC, so their pools read $0 TVL there and the $100 filter drops them +const noTvlFilterChains = ['xlayer'] + function v3TvlPaged(chain) { return async (api) => { const block = await api.getBlock() + const tvlFilter = noTvlFilterChains.includes(chain) ? '' : 'totalValueLockedUSD_gt: 100' let graphQueryPaged = ` query poolQuery($lastId: String, $block: Int) { - pools(block: { number: $block } first:1000 where: {id_gt: $lastId totalValueLockedUSD_gt: 100} subgraphError: allow) { + pools(block: { number: $block } first:1000 where: {id_gt: $lastId ${tvlFilter}} subgraphError: allow) { id token0 { id } token1 { id } From b8218e1acbfd1d4424dd0713739a27e80c7372e7 Mon Sep 17 00:00:00 2001 From: kpk-giel Date: Tue, 6 Oct 2026 15:31:34 +0100 Subject: [PATCH 104/988] kpk: track XAUt Carry, WBTC Carry and the Robinhood Chain OIVs, drop empty chains (#21406) Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/helper/debank.js | 1 + projects/kpk/index.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/projects/helper/debank.js b/projects/helper/debank.js index 42e2f650844..40c329606b9 100644 --- a/projects/helper/debank.js +++ b/projects/helper/debank.js @@ -17,6 +17,7 @@ const debankToLlamaChain = { frax: 'fraxtal', mnt: 'mantle', gno: 'xdai', + hood: 'robinhood', } function getLlamaChain(debankChain) { diff --git a/projects/kpk/index.js b/projects/kpk/index.js index 185f950c041..dc799cc195c 100644 --- a/projects/kpk/index.js +++ b/projects/kpk/index.js @@ -7,6 +7,11 @@ const { dydxLiveTvl, dydxHistoricalTvl } = require("./dydx") const DEFILLAMA_COMPRESSOR_V310 = "0x81cb9eA2d59414Ab13ec0567EFB09767Ddbe897a" const ETH_ALPHA_SAFE = "0x99b9F5F24205Cb88E33b1CC72008f644Fc23768b" // ETH Alpha Fund Portfolio Safe const USD_ALPHA_SAFE = "0x38F6a1B46144fAEe6a6D9F79D8dE264C18e23848" // USD Alpha Fund Portfolio Safe +const XAUT_CARRY_SAFE = "0x67269455871526A052cA89329218a41e810Ecc15" // XAUt Carry Fund Portfolio Safe +const WBTC_CARRY_SAFE = "0x0295E5d0530C23E560CdbFc097C488a0A0D7752D" // WBTC Carry Fund Portfolio Safe +const RH_USD_SAFE = "0x01F18eadd996e41235A9155Ec9aF5878c6ED6294" // kpk Robinhood USD Portfolio Safe (Robinhood Chain) +const RH_SPY_SAFE = "0xe2548934197AbE73F97326302A0900302fCb34d1" // kpk Robinhood SPY Portfolio Safe (Robinhood Chain) +const RH_ETH_USD_SAFE = "0x2EeB414D0bc548094a574E6801f5365498D28aa4" // kpk Robinhood ETH-USD Portfolio Safe (Robinhood Chain) const GearboxCompressorABI = { // returns credit managers associated with the given legacy (market) configurators @@ -166,8 +171,8 @@ async function getAlephVaultTvl(api, vaults) { } // ---- kpk Fund (OIV) TVL via DeBank ---- -const OIV_SAFES = [ETH_ALPHA_SAFE, USD_ALPHA_SAFE] -const OIV_CHAINS = ['ethereum', 'arbitrum', 'base', 'xdai', 'optimism'] +const OIV_SAFES = [ETH_ALPHA_SAFE, USD_ALPHA_SAFE, XAUT_CARRY_SAFE, WBTC_CARRY_SAFE, RH_USD_SAFE, RH_SPY_SAFE, RH_ETH_USD_SAFE] +const OIV_CHAINS = ['ethereum', 'arbitrum', 'base', 'xdai', 'robinhood'] // ---- Zodiac-managed Safes (Institutional vertical) TVL via DeBank ---- // Safes owned by external institutions but actively managed by kpk via Zodiac Roles Modifier. @@ -182,7 +187,7 @@ const ZODIAC_MANAGED_SAFES = [ '0xe7f2C930d6c64B91b96cd46C2933885765810A8E', // dYdX wallet (eth/arb) '0xd97eCe4a24C4538d96E14296c5544c871caE2eEB', // dYdX wallet (eth) - USDY + kpk USDC Prime Core V2 ] -const ZODIAC_CHAINS = ['ethereum', 'arbitrum', 'base', 'xdai', 'optimism', 'bsc', 'polygon', 'avax'] +const ZODIAC_CHAINS = ['ethereum', 'arbitrum', 'base', 'xdai', 'bsc'] // ---- Historical Zodiac mandate TVL from the kpk treasury IR cache ---- // @@ -286,4 +291,8 @@ exportObjects.dydx = { tvl: async (api) => isHistoricalRun(api) ? dydxHistoricalTvl(api) : dydxLiveTvl(api), } +// no longer swept, kept so their history stays in the API +for (const chain of ['optimism', 'polygon', 'avax']) + exportObjects[chain] = { tvl: () => ({}) } + module.exports = exportObjects From e3cf13d48513e7ee0c7de03108cf18c5e784d14d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Tue, 6 Oct 2026 20:13:39 +0530 Subject: [PATCH 105/988] moonwell: $9.5M of the 2026-08-27 exploiter's debt is counted in Base borrowed (#21379) --- projects/helper/compound.js | 15 ++++++++++----- registries/compound.js | 4 +++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/projects/helper/compound.js b/projects/helper/compound.js index ee4e9992a6f..93fbaba3226 100644 --- a/projects/helper/compound.js +++ b/projects/helper/compound.js @@ -26,7 +26,7 @@ async function getMarkets(comptroller, api, cether, cetheEquivalent = nullAddres return markets; } -function _getCompoundV2Tvl(comptroller, cether, cetheEquivalent, borrowed = false, { blacklistedTokens = [], abis = {}, blacklistedMarkets = [], isInsolvent = false, markets: staticMarkets } = {}) { +function _getCompoundV2Tvl(comptroller, cether, cetheEquivalent, borrowed = false, { blacklistedTokens = [], abis = {}, blacklistedMarkets = [], isInsolvent = false, markets: staticMarkets, excludedBorrowers = [] } = {}) { abis = { ...abi, ...abis } if (borrowed && isInsolvent) return async () => ({}) @@ -39,6 +39,11 @@ function _getCompoundV2Tvl(comptroller, cether, cetheEquivalent, borrowed = fals return sumTokens2({ api, tokensAndOwners2: [tokens, cTokens], blacklistedTokens, resolveLP: true, }) let v2Locked = await api.multiCall({ calls: cTokens, abi: borrowed ? abis.totalBorrows : abis.getCash, }) + // debt of accounts that will never repay (exploiters) is not live borrowing, take it back out + for (const account of excludedBorrowers) { + const debts = await api.multiCall({ calls: cTokens.map(target => ({ target, params: [account] })), abi: 'function borrowBalanceStored(address) view returns (uint256)', permitFailure: true }) + v2Locked = v2Locked.map((v, i) => BigInt(v) - BigInt(debts[i] ?? 0)).map(v => (v > 0n ? v : 0n).toString()) + } api.add(tokens, v2Locked) blacklistedTokens.forEach(token => api.removeTokenBalance(token)) @@ -47,15 +52,15 @@ function _getCompoundV2Tvl(comptroller, cether, cetheEquivalent, borrowed = fals } } -function compoundExports(comptroller, cether, cetheEquivalent = nullAddress, { blacklistedTokens = [], abis = {}, blacklistedMarkets = [], isInsolvent = false, markets } = {}) { +function compoundExports(comptroller, cether, cetheEquivalent = nullAddress, { blacklistedTokens = [], abis = {}, blacklistedMarkets = [], isInsolvent = false, markets, excludedBorrowers = [] } = {}) { return { tvl: _getCompoundV2Tvl(comptroller, cether, cetheEquivalent, false, { blacklistedTokens, abis, blacklistedMarkets, markets, }), - borrowed: _getCompoundV2Tvl(comptroller, cether, cetheEquivalent, true, { blacklistedTokens, abis, blacklistedMarkets, isInsolvent, markets }) + borrowed: _getCompoundV2Tvl(comptroller, cether, cetheEquivalent, true, { blacklistedTokens, abis, blacklistedMarkets, isInsolvent, markets, excludedBorrowers }) } } -function compoundExports2({ comptroller, cether, cetheEquivalent = nullAddress, blacklistedTokens = [], abis = {}, blacklistedMarkets = [], isInsolvent = false, markets }) { - return compoundExports(comptroller, cether, cetheEquivalent, { blacklistedTokens, abis, blacklistedMarkets, isInsolvent, markets }) +function compoundExports2({ comptroller, cether, cetheEquivalent = nullAddress, blacklistedTokens = [], abis = {}, blacklistedMarkets = [], isInsolvent = false, markets, excludedBorrowers = [] }) { + return compoundExports(comptroller, cether, cetheEquivalent, { blacklistedTokens, abis, blacklistedMarkets, isInsolvent, markets, excludedBorrowers }) } module.exports = { diff --git a/registries/compound.js b/registries/compound.js index b9d112b90fa..8054405652d 100644 --- a/registries/compound.js +++ b/registries/compound.js @@ -472,7 +472,7 @@ const configs = { base: { comptroller: '0x1DB2466d9F5e10D7090E7152B68d62703a2245F0' }, }, 'moonwell': { - hallmarks: [['2022-08-01', 'Nomad Bridge Exploit']], + hallmarks: [['2022-08-01', 'Nomad Bridge Exploit'], ['2026-08-27', 'MAMO oracle exploit on Base']], moonbeam: { comptroller: '0x8E00D5e02E65A19337Cdba98bbA9F84d4186a180', cether: '0x091608f4e4a15335145be0a279483c0f8e4c7955', @@ -481,6 +481,8 @@ const configs = { base: { comptroller: '0xfBb21d0380beE3312B33c4353c8936a0F13EF26C', staking: ['0xe66E3A37C3274Ac24FE8590f7D84A2427194DC17', '0xa88594d404727625a9437c3f886c7643872296ae'], + // 2026-08-27 MAMO oracle exploiter, ~$9.5M of debt against worthless mMAMO collateral + excludedBorrowers: ['0x719eae70d4a83f35bf82a2740699f5db84be919d'], }, optimism: { comptroller: '0xCa889f40aae37FFf165BccF69aeF1E82b5C511B9' }, ethereum: { comptroller: '0xdec80bB934397575594E91970b37baf65f5b21bE' }, From afa0607ceb2bb509bc3db20368d36f26de003a76 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 6 Oct 2026 16:17:47 +0100 Subject: [PATCH 106/988] jup lend ethena (#21434) --- projects/jupiter-lend/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/jupiter-lend/index.js b/projects/jupiter-lend/index.js index 93411b9154f..d6cdd9e76b1 100644 --- a/projects/jupiter-lend/index.js +++ b/projects/jupiter-lend/index.js @@ -26,6 +26,7 @@ const EXCHANGE_PRICE_PRECISION = 1e12 // these deposits are already counted in ethena's TVL const ETHENA_ATOKEN_ACCOUNTS = { '6ZaKSZfYLUvbWqDmHKWWZ7wtUo8aMidvE6k8U2oMXvjf': '2u1tszSeqZ3qBWF3uNGPFc8TzMk2tdiwknnRMWGWjGWH', // jUSDG -> USDG + '5pQu76BCLqLuePsdTdkRKsZA1Ch5YxahGBmHuPxUu1Da': '2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo', // jPYUSD -> PYUSD } async function tvl(api) { const tokenReserves = await getData(); From 2491b9ced800f609cbd9b466d363fdc41d116eb9 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 6 Oct 2026 11:33:33 -0400 Subject: [PATCH 107/988] Add Ufarm V2 (#21433) Co-authored-by: Evgenii Valeev --- projects/ufarm-digital-v2/index.js | 57 ++++++++++++++++++++++++++++++ projects/ufarm-digital/index.js | 5 ++- 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 projects/ufarm-digital-v2/index.js diff --git a/projects/ufarm-digital-v2/index.js b/projects/ufarm-digital-v2/index.js new file mode 100644 index 00000000000..58327e1f61c --- /dev/null +++ b/projects/ufarm-digital-v2/index.js @@ -0,0 +1,57 @@ +const { getConfig } = require('../helper/cache') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const API = 'https://app.ufarm.digital/api/v2/pool/positions?chainId=' +const ADDRESS = /^0x[\da-f]{40}$/i +const UNI_V3_NFT = '0xc36442b4a4522e871399cd717abdd847ab11fe88' +const config = { + arbitrum: { chainId: 42161, blacklistedTokens: [UNI_V3_NFT] }, + ethereum: { + chainId: 1, + blacklistedTokens: [ + UNI_V3_NFT, + '0xdb95d646012bb87ac2e6cd63eab2c42323c1f5af', // listed as asset by their API but not an ERC20, reverts every call + ], + }, +} + +module.exports = { + methodology: 'Counts the assets held by UFarm v2 vaults, discovered from the UFarm positions API.', + doublecounted: true, +} + +Object.keys(config).forEach(chain => { + const { chainId, blacklistedTokens } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const positions = await getConfig('ufarm-digital-v2/' + chain, API + chainId) + if (!Array.isArray(positions)) throw new Error('Invalid UFarm positions response') + + const type = p => p.positionType?.toLowerCase() + const rwaVaults = new Set(positions.filter(p => type(p) === 'rwa').map(p => p.owner?.toLowerCase())) + const valid = positions.filter(p => Number(p.chainId) === chainId && ADDRESS.test(p.owner) && ADDRESS.test(p.asset) + && !rwaVaults.has(p.owner.toLowerCase()) + && p.asset.toLowerCase() !== p.owner.toLowerCase()) // vault's own share token + + const tokenPositions = valid.filter(p => ['erc20', 'erc4626', 'convex'].includes(type(p))) + const byOwner = {} + tokenPositions.forEach(({ owner, asset }) => { + if (!byOwner[owner]) byOwner[owner] = new Set() + byOwner[owner].add(asset) + }) + const ownerTokens = Object.entries(byOwner).map(([owner, assets]) => [[...assets], owner]) + const owners = [...new Set(valid.map(p => p.owner))] + const convexRewardPools = [...new Set(tokenPositions.filter(p => type(p) === 'convex').map(p => p.asset))] + + const uniV4 = valid.filter(p => type(p) === 'uniswap4' && p.tokenId) + const uniV4PositionIds = [...new Set(uniV4.map(p => p.tokenId))] + const blacklist = [...blacklistedTokens, ...uniV4.map(p => p.asset)] + + await sumTokens2({ api, ownerTokens, owners, resolveLP: true, resolveUniV3: true, unwrapAll: true, convexRewardPools, blacklistedTokens: blacklist, permitFailure: true }) + + if (uniV4PositionIds.length) { + await sumTokens2({ api, resolveUniV4: true, uniV4ExtraConfig: { positionIds: uniV4PositionIds }, blacklistedTokens: blacklist, permitFailure: true }) + } + } + } +}) diff --git a/projects/ufarm-digital/index.js b/projects/ufarm-digital/index.js index bb1bae102fa..41c0ced559c 100644 --- a/projects/ufarm-digital/index.js +++ b/projects/ufarm-digital/index.js @@ -1,7 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getConfig } = require('../helper/cache') - -const { getLogs2 } = require('../helper/cache/getLogs') const { sumTokens2 } = require('../helper/unwrapLPs') const config = { arbitrum: { @@ -32,7 +30,8 @@ Object.keys(config).forEach(chain => { const { endpoint, blacklistedTokens = [] } = config[chain] module.exports[chain] = { tvl: async (api) => { - const { data } = await getConfig('ufarm-digital/' + api.chain, endpoint) + const { data: pools } = await getConfig('ufarm-digital/' + api.chain, endpoint) + const data = pools.filter(i => !i.isRWA) // RWA pools are listed as assets, not TVL const blacklistSet = new Set(blacklistedTokens.map(i => i.toLowerCase())) const ownerTokens = data .map(i => [(i.assetAllocation?.map(a => a.asset) || []).filter(a => a && !blacklistSet.has(a.toLowerCase())), i.poolAddress]) From a46f4a599121e926e9057fa8bbd1b833c366f5f9 Mon Sep 17 00:00:00 2001 From: kpk-giel Date: Tue, 6 Oct 2026 16:45:00 +0100 Subject: [PATCH 108/988] curators: drop vaults two registry entries should not count (#21417) Co-authored-by: Claude Opus 5.5 --- registries/curators.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/registries/curators.js b/registries/curators.js index 980865b0cf2..7e7e8f433a7 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -1620,12 +1620,6 @@ const configs = { methodology: 'Count all assets are deposited in all vaults curated by Vault Bridge and its partners.', blockchains: { ethereum: { - morpho: [ - '0xBEefb9f61CC44895d8AEc381373555a64191A9c4', - '0xc54b4E08C1Dcc199fdd35c6b5Ab589ffD3428a8d', - '0x31A5684983EeE865d943A696AAC155363bA024f9', - '0x812B2C6Ab3f4471c0E43D4BB61098a9211017427', - ], erc4626: [ '0x3DD459dE96F9C28e3a343b831cbDC2B93c8C4855', ], @@ -1671,12 +1665,6 @@ const configs = { '0x50B75d586929Ab2F75dC15f07E1B921b7C4Ba8fA', '0x75a1253432356f90611546a487b5350CEF08780D', ], - turtleclub_erc4626: [ - '0xF470EB50B4a60c9b069F7Fd6032532B8F5cC014d', - '0xA5DaB32DbE68E6fa784e1e50e4f620a0477D3896', - '0xe1Ac97e2616Ad80f69f705ff007A4bbb3655544a', - '0x77570CfEcf83bc6bB08E2cD9e8537aeA9F97eA2F', - ], }, base: { morphoVaultOwners: [ From 1eb1bd5b42bde71f7f8ccc45986679f0bd6efa97 Mon Sep 17 00:00:00 2001 From: Dani Date: Tue, 6 Oct 2026 17:46:21 +0200 Subject: [PATCH 109/988] kalmydas: add v5_2_2 vaults, v8_2 staking and treasury pol (#21428) --- projects/kalmydas/index.js | 12 ++++++++-- projects/treasury/kalmydas.js | 44 ++++++++++++++++++++++++++--------- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/projects/kalmydas/index.js b/projects/kalmydas/index.js index f236325aa41..432140a2dcc 100644 --- a/projects/kalmydas/index.js +++ b/projects/kalmydas/index.js @@ -5,7 +5,7 @@ const USDC = ADDRESSES.base.USDC const WETH = ADDRESSES.optimism.WETH_1 const KAL = '0xe99556D5594faf533fcB346A8a9B11259D29afA8' -// KalPool strategy vaults, generations V5_1_4 and V5_2_0 (both live during the migration) +// KalPool strategy vaults, generations V5_1_4, V5_2_0 and V5_2_2 (all live during the migration) const VAULTS = [ // V5_1_4 '0x96869F08F5B5C52664c9620269394eFF4efd065b', // HORIZON @@ -21,6 +21,13 @@ const VAULTS = [ '0xf5aC77495227741CeB696d43Cd0fD4Ed83F73Bf8', // TREASURY '0x9b87C7075ca523a160F6e9657dDEedb263CFa3c2', // ORION '0x7393819B67A4f70C307831B114Ca5f5e224bebF1', + // V5_2_2 + '0x6bDdFAA9Fe728bEee4A14FD64F7C770490A42654', // HORIZON + '0xAb1825cB888c88a283518905f7981C3b2E158bD8', // VALKYRIE + '0xB502e605804d03c45Ea8a7f73814Fd3efcB2975d', // REVOLUTION + '0xeCf3c5963B3514714F9d6bDC3F481EB8e4007Aa9', // TREASURY + '0x04495A5F602fad117cC39806603c95D458De405E', // ORION + '0x9455fFC22D84031BAf05f3091DB4FF6e48722F77', // GENESIS ] // KalSwap USDC/WETH market: not farmed with KAL, counted as tvl @@ -42,6 +49,7 @@ const STAKING = [ '0xF392A8F1B6c85f607F988B44EcAE2B4d652585f5', '0x590f7d2ba77ADac6fC1e3cc2df16781989919529', '0x58CfcB5A67Aac6255cA13771EbdCFF45bAd5d605', + '0x116BBb2333B482cAB15ae10620E7671D6231434e', // LiquidityRewards V8_2 ] async function tvl(api) { @@ -74,7 +82,7 @@ async function pool2(api) { } module.exports = { - methodology: 'TVL is the USDC deposited by users in the KalPool strategy vaults (vault USDC balance minus the platform reserve still held in the vault, reserveBalance - operatorBalance) plus the USDC and WETH in the KalSwap USDC/WETH market, on Base. Both vault generations (V5_1_4 and V5_2_0) are counted during the migration. The platform reserve is protocol-owned trading capital and is reported in the Kal Mydas treasury. KalSwap markets paired with KAL and the Aerodrome KAL/USDC LP staked in the Kal Mydas Aerodrome LP staking are farmed for KAL rewards and reported under pool2. KAL staked single-side and KAL locked in veKAL are reported under staking.', + methodology: 'TVL is the USDC deposited by users in the KalPool strategy vaults (vault USDC balance minus the platform reserve still held in the vault, reserveBalance - operatorBalance) plus the USDC and WETH in the KalSwap USDC/WETH market, on Base. All live vault generations (V5_1_4, V5_2_0 and V5_2_2) are counted during the migration. The platform reserve is protocol-owned trading capital and is reported in the Kal Mydas treasury. KalSwap markets paired with KAL and the Aerodrome KAL/USDC LP staked in the Kal Mydas Aerodrome LP staking are farmed for KAL rewards and reported under pool2. KAL staked single-side and KAL locked in veKAL are reported under staking.', base: { tvl, pool2, diff --git a/projects/treasury/kalmydas.js b/projects/treasury/kalmydas.js index 5b455877367..8e1a4796146 100644 --- a/projects/treasury/kalmydas.js +++ b/projects/treasury/kalmydas.js @@ -2,15 +2,16 @@ const { treasuryExports } = require('../helper/treasury') const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -// Kal Mydas protocol treasury on Base mainnet. -// - Gnosis Safe multisig (protocol treasury: USDC, KAL) -// - TreasuryRWAV2 (tokenized gold and bitcoin reserve, being funded) -// - RainyDayFund (emergency reserve) -// - Protocol KAL held by the presale, airdrop, referral and depositor bonus contracts (ownTokens) -// - Platform reserve held inside the KalPool strategy vaults (reserveBalance - operatorBalance), -// excluded from the Kal Mydas protocol TVL const KAL = '0xe99556D5594faf533fcB346A8a9B11259D29afA8' const USDC = ADDRESSES.base.USDC +const SAFE = '0x55a7645F04CEbCE3eb706D441cB649fFDe4D5027' + +// KAL/USDC LP owned by the Safe: KalSwap V3, KalSwap V2, Aerodrome (KalSwap pairs expose no token0/token1) +const POL_PAIRS = [ + '0x1FaC3B6a11C441Dd1535deB4c1140a7D01fB8E98', + '0x3315E6E788E2B30aF8f4c35124695E60D510c31B', + '0x65e8d79D0103A470e92A81F2cDB970bA9a823b9E', +] const VAULTS = [ '0x96869F08F5B5C52664c9620269394eFF4efd065b', @@ -25,6 +26,13 @@ const VAULTS = [ '0xf5aC77495227741CeB696d43Cd0fD4Ed83F73Bf8', '0x9b87C7075ca523a160F6e9657dDEedb263CFa3c2', '0x7393819B67A4f70C307831B114Ca5f5e224bebF1', + // V5_2_2 + '0x6bDdFAA9Fe728bEee4A14FD64F7C770490A42654', + '0xAb1825cB888c88a283518905f7981C3b2E158bD8', + '0xB502e605804d03c45Ea8a7f73814Fd3efcB2975d', + '0xeCf3c5963B3514714F9d6bDC3F481EB8e4007Aa9', + '0x04495A5F602fad117cC39806603c95D458De405E', + '0x9455fFC22D84031BAf05f3091DB4FF6e48722F77', ] async function vaultReserves(api) { @@ -44,11 +52,24 @@ async function vaultReserves(api) { return api.getBalances() } +// USDC side of the Safe's LP; the KAL side is the protocol's own token +async function polUSDC(api) { + const pairUSDC = await api.multiCall({ abi: 'erc20:balanceOf', target: USDC, calls: POL_PAIRS }) + // pairs not yet deployed at this block hold no USDC, so skip empty ones + const live = POL_PAIRS.map((pair, i) => ({ pair, usdc: BigInt(pairUSDC[i]) })).filter(p => p.usdc > 0n) + const [lpHeld, supplies] = await Promise.all([ + api.multiCall({ abi: 'erc20:balanceOf', calls: live.map(p => ({ target: p.pair, params: SAFE })) }), + api.multiCall({ abi: 'erc20:totalSupply', calls: live.map(p => p.pair) }), + ]) + live.forEach(({ usdc }, i) => api.add(USDC, (usdc * BigInt(lpHeld[i]) / BigInt(supplies[i])).toString())) + return api.getBalances() +} + const exportsObj = treasuryExports({ base: { owners: [ - '0x55a7645F04CEbCE3eb706D441cB649fFDe4D5027', // Gnosis Safe multisig - '0x4f1F316e76d8E8637006eF246E9dD6dc3b4680C1', // TreasuryRWAV2 + SAFE, // Gnosis Safe (1-of-1) + '0x4f1F316e76d8E8637006eF246E9dD6dc3b4680C1', // TreasuryRWAV2 (no RWA protocol registered yet) '0xD1795dD0Cfe169E4dE601469C07E0c4884aD251f', // RainyDayFund ], tokens: [ADDRESSES.null, ADDRESSES.base.USDC, ADDRESSES.base.WETH], @@ -58,12 +79,13 @@ const exportsObj = treasuryExports({ '0x6466C5042669f8d6D7f0c725B51cD2650d1E1b9A', // KAL presale (unsold KAL) '0xB04E37e0568873f29f3666E3b94810B6CeA4Ee57', // KAL airdrop reserve '0xadEd1b00159fABCefd111bA97E64875B8c82a21A', // referral rewards reserve - '0x2F437493a8899bBd3B7dB41597d9f2695B7070c9', // KalPoolRewardsV3, depositor KAL bonus reserve + '0x77feeA49fd83A635fa3474e23D89534Cb1b1b809', // KalPoolRewardsV4, depositor KAL bonus reserve + '0x2F437493a8899bBd3B7dB41597d9f2695B7070c9', // KalPoolRewardsV3 (previous generation) '0x5dEE301aD9290DC5BAFa8cC6F6e359bDDF5356ea', // KalPoolRewardsV2 (previous generation) ], }, }) -exportsObj.base.tvl = sdk.util.sumChainTvls([exportsObj.base.tvl, vaultReserves]) +exportsObj.base.tvl = sdk.util.sumChainTvls([exportsObj.base.tvl, vaultReserves, polUSDC]) module.exports = exportsObj From 354d76f7f78406fdd23c0ba103aa29a9e029dbab Mon Sep 17 00:00:00 2001 From: i own ducks <111690356+iownducks@users.noreply.github.com> Date: Tue, 6 Oct 2026 22:12:57 +0500 Subject: [PATCH 110/988] btb-finance: fix Base TVL counting other users' staked positions (#21435) Co-authored-by: iownducks Co-authored-by: FelixBruguera --- projects/btb-finance/index.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/projects/btb-finance/index.js b/projects/btb-finance/index.js index 9f524b68565..d842148a73d 100644 --- a/projects/btb-finance/index.js +++ b/projects/btb-finance/index.js @@ -76,13 +76,21 @@ async function wallets(api, { factories }, toBlock) { // Base: a wallet only lets an NFT leave to its owner or to a farm that stakes it, so the gauges it staked into are // the voter's gauges among the contracts it sent NFTs to. Each of those gauges returns the wallet's staked ids. async function stakedFromLogs(api, nft, voter, owners, fromBlock, toBlock) { - // One query for all wallets: the sender topic matches any of them. - const logs = await getLogs({ - api, target: nft, eventAbi: transferAbi, onlyArgs: true, fromBlock, toBlock, - topics: [TRANSFER, owners.map(o => '0x' + o.slice(2).padStart(64, '0'))], - extraKey: `btb-sent-${owners.length}`, - }) - const pairs = [...new Set(logs.map(l => `${l.from.toLowerCase()}:${l.to.toLowerCase()}`))].map(p => p.split(':')) + // One query per wallet: the indexer filters on a single sender topic, not on a list of them. + const logs = [] + for (const owner of owners) { + logs.push(...await getLogs({ + api, target: nft, eventAbi: transferAbi, onlyArgs: true, fromBlock, toBlock, + topics: [TRANSFER, '0x' + owner.slice(2).toLowerCase().padStart(64, '0')], + extraKey: `btb-sent-${owner.toLowerCase()}`, + })) + } + // Keep only transfers sent by a BTB wallet, in case a log source ignores the sender topic. Without this every + // staker in the same gauges was counted (Base read $32M instead of about $600). + const ownerSet = new Set(owners.map(o => o.toLowerCase())) + const pairs = [...new Set(logs + .filter(l => ownerSet.has(l.from.toLowerCase())) + .map(l => `${l.from.toLowerCase()}:${l.to.toLowerCase()}`))].map(p => p.split(':')) const recipients = [...new Set(pairs.map(([, to]) => to))] if (!recipients.length) return [] const isGauge = await api.multiCall({ abi: 'function isGauge(address) view returns (bool)', target: voter, calls: recipients }) From b765d50fc9cdd4d0b7943114d29687dc190f444a Mon Sep 17 00:00:00 2001 From: kpk-giel Date: Tue, 6 Oct 2026 20:07:56 +0100 Subject: [PATCH 111/988] curators: leave out double counted and unrecoverable vault assets (#21414) Co-authored-by: Claude Opus 5.5 --- projects/helper/curators/configs.js | 3 + projects/helper/curators/index.js | 93 +++++++++++- projects/helper/curators/morpho-bad-debt.js | 153 ++++++++++++++++++++ projects/k3/index.js | 25 ++-- registries/curators.js | 10 +- 5 files changed, 263 insertions(+), 21 deletions(-) create mode 100644 projects/helper/curators/morpho-bad-debt.js diff --git a/projects/helper/curators/configs.js b/projects/helper/curators/configs.js index cc2562a1830..ffaed9612f7 100644 --- a/projects/helper/curators/configs.js +++ b/projects/helper/curators/configs.js @@ -33,6 +33,9 @@ const ABI = { getProxyListLength: 'uint256:getProxyListLength', proxyList: 'function proxyList(uint256) view returns (address)', creator: 'address:creator', + cash: 'uint256:cash', + totalBorrows: 'uint256:totalBorrows', + interestRate: 'uint256:interestRate', }, silo: { CreateSiloVaultEvent: 'event CreateSiloVault(address indexed vault, address incentivesController, address idleVault)', diff --git a/projects/helper/curators/index.js b/projects/helper/curators/index.js index a2f1d9b7700..d10db38d2b4 100644 --- a/projects/helper/curators/index.js +++ b/projects/helper/curators/index.js @@ -1,5 +1,6 @@ const { getLogs2 } = require("../../helper/cache/getLogs") const { ABI, MorphoConfigs, EulerConfigs, SiloConfigs, VesuConfigs } = require('./configs') +const { leaveOutMorphoBadDebt } = require('./morpho-bad-debt') const { nullAddress } = require('../tokenMapping') const { multiCall } = require('../chain/starknet') const { bs58 } = require('@project-serum/anchor/dist/cjs/utils/bytes') @@ -188,7 +189,34 @@ async function getSiloVaults(api, owners) { return allVaults } -async function getCuratorTvlErc4626(api, vaults) { +// An Euler (EVK) vault that is fully lent while its borrow rate has been cut to near zero has stopped +// charging its borrowers, which a lender only does once the loans are not coming back. Its loans are +// left out and the vault counts only its cash. +const FROZEN_MIN_UTILIZATION_BPS = 9500n // 95% lent out +const FROZEN_MAX_BORROW_APR_BPS = 100n // 1% a year, far below any market rate for a fully lent vault +const SECONDS_PER_YEAR = 31536000n +const RAY = 10n ** 27n // EVK interestRate() is a per-second rate scaled by 1e27 + +function isFrozenEulerVault(cash, totalBorrows, interestRate) { + if (cash == null || totalBorrows == null || interestRate == null) return false + const total = BigInt(cash) + BigInt(totalBorrows) + if (total === 0n) return false + const utilizationBps = BigInt(totalBorrows) * 10000n / total + const borrowAprBps = BigInt(interestRate) * SECONDS_PER_YEAR * 10000n / RAY + return utilizationBps >= FROZEN_MIN_UTILIZATION_BPS && borrowAprBps < FROZEN_MAX_BORROW_APR_BPS +} + +async function countFrozenEulerVaultsAtCash(api, vaults, totalAssets) { + const [cash, totalBorrows, interestRates] = await Promise.all([ABI.euler.cash, ABI.euler.totalBorrows, ABI.euler.interestRate] + .map(abi => api.multiCall({ abi, calls: vaults, permitFailure: true }))) + vaults.forEach((_, i) => { + if (totalAssets[i] && isFrozenEulerVault(cash[i], totalBorrows[i], interestRates[i])) totalAssets[i] = cash[i] + }) +} + +// euler: run the frozen-Euler check (Euler vault lists only). booked: collects the vaults whose +// asset() and totalAssets() reads succeeded, for the cross-holding netting. +async function getCuratorTvlErc4626(api, vaults, { euler = false, booked = new Set() } = {}) { if (!vaults || vaults.length === 0) return; vaults = vaults.map(v => v.toLowerCase()) vaults = [...new Set(vaults)] // de-dup vault addresses @@ -196,6 +224,8 @@ async function getCuratorTvlErc4626(api, vaults) { // Get assets and totalAssets for all vaults const assets = await api.multiCall({ abi: ABI.ERC4626.asset, calls: vaults, permitFailure: true }) const totalAssets = await api.multiCall({ abi: ABI.ERC4626.totalAssets, calls: vaults, permitFailure: true }) + vaults.forEach((vault, i) => { if (assets[i] && totalAssets[i]) booked.add(vault) }) + if (euler) await countFrozenEulerVaultsAtCash(api, vaults, totalAssets) // Check which vaults are Morpho v2 (have liquidityAdapter function) const liquidityAdapters = await api.multiCall({ @@ -204,6 +234,9 @@ async function getCuratorTvlErc4626(api, vaults) { permitFailure: true, }) + // Morpho vaults holding bad debt count only what they can pay back (see ./morpho-bad-debt.js) + await leaveOutMorphoBadDebt(api, vaults, assets, totalAssets) + // Separate vaults into Morpho v2 and others const v2Vaults = [] const otherVaults = [] @@ -531,6 +564,47 @@ async function getNested4626Vaults(api, vaults) { } } +// Shares of a counted vault that another counted vault of the same curator holds are in both vaults' +// assets: e.g. an Euler Earn vault allocating to the curator's eVaults, an IPOR, Aera or Lagoon vault +// holding the curator's Morpho vault, or an eVault whose asset is another counted vault. Each holding +// is counted once: +// - a holder whose asset is the issuer (an escrow vault) books the shares themselves, so they are +// taken out of the holder's booking, in issuer shares; +// - MetaMorpho, Morpho V2 and EVK vaults count nothing but their own asset, so their other holdings +// are left alone (Morpho V2 holdings through adapters are netted in getCuratorTvlErc4626); +// - any other holder (Euler Earn, IPOR, Aera, Veda, or the Safe that holds a Lagoon vault's assets) +// counts the shares at their underlying value, which is taken out of the issuer's booking. +async function netCrossHoldings(api, issuers, holders) { + issuers = [...new Set(issuers.map(v => v.toLowerCase()))] + holders = [...new Set(holders.map(v => v.toLowerCase()))] + const issuerSet = new Set(issuers) + const [holderAssets, morphos, adapterCounts, cash, safes] = await Promise.all( + [ABI.ERC4626.asset, 'address:MORPHO', 'uint256:adaptersLength', 'uint256:cash', 'address:safe'] + .map(abi => api.multiCall({ abi, calls: holders, permitFailure: true }))) + + const pairs = [] + holders.forEach((holder, i) => { + const asset = holderAssets[i]?.toLowerCase() + if (issuerSet.has(asset)) pairs.push({ issuer: asset, holder, ownAsset: holderAssets[i] }) + else if (!morphos[i] && adapterCounts[i] == null && cash[i] == null) + issuers.filter(issuer => issuer !== holder).forEach(issuer => pairs.push({ issuer, holder })) + if (safes[i] && safes[i] !== nullAddress) + issuers.filter(issuer => issuer !== holder).forEach(issuer => pairs.push({ issuer, holder: safes[i] })) + }) + if (!pairs.length) return + + const shares = await api.multiCall({ abi: ABI.ERC4626.balanceOf, calls: pairs.map(({ issuer, holder }) => ({ target: issuer, params: [holder] })), permitFailure: true }) + const held = pairs.map((pair, i) => ({ ...pair, shares: shares[i] })).filter(({ shares }) => shares && BigInt(shares) > 0n) + held.filter(h => h.ownAsset).forEach(h => api.add(h.ownAsset, -BigInt(h.shares))) + const valued = held.filter(h => !h.ownAsset) + if (!valued.length) return + const assets = await api.multiCall({ abi: ABI.ERC4626.asset, calls: valued.map(h => h.issuer), permitFailure: true }) + const amounts = await api.multiCall({ abi: ABI.ERC4626.convertToAssets, calls: valued.map(h => ({ target: h.issuer, params: [h.shares] })), permitFailure: true }) + valued.forEach((_, i) => { + if (assets[i] && amounts[i]) api.add(assets[i], -BigInt(amounts[i])) + }) +} + async function getCuratorTvl(api, vaults) { if (api.chain === 'solana') { @@ -575,6 +649,12 @@ async function getCuratorTvl(api, vaults) { allVaults.silo = allVaults.silo.concat(await getSiloVaults(api, vaults.siloVaultOwners)) } + // excludedVaults: vaults this listing picks up (e.g. through owner discovery) that another listing counts + if (vaults.excludedVaults) { + const excluded = new Set(vaults.excludedVaults.map(v => v.toLowerCase())) + for (const key of Object.keys(allVaults)) allVaults[key] = allVaults[key].filter(v => !excluded.has(v.toLowerCase())) + } + // Combine all ERC-4626 vaults (morpho, erc4626, etc.) into a single array // This ensures de-duplication works across all ERC-4626 vaults regardless of which array they come from const allErc4626Vaults = [ @@ -585,13 +665,14 @@ async function getCuratorTvl(api, vaults) { ] // Process all ERC-4626 vaults together for proper de-duplication + const booked = new Set() if (allErc4626Vaults.length > 0) { - await getCuratorTvlErc4626(api, allErc4626Vaults) + await getCuratorTvlErc4626(api, allErc4626Vaults, { booked }) } // Process other vault types separately - await getCuratorTvlErc4626(api, allVaults.euler) - await getCuratorTvlErc4626(api, allVaults.silo) + await getCuratorTvlErc4626(api, allVaults.euler, { euler: true, booked }) + await getCuratorTvlErc4626(api, allVaults.silo, { booked }) // aera.finance vaults if (vaults.aera) { @@ -644,6 +725,10 @@ async function getCuratorTvl(api, vaults) { await getCuratorTvlMidasToken(api, vaults.midasTokens) } + const shareVaults = [...booked, ...(vaults.accountableVaults || [])] // only vaults whose reads succeeded + const otherVaults = ['aera', 'turtleclub', 'boringVaults', 'symbiotic', 'upshiftV2', 'nestedVaults'].flatMap(key => vaults[key] || []) + await netCrossHoldings(api, shareVaults, [...shareVaults, ...otherVaults]) + return api.getBalances() } diff --git a/projects/helper/curators/morpho-bad-debt.js b/projects/helper/curators/morpho-bad-debt.js new file mode 100644 index 00000000000..b5563c3c9b2 --- /dev/null +++ b/projects/helper/curators/morpho-bad-debt.js @@ -0,0 +1,153 @@ +// Morpho vaults keep booking loans that will not be paid back. Two cases are left out of their TVL: +// +// 1. Markets with unrealised bad debt. When a market's collateral is worthless nobody repays and +// nobody liquidates, so the market stays fully borrowed and keeps accruing interest into its +// suppliers' balances. The AdaptiveCurveIrm marks such a market: at ~100% utilisation its rate at +// target keeps rising until it hits the 200% APR cap. Getting to half the cap from the 4% initial +// rate takes more than three weeks of full utilisation at 400%+ APR, which a solvent borrower +// does not pay. +// 2. Losses that MetaMorpho v1.1 keeps in totalAssets(): it adds lostAssets back so that the share +// price does not drop. Rounding leaves a few wei of lostAssets in many healthy vaults, so only a +// loss above 1 bp of totalAssets counts. totalAssets() includes a new loss straight away while +// lostAssets() stores it only at the next deposit or withdrawal, so a vault whose positions are +// worth less than 99% of totalAssets() counts as having lost the difference too. +// +// An affected V1 vault counts its positions in the other markets. A V2 vault leaves out what its +// market adapters hold in bricked markets. Every other vault keeps its totalAssets(). + +const MAX_RATE_AT_TARGET = 63419583967n // AdaptiveCurveIrm cap: 200% APR per second (2e18 / 365 days) +const BRICKED_MIN_RATE_AT_TARGET = MAX_RATE_AT_TARGET / 2n +const BRICKED_MIN_UTILIZATION_BPS = 9900n // 99% +const MATERIAL_LOSS_BPS = 1n +const MIN_HELD_PERCENT = 99n +const TARGET_UTILIZATION = 0.9 // AdaptiveCurveIrm +const ADJUSTMENT_SPEED = 50 // AdaptiveCurveIrm: per year, at full utilisation +const SECONDS_PER_YEAR = 31536000 +const VIRTUAL_SHARES = 10n ** 6n // Morpho Blue SharesMathLib +const VIRTUAL_ASSETS = 1n + +const abi = { + MORPHO: 'address:MORPHO', + lostAssets: 'uint256:lostAssets', + withdrawQueueLength: 'uint256:withdrawQueueLength', + withdrawQueue: 'function withdrawQueue(uint256) view returns (bytes32)', + adaptersLength: 'uint256:adaptersLength', + adapters: 'function adapters(uint256) view returns (address)', + realAssets: 'uint256:realAssets', + morpho: 'address:morpho', + marketIdsLength: 'uint256:marketIdsLength', + marketIds: 'function marketIds(uint256) view returns (bytes32)', + expectedSupplyAssets: 'function expectedSupplyAssets(bytes32) view returns (uint256)', + balanceOf: 'function balanceOf(address) view returns (uint256)', + market: 'function market(bytes32) view returns (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee)', + idToMarketParams: 'function idToMarketParams(bytes32) view returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv)', + rateAtTarget: 'function rateAtTarget(bytes32) view returns (int256)', + position: 'function position(bytes32, address) view returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral)', +} + +const isAddr = (a) => typeof a === 'string' && /^0x[0-9a-fA-F]{40}$/.test(a) && !/^0x0{40}$/.test(a) +const range = (n) => Array.from({ length: Number(n || 0) }, (_, i) => i) +const min = (a, b) => (a < b ? a : b) + +async function multi(api, abi, calls) { + return calls.length ? api.multiCall({ abi, calls, permitFailure: true }) : [] +} + +function isBricked(market, rateAtTarget, now) { + if (!market || rateAtTarget == null || BigInt(market.totalSupplyAssets) === 0n) return false + const utilizationBps = BigInt(market.totalBorrowAssets) * 10000n / BigInt(market.totalSupplyAssets) + if (utilizationBps < BRICKED_MIN_UTILIZATION_BPS) return false + // the stored rate at target only moves when the market is touched: bring it forward to now + const err = (Number(utilizationBps) / 10000 - TARGET_UTILIZATION) / (1 - TARGET_UTILIZATION) + const elapsed = Math.max(0, now - Number(market.lastUpdate)) + return Number(rateAtTarget) * Math.exp(ADJUSTMENT_SPEED * err * elapsed / SECONDS_PER_YEAR) >= Number(BRICKED_MIN_RATE_AT_TARGET) +} + +// Lowers totalAssets[i] (aligned with vaults and assets) for the Morpho vaults that hold bad debt. +async function leaveOutMorphoBadDebt(api, allVaults, allAssets, totalAssets) { + const index = new Map(allVaults.map((v, i) => [v, i])) + const vaults = allVaults.filter((_, i) => allAssets[i] && totalAssets[i]) + const assets = new Map(vaults.map((v) => [v, allAssets[index.get(v)]])) + const totals = new Map(vaults.map((v) => [v, BigInt(totalAssets[index.get(v)])])) + const [morphos, lostAssets, queueLengths, adaptersLengths] = await Promise.all( + [abi.MORPHO, abi.lostAssets, abi.withdrawQueueLength, abi.adaptersLength].map((a) => multi(api, a, vaults))) + const v1 = [] + const v2 = [] + vaults.forEach((vault, i) => { + if (isAddr(morphos[i]) && queueLengths[i] != null) v1.push({ vault, morpho: morphos[i], lost: BigInt(lostAssets[i] || 0), queueLength: queueLengths[i], positions: [] }) + else if (adaptersLengths[i] != null) v2.push({ vault, adaptersLength: adaptersLengths[i], adapters: [], positions: [] }) + }) + + // V1: the vault supplies to the markets of its withdraw queue + const queue = v1.flatMap((v) => range(v.queueLength).map((j) => ({ v, j }))) + const queueIds = await multi(api, abi.withdrawQueue, queue.map(({ v, j }) => ({ target: v.vault, params: [j] }))) + queue.forEach(({ v }, k) => v.positions.push({ morpho: v.morpho, id: queueIds[k] })) + + // V2: idle assets plus what each adapter holds; market adapters report their assets per market + const adapterSlots = v2.flatMap((v) => range(v.adaptersLength).map((j) => ({ v, j }))) + const adapterAddrs = await multi(api, abi.adapters, adapterSlots.map(({ v, j }) => ({ target: v.vault, params: [j] }))) + adapterSlots.forEach(({ v }, k) => { if (!isAddr(adapterAddrs[k])) v.incomplete = true }) + const adapters = adapterSlots.map(({ v }, k) => ({ v, address: adapterAddrs[k] })).filter((a) => isAddr(a.address)) + const [realAssets, adapterMorphos, marketCounts, idle] = await Promise.all([ + multi(api, abi.realAssets, adapters.map((a) => a.address)), + multi(api, abi.morpho, adapters.map((a) => a.address)), + multi(api, abi.marketIdsLength, adapters.map((a) => a.address)), + multi(api, abi.balanceOf, v2.map((v) => ({ target: assets.get(v.vault), params: [v.vault] }))), + ]) + adapters.forEach((a, k) => { + a.v.adapters.push({ ...a, realAssets: realAssets[k], morpho: adapterMorphos[k], marketCount: marketCounts[k] }) + if (isAddr(adapterMorphos[k]) && marketCounts[k] == null) a.v.incomplete = true // a market adapter whose markets did not load + }) + v2.forEach((v, i) => { v.idle = idle[i] }) + const adapterMarkets = v2.flatMap((v) => v.adapters).filter((a) => isAddr(a.morpho) && a.marketCount != null) + .flatMap((a) => range(a.marketCount).map((j) => ({ a, j }))) + const marketIds = await multi(api, abi.marketIds, adapterMarkets.map(({ a, j }) => ({ target: a.address, params: [j] }))) + adapterMarkets.forEach(({ a }, k) => { if (!marketIds[k]) a.v.incomplete = true }) + const withId = adapterMarkets.map(({ a }, k) => ({ a, id: marketIds[k] })).filter((m) => m.id) + const expected = await multi(api, abi.expectedSupplyAssets, withId.map(({ a, id }) => ({ target: a.address, params: [id] }))) + withId.forEach(({ a, id }, k) => a.v.positions.push({ morpho: a.morpho, id, assets: expected[k] })) + + // the state of every market involved and whether it is bricked + const keyOf = (p) => `${p.morpho}:${p.id}`.toLowerCase() + const markets = [...new Map([...v1, ...v2].flatMap((v) => v.positions).filter((p) => p.id).map((p) => [keyOf(p), p])).values()] + const [states, params] = await Promise.all([abi.market, abi.idToMarketParams].map((a) => multi(api, a, markets.map((m) => ({ target: m.morpho, params: [m.id] }))))) + const withIrm = markets.map((m, i) => ({ m, i })).filter(({ i }) => isAddr(params[i]?.irm)) + const rates = await multi(api, abi.rateAtTarget, withIrm.map(({ m, i }) => ({ target: params[i].irm, params: [m.id] }))) + const marketInfo = new Map(markets.map((m, i) => [keyOf(m), { state: states[i], params: params[i], bricked: false }])) + const loaded = (p) => marketInfo.get(keyOf(p))?.state && marketInfo.get(keyOf(p))?.params + const now = api.timestamp || Math.floor(Date.now() / 1000) + withIrm.forEach(({ m, i }, k) => { marketInfo.get(keyOf(m)).bricked = isBricked(states[i], rates[k], now) }) + + const values = new Map() + + const v1Positions = v1.flatMap((v) => v.positions.map((p) => ({ v, p }))).filter(({ p }) => p.id) + const shares = await multi(api, abi.position, v1Positions.map(({ v, p }) => ({ target: p.morpho, params: [p.id, v.vault] }))) + v1Positions.forEach(({ p }, k) => { + const state = marketInfo.get(keyOf(p))?.state + if (shares[k] && state) p.assets = BigInt(shares[k].supplyShares) * (BigInt(state.totalSupplyAssets) + VIRTUAL_ASSETS) / (BigInt(state.totalSupplyShares) + VIRTUAL_SHARES) + }) + for (const v of v1) { + if (v.positions.some((p) => p.assets == null || !loaded(p))) continue // incomplete read: keep totalAssets() + const total = totals.get(v.vault) + const bricked = v.positions.filter((p) => marketInfo.get(keyOf(p)).bricked) + const held = v.positions.reduce((sum, p) => sum + p.assets, 0n) + const lostSome = v.lost * 10000n > total * MATERIAL_LOSS_BPS || held * 100n < total * MIN_HELD_PERCENT + if (!lostSome && !bricked.some((p) => p.assets > 0n)) continue + const good = v.positions.filter((p) => !bricked.includes(p)).reduce((sum, p) => sum + p.assets, 0n) + values.set(v.vault, min(good, total > v.lost ? total - v.lost : 0n)) + } + + for (const v of v2) { + if (v.incomplete || v.idle == null || v.adapters.some((a) => a.realAssets == null) || v.positions.some((p) => p.assets == null || !loaded(p))) continue + const bricked = v.positions.filter((p) => marketInfo.get(keyOf(p))?.bricked).reduce((sum, p) => sum + BigInt(p.assets), 0n) + if (bricked === 0n) continue + const real = v.adapters.reduce((sum, a) => sum + BigInt(a.realAssets), BigInt(v.idle)) + values.set(v.vault, min(real > bricked ? real - bricked : 0n, totals.get(v.vault))) + } + + for (const [vault, value] of values) totalAssets[index.get(vault)] = value +} + +module.exports = { + leaveOutMorphoBadDebt, +} diff --git a/projects/k3/index.js b/projects/k3/index.js index cacfacbfd69..d73ecae73d0 100644 --- a/projects/k3/index.js +++ b/projects/k3/index.js @@ -1,5 +1,4 @@ -const { getCuratorExport } = require("../helper/curators"); -const { mergeExports } = require("../helper/utils"); +const { getCuratorExport, getCuratorTvl } = require("../helper/curators"); const configs = { methodology: @@ -114,13 +113,17 @@ const configs = { // Pre-sunset these vaults count under projects/euler-dao, from the sunset date // onward they are attributed to K3. // https://forum.euler.finance/t/sunsetting-of-dao-managed-market-and-vaults/1828 -const eulerSunsetConfigs = getCuratorExport({ - start: "2026-05-06", - blockchains: { - monad: { - eulerVaultOwners: ["0x5D42F8aCd567810D57D60f90bB9C6d194207a6e1"], - }, - }, -}); +const EULER_SUNSET = Math.floor(new Date("2026-05-06").getTime() / 1000); +const EULER_SUNSET_OWNER = "0x5D42F8aCd567810D57D60f90bB9C6d194207a6e1"; + +module.exports = getCuratorExport(configs); -module.exports = mergeExports([getCuratorExport(configs), eulerSunsetConfigs]); \ No newline at end of file +// The handed-over vaults are read together with K3's own Monad vaults, so that the shares K3's Earn +// vaults hold of them are netted once. +module.exports.monad = { + tvl: async (api) => { + const monad = configs.blockchains.monad; + const owners = api.timestamp >= EULER_SUNSET ? [...monad.eulerVaultOwners, EULER_SUNSET_OWNER] : monad.eulerVaultOwners; + return getCuratorTvl(api, { ...monad, eulerVaultOwners: owners }); + }, +}; \ No newline at end of file diff --git a/registries/curators.js b/registries/curators.js index 7e7e8f433a7..ac907a0eba7 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -1220,6 +1220,10 @@ const configs = { methodology: 'Count all assets are deposited in all vaults curated by Steakhouse Financial.', blockchains: { ethereum: { + excludedVaults: [ // Waterline's vaults (Morpho lists Waterline as curator), counted under waterline + '0xbeEF346d7099865208Ff331e4f648f4154DDAa05', // Waterline Reservoir USDC (V1) + '0xBEeF1f5Bd88285E5B239B6AAcb991d38ccA23Ac9', // Waterline infiniFi USDC (V1) + ], morphoVaultOwners: [ '0x0000aeB716a0DF7A9A1AAd119b772644Bc089dA8', '0x255c7705e8BB334DfCae438197f7C4297988085a', @@ -1254,12 +1258,6 @@ const configs = { '0xBEEFFFC57A26fD8D3b693Ba025ead597DbECEBfe', // USDC High Yield Term '0xBEEf3f3A04e28895f3D5163d910474901981183D', // 3F Ecosystem Vault '0xBeefF08dF54897e7544aB01d0e86f013DA354111', // Steakhouse Prime - '0xBEeF1f5Bd88285E5B239B6AAcb991d38ccA23Ac9', // Waterline infiniFi USDC - '0xbeEF346d7099865208Ff331e4f648f4154DDAa05', // Waterline Reservoir USDC - '0xBEeFF047C03714965a54b671A37C18beF6b96210', // Waterline Reservoir USDC - '0xAb5955EB671d150527f8E61A42B703832F86616C', // M1 USDC - '0xbeEFF75262b2eC16a3C62a807F02EE7627654931', // Waterline InfiniFi USDC - '0x7d4741ba166B21cf3168A9A0ea71388531C52FF7', // Tenbin USDC '0x6f48cE6380693808682E43140E3Eeb877a096Aa1', // USDC T-Prime Instant '0xBEEFFF4716a49418D69c251cab8759bB107e57C8', // USDC Turbo '0xBEEFFFDE1CABD3d8A3cd4fd5e04DbA51B9D4Ac39', // XAUT Turbo From 6167bb605f80b2fb41ee99f55f13faec08c28771 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Tue, 6 Oct 2026 21:12:33 +0200 Subject: [PATCH 112/988] Add hallmarks for recent TVL events (#21438) --- projects/blast-bridge/index.js | 3 +++ projects/helio-money/index.js | 1 + projects/layer-zero/index.js | 3 +++ projects/legion/index.js | 6 +++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/blast-bridge/index.js b/projects/blast-bridge/index.js index 6a36c4d02f4..608dc94590c 100644 --- a/projects/blast-bridge/index.js +++ b/projects/blast-bridge/index.js @@ -2,6 +2,9 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); const ADDRESSES = require('../helper/coreAssets.json'); module.exports = { + hallmarks: [ + ['2026-10-02', 'Blast L2 shutdown announced, bridge withdrawals until Oct 26'], + ], ethereum: { tvl: async (api) =>{ const balances = { diff --git a/projects/helio-money/index.js b/projects/helio-money/index.js index 15953e933f8..aab9d3e286d 100644 --- a/projects/helio-money/index.js +++ b/projects/helio-money/index.js @@ -29,6 +29,7 @@ module.exports = { methodology: "The TVL is calculated by summing the values of tokens held in the specified vault addresses", hallmarks: [ ['2022-12-02', "aBNBc exploit"], + ['2026-10-01', "CDP sunset announced, migrate to Lista Lending or unwind by Oct 31"], ], bsc: { tvl: async (api) => { diff --git a/projects/layer-zero/index.js b/projects/layer-zero/index.js index 3ee79d162a8..99be00f4617 100644 --- a/projects/layer-zero/index.js +++ b/projects/layer-zero/index.js @@ -137,6 +137,9 @@ const chains = [ module.exports = { methodology: 'Counts assets escrowed in LayerZero OFT Adapter / ProxyOFT lockboxes on each chain, discovered from the LayerZero metadata API. Pure mint-and-burn OFTs hold no collateral and are not counted. Destination-chain escrows that hold a LayerZero-minted wrapper are excluded, since the collateral backing them is already counted at its canonical lockbox, escrows holding natively-issued assets are counted even where the metadata annotates them as pegged to another chain.', + hallmarks: [ + ['2026-10-03', 'Record $4B daily bridged volume, driven by a single $3.6B WPAY transfer (Polygon to Arc)'], + ], tron: { tvl: tronTvl }, solana: { tvl: solanaTvl }, } diff --git a/projects/legion/index.js b/projects/legion/index.js index 5857a106f34..08fdf8cffd5 100644 --- a/projects/legion/index.js +++ b/projects/legion/index.js @@ -17,4 +17,8 @@ const tvl = async (api) => { Object.keys(config).forEach(chain => { module.exports[chain] = { tvl } -}) \ No newline at end of file +}) + +module.exports.hallmarks = [ + ['2026-09-29', 'Jumper JUMP token sale opens, ~16x oversubscribed'], +] \ No newline at end of file From dc7841380bbd3bcac1f3bcf514da67584e98627a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 6 Oct 2026 21:37:10 +0200 Subject: [PATCH 113/988] alchemix: track base --- projects/alchemix-v3/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/alchemix-v3/index.js b/projects/alchemix-v3/index.js index a035cae0cb7..61313e6c4d7 100644 --- a/projects/alchemix-v3/index.js +++ b/projects/alchemix-v3/index.js @@ -4,6 +4,7 @@ const FACTORY = { ethereum: { factory: '0xdd56b00302e91C4c2b8246156bDEAa1cEDc58984', fromBlock: 24875892 }, arbitrum: { factory: '0x8c7C0C380bA4eE38461eb5a6b82e5d930EC11Ca2', fromBlock: 452291175 }, optimism: { factory: '0x8c7C0C380bA4eE38461eb5a6b82e5d930EC11Ca2', fromBlock: 150271732 }, + base: { factory: '0x2584E8b0616b3E750492c9629a3b27679C410cb9', fromBlock: 51125654 }, } const CREATE_VAULT_EVENT = @@ -18,8 +19,9 @@ async function tvl(api) { module.exports = { doublecounted: true, methodology: - 'TVL sums totalAssets() of every Alchemix V3 MYT (ERC-4626) vault found from VaultV2Factory.CreateVaultV2 events.', + 'Value of all assets deposited in Alchemix V3 vaults', ethereum: { tvl }, arbitrum: { tvl }, optimism: { tvl }, + base: { tvl }, } From 28c35dead9dc8f093c988d62fc2c7582c11a2e58 Mon Sep 17 00:00:00 2001 From: Evgenii Zinner Date: Wed, 7 Oct 2026 03:29:56 +0700 Subject: [PATCH 114/988] fix(omniyield): count physical token balances via sumTokens2 (#21404) (#21439) Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- projects/omniyield/index.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/projects/omniyield/index.js b/projects/omniyield/index.js index ed5dfd2da91..9410638bc7b 100644 --- a/projects/omniyield/index.js +++ b/projects/omniyield/index.js @@ -1,16 +1,20 @@ -const { getConfig } = require("../helper/cache") -const { sumERC4626Vaults } = require("../helper/erc4626") +const { getConfig } = require("../helper/cache"); +const { sumTokens2 } = require("../helper/unwrapLPs"); const ENDPOINT = "https://api.omniyield.finance/pools"; async function tvl(api) { const pools = await getConfig("omniyield/arbitrum", ENDPOINT); - const vaults = (pools[api.chainId] ?? []).map(i => i.address) - return sumERC4626Vaults({ api, calls: vaults, tokenAbi: 'token', balanceAbi: 'totalValue' }) + const vaults = (pools[api.chainId] ?? []).map((i) => i.address); + const tokens = await api.multiCall({ calls: vaults, abi: "address:token" }); + return sumTokens2({ + api, + tokensAndOwners: tokens.map((token, i) => [token, vaults[i]]), + }); } module.exports = { methodology: - "TVL is calculated by summing the total value of assets locked in all pools.", + "TVL is calculated by summing the underlying tokens held in OmniYield pools.", arbitrum: { tvl }, }; \ No newline at end of file From 872b3c648ac4edcb781dad7dba043ed040c955af Mon Sep 17 00:00:00 2001 From: AvaLoveApp Date: Wed, 7 Oct 2026 00:17:07 +0300 Subject: [PATCH 115/988] Add EL-Casino, EL Perps and EL Predict (Robinhood Chain) (#21421) Co-authored-by: huseyinaztekintr-ctrl Co-authored-by: FelixBruguera --- projects/el-casino/index.js | 42 ++++++++++++++++++++++++++++++++++++ projects/el-perps/index.js | 20 +++++++++++++++++ projects/el-predict/index.js | 20 +++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 projects/el-casino/index.js create mode 100644 projects/el-perps/index.js create mode 100644 projects/el-predict/index.js diff --git a/projects/el-casino/index.js b/projects/el-casino/index.js new file mode 100644 index 00000000000..4f2ab6a32ca --- /dev/null +++ b/projects/el-casino/index.js @@ -0,0 +1,42 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +// EL-Casino — on-chain casino on Robinhood Chain. Every room (roulette, crash, blackjack, slots, keno, …) is its own +// contract deployed by a game factory; it holds its own token pool that pays winnings and is funded by stakers +// ("become the house"). Rooms are listed from the factories themselves (getTotalGames / getGames). +const ELCAS = '0xE73f12D9d81ff6b11c1d0261F440c2EA4C400E18' // the protocol's own token: rooms in $ELCAS are excluded + +const FACTORIES = [ + // V4 game factories + '0x0a6A06F446CC02Da7a60f5626CC2b9aA27b875f9', '0xEffAbF2a88Ce69175dE0800f9b8Eeb3622ac43b9', '0x9CD4669Ec061f02D594807eE6ADC9502E7d5042b', + '0x2E615291ecb0a9EF73b8c35771D4746C255aDEfA', '0x2Cd48ACA526D1C68967b5B7ABBc6C48Ef74f4955', '0x72dc6929D0EC4f519B351D4f12E578D17993cf5e', + '0xE22Ce157f4b8c07311320050f2aC1D0902AD3b27', '0x86E96B1E6bD78279E60cFF9a9b67794d1F33eb6d', '0x0FFCed9E20A00B05eC142C41239AB6a046c9Cecc', + '0x89B404BA6ED15FC98684Ed34548B3A6c2146b4f5', '0x8166D47477278E0114FDB89C30362214539C4F18', + // V5 game factories (CasinoHubV5 0xF844142E6F0474a115712d650e58F238f760555d) + '0x5B9dF3831d50af1b02AE0bdF3061C744C45087b0', '0xbf976d1b6efF1B047f8aE2A5d6259D689b4A536B', '0x4E83A441F280fE9a07DeB88a4a3F4D14Bf5400Eb', + '0x9b5037eF17598Ff5B6C16d6a9e027c72897828eB', '0x08A9DF94F9C5DE378A283cC4a44Da09909CE3Ab6', '0xCa6F1bE59C06EA6E14412A387eD5f3bCb71B2248', + '0x5231c0282025799aB38b317F89470C6b7C153A77', '0x7E8bA129e445771dc7a514D5F9E1179a23c1beb4', '0x31929aCE4FBa4C9c98A29559b1aA8D5cf18414a7', + '0x15DdCF1C6F7CB8A7dfBb9aca792F6CbAcABAa27f', '0xd2Bf1fe7D418C011c8A2b2bD64298Dd3ed9cEF80', '0xae7994D4e25f2965367B55950A1a95a930Aa554A', + '0x10e02DD0F131Cbb55a97fef5b724541B8A6b378C', '0x6751dD9ADBCE7913Fea529FDe5E561422D017725', '0x553220711d5683205a2644a77755Ba6f7E34b31b', + '0x25Ac8B77B8e32B1eA9C431127679e4Ff11eC4FA4', '0x7C7ad1370a26E1a7e67A778E9C9820637f76BC1d', '0x796d695569520BE3963CB620A3a3c53b92B606a4', + '0x64D84eAcEdEe214995d1b30febD8720131DAEE9f', '0x2935fDb03C2F4f4fb32D29032F46357706519268', '0x6dFF48299Ac1Ff559DcEdDDf28AF3B1e5140c6A4', +] +const getGames = 'function getGames(uint256 offset, uint256 limit) view returns (tuple(address gameAddress, address owner, address creator, address token, string tokenLogoUrl, string betName, uint256 createdAt)[])' +const PAGE = 200 + +async function rooms(api) { + const totals = await api.multiCall({ abi: 'uint256:getTotalGames', calls: FACTORIES }) + const calls = [] + FACTORIES.forEach((f, i) => { for (let o = 0; o < Number(totals[i]); o += PAGE) calls.push({ target: f, params: [o, PAGE] }) }) + return (await api.multiCall({ abi: getGames, calls })).flat() +} + +async function tvl(api) { + const tokensAndOwners = (await rooms(api)).filter((g) => g.token.toLowerCase() !== ELCAS.toLowerCase()).map((g) => [g.token, g.gameAddress]) + return sumTokens2({ api, tokensAndOwners }) +} + +module.exports = { + methodology: 'Sums the tokens held by every EL-Casino room, listed from the V4 and V5 game factories: each room\'s token pool pays winnings and is funded by stakers ("become the house"). Rooms whose pool is in $ELCAS, the protocol\'s own token, are excluded.', + start: '2026-09-01', + robinhood: { tvl }, +} diff --git a/projects/el-perps/index.js b/projects/el-perps/index.js new file mode 100644 index 00000000000..65c05a94c83 --- /dev/null +++ b/projects/el-perps/index.js @@ -0,0 +1,20 @@ +// EL Perps (by EL-Casino) — permissionless perpetuals on Robinhood Chain. +// ElcasMarketsHub (source verified on Sourcify) gives every margin token its own book, a minimal clone created with +// CREATE2. A book holds, in its margin token: each market's LP vault (the traders' counterparty), the traders' margin, +// and fee shares accrued for the platform / market creators but not claimed yet (owedTotal — not user money). +const HUB = '0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45' +const ELCAS = '0xE73f12D9d81ff6b11c1d0261F440c2EA4C400E18' // the protocol's own token: excluded + +async function tvl(api) { + const tokens = (await api.call({ abi: 'address[]:allPerpsTokens', target: HUB })).filter((t) => t.toLowerCase() !== ELCAS.toLowerCase()) + const owners = await api.multiCall({ abi: 'function perpsBook(address) view returns (address)', target: HUB, calls: tokens }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map((t, i) => ({ target: t, params: [owners[i]] })) }) + const owed = await api.multiCall({ abi: 'uint256:owedTotal', calls: owners }) + tokens.forEach((token, i) => api.add(token, BigInt(bals[i]) - BigInt(owed[i]))) +} + +module.exports = { + methodology: 'Lists every perps book from ElcasMarketsHub (one per margin token) and counts each book\'s balance of its margin token — LP vaults and traders\' margin — minus the fee shares accrued for the platform and market creators but not yet claimed. Books margined in $ELCAS, the protocol\'s own token, are excluded.', + start: '2026-10-06', + robinhood: { tvl }, +} diff --git a/projects/el-predict/index.js b/projects/el-predict/index.js new file mode 100644 index 00000000000..43b6070db7f --- /dev/null +++ b/projects/el-predict/index.js @@ -0,0 +1,20 @@ +// EL Predict (by EL-Casino) — UP / DOWN price rounds on Robinhood Chain. +// ElcasMarketsHub (source verified on Sourcify) gives every stake token its own book, a minimal clone created with +// CREATE2. A book holds, in its stake token: each market's house vault (anyone can LP), players' stakes in open rounds, +// unclaimed winnings, and fee shares accrued for the platform / market creators but not claimed yet (owedTotal). +const HUB = '0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45' +const ELCAS = '0xE73f12D9d81ff6b11c1d0261F440c2EA4C400E18' // the protocol's own token: excluded + +async function tvl(api) { + const tokens = (await api.call({ abi: 'address[]:allPredictTokens', target: HUB })).filter((t) => t.toLowerCase() !== ELCAS.toLowerCase()) + const owners = await api.multiCall({ abi: 'function predictBook(address) view returns (address)', target: HUB, calls: tokens }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map((t, i) => ({ target: t, params: [owners[i]] })) }) + const owed = await api.multiCall({ abi: 'uint256:owedTotal', calls: owners }) + tokens.forEach((token, i) => api.add(token, BigInt(bals[i]) - BigInt(owed[i]))) +} + +module.exports = { + methodology: 'Lists every prediction book from ElcasMarketsHub (one per stake token) and counts each book\'s balance of its stake token — house vaults, stakes in open rounds and unclaimed winnings — minus the fee shares accrued for the platform and market creators but not yet claimed. Books staked in $ELCAS, the protocol\'s own token, are excluded.', + start: '2026-10-06', + robinhood: { tvl }, +} From de74a9e8e211a7c45c067581f26a94ea1b2cbb2b Mon Sep 17 00:00:00 2001 From: bonker-wtf-dev <325783826+bonker-wtf-dev@users.noreply.github.com> Date: Wed, 7 Oct 2026 09:21:56 +0200 Subject: [PATCH 116/988] bonker: add Arc TVL (#21158) Co-authored-by: ccipherx --- projects/bonker/index.js | 21 ++++++++++++++++----- projects/helper/unwrapLPs.js | 7 ++++--- projects/helper/utils/tick.js | 26 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/projects/bonker/index.js b/projects/bonker/index.js index 4971aa48fd6..8cfa8a63a92 100644 --- a/projects/bonker/index.js +++ b/projects/bonker/index.js @@ -13,7 +13,7 @@ const OWNER_OF_ABI = 'function ownerOf(uint256 tokenId) view returns (address)' // held by a superseded one, which is exactly what happened on Robinhood Chain's 2026-09-09 // redeploy (the old locker's fee-conversion swap couldn't decode that chain's forked router, but // it kept every liquidity position it already held). -function tvlForChain({ lockers, positionManager, weth, startBlock }) { +function tvlForChain({ lockers, positionManager, pairedToken, stateViewer, startBlock }) { return async (api) => { const allLockedPositionIds = [] @@ -53,8 +53,10 @@ function tvlForChain({ lockers, positionManager, weth, startBlock }) { api, resolveUniV4: true, uniV4ExtraConfig: { + nftAddress: positionManager, positionIds: allLockedPositionIds, - whitelistedTokens: [weth], + stateViewer, + whitelistedTokens: [pairedToken], }, }) } @@ -62,14 +64,14 @@ function tvlForChain({ lockers, positionManager, weth, startBlock }) { module.exports = { methodology: - 'Counts the WETH side of Uniswap V4 liquidity positions created by the Bonker factory and permanently held by a Bonker LP locker. Positions are enumerated on-chain from TokenRewardAdded events, and launchpad-minted tokens are excluded to avoid circular pricing. A chain can have more than one locker across its history since setLocker() only adds, never replaces, so every locker that has ever been live on a chain is summed.', + 'Counts the paired-currency side of Uniswap V4 liquidity positions created by the Bonker factory and permanently held by a Bonker LP locker. Positions are enumerated on-chain from TokenRewardAdded events, and launchpad-minted tokens are excluded to avoid circular pricing. A chain can have more than one locker across its history since setLocker() only adds, never replaces, so every locker that has ever been live on a chain is summed.', start: '2026-03-06', doublecounted: true, base: { tvl: tvlForChain({ lockers: ['0xBf05b1d5E356f3219D0086A4e09c969ADbe2e7d0'], positionManager: '0x7C5f5A4bBd8fD63184577525326123B519429bDc', - weth: ADDRESSES.base.WETH, + pairedToken: ADDRESSES.base.WETH, startBlock: 43_000_832, }), }, @@ -83,8 +85,17 @@ module.exports = { '0x97d863C592ffe30c8D8621c869f143cF34F18A9D', ], positionManager: '0x58daec3116aae6d93017baaea7749052e8a04fa7', - weth: ADDRESSES.robinhood.WETH, + pairedToken: ADDRESSES.robinhood.WETH, startBlock: 53_621_593, }), }, + arc: { + tvl: tvlForChain({ + lockers: ['0x7Fe433A7E1a89ab598834ac2fB0695041F8DB7Ca'], + positionManager: '0x6049c9a0e26405C0985f9E3685C87d0aE917f82B', + pairedToken: ADDRESSES.arc.USDC, + stateViewer: '0xf3334192d15450cdd385c8b70e03f9a6bd9e673b', + startBlock: 21_167_882, + }), + }, } diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index ecc51fec77e..d93a8ac1e9d 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -12,7 +12,7 @@ const uniV3ABI = require('./abis/uniV3.json'); const slipstreamNftABI = require('../arcadia-finance-v2/slipstreamNftABI.json'); const { covalentGetTokens, } = require("./token"); const SOLIDLY_VE_NFT_ABI = require('./abis/solidlyVeNft.json'); -const { tickToPrice } = require('./utils/tick'); +const { tickToPrice, getSqrtPriceX96AtTick } = require('./utils/tick'); const { queryAllium } = require('./allium'); const { cachedGraphQuery } = require('./cache'); @@ -288,8 +288,9 @@ async function unwrapUniswapV4NFT({ balances, nftAddress, stateViewer, api, blac const bottomTick = +position.tickLower const topTick = +position.tickUpper const sp = lpInfo[getKey(position)].sqrtPrice - const sa = tickToPrice(bottomTick / 2) - const sb = tickToPrice(topTick / 2) + // exact edges: 1.0001 ** (tick / 2) drifts ~1e-12 from TickMath, which misvalues positions priced at an edge + const sa = Number(getSqrtPriceX96AtTick(bottomTick)) / 2 ** 96 + const sb = Number(getSqrtPriceX96AtTick(topTick)) / 2 ** 96 let amount0 = 0 let amount1 = 0 diff --git a/projects/helper/utils/tick.js b/projects/helper/utils/tick.js index cc7470a19e2..ca0f43754fe 100644 --- a/projects/helper/utils/tick.js +++ b/projects/helper/utils/tick.js @@ -167,8 +167,34 @@ function i32BitsToNumber(v) { return asIntN(BigInt(v), 32); } +// exact Uniswap TickMath.getSqrtPriceAtTick, returns sqrtPriceX96 as BigInt +const SQRT_PRICE_MULTIPLIERS = [ + 0xfffcb933bd6fad37aa2d162d1a594001n, 0xfff97272373d413259a46990580e213an, + 0xfff2e50f5f656932ef12357cf3c7fdccn, 0xffe5caca7e10e4e61c3624eaa0941cd0n, + 0xffcb9843d60f6159c9db58835c926644n, 0xff973b41fa98c081472e6896dfb254c0n, + 0xff2ea16466c96a3843ec78b326b52861n, 0xfe5dee046a99a2a811c461f1969c3053n, + 0xfcbe86c7900a88aedcffc83b479aa3a4n, 0xf987a7253ac413176f2b074cf7815e54n, + 0xf3392b0822b70005940c7a398e4b70f3n, 0xe7159475a2c29b7443b29c7fa6e889d9n, + 0xd097f3bdfd2022b8845ad8f792aa5825n, 0xa9f746462d870fdf8a65dc1f90e061e5n, + 0x70d869a156d2a1b890bb3df62baf32f7n, 0x31be135f97d08fd981231505542fcfa6n, + 0x9aa508b5b7a84e1c677de54f3e99bc9n, 0x5d6af8dedb81196699c329225ee604n, + 0x2216e584f5fa1ea926041bedfe98n, 0x48a170391f7dc42444e8fa2n, +] + +function getSqrtPriceX96AtTick(tick) { + if (!Number.isInteger(tick) || Math.abs(tick) > 887272) throw new Error('Invalid tick: ' + tick) + const absTick = Math.abs(tick) + let ratio = 1n << 128n + SQRT_PRICE_MULTIPLIERS.forEach((multiplier, bit) => { + if (absTick & (1 << bit)) ratio = (ratio * multiplier) >> 128n + }) + if (tick > 0) ratio = ((1n << 256n) - 1n) / ratio + return (ratio + (1n << 32n) - 1n) >> 32n +} + module.exports = { tickToPrice, tickIndexToSqrtPriceX64, i32BitsToNumber, + getSqrtPriceX96AtTick, } \ No newline at end of file From 656516b40505ecc26a1ee72155a65b02aad45bfc Mon Sep 17 00:00:00 2001 From: Berafarm Date: Wed, 7 Oct 2026 12:53:39 +0530 Subject: [PATCH 117/988] Add Berafarm TVL adapter (Berachain) (#21454) Co-authored-by: TusharTapadia --- projects/berafarm/index.js | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 projects/berafarm/index.js diff --git a/projects/berafarm/index.js b/projects/berafarm/index.js new file mode 100644 index 00000000000..b8a36780e70 --- /dev/null +++ b/projects/berafarm/index.js @@ -0,0 +1,41 @@ +// Berafarm: senior/junior tranche vaults. Each vault deposits its base token +// through a StrategyManager into external strategies (lending markets, LPs). +// Vaults are discovered from the TrancheVaultFactory, and every manager's NAV +// is read from the protocol's DataEmitterFixed view contract. + +const config = { + berachain: { + factories: ['0xfD2A077Fa8E81A258f85e21365EeaC5e6e92f109'], + dataEmitter: '0x63245b18f70487038c885558Df242B9B357EB50F', + }, +} + +const abi = { + getTrancheVaultInfo: 'function getTrancheVaultInfo(uint256) view returns ((uint256 index, address trancheVault, address strategyManager, address vaultManagerConfig, address feeModule, address accessController, address seniorToken, address juniorToken))', + getTrancheTvl: 'function getTrancheTvl(address strategyManager) view returns (uint256)', +} + +async function tvl(api) { + const { factories, dataEmitter } = config[api.chain] + const vaults = (await Promise.all(factories.map((target) => api.fetchList({ + target, + lengthAbi: 'uint256:getTrancheVaultCount', + itemAbi: abi.getTrancheVaultInfo, + })))).flat() + + const managers = vaults.map((v) => v.strategyManager) + const currencies = await api.multiCall({ abi: 'address:currency', calls: managers }) + // Strategy balances + idle currency at the manager + pending rewards, in the + // manager's currency (native decimals). + const navs = await api.multiCall({ abi: abi.getTrancheTvl, target: dataEmitter, calls: managers }) + api.add(currencies, navs) +} + +module.exports = { + methodology: 'TVL is the net asset value of every Berafarm tranche vault, read on-chain from the DataEmitterFixed contract (getTrancheTvl): the base token held in each vault\'s strategies, plus idle base token at the strategy manager, plus pending strategy rewards valued in the base token. Vaults are discovered from the TrancheVaultFactory. Vault deposits are deployed into other listed protocols (Bend, Dolomite, Kodiak), so TVL is marked as double counted.', + doublecounted: true, +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl } +}) From 8e979cefdc557eb43dffb0b85587eb072245bc33 Mon Sep 17 00:00:00 2001 From: Dani Date: Wed, 7 Oct 2026 09:27:30 +0200 Subject: [PATCH 118/988] Theo Network: add thBILL Stable vault, set thUSD start (resolves #21455) (#21457) Co-authored-by: T.K. Co-authored-by: Claude Opus 5.5 --- projects/theo-network-thbill/index.js | 13 ++++++++++++- projects/theo-network-thusd/index.js | 12 +++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/projects/theo-network-thbill/index.js b/projects/theo-network-thbill/index.js index 69a80d416f5..9803409b7d6 100644 --- a/projects/theo-network-thbill/index.js +++ b/projects/theo-network-thbill/index.js @@ -19,6 +19,7 @@ const STEAKUSDT = '0xbeef003c68896c7d2c3c60d363e8d71a49ab2bf9' // Morpho Steakho const ULTRA_ARB = '0xc26af85ede9cc25d449bcebef866bb85afd5d346' const GTUSDCP_BASE = '0x050ce30b927da55177a4914ec73480238bad56f0' // Morpho Gauntlet USDC Prime (Base) const aMonUSDC = '0x35a73bacb179d3740395a3cecc87ff2e581d6042' // Aave v3 on Monad +const STABLEEARN = '0xb7Df8db22A5DBBFA9ebeb94b3910aec6a4f05c08' // Morpho StableEarn vault on Stable (ERC4626, USDT0) // Solana const ULTRA_TOKEN_ACCOUNT = '6fk5UwZXF1Zs327zV5Fbmay2xTYCqg7eM5QeNQyyu7ae' @@ -33,12 +34,19 @@ async function solanaTvl(api) { } } +// Only the backing wallet's share of the vault; the shared erc4626 helper would count every depositor. +async function stableTvl(api) { + const shares = await api.call({ abi: 'erc20:balanceOf', target: STABLEEARN, params: BACKING }) + const assets = await api.call({ abi: 'function convertToAssets(uint256 shares) view returns (uint256)', target: STABLEEARN, params: shares }) + api.add(ADDRESSES.stable.USDT0, assets) +} + module.exports = { doublecounted: true, methodology: 'thBILL TVL is the value of the reserve assets held in the thBILL backing wallets: tokenized Treasury ' + 'fund shares (ULTRA, FILQ-A), stablecoins, and stablecoin lending positions (Aave v3, Morpho vaults) ' + - 'across Ethereum, Arbitrum, Base, Monad and Solana. About 96% of thBILL supply is held as reserve by ' + + 'across Ethereum, Arbitrum, Base, Monad, Stable and Solana. About 96% of thBILL supply is held as reserve by ' + 'thUSD (see Theo Network thUSD), so this adapter is flagged doublecounted under the Theo Network parent.', hallmarks: [ ['2025-11-20', 'Reserve rotated into ULTRA on Ethereum, Arbitrum and Solana'], @@ -66,6 +74,9 @@ module.exports = { monad: { tvl: sumTokensExport({ owner: BACKING, tokens: [aMonUSDC, ADDRESSES.monad.USDC] }), }, + stable: { + tvl: stableTvl, + }, solana: { tvl: solanaTvl, }, diff --git a/projects/theo-network-thusd/index.js b/projects/theo-network-thusd/index.js index be02d554d3e..a4e99faf207 100644 --- a/projects/theo-network-thusd/index.js +++ b/projects/theo-network-thusd/index.js @@ -8,13 +8,15 @@ const thBILL = '0x5fa487bca6158c64046b2813623e20755091da0b' // 6 decimals, NAV const RESERVE = '0xEc417Ccb6dD26868Cca993a92F37217b1D4b3c2f' // thUSD reserve wallet module.exports = { + start: '2026-04-09', // thUSD deployed 2026-04-08 methodology: 'thUSD TVL equals circulating thUSD supply, built from the reserve side. On-chain reserves held in the ' + 'thUSD reserve wallet — thBILL (valued at thBILL contract NAV via convertToAssets, not market price), ' + - 'USDC and USDT — are reported as those assets. The remainder of supply is backed by physical gold ' + - 'purchased and leased through StoneX and Monetary Metals and hedged with CME gold futures, and is ' + - 'reported as thUSD. thBILL held in the reserve is also tracked by the Theo Network thBILL adapter, ' + - 'which is flagged doublecounted under the Theo Network parent.', + 'USDC and USDT — are reported as those assets. The remainder of supply is backed by physical gold and silver ' + + 'purchased and leased through StoneX and Monetary Metals, part of it tokenized as thGOLD and thSLVR held in the ' + + 'reserve wallet, with the gold position hedged with CME gold futures, and is reported as thUSD. thBILL held in ' + + 'the reserve is also tracked by the Theo Network thBILL adapter, which is flagged doublecounted under the Theo ' + + 'Network parent.', hallmarks: [ ['2026-04-27', 'thUSD reserve migrated to current reserve wallet'], ['2026-05-01', 'Gold carry strategy funded'], @@ -41,7 +43,7 @@ module.exports = { }) api.add(ADDRESSES.ethereum.USDC, thbillUsdc) - // 3. Off-chain gold reserves = the remainder of supply not covered by on-chain reserves. + // 3. Off-chain metal reserves = the remainder of supply not covered by on-chain reserves. // Added unconditionally, as in projects/ethena, so the total is always exactly thUSD supply: // were on-chain reserves ever to exceed supply, this residual goes negative and nets it back down. const onchainUsd = await api.getBalancesV2().getUSDValue() From 4a41303b57ddda0657c11a0e4b98b34b9d76ddab Mon Sep 17 00:00:00 2001 From: Eren Jaegar <88328748+erenjaegar77@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:32:44 -0300 Subject: [PATCH 119/988] beefy: support arc chain (#21442) --- projects/beefy/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/beefy/index.js b/projects/beefy/index.js index d9a1690f0e8..c6e9cf47c97 100644 --- a/projects/beefy/index.js +++ b/projects/beefy/index.js @@ -55,6 +55,7 @@ const chains = { kava: 2222, megaeth: 4326, mantle: 5000, + arc: 5042, saga: 5464, canto: 7700, base: 8453, @@ -126,6 +127,7 @@ const beefyChainNameMapping = { 'harmony': 'harmony', 'megaeth': 'megaeth', 'robinhood': 'robinhood', + 'arc': 'arc', }; async function fetchVaultData() { From f10eea067aead8b73695512d4ff5ffe58dcfd20e Mon Sep 17 00:00:00 2001 From: Nathan Date: Wed, 7 Oct 2026 10:42:58 +0300 Subject: [PATCH 120/988] bullgems (#21453) Co-authored-by: ccipherx --- projects/bullgems/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/bullgems/index.js diff --git a/projects/bullgems/index.js b/projects/bullgems/index.js new file mode 100644 index 00000000000..74497df0479 --- /dev/null +++ b/projects/bullgems/index.js @@ -0,0 +1,23 @@ +const { getLogs } = require('../helper/cache/getLogs') + +const FACTORY = '0x9ace767D8654F79cD63a959C103c8ceb70DCffcb' +const FROM_BLOCK = 75186640 + +async function tvl(api) { + const logs = await getLogs({ + api, + target: FACTORY, + eventAbi: 'event TokenCreated(address indexed token, address indexed curve, address indexed creator, bytes32 imageHash, bool original)', + fromBlock: FROM_BLOCK, + onlyArgs: true, + }) + if (!logs.length) return + const quotes = await api.multiCall({ abi: 'uint256:realQuote', calls: logs.map(i => i.curve) }) + api.addGasToken(quotes) +} + +module.exports = { + start: '2026-09-28', + methodology: 'ETH sitting on live BullGems curves (realQuote). The memecoin, virtual reserves, fee pots and treasury are not included.', + robinhood: { tvl }, +} From 85fc9bd469ed9d16716f5062585b6837825dc1a0 Mon Sep 17 00:00:00 2001 From: Ben Walther <156485944+ethos-ben@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:44:09 -0700 Subject: [PATCH 121/988] Ethos: count WHUF in ethos-network staking and ethos-markets TVL (#21450) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- registries/sumTokens/data3.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index daa441425b8..e668eeba688 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -37,17 +37,19 @@ module.exports = { }, }, "ethos-network": { - "methodology": "Measures the total amount of ETH stored in the Vouch contract. Each vouch represents a trust relationship backed by ETH.", + "methodology": "TVL is the ETH held in the v1 Vouch contract. Staking is the WHUF held in the EthosVouchV2 contract. Each vouch represents a trust relationship backed by ETH or WHUF.", "start": "2025-01-21", "base": { "tvl": { "owner": "0xD89E6B7687f862dd6D24B3B2D4D0dec6A89A6fdd", "tokens": [ADDRESSES.null] }, + "staking": { "owners": ["0x8B5Ef9c00152CaDBfedA4f59212EDB6e2e45de11"], "tokens": ["0xeeee77bC7e82c0d4166d52F58239D4c5Bf41eeee"] }, }, }, "ethos-markets": { - "methodology": "Measures the total amount of ETH stored in the Reputation Markets contract. Markets allow trading trust/distrust votes against Ethos network profiles on an AMM.", + "methodology": "TVL is the ETH held in the v1 Reputation Markets contract. Staking is the WHUF held in the EthosMarket contract. Markets allow trading trust/distrust votes against Ethos network profiles on an AMM.", "start": "2025-01-21", "base": { "tvl": { "owner": "0xC26F339F4E46C776853b1c190eC17173DBe059Bf", "tokens": [ADDRESSES.null] }, + "staking": { "owners": ["0x27F49210bc000BEE3197aFB4397969df35810919"], "tokens": ["0xeeee77bC7e82c0d4166d52F58239D4c5Bf41eeee"] }, }, }, "king-finance": { From 303aa24b068c211cc8af9cafd9572403d560f3b9 Mon Sep 17 00:00:00 2001 From: yawningmonsoon Date: Wed, 7 Oct 2026 09:45:18 +0200 Subject: [PATCH 122/988] t3rn: add the TRN lock escrow on Arbitrum (ownTokens) (#21449) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/t3rn/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/t3rn/index.js b/projects/t3rn/index.js index 63c68d48125..956a10b2642 100644 --- a/projects/t3rn/index.js +++ b/projects/t3rn/index.js @@ -76,13 +76,14 @@ const ARBITRUM_STAKING = [ '0xC5a87664DCFD45B1bF646cFD209c5a54118B146B', // stakedTRNChef '0x536e9D7328276BAaE13Df7028dCF8d37bBa2F2Cd', // govAdapter '0x8B09F3B41203ec18Ec2E80eEc1bd57A91f21DB7D', // syrupBar + '0xCff7404874ffb1Ab1Cc62631bfE097C391b6491d', // TRN lock escrow, backs TRN released on Base, Arc and Robinhood Chain ] module.exports = { hallmarks:[ ], methodology: - "t3rn TVL is the USD value of token balances in the bridge contracts and TRN tokens staked on Arbitrum.", + "t3rn TVL is the USD value of token balances in the bridge contracts. TRN staked on Arbitrum and TRN locked in the TRN lock escrow on Arbitrum (bridged to Base, Arc and Robinhood Chain) is the protocol's own token and is counted under staking.", } Object.keys(CONFIG).forEach(chain => module.exports[chain] = { From 489048caa746b22d8e03abe0cd9536d0cbe36665 Mon Sep 17 00:00:00 2001 From: yawningmonsoon Date: Wed, 7 Oct 2026 09:46:01 +0200 Subject: [PATCH 123/988] Add Taifoon (ICP bridge) (#21448) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- registries/sumTokens.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 2a5b5aabd5b..a7fbb05e7a0 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -27498,6 +27498,14 @@ const configs = { ] }, }, + "taifoon": { + "methodology": "TVL is the ICP held on the ICP ledger by the tICP bridge custody canister (dkafq-4aaaa-aaaaj-a6ysq-cai, default account). It backs the tICP released on Base, Arc and Robinhood Chain.", + "icp": { + "owners": [ + "dkafq-4aaaa-aaaaj-a6ysq-cai" + ] + }, + }, "tangent-protocol": { "cardano": { "tvl": { From 27e8f09c714cfc209c513bf761a01fbed1d0ebdc Mon Sep 17 00:00:00 2001 From: routebuilder Date: Wed, 7 Oct 2026 09:47:08 +0200 Subject: [PATCH 124/988] Add exploit hallmarks for nostra, aquifer, bitget (#21446) Co-authored-by: ccipherx --- projects/aquifer/index.js | 3 +++ projects/bitget/index.js | 4 +++- projects/nostra/index.js | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/aquifer/index.js b/projects/aquifer/index.js index 6fccbf9b858..7bfa400928e 100644 --- a/projects/aquifer/index.js +++ b/projects/aquifer/index.js @@ -29,5 +29,8 @@ module.exports = { timetravel: false, methodology: "TVL is the value of assets held in the program-derived token account of every Coin registered to Aquifer's official Solana DEX.", + hallmarks: [ + ["2026-08-31", "Exploit (~$2.5M)"], + ], solana: { tvl }, } diff --git a/projects/bitget/index.js b/projects/bitget/index.js index 8a7c2fe3978..182b3a8c6cd 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -255,4 +255,6 @@ const withdrawalAddresses = [ module.exports = mergeExports([ cexExports(config), { ethereum: { tvl: getStakedEthTVL({ withdrawalAddresses: withdrawalAddresses, size: 200, sleepTime: 20_000, proxy: true }) } }, -]) \ No newline at end of file +]) + +module.exports.hallmarks = [["2026-09-24", "Hot-wallet hack (~$387M)"]] \ No newline at end of file diff --git a/projects/nostra/index.js b/projects/nostra/index.js index 1db1607d85f..6a6ed286512 100644 --- a/projects/nostra/index.js +++ b/projects/nostra/index.js @@ -172,6 +172,9 @@ async function borrowed(api) { module.exports = { methodology: "The TVL is calculated as a difference between supplied and borrowed assets.", + hallmarks: [ + ["2026-09-17", "Exploit (~$3.5M)"], + ], starknet: { tvl, borrowed: () => ({}), // hacked From 801243160bdd3b1425664a3c4ad9916afac3b3a3 Mon Sep 17 00:00:00 2001 From: pseudoatellipsis Date: Wed, 7 Oct 2026 03:48:29 -0400 Subject: [PATCH 125/988] phoenix-perp: add TVL adapter (#21447) Co-authored-by: pseudoatellipsis <321824326+pseudoatellipsis@users.noreply.github.com> --- projects/phoenix-perp/index.js | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 projects/phoenix-perp/index.js diff --git a/projects/phoenix-perp/index.js b/projects/phoenix-perp/index.js new file mode 100644 index 00000000000..db3a1c5823b --- /dev/null +++ b/projects/phoenix-perp/index.js @@ -0,0 +1,37 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getConnection, sumTokens2 } = require('../helper/solana') +const { PublicKey } = require('@solana/web3.js') +const { bs58 } = require('@project-serum/anchor/dist/cjs/utils/bytes') + +const PHOENIX_PROGRAM = new PublicKey('EtrnLzgbS7nMMy5fbD42kXiUzGg8XQzJ972Xtk1cjWih') +const EMBER_PROGRAM = new PublicKey('EMBERpYNE6ehWmXymZZS2skiFmCa9V5dp14e1iduM5qy') + +// USDC backing all perp collateral: Ember vault PDA, seeds [phoenix_program_id, "vault"] +const [USDC_VAULT] = PublicKey.findProgramAddressSync([PHOENIX_PROGRAM.toBuffer(), Buffer.from('vault')], EMBER_PROGRAM) + +// native SOL is held as lamports on each trader account, on top of rent +const TRADER_DISCRIMINATOR = Buffer.from('296149696ed67009', 'hex') + +async function tvl(api) { + const connection = getConnection() + const traders = await connection.getProgramAccounts(PHOENIX_PROGRAM, { + filters: [{ memcmp: { offset: 0, bytes: bs58.encode(TRADER_DISCRIMINATOR) } }], + dataSlice: { offset: 0, length: 0 }, + }) + + // trader accounts come in several sizes, each with its own rent-exempt minimum + const rentBySize = {} + for (const size of new Set(traders.map(({ account }) => account.space))) + rentBySize[size] = await connection.getMinimumBalanceForRentExemption(size) + + const lamports = traders.reduce((sum, { account }) => sum + Math.max(account.lamports - rentBySize[account.space], 0), 0) + api.add(ADDRESSES.solana.SOL, lamports) + + return sumTokens2({ api, tokenAccounts: [USDC_VAULT.toBase58()] }) +} + +module.exports = { + timetravel: false, + methodology: 'TVL is trader funds on Phoenix perps: USDC held in the Ember vault that backs all deposits, plus native SOL held on trader accounts (rent excluded).', + solana: { tvl }, +} From cc1670be7ecc3ecfea8510e86b0465f2b05ac952 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 7 Oct 2026 10:52:08 +0200 Subject: [PATCH 126/988] fix jigsaw --- projects/jigsaw/index.js | 69 ++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 41 deletions(-) diff --git a/projects/jigsaw/index.js b/projects/jigsaw/index.js index ac351d53d13..a3f12d524bb 100644 --- a/projects/jigsaw/index.js +++ b/projects/jigsaw/index.js @@ -1,47 +1,34 @@ -const {request, gql} = require("graphql-request") +const { getLogs } = require('../helper/cache/getLogs') -const BASE_MAINNET_SUBGRAPH_URL = 'https://subgraph.satsuma-prod.com/5b49793e7bcd/jigsaw--557177/jigsaw-protocol/version/v0.0.1/api' +// jUSD.manager() -> 0x0000000E44A948Ab0c83F2C65D3a2C4A06B05228, Manager.stablesManager() -> +const STABLES_MANAGER = '0x00000000Fb1d443a8D2aAAEE72ce4c55b8dB04B7' +const FROM_BLOCK = 21500000 -async function fetchAllSubgraphResults({url, query, field, variables = {}}) { - let skip = 0; - let allResults = []; - let hasMore = true; - while (hasMore) { - const data = await request(url, query, {...variables, skip}); - const results = data[field]; - allResults = [...allResults, ...results]; - if (results.length < 1000) { - hasMore = false; - } else { - skip += 1000; - } - } - return allResults; -} - -async function collaterals(_, _1, _2, {api}) { - const query = gql` - query GetCollaterals { - collaterals { id, amount } - } - `; - const allCollaterals = await fetchAllSubgraphResults({ - url: BASE_MAINNET_SUBGRAPH_URL, - query, - field: "collaterals", - }); +async function tvl(api) { + const registryLogs = await getLogs({ + api, target: STABLES_MANAGER, fromBlock: FROM_BLOCK, onlyArgs: true, + eventAbi: 'event RegistryAdded(address indexed token, address indexed registry)', + }) + const updatedLogs = await getLogs({ + api, target: STABLES_MANAGER, fromBlock: FROM_BLOCK, onlyArgs: true, extraKey: 'registry-updated', + eventAbi: 'event RegistryUpdated(address indexed token, address indexed registry)', + }) + const registries = [...new Set([...registryLogs, ...updatedLogs].map(l => l.registry))] + const tokens = await api.multiCall({ abi: 'address:token', calls: registries }) - for (const collateral of allCollaterals) { - const underlyingAddress = collateral.id; - if (!underlyingAddress) continue; - api.add(underlyingAddress, collateral.amount); - } - return api.getBalances(); + for (let i = 0; i < registries.length; i++) { + const logs = await getLogs({ + api, target: registries[i], fromBlock: FROM_BLOCK, onlyArgs: true, + eventAbi: 'event CollateralAdded(address indexed user, uint256 share)', + }) + const holdings = [...new Set(logs.map(l => l.user))] + if (!holdings.length) continue + const collaterals = await api.multiCall({ abi: 'function collateral(address) view returns (uint256)', target: registries[i], calls: holdings }) + api.add(tokens[i], collaterals) + } } module.exports = { - methodology: "TVL includes all collateral locked in the protocol", - ethereum: { - tvl: collaterals, - }, -} \ No newline at end of file + methodology: 'TVL includes all collateral registered in the protocol', + ethereum: { tvl }, +} From 07a9a4704869135e59815475058d22b544471a86 Mon Sep 17 00:00:00 2001 From: Platy Kurtic <47456414+platykurtic-icu@users.noreply.github.com> Date: Wed, 7 Oct 2026 11:01:38 +0200 Subject: [PATCH 127/988] makina: discover machines on-chain, add Base, net out nested strategies (#21422) Co-authored-by: Claude Opus 5.5 Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/makina-finance/index.js | 116 +++++++++++++++++++++++-------- 1 file changed, 87 insertions(+), 29 deletions(-) diff --git a/projects/makina-finance/index.js b/projects/makina-finance/index.js index f8d8f0f849d..7753ec6ea34 100644 --- a/projects/makina-finance/index.js +++ b/projects/makina-finance/index.js @@ -1,37 +1,95 @@ // https://docs.makina.finance/ // https://makina.finance/ -// Makina TVL Adapter - External Pricing Version -const DUSD_TOKEN = '0x1e33e98af620f1d563fcd3cfd3c75ace841204ef'; -const DETH_TOKEN = '0x871ab8e36cae9af35c6a3488b049965233deb7ed'; -const DBIT_TOKEN = '0x972966bcc17f7d818de4f27dc146ef539c231bdf'; -const usdSHFmk_TOKEN = '0xac499adf00a54044b988a59b19016655c3494b06'; -const intMkSrRoyUSDC_TOKEN = '0x1004D230aCA4b781d0049AFD6D0b1ee8ed3A6787'; -const DQAeETH_TOKEN = '0x2b24dFcE3a6AEF36E147C692Fa32d484ec538FC1'; +const sdk = require('@defillama/sdk') +const { getLogs2 } = require('../helper/cache/getLogs') + +// Each hub chain has a HubCoreFactory that deploys its machines (and their hub calibers) and pre-deposit vaults. +// fromBlock is the first machine/pre-deposit deployment on that factory. +// Spoke calibers deployed on a chain for the other hub's machines are resolved from ethereum data only, so ethereum +// tvl never depends on base logs: +// - on ethereum, from CaliberCreated on the spoke factory (same address as the base hub factory) +// - on base, via each ethereum machine's getSpokeCaliberMailbox(8453) -> mailbox.caliber() +const hubs = { + ethereum: { + chainId: 1, factory: '0x8d28A69328561eF9F171c58996fEcB9F494e070c', fromBlock: 23426666, + spokeFactory: { address: '0x1E1fa6F5f258b744881634216bDBc612B09C3C30', fromBlock: 25834668 }, + }, + base: { + chainId: 8453, factory: '0x1E1fa6F5f258b744881634216bDBc612B09C3C30', fromBlock: 50872000, + spokeOf: 'ethereum', + }, +} + +const abi = { + MachineCreated: 'event MachineCreated(address indexed machine, address indexed shareToken)', + PreDepositVaultCreated: 'event PreDepositVaultCreated(address indexed preDepositVault, address indexed shareToken)', + CaliberCreated: 'event CaliberCreated(address indexed caliber, address indexed machineEndpoint)', + accountingToken: 'address:accountingToken', + lastTotalAum: 'uint256:lastTotalAum', + hubCaliber: 'address:hubCaliber', + getSpokeCaliberMailbox: 'function getSpokeCaliberMailbox(uint256 chainId) view returns (address)', + caliber: 'address:caliber', + convertToAssets: 'function convertToAssets(uint256 shares) view returns (uint256)', + depositToken: 'address:depositToken', +} + +// public base rpcs can lag a few blocks behind the resolved block +const getToBlock = async (api) => api.chain === 'base' ? (await api.getBlock()) - 10 : undefined + +async function getMachines(api) { + const { factory, fromBlock } = hubs[api.chain] + const logs = await getLogs2({ api, target: factory, fromBlock, eventAbi: abi.MachineCreated, extraKey: 'machines' }) + return { machines: logs.map(log => log.machine), shareTokens: logs.map(log => log.shareToken) } +} + +// calibers deployed on this chain by machines hosted on the other hub chain +async function getSpokeCalibers(api) { + const { spokeFactory, spokeOf } = hubs[api.chain] + if (spokeFactory) { + const logs = await getLogs2({ api, target: spokeFactory.address, fromBlock: spokeFactory.fromBlock, eventAbi: abi.CaliberCreated, extraKey: 'spokeCalibers' }) + return logs.map(log => log.caliber) + } + const hubApi = new sdk.ChainApi({ chain: spokeOf, timestamp: api.timestamp }) + await hubApi.getBlock() + const { machines } = await getMachines(hubApi) + // reverts for machines without a spoke caliber on this chain + const mailboxes = await hubApi.multiCall({ abi: abi.getSpokeCaliberMailbox, calls: machines.map(target => ({ target, params: [hubs[api.chain].chainId] })), permitFailure: true }) + return api.multiCall({ abi: abi.caliber, calls: mailboxes.filter(Boolean) }) +} async function tvl(api) { - const [dusdSupply, dethSupply, dbitSupply, usdSHFmkSupply, intMkSrRoyUSDCSupply, DQAeETHSupply] = await Promise.all([ - api.call({ abi: 'erc20:totalSupply', target: DUSD_TOKEN }), - api.call({ abi: 'erc20:totalSupply', target: DETH_TOKEN }), - api.call({ abi: 'erc20:totalSupply', target: DBIT_TOKEN }), - api.call({ abi: 'erc20:totalSupply', target: usdSHFmk_TOKEN }), - api.call({ abi: 'erc20:totalSupply', target: intMkSrRoyUSDC_TOKEN }), - api.call({ abi: 'erc20:totalSupply', target: DQAeETH_TOKEN }), - ]); - - return { - [DUSD_TOKEN]: dusdSupply, - [DETH_TOKEN]: dethSupply, - [DBIT_TOKEN]: dbitSupply, - [usdSHFmk_TOKEN]: usdSHFmkSupply, - [intMkSrRoyUSDC_TOKEN]: intMkSrRoyUSDCSupply, - [DQAeETH_TOKEN]: DQAeETHSupply, - }; + const { factory, fromBlock } = hubs[api.chain] + const { machines, shareTokens } = await getMachines(api) + + // a machine's AUM covers its hub caliber and all of its spoke calibers, denominated in its accounting token + const [accountingTokens, aums, hubCalibers] = await Promise.all([ + api.multiCall({ abi: abi.accountingToken, calls: machines }), + api.multiCall({ abi: abi.lastTotalAum, calls: machines }), + api.multiCall({ abi: abi.hubCaliber, calls: machines }), + ]) + api.add(accountingTokens, aums) + + // machines can allocate into other machines: net out Makina share tokens held by any Makina caliber or machine on this chain + const holders = [...hubCalibers, ...await getSpokeCalibers(api), ...machines] + const pairs = machines.flatMap((machine, i) => holders.map(holder => ({ machine, shareToken: shareTokens[i], accountingToken: accountingTokens[i], holder }))) + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls: pairs.map(({ shareToken, holder }) => ({ target: shareToken, params: [holder] })) }) + const nested = pairs.map((pair, i) => ({ ...pair, shares: balances[i] })).filter(({ shares }) => BigInt(shares) > 0n) + const nestedAssets = await api.multiCall({ abi: abi.convertToAssets, calls: nested.map(({ machine, shares }) => ({ target: machine, params: [shares] })) }) + nested.forEach(({ accountingToken }, i) => api.add(accountingToken, -BigInt(nestedAssets[i]))) + + // deposits still sitting in pre-deposit vaults that have not migrated to their machine yet + const preDepositLogs = await getLogs2({ api, target: factory, fromBlock, eventAbi: abi.PreDepositVaultCreated, extraKey: 'preDepositVaults' }) + const preDepositVaults = preDepositLogs.map(log => log.preDepositVault) + const depositTokens = await api.multiCall({ abi: abi.depositToken, calls: preDepositVaults }) + return api.sumTokens({ tokensAndOwners2: [depositTokens, preDepositVaults] }) } module.exports = { - methodology: "TVL counts the total supply of share tokens of the protocol", - misrepresentedTokens: true, - start: 23428036, - ethereum: { tvl }, -}; \ No newline at end of file + methodology: 'Machines and pre-deposit vaults are discovered from Makina factory events. TVL is the sum of each machine\'s on-chain lastTotalAum() (hub and spoke calibers combined), valued in its accounting token, plus deposit tokens still held by pre-deposit vaults. Makina share tokens held by other Makina machines or calibers are subtracted to avoid double counting nested strategies.', + start: '2025-09-24', +} + +Object.keys(hubs).forEach(chain => { + module.exports[chain] = { tvl } +}) From 81639d05140dd27e3da65860d3ea59341f62cf9d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 7 Oct 2026 12:20:58 +0200 Subject: [PATCH 128/988] default to indexer --- projects/helper/cache/getLogs.js | 2 +- registries/curators.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/helper/cache/getLogs.js b/projects/helper/cache/getLogs.js index c4b163c3274..8d4d96b8b30 100644 --- a/projects/helper/cache/getLogs.js +++ b/projects/helper/cache/getLogs.js @@ -10,7 +10,7 @@ const problematicChainSet = new Set(['rbn',]) async function getLogs({ target, topic, keys = [], fromBlock, toBlock, topics, - api, eventAbi, onlyArgs = false, extraKey, skipCache = false, onlyUseExistingCache = false, customCacheFunction, skipCacheRead = false, compressType, useIndexer }) { + api, eventAbi, onlyArgs = false, extraKey, skipCache = false, onlyUseExistingCache = false, customCacheFunction, skipCacheRead = false, compressType, useIndexer = true, }) { if (!api) throw new Error('Missing sdk api object!') if (!target) throw new Error('Missing target!') if (!fromBlock) throw new Error('Missing fromBlock!') diff --git a/registries/curators.js b/registries/curators.js index ac907a0eba7..d78e6280f39 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -1102,6 +1102,11 @@ const configs = { '0xE5EAE3770750dC9E9eA5FB1B1d81A0f9C6c3369c', ], }, + arc: { + morpho: [ + '0xabb75DcDAC72ff9a4a3603119B1e6d060f212ECA', // Aerie x Plume USDC Core (Morpho V2) + ], + }, } }, _meta: { From ddc525cd965c837ca1a0d0b172ac703664d522f3 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Wed, 7 Oct 2026 13:24:26 +0200 Subject: [PATCH 129/988] Update Kaskad adapter (RH support) (#21461) --- registries/aaveV3.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/registries/aaveV3.js b/registries/aaveV3.js index 134dd579e45..9a614d74392 100644 --- a/registries/aaveV3.js +++ b/registries/aaveV3.js @@ -101,7 +101,10 @@ const configs = { 'kaskad': { igra: { poolDatas: ['0xFEaD8E14e58ecF72B5cD585458f07523F173E2F4'] - } + }, + robinhood: { + poolDatas: ['0x9ff935c295925540077416042E3A0e1bE5276401'] + }, }, 'velkonix': { megaeth: { poolDatas: ['0x6da56B769B42952CACA18D37Feda3015FDB2fE67'], }, }, 'oter-fi': { robinhood: { poolDatas: ['0xD95D42BAd744821af78da755C6fC012f10ad1824'], }, }, From aa45ca1322ee19b050ff361671f586eb26c0db29 Mon Sep 17 00:00:00 2001 From: "Clement (AI)" Date: Wed, 7 Oct 2026 22:39:52 +0800 Subject: [PATCH 130/988] paradex-bridge: add DIME and ETH to TVL (#21459) Co-authored-by: clement-paradex-bot <265419340+clement-paradex-bot@users.noreply.github.com> Co-authored-by: DT Co-authored-by: FelixBruguera --- registries/sumTokens.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index a7fbb05e7a0..0011f3b06b2 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -21416,12 +21416,17 @@ const configs = { }, "paradex": { "ethereum": { - "owners": [ - "0xE3cbE3A636AB6A754e9e41B12b09d09Ce9E53Db3" - ], - "tokens": [ - ADDRESSES.ethereum.USDC - ] + "tvl": { + "tokensAndOwners": [ + [ADDRESSES.ethereum.USDC, "0xE3cbE3A636AB6A754e9e41B12b09d09Ce9E53Db3"], // StarknetTokenBridge proxy (USDC + DIME) + [ADDRESSES.null, "0x45B79622C095ab834b9C8dC71013ed13B39F1B8D"], // native ETH (StarknetEthBridge) + ] + }, + "staking": { + "tokensAndOwners": [ + ["0xb32E10022FFBeDfE10bc818a1C7e67D9d87e0fa7", "0xE3cbE3A636AB6A754e9e41B12b09d09Ce9E53Db3"], // DIME + ] + } }, }, "parasset": { From c88cb0a0b10c3e586417dd7e6b504fad9f954683 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 7 Oct 2026 20:35:29 +0200 Subject: [PATCH 131/988] fix yusan and liquid-ops --- projects/LiquidOps/index.js | 1 + projects/yusan/index.js | 84 +++++-------------------------------- 2 files changed, 11 insertions(+), 74 deletions(-) diff --git a/projects/LiquidOps/index.js b/projects/LiquidOps/index.js index 5a07ff49d76..4208d5db1ca 100644 --- a/projects/LiquidOps/index.js +++ b/projects/LiquidOps/index.js @@ -118,6 +118,7 @@ async function borrowed() { module.exports = { + deadFrom: '2026-10-07', // cu.ardrive.io is gone and public AO CUs only serve whitelisted processes methodology: methodologies.lendingMarket, ao: { tvl, borrowed }, }; diff --git a/projects/yusan/index.js b/projects/yusan/index.js index c375ff62969..ba33b2aa00d 100644 --- a/projects/yusan/index.js +++ b/projects/yusan/index.js @@ -1,7 +1,6 @@ const { getCache } = require('../helper/http') const YUSAN_API = 'https://yusan.fi/metrics_json' -const ONESEC_API = 'https://1sec.to/api/balances' const tokens = { ICP: { decimals: 8, coingeckoId: 'internet-computer' }, @@ -11,69 +10,14 @@ const tokens = { ckDOGE: { decimals: 8, coingeckoId: 'dogecoin' }, } -const chainTokens = { - icp: ['ICP'], - bitcoin: ['ckBTC'], - doge: ['ckDOGE'], - ethereum: ['USDC', 'USDT'], - arbitrum: ['USDC'], - base: ['USDC'], -} - -function parseBalance(str) { - if (!str) return 0 - return Number(str.toString().replace(/_/g, '')) -} - -function calcChainShare(supply, bridgeData, chain, relevantChains) { - if (!bridgeData) return supply - - const total = relevantChains - .reduce((sum, c) => sum + parseBalance(bridgeData[c]), 0) - - if (total === 0) return supply - - const chainBalance = parseBalance(bridgeData[chain]) - return (supply * chainBalance) / total -} - -function createTvl(chain) { - return async (api) => { - const [yusan, bridge] = await Promise.all([ - getCache(YUSAN_API), - getCache(ONESEC_API), - ]) - - for (const symbol of chainTokens[chain]) { - const { decimals, coingeckoId } = tokens[symbol] - const supply = yusan.tokens[symbol]?.total_supply || 0 - const borrow = yusan.tokens[symbol]?.total_borrow || 0 - const available = supply - borrow - if (available <= 0) continue - - // Check if token is on multiple chains - const chainsWithToken = Object.entries(chainTokens) - .filter(([, syms]) => syms.includes(symbol)) - .map(([c]) => c) - - let amount = available - if (chainsWithToken.length > 1) { - amount = calcChainShare(available, bridge[symbol], chain, chainsWithToken) - } - - if (amount > 0) { - api.addCGToken(coingeckoId, amount / 10 ** decimals) - } - } +async function tvl(api) { + const data = await getCache(YUSAN_API) - // Add liquidation pool balances to ICP chain (where the pool resides) - if (chain === 'icp' && yusan.liquidation_pool) { - for (const [symbol, balance] of Object.entries(yusan.liquidation_pool)) { - if (!tokens[symbol] || balance <= 0) continue - const { decimals, coingeckoId } = tokens[symbol] - api.addCGToken(coingeckoId, balance / 10 ** decimals) - } - } + for (const [symbol, { decimals, coingeckoId }] of Object.entries(tokens)) { + const supply = data.tokens[symbol]?.total_supply || 0 + const borrow = data.tokens[symbol]?.total_borrow || 0 + const available = supply - borrow + if (available > 0) api.addCGToken(coingeckoId, available / 10 ** decimals) } } @@ -82,20 +26,12 @@ async function borrowed(api) { for (const [symbol, { decimals, coingeckoId }] of Object.entries(tokens)) { const balance = data.tokens[symbol]?.total_borrow || 0 - if (balance > 0) { - api.addCGToken(coingeckoId, balance / 10 ** decimals) - } + if (balance > 0) api.addCGToken(coingeckoId, balance / 10 ** decimals) } } module.exports = { timetravel: false, - methodology: - 'Cross-chain lending protocol. Deposits attributed to origin chains.', - icp: { tvl: createTvl('icp'), borrowed }, - bitcoin: { tvl: createTvl('bitcoin') }, - doge: { tvl: createTvl('doge') }, - ethereum: { tvl: createTvl('ethereum') }, - arbitrum: { tvl: createTvl('arbitrum') }, - base: { tvl: createTvl('base') }, + methodology: 'TVL is supplied assets minus borrowed assets in Yusan lending markets.', + icp: { tvl, borrowed }, } From 740a6367e808c3ecd4d85dc5eb766406682b7b81 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 7 Oct 2026 15:42:34 -0400 Subject: [PATCH 132/988] disable v2 vault from locus (#21474) --- projects/locus/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/locus/index.js b/projects/locus/index.js index 485877be964..8bebd3d431a 100644 --- a/projects/locus/index.js +++ b/projects/locus/index.js @@ -11,7 +11,7 @@ const CONFIG = { arbitrum: { vaults: { v1: ['0x515f3533a17E2EEFB13313D9248f328C94dBe641'], - v2: ['0x6318938F825F57d439B3a9E25C38F04EF97987D8'], + // v2: ['0x6318938F825F57d439B3a9E25C38F04EF97987D8'], }, staking: { token: '0xe1d3495717f9534db67a6a8d4940dd17435b6a9e', From 1d39c58de4eb6fe0ef946e292d9140829f3dd2a5 Mon Sep 17 00:00:00 2001 From: Flip-FriendSpace Date: Thu, 8 Oct 2026 01:04:43 +0400 Subject: [PATCH 133/988] Add AlfaClub V2 TVL on Robinhood (#21436) Co-authored-by: FelixBruguera --- registries/sumTokens/data3.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index e668eeba688..c41b1e93cd9 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -865,6 +865,13 @@ module.exports = { "tvl": { "owners": ["0xAF0Bf8593dC6CA973DF2132731B0F9B5F974FA9F", "0xa1bf9bb17C283CF17F01516f78f3127D2C84C79d"], "tokens": [ADDRESSES.base.USDC] }, } }, + "alfaclub-v2": { + "methodology": "USDG held by the AlfaClub V2 RoomKey contract on Robinhood Chain: bonding-curve reserves backing outstanding room keys, plus key-trading fees not yet claimed.", + "start": "2026-09-27", + "robinhood": { + "tvl": { "owners": ["0x64Fb2678cCe04A352a405eAa024eE02935f0ACb9"], "tokens": [ADDRESSES.robinhood.USDG] }, + } + }, "usdr": { "methodology": "TVL is the $M balance held by the USDR extension contract on RISE Chain, which is the collateral backing every minted USDR.", "rise": { From 939a3d6ef6fc952510b852fe017c8df63d9ad14b Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 7 Oct 2026 17:56:20 -0400 Subject: [PATCH 134/988] deduplicate native tokens in sumTokens (#21370) --- projects/helper/unwrapLPs.js | 2 ++ projects/morpho-blue/index.js | 4 ---- projects/sushiswap-v4/index.js | 13 ++----------- projects/uniswap-v4/index.js | 17 +++-------------- 4 files changed, 7 insertions(+), 29 deletions(-) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index d93a8ac1e9d..8568115dd20 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -693,6 +693,8 @@ const nativeTokenAliases = { polygon: '0x0000000000000000000000000000000000001010', // POL (MRC20) celo: '0x471ece3750da237f93b8e339c536989b8978a438', // CELO (GoldToken) metis: '0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000', // METIS + arc: '0x3600000000000000000000000000000000000000', // USDC (6 decimals, native is 18) + stable: '0x779ded0c9e1022225f8e0630b35a9b54be713736', // USDT0 (6 decimals, native is 18) } /* tokensAndOwners [ diff --git a/projects/morpho-blue/index.js b/projects/morpho-blue/index.js index dda0e0f5245..552b1d84fb2 100644 --- a/projects/morpho-blue/index.js +++ b/projects/morpho-blue/index.js @@ -109,10 +109,6 @@ const tvl = async (api) => { }) } - // the gas token and this ERC-20 read the same balance on these chains, so count only one of them - const gasTokenTwin = { stable: ADDRESSES.stable.USDT0, arc: ADDRESSES.arc.USDC } - if (gasTokenTwin[api.chain] && tokens.includes(ADDRESSES.null)) - blacklistedTokens.push(gasTokenTwin[api.chain]) return sumTokens2({ api, owner: morphoBlue, tokens, blacklistedTokens, permitFailure: true }) } diff --git a/projects/sushiswap-v4/index.js b/projects/sushiswap-v4/index.js index fe47673a4b9..9db260fab10 100644 --- a/projects/sushiswap-v4/index.js +++ b/projects/sushiswap-v4/index.js @@ -1,6 +1,5 @@ const { getLogs2 } = require('../helper/cache/getLogs') const { sumTokens2 } = require('../helper/unwrapLPs') -const ADDRESSES = require('../helper/coreAssets.json') // https://docs.sushi.com/contracts/v4 // https://github.com/sushi-labs/infinity-deployments/tree/main/chains @@ -50,18 +49,10 @@ Object.entries(config).forEach(([chain, { vault, clPoolManager, fromBlock }]) => eventAbi: 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint160 sqrtPriceX96, int24 tick)', }) - // On Arc, USDC is the gas token and the ERC-20 at 0x3600... reads the same balance as the native coin. - // Pools quoted in each would count the Vault's USDC twice, so read native through the ERC-20. - const normalize = (token) => { - token = token.toLowerCase() - if (chain === 'arc' && token === ADDRESSES.null) return ADDRESSES.arc.USDC - return token - } - const tokens = new Set() logs.forEach(({ currency0, currency1 }) => { - tokens.add(normalize(currency0)) - tokens.add(normalize(currency1)) + tokens.add(currency0.toLowerCase()) + tokens.add(currency1.toLowerCase()) }) // Infinity pools hold their assets in the Vault, not the pool manager. diff --git a/projects/uniswap-v4/index.js b/projects/uniswap-v4/index.js index 66f6a54e182..53abbfc0eef 100644 --- a/projects/uniswap-v4/index.js +++ b/projects/uniswap-v4/index.js @@ -3,7 +3,6 @@ const { getLogs2 } = require('../helper/cache/getLogs'); const { nullAddress } = require("../helper/tokenMapping"); const { getEnv } = require("../helper/env"); const { cachedGraphQuery } = require("../helper/cache"); -const ADDRESSES = require('../helper/coreAssets.json') // from https://docs.uniswap.org/contracts/v4/deployments const config = { @@ -58,24 +57,14 @@ const subgraphs = { xlayer: {endpoint: '2fc6nFafrPs4xybzHMnmD48qgUYoHTizhDk1mCJJUDjD', factory: '0x360E68faCcca8cA495c1B759Fd9EEe466db9FB32', noTvlFilter: true } } -// On Arc, USDC is the gas token and the ERC-20 at 0x3600... reads the same balance as the native coin. -// A pool quoted in native USDC and one quoted in the ERC-20 would count the PoolManager's USDC twice, -// so read native through the ERC-20 and let the token set dedupe it. -function normalizeCurrency(api, token) { - if (api.chain === 'arc' && token.toLowerCase() === nullAddress) return ADDRESSES.arc.USDC - return token -} - function processResult(api, results, factory, blacklistedTokens = []) { const tokenSet = new Set() const ownerTokens = [] results.forEach(pool => { - const token0 = normalizeCurrency(api, pool.token0) - const token1 = normalizeCurrency(api, pool.token1) - tokenSet.add(token0) - tokenSet.add(token1) + tokenSet.add(pool.token0) + tokenSet.add(pool.token1) if (pool.hooks !== nullAddress) { - ownerTokens.push([[token0, token1], pool.hooks]) + ownerTokens.push([[pool.token0, pool.token1], pool.hooks]) } }) ownerTokens.push([Array.from(tokenSet), factory]) From 3b7786b2b1e50a4fcb6a94894d005f7bc11f59b2 Mon Sep 17 00:00:00 2001 From: The Architect Date: Wed, 7 Oct 2026 19:09:54 -0300 Subject: [PATCH 135/988] Add NLYRA and Architect Swap (Robinhood Chain) (#21432) Co-authored-by: NlyraProject <335227524+NlyraProject@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- registries/sumTokens/data3.js | 30 ++++++++++++++++++++++++++++++ registries/uniswapV2.js | 4 ++++ registries/uniswapV3.js | 4 ++++ 3 files changed, 38 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index c41b1e93cd9..ac6dbe24028 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1083,4 +1083,34 @@ module.exports = { ] }, }, + "nlyra-desk": { + "methodology": "TVL counts the ETH, WETH, USDG and USDe that users keep in the NLYRA Desk escrow contracts (grid, infinity, DCA, TWAP, martingale, ladder, copy-trading and sniper bots, the OTC desk and open Predict rounds). NLYRA held in the escrows is not counted. Staking counts the NLYRA held by Staking v1 and Real Yield Staking v2.", + "robinhood": { + "tvl": { + "owners": [ + "0x9730274e9aB060eB2C9CC3417f85A323aeF7bB6C", // Ladder + "0x056A87cB9974f78fa4185BCe2e14807cBE357F8F", // Martingale v2 + "0xad55Ab54B38F6eE5aB8408de627C0CE20aeF5Cef", // Martingale v1 + "0xC0A3cE7e18FeE382432a18F750756E296D44dD4b", // Spot Grid v1 + "0x994Cf0A4f0E876f52f3b76a2856D93924DA71511", // Spot Grid v3 + "0xF8ef52605FBcc968B24b7FdBD7e93c752A659D5f", // Spot Grid v4 + "0xdd13354cfE3E79a944d8F93476176F016f6311e4", // Spot Grid USDG + "0x5B8555f254AbD8c4B2a25ca6595Cc4025308584c", // Infinity Grid v1 + "0x6C56f98FF2A3867B43aFf8Cad47EC2b6da81E1ab", // Infinity Grid v2 + "0x177a8837c0444e18677b618624C2a853573d2D7D", // Infinity Grid v3 + "0xBdC77e3D589D161489f7C986d8f654F30b88DDeb", // Infinity Grid v4 + "0x551C66EF613c283FC439AE21DFa9C54c6f6b19a3", // Infinity Grid USDG + "0x07D52Ced2EA760187Fa83D5AA96A4B8174124a0d", // DCA v1 + "0x630d58f9B8Cb55D8e246268F52596AFc3471fc1d", // DCA v2 + "0xF8bE45D8da70745B9Df1CF17848dfcDD4b4C2309", // TWAP + "0xE26dd0A09Cd7bA2F7d0a31e4B625E983B0B1B3D2", // Shadow (copy trading) + "0x6B30B0946743eF8A2D323127c8CfaC9966b5C84c", // Sniper + "0x9656513aC910a9839B51dB7c92a6914ABB4F52e8", // OTC Desk + "0x688c265886776005eaF321c7121bF2D1b76676A1", // Predict + ], + "tokens": [ADDRESSES.null, ADDRESSES.robinhood.WETH, ADDRESSES.robinhood.USDG, ADDRESSES.robinhood.USDe] + }, + "staking": { "__staking": [["0x5e63228add4390f77BbcDb364F6A7b42bA7Aa3ef", "0x5CB0Cb16cA019bcff4E494b32575848E4CdB5aF8"], "0xb9d3824149ad8ac984153ceec91d5a2405d1fb95"] } + } + }, } diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index ab14cbf1d81..5a9dfb66d85 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -3244,6 +3244,10 @@ const uniV2Configs = { methodology: 'Token balances held in every Unitflow v2.5 pair, enumerated from the factory.', arc: '0xFc1EC6761e246D5cb0c4C22669f8635098B22ba1', }, + 'architect-swap-v2': { + methodology: 'Value of the tokens held in the Architect Swap V2 pairs on Robinhood Chain, enumerated from the factory.', + robinhood: '0xfa6253ee74F7956b022998F7bfa271990C8A82a8', + }, } module.exports = buildProtocolExports(uniV2Configs, uniV2ExportFn) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index b9e1f257e55..dffc8007b07 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1915,6 +1915,10 @@ const uniV3Configs = { methodology: 'TVL is the sum of both underlying ERC20 balances held by Abyss pools on Robinhood. Pools are discovered from factory PoolCreated events. Separate treasury and fee-vault holdings are excluded.', robinhood: { factory: '0xe7feF2BC860B25bbdEB6F6AB96d88bAAa77ddad7', fromBlock: 50161538 }, }, + 'architect-swap-v3': { + methodology: 'Value of the tokens held in the Architect Swap V3 pools on Robinhood Chain, discovered from factory PoolCreated events.', + robinhood: { factory: '0x3FdaBf7AB5d871B89F1d9DA04Dc2E0733dB70CaF', fromBlock: 22361711 }, + }, } module.exports = buildProtocolExports(uniV3Configs, uniV3Export) From d2cf5ec2154f47e3bcedddb366a8390928eb2588 Mon Sep 17 00:00:00 2001 From: Dani Date: Thu, 8 Oct 2026 09:51:34 +0200 Subject: [PATCH 136/988] Revert "Add exploit hallmarks for nostra, aquifer, bitget" (#21482) --- projects/aquifer/index.js | 3 --- projects/bitget/index.js | 4 +--- projects/nostra/index.js | 3 --- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/projects/aquifer/index.js b/projects/aquifer/index.js index 7bfa400928e..6fccbf9b858 100644 --- a/projects/aquifer/index.js +++ b/projects/aquifer/index.js @@ -29,8 +29,5 @@ module.exports = { timetravel: false, methodology: "TVL is the value of assets held in the program-derived token account of every Coin registered to Aquifer's official Solana DEX.", - hallmarks: [ - ["2026-08-31", "Exploit (~$2.5M)"], - ], solana: { tvl }, } diff --git a/projects/bitget/index.js b/projects/bitget/index.js index 182b3a8c6cd..8a7c2fe3978 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -255,6 +255,4 @@ const withdrawalAddresses = [ module.exports = mergeExports([ cexExports(config), { ethereum: { tvl: getStakedEthTVL({ withdrawalAddresses: withdrawalAddresses, size: 200, sleepTime: 20_000, proxy: true }) } }, -]) - -module.exports.hallmarks = [["2026-09-24", "Hot-wallet hack (~$387M)"]] \ No newline at end of file +]) \ No newline at end of file diff --git a/projects/nostra/index.js b/projects/nostra/index.js index 6a6ed286512..1db1607d85f 100644 --- a/projects/nostra/index.js +++ b/projects/nostra/index.js @@ -172,9 +172,6 @@ async function borrowed(api) { module.exports = { methodology: "The TVL is calculated as a difference between supplied and borrowed assets.", - hallmarks: [ - ["2026-09-17", "Exploit (~$3.5M)"], - ], starknet: { tvl, borrowed: () => ({}), // hacked From 049e05847f5a87874ca8dfd052dd55250b29e27c Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Thu, 8 Oct 2026 04:59:39 -0300 Subject: [PATCH 137/988] Fix Rumpel Fluid position discovery to avoid full-factory scans (#21479) Co-authored-by: ccipherx --- projects/rumpel/index.js | 95 ++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 37 deletions(-) diff --git a/projects/rumpel/index.js b/projects/rumpel/index.js index 291134f23a7..2c3ae93e12d 100644 --- a/projects/rumpel/index.js +++ b/projects/rumpel/index.js @@ -8,7 +8,7 @@ const CONTRACTS = { MORPHO_BLUE: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb", ZIRCUIT_RESTAKING_POOL: "0xF047ab4c75cebf0eB9ed34Ae2c186f3611aEAfa6", FLUID_POSITION_RESOLVER: "0x3E3dae4F30347782089d398D462546eb5276801C", - FLUID_VAULT_RESOLVER: "0x77648C2FEda8D5f9f21A9FE91db0d102E49d3031", + FLUID_VAULT_RESOLVER: "0x8DD65DaDb217f73A94Efb903EB2dc7B49D97ECca", FLUID_DEX_RESOLVER: "0x71783F64719899319B56BdA4F27E1219d9AF9a3d", FLUID_DEX_RESERVES_RESOLVER: "0xC93876C0EEd99645DD53937b25433e311881A27C", // HyperEVM contracts @@ -178,6 +178,59 @@ const FLUID_VAULTS = [ const MORPHO_SUSDE_MARKET_ID = "0x39d11026eae1c6ec02aa4c0910778664089cdd97c3fd23f68f7cd05e2e95af48"; +async function getFluidPositions(api, owners) { + // Enumerate only Rumpel-owned NFTs; getAllVaultPositions scans the entire Fluid factory. + const ownerNftIds = await api.multiCall({ + target: CONTRACTS.FLUID_VAULT_RESOLVER, + abi: 'function positionsNftIdOfUser(address) view returns (uint256[])', + calls: owners.map(owner => ({ params: [owner] })), + }); + const nftIds = [...new Set(ownerNftIds.flat())]; + const positionsByVault = new Map(FLUID_VAULTS.map(({ VAULT }) => [VAULT.toLowerCase(), []])); + if (!nftIds.length) return positionsByVault; + + const vaults = await api.multiCall({ + target: CONTRACTS.FLUID_VAULT_RESOLVER, + abi: 'function vaultByNftId(uint256) view returns (address)', + calls: nftIds.map(id => ({ params: [id] })), + }); + const tracked = nftIds.map((id, i) => ({ id, vault: vaults[i].toLowerCase() })) + .filter(({ vault }) => positionsByVault.has(vault)); + if (!tracked.length) return positionsByVault; + + const positions = await api.multiCall({ + target: CONTRACTS.FLUID_POSITION_RESOLVER, + abi: 'function getPositionsForNftIds(uint256[]) view returns ((uint256 nftId,address owner,uint256 supply,uint256 borrow)[])', + calls: tracked.map(({ id }) => ({ params: [[id]] })), + chunkSize: 25, + }); + positions.forEach((result, i) => positionsByVault.get(tracked[i].vault).push(...result)); + return positionsByVault; +} + +async function addFluidSmartCollateral(api, vault, positions) { + const [totalSupplySharesRaw, reserves] = await Promise.all([ + api.call({ + target: CONTRACTS.FLUID_DEX_RESOLVER, + abi: 'function getTotalSupplySharesRaw(address dex_) view returns (uint)', + params: [vault.LP_TOKEN] + }), + api.call({ + target: CONTRACTS.FLUID_DEX_RESERVES_RESOLVER, + abi: 'function getDexCollateralReserves(address) view returns (uint256,uint256,uint256,uint256)', + params: [vault.LP_TOKEN] + }) + ]); + const totalSupplyShares = BigInt(totalSupplySharesRaw) & BigInt('0xffffffffffffffffffffffffffffffff'); + const [token0Reserves, token1Reserves] = reserves; + const totalPositionShares = positions.reduce((sum, p) => sum + BigInt(p.supply), 0n); + if (totalSupplyShares === 0n) return; + const token0Amount = BigInt(token0Reserves) * totalPositionShares / totalSupplyShares; + const token1Amount = BigInt(token1Reserves) * totalPositionShares / totalSupplyShares; + if (token0Amount > 0n) api.add(vault.TOKEN0, token0Amount.toString()); + if (token1Amount > 0n) api.add(vault.TOKEN1, token1Amount.toString()); +} + async function tvl(api) { const owners = await getOwners(api); @@ -231,45 +284,13 @@ async function tvl(api) { async function handleFluidPositions() { if (api.chain !== 'ethereum') return; - const positions = await api.multiCall({ - target: CONTRACTS.FLUID_POSITION_RESOLVER, - abi: "function getAllVaultPositions(address) view returns ((uint256,address owner,uint256 supply,uint256)[])", - calls: FLUID_VAULTS.map(({ VAULT }) => ({ params: [VAULT] })), - }); - - for (let i = 0; i < positions.length; i++) { - const vaultPositions = positions[i]; - const rumpelPositions = vaultPositions.filter(p => owners.includes(p.owner)); - + const positions = await getFluidPositions(api, owners); + for (const vault of FLUID_VAULTS) { + const rumpelPositions = positions.get(vault.VAULT.toLowerCase()); if (rumpelPositions.length === 0) continue; - const vault = FLUID_VAULTS[i]; - if (vault.IS_SMART) { - const [totalSupplySharesRaw, reserves] = await Promise.all([ - api.call({ - target: CONTRACTS.FLUID_DEX_RESOLVER, - abi: 'function getTotalSupplySharesRaw(address dex_) view returns (uint)', - params: [vault.LP_TOKEN] - }), - api.call({ - target: CONTRACTS.FLUID_DEX_RESERVES_RESOLVER, - abi: 'function getDexCollateralReserves(address) view returns (uint256,uint256,uint256,uint256)', - params: [vault.LP_TOKEN] - }) - ]); - - const totalSupplyShares = BigInt(totalSupplySharesRaw) & BigInt('0xffffffffffffffffffffffffffffffff'); - const [token0Reserves, token1Reserves] = reserves; - - const totalPositionShares = rumpelPositions.reduce((sum, p) => sum + BigInt(p.supply), 0n); - const ratio = Number(totalPositionShares) / Number(totalSupplyShares); - - const token0Amount = Number(token0Reserves) * ratio; - const token1Amount = Number(token1Reserves) * ratio; - - if (token0Amount > 0) api.add(vault.TOKEN0, token0Amount.toFixed(0)); - if (token1Amount > 0) api.add(vault.TOKEN1, token1Amount.toFixed(0)); + await addFluidSmartCollateral(api, vault, rumpelPositions); } else { api.add(vault.TOKEN, rumpelPositions.map(p => p.supply)); } From 7678576b8cb75ca7a64b3542cd94a545c79b84ae Mon Sep 17 00:00:00 2001 From: tyler-tsai <15355143+tyler-tsai@users.noreply.github.com> Date: Thu, 8 Oct 2026 16:05:27 +0800 Subject: [PATCH 138/988] fix(lista): page through the full Moolah market list (lending + dex) (#21476) Co-authored-by: Claude Opus 5 Co-authored-by: ccipherx --- projects/lista-dex/index.js | 37 ++++++++++++++++++++------------- projects/lista-lending/index.js | 37 ++++++++++++++++++++++----------- 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/projects/lista-dex/index.js b/projects/lista-dex/index.js index af0a7f8e494..5290acc485a 100644 --- a/projects/lista-dex/index.js +++ b/projects/lista-dex/index.js @@ -1,25 +1,34 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') const { nullAddress } = require('../helper/tokenMapping') const NATIVE_PLACEHOLDER = ADDRESSES.GAS_TOKEN_2 +const MARKET_LIST_URL = 'https://api.lista.org/api/moolah/borrow/marketList?pageSize=200&page=' -const config = { - bsc: { - marketListUrl: - 'https://api.lista.org/api/moolah/borrow/marketList?page=1&pageSize=1000&chain=bsc', - }, - ethereum: { - marketListUrl: - 'https://api.lista.org/api/moolah/borrow/marketList?page=1&pageSize=1000&chain=ethereum', - }, +const chains = ['bsc', 'ethereum'] + +/** The API caps pageSize at 200 and ignores the chain filter, so page through every market once. */ +async function fetchMarketList() { + const list = [] + let total = Infinity + for (let page = 1; list.length < total; page++) { + const { data } = await get(MARKET_LIST_URL + page) + total = data?.total ?? 0 + const pageList = data?.list ?? [] + if (!pageList.length) break + list.push(...pageList) + } + const unique = [...new Map(list.map((m) => [m.marketId, m])).values()] + // throw on a short list so getConfig keeps the last complete one + if (!unique.length || unique.length < total) throw new Error(`lista: fetched ${unique.length}/${total} markets`) + return { data: { list: unique } } } async function getSmartLendingMarketIds(api) { - const { marketListUrl } = config[api.chain] - const { data } = await getConfig('lista/marketList-' + api.chain, marketListUrl) - const list = data?.list ?? [] - return list + const { data } = await getConfig('lista-dex/marketList', undefined, { fetcher: fetchMarketList }) + if (!data?.list?.length) throw new Error('lista: no market list') + return data.list .filter((m) => m.chain === api.chain) .filter((m) => m.isSmartLending === true) .filter((m) => m.status === 1) @@ -81,6 +90,6 @@ module.exports = { 'TVL = sum of token0 and token1 balances in each smart lending market swapPool (two collateral assets). Data from Moolah market list + market basic info API.', } -Object.keys(config).forEach((chain) => { +chains.forEach((chain) => { module.exports[chain] = { tvl } }) diff --git a/projects/lista-lending/index.js b/projects/lista-lending/index.js index b4cce1a5169..98cccacbf1a 100644 --- a/projects/lista-lending/index.js +++ b/projects/lista-lending/index.js @@ -1,14 +1,11 @@ const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') + +const MARKET_LIST_URL = 'https://api.lista.org/api/moolah/borrow/marketList?pageSize=200&page=' const config = { - bsc: { - vault: '0x8F73b65B4caAf64FBA2aF91cC5D4a2A1318E5D8C', - marketListUrl: 'https://api.lista.org/api/moolah/borrow/marketList?page=1&pageSize=1000&chain=bsc', - }, - ethereum: { - vault: '0xf820fB4680712CD7263a0D3D024D5b5aEA82Fd70', - marketListUrl: 'https://api.lista.org/api/moolah/borrow/marketList?page=1&pageSize=1000&chain=ethereum', - }, + bsc: { vault: '0x8F73b65B4caAf64FBA2aF91cC5D4a2A1318E5D8C' }, + ethereum: { vault: '0xf820fB4680712CD7263a0D3D024D5b5aEA82Fd70' }, } const abi = { @@ -18,11 +15,27 @@ const abi = { 'function market(bytes32) view returns (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee)', } +/** The API caps pageSize at 200 and ignores the chain filter, so page through every market once. */ +async function fetchMarketList() { + const list = [] + let total = Infinity + for (let page = 1; list.length < total; page++) { + const { data } = await get(MARKET_LIST_URL + page) + total = data?.total ?? 0 + const pageList = data?.list ?? [] + if (!pageList.length) break + list.push(...pageList) + } + const unique = [...new Map(list.map((m) => [m.marketId, m])).values()] + // throw on a short list so getConfig keeps the last complete one + if (!unique.length || unique.length < total) throw new Error(`lista: fetched ${unique.length}/${total} markets`) + return { data: { list: unique } } +} + async function getMarketList(api) { - const { marketListUrl } = config[api.chain] - const { data } = await getConfig('lista/marketList-' + api.chain, marketListUrl) - const list = data?.list ?? [] - return list.filter((m) => m.chain === api.chain) + const { data } = await getConfig('lista-lending/marketList', undefined, { fetcher: fetchMarketList }) + if (!data?.list?.length) throw new Error('lista: no market list') + return data.list.filter((m) => m.chain === api.chain) } /** Market IDs for TVL: all markets (Smart Lending collateral is in lista-dex swap pools, but loanToken supply is still in vault). */ From 9a2b49d6bcd49b35281b97e093f8d330d1c2512a Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Thu, 8 Oct 2026 05:21:22 -0300 Subject: [PATCH 139/988] Replace SuperRare subgraph with on-chain Rarity Pool balances (#21478) Co-authored-by: ccipherx --- projects/superrare/index.js | 44 +++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/projects/superrare/index.js b/projects/superrare/index.js index 6d7a16498b6..92007c76fb7 100644 --- a/projects/superrare/index.js +++ b/projects/superrare/index.js @@ -1,22 +1,28 @@ -const { request, gql } = require("graphql-request"); +const { getLogs2 } = require('../helper/cache/getLogs') -async function staking(_time, block){ - const query = gql`query AllRareLocked ($block: Int) { - pools(first: 1000, block: { number: $block }) { - totalRareLocked - } - }` - const result = await request("https://gateway-arbitrum.network.thegraph.com/api/5fba66cce34542163f90501c363f99e8/subgraphs/id/Cc4fyxiBkZYdzATQDhTv3zLzfEwRupygp7HB2WWQciw5", query, { - block, - }); - return { - "0xba5BDe662c17e2aDFF1075610382B9B691296350": result.pools.reduce((sum, a)=>sum+Number(a.totalRareLocked), 0) - } +const RARE = '0xba5BDe662c17e2aDFF1075610382B9B691296350' +const FACTORY = '0x5d09145E1E798c7a885e49a6FC4f0542ce231A47' +const RARE_STAKING_V1 = '0x3f4D749675B3e48bCCd932033808a7079328Eb48' +const FROM_BLOCK = 18021312 // First StakingContractCreated event. + +async function staking(api) { + if (await api.getBlock() < FROM_BLOCK) return {} + + const pools = await getLogs2({ + api, + target: FACTORY, + fromBlock: FROM_BLOCK, + eventAbi: 'event StakingContractCreated(address indexed _deployingUser, address indexed _userStakedOn, address indexed _stakingAddress)', + transform: log => log._stakingAddress, + }) + + return api.sumTokens({ owners: [...pools, RARE_STAKING_V1], tokens: [RARE] }) } -module.exports={ - ethereum:{ - staking, - tvl: async()=>({}) - } -} \ No newline at end of file +module.exports = { + methodology: 'Counts RARE held in Rarity Pools (including unclaimed rewards) and in the RareStakingV1 contract as staking. Excludes sRARE receipts and external reward accumulators.', + ethereum: { + staking, + tvl: async () => ({}), + }, +} From 3d701b5c31ffd1817b8c05fc7b27c74fd5c37658 Mon Sep 17 00:00:00 2001 From: Matthew <84196639+mteam88@users.noreply.github.com> Date: Thu, 8 Oct 2026 04:24:23 -0400 Subject: [PATCH 140/988] Add BaiBai (#21475) Co-authored-by: ccipherx --- registries/sumTokens/data3.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index ac6dbe24028..bd6ffc33ec7 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1113,4 +1113,12 @@ module.exports = { "staking": { "__staking": [["0x5e63228add4390f77BbcDb364F6A7b42bA7Aa3ef", "0x5CB0Cb16cA019bcff4E494b32575848E4CdB5aF8"], "0xb9d3824149ad8ac984153ceec91d5a2405d1fb95"] } } }, + "baibai": { + "methodology": "TVL is the WETH and USDC held by the BaibaiCustodian contract, which custodies the maker liquidity that BaiBai quotes and settles swaps against.", + "start": "2026-09-05", + "base": { + "owner": "0xAaC48FEB93c5C97E0fb3c7C57E1633922A4ACDa3", + "tokens": [ADDRESSES.base.WETH, ADDRESSES.base.USDC] + } + }, } From 9c047edd80a92857a4303e61df085e373ce0cbc4 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Thu, 8 Oct 2026 10:32:53 +0200 Subject: [PATCH 141/988] Fail fast on dead upstreams with 30s request timeouts (#21473) --- projects/justlock-io/index.js | 2 +- projects/pacaswap-bridge/index.js | 2 +- projects/rocket-vault/index.js | 4 ++-- projects/web3world/index.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/justlock-io/index.js b/projects/justlock-io/index.js index e7fd8fd90eb..e25dd5736ac 100644 --- a/projects/justlock-io/index.js +++ b/projects/justlock-io/index.js @@ -6,7 +6,7 @@ module.exports = { } async function tvl(api) { - const { tvl_usd } = await get('https://api.justlock.io/tvl_by_types') + const { tvl_usd } = await get('https://api.justlock.io/tvl_by_types', { timeout: 30000 }) api.addUSDValue(tvl_usd["FungibleResource-NativePoolUnit"]) api.addUSDValue(tvl_usd["NonFungibleResource-PrecisionPool"]) api.addUSDValue(tvl_usd["NonFungibleResource-QuantaSwap"]) diff --git a/projects/pacaswap-bridge/index.js b/projects/pacaswap-bridge/index.js index e2e49ad1ddd..638d913498c 100644 --- a/projects/pacaswap-bridge/index.js +++ b/projects/pacaswap-bridge/index.js @@ -1,7 +1,7 @@ const { get } = require('../helper/http') async function tvl(api) { - const data = await get('https://api.pacaswap.com/mainnet/coingecko/tickers_complete') + const data = await get('https://api.pacaswap.com/mainnet/coingecko/tickers_complete', { timeout: 30000 }) api.addUSDValue(data.reduce((acc, i) => acc + +i.liquidity_in_usd, 0)) } diff --git a/projects/rocket-vault/index.js b/projects/rocket-vault/index.js index 2df3e72042f..6d454a6448b 100644 --- a/projects/rocket-vault/index.js +++ b/projects/rocket-vault/index.js @@ -4,13 +4,13 @@ const ROCKET_API = "https://beta.rocket-cluster-1.com"; const VAULT_ADDRESS = "0x6BC2179a284CB2A2857C379391E0158524de7cA0"; const tvl = async (api) => { - const { data } = await axios.get(`${ROCKET_API}/vaults`) + const { data } = await axios.get(`${ROCKET_API}/vaults`, { timeout: 30000 }) let vaults = data.vaults.map(({ address }) => address) if (!vaults.length) vaults = [VAULT_ADDRESS] let total = 0 for (const vault of vaults) { - const { data } = await axios.get(`${ROCKET_API}/collateral?account=${encodeURIComponent(vault)}`) + const { data } = await axios.get(`${ROCKET_API}/collateral?account=${encodeURIComponent(vault)}`, { timeout: 30000 }) total += Object.values(data.collaterals).reduce((sum, v) => sum + Number(v), 0) } api.addUSDValue(total) diff --git a/projects/web3world/index.js b/projects/web3world/index.js index 9c14e8173ca..850b8ae0757 100644 --- a/projects/web3world/index.js +++ b/projects/web3world/index.js @@ -10,7 +10,7 @@ const payload = { } const tvl = async (api) => { - const { pools } = await post(url, payload) + const { pools } = await post(url, payload, { timeout: 30000 }) pools.forEach(({ tvl }) => { api.addUSDValue(Math.round(tvl)) }) From b6dc222237107747674741b1e2006f3d6ca820e1 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Thu, 8 Oct 2026 10:36:12 +0200 Subject: [PATCH 142/988] Rebuild caviarnine-lsu TVL on-chain after api-core shutdown (#21470) --- projects/caviarnine-lsu/index.js | 19 +++++++++++++------ projects/helper/chain/radixdlt.js | 3 +++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/projects/caviarnine-lsu/index.js b/projects/caviarnine-lsu/index.js index c623ce996cd..c592db6eae0 100644 --- a/projects/caviarnine-lsu/index.js +++ b/projects/caviarnine-lsu/index.js @@ -1,13 +1,20 @@ -const { get } = require('../helper/http') +const { sumTokens, transformLSUs } = require('../helper/chain/radixdlt') +const ADDRESSES = require('../helper/coreAssets.json') + +// LSU Pool component from CaviarNine docs (was read via api-core.caviarnine.com, dead since Sep 2026) +const LSU_POOL = 'component_rdx1cppy08xgra5tv5melsjtj79c0ngvrlmzl8hhs7vwtzknp9xxs63mfp' async function tvl(api) { - const { summary } = await get('https://api-core.caviarnine.com/v1.0/stats/product/lsupool') - return { - 'radix': summary.total_value_locked.xrd - } + await sumTokens({ api, owners: [LSU_POOL] }) + const balances = await transformLSUs(api) + // queryLiquidStakeUnitDetails swallows lookup errors (returns {}): fail loud + // instead of reporting unconverted LSU units (converted XRD itself excluded) + const leftover = Object.keys(balances).filter(k => k.startsWith('radixdlt:resource_') && !k.endsWith(ADDRESSES.radixdlt.XRD)) + if (leftover.length) throw new Error(`LSU redemption lookup failed for ${leftover.length} resources`) + return balances } module.exports = { timetravel: false, radixdlt: { tvl } -} \ No newline at end of file +} diff --git a/projects/helper/chain/radixdlt.js b/projects/helper/chain/radixdlt.js index 77f029da729..cb81703f106 100644 --- a/projects/helper/chain/radixdlt.js +++ b/projects/helper/chain/radixdlt.js @@ -140,6 +140,9 @@ async function transformLSUs(api) { if (tokens.length) { const lsuRedemptionValues = await queryLiquidStakeUnitDetails(tokens) Object.entries(lsuRedemptionValues).forEach(([lsuResourceAddress, { xrdRedemptionValue }]) => { + if (!Number.isFinite(Number(xrdRedemptionValue))) { + throw new Error(`Missing XRD redemption value for ${lsuResourceAddress}`) + } const bals = balances[`radixdlt:${lsuResourceAddress}`] * xrdRedemptionValue api.add(ADDRESSES.radixdlt.XRD, bals) delete balances[`radixdlt:${lsuResourceAddress}`] From 09703546ad602fa3461e0a201d2bf55019a49608 Mon Sep 17 00:00:00 2001 From: livingrockrises <90545960+livingrockrises@users.noreply.github.com> Date: Thu, 8 Oct 2026 12:40:26 +0400 Subject: [PATCH 143/988] Add Startale Earn (Soneium USDSC vault) (#21464) Co-authored-by: ccipherx --- registries/sumTokens/data3.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index bd6ffc33ec7..123813d1c89 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -878,6 +878,13 @@ module.exports = { "tvl": { "owners": ["0x62b7f5A5Be488ea58f660C5aff465647213Bc6e9"], "tokens": ["0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b"] }, } }, + "startale-earn": { + "methodology": "TVL is the USDSC held by the Startale Earn vault on Soneium.", + "start": "2025-11-25", + "soneium": { + "tvl": { "owners": ["0xfdeb7e9f59cad080d9158ff850ce79bcf6cdd5f0"], "tokens": ["0x3f99231dD03a9F0E7e3421c92B7b90fbe012985a"] }, + } + }, "veiledhood": { "methodology": "TVL is the sum of USDG and WETH balances held by VeiledHood's Veiledhood and VeilSwap vault contracts on Robinhood Chain, read directly on-chain. Per-user balances are tracked off-chain via a Merkle-committed ledger, but the vault's aggregate token balances are public and require no private state to compute.", "robinhood": { From a62985f91883ce121344c1307d1db49c18eef33e Mon Sep 17 00:00:00 2001 From: Yasin Aktimur Date: Thu, 8 Oct 2026 11:55:28 +0300 Subject: [PATCH 144/988] flooor-fun: track migrated main contract and per-collection auction contracts (#21460) Co-authored-by: ccipherx --- registries/sumTokens.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 0011f3b06b2..810b20b0546 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -361,9 +361,30 @@ const configs = { }, }, "flooor-fun": { - "methodology": "TVL is the native ETH held in the flooor.fun auction contract on Base, comprising the current highest bid locked in escrow (activebidAM) plus accumulated epoch pool rewards (poolAccrued). ETH exits the contract when sellToHighest() is called, distributing 99.5% to the NFT seller and 0.5% fee to the protocol.", + "methodology": "TVL is the native ETH held in the flooor.fun auction contracts on Base and Robinhood Chain (the current main contract, the legacy contract, and one auction contract per NFT collection), comprising the current highest bid locked in escrow (activebidAM) plus accumulated epoch pool rewards (poolAccrued). When sellToHighest() is called, the winning bid is split: 95% is sent to the NFT seller and 0.5% to the protocol as a fee, while 4.5% stays in the contract as epoch pool rewards (poolAccrued) until signers claim it.", "base": { - "owner": "0xF6B2C2411a101Db46c8513dDAef10b11184c58fF", + "owners": [ + "0xD53292182A342953f446CD4D10Dc177776044306", // current + "0xF6B2C2411a101Db46c8513dDAef10b11184c58fF", // legacy + "0xD3706917c71b1A81CeCc31311C6B41eac344DDb5", // loopers + "0x0c2d41b6896a7dde2641a0fe04165df180c43242", // warplets + "0x0DA60a9965e1059F2258d5e74c3839844FEF1Cf9", // gnars + "0x89350393e99f1df89D09376a02a99BAE9aBc8d8F", // based nouns + "0x0669583e7d5bE64967153dd276987415926b5e32", // based onchain dinos + "0x7b4A2c265dECE5A48e9c9232de1bd4940dfb6A0F", // base day one + "0xE0AB0cE2FF407f53b9384205258C037c22cB03A0" // ok computers + ], + "tokens": [ + ADDRESSES.null + ] + }, + "robinhood": { + "owners": [ + "0x352E6e9EF7BA1BC4398C2c3784dFdF1930D0df32", // hashcats + "0x04ec8eDB287D20f29B834b47a44713d814b0788a", // stonkbrokers + "0xa14b6A3980C178D8f446F6a33Bad83a9aAa2D09D", // rh machines + "0xc347759352F8f2e556CE6A0Ea8048Fb48cfFca45" // quotrons + ], "tokens": [ ADDRESSES.null ] From 53dc618edee39d31eca4a338f627db8d7c3398ec Mon Sep 17 00:00:00 2001 From: routebuilder Date: Thu, 8 Oct 2026 10:57:02 +0200 Subject: [PATCH 145/988] Rebuild stella TVL on-chain after subgraph shutdown (#21471) Co-authored-by: ccipherx --- projects/stellaxyz-io/index.js | 104 +++++++++++++++------------------ 1 file changed, 46 insertions(+), 58 deletions(-) diff --git a/projects/stellaxyz-io/index.js b/projects/stellaxyz-io/index.js index 89688ea948c..6fc7154a08d 100644 --- a/projects/stellaxyz-io/index.js +++ b/projects/stellaxyz-io/index.js @@ -1,70 +1,58 @@ const { sumTokens2 } = require('../helper/unwrapLPs') -const { getLogs, getAddress } = require('../helper/cache/getLogs'); -const { cachedGraphQuery } = require('../helper/cache') -const { graphQuery } = require('../helper/http'); -const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs } = require('../helper/cache/getLogs'); -const config = { - arbitrum: { - endpoint: 'https://graph.stellaxyz.io/v1/graphql', - // factory: '0x573a89fBc6b4a5B11a55DC9814A1018a3A9cD0CA', - // fromBlock: 101291920, - } +// lending proxy => deploy block +const proxies = { + '0xfff45c0b77d7c0c33a97a879576f0550b6842bff': 101291653, + '0x032ba65c71c82d2e6dcf91cad148adc64a5f02a7': 131951206, } -module.exports = { - misrepresentedTokens: true, +const factories = { + '0x573a89fbc6b4a5b11a55dc9814a1018a3a9cd0ca': 101291920, // UniV3StrategyFactory + '0x811A3f2577DE04Af01663Df8DcF543bF6a6187B2': 111000000, // JoeV2StrategyFactory + '0x6A5fB411e85D74b51862DED8d1cF54f1896d95bE': 131000000, // PendleLSDStrategyFactory + '0xbb5A4dCb173f643Ca6687aA837d6357DF9d6C936': 131000000, // PenpieLSDStrategyFactory + '0xE3d6f0D0b487B102C4eCFa5c1Cc27774ED227B7b': 161000000, // CamelotV3StrategyFactory } -const query = `query GET_ALL_LENDING_POOLS{ pools: lending_pool_registry( where: {_or: [{is_launched: {_eq: true}}], chain_id: {_eq: 42161}, is_deprecated: {_eq: false}} ) { tokenName: lending_token_name poolAddress: pool_address }}` -const strategyQuery = `query Strategy { strategy( where: {chain_id: {_eq: 42161 }, _or: [{is_launched: {_eq: true}}]} order_by: {display_priority: asc} ) { id name strategyAddress: strategy_address }}` +const createStrategyAbi = 'event CreateStrategy(address,address)' +const addPoolAbi = 'event AddLendingPool(address)' +const delistPoolAbi = 'event DelistLendingPool(address)' -Object.keys(config).forEach(chain => { - const { endpoint, factory, fromBlock, } = config[chain] - module.exports[chain] = { - tvl: async (api) => { - await getStraegyTvl2() - const { pools } = await cachedGraphQuery('stellaxyz/lending-pool/' + api.chain, endpoint, query) - const lendingContracts = pools.map(i => i.poolAddress) - const tokens = await api.multiCall({ abi: 'address:depositToken', calls: lendingContracts }) - await sumTokens2({ api, tokensAndOwners2: [tokens, lendingContracts] }) - - async function getStraegyTvl2() { - let hasMore = false - let offset = 0 - do { - const { position } = await graphQuery(endpoint, `query GetPositionsDefillama($offset:Int!) { - position(order_by:{opened_at:asc},where: {status: {_eq: "Active"}}, limit: 1000, offset: $offset) { - id - position_value_usd - strategy{ - id - strategy_address - lp_address - pool_address - } - opened_at - closed_at - status - } - }`, {offset}) - hasMore = position.length === 1000 - position.forEach(i => { - api.add(ADDRESSES.arbitrum.USDC, i.position_value_usd * 1e6) - }) - } while (hasMore) - } +async function getStrategies(api) { + const all = [] + for (const [factory, fromBlock] of Object.entries(factories)) { + const logs = await getLogs({ api, target: factory, eventAbi: createStrategyAbi, fromBlock, onlyArgs: true }) + all.push(...logs.map(log => log[1])) // strategy proxy + } + return [...new Set(all)] +} - async function getStategyTvl() { - const { strategy } = await cachedGraphQuery('stellaxyz/strategy/' + api.chain, endpoint, strategyQuery) - const strategies = strategy.map(i => i.strategyAddress) - // const logs = await getLogs({ api, target: factory, topics: ['0x0803371633b57311f58d10924711080d2dae75ab17c5c0c262af3887cfca00bb'], fromBlock, }) +async function getPools(api) { + const pools = [] + for (const [proxy, fromBlock] of Object.entries(proxies)) { + const adds = await getLogs({ api, target: proxy, eventAbi: addPoolAbi, fromBlock, onlyArgs: true, extraKey: 'add-pool' }) + const delists = await getLogs({ api, target: proxy, eventAbi: delistPoolAbi, fromBlock, onlyArgs: true, extraKey: 'delist-pool' }) + const delisted = new Set(delists.map(log => log[0].toLowerCase())) + pools.push(...adds.map(log => log[0]).filter(pool => !delisted.has(pool.toLowerCase()))) + } + return [...new Set(pools)] +} - const positionManagers = await api.multiCall({ abi: 'address:positionManager', calls: strategies }) - return sumTokens2({ api, owners: positionManagers, resolveUniV3: true, }) +module.exports = { + methodology: 'Counts deposit-token balances held by Stella lending pools (AddLendingPool events on both lending proxies, delisted pools excluded), plus tokens and Uniswap V3 positions held by strategy position managers.', + arbitrum: { + tvl: async (api) => { + const strategies = await getStrategies(api) + const positionManagers = await api.multiCall({ abi: 'address:positionManager', calls: strategies }) + const pools = await getPools(api) + const tokens = await api.multiCall({ abi: 'address:depositToken', calls: pools }) + await sumTokens2({ api, tokensAndOwners2: [tokens, pools] }) - } + const pmTokenPairs = [] + for (const pm of positionManagers) for (const token of tokens) pmTokenPairs.push([token, pm]) + await sumTokens2({ api, tokensAndOwners: pmTokenPairs, owners: positionManagers, resolveUniV3: true }) } - } -}) \ No newline at end of file + }, +} From 8ca4710da346ba2f3a40b646e7d77aadd472a1b5 Mon Sep 17 00:00:00 2001 From: daonarchy Date: Thu, 8 Oct 2026 15:59:23 +0700 Subject: [PATCH 146/988] Add PentaSwap (Uniswap V2) on Pentagon Chain (3344) (#21456) Co-authored-by: daonarchy <219096321+daonarchy@users.noreply.github.com> Co-authored-by: ccipherx --- projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 3 +++ registries/uniswapV2.js | 1 + 3 files changed, 5 insertions(+) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index b9fc117f96d..bbefed53335 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -366,6 +366,7 @@ "parallel", "parex", "peaq", + "pentagonchain", "penumbra", "pepu", "perennial", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 95745a007df..911921ce3ea 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -2899,5 +2899,8 @@ }, "horizen": { "ZEN": "0x57da2D504bf8b83Ef304759d9f2648522D7a9280" + }, + "pentagonchain": { + "WPC": "0xAA3d9411DD08FDA149d4545089e241E62EE87860" } } \ No newline at end of file diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index 5a9dfb66d85..0f5dbe6d3f3 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -24,6 +24,7 @@ function uniV2ExportFn(chainConfigs, options = {}) { } const uniV2Configs = { + 'pentaswap': { pentagonchain: '0xC75C7E9352bC1475d7c308E65C0a21969DcEdEe7' }, 'bbbfi-swap-v2': { methodology: 'Value of reserves in BBBFi-owned V2 AMM pools on XDC and BSC, discovered from each factory. Uses the standard core-asset reserve valuation helper. Staked LP receipts are not added again; reward budgets and bridge reserves are excluded.', xdc: '0xFe536C6a76487563D4393a3Bd03ef2621546A198', From a049262f16ddc2f34ee7974fb83e63f22756bcb8 Mon Sep 17 00:00:00 2001 From: 0xsamson Date: Thu, 8 Oct 2026 23:09:26 +1000 Subject: [PATCH 147/988] Add Mosh (Robinhood Chain): capital deployed + treasury (#21429) Co-authored-by: Samson <247922163+0xsamson@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/mosh/index.js | 136 ++++++++++++++++++++++++++++++++++++++ projects/treasury/mosh.js | 17 +++++ 2 files changed, 153 insertions(+) create mode 100644 projects/mosh/index.js create mode 100644 projects/treasury/mosh.js diff --git a/projects/mosh/index.js b/projects/mosh/index.js new file mode 100644 index 00000000000..f0f6f01172d --- /dev/null +++ b/projects/mosh/index.js @@ -0,0 +1,136 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { ethers } = require('ethers') + +// BUN is Mosh's own token. Bundles paired against BUN hold it as their pair asset, and that is +// reported under staking instead of tvl. +const BUN = '0x07ebb29a38fbcb41563817e5e19f2cec619c90d2' + +// PonsSwarm factories, one per counter asset; each emits SwarmCreated for every bundle +const FACTORIES = [ + '0x9073cb17846398fb8b379ab06c2b840dea7f0069', // native ETH + '0xe5ec3e5f288036526112415385e4ce3331012887', + '0xd32f988aa0d7e202c31f0bb0b3f8372adacc329b', + '0x3c4cb58ef0f5b2f4d4b2cc786d51769ff4af5fe4', + '0xea2594c7fbf4c443c023ef07899779b936395402', + '0xa7634db2c4e54984be05a22287c42858358190e4', + '0x290f546f96449449118f9fbb42465fddc2020f3f', + '0xc9793e938198fede4d4877f4a09f24f0f377dde6', + '0xf6d2268d5ebd75d15553ad275f2ec9147b6f4350', // BUN +] +const fromBlock = 70_000_000 +// the first bundle ($BUN), created by the original deployment before the factories above +const LEGACY_SWARMS = ['0x7bdb0b02f41ca6644750b9e6ae75de08f1bc6d01'] + +// Uniswap's StateView lens on Robinhood Chain (the one DefiLlama's v4 helper uses) +const STATE_VIEW = '0xf3334192d15450cdd385c8b70e03f9a6bd9e673b' +const RANGE_ABI = 'function ranges(uint256) view returns (uint8 venue, int24 tickLower, int24 tickUpper, uint128 liquidity, bytes32 salt)' +const EXTRA_VENUE_ABI = 'function extraVenues(uint256) view returns (uint24 fee, int24 tickSpacing)' +const GET_SLOT0_ABI = 'function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)' + +// keccak256(abi.encode(PoolKey)): Uniswap v4's pool id +function poolIdOf({ currency0, currency1, fee, tickSpacing, hooks }) { + return ethers.keccak256(ethers.AbiCoder.defaultAbiCoder().encode( + ['address', 'address', 'uint24', 'int24', 'address'], [currency0, currency1, fee, tickSpacing, hooks])) +} + +const SwarmCreated = 'event SwarmCreated(address indexed swarm, address indexed creator, uint256 index, bytes32 launchParamsHash)' + +// Sums the pair asset of every swarm whose pair asset is (ownToken) or is not (!ownToken) BUN +async function pairAssetBalances(api, ownToken) { + const created = [] + for (const target of FACTORIES) created.push(...await getLogs2({ api, target, eventAbi: SwarmCreated, fromBlock })) + const allSwarms = [...new Set([...created.map(i => i.swarm.toLowerCase()), ...LEGACY_SWARMS])] + + // a swarm's counter asset is fixed at creation; the legacy bundle predates counterIsNative() and is native ETH + const native = await api.multiCall({ abi: 'bool:counterIsNative', calls: allSwarms, permitFailure: true }) + const counters = await api.multiCall({ abi: 'address:counterAsset', calls: allSwarms, permitFailure: true }) + const allCounters = allSwarms.map((s, i) => (native[i] ?? LEGACY_SWARMS.includes(s)) ? nullAddress : counters[i]) + // a swarm whose counter asset did not read is skipped rather than allowed to fail the whole run + const keep = allSwarms.map((_, i) => Boolean(allCounters[i]) && (allCounters[i].toLowerCase() === BUN) === ownToken) + const swarms = allSwarms.filter((_, i) => keep[i]) + const counterOf = allCounters.filter((_, i) => keep[i]) + if (!swarms.length) return api.getBalances() + + const memecoins = await api.multiCall({ abi: 'address:memecoin', calls: swarms, permitFailure: true }) + const vaultCounts = await api.multiCall({ abi: 'uint256:vaultCount', calls: swarms, permitFailure: true }) + // the launched token is only needed to build a range's pool key + const hasPair = (i) => Boolean(memecoins[i]) && memecoins[i] !== nullAddress + + const vaultCalls = swarms.flatMap((s, i) => Array.from({ length: Number(vaultCounts[i] ?? 0) }, (_, j) => ({ target: s, params: [j], swarm: i }))) + const vaults = await api.multiCall({ abi: 'function vaults(uint256) view returns (address)', calls: vaultCalls.map(({ target, params }) => ({ target, params })) }) + const swarmOfVault = vaults.map((_, k) => vaultCalls[k].swarm) + + // cash: the pair asset held by each swarm and each of its vaults + const ownerTokens = swarms.map((s, i) => [[counterOf[i]], s]) + vaults.forEach((v, k) => ownerTokens.push([[counterOf[swarmOfVault[k]]], v])) + await sumTokens2({ api, ownerTokens }) + + // Each vault's pool key for venue 0, the token's Pons pool + const fees = await api.multiCall({ abi: 'uint24:v4Fee', calls: vaults, permitFailure: true }) + const spacings = await api.multiCall({ abi: 'int24:v4TickSpacing', calls: vaults, permitFailure: true }) + const hooks = await api.multiCall({ abi: 'address:v4Hooks', calls: vaults, permitFailure: true }) + const pairOf = (i) => { + const counter = counterOf[i], meme = memecoins[i] + return BigInt(counter) < BigInt(meme) ? [counter, meme] : [meme, counter] + } + const ponsKeyOf = (k) => { + if (!hooks[k] || hooks[k] === nullAddress) return null // not yet graduated: no Pons pool configured + if (!hasPair(swarmOfVault[k]) || fees[k] == null || spacings[k] == null) return null // a key read failed: skip, not throw + const [currency0, currency1] = pairOf(swarmOfVault[k]) + return { currency0, currency1, fee: fees[k], tickSpacing: spacings[k], hooks: hooks[k] } + } + + // ranges: the vaults' open v4 positions. A vault holds them in the PoolManager directly (keyed by + // owner, ticks and a salt), not as position NFTs, so each is valued here from its liquidity and + // ticks at its pool's current price. Venue 0 is the Pons pool; venue i > 0 is extraVenues(i - 1), + // a hookless pool on the same pair. Only the pair-asset side is counted. + const rangeCounts = await api.multiCall({ abi: 'uint256:openRangeCount', calls: vaults, permitFailure: true }) + const rangeCalls = vaults.flatMap((v, k) => Array.from({ length: Number(rangeCounts[k] ?? 0) }, (_, j) => ({ target: v, params: [j], vault: k }))) + // a range or venue that does not read is skipped, not allowed to fail the whole run + const ranges = rangeCalls.length ? await api.multiCall({ abi: RANGE_ABI, calls: rangeCalls.map(({ target, params }) => ({ target, params })), permitFailure: true }) : [] + const extraKeys = [...new Set(rangeCalls.map((r, j) => ranges[j] && Number(ranges[j].venue) > 0 ? `${r.vault}:${Number(ranges[j].venue)}` : null).filter(Boolean))] + const extraCalls = extraKeys.map(key => { const [k, v] = key.split(':').map(Number); return { target: vaults[k], params: [v - 1], key } }) + const extras = extraCalls.length ? await api.multiCall({ abi: EXTRA_VENUE_ABI, calls: extraCalls.map(({ target, params }) => ({ target, params })), permitFailure: true }) : [] + const venueOf = new Map(extraCalls.map((c, i) => [c.key, extras[i]])) + const rangeKeys = rangeCalls.map((r, j) => { + if (!ranges[j]) return null + const venue = Number(ranges[j].venue) + if (venue === 0) return ponsKeyOf(r.vault) + if (!hasPair(swarmOfVault[r.vault])) return null + const [currency0, currency1] = pairOf(swarmOfVault[r.vault]), extra = venueOf.get(`${r.vault}:${venue}`) + if (!extra) return null + return { currency0, currency1, fee: extra.fee, tickSpacing: extra.tickSpacing, hooks: nullAddress } + }) + + // one slot0 read per pool a range sits on + const rangePools = rangeKeys.map(key => key ? poolIdOf(key) : null) + const pools = [...new Set(rangePools.filter(Boolean))] + const slot0 = pools.length ? await api.multiCall({ abi: GET_SLOT0_ABI, target: STATE_VIEW, calls: pools, permitFailure: true }) : [] + const sqrtPriceOf = new Map(pools.map((id, i) => [id, slot0[i] ? Number(slot0[i].sqrtPriceX96) / 2 ** 96 : 0])) + + ranges.forEach((r, j) => { + if (!r) return + const key = rangeKeys[j], sp = key && sqrtPriceOf.get(rangePools[j]), L = Number(r.liquidity) + if (!sp || !L) return + const sa = Math.sqrt(1.0001 ** Number(r.tickLower)), sb = Math.sqrt(1.0001 ** Number(r.tickUpper)) + let amount0 = 0, amount1 = 0 + if (sp <= sa) amount0 = L * (sb - sa) / (sa * sb) + else if (sp >= sb) amount1 = L * (sb - sa) + else { amount0 = L * (sb - sp) / (sp * sb); amount1 = L * (sp - sa) } + const i = swarmOfVault[rangeCalls[j].vault], counterIs0 = key.currency0 === counterOf[i] + api.add(counterOf[i], BigInt(Math.floor(counterIs0 ? amount0 : amount1))) + }) + + return api.getBalances() +} + +module.exports = { + doublecounted: true, + methodology: + "TVL is the pair asset (native ETH or the bundle's ERC20 pair asset) held by Mosh bundles on Robinhood Chain: by each bundle's swarm contract (open raises and backers' unclaimed fees), by its agent vaults, and on the pair-asset side of the vaults' open Uniswap v4 ranges. Bundles paired against BUN are reported under staking. Range liquidity is also Uniswap v4 TVL, so the listing is double counted.", + robinhood: { + tvl: (api) => pairAssetBalances(api, false), + staking: (api) => pairAssetBalances(api, true), + }, +} diff --git a/projects/treasury/mosh.js b/projects/treasury/mosh.js new file mode 100644 index 00000000000..d44e3bbf511 --- /dev/null +++ b/projects/treasury/mosh.js @@ -0,0 +1,17 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +// The Mosh treasury: a Safe on Robinhood Chain that receives Mosh's share of bundle fees and the raise +// fees, and backs bundles itself. Further treasury wallets go in `owners`. +const MOSH_TREASURY = "0x6736b8bc65f110e02ca4f681fd84375940f37da6"; + +module.exports = treasuryExports({ + robinhood: { + owners: [MOSH_TREASURY], + tokens: [ + nullAddress, + "0x5fc5360d0400a0fd4f2af552add042d716f1d168", // USDG + "0xc9a981fee1f9dec688bb123ccdecc63d0debfc4e", // GLD + ], + ownTokens: ["0x07ebb29a38fbcb41563817e5e19f2cec619c90d2"], // BUN + }, +}); From efef58395c2f9dd403252c068258803a4b1c84a5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 8 Oct 2026 15:52:17 +0200 Subject: [PATCH 148/988] fix broken --- projects/bidask/index.js | 55 ++++++++--------- projects/cellana/index.js | 79 ++++++++++++------------- projects/muesliswap/index.js | 56 ++---------------- projects/optim-liquidity-bonds/index.js | 38 +++++++++--- projects/prime-protocol/index.js | 2 +- projects/stakedicp/index.js | 19 +----- projects/thalaswap-v2/index.js | 50 +++++++--------- projects/yusan/index.js | 32 +++++----- 8 files changed, 141 insertions(+), 190 deletions(-) diff --git a/projects/bidask/index.js b/projects/bidask/index.js index 4d0f1fb7a2f..88232a03d65 100644 --- a/projects/bidask/index.js +++ b/projects/bidask/index.js @@ -1,39 +1,32 @@ -const { getConfig } = require('../helper/cache') -const ADDRESSES = require('../helper/coreAssets.json') -const { addTonBalances, addJettonBalances } = require('../helper/chain/ton') -const { sleep } = require('../helper/utils') - -const TON_ADDRESS = '0:0000000000000000000000000000000000000000000000000000000000000000' - +const { addTonBalances } = require('../helper/chain/ton') +const { sliceIntoChunks } = require('../helper/utils') +const { ton } = require('@defillama/sdk').chains + +const FACTORY = 'EQAuBZGak9BdkxuCC9gWUsY4Em3jog94BI4eRzX-3_Bidask' +const DEPLOY_POOL_OP = '0xb814c41a' + +// every pool is deployed by the factory via a message carrying state init +async function getPools() { + const pools = new Set() + const limit = 1000 + for (let offset = 0; ; offset += limit) { + const { messages } = await ton.toncenterGet({ path: 'messages', params: { source: FACTORY, limit, offset, sort: 'asc' } }) + messages.filter(m => m.opcode === DEPLOY_POOL_OP && m.init_state).forEach(m => pools.add(m.destination)) + if (messages.length < limit) break + } + return [...pools] +} module.exports = { - misrepresentedTokens: true, + methodology: 'Pools are discovered from deploy messages sent by the Bidask factory; TVL is the TON and jetton balances held by those pools.', timetravel: false, ton: { tvl: async (api) => { - const response = await getConfig('bidask', 'https://bidask.finance/api/pools?size=1000&all=false') - const pools = response.result; - - const tokenToPoolsMap = {} - - pools.forEach(pool => { - const tokenXAddress = pool.tokens.token_x.address - const tokenYAddress = pool.tokens.token_y.address === TON_ADDRESS ? ADDRESSES.ton.TON : pool.tokens.token_y.address - - tokenToPoolsMap[tokenXAddress] ??= [] - tokenToPoolsMap[tokenXAddress].push(pool.address) - - tokenToPoolsMap[tokenYAddress] ??= [] - tokenToPoolsMap[tokenYAddress].push(pool.address) - }) - - for (const tokenAddress in tokenToPoolsMap) { - if (ADDRESSES.ton.TON === tokenAddress) { - await addTonBalances({ api, addresses: tokenToPoolsMap[tokenAddress] }) - } else { - await addJettonBalances({ api, jettonAddress: tokenAddress, addresses: tokenToPoolsMap[tokenAddress] }) - } - await sleep(1000) + const pools = await getPools() + await addTonBalances({ api, addresses: pools }) + for (const chunk of sliceIntoChunks(pools, 100)) { + const wallets = await ton.getJettonWallets({ owner: chunk, excludeZeroBalance: true }) + wallets.forEach(({ jetton, balance }) => api.add(ton.normalizeAddress(jetton), balance)) } } } diff --git a/projects/cellana/index.js b/projects/cellana/index.js index 241c646932a..e3311ffd1c6 100644 --- a/projects/cellana/index.js +++ b/projects/cellana/index.js @@ -1,47 +1,46 @@ +const { GraphQLClient } = require("graphql-request"); const { function_view } = require("../helper/chain/aptos"); -const { sleep } = require("../helper/utils"); +const { sliceIntoChunks } = require("../helper/utils"); const cellanaAddress = "0x4bf51972879e3b95c4781a5cdcb9e1ee24ef483e7d22f2d903626f126df62bd1" -const MAX_RETRIES = 5; - -async function callWithRetry(fn) { - for (let i = 0; i <= MAX_RETRIES; i++) { - try { return await fn() } catch (e) { - if (i === MAX_RETRIES) throw e; - // rate limits (429) need a long backoff before the quota window resets - const isRateLimit = e?.response?.status === 429 || /429/.test(e?.message ?? '') - await sleep(isRateLimit ? 10000 * (i + 1) : 200 * (i + 1)); - } +const graphQLClient = new GraphQLClient("https://api.mainnet.aptoslabs.com/v1/graphql"); +const FA_BALANCES_QUERY = `query CellanaPoolBalances($addresses: [String!]!, $limit: Int!, $offset: Int!) { + current_fungible_asset_balances(where: { owner_address: { _in: $addresses } }, order_by: { storage_id: asc }, limit: $limit, offset: $offset) { + amount + asset_type } -} - -async function _getPools() { - return function_view({ functionStr: `${cellanaAddress}::liquidity_pool::all_pool_addresses`, type_arguments: [], args: [] }) -} - -async function _getPoolReserves(poolAddress) { - return function_view({ functionStr: `${cellanaAddress}::liquidity_pool::pool_reserves`, type_arguments: ['0x1::object::ObjectCore'], args: [poolAddress] }) -} - -async function _getTokenOfPool(poolAddress) { - return function_view({ functionStr: `${cellanaAddress}::liquidity_pool::supported_token_strings`, type_arguments: [], args: [poolAddress] }) -} - +}` +const FA_CREATORS_QUERY = `query CellanaAssetCreators($assets: [String!]!) { + fungible_asset_metadata(where: { asset_type: { _in: $assets } }) { + asset_type + creator_address + } +}` async function tvl(api) { - const pools = (await _getPools()) - - for (const pool of pools) { - const poolAddress = pool.inner - const reserves = await callWithRetry(() => _getPoolReserves(poolAddress)); - const tokens = await callWithRetry(() => _getTokenOfPool(poolAddress)); - - if (!reserves || !tokens || tokens.length < 2) - throw new Error(`Invalid data for pool ${poolAddress}`); - - api.add(tokens[0], reserves[0]); - api.add(tokens[1], reserves[1]); - await sleep(200); + const pools = await function_view({ functionStr: `${cellanaAddress}::liquidity_pool::all_pool_addresses`, type_arguments: [], args: [] }) + // pool reserves sit in fungible stores owned by the pool objects; one indexer query per 50 pools + // instead of two rate-limited view calls per pool + const balances = {} + // the indexer silently truncates large responses (4 stores per pool), so page through each chunk + const limit = 100 + for (const chunk of sliceIntoChunks(pools.map(p => p.inner), 50)) { + for (let offset = 0; ; offset += limit) { + const { current_fungible_asset_balances: rows } = await graphQLClient.request(FA_BALANCES_QUERY, { addresses: chunk, limit, offset }) + rows.forEach(({ amount, asset_type }) => { + if (+amount > 0) balances[asset_type] = (balances[asset_type] ?? 0n) + BigInt(amount) + }) + if (rows.length < limit) break + } + } + // legacy coins are held as cellana coin_wrapper FAs; get_original maps them back to the priceable coin type. + // only FAs created by the wrapper account need the lookup + const wrapperAddress = await function_view({ functionStr: `${cellanaAddress}::coin_wrapper::wrapper_address` }) + const { fungible_asset_metadata: metadata } = await graphQLClient.request(FA_CREATORS_QUERY, { assets: Object.keys(balances) }) + const wrapped = new Set(metadata.filter(m => m.creator_address === wrapperAddress).map(m => m.asset_type)) + for (const [asset, amount] of Object.entries(balances)) { + const token = wrapped.has(asset) ? await function_view({ functionStr: `${cellanaAddress}::coin_wrapper::get_original`, args: [asset] }) : asset + api.add(token, amount.toString()) } } @@ -49,8 +48,8 @@ module.exports = { timetravel: false, isHeavyProtocol: true, methodology: - "Counts the lamports in each coin container in the Cellana contract account.", + "Counts the tokens held in every Cellana liquidity pool.", aptos: { tvl, } -} \ No newline at end of file +} diff --git a/projects/muesliswap/index.js b/projects/muesliswap/index.js index ec768bfe352..9c998c15397 100644 --- a/projects/muesliswap/index.js +++ b/projects/muesliswap/index.js @@ -31,57 +31,9 @@ async function staking() { async function adaTvl() { let totalAda = 0 - // fetch the prices of each traded token first - const adaPrices = new Map(Object.entries((await fetchURL("https://api.muesliswap.com/defillama/prices")).data)) - - /* // then first accumulate over the legacy orderbook - const orderbookV1 = (await fetchURL("https://orders.muesliswap.com/all-orderbooks")).data - const vOrderbookV1 = orderbookV1.map(ob => { - if (ob.fromToken === ".") { - const totalBuy = ob.buy.map(o => parseFloat(o.totalPrice)).reduce((p, c) => p + c, 0) - const totalSell = ob.sell.map(o => parseFloat(o.amount)).reduce((p, c) => p + c, 0) - // Find the price (we need to convert the tokenname to hex first for this) - const policyId = ob.toToken.split('.')[0] - const name = Buffer.from(ob.toToken.split('.', 2)[1]).toString('hex').toLowerCase() - const price = (adaPrices.get(policyId + '.' + name)?.bidPrice ?? 0) / 1e6 - return (totalBuy + totalSell * price) - } else { - const totalBuy = ob.buy.map(o => parseFloat(o.totalPrice)).reduce((p, c) => p + c, 0) - const totalSell = ob.sell.map(o => parseFloat(o.amount)).reduce((p, c) => p + c, 0) - // Find the price (we need to convert the tokenname to hex first for this) - const fromPolicyId = ob.fromToken.split('.')[0] - const fromName = Buffer.from(ob.fromToken.split('.', 2)[1]).toString('hex').toLowerCase() - const fromPrice = (adaPrices.get(fromPolicyId + '.' + fromName)?.bidPrice ?? 0) / 1e6 - const toPolicyId = ob.toToken.split('.')[0] - const toName = Buffer.from(ob.toToken.split('.', 2)[1]).toString('hex').toLowerCase() - const toPrice = (adaPrices.get(toPolicyId + '.' + toName)?.bidPrice ?? 0) / 1e6 - return (totalBuy * fromPrice + totalSell * toPrice) - } - }) - totalAda += vOrderbookV1.reduce((p, c) => p + c, 0) */ - - // then accumulate over the orderbooks - const orderbookV2 = (await fetchURL("https://onchain.muesliswap.com/all-orderbooks")).data - const vOrderbookV2 = orderbookV2 - .map(ob => { - if (ob.fromToken === ".") { - const totalBuy = ob.orders - .filter(o => !o.providers.includes("muesliswapAMM")) - .map(o => parseInt(o.fromAmount)).reduce((p, c) => p + c, 0) - return totalBuy - } else { - const price = adaPrices.get(ob.fromToken)?.bidPrice ?? 0 - const totalAmountOtherToken = ob.orders - .filter(o => !o.providers.includes("muesliswapAMM")) - .map(o => parseInt(o.fromAmount)).reduce((p, c) => p + c, 0) - const totalSell = totalAmountOtherToken * price - return totalSell - } - }) - totalAda += vOrderbookV2.reduce((p, c) => p + c, 0) / 1e6 - - // and add pool TVLs - const pools = (await fetchURL("https://api.muesliswap.com/liquidity/pools?providers=muesliswap,muesliswap_clp,muesliswap_v2&only-verified=n")).data + // old api.muesliswap.com / onchain.muesliswap.com hosts are gone and api-v2 has no all-orderbooks/prices + // equivalent, so open orders can no longer be valued; only AMM pools are counted + const pools = (await fetchURL("https://api-v2.muesliswap.com/liquidity/pools?providers=muesliswap-v1,muesliswap-v2,muesliswap-clp&only-verified=n")).data const vPools = pools.map(p => { const amountA = parseInt(p.tokenA.amount) * parseFloat(p.tokenA.priceAda) const amountB = parseInt(p.tokenB.amount) * parseFloat(p.tokenB.priceAda) @@ -97,7 +49,7 @@ async function adaTvl() { module.exports = { misrepresentedTokens: true, timetravel: false, - methodology: "The factory addresses are used to find the LP pairs on Smart BCH and Milkomeda. For Cardano we calculate the tokens on resting orders on the order book contracts. TVL is equal to the liquidity on the AMM plus the open orders in the order book", + methodology: "The factory addresses are used to find the LP pairs on Smart BCH and Milkomeda. For Cardano TVL is equal to the liquidity on the MuesliSwap AMM pools", cardano: { tvl: adaTvl, // staking diff --git a/projects/optim-liquidity-bonds/index.js b/projects/optim-liquidity-bonds/index.js index 11e43782372..aa2c39b93be 100644 --- a/projects/optim-liquidity-bonds/index.js +++ b/projects/optim-liquidity-bonds/index.js @@ -1,13 +1,37 @@ -const { get } = require('../helper/http') +const { sumTokensExport } = require('../helper/chain/cardano') + +// payment credentials (bech32 script hashes): each bond/pool/vault UTxO carries a different stake part, so they are queried by credential, not by address +const scripts = [ + // liquidity bonds: bond validators, lender ADA locked in issued bonds + 'script15plzrmq39wwa9cvjw7zy7aqycn8ak6jlej7gcsnj5xe26unnlyp', + 'script1r53epw45fa3x0sq523tdct6l3639sm7tp2k6c4f9mxjqvrt0cek', + // liquidity bonds: per-offer pool validators, lender ADA waiting to fund a bond + 'script18f4hlq89uk43qkju5mlruy69vzz0l4930k2q3f30u9e05elgsml', + 'script1gfyssard8n8a2petps3ep6ndrgnuhp9gmgt5u97zg2dvjcqu6ja', + 'script1ck008g9tund0eyfhyvppaclytnfrsn0nwc67r35mgqefvcr34xg', + 'script1lrm48jdvaxncehwjydn2l7wrvx83wm7av7frzut6z4dak8xtu5u', + 'script1yuu8udwjleva6j2kdqw9t3tauv7wftwcu9fgt244vx7tqlez7nm', + 'script1dst7vhwp6m755nlmp7ngdddpuf92s9m3hfqdd30pf0uu22n2p4n', + 'script15jh5sl8kfwht9dkrnzjpztaf7t6vs3n2vzlhwfzaey47zfr5333', + 'script1nuyzrfx9uxusxmyjwjpcslypcv2slldvv986qwhtv894whxvshc', + 'script1ldq3yhgppv005g3wa269653j3aqvj6geglyk0e9a5z045mmpt2x', + 'script1y20vcxsdcu5kfaw065m6j4t2n83dxnn6rp4w75effwllwcpynmq', + 'script129dzzmy8s35hptktn4tq2q2v2whz5l5vt30029ltraswcqz5y92', + 'script1nvw24vvjdat43p7gc75nm8f3s8h9ezht3j8m56ny7s29vgvv2j5', + 'script1s2nchqddyv5qwnnypc8wrc63h68l0wkkq8xgr34e834mkzdjtpp', + 'script1qh83dw08xdc8s2mjayhn8c7g7d47a5mqwj6ly3es4f6zxpa4ekc', + 'script1vr0aesy7edh90yl8tnmyrua7lznlwuujemytuhye9lp7wkj7pez', + // OADA v2: vault and staking strategy validators backing OADA/sOADA + 'script1t57ln870h0eg90tk50tk5t3shhfzucw9du2xy3re8zfnk6pgenc', + 'script1793v28s7qgss7zy5ujnjeskxzdc9pq87y07903gwd5ln6mvg5zy', + 'script12nn8adscy06atypxlt9jeawz587jzmhc4xnylatkzug0jyfyjhz', +] module.exports = { timetravel: false, + methodology: 'ADA locked in the Liquidity Bonds bond and pool contracts plus the OADA v2 vault and staking strategy contracts, read on-chain by payment credential. OADA and protocol tokens held by the contracts are excluded.', + hallmarks: [['2026-09-13', 'OADA paused after Splash pool exploit, liquidity pulled']], cardano: { - tvl: async () => { - const data = await get('https://spo-server.optim.finance/tvl') - return { - cardano: data.historicalData.totalLovelace/1e6 - } - } + tvl: sumTokensExport({ scripts, tokens: ['lovelace'] }), }, }; diff --git a/projects/prime-protocol/index.js b/projects/prime-protocol/index.js index 07379c2fdd3..6b5e2c3109e 100644 --- a/projects/prime-protocol/index.js +++ b/projects/prime-protocol/index.js @@ -129,5 +129,5 @@ module.exports = { }; Object.keys(PRIME_SATELLITE_NETWORKS).forEach(primeSatelliteNetwork => { - module.exports[primeSatelliteNetwork] = { tvl, borrowed, } + module.exports[primeSatelliteNetwork] = { tvl, borrowed: () => ({}), } }) diff --git a/projects/stakedicp/index.js b/projects/stakedicp/index.js index 54a68c79086..e538d6b6823 100644 --- a/projects/stakedicp/index.js +++ b/projects/stakedicp/index.js @@ -1,22 +1,9 @@ -const { get } = require("../helper/http"); - -const url = 'https://h6uvl-xiaaa-aaaap-qaawa-cai.raw.ic0.app/tvl'; - -async function tvl(_timestamp, _block) { - const tvl = (await get(url)).tvl; - if (tvl === undefined) { - // API didn't return a tvl number to work with - throw new Error("Unknown"); - } - return { - "coingecko:internet-computer": tvl/1e8, - }; -} - +// canister h6uvl-xiaaa-aaaap-qaawa-cai has had its wasm module uninstalled, so the /tvl endpoint no longer exists module.exports = { + deadFrom: '2026-10-07', // abandoned? timetravel: false, methodology: "TVL counts ICP deposited as collateral to mint stICP", icp: { - tvl, + tvl: () => ({}), }, }; diff --git a/projects/thalaswap-v2/index.js b/projects/thalaswap-v2/index.js index 0c0478614e0..2f1741d542a 100644 --- a/projects/thalaswap-v2/index.js +++ b/projects/thalaswap-v2/index.js @@ -1,41 +1,37 @@ +const { GraphQLClient } = require("graphql-request"); const { getConfig } = require("../helper/cache"); -const { function_view } = require("../helper/chain/aptos"); +const { sliceIntoChunks } = require("../helper/utils"); -const thalaswapLensAddress = "ff1ac437457a839f7d07212d789b85dd77b3df00f59613fcba02388464bfcacb"; - -async function getPool(lensAddress, lptAddress) { - const args = [lptAddress]; - const fn = () => function_view({ functionStr: `${lensAddress}::lens::get_pool_info`, args}); - - let lastError; - for (let i = 0; i < 3; i++) { - try { - return await fn(); - } catch (err) { - lastError = err; - await new Promise(res => setTimeout(res, 200)); - } +const graphQLClient = new GraphQLClient("https://api.mainnet.aptoslabs.com/v1/graphql"); +const FA_BALANCES_QUERY = `query ThalaswapV2PoolBalances($addresses: [String!]!, $limit: Int!, $offset: Int!) { + current_fungible_asset_balances(where: { owner_address: { _in: $addresses } }, order_by: { storage_id: asc }, limit: $limit, offset: $offset) { + amount + asset_type } - - return null; -} +}` const tvl = async (api) => { const { data: poolsData } = await getConfig('thalaswa-v2', 'https://app.thala.fi/api/liquidity-pools'); - const v2Pools = poolsData.filter(pool => pool.metadata.isV2) + const pools = poolsData.filter(pool => pool.metadata.isV2).map(pool => pool.metadata.lptAddress) + const lpTokens = new Set(pools) - for (const v2Pool of v2Pools) { - const poolInfo = await getPool(thalaswapLensAddress, v2Pool.metadata.lptAddress) - if (!poolInfo) continue; - const assets = poolInfo.assets_metadata.map(asset => asset.inner) - if (!assets) continue - const balances = poolInfo.balances - api.add(assets, balances) + // pool assets sit in fungible stores owned by the pool object (address == LP token address); read them from the + // indexer instead of one rate-limited lens view call per pool. the indexer truncates large responses, so paginate + const limit = 100 + for (const chunk of sliceIntoChunks(pools, 50)) { + for (let offset = 0; ; offset += limit) { + const { current_fungible_asset_balances: rows } = await graphQLClient.request(FA_BALANCES_QUERY, { addresses: chunk, limit, offset }) + rows.forEach(({ amount, asset_type }) => { + if (!lpTokens.has(asset_type)) api.add(asset_type, amount) + }) + if (rows.length < limit) break + } } } module.exports = { timetravel: false, + isHeavyProtocol: true, methodology: "Aggregates TVL in all pools in Thalaswap, Thala Labs' AMM.", aptos: { tvl } -} \ No newline at end of file +} diff --git a/projects/yusan/index.js b/projects/yusan/index.js index ba33b2aa00d..71014cc6167 100644 --- a/projects/yusan/index.js +++ b/projects/yusan/index.js @@ -1,37 +1,37 @@ +const { icp } = require('@defillama/sdk').chains const { getCache } = require('../helper/http') -const YUSAN_API = 'https://yusan.fi/metrics_json' +const YUSAN_CANISTER = '52mp3-qiaaa-aaaar-qbzja-cai' +const YUSAN_API = 'https://yusan.fi/metrics_json' // served by the canister itself, borrows are only exposed here +const YUSAN_DECIMALS = 8 // internal accounting decimals used by metrics_json const tokens = { - ICP: { decimals: 8, coingeckoId: 'internet-computer' }, - USDC: { decimals: 8, coingeckoId: 'usd-coin' }, - USDT: { decimals: 8, coingeckoId: 'tether' }, - ckBTC: { decimals: 8, coingeckoId: 'bitcoin' }, - ckDOGE: { decimals: 8, coingeckoId: 'dogecoin' }, + ICP: { ledger: 'ryjl3-tyaaa-aaaaa-aaaba-cai', decimals: 8, coingeckoId: 'internet-computer' }, + ckBTC: { ledger: 'mxzaz-hqaaa-aaaar-qaada-cai', decimals: 8, coingeckoId: 'bitcoin' }, + ckDOGE: { ledger: 'efmc5-wyaaa-aaaar-qb3wa-cai', decimals: 8, coingeckoId: 'dogecoin' }, + USDC: { ledger: '53nhb-haaaa-aaaar-qbn5q-cai', decimals: 6, coingeckoId: 'usd-coin' }, // 1sec USDC + USDT: { ledger: 'ij33n-oiaaa-aaaar-qbooa-cai', decimals: 6, coingeckoId: 'tether' }, // 1sec USDT + WTN: { ledger: 'jcmow-hyaaa-aaaaq-aadlq-cai', decimals: 8, coingeckoId: 'waterneuron' }, } async function tvl(api) { - const data = await getCache(YUSAN_API) - - for (const [symbol, { decimals, coingeckoId }] of Object.entries(tokens)) { - const supply = data.tokens[symbol]?.total_supply || 0 - const borrow = data.tokens[symbol]?.total_borrow || 0 - const available = supply - borrow - if (available > 0) api.addCGToken(coingeckoId, available / 10 ** decimals) + for (const { ledger, decimals, coingeckoId } of Object.values(tokens)) { + const balance = await icp.getIcrcBalance({ ledger, owner: YUSAN_CANISTER }) + api.addCGToken(coingeckoId, Number(balance) / 10 ** decimals) } } async function borrowed(api) { const data = await getCache(YUSAN_API) - for (const [symbol, { decimals, coingeckoId }] of Object.entries(tokens)) { + for (const [symbol, { coingeckoId }] of Object.entries(tokens)) { const balance = data.tokens[symbol]?.total_borrow || 0 - if (balance > 0) api.addCGToken(coingeckoId, balance / 10 ** decimals) + if (balance > 0) api.addCGToken(coingeckoId, balance / 10 ** YUSAN_DECIMALS) } } module.exports = { timetravel: false, - methodology: 'TVL is supplied assets minus borrowed assets in Yusan lending markets.', + methodology: 'TVL is the balance of the Yusan lending canister on each token ledger (supplied assets, collateral and liquidation pool, net of borrows).', icp: { tvl, borrowed }, } From c4d4931f9ddacee8074e837043cf66c6b0a99919 Mon Sep 17 00:00:00 2001 From: ross <92001561+z0r0z@users.noreply.github.com> Date: Thu, 8 Oct 2026 21:35:31 +0700 Subject: [PATCH 149/988] Add Tacit TVL adapter (Ethereum, Base, Robinhood Chain) (#21437) Co-authored-by: FelixBruguera --- registries/sumTokens/data3.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 123813d1c89..a9a51efcae5 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1128,4 +1128,29 @@ module.exports = { "tokens": [ADDRESSES.base.WETH, ADDRESSES.base.USDC] } }, + "tacit": { + "methodology": "TVL is the ETH held by Tacit's shielded pools: the ETH wrapped into the ConfidentialPool on Ethereum, and the ETH shielded in the TacitEvmPool on Ethereum, Base and Robinhood Chain. Balances are read from the pool contracts.", + "start": "2026-09-17", + "ethereum": { + "owners": [ + "0x000000000Ed1eabD231Be41d93b719056F7febFC", + "0x000000c2A20657CE25f2Ba99737933D031AFBEE9" + ], + "tokens": [ + ADDRESSES.null + ] + }, + "base": { + "owner": "0x000000c2A20657CE25f2Ba99737933D031AFBEE9", + "tokens": [ + ADDRESSES.null + ] + }, + "robinhood": { + "owner": "0x000000c2A20657CE25f2Ba99737933D031AFBEE9", + "tokens": [ + ADDRESSES.null + ] + }, + } } From c2cd0d2330042deb8cafa83df57b1c00ed17082d Mon Sep 17 00:00:00 2001 From: routebuilder Date: Thu, 8 Oct 2026 16:36:59 +0200 Subject: [PATCH 150/988] Add Stride chain shutdown hallmark (#21467) --- projects/stride/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/stride/index.js b/projects/stride/index.js index 836b8edae60..42c35693084 100644 --- a/projects/stride/index.js +++ b/projects/stride/index.js @@ -136,6 +136,9 @@ function makeTvlFn(chain) { module.exports = { timetravel: false, methodology: "Sum of all the tokens that are liquid staked on Stride", + hallmarks: [ + ['2026-09-29', 'Stride chain shutdown proposed (funding shortfall); redemptions until Oct 12, moving to Osmosis ~Nov 20'], + ], stride: { tvl: async () => ({}), // kept so tvl history doesnt disappear }, From 49fd96297661abaada338cfd00a9001fca6df56e Mon Sep 17 00:00:00 2001 From: R25 Team Date: Thu, 8 Oct 2026 23:08:12 +0800 Subject: [PATCH 151/988] add R25 new vaults (#21480) Co-authored-by: coreyjj1679 --- projects/r25/index.js | 29 +++++++++++++++++++++++++++++ registries/erc4626.js | 11 ----------- 2 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 projects/r25/index.js diff --git a/projects/r25/index.js b/projects/r25/index.js new file mode 100644 index 00000000000..92a0a71815c --- /dev/null +++ b/projects/r25/index.js @@ -0,0 +1,29 @@ +const { sumERC4626VaultsExport2 } = require('../helper/erc4626') +const sui = require('../helper/chain/sui') + +const RCUSDP_STAKING_POOL = '0x64202e28c99a2036134788b750d3223b02f9b3c29b603e3e21e60a41289e395f' +const RCUSD_DECIMALS = 6 + +const pharosVaults = [ + '0x1c2bc8b553d9a7e61f7531a3a4bf2162f4569268', // vRPCWeeklyVault + '0x94f7ebc6ae0819a4b4e231ae6ddaaf9bfd2a1a86', // vRPCQuarterlyVault + '0xee26bb0989691735c997dfdc49a4a607f75e190b', // vRPCSemiYearlyVault + '0x39976f3Ef143a5824d4E4c28c204d556113dCF7f', // pCreditVault + '0xd0428799fbc35557834d33121ba4472692c8908a', // apcVault + '0x6Ce4bc043398Ac40392d1E063328048072b2075d', // hybVault + '0x921974d7b1a2dbaccaf5ba893a3a1500638cea6b', // axilpot +] + +// rcUSD total supply includes unstaked tokens, so vault TVL is PoolInner.staked. +async function tvl(api) { + const pool = await sui.getObject(RCUSDP_STAKING_POOL) + const versioned = pool.fields.inner.fields + const inner = await sui.getDynamicFieldObject(versioned.id.id, versioned.version, { idType: 'u64' }) + api.addUSDValue(Number(inner.fields.value.fields.staked) / 10 ** RCUSD_DECIMALS) +} + +module.exports = { + methodology: 'TVL represents the total value of assets held within the vault. Each vault token is minted using USDC and appreciates in line with the performance of the underlying asset. On Sui, TVL is rcUSD locked in the rcUSDp staking vault, valued at the rcUSD face value of 1 USD.', + pharos: { tvl: sumERC4626VaultsExport2({ vaults: pharosVaults }) }, + sui: { tvl }, +} diff --git a/registries/erc4626.js b/registries/erc4626.js index 929148a9f3c..235fcfe16cc 100644 --- a/registries/erc4626.js +++ b/registries/erc4626.js @@ -260,17 +260,6 @@ const configs = { start: '2026-04-11', base: ['0x71c298a6eb10e7958ce25a450a706330a4c946c0'] }, - 'r25': { - pharos: Object.values({ - vRPCWeeklyVault: '0x1c2bc8b553d9a7e61f7531a3a4bf2162f4569268', - vRPCQuarterlyVault: '0x94f7ebc6ae0819a4b4e231ae6ddaaf9bfd2a1a86', - vRPCSemiYearlyVault: '0xee26bb0989691735c997dfdc49a4a607f75e190b', - pCreditVault: '0x39976f3Ef143a5824d4E4c28c204d556113dCF7f', - apcVault: '0xd0428799fbc35557834d33121ba4472692c8908a', - hybVault: '0x6Ce4bc043398Ac40392d1E063328048072b2075d', - }), - methodology: "TVL represents the total value of assets held within the vault. Each vault token is minted using USDC and appreciates in line with the performance of the underlying asset.", - }, 'visionboard-vault': { timetravel: false, hyperliquid: ['0x0a5e236425aca07fd087904F8863CAd554675E06'], From fec54fd52aaf30b0b9afd570494fb8c751422c90 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 8 Oct 2026 11:31:11 -0400 Subject: [PATCH 152/988] Add Numerai Staking (#21496) Co-authored-by: Noah Harasz --- registries/stakingOnly.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/registries/stakingOnly.js b/registries/stakingOnly.js index dbc04d525ad..5cd0d4dcb2d 100644 --- a/registries/stakingOnly.js +++ b/registries/stakingOnly.js @@ -1417,6 +1417,13 @@ const configs = { staking: ['0x9c648D57E929F59B483b2903390725449F990Cb8', '0x0000000005aCa17e8bd5779Fc87E13cb433aEd24'], }, }, + "numerai": { + "methodology": "NMR staked on models in Numerai's tournament staking contracts (tournaments 8 and 12). NMR is Numerai's own token, so it is reported as staking.", + "start": "2026-07-29", + "ethereum": { + staking: [['0xe44c35ec2896983accce2a38dc1668793e85956d', '0xc1f46adf341145369eee9fbe0d84fa1cb0c24706'], '0x1776e1F26f98b1A5dF9cD347953a26dd3Cb46671'], + }, + }, } module.exports = buildProtocolExports(configs, stakingOnlyExportFn) From 1b1c40b5a902c47029bfbe181d3dffb06e2fb78e Mon Sep 17 00:00:00 2001 From: OxForged Date: Thu, 8 Oct 2026 09:40:27 -0700 Subject: [PATCH 153/988] Peddles: TVL adapter (Uniswap v4 hook pools on Base, Robinhood, BSC, Arc) (#21472) Co-authored-by: FelixBruguera --- projects/helper/uniswapV4.js | 1 + projects/peddles/index.js | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 projects/peddles/index.js diff --git a/projects/helper/uniswapV4.js b/projects/helper/uniswapV4.js index 3ba443e2629..0cedac122b2 100644 --- a/projects/helper/uniswapV4.js +++ b/projects/helper/uniswapV4.js @@ -19,6 +19,7 @@ const chainConfig = { unichain: { poolManager: '0x1F98400000000000000000000000000000000004', fromBlock: 1, stateView: '0x86e8631A016F9068C3f085fAF484Ee3F5fDee8f2' }, monad: { poolManager: '0x188d586ddcf52439676ca21a244753fa19f9ea8e', fromBlock: 29255895, stateView: '0x77395f3b2e73ae90843717371294fa97cc419d64' }, robinhood: { poolManager: '0x8366a39CC670B4001A1121B8F6A443A643e40951', fromBlock: 9070, stateView: '0xf3334192d15450cdd385c8b70e03f9a6bd9e673b' }, + arc: { poolManager: '0x8366a39cc670b4001a1121b8f6a443a643e40951', fromBlock: 1946500, stateView: '0xF3334192D15450CdD385c8B70e03f9A6bD9E673b' }, } const initializeAbi = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks, uint160 sqrtPriceX96, int24 tick)' diff --git a/projects/peddles/index.js b/projects/peddles/index.js new file mode 100644 index 00000000000..e368420ce0c --- /dev/null +++ b/projects/peddles/index.js @@ -0,0 +1,22 @@ +const { uniV4HookOnChainExport } = require('../helper/uniswapV4') + +// Peddles (https://peddles.xyz): every launch is one Uniswap v4 pool carrying PeddlesFeeHook, with the +// launch liquidity locked in it. Pools are found from the PoolManager Initialize logs filtered to the hook +// and valued on chain from tick liquidity via StateView. +// Each chain has its own hook (CREATE2 against per-chain constructor arguments), so nothing is shared. +const hooks = { + base: '0xAB8E39207718f519865D6f0d52eFB31b231D40cc', + robinhood: '0xfe055282E3cD471A8b2cd922d31E75ECd3bBc0CC', + bsc: '0x39D760601731025e0F02A3e5D232445797fAC0CC', + arc: '0x317e34De0298F23bd41bf9A853289e227E9cC0CC', +} + +module.exports = { + doublecounted: true, // the pools live in the Uniswap v4 PoolManager, so Uniswap v4 TVL counts them too + methodology: 'Counts the liquidity in every Uniswap v4 pool created by a Peddles launch, i.e. every pool that runs the Peddles fee hook. Pools are found from the PoolManager Initialize logs and their reserves are rebuilt on chain from tick liquidity and the current price. Launch liquidity is locked in these pools. Fees the hook has accrued but not yet paid out are not counted.', + start: '2026-09-27', +} + +Object.keys(hooks).forEach((chain) => { + module.exports[chain] = { tvl: uniV4HookOnChainExport({ hook: hooks[chain] }) } +}) From 473240f59414635c66d2b784442abca48e314da8 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 8 Oct 2026 15:06:57 -0400 Subject: [PATCH 154/988] mosh: count both sides of active positions (#21504) --- projects/mosh/index.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/projects/mosh/index.js b/projects/mosh/index.js index f0f6f01172d..8d66e46a446 100644 --- a/projects/mosh/index.js +++ b/projects/mosh/index.js @@ -2,8 +2,8 @@ const { getLogs2 } = require('../helper/cache/getLogs') const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') const { ethers } = require('ethers') -// BUN is Mosh's own token. Bundles paired against BUN hold it as their pair asset, and that is -// reported under staking instead of tvl. +// BUN is Mosh's own token. Wherever it is counted (the pair asset of BUN-paired bundles, or the +// launched-token side of the first bundle's ranges) it is reported under staking instead of tvl. const BUN = '0x07ebb29a38fbcb41563817e5e19f2cec619c90d2' // PonsSwarm factories, one per counter asset; each emits SwarmCreated for every bundle @@ -36,8 +36,10 @@ function poolIdOf({ currency0, currency1, fee, tickSpacing, hooks }) { const SwarmCreated = 'event SwarmCreated(address indexed swarm, address indexed creator, uint256 index, bytes32 launchParamsHash)' -// Sums the pair asset of every swarm whose pair asset is (ownToken) or is not (!ownToken) BUN -async function pairAssetBalances(api, ownToken) { +// Sums the swarms' and vaults' pair asset and both sides of the vaults' ranges, keeping only BUN +// (ownToken) or everything but BUN (!ownToken) +async function swarmBalances(api, ownToken) { + const counts = (token) => (token.toLowerCase() === BUN) === ownToken const created = [] for (const target of FACTORIES) created.push(...await getLogs2({ api, target, eventAbi: SwarmCreated, fromBlock })) const allSwarms = [...new Set([...created.map(i => i.swarm.toLowerCase()), ...LEGACY_SWARMS])] @@ -47,9 +49,8 @@ async function pairAssetBalances(api, ownToken) { const counters = await api.multiCall({ abi: 'address:counterAsset', calls: allSwarms, permitFailure: true }) const allCounters = allSwarms.map((s, i) => (native[i] ?? LEGACY_SWARMS.includes(s)) ? nullAddress : counters[i]) // a swarm whose counter asset did not read is skipped rather than allowed to fail the whole run - const keep = allSwarms.map((_, i) => Boolean(allCounters[i]) && (allCounters[i].toLowerCase() === BUN) === ownToken) - const swarms = allSwarms.filter((_, i) => keep[i]) - const counterOf = allCounters.filter((_, i) => keep[i]) + const swarms = allSwarms.filter((_, i) => Boolean(allCounters[i])) + const counterOf = allCounters.filter(Boolean) if (!swarms.length) return api.getBalances() const memecoins = await api.multiCall({ abi: 'address:memecoin', calls: swarms, permitFailure: true }) @@ -64,7 +65,8 @@ async function pairAssetBalances(api, ownToken) { // cash: the pair asset held by each swarm and each of its vaults const ownerTokens = swarms.map((s, i) => [[counterOf[i]], s]) vaults.forEach((v, k) => ownerTokens.push([[counterOf[swarmOfVault[k]]], v])) - await sumTokens2({ api, ownerTokens }) + const counted = ownerTokens.filter(([[token]]) => counts(token)) + if (counted.length) await sumTokens2({ api, ownerTokens: counted }) // Each vault's pool key for venue 0, the token's Pons pool const fees = await api.multiCall({ abi: 'uint24:v4Fee', calls: vaults, permitFailure: true }) @@ -84,7 +86,8 @@ async function pairAssetBalances(api, ownToken) { // ranges: the vaults' open v4 positions. A vault holds them in the PoolManager directly (keyed by // owner, ticks and a salt), not as position NFTs, so each is valued here from its liquidity and // ticks at its pool's current price. Venue 0 is the Pons pool; venue i > 0 is extraVenues(i - 1), - // a hookless pool on the same pair. Only the pair-asset side is counted. + // a hookless pool on the same pair. Both sides are counted, as for any liquidity manager's + // positions. const rangeCounts = await api.multiCall({ abi: 'uint256:openRangeCount', calls: vaults, permitFailure: true }) const rangeCalls = vaults.flatMap((v, k) => Array.from({ length: Number(rangeCounts[k] ?? 0) }, (_, j) => ({ target: v, params: [j], vault: k }))) // a range or venue that does not read is skipped, not allowed to fail the whole run @@ -119,7 +122,8 @@ async function pairAssetBalances(api, ownToken) { else if (sp >= sb) amount1 = L * (sb - sa) else { amount0 = L * (sb - sp) / (sp * sb); amount1 = L * (sp - sa) } const i = swarmOfVault[rangeCalls[j].vault], counterIs0 = key.currency0 === counterOf[i] - api.add(counterOf[i], BigInt(Math.floor(counterIs0 ? amount0 : amount1))) + if (counts(counterOf[i])) api.add(counterOf[i], BigInt(Math.floor(counterIs0 ? amount0 : amount1))) + if (counts(memecoins[i])) api.add(memecoins[i], BigInt(Math.floor(counterIs0 ? amount1 : amount0))) }) return api.getBalances() @@ -128,9 +132,9 @@ async function pairAssetBalances(api, ownToken) { module.exports = { doublecounted: true, methodology: - "TVL is the pair asset (native ETH or the bundle's ERC20 pair asset) held by Mosh bundles on Robinhood Chain: by each bundle's swarm contract (open raises and backers' unclaimed fees), by its agent vaults, and on the pair-asset side of the vaults' open Uniswap v4 ranges. Bundles paired against BUN are reported under staking. Range liquidity is also Uniswap v4 TVL, so the listing is double counted.", + "TVL is the pair asset (native ETH or the bundle's ERC20 pair asset) held by Mosh bundles on Robinhood Chain, by each bundle's swarm contract (open raises and backers' unclaimed fees) and by its agent vaults, plus both sides of the vaults' open Uniswap v4 ranges. Launched tokens the vaults hold outside their ranges are not counted. BUN is reported under staking wherever it appears. Range liquidity is also Uniswap v4 TVL, so the listing is double counted.", robinhood: { - tvl: (api) => pairAssetBalances(api, false), - staking: (api) => pairAssetBalances(api, true), + tvl: (api) => swarmBalances(api, false), + staking: (api) => swarmBalances(api, true), }, } From 80c663b2216756d4e79dc0b2e0f2a17da27dc984 Mon Sep 17 00:00:00 2001 From: solonlend Date: Fri, 9 Oct 2026 16:21:25 +0900 Subject: [PATCH 155/988] Solon: Arc Morpho vault (curators) + SolonPad V3.1 locked positions (#21516) Co-authored-by: solonlend --- projects/solonpad-v3/index.js | 23 ++++++++++++++++------- registries/curators.js | 10 +++++++++- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/projects/solonpad-v3/index.js b/projects/solonpad-v3/index.js index f3121a8658d..ab8fa945e43 100644 --- a/projects/solonpad-v3/index.js +++ b/projects/solonpad-v3/index.js @@ -5,20 +5,29 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const POSITION_MANAGER = '0x6049c9a0e26405C0985f9E3685C87d0aE917f82B' // Uniswap V4 PositionManager on Arc const STATE_VIEW = '0xF3334192D15450CdD385c8B70e03f9A6bD9E673b' // Uniswap V4 StateView on Arc const USDC = ADDRESSES.null // native USDC (gas token, 18 decimals) -const V3_LP_LOCKER = '0x09650Be5c4866971aBbD5C9e92AE495A118fD13F' +const V3_LP_LOCKER = '0x09650Be5c4866971aBbD5C9e92AE495A118fD13F' // V3.0 launches (2026-10-03 to 10-07) const V3_DEPLOY_BLOCK = 23985516 +const V31_FEE_SPLITTER = '0x985E396A2e7421cFF1A453d9E7B02cc91BCe1D55' // V3.1 launches (every launch since 2026-10-07) +const V31_DEPLOY_BLOCK = 24316034 const TRANSFER_TOPIC = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' -async function tvl(api) { - // The V4 PositionManager has no enumeration, so token ids come from Transfer logs and are re-verified with ownerOf +// The V4 PositionManager has no enumeration, so token ids come from Transfer logs and are re-verified with ownerOf +async function lockedPositionIds(api, owner, fromBlock, extraKey) { const transfers = await getLogs2({ - api, target: POSITION_MANAGER, fromBlock: V3_DEPLOY_BLOCK, extraKey: 'solonpad-v3-locker', + api, target: POSITION_MANAGER, fromBlock, extraKey, eventAbi: 'event Transfer(address indexed from, address indexed to, uint256 indexed id)', - topics: [TRANSFER_TOPIC, null, '0x' + V3_LP_LOCKER.slice(2).toLowerCase().padStart(64, '0')], + topics: [TRANSFER_TOPIC, null, '0x' + owner.slice(2).toLowerCase().padStart(64, '0')], }) const ids = [...new Set(transfers.map(i => i.id.toString()))] const owners = await api.multiCall({ target: POSITION_MANAGER, abi: 'function ownerOf(uint256) view returns (address)', calls: ids, permitFailure: true }) - const positionIds = ids.filter((_, i) => owners[i]?.toLowerCase() === V3_LP_LOCKER.toLowerCase()) + return ids.filter((_, i) => owners[i]?.toLowerCase() === owner.toLowerCase()) +} + +async function tvl(api) { + const positionIds = [ + ...await lockedPositionIds(api, V3_LP_LOCKER, V3_DEPLOY_BLOCK, 'solonpad-v3-locker'), + ...await lockedPositionIds(api, V31_FEE_SPLITTER, V31_DEPLOY_BLOCK, 'solonpad-v31-splitter'), + ] if (!positionIds.length) return // Stock-quoted launches (NVDA.sol, AAPL.sol, TSLA.sol) are not counted here: their backing is counted under solon-stocks @@ -29,7 +38,7 @@ async function tvl(api) { } module.exports = { - methodology: 'TVL is the USDC side of the launch positions permanently locked in the V3LPLocker, enumerated from PositionManager Transfer events and re-verified with ownerOf. Launched tokens are not counted. The stock-token side of stock-quoted launches is not counted here, since the stock backing those tokens is counted under Solon Stocks. Marked doublecounted because the locked positions already sit inside Uniswap V4 TVL on Arc.', + methodology: 'TVL is the USDC side of the launch positions permanently locked by the protocol: the V3LPLocker for V3.0 launches and the V31FeeSplitter for V3.1 launches (the serving stack since 2026-10-07), enumerated from PositionManager Transfer events and re-verified with ownerOf. Launched tokens are not counted. The stock-token side of stock-quoted launches is not counted here, since the stock backing those tokens is counted under Solon Stocks. Marked doublecounted because the locked positions already sit inside Uniswap V4 TVL on Arc.', doublecounted: true, start: '2026-10-03', arc: { tvl }, diff --git a/registries/curators.js b/registries/curators.js index d78e6280f39..0bd921061a8 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -1190,7 +1190,7 @@ const configs = { }, "solon": { config: { - methodology: 'Counts all assets deposited in Morpho vaults curated by Solon on Robinhood Chain.', + methodology: 'Counts all assets deposited in Morpho vaults curated by Solon on Robinhood Chain and Arc.', blockchains: { robinhood: { morphoVaultOwners: [ @@ -1200,6 +1200,14 @@ const configs = { '0xCBB61788fB5A1969C93A222B1a12E4D1A50c6d99', // Solon USDG Vault (explicit fallback) ], }, + arc: { + morphoVaultOwners: [ + '0xdD43ee6f3fc4786c62D0727F07F4c668EE9F4F13', // Solon curator/owner on Arc - auto-tracks current & future vaults + ], + morpho: [ + '0xD02ece663C03D2786033140c77BB71d85f552b0c', // SolonLend USDC Vault (explicit fallback) + ], + }, } }, }, From 3c7c4bdc40907cf63459513fc1003d5a0e5813e8 Mon Sep 17 00:00:00 2001 From: EZManagerTGC Date: Fri, 9 Oct 2026 02:22:15 -0500 Subject: [PATCH 156/988] Fix EZManager Base TVL: include Aerodrome Slipstream V3 positions (#21514) Co-authored-by: EZManagerTGC <260291702+EZManagerTGC@users.noreply.github.com> --- registries/sumTokens.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 810b20b0546..2a209369db5 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -14381,7 +14381,8 @@ const configs = { "base": { "owner": "0x61c36AFF32Be348a3D1FE1E2B4745048f652770F", "resolveUniV3": true, - "resolveSlipstream": true + "resolveSlipstream": true, + "resolveSlipstreamV3": true }, "arbitrum": { "owner": "0xD52170Ae01B9198246842D9a4Ad964AcD786ae91", From 3cb56693c6ebcfe99f1919a49512d674cff220d7 Mon Sep 17 00:00:00 2001 From: tree Date: Fri, 9 Oct 2026 13:04:23 +0530 Subject: [PATCH 157/988] Add Derive v3 TVL adapter (#21519) --- projects/derive-v3/index.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 projects/derive-v3/index.js diff --git a/projects/derive-v3/index.js b/projects/derive-v3/index.js new file mode 100644 index 00000000000..3e892a70281 --- /dev/null +++ b/projects/derive-v3/index.js @@ -0,0 +1,36 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getConfig } = require('../helper/cache') + +// Derive v3: zk exchange settled on Ethereum L1. All user collateral is custodied in SPOT_VAULT. +// https://docs.derive.xyz/getting-started/contracts +const SPOT_VAULT = '0x2e7dF4fAf35a1599979C7E764444e112d936ec42' +const DRV = '0xB1D1eae60EEA9525032a6DCb4c1CE336a1dE71BE' + +// Bridged (LayerZero OFT) / custody-wrapped tokens on L1 with no price feed -> canonical asset +// https://docs.derive.xyz/getting-started/custom-bridges +const TOKEN_MAP = { + '0x0762365e088fb8d285b295d782bb7b23690713e2': 'hyperliquid:' + ADDRESSES.hyperliquid.WHYPE, // HYPE OFT + '0xb5ead284cd00fd0eb37e84327a4ee781172a07d6': 'solana:So11111111111111111111111111111111111111112', // SOL OFT + '0xc2908db337aa16fb22b01bd4e8ff91460b23ff4b': 'solana:J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn', // jitoSOL OFT + '0x2e3023ca882ee359ebfa69b740be318df1b5cd7c': 'ethereum:' + ADDRESSES.ethereum.cbBTC, // cbBTC OFT from Base + '0x13fd17b60735be034b874e31ef4aed2cd613c9f9': 'flare:0xAd552A648C74D49E10027AB8a618A3ad4901c5bE', // FXRP OFT + '0x1ebb06ae854f186030a80bb7b3e73d5f22240fd6': 'ethereum:' + ADDRESSES.ethereum.USDC, // Strands.DACAP.BitGo.USDC + '0xee70394909906e9b5fe6d19d16b8c07058b06d74': 'ethereum:' + ADDRESSES.ethereum.USDT, // Strands.DACAP.BitGo.USDT +} + +async function tvl(api) { + const universes = await getConfig('derive-v3/collaterals', 'https://api.derive.xyz/v3/public/get_risk_universes') + const tokens = new Set() + for (const u of universes.result) for (const m of u.managers) for (const c of m.collaterals) + if (c.erc20?.underlying_erc20) tokens.add(c.erc20.underlying_erc20.toLowerCase()) + tokens.delete(DRV.toLowerCase()) + const list = [...tokens] + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: list.map(t => ({ target: t, params: SPOT_VAULT })) }) + list.forEach((t, i) => api.add(TOKEN_MAP[t] ?? t, bals[i], { skipChain: !!TOKEN_MAP[t] })) +} + +module.exports = { + methodology: 'Sum of all supported collateral tokens held in the Derive v3 SPOT_VAULT contract on Ethereum. DRV (own token) is excluded.', + hallmarks: [['2026-10-08', 'V3 launch: migration from Derive Chain to Ethereum L1']], + ethereum: { tvl }, +} From 66cbf2966d1177da7bc105dbf53acaeafded8f61 Mon Sep 17 00:00:00 2001 From: tree Date: Fri, 9 Oct 2026 13:05:44 +0530 Subject: [PATCH 158/988] Add Papertrade TVL adapter (#21520) --- projects/papertrade/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/papertrade/index.js diff --git a/projects/papertrade/index.js b/projects/papertrade/index.js new file mode 100644 index 00000000000..8c35fef4a58 --- /dev/null +++ b/projects/papertrade/index.js @@ -0,0 +1,13 @@ +const { addHypercoreSpotBalances } = require('../helper/chain/hyperliquid') + +// Papertrade: synthetic BTC/ETH perps on HyperEVM against a protocol-owned LP. Trader deposits and the LP sit as USDC +// in the Exchange contract's HyperCore spot account, not on the EVM (its EVM token balances are zero). +const EXCHANGE = '0x6cd5661646289fb6e65ea5c032310fded797d0a2' + +module.exports = { + timetravel: false, + methodology: 'USDC held in the Papertrade Exchange contract\'s HyperCore spot account: trader trading balances plus the protocol-owned LP that takes the other side of every position.', + hyperliquid: { + tvl: (api) => addHypercoreSpotBalances({ api, owners: [EXCHANGE] }), + }, +} From 951979899a1dafdaecaa4aad4dacd9f63c0c21a8 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Fri, 9 Oct 2026 09:42:12 +0200 Subject: [PATCH 159/988] Fail fast on remaining dead upstreams with 30s request timeouts (#21501) --- projects/afx-lp/index.js | 1 + projects/moon-swap/index.js | 2 +- projects/orbit-finance/index.js | 2 +- projects/parraton/index.js | 2 +- projects/quicksilver/index.js | 4 ++-- projects/radlock/index.js | 2 +- projects/venomstake/index.js | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/projects/afx-lp/index.js b/projects/afx-lp/index.js index 2194701ec1e..15709709c28 100644 --- a/projects/afx-lp/index.js +++ b/projects/afx-lp/index.js @@ -5,6 +5,7 @@ const API_URL = "https://api.afx.xyz/info/integrations/defillama/lp/summary"; async function tvl(api) { const response = await get(API_URL, { + timeout: 30000, headers: { Accept: "application/json", "User-Agent": "defillama-tvl-adapters/1.0", diff --git a/projects/moon-swap/index.js b/projects/moon-swap/index.js index 51dad224e5f..250c1ed4014 100644 --- a/projects/moon-swap/index.js +++ b/projects/moon-swap/index.js @@ -4,7 +4,7 @@ const { toUSDTBalances } = require('../helper/balances'); const baseUrl = "https://moonswap.fi/api/route/opt/swap/dashboard/global-data"; async function tvl() { - const response = (await get(baseUrl)).data; + const response = (await get(baseUrl, { timeout: 30000 })).data; return toUSDTBalances(response.uniswapFactories[0].totalLiquidityUSD) } diff --git a/projects/orbit-finance/index.js b/projects/orbit-finance/index.js index 7a672dfe4d3..c68cc0e5da6 100644 --- a/projects/orbit-finance/index.js +++ b/projects/orbit-finance/index.js @@ -22,7 +22,7 @@ async function tvl(api) { * read the aggregate total from the adapter's Streamflow indexer. */ async function staking() { - const data = await get(`${ADAPTER_BASE}/api/v1/streamflow/vaults`); + const data = await get(`${ADAPTER_BASE}/api/v1/streamflow/vaults`, { timeout: 30000 }); const cipherVault = (data.vaults ?? []).find((v) => v.tokenMint === CIPHER_MINT); if (!cipherVault?.total_staked_raw) return {}; return { ["solana:" + CIPHER_MINT]: cipherVault.total_staked_raw }; diff --git a/projects/parraton/index.js b/projects/parraton/index.js index a54602ba68b..d8940ddfc52 100644 --- a/projects/parraton/index.js +++ b/projects/parraton/index.js @@ -1,7 +1,7 @@ const { get } = require('../helper/http') async function tvl(api) { - const vaults = await get('https://api.parraton.com/v1/vaults') + const vaults = await get('https://api.parraton.com/v1/vaults', { timeout: 30000 }) const tvl =vaults.reduce((acc, vault) => { if (vault.tvlUsd > 1e6) return acc // skip vaults with TVL > $1M as they are likely outliers or errors acc += Number(vault.tvlUsd) diff --git a/projects/quicksilver/index.js b/projects/quicksilver/index.js index 1f27cbc573f..f866bfb97b2 100644 --- a/projects/quicksilver/index.js +++ b/projects/quicksilver/index.js @@ -22,8 +22,8 @@ const coinGeckoIds = { async function tvl() { const balances = {}; - const { zones } = await get(endPoints.quicksilver + "/quicksilver/interchainstaking/v1/zones"); - const { supply } = await get(endPoints.quicksilver + "/cosmos/bank/v1beta1/supply"); + const { zones } = await get(endPoints.quicksilver + "/quicksilver/interchainstaking/v1/zones", { timeout: 30000 }); + const { supply } = await get(endPoints.quicksilver + "/cosmos/bank/v1beta1/supply", { timeout: 30000 }); zones.forEach((zone) => { const balance = supply.find((coin) => coin.denom === zone.local_denom); diff --git a/projects/radlock/index.js b/projects/radlock/index.js index 582eddf4ba3..8e4bcf9fc10 100644 --- a/projects/radlock/index.js +++ b/projects/radlock/index.js @@ -1,7 +1,7 @@ const { get } = require('../helper/http') async function tvl(api) { - const tokensLockedInXrdList = await get('https://api.radlock.io/token/locked?format=list&lpOnly=true') + const tokensLockedInXrdList = await get('https://api.radlock.io/token/locked?format=list&lpOnly=true', { timeout: 30000 }) return { 'radix': tokensLockedInXrdList.reduce((acc, token) => acc + +token.xrd, 0) } diff --git a/projects/venomstake/index.js b/projects/venomstake/index.js index 138e22c36a1..f5fc5d64c8c 100644 --- a/projects/venomstake/index.js +++ b/projects/venomstake/index.js @@ -2,7 +2,7 @@ const { post, get } = require('../helper/http') const BigNumber = require('bignumber.js') async function fetchTvl() { - const { data: { tvl } } = await get('https://api.venomstake.com/v1/strategies/main'); + const { data: { tvl } } = await get('https://api.venomstake.com/v1/strategies/main', { timeout: 30000 }); return { venom: BigNumber(tvl).div(1e9) }; } From 5d614343732c53928a63b97aa1a458c3a7e0462e Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Fri, 9 Oct 2026 04:43:17 -0300 Subject: [PATCH 160/988] fix: read Chain Fusion ckBTC supply from the ledger (#21505) Co-authored-by: ccipherx --- projects/chain-fusion/index.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/projects/chain-fusion/index.js b/projects/chain-fusion/index.js index 80c79de0d0b..9b2534a7ff0 100644 --- a/projects/chain-fusion/index.js +++ b/projects/chain-fusion/index.js @@ -1,5 +1,8 @@ const { sumTokens2, } = require("../helper/unwrapLPs"); -const { get } = require('../helper/http') +const { chains: { icp } } = require('@defillama/sdk') + +// https://docs.internetcomputer.org/references/chain-key-canister-ids/#ckbtc +const CKBTC_LEDGER = 'mxzaz-hqaaa-aaaar-qaada-cai'; // This address holds all the locked ETH as well as locked ERC20 tokens const ethereum_contract = "0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80"; @@ -8,18 +11,18 @@ async function ethereum_tvl(api) { return sumTokens2({ owner: ethereum_contract, api, fetchCoValentTokens: true }); } -async function bitcoin_tvl(ts) { - var end = ts.timestamp - let start = end - 24 * 60 * 60; - const { data } = await get(`https://icrc-api.internetcomputer.org/api/v1/ledgers/mxzaz-hqaaa-aaaar-qaada-cai/total-supply?start=${start}&end=${end}&step=1`); - let [_, bal] = data.pop() - return { - 'coingecko:bitcoin': bal / 1e8 - }; +async function bitcoin_tvl(api) { + const [supply, decimals] = await Promise.all([ + icp.getIcrcTotalSupply({ ledger: CKBTC_LEDGER }), + icp.getIcrcDecimals({ ledger: CKBTC_LEDGER }), + ]); + // Coingecko balances use whole-coin numbers; decimal strings are truncated by the SDK. + api.addCGToken('bitcoin', Number(supply) / 10 ** decimals); } module.exports = { - methodology: `We count the ETH and ERC20-Tokens on ${ethereum_contract} as the collateral for ckETH and ck-ERC20 tokens and we count BTC as the collateral for ckBTC`, + timetravel: false, + methodology: `Counts ETH and ERC20 tokens held at ${ethereum_contract} on Ethereum. The Bitcoin bucket uses the current ckBTC ledger supply as a proxy for BTC backing, excluding burned ckBTC and deposits not yet minted; it does not independently sum Bitcoin UTXOs.`, ethereum: { tvl: ethereum_tvl, }, From b89c787143c643c7618bf2eafd8d949d7439e82d Mon Sep 17 00:00:00 2001 From: avral Date: Fri, 9 Oct 2026 14:43:48 +0700 Subject: [PATCH 161/988] Add Alcor Bridge (child of Alcor) (#21511) Co-authored-by: Avral Co-authored-by: ccipherx --- registries/sumTokens.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 2a209369db5..aa8867f1804 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -992,6 +992,32 @@ const configs = { ] }, }, + "alcor-bridge": { + "methodology": "Assets locked in the AlcorVault contract on each EVM chain (Ethereum, BNB Chain, Polygon): native ETH/BNB/POL, USDC and USDT backing the tokens minted on Telos and WAX.", + "ethereum": { + "owner": "0x3e447d533321ad6a8412f97034ac295a9ff8d858", + "tokens": [ + ADDRESSES.null, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT + ] + }, + "bsc": { + "owner": "0x53F18eaa8Bf8099b5bA21Bb7E11ed311b677690e", + "tokens": [ + ADDRESSES.null, + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.USDC + ] + }, + "polygon": { + "owner": "0x15bbd21148f98c4daeb30450eb05666f7859993d", + "tokens": [ + ADDRESSES.null, + ADDRESSES.polygon.USDC_CIRCLE + ] + }, + }, "alkemi": { "methodology": "TVL consists of Assets (ETH, WBTC, Stablecoins) deposited in Alkemi Earn, Assets (ETH, WBTC, Stablecoins) deposited in Alkemi Earn Open, and does NOT currently consider assets borrowed", "start": "2020-12-31", From 2ccbb4e894d34bb46879025b271755901af3a8dc Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 9 Oct 2026 09:44:46 +0200 Subject: [PATCH 162/988] Add BTR TVL adapter (#21513) Co-authored-by: ccipherx --- projects/btr/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/btr/index.js diff --git a/projects/btr/index.js b/projects/btr/index.js new file mode 100644 index 00000000000..67c700e468a --- /dev/null +++ b/projects/btr/index.js @@ -0,0 +1,13 @@ +const FACTORY = '0xbbbbbbbbbd5e955E20F323cA1F95f8191fD0E0BF' + +async function tvl(api) { + const pools = await api.fetchList({ lengthAbi: 'getOfficialPoolsCount', itemAbi: 'officialPools', target: FACTORY }) + const tokens = await api.multiCall({ target: FACTORY, abi: 'function getPoolTokens(address pool) view returns (address[])', calls: pools }) + return api.sumTokens({ ownerTokens: pools.map((pool, i) => [tokens[i], pool]) }) +} + +module.exports = { + methodology: "Sums the token balances held by every official BTR pool listed by the PoolFactory. Tranches a pool has pushed to external venues (Euler/Aave) leave the pool and are not counted, since those venues are listed separately.", + start: '2026-10-01', + monad: { tvl }, +} From 37a794a5c6e72d1aee7aff57a9429b580b3d7d84 Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Fri, 9 Oct 2026 05:07:05 -0300 Subject: [PATCH 163/988] fix: discover FNDZ vaults on-chain instead of using a frozen API cache (#21506) Co-authored-by: ccipherx --- projects/fndzdao/index.js | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/projects/fndzdao/index.js b/projects/fndzdao/index.js index e0e637500f6..e7e4a018e45 100644 --- a/projects/fndzdao/index.js +++ b/projects/fndzdao/index.js @@ -1,18 +1,42 @@ const { staking } = require('../helper/staking') -const { getConfig } = require('../helper/cache') +const { getCreateAddress } = require('ethers') const getTrackedAssetsAbi = "address[]:getTrackedAssets" +const dispatcher = '0x07036f5385AE6F4049f7788bD960f9Dd7fecC241' +const deploymentBlock = 18879113 +const zero = '0x0000000000000000000000000000000000000000' + +async function getVaults(api) { + const block = await api.getBlock() + if (block < deploymentBlock) return [] + + // the Dispatcher registers every VaultProxy it CREATEs (nonce 1 onward) and never clears it, so registered addresses form a prefix + const vaults = [] + for (let nonce = 1; ; nonce += 100) { + const batch = Array.from({ length: 100 }, (_, i) => getCreateAddress({ from: dispatcher, nonce: nonce + i })) + const deployers = await api.multiCall({ + target: dispatcher, + abi: 'function getFundDeployerForVaultProxy(address) view returns (address)', + calls: batch, + }) + const count = deployers.findIndex(address => address === zero) + if (count === -1) { vaults.push(...batch); continue } + if (deployers.slice(count).some(address => address !== zero)) throw new Error('Incomplete FNDZ vault discovery') + return vaults.concat(batch.slice(0, count)) + } +} async function tvl(api) { - const res = await getConfig('fndzdao', 'https://api.fndz.io/tvl') - const vaults = res.result.chains[0].vault_addresses; + const vaults = await getVaults(api) + if (!vaults.length) return api.getBalances() const tokens = await api.multiCall({ abi: getTrackedAssetsAbi, calls: vaults }) const ownerTokens = vaults.map((v, i) => [tokens[i], v]) return api.sumTokens({ ownerTokens, }) } module.exports = { + methodology: 'TVL is the ERC-20 custody of tracked assets in all vaults created by the FNDZ Dispatcher on BSC. Vault discovery, tracked assets and balances use the same block. FNDZ held by the staking contract is reported separately as staking.', bsc: { tvl, staking: staking('0x4910638b88c40Ee382CEd72A4056E2f859Bd4658', '0x7754c0584372d29510c019136220f91e25a8f706') }, -}; \ No newline at end of file +}; From 6f994c48a049cd3f569ac6ba028ae2057a50923b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 9 Oct 2026 10:17:03 +0200 Subject: [PATCH 164/988] fix morpho --- projects/morpho-blue/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/morpho-blue/index.js b/projects/morpho-blue/index.js index 552b1d84fb2..4d3765ce1b6 100644 --- a/projects/morpho-blue/index.js +++ b/projects/morpho-blue/index.js @@ -18,7 +18,8 @@ const getMarket = async (api) => { const extraKey = 'reset-v2' let logs = []; - if (api.chain === 'tac') { + const chainsWithTroublePullingLogs = new Set(['tac', 'sei']) + if (chainsWithTroublePullingLogs.has(api.chain)) { try { logs = await getLogs({ api, target: morphoBlue, eventAbi: eventAbis.createMarket, fromBlock, onlyArgs: true, extraKey, onlyUseExistingCache, useIndexer }) } catch (e) { From 95047fb59454ca06fdc401ac86f24619b2f3468e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 9 Oct 2026 11:05:01 +0200 Subject: [PATCH 165/988] fix broken --- projects/flamingo-lend/index.js | 44 ++++++++---------- projects/flamingo.js | 78 ++++++++++++++++--------------- projects/hybra-v4/index.js | 2 +- projects/sora.js | 45 +++++++++++------- registries/deadAdapters.json | 81 ++++++++++++++++++++++----------- 5 files changed, 141 insertions(+), 109 deletions(-) diff --git a/projects/flamingo-lend/index.js b/projects/flamingo-lend/index.js index 03517df36a8..bfae2e8aa81 100644 --- a/projects/flamingo-lend/index.js +++ b/projects/flamingo-lend/index.js @@ -1,38 +1,32 @@ const { post } = require('../helper/http') -const { sumTokens2 } = require('../helper/unwrapLPs') -const endpoint = 'https://explorer.onegate.space/api' +const RPC = 'https://n3seed1.ngd.network:10332' -const whitelistedTokens = new Set([ +// lending contracts, e.g. https://explorer.onegate.space/accountprofile/0x799bbfcbc97b5a425e14089aeb06753cb3190560 +const accounts = ['0x03217e03834e48ac6b7b0053af23d3663090875a', '0x799bbfcbc97b5a425e14089aeb06753cb3190560'] + +const tokens = [ '0x68b938cc42b6a2d54fb9040f5facf4290ebb8c5f', '0xd3a41b53888a733b549f5d4146e7a98d3285fa21', '0xd2a4cff31913016155e38e474a2c06d08be276cf', '0x4548a3bcb3c2b5ce42bf0559b1cf2f1ec97a51d0', -]) - +] -async function getBalances(address) { - const data = await post(endpoint, { - "jsonrpc": "2.0", "id": 1, "params": - { - "Address": address, "Limit": 10, "Skip": 0 - - }, "method": "GetAssetsHeldByAddress" +async function balanceOf(token, account) { + const { result } = await post(RPC, { + jsonrpc: '2.0', id: 1, method: 'invokefunction', + params: [token, 'balanceOf', [{ type: 'Hash160', value: account }]], }) - return data.result.result + if (result.state !== 'HALT') throw new Error(`${token}.balanceOf(${account}) failed: ${result.exception}`) + return result.stack[0].value } async function tvl(api) { - // https://explorer.onegate.space/accountprofile/0x799bbfcbc97b5a425e14089aeb06753cb3190560 - const accounts = ['0x03217e03834e48ac6b7b0053af23d3663090875a', '0x799bbfcbc97b5a425e14089aeb06753cb3190560'] - for (const account of accounts) { - const data = await getBalances(account) - data.forEach(i => { - if (!whitelistedTokens.has(i.asset.toLowerCase())) return; - api.add(i.asset, i.balance) - }) - } - return sumTokens2({ api }) + for (const account of accounts) + for (const token of tokens) + api.add(token, await balanceOf(token, account)) } module.exports = { - neo: { tvl } -} \ No newline at end of file + timetravel: false, + methodology: 'Balances of the supported collateral and lending tokens held by the Flamingo Lend contracts, read on-chain from a Neo N3 node.', + neo: { tvl }, +} diff --git a/projects/flamingo.js b/projects/flamingo.js index fdf3fadeaa0..1015ffed112 100644 --- a/projects/flamingo.js +++ b/projects/flamingo.js @@ -1,21 +1,41 @@ -// adapter.js -const { get } = require('./helper/http'); +const { post } = require('./helper/http') -async function tvl() { - throw new Error("temporary break to verify 14m spike") +const RPC = 'https://n3seed1.ngd.network:10332' +const FACTORY = '0xca2d20610d7982ebe0bed124ee7e9b2d580a6efc' // FlamingoSwapFactory (N3) - const data = await get( - 'https://flamingo-us-1.b-cdn.net/flamingo/analytics/daily-latest/tvl_data' - ); - const { pool_usd, flund_usd, lend_usd } = data.tvl_data; +// pool tokens the coins api can price; bNEO is NeoBurger's 1:1 wrapped NEO +const PRICED = { + '0xd2a4cff31913016155e38e474a2c06d08be276cf': null, // GAS + '0x68b938cc42b6a2d54fb9040f5facf4290ebb8c5f': null, + '0xd3a41b53888a733b549f5d4146e7a98d3285fa21': null, + '0x4548a3bcb3c2b5ce42bf0559b1cf2f1ec97a51d0': null, + '0x48c40d4666f93408be1bef038b6722404d9a4c2a': { cg: 'neo', decimals: 8 }, // bNEO +} + +// script hashes come back base64 encoded, little endian +const toHash = b64 => '0x' + Buffer.from(b64, 'base64').reverse().toString('hex') + +async function invoke(contract, method) { + const { result } = await post(RPC, { jsonrpc: '2.0', id: 1, method: 'invokefunction', params: [contract, method, []] }) + if (result.state !== 'HALT') throw new Error(`${contract}.${method} failed: ${result.exception}`) + return result.stack[0] +} - // Parse strings to floats and sum them - // const totalUsd = - // parseFloat(pool_usd) - // parseFloat(flund_usd) + // FLUND is backed by platforms own token: https://medium.com/flamingo-finance/flamingo-finance-announces-flamingo-flund-single-stake-9be434d0999d - // parseFloat(lend_usd); // will be tracked under a new listing +function add(api, token, amount) { + const mapped = PRICED[token] + if (mapped) api.addCGToken(mapped.cg, Number(amount) / 10 ** mapped.decimals) + else api.add(token, amount) +} - return { tether: +pool_usd }; +async function tvl(api) { + const pairs = (await invoke(FACTORY, 'getAllExchangePair')).value.map(s => s.value.map(v => toHash(v.value))) + for (const [token0, token1, pair] of pairs) { + const [r0, r1] = (await invoke(pair, 'getReserves')).value.map(v => BigInt(v.value)) + const p0 = token0 in PRICED, p1 = token1 in PRICED + // a side without a price is valued as equal to the priced side + if (p0) add(api, token0, p1 ? r0 : r0 * 2n) + if (p1) add(api, token1, p0 ? r1 : r1 * 2n) + } } module.exports = { @@ -23,32 +43,10 @@ module.exports = { ['2021-12-03', "N3 migration start"], ['2022-01-02', "100% minting on N3"], ['2022-01-10', "First IDO"], - //['2022-03-24', "First reverse pool"], - // ['2022-04-18', "Binance N3 support"], - // ['2022-04-28', "FLUND single stake"], - ['2022-06-01', "Advanced Trade launched"], - ['2022-06-28', "Mobile App"], - ['2022-07-01', "Fiat Onramper launched"], - //['2022-08-09', "First limit order trades on OrderBook+"], - // ['2022-11-14', "Wave 1 of new liquidity pools"], - // ['2022-12-16', "Wave 2 of new liquidity pools"], - // ['2023-01-10', "USD Stablecoin FUSD & Flamingo Lend"], - // ['2023-02-15', "FUSD Pool Bonus released"], - // ['2023-04-25', "New landing and Get Started pages"], - // ['2023-06-01', "Flamingo Ambassador Program launched"], - // ['2023-06-20', "Expands to 14 EVM chains"], - //['2023-09-25', "Flamingo Finance 3.0"], - // ['2024-01-18', "New roadmap announced"], - // ['2024-04-04', "Dashboard-athon"], - ['2024-09-23', "Wave 3 of new liquidity pools"], - // ['2024-12-18', "OrderBook+ 2.0 live on Testnet"], - // ['2025-03-06', "OrderBook+ 2.0 live on Mainnet"], - // ['2025-03-25', "FLOCKS released"] + ['2024-09-23', "Wave 3 of new liquidity pools"], ], - methodology: `TVL is obtained by making calls to the Flamingo Finance API "https://flamingo-us-1.b-cdn.net/flamingo/analytics/daily-latest/tvl_data".`, + methodology: 'Reserves of every Flamingo swap pair, read on-chain from the FlamingoSwapFactory on Neo N3. Pairs with one unpriced token are valued at twice the priced side; pairs with no priced token are excluded.', misrepresentedTokens: true, timetravel: false, - neo: { - tvl - } -}; + neo: { tvl }, +} diff --git a/projects/hybra-v4/index.js b/projects/hybra-v4/index.js index 26a2a100f23..53c03e94b07 100644 --- a/projects/hybra-v4/index.js +++ b/projects/hybra-v4/index.js @@ -7,7 +7,7 @@ Object.keys(config).forEach(chain => { const { factory, blacklistedTokens, } = config[chain] module.exports[chain] = { tvl: getUniTVL({ - factory, blacklistedTokens, fetchBalances: true, abis: { + factory, blacklistedTokens, fetchBalances: true, permitFailure: true, abis: { allPairsLength: 'uint256:allPoolsLength', allPairs: "function allPools(uint) view returns (address)", } diff --git a/projects/sora.js b/projects/sora.js index bb82e4982ae..2226ed90758 100644 --- a/projects/sora.js +++ b/projects/sora.js @@ -1,25 +1,38 @@ -const { post } = require('./helper/http') +const { getStorageEntries, ScaleReader } = require('./helper/chain/substrate') +const XOR = '0x0200000000000000000000000000000000000000000000000000000000000000' + +// PoolXYK.Reserves: double map (Blake2_128Concat base, Blake2_128Concat target) -> (baseReserve: u128, targetReserve: u128) +// every SORA asset uses 18 decimals async function tvl(api) { - const { data: { data: { edges } } } = await post('https://api.subquery.network/sq/sora-xor/sora-prod', { "operationName": "SubqueryPoolsQuery", "query": "query SubqueryPoolsQuery($after: Cursor, $filter: PoolXYKFilter) {\n data: poolXYKs(after: $after, filter: $filter) {\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n node {\n baseAssetId\n targetAssetId\n baseAssetReserves\n targetAssetReserves\n priceUSD\n liquidityUSD\n strategicBonusApy\n }\n }\n }\n}", "variables": { "after": "", "filter": { "baseAssetReserves": { "greaterThan": "0" }, "targetAssetId": { "in": ["0x0200000000000000000000000000000000000000000000000000000000000000", "0x0200040000000000000000000000000000000000000000000000000000000000", "0x0200050000000000000000000000000000000000000000000000000000000000", "0x02000c0000000000000000000000000000000000000000000000000000000000", "0x02000a0000000000000000000000000000000000000000000000000000000000", "0x0200080000000000000000000000000000000000000000000000000000000000", "0x0200090000000000000000000000000000000000000000000000000000000000", "0x0200060000000000000000000000000000000000000000000000000000000000", "0x0200070000000000000000000000000000000000000000000000000000000000", "0x02000b0000000000000000000000000000000000000000000000000000000000", "0x02000d0000000000000000000000000000000000000000000000000000000000", "0x02000e0000000000000000000000000000000000000000000000000000000000", "0x02000f0000000000000000000000000000000000000000000000000000000000", "0x006a271832f44c93bd8692584d85415f0f3dccef9748fecd129442c8edcb4361"] }, "targetAssetReserves": { "greaterThan": "0" } } } }) - edges.forEach(i => api.addUSDValue(+i.node.liquidityUSD > 0 ? +i.node.liquidityUSD : 0)) + const entries = await getStorageEntries('sora', { pallet: 'PoolXYK', item: 'Reserves' }) + const pools = entries.map(({ rest, value }) => { + const key = Buffer.from(rest) + const reader = new ScaleReader(value) + return { + base: '0x' + key.subarray(16, 48).toString('hex'), + target: '0x' + key.subarray(64, 96).toString('hex'), + baseReserve: Number(BigInt(reader.u128())) / 1e18, + targetReserve: Number(BigInt(reader.u128())) / 1e18, + } + }) + + // non-XOR base assets (XSTUSD, KUSD, TBCD) have no price feed and are depegged, so price them in XOR via their XOR pool + const xorPrice = { [XOR]: 1 } + for (const { base, target, baseReserve, targetReserve } of pools) + if (base === XOR && targetReserve > 0) xorPrice[target] = baseReserve / targetReserve + + let xorTotal = 0 + for (const { base, baseReserve } of pools) { + if (!xorPrice[base]) continue + xorTotal += 2 * baseReserve * xorPrice[base] + } + api.addCGToken('sora-2', xorTotal) } module.exports = { misrepresentedTokens: true, timetravel: false, - methodology: "All pools from https://polkaswap.io launched on SORA network are included in TVL. Data comes from https://polkaview.io", + methodology: "All XYK pools from https://polkaswap.io on SORA, read on-chain. Each pool is valued at twice its base-asset reserve; non-XOR base assets are priced in XOR through their XOR pool.", sora: { tvl }, }; - - -// on-chain -/* -const { getExports } = require('./helper/heroku-api') - -module.exports = { - timetravel: false, - misrepresentedTokens: true, - ...getExports("stackswap", ['stacks']), -} - */ \ No newline at end of file diff --git a/registries/deadAdapters.json b/registries/deadAdapters.json index dd0000831c9..42c3155cae2 100644 --- a/registries/deadAdapters.json +++ b/registries/deadAdapters.json @@ -116,7 +116,8 @@ "methodology": "CDP collateral value + treasury mv", "cronos": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "Caketomb": { "deadFrom": "2022-03-31", @@ -268,7 +269,8 @@ "2026-04-01", "Drift hack" ] - ] + ], + "deadFrom": "2026-05-03" }, "Magnate": { "base": { @@ -301,7 +303,8 @@ "Revoluzion": { "bsc": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "Solily": { "hallmarks": [ @@ -902,7 +905,8 @@ "2025-01-26", "Rug Pull!" ] - ] + ], + "deadFrom": "2026-05-03" }, "barnswap": { "deadFrom": "2023-09-30", @@ -1433,7 +1437,8 @@ "cheesedao": { "harmony": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "chiknfarm": { "deadFrom": "2025-09-19", @@ -1684,7 +1689,8 @@ "cryptomate": { "stacks": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "cswap": { "deadFrom": "2024-09-17", @@ -2203,7 +2209,8 @@ "misrepresentedTokens": true, "eos": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "eight": { "deadFrom": "2022-11-10", @@ -2399,7 +2406,8 @@ "misrepresentedTokens": true, "fantom": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "farmersonly": { "harmony": { @@ -2867,7 +2875,8 @@ "ethereum": { "staking": "_f", "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "hfione": { "heco": { @@ -3144,7 +3153,8 @@ "jade-protocol": { "ethereum": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "jademoney": { "methodology": "Queries the Jade.Money contract for the total value of USDC deposits.", @@ -3326,7 +3336,8 @@ "ethereum": { "tvl": "_f", "staking": "_f" - } + }, + "deadFrom": "2026-05-03" }, "kekswap": { "kekchain": { @@ -3673,7 +3684,8 @@ "methodology": "We are counting all the liquidity on their DEX as TVL, data is sourced from the subgraph at 'https://subgraph.liquidchain.net/subgraphs/name/liquid/exchange'", "liquidchain": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "lndfi": { "methodology": "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.", @@ -3842,7 +3854,8 @@ }, "ethereum": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "marginswap": { "ethereum": { @@ -3921,7 +3934,8 @@ "timetravel": false, "cardano": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "merchant": { "hallmarks": [ @@ -4122,7 +4136,8 @@ "monarchpay": { "kava": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "moondao": { "moonriver": { @@ -4160,7 +4175,8 @@ "doublecounted": true, "base": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "mstable-yield": { "deadFrom": "2023-04-07", @@ -4311,7 +4327,8 @@ "timetravel": false, "moonriver": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "nirvana": { "timetravel": false, @@ -4333,7 +4350,8 @@ "timetravel": false, "algorand": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "notional": { "deadFrom": "2024-08-22", @@ -5442,7 +5460,8 @@ "harmony": { "tvl": "_f", "staking": "_f" - } + }, + "deadFrom": "2026-05-03" }, "rikkei-finance": { "bsc": { @@ -5556,7 +5575,8 @@ "timetravel": false, "kava": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "sashimidao": { "hallmarks": [ @@ -5652,7 +5672,8 @@ "shiden-dapps-staking": { "shiden": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "shipyard-finance": { "doublecounted": true, @@ -5986,7 +6007,8 @@ "stakehound": { "ethereum": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "stakerz-io": { "misrepresentedTokens": true, @@ -6231,7 +6253,8 @@ "arbitrum": { "tvl": "_f", "borrowed": "_f" - } + }, + "deadFrom": "2026-05-03" }, "sushiswap-trident": { "polygon": { @@ -6317,7 +6340,8 @@ ] ], "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "syncus": { "ethereum": { @@ -6346,7 +6370,8 @@ "2026-01-15", "The Synnax.fi application was closed" ] - ] + ], + "deadFrom": "2026-05-03" }, "synthetify": { "deadFrom": "2025-11-01", @@ -6462,7 +6487,8 @@ "2025-02-03", "Thorfi unwinds" ] - ] + ], + "deadFrom": "2026-05-03" }, "tlchain-decryption": { "tlchain": { @@ -7004,7 +7030,8 @@ "x7": { "ethereum": { "tvl": "_f" - } + }, + "deadFrom": "2026-05-03" }, "xWeowns": { "lachain": { From 490828886374e172938913c57e22e11ec3822ea0 Mon Sep 17 00:00:00 2001 From: eden Date: Fri, 9 Oct 2026 16:37:54 +0700 Subject: [PATCH 166/988] update hemi, merlin seals BTC wallets (#21523) --- projects/helper/bitcoin-book/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index e2fd20d267e..b28d8b3140f 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -45,6 +45,8 @@ module.exports = { getBTCExport, hemiBTC: [ + // Custody address from Hemi vault 0x58f7b8d7a7291AAEcE0febb39aa4e877387e61E4. + "1QDhzsteETKuw1M5kWHEjzaAmHSGhpH8zr", "16NuSCxDVCAXbKs9GRbjbHXbwGXu3tnPSo", "1GawhMSUVu3bgRiNmejbVTBjpwBygGWSqf", "bc1q4lpa9d5zxehge7vx86784gcxy23hc3xwp3gl422venswe6pvhh5qpn9xfj", @@ -305,6 +307,11 @@ module.exports = { 'bc1pyz7l3u2wdhvdwgej0n6myhp6wzrr0qa3982l7zq5v3k5f6fxgmyqg5vkxu' ], merlin: [ + // Current reserve wallets and predecessor balances: https://merlinbitcoin.org/ + "3EtJpUAgSgHgUYkTSG12tocDgYbc2TBHQ3", // Rotated from 3FYAoJau on 2026-09-16. + "1M1T6sUtZP4UdsnvMJvQA7BbTrV1Y5c1QR", // Rotated from 1DthDPh7 on 2026-09-16. + "3FYAoJauXw17sBn5BwqbS4kkzRGeXmbN6r", + "1DthDPh76r4vGbnJqTSyYGmFPoiXUpityn", "bc1qtu66zfqxj6pam6e0zunwnggh87f5pjr7vdr5cd", "15zVuow5e9Zwj4nTrxSH3Rvupk32wiKEsr", "bc1q4gfsheqz7ll2wdgfwjh2l5hhr45ytc4ekgxaex", From d710c4c2258be5bfa6a1701fb68e1382543e526e Mon Sep 17 00:00:00 2001 From: "Souls.club" Date: Fri, 9 Oct 2026 15:38:40 +0300 Subject: [PATCH 167/988] heks: add V2.3 launchpad (#21483) --- projects/heks/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/projects/heks/index.js b/projects/heks/index.js index 0ca8e058ea9..0556458e136 100644 --- a/projects/heks/index.js +++ b/projects/heks/index.js @@ -16,9 +16,15 @@ const { addUniV3LikePosition } = require('../helper/unwrapLPs') // the owner is the PositionManager and the salt is the NFT id, which the launchpad publishes in // its LaunchTermsV22 event. The reserves are derived the same way. // -// https://robinhoodchain.blockscout.com/address/0x0f2005a033c6cA153a06cA80c670E856e494c45A +// From V2.3 anyone may also add liquidity to a pool once its opening windows are over. Those positions +// belong to whoever added them, so they are not counted: only the launch's own position is read, by its +// NFT id. +// +// https://robinhoodchain.blockscout.com/address/0x05281d26889a7225936D124F30CA5bDfF025339B const LAUNCHPADS = [ - // V2.2: new coins are created here since 2026-09-26; positions are LP NFTs locked at the dead address. + // V2.3: new coins are created here since 2026-10-07; same events and positions as V2.2. + { launchpad: '0x05281d26889a7225936D124F30CA5bDfF025339B', fromBlock: 82670394, lpNft: true }, + // V2.2: positions are LP NFTs locked at the dead address. { launchpad: '0x0f2005a033c6cA153a06cA80c670E856e494c45A', fromBlock: 73071918, lpNft: true }, // V2.1: vault-held positions. { launchpad: '0x3AAB7D1317565d768b92A07b4417B128F470Da68', vault: '0xb7Ab4c5e3d133cfbE4fCd627728849B8E6F0dbF0', fromBlock: 69908367 }, @@ -146,7 +152,7 @@ async function tvl(api) { module.exports = { methodology: - 'TVL is the liquidity heks locks in the Uniswap V4 PoolManager across every coin it has launched. Each launch seeds one one-sided position that can never be withdrawn — held by the launchpad vault in earlier deployments, and from V2.2 minted through the Uniswap V4 PositionManager with its NFT sent to the dead address — so the pair asset buyers pay in accumulates there and only fees can leave. Launches are read from the launchpads\' TokenCreated logs, which carry both currencies and the position\'s tick range (V2.2 launches also name their NFT in LaunchTermsV22); the position\'s liquidity is read from Uniswap V4 StateView, and the reserves are derived from that liquidity, the tick range and the pool\'s current price. Both sides of each position are counted, so a launched coin contributes only once it has a price of its own.', + 'TVL is the liquidity heks locks in the Uniswap V4 PoolManager across every coin it has launched. Each launch seeds one one-sided position that can never be withdrawn — held by the launchpad vault in earlier deployments, and from V2.2 minted through the Uniswap V4 PositionManager with its NFT sent to the dead address — so the pair asset buyers pay in accumulates there and only fees can leave. Launches are read from the launchpads\' TokenCreated logs, which carry both currencies and the position\'s tick range (V2.2 launches also name their NFT in LaunchTermsV22); the position\'s liquidity is read from Uniswap V4 StateView, and the reserves are derived from that liquidity, the tick range and the pool\'s current price. Both sides of each position are counted, so a launched coin contributes only once it has a price of its own. Liquidity that other users add to these pools (possible from V2.3 once a launch\'s opening windows are over) is theirs and is not counted.', start: '2026-09-10', // These are Uniswap V4 pools, and the same funds are already counted by the uniswap-v4 adapter, // which reads raw PoolManager balances on this chain. From bc0689850411d1346a76b7414adb7afd5fe54bbd Mon Sep 17 00:00:00 2001 From: jizhen181-dot Date: Fri, 9 Oct 2026 20:55:32 +0800 Subject: [PATCH 168/988] Add SunSwap V4 TVL (#21484) Co-authored-by: Claude Opus 5 (1M context) Co-authored-by: FelixBruguera --- projects/sunswap-v4/index.js | 66 ++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 projects/sunswap-v4/index.js diff --git a/projects/sunswap-v4/index.js b/projects/sunswap-v4/index.js new file mode 100644 index 00000000000..38a4bd709ea --- /dev/null +++ b/projects/sunswap-v4/index.js @@ -0,0 +1,66 @@ +const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') +const { nullAddress } = require('../helper/tokenMapping') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// SunSwap V4 uses a singleton PoolManager: all V4 liquidity is held by this one contract. +// TVL = token balances of the PoolManager. +// No SunSwap V4 hook custodies liquidity, so only the PoolManager is counted. +// PoolManager: https://tronscan.org/#/contract/TVjuTE3V5bMVdpfNhid8kD2v35T2k1u1Br +const POOL_MANAGER = 'TVjuTE3V5bMVdpfNhid8kD2v35T2k1u1Br' + +// The pool list (token pairs) comes from the SUN.io API because Initialize-event log scanning is not available on Tron. +// Note: the API's `pairAddress` field holds the V4 PoolId (bytes32), not a contract address. +const POOL_LIST_API = 'https://sbc.endjgfsv.link/scan/getPoolList?version=v4' +const PAGE_SIZE = 100 // the API returns at most 100 pools per page +const MAX_PAGES = 100 +// Skip dust pools: most are spam tokens (fake USDT etc.) and some of their balanceOf calls exceed the Tron node CPU limit, +// which fails the whole balance multicall. Pools below this size hold a negligible share of TVL. +const MIN_POOL_LIQUIDITY_USD = 1000 +const TRX_PLACEHOLDER = 'T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb' // native TRX in the SUN.io API (0x0 address) + +/** + * Collects the tokens of all SunSwap V4 pools with at least MIN_POOL_LIQUIDITY_USD of liquidity, + * paging through the SUN.io pool list API until an empty page (at most MAX_PAGES pages). + * Native TRX is returned as nullAddress so its balance is read as the native coin. + * @returns {Promise} unique token addresses + * @throws if the list has more than MAX_PAGES pages, a page only repeats earlier pools (the API ignored pageNo), or no pool is found + */ +async function getTokens() { + const tokens = new Set() + const seenPools = new Set() + // Fetch one page past MAX_PAGES: it must be empty, otherwise the list was cut off and TVL would be partial. + for (let pageNo = 1; pageNo <= MAX_PAGES + 1; pageNo++) { + const { data } = await get(`${POOL_LIST_API}&pageNo=${pageNo}&pageSize=${PAGE_SIZE}`) + if (!Array.isArray(data)) throw new Error(`sunswap-v4: unexpected pool list response for page ${pageNo}`) + if (!data.length) break // an empty page is the end of the list + if (pageNo > MAX_PAGES) throw new Error(`sunswap-v4: pool list has more than ${MAX_PAGES} pages`) + let newPools = 0 + for (const pool of data) { + if (seenPools.has(pool.pairAddress)) continue + seenPools.add(pool.pairAddress) + newPools++ + if (!(Number(pool.liquidity) >= MIN_POOL_LIQUIDITY_USD)) continue + tokens.add(pool.token0Address) + tokens.add(pool.token1Address) + } + if (!newPools) throw new Error(`sunswap-v4: pool list page ${pageNo} repeats earlier pools`) // the API ignored pageNo: fail instead of reporting a partial TVL + } + if (!tokens.size) throw new Error('sunswap-v4: pool list is empty') + return [...tokens].map(t => (t === TRX_PLACEHOLDER ? nullAddress : t)) +} + +async function tvl(api) { + const tokens = await getConfig('sunswap-v4', undefined, { fetcher: getTokens }) + // Query balances in small batches: a single multicall with all tokens can hit the Tron node's CPU time limit. + return sumTokens2({ api, owner: POOL_MANAGER, tokens, sumChunkSize: 20 }) +} + +module.exports = { + methodology: 'TVL is the balance of all tokens (including native TRX) held by the SunSwap V4 singleton PoolManager contract. Tokens are discovered from the SUN.io pool list API (pools with at least $1k liquidity; smaller pools are mostly spam tokens).', + start: '2026-03-01', + // The pool list API only reflects current pools and liquidity, so this adapter cannot compute historical TVL + // (same as other Tron adapters such as projects/justSwap). TVL is tracked from the listing date onwards. + timetravel: false, + tron: { tvl }, +} From 612f18ff5f30966f65e846a3ccd44a2247623c1e Mon Sep 17 00:00:00 2001 From: routebuilder Date: Fri, 9 Oct 2026 15:55:39 +0200 Subject: [PATCH 169/988] curators: throw on Euler factory length read failure instead of silently skipping (#21489) --- projects/helper/curators/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/helper/curators/index.js b/projects/helper/curators/index.js index d10db38d2b4..33cbe995725 100644 --- a/projects/helper/curators/index.js +++ b/projects/helper/curators/index.js @@ -134,7 +134,6 @@ async function getEulerVaults(api, owners) { const getProxyListLength = await api.call({ abi: ABI.euler.getProxyListLength, target: factory, - permitFailure: true, }); if (getProxyListLength) { const lists = [] From 96f78dea38e2ac2ce42dc6643fe674c87ebef370 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 9 Oct 2026 15:07:53 +0100 Subject: [PATCH 170/988] morpho exclusions (#21488) --- projects/morpho-blue/exclusions.js | 88 ++++++++++++++++++++++++++++++ projects/morpho-blue/index.js | 78 ++++++++++++++++++++++++-- 2 files changed, 160 insertions(+), 6 deletions(-) create mode 100644 projects/morpho-blue/exclusions.js diff --git a/projects/morpho-blue/exclusions.js b/projects/morpho-blue/exclusions.js new file mode 100644 index 00000000000..ca8ab361fbe --- /dev/null +++ b/projects/morpho-blue/exclusions.js @@ -0,0 +1,88 @@ +const sdk = require('@defillama/sdk') +const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') + +// Morpho's own exclusion feed. Additive: unioned with the hardcoded lists in config.js, never a +// replacement - the feed is currently a strict subset of what we exclude by hand. +const BASE_URL = 'https://api.morpho.org/reporting/v1/exclusions' +// required columns per file: a response that does not carry them is not a CSV we understand, +// which is how an html error page served as 200 is told apart from a genuine header-only file +const KINDS = { + markets: ['chain', 'market_id', 'effective_from', 'effective_to'], + assets: ['chain', 'asset_address', 'effective_from', 'effective_to'], + vaults: ['chain', 'vault_address', 'effective_from', 'effective_to'], +} + +const isDate = (v) => /^\d{4}-\d{2}-\d{2}$/.test(v) +const isId = (v) => /^0x[0-9a-fA-F]+$/.test(v) + +// the feed is plain comma-separated with no quoting; reason is last, so any extra commas fold into it. +// returns null when the header or any row is malformed, so the caller can keep the old cache: a +// truncated file would otherwise read as a short but valid list and silently drop live exclusions +function parseCsv(text, requiredColumns) { + const lines = String(text).trim().split('\n').filter(Boolean) + if (!lines.length) return null + const header = lines[0].split(',').map(h => h.trim()) + if (!requiredColumns.every(c => header.includes(c))) return null + + const rows = [] + for (const line of lines.slice(1)) { + const parts = line.split(',') + if (parts.length < header.length) return null // truncated row + const row = {} + header.forEach((h, i) => { + row[h] = (i === header.length - 1 ? parts.slice(i).join(',') : parts[i] || '').trim() + }) + const [, idColumn] = requiredColumns + if (!row.chain || !isId(row[idColumn] || '')) return null + if (!isDate(row.effective_from) || (row.effective_to && !isDate(row.effective_to))) return null + rows.push(row) + } + return rows +} + +// a header-only file is a valid empty list; a missing key means we never got a usable version of it +const isValidBundle = (bundle) => !!bundle && Object.keys(KINDS).every(k => Array.isArray(bundle[k])) + +async function getExclusions() { + const kinds = Object.keys(KINDS) + const bundle = await getConfig('morpho-blue/exclusions', undefined, { + fetcher: async () => { + const files = await Promise.all(kinds.map(f => get(`${BASE_URL}/${f}.csv`))) + const fetched = {} + kinds.forEach((k, i) => { + const rows = parseCsv(files[i], KINDS[k]) + if (rows) fetched[k] = rows + }) + // a partial or malformed fetch must not overwrite the cache - getConfig keeps the last good copy + if (!isValidBundle(fetched)) throw new Error('morpho exclusions: incomplete or malformed feed') + return fetched + }, + }) + if (!isValidBundle(bundle)) { + sdk.log('morpho-blue: no valid exclusion feed and no cache, running without feed exclusions') + return null + } + return bundle +} + +// effective_from is inclusive, effective_to exclusive and empty while the exclusion is still active +const isActive = (row, dateString) => + isDate(row.effective_from) && row.effective_from <= dateString && + (!row.effective_to || row.effective_to > dateString) + +const getDateString = (api) => + new Date((api.timestamp || Math.floor(Date.now() / 1e3)) * 1e3).toISOString().slice(0, 10) + +async function getRows(api, kind) { + const exclusions = await getExclusions() + const rows = (exclusions && exclusions[kind]) || [] + const dateString = getDateString(api) + return rows.filter(row => row.chain === api.chain && isActive(row, dateString)) +} + +const getExcludedMarketIds = async (api) => (await getRows(api, 'markets')).map(i => i.market_id.toLowerCase()) +const getExcludedAssets = async (api) => (await getRows(api, 'assets')).map(i => i.asset_address.toLowerCase()) +const getExcludedVaults = async (api) => (await getRows(api, 'vaults')).map(i => i.vault_address.toLowerCase()) + +module.exports = { getExcludedMarketIds, getExcludedAssets, getExcludedVaults } diff --git a/projects/morpho-blue/index.js b/projects/morpho-blue/index.js index 4d3765ce1b6..61f62a47656 100644 --- a/projects/morpho-blue/index.js +++ b/projects/morpho-blue/index.js @@ -5,6 +5,7 @@ const abi = require("../helper/abis/morpho.json"); const { sumTokens2 } = require("../helper/unwrapLPs"); const { getMorphoVaults } = require("../helper/curators"); const { config } = require("./config"); +const { getExcludedMarketIds, getExcludedAssets, getExcludedVaults } = require("./exclusions"); const eventAbis = { createMarket: 'event CreateMarket(bytes32 indexed id, (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams)' @@ -45,7 +46,66 @@ const getMarket = async (api) => { ].filter(i => !existingIds.has(i)).map(id => ({ id }))) } - return logs.map((i) => i.id.toLowerCase()).filter((id) => !blacklistedMarketIds.includes(id)) + // union with morpho's own feed, never a replacement - the feed is a subset of the list above + const excluded = new Set([...blacklistedMarketIds.map(i => i.toLowerCase()), ...await getExcludedMarketIds(api)]) + const all = logs.map((i) => i.id.toLowerCase()) + + // asset_usage is 'all', so a market with an excluded asset on either leg is excluded too - same rule + // the fees adapter applies. Without this a market excluded only by its collateral keeps its loan + // balance in tvl, even though borrowed already drops it. + const excludedAssets = new Set(await getExcludedAssets(api)) + if (excludedAssets.size) { + const candidates = all.filter((id) => !excluded.has(id)) + const infos = await api.multiCall({ target: morphoBlue, calls: candidates, abi: abi.morphoBlueFunctions.idToMarketParams }) + infos.forEach((info, i) => { + if (excludedAssets.has(info.loanToken.toLowerCase()) || excludedAssets.has(info.collateralToken.toLowerCase())) + excluded.add(candidates[i]) + }) + } + return { markets: all.filter((id) => !excluded.has(id)), excludedMarkets: all.filter((id) => excluded.has(id)) } +} + +// tvl sums the whole balance the shared morpho contract holds of each token, so dropping an excluded +// market from the id list does nothing while a valid market uses the same token. Subtract what the +// excluded market still physically holds: supply minus borrowed, since borrowed assets have left the +// contract. Collateral is not attributable: morpho exposes no per-market total, only position(id, user), +// so an excluded market's collateral stays counted when a valid market shares that token - measured at +// ~$1k on ethereum, which is why netting the collateral logs per market is not worth the scan. +const subtractExcludedMarkets = async (api, excludedMarkets, morphoHeld) => { + if (!excludedMarkets.length) return + const { morphoBlue } = config[api.chain] + const [marketInfos, marketDatas] = await Promise.all([ + api.multiCall({ target: morphoBlue, calls: excludedMarkets, abi: abi.morphoBlueFunctions.idToMarketParams }), + api.multiCall({ target: morphoBlue, calls: excludedMarkets, abi: abi.morphoBlueFunctions.market }), + ]) + + const idleByToken = new Map() + marketDatas.forEach((data, i) => { + const loanToken = marketInfos[i].loanToken.toLowerCase() + const idle = BigInt(data.totalSupplyAssets || 0) - BigInt(data.totalBorrowAssets || 0) + if (idle > 0n) idleByToken.set(loanToken, (idleByToken.get(loanToken) ?? 0n) + idle) + }) + + idleByToken.forEach((idle, token) => { + const held = morphoHeld.get(token) + if (!held) return + // clamp: a market's accounting supply can exceed what the contract holds when interest is phantom + api.add(held.token, (-(idle > held.amount ? held.amount : idle)).toString()) + }) +} + +// what the shared morpho contract itself contributed, as the delta across its own sumTokens2 call. +// api balances also carry vault-held assets, and a loan token can be present only because a valid vault +// holds it unallocated - debiting that merged figure would remove assets the excluded market never held. +const measureMorphoHeld = async (api, sumMorphoBalances) => { + const before = { ...api.getBalances() } + await sumMorphoBalances() + const held = new Map() + Object.entries(api.getBalances()).forEach(([key, value]) => { + const amount = BigInt(value) - BigInt(before[key] ?? 0) + if (amount > 0n) held.set(key.split(':')[1].toLowerCase(), { token: key.split(':')[1], amount }) + }) + return held } // exclude ethena deposits into markets where collateral is USDe @@ -76,15 +136,17 @@ const tvl = async (api) => { // vault share tokens (MetaMorpho / Vault V2) are already counted via their underlying assets, exclude them everywhere const vaultSet = new Set(morphoVaults.map(v => v.toLowerCase())) - const blacklistedTokens = [...blackList, ...morphoVaults] + const blacklistedTokens = [...blackList, ...morphoVaults, ...await getExcludedAssets(api)] + // excluded vaults stay blacklisted as tokens above, but their unallocated assets are not counted + const excludedVaults = new Set(await getExcludedVaults(api)) const vaultTaO = vaultAssets - .map((asset, i) => asset ? [asset, morphoVaults[i]] : null) + .map((asset, i) => asset && !excludedVaults.has(morphoVaults[i].toLowerCase()) ? [asset, morphoVaults[i]] : null) .filter(Boolean) await sumTokens2({ api, tokensAndOwners: vaultTaO, blacklistedTokens, permitFailure: true }) - const markets = await getMarket(api) + const { markets, excludedMarkets } = await getMarket(api) const marketInfos = await api.multiCall({ target: morphoBlue, calls: markets, abi: abi.morphoBlueFunctions.idToMarketParams }) const collCalls = [...new Set(marketInfos.map(m => m.collateralToken.toLowerCase()).filter(addr => addr !== nullAddress && !vaultSet.has(addr)))]; const withdrawQueueLengths = await api.multiCall({ calls: collCalls, abi: abi.metaMorphoFunctions.withdrawQueueLength, permitFailure: true }) @@ -110,15 +172,18 @@ const tvl = async (api) => { }) } - return sumTokens2({ api, owner: morphoBlue, tokens, blacklistedTokens, permitFailure: true }) + const morphoHeld = await measureMorphoHeld(api, () => sumTokens2({ api, owner: morphoBlue, tokens, blacklistedTokens, permitFailure: true })) + await subtractExcludedMarkets(api, excludedMarkets, morphoHeld) + return api.getBalances() } const borrowed = async (api) => { const { morphoBlue, blackList = [] } = config[api.chain] - const markets = await getMarket(api) + const { markets } = await getMarket(api) const marketInfos = await api.multiCall({ target: morphoBlue, calls: markets, abi: abi.morphoBlueFunctions.idToMarketParams }) const marketDatas = await api.multiCall({ target: morphoBlue, calls: markets, abi: abi.morphoBlueFunctions.market }) const blackListLower = blackList.map(b => b.toLowerCase()) + const excludedAssets = new Set(await getExcludedAssets(api)) // asset_usage is 'all', so loan or collateral side const priceByAddr = await fetchPriceMap(api, marketInfos.flatMap(m => [m.collateralToken, m.loanToken])) const chainHasPrices = Object.keys(priceByAddr).length > 0 @@ -127,6 +192,7 @@ const borrowed = async (api) => { const { collateralToken, loanToken } = marketInfos[idx]; if (collateralToken.toLowerCase() === '0xda1c2c3c8fad503662e41e324fc644dc2c5e0ccd') return; if (blackListLower.includes(loanToken.toLowerCase())) return; + if (excludedAssets.has(loanToken.toLowerCase()) || excludedAssets.has(collateralToken.toLowerCase())) return; if (chainHasPrices && collateralToken && collateralToken.toLowerCase() !== nullAddress) { if (!priceByAddr[collateralToken.toLowerCase()]) return; From 028023356a2fefe8caf11a72dfd426c704558903 Mon Sep 17 00:00:00 2001 From: Perps Funds <121143672+perpsfunds@users.noreply.github.com> Date: Fri, 9 Oct 2026 17:22:01 +0300 Subject: [PATCH 171/988] Add PerpsFunds (Robinhood Chain perpetuals) TVL (#21518) --- projects/perpsfunds/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/perpsfunds/index.js diff --git a/projects/perpsfunds/index.js b/projects/perpsfunds/index.js new file mode 100644 index 00000000000..5ac089e197e --- /dev/null +++ b/projects/perpsfunds/index.js @@ -0,0 +1,21 @@ +// PERPS — permissionless perpetuals on Robinhood Chain (https://perpsfunds.github.io). +// PerpsHub (source verified on Sourcify) gives every margin token its own book, a minimal clone created with CREATE2. +// A book holds, in its margin token: each market's LP vault (the traders' counterparty), the traders' margin, and fee +// shares accrued for the protocol / market creators but not claimed yet (owedTotal — not user money). +const HUB = '0x63ce687590d29fC3aa62a58Df294E0663815C61b' + +async function tvl(api) { + const tokens = await api.call({ abi: 'address[]:allPerpsTokens', target: HUB }) + const books = await api.multiCall({ abi: 'function perpsBook(address) view returns (address)', target: HUB, calls: tokens }) + const [bals, owed] = await Promise.all([ + api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map((t, i) => ({ target: t, params: [books[i]] })) }), + api.multiCall({ abi: 'uint256:owedTotal', calls: books }), + ]) + tokens.forEach((token, i) => api.add(token, BigInt(bals[i]) - BigInt(owed[i]))) +} + +module.exports = { + methodology: 'Lists every perps book from PerpsHub (one per margin token) and counts each book\'s balance of its margin token — LP vaults and traders\' margin — minus the fee shares accrued for the protocol and market creators but not yet claimed.', + start: '2026-10-08', + robinhood: { tvl }, +} From 3e1fb51dfd7808b01318e7ed4dfa5b7a5125d3bf Mon Sep 17 00:00:00 2001 From: routebuilder Date: Fri, 9 Oct 2026 16:23:52 +0200 Subject: [PATCH 172/988] bluefin-amm: raise pool list limit to cover all 2837 sui pools (#21491) --- projects/bluefin-amm/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/bluefin-amm/index.js b/projects/bluefin-amm/index.js index ee552bcc106..e1905f5f630 100644 --- a/projects/bluefin-amm/index.js +++ b/projects/bluefin-amm/index.js @@ -7,7 +7,7 @@ const blacklistedPools = [ ] async function suiTvl(api) { - const pools = (await getConfig('bluefin/amm-sui', 'https://swap.api.sui-prod.bluefin.io/api/v1/pools/info?limit=1000')).map(i => i.address) + const pools = (await getConfig('bluefin/amm-sui', 'https://swap.api.sui-prod.bluefin.io/api/v1/pools/info?limit=10000')).map(i => i.address) // const res = await sui.getObjects(pools.filter(p => !blacklistedPools.includes(p))) const res = await sui.getObjects(pools) res.forEach((i) => { From 1f961c8429f71788331464ed538c05cddb7f9f57 Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Fri, 9 Oct 2026 11:24:23 -0300 Subject: [PATCH 173/988] Fix Orbit Finance staking with on-chain vault balances (#21492) Co-authored-by: ccipherx --- projects/orbit-finance/index.js | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/projects/orbit-finance/index.js b/projects/orbit-finance/index.js index c68cc0e5da6..ca7c7dd239b 100644 --- a/projects/orbit-finance/index.js +++ b/projects/orbit-finance/index.js @@ -1,12 +1,10 @@ -const { sumTokens2 } = require("../helper/solana"); -const { get } = require("../helper/http"); +const { sumTokens2, getConnection, getProvider } = require("../helper/solana"); const { Program } = require("@coral-xyz/anchor"); -const { getProvider } = require("../helper/solana"); - -const ADAPTER_BASE = "https://orbit-dex.api.cipherlabsx.com"; +const { PublicKey } = require("@solana/web3.js"); // CIPHER native token mint const CIPHER_MINT = "Ciphern9cCXtms66s8Mm6wCFC27b2JProRQLYmiLMH3N"; +const STAKING_PROGRAM = new PublicKey("STAKEvGqQTtzJZH6BWDcbpzXXn2BBerPAgQ3EGLN2GH"); async function tvl(api) { const provider = getProvider(); @@ -16,23 +14,24 @@ async function tvl(api) { return sumTokens2({ api, tokenAccounts, blacklistedTokens: [CIPHER_MINT] }); // exclude projects own token from the tvl } -/** - * Staking TVL: total CIPHER locked in Streamflow staking streams. - * Staked CIPHER is distributed across per-user escrow accounts so we - * read the aggregate total from the adapter's Streamflow indexer. - */ -async function staking() { - const data = await get(`${ADAPTER_BASE}/api/v1/streamflow/vaults`, { timeout: 30000 }); - const cipherVault = (data.vaults ?? []).find((v) => v.tokenMint === CIPHER_MINT); - if (!cipherVault?.total_staked_raw) return {}; - return { ["solana:" + CIPHER_MINT]: cipherVault.total_staked_raw }; +async function staking(api) { + // Streamflow StakePool layout: mint at 10, staking vault at 139; reward pools are separate accounts. + // https://github.com/streamflow-finance/js-sdk/blob/fb236fff325ab02d7ff5d0ff5e393be8934cda9d/packages/staking/solana/descriptor/idl/stake_pool.json + const pools = await getConnection().getProgramAccounts(STAKING_PROGRAM, { + filters: [ + { memcmp: { offset: 0, bytes: "MGAteRdkWBD" } }, // StakePool discriminator + { memcmp: { offset: 10, bytes: CIPHER_MINT } }, + ], + }); + const tokenAccounts = pools.map(({ account: { data } }) => new PublicKey(data.subarray(139, 171))); + return sumTokens2({ api, tokenAccounts }); } module.exports = { timetravel: false, solana: { tvl, staking }, methodology: - "TVL is the sum of all token balances in CipherDLMM pool vaults (base + quote) on Solana. Staking TVL separately counts CIPHER locked in the Streamflow staking pool.", + "TVL is the sum of token balances in CipherDLMM pool vaults (base + quote) on Solana, excluding CIPHER. Staking separately counts CIPHER balances held in Streamflow stake pool vaults discovered on-chain, excluding reward and vesting accounts.", }; From bfe80f700bf527cb6e4cd70586029a2d3ff58e97 Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Fri, 9 Oct 2026 11:37:51 -0300 Subject: [PATCH 174/988] fix(jediswap-v2): discover pools on-chain and include legacy custody (#21497) Co-authored-by: ccipherx --- projects/jediswap-v2/index.js | 46 ++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/projects/jediswap-v2/index.js b/projects/jediswap-v2/index.js index b2b65e9a64c..34e6892c49e 100644 --- a/projects/jediswap-v2/index.js +++ b/projects/jediswap-v2/index.js @@ -1,19 +1,47 @@ -const { sumTokens } = require('../helper/chain/starknet') -const { cachedGraphQuery } = require('../helper/cache') +const { getLogs, multiCall, parseAddress } = require('../helper/chain/starknet') +const { getSelectorFromName } = require('../helper/utils/starknet') + +// https://docs.jediswap.xyz/for-developers/jediswap-v2/contract-addresses +// https://docs.jediswap.xyz/for-developers/jediswap-v2/deprecated-contract-addresses +const factories = [ + { target: '0x01aa950c9b974294787de8df8880ecf668840a6ab8fa8290bf2952212b375148', fromBlock: 637881 }, + { target: '0x04ba0de31008f4e3edd42b3c31db8f49490505885d684b78f5aa1572850b3a5a', fromBlock: 535428 }, +] +const poolCreated = getSelectorFromName('PoolCreated') +const balanceOf = { + name: 'balanceOf', type: 'function', + inputs: [{ name: 'account', type: 'felt' }], + // Decode both limbs as an integer string; the legacy Uint256 ABI coerces to Number. + outputs: [{ type: 'core::integer::u256' }], + state_mutability: 'view', +} + +function parsePool({ data }) { + // PoolCreated contains token0, token1, fee, tick_spacing, pool (all in data). + if (data.length !== 5) throw new Error('Invalid JediSwap V2 PoolCreated event') + return { pool: parseAddress(data[4]), tokens: data.slice(0, 2).map(parseAddress) } +} async function tvl(api) { - const query = '{ pools (first: 1000) { poolAddress token0 { tokenAddress } token1 { tokenAddress } }}' - const { pools } = await cachedGraphQuery('starknet-jediswap-v2', 'https://api.v2.jediswap.xyz/graphql', query) - const t = str => str.replace('0x', '0x0') - const ownerTokens = pools.map(pool => [[t(pool.token0.tokenAddress), t(pool.token1.tokenAddress)], t(pool.poolAddress)]) - return sumTokens({ ownerTokens, api }) - // await getLogs({ fromBlock: 535428, topic: '0x27dd458d081c22bd6e76f4dddbc87f11e477b7c5823b13f147d45f91ec098ee', target: factory }).catch(console.error) + const pools = new Map() + for (const factory of factories) { + const logs = await getLogs({ ...factory, topics: [poolCreated] }) + for (const log of logs) { + const pool = parsePool(log) + pools.set(pool.pool, pool.tokens) + } + } + const calls = [...pools].flatMap(([pool, tokens]) => tokens.map(target => ({ target, params: [pool] }))) + const balances = await multiCall({ abi: balanceOf, calls }) + balances.forEach((balance, i) => api.add(calls[i].target, balance)) + return api.getBalances() } module.exports = { timetravel: false, isHeavyProtocol: true, + methodology: 'Counts the underlying token balances held by pools created by the current and deprecated JediSwap V2 factories. Pools are discovered from on-chain PoolCreated events and counted once; position NFTs and router balances are excluded.', starknet: { tvl, } -} \ No newline at end of file +} From 312dbf995c08ffe44426074d77274f7a6bb30a34 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Fri, 9 Oct 2026 16:41:44 +0200 Subject: [PATCH 175/988] auctus: stop double-counting options via shared log cache (#21494) Co-authored-by: FelixBruguera --- projects/auctus/index.js | 59 ++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/projects/auctus/index.js b/projects/auctus/index.js index 07c40f90f79..c6c513017d7 100644 --- a/projects/auctus/index.js +++ b/projects/auctus/index.js @@ -18,34 +18,32 @@ const getUnderlyingAddressFromNewAcoPoolLogData = data => '0x' + data.substring( const getStrikeAssetAddressFromNewAcoPoolLogData = data => '0x' + data.substring(26, 66); async function tvl(api) { - var logsPromises = await Promise.all([ - getLogs({ - api, - target: FACTORY, - fromBlock: START_BLOCK, - topic: 'NewAcoToken(address,address,bool,uint256,uint256,address,address)', - }), - getLogs({ - api, - target: FACTORY, - fromBlock: START_BLOCK, - topic: 'NewAcoTokenData(address,address,bool,uint256,uint256,address,address,address)', - }), - getLogs({ - api, - target: POOLS_FACTORY, - fromBlock: START_BLOCK, - topic: 'NewAcoPool(address,address,bool,address,address)', - }), - getLogs({ - api, - target: VAULTS, - fromBlock: START_BLOCK, - topic: 'AcoVault(address,bool)', - }) - ]) - - const logs = logsPromises[0]; + const logs = await getLogs({ + api, + target: FACTORY, + fromBlock: START_BLOCK, + topic: 'NewAcoToken(address,address,bool,uint256,uint256,address,address)', + extraKey: 'new-aco-token', + }) + const logs2 = await getLogs({ + api, + target: FACTORY, + fromBlock: START_BLOCK, + topic: 'NewAcoTokenData(address,address,bool,uint256,uint256,address,address,address)', + extraKey: 'new-aco-token-data', + }) + const newAcoPoolLogs = await getLogs({ + api, + target: POOLS_FACTORY, + fromBlock: START_BLOCK, + topic: 'NewAcoPool(address,address,bool,address,address)', + }) + const setVaultLog = await getLogs({ + api, + target: VAULTS, + fromBlock: START_BLOCK, + topic: 'AcoVault(address,bool)', + }) let acoOptionsAddresses = []; logs.forEach((log) => { @@ -53,11 +51,11 @@ async function tvl(api) { acoOptionsAddresses.push(address) }); - const logs2 = logsPromises[1]; logs2.forEach((log) => { const address = getTokenAddressFromNewAcoTokenLogData(log.data); acoOptionsAddresses.push(address) }); + acoOptionsAddresses = [...new Set(acoOptionsAddresses.map(a => a.toLowerCase()))]; let collateralResult = await api.multiCall({ calls: acoOptionsAddresses, abi: abi.collateral, }); @@ -74,7 +72,6 @@ async function tvl(api) { api.add(colateralAddress, result) }); - const newAcoPoolLogs = logsPromises[2]; const ownerTokens = [] newAcoPoolLogs.forEach((log) => { @@ -86,8 +83,6 @@ async function tvl(api) { await api.sumTokens({ ownerTokens }) - const setVaultLog = logsPromises[3]; - let acoVaultsAddresses = []; setVaultLog.forEach((log) => { const address = getVaultAddressFromSetAcoVaultLogData(log.topics[1]); From e0ebc1e8879a944db3de16ee1ee12eb092808198 Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Fri, 9 Oct 2026 11:54:45 -0300 Subject: [PATCH 176/988] Fix ZilSwap TVL using on-chain pool reserves (#21481) Co-authored-by: FelixBruguera --- projects/zilswap.js | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/projects/zilswap.js b/projects/zilswap.js index a517f2c1a72..18484571d5b 100644 --- a/projects/zilswap.js +++ b/projects/zilswap.js @@ -1,17 +1,47 @@ -const utils = require('./helper/utils'); +const BigNumber = require('bignumber.js') +const { call, formQuery } = require('./helper/chain/zilliqa') + +// https://github.com/Switcheo/zilswap#deployed-contracts +const CONTRACT = '459cb2d3baf7e61cfbd5fe362f289ae92b2babb0' async function tvl() { - var totalTvl = (await utils.fetchURL('https://stats.zilswap.org/liquidity'))?.data?.reduce((prev,curr) => prev + (Number(curr?.amount) * 10**-12 ?? 0), 0); + const { result, error } = await call(formQuery({ params: [CONTRACT, 'pools', []] })) + if (error) throw new Error(`ZilSwap RPC error: ${error.message}`) + + const pools = result?.pools + if (!pools || typeof pools !== 'object' || Array.isArray(pools)) + throw new Error('Invalid ZilSwap pools response') + + const zilReserve = Object.values(pools).reduce((total, pool) => total + getZilReserve(pool), 0n) + // Each Pool contains [ZIL reserve, token reserve]. Value the token side at + // the pool's reserve ratio, so both sides together are worth twice its ZIL. + // CoinGecko balances must be numbers in the SDK; convert only after summing Qa. return { - zilliqa: totalTvl - }; + 'coingecko:zilliqa': BigNumber(zilReserve.toString()).times(2).shiftedBy(-12).toNumber(), + } +} + +function getZilReserve(pool) { + const reserves = pool?.arguments + if (!Array.isArray(reserves) || reserves.length !== 2 || !reserves.every(isReserve)) + throw new Error('Invalid ZilSwap pool reserves') + + const [zilReserve, tokenReserve] = reserves.map(BigInt) + if ((zilReserve === 0n) !== (tokenReserve === 0n)) + throw new Error('Invalid ZilSwap pool: one-sided reserves') + + return zilReserve +} + +function isReserve(value) { + return typeof value === 'string' && /^\d+$/.test(value) } module.exports = { zilliqa: { tvl, }, - methodology: `ZilSwap TVL is achieved by making a call to its API: https://stats.zilswap.org/liquidity`, + methodology: 'Reads recorded reserves from all pools in the current ZilSwap contract on Zilliqa. Values paired ZRC-2 reserves at each pool\'s reserve ratio (twice the native ZIL reserve), without reconciling token-contract balances. Excludes LP shares, rewards and the migrated legacy contract.', misrepresentedTokens: true, timetravel: false, } From b446f08e886c541d6a159885e9bcefbdf02e1409 Mon Sep 17 00:00:00 2001 From: Hoodlock Date: Fri, 9 Oct 2026 17:22:17 +0200 Subject: [PATCH 177/988] HoodLock: add Liquidity Locker (Uniswap V3/V4 positions) (#21395) Co-authored-by: Hoodlock <285061650+Hoodlock@users.noreply.github.com> Co-authored-by: ccipherx Co-authored-by: FelixBruguera --- projects/hoodlock/index.js | 92 +++++++++++++++++++++++++++----------- 1 file changed, 66 insertions(+), 26 deletions(-) diff --git a/projects/hoodlock/index.js b/projects/hoodlock/index.js index 0269f96af01..509f8609be3 100644 --- a/projects/hoodlock/index.js +++ b/projects/hoodlock/index.js @@ -1,63 +1,103 @@ const { getUniqueAddresses } = require('../helper/utils') const { sumTokens2 } = require('../helper/unwrapLPs') -/* HoodLock, a token locker and vesting protocol on Robinhood Chain. +/* HoodLock, a token locker, liquidity locker and vesting protocol on Robinhood Chain. * - * TVL is what the contracts hold right now, read with balanceOf. A withdrawn + * tvl: tokens locked in the token locker plus Uniswap V3/V4 positions locked in + * the Liquidity Locker. vesting: tokens held by the vesting contract. + * + * Value is what the contracts hold right now, read with balanceOf. A withdrawn * lock leaves its record behind with a `withdrawn` flag, so summing records * would keep counting tokens that already left. The records are read only to * discover WHICH tokens each contract holds. * - * HoodLock's own token, LOCK, is reported under staking rather than tvl. + * HoodLock's own token, LOCK, is reported under staking. * * Burns are excluded on purpose: burned supply sits at the dead address and is - * no longer held by any HoodLock contract, so it is not TVL. + * no longer held by any HoodLock contract, so it is not counted. + * + * Uniswap V3 and V4 positions locked in the Liquidity Locker count by what the + * position holds. The locker owns the position NFT for the life of a lock, and + * its active locks name the position ids, which the shared V3/V4 helpers value. + * A position that pairs LOCK is reported under pool2. */ const LOCKER = '0xd0f7d8c6e9f6d80c297bebe4f7fd1b9c8125c32f' const VESTING = '0x910e19bcC4bce46999994Ed7297E0Fc4431ec72E' const LOCK_TOKEN = '0xd5bf43f29bf7aa5bb42ae9e217b84b86eb7a4b94' +const LP_LOCKER = '0x91Aa2dA1956C77F8448E18DCaf53383bCc658e67' +const LP_LOCKER_BLOCK = 80030403 // Liquidity Locker deploy block const abi = { totalLocks: 'uint256:totalLocks', locks: 'function locks(uint256) view returns (address owner, address token, uint256 amount, uint256 unlockTime, bool withdrawn)', totalSchedules: 'uint256:totalSchedules', getSchedule: 'function getSchedule(uint256) view returns ((address creator, uint64 start, address beneficiary, uint64 cliff, address token, uint64 end, uint128 total, uint128 claimed))', + nextLockId: 'uint256:nextLockId', + getLock: 'function getLock(uint256) view returns ((address owner, uint40 unlockTime, uint16 collectFeeBps, bool isV4, bool hookVerified, bool withdrawn, address feeRecipient, address token0, address token1, uint256 tokenId))', } /** Ids run 1..n inclusive: both contracts pre-increment their counter. */ const idCalls = (target, n) => Array.from({ length: Number(n) }, (_, i) => ({ target, params: i + 1 })) +const notLock = t => t.toLowerCase() !== LOCK_TOKEN.toLowerCase() + +/* Ids 1..n all exist, so a failed record read is an infrastructure problem, + * not an expected revert. Let it throw instead of dropping the record: a + * short list would understate TVL with nothing visible to say so. */ async function tvl(api) { - const [lockCount, scheduleCount] = await Promise.all([ - api.call({ abi: abi.totalLocks, target: LOCKER }), - api.call({ abi: abi.totalSchedules, target: VESTING }), - ]) - - /* Ids 1..n all exist, so a failed record read is an infrastructure problem, - * not an expected revert. Let it throw instead of dropping the record: a - * short list would understate TVL with nothing visible to say so. */ - const [locks, schedules] = await Promise.all([ - api.multiCall({ abi: abi.locks, calls: idCalls(LOCKER, lockCount) }), - api.multiCall({ abi: abi.getSchedule, calls: idCalls(VESTING, scheduleCount) }), - ]) - - const notLock = t => t !== LOCK_TOKEN - const ownerTokens = [ - [getUniqueAddresses(locks.filter(l => !l.withdrawn && l.amount > 0).map(l => l.token)).filter(notLock), LOCKER], - [getUniqueAddresses(schedules.filter(s => s.total > s.claimed).map(s => s.token)).filter(notLock), VESTING], - ] - return sumTokens2({ api, ownerTokens }) + const lockCount = await api.call({ abi: abi.totalLocks, target: LOCKER }) + const locks = await api.multiCall({ abi: abi.locks, calls: idCalls(LOCKER, lockCount) }) + const tokens = getUniqueAddresses(locks.filter(l => !l.withdrawn && l.amount > 0).map(l => l.token)).filter(notLock) + await sumTokens2({ api, owner: LOCKER, tokens }) + await addLockedPositions(api, (l) => !pairsLock(l)) + return api.getBalances() +} + +async function vesting(api) { + const scheduleCount = await api.call({ abi: abi.totalSchedules, target: VESTING }) + const schedules = await api.multiCall({ abi: abi.getSchedule, calls: idCalls(VESTING, scheduleCount) }) + const tokens = getUniqueAddresses(schedules.filter(s => s.total > s.claimed).map(s => s.token)).filter(notLock) + return sumTokens2({ api, owner: VESTING, tokens }) +} + +const pairsLock = (l) => [l.token0, l.token1].some(t => t.toLowerCase() === LOCK_TOKEN.toLowerCase()) + +/* Active Liquidity Locker locks. Ids start at 1 and nextLockId is the next one + * to be issued, so 1..nextLockId-1 all exist. */ +async function activeLpLocks(api) { + if (await api.getBlock() < LP_LOCKER_BLOCK) return [] + const next = Number(await api.call({ abi: abi.nextLockId, target: LP_LOCKER })) + const calls = Array.from({ length: Math.max(0, next - 1) }, (_, i) => ({ target: LP_LOCKER, params: i + 1 })) + if (!calls.length) return [] + const locks = await api.multiCall({ abi: abi.getLock, calls }) + return locks.filter(l => !l.withdrawn) +} + +async function addLockedPositions(api, keep) { + const locks = (await activeLpLocks(api)).filter(keep) + const v3 = locks.filter(l => !l.isV4).map(l => l.tokenId) + const v4 = locks.filter(l => l.isV4).map(l => l.tokenId) + if (v3.length) await sumTokens2({ api, resolveUniV3: true, uniV3ExtraConfig: { positionIds: v3 } }) + if (v4.length) await sumTokens2({ api, resolveUniV4: true, uniV4ExtraConfig: { positionIds: v4 } }) +} + +async function pool2(api) { + await addLockedPositions(api, pairsLock) + return api.getBalances() } const staking = (api) => sumTokens2({ api, owners: [LOCKER, VESTING], tokens: [LOCK_TOKEN] }) module.exports = { methodology: - 'Counts the ERC-20 balances held by the HoodLock locker and vesting contracts on Robinhood Chain. ' + + 'TVL counts the ERC-20 balances held by the HoodLock token locker on Robinhood Chain, ' + + 'plus the Uniswap V3 and V4 positions locked in the HoodLock Liquidity Locker, valued by the tokens each position holds. ' + + 'Tokens held by the HoodLock vesting contract are reported as vesting. ' + 'Lock and vesting records are read on chain to find which tokens each contract holds, then every ' + 'balance is read with balanceOf, so withdrawn locks and fully claimed vesting stop counting ' + - 'automatically. HoodLock\'s own LOCK token held by the contracts is reported as staking. Burned supply ' + + 'automatically. HoodLock\'s own LOCK token held by the contracts is reported as staking, and locked positions ' + + 'that pair LOCK as pool2. Burned supply ' + 'is excluded because it is sent to the dead address and is no longer held by any HoodLock contract.', - robinhood: { tvl, staking }, + robinhood: { tvl, vesting, staking, pool2 }, } From f09045c2dd539dedff7c15a1445e7652a6cf7b4e Mon Sep 17 00:00:00 2001 From: marvz702 <33850849+marvz702@users.noreply.github.com> Date: Sat, 10 Oct 2026 05:29:01 +1000 Subject: [PATCH 178/988] yieldcore: include protocol-controlled vault positions in TVL (#21508) Co-authored-by: FelixBruguera --- registries/sumTokens.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index aa8867f1804..44d0b940d7a 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -41705,17 +41705,25 @@ const configs = { }, "yieldcore": { "start": "2026-02-06", - "methodology": "TVL is calculated as the total USDT deposited by users into YieldCore bonds & Krystal vault", + "methodology": "Counts USDT held by the YieldCore bond contracts (v3, v4.3.1, v4.3.2) and USDT plus PancakeSwap/Uniswap V3 LP positions held by the protocol's Krystal vaults.", "bsc": { "tokens": [ ADDRESSES.bsc.USDT ], "owners": [ - "0x2375Fcc2a256425228aA94d7100093230761639e", + "0x2375Fcc2a256425228aA94d7100093230761639e", // v3 "0x6D6CDf89Cc565A04f0Ba99A1Dc13d43d0d005E4E", // v4.3.1 "0x903407687486b3ae60746622D06b2eD3D75EaCAb", // v4.3.2 - "0xeE9dd48b2Aa7Ab67534c6Da5E1cD261263d46ef7" - ] + // Krystal PrivateVaults owned by the protocol wallet + "0xeE9dd48b2Aa7Ab67534c6Da5E1cD261263d46ef7", + "0x5e910c45611b401c6bbd6d9c85e4a228b4f5fac1", + "0xde5da338479e1c5751e7243eb1bd750ec4e5a91f", + "0x9fd253eeca51aa8cef55d8eb2fedd22b72fab3fd", + "0x3322a1084b905cad729abcc6f02c52bbfbcbdf55", + "0xad0d5df9316ca451707fae2ea3e079d368e80ba3", + "0x4f84d1f9ae79363008870dacf7d50e4385166c9f" + ], + "resolveUniV3": true }, }, "yieldwars": { From daa630cfb5b378419ab9849914f1d459815242e8 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Fri, 9 Oct 2026 21:59:02 +0200 Subject: [PATCH 179/988] Add Derive V3 migration hallmark (#21521) --- projects/lyra-v2/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/lyra-v2/index.js b/projects/lyra-v2/index.js index 0eb312fc48a..e541eb32f69 100644 --- a/projects/lyra-v2/index.js +++ b/projects/lyra-v2/index.js @@ -34,3 +34,7 @@ chains.forEach(chain => { } } }) + +module.exports.hallmarks = [ + ['2026-10-08', "Derive V3 migration completed, V2 bridge funds moved to L1"], +] From 1953dd9d4931b1b67e447cdc7e16da19017d9687 Mon Sep 17 00:00:00 2001 From: OxForged Date: Fri, 9 Oct 2026 13:25:51 -0700 Subject: [PATCH 180/988] Add DEEP launchpad and DeepSwap (Solana) (#21503) Co-authored-by: OxForged <270251360+OxForged@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- projects/deep-launchpad/index.js | 37 +++++++++++++++ projects/deepswap/index.js | 80 ++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 projects/deep-launchpad/index.js create mode 100644 projects/deepswap/index.js diff --git a/projects/deep-launchpad/index.js b/projects/deep-launchpad/index.js new file mode 100644 index 00000000000..cd29dbe382c --- /dev/null +++ b/projects/deep-launchpad/index.js @@ -0,0 +1,37 @@ +const { PublicKey } = require('@solana/web3.js') +const ADDRESSES = require('../helper/coreAssets.json') +const { getConnection } = require('../helper/solana') + +// DEEP launchpad: the Deep Curve bonding-curve program. Every launched token has one +// BondingCurve account (PDA ["curve", mint]) that holds the SOL buyers paid in. +// At graduation the SOL moves to a DeepSwap pool (counted by the deepswap adapter) and the +// program sets real_sol_reserves to 0, so a graduated curve adds nothing here. +const DEEP_CURVE_PROGRAM = '7czURwVLkQpcF1HVhhZU5GGzvPA8YniogZY1BhZHCDtA' + +// Anchor discriminator of the account: sha256("account:BondingCurve")[0..8] +const BONDING_CURVE_DISCRIMINATOR = Buffer.from([23, 183, 248, 55, 96, 216, 172, 96]) + +// BondingCurve layout (borsh, after the 8-byte discriminator): mint 32 | creator 32 | +// virtual_sol_reserves u64 | virtual_token_reserves u64 | real_sol_reserves u64 @88 | ... +// The account has only ever grown by appended fields, so this offset holds for every version. +const OFFSET_REAL_SOL_RESERVES = 88 + +async function tvl(api) { + const connection = getConnection() + const curves = await connection.getProgramAccounts(new PublicKey(DEEP_CURVE_PROGRAM), { + filters: [{ memcmp: { offset: 0, bytes: BONDING_CURVE_DISCRIMINATOR.toString('base64'), encoding: 'base64' } }], + dataSlice: { offset: OFFSET_REAL_SOL_RESERVES, length: 8 }, + }) + + let lamports = 0n + for (const { account } of curves) lamports += account.data.readBigUInt64LE(0) + + api.add(ADDRESSES.solana.SOL, lamports.toString()) +} + +module.exports = { + timetravel: false, // getProgramAccounts reads the current state only + methodology: + 'TVL is the SOL that buyers have paid into the bonding curves of tokens that have not graduated yet: the sum of real_sol_reserves over every BondingCurve account of the Deep Curve program. Not counted: the curve\'s virtual reserves (a pricing parameter, not assets), the launched tokens still held by a curve (they have no market outside their own curve), trading fees and creator or holder rewards that sit on a curve account until they are claimed, and graduated tokens, whose liquidity is in a DeepSwap pool.', + solana: { tvl }, +} diff --git a/projects/deepswap/index.js b/projects/deepswap/index.js new file mode 100644 index 00000000000..b0a53079289 --- /dev/null +++ b/projects/deepswap/index.js @@ -0,0 +1,80 @@ +const { PublicKey } = require('@solana/web3.js') +const { getConnection, getTokenAccountBalances } = require('../helper/solana') +const { transformDexBalances } = require('../helper/portedTokens') + +// DeepSwap: DEEP's constant-product AMM, a fork of Raydium cp-swap (Apache-2.0) deployed +// under its own program id. Tokens that graduate from the DEEP launchpad get their pool here +// (the LP tokens of a graduation pool are burned); anyone can open a pool for any other pair. +const DEEP_AMM_PROGRAM = 'HCrCy6bzHhZ1b6bXwQAucEFkKXyzYMh3hgAR8UPrYSEP' + +// Anchor discriminator of the account: sha256("account:PoolState")[0..8] +const POOL_STATE_DISCRIMINATOR = Buffer.from([247, 237, 227, 245, 215, 195, 222, 70]) +const POOL_STATE_SIZE = 637 + +// PoolState layout (zero-copy, packed). Offsets from the start of the account. +const OFFSET_TOKEN_0_VAULT = 72 +const OFFSET_TOKEN_1_VAULT = 104 +const OFFSET_TOKEN_0_MINT = 168 +const OFFSET_TOKEN_1_MINT = 200 +// Fees that have accrued in the vaults but belong to the protocol or to the pool's reward +// recipient, not to the liquidity: u64 each, [token 0, token 1]. +const OFFSETS_ACCRUED_FEES = [ + [341, 349], // protocol_fees_token_0 / _1 + [357, 365], // fund_fees_token_0 / _1 + [397, 405], // creator_fees_token_0 / _1 +] +const SLICE_START = OFFSET_TOKEN_0_VAULT +const SLICE_LENGTH = 413 - SLICE_START + +async function tvl(api) { + const connection = getConnection() + const pools = await connection.getProgramAccounts(new PublicKey(DEEP_AMM_PROGRAM), { + filters: [ + { dataSize: POOL_STATE_SIZE }, + { memcmp: { offset: 0, bytes: POOL_STATE_DISCRIMINATOR.toString('base64'), encoding: 'base64' } }, + ], + dataSlice: { offset: SLICE_START, length: SLICE_LENGTH }, + }) + if (!pools.length) return + + const readPubkey = (data, offset) => new PublicKey(data.subarray(offset - SLICE_START, offset - SLICE_START + 32)).toString() + const readU64 = (data, offset) => data.readBigUInt64LE(offset - SLICE_START) + + const vaults = pools.flatMap(({ account }) => [ + readPubkey(account.data, OFFSET_TOKEN_0_VAULT), + readPubkey(account.data, OFFSET_TOKEN_1_VAULT), + ]) + const vaultBalances = await getTokenAccountBalances(vaults, { individual: true }) + + const data = [] + pools.forEach(({ pubkey, account }, i) => { + const reserves = [0, 1].map((side) => { + const vault = vaultBalances[2 * i + side] + if (vault?.amount === undefined) return null + const accruedFees = OFFSETS_ACCRUED_FEES.reduce((sum, offsets) => sum + readU64(account.data, offsets[side]), 0n) + const reserve = BigInt(vault.amount) - accruedFees + return reserve < 0n ? null : reserve.toString() + }) + // A pool whose vault could not be read, or that would owe more fees than its vault holds + // (the program does not allow it), is left out instead of failing every other pool. + if (reserves.includes(null)) { + api.log(`deepswap: skipped pool ${pubkey}, its vault balances could not be used`) + return + } + data.push({ + token0: readPubkey(account.data, OFFSET_TOKEN_0_MINT), + token1: readPubkey(account.data, OFFSET_TOKEN_1_MINT), + token0Bal: reserves[0], + token1Bal: reserves[1], + }) + }) + + return transformDexBalances({ api, data }) +} + +module.exports = { + timetravel: false, // getProgramAccounts reads the current state only + methodology: + 'TVL is the liquidity in every DeepSwap pool: the balance of the pool\'s two token vaults minus the trading fees that have accrued in them for the protocol and for the pool\'s reward recipient. A pool that pairs a token with SOL or another major asset is valued at twice that side, since most tokens here have no market outside their own pool; a pool of two major assets counts both sides.', + solana: { tvl }, +} From df63e844903b8ec61fcfd6f774e46e61e7990e9c Mon Sep 17 00:00:00 2001 From: kamirai-ops Date: Sat, 10 Oct 2026 00:52:07 +0400 Subject: [PATCH 181/988] Add Kyorai TVL (BSC farm) (#21524) Co-authored-by: FelixBruguera --- registries/sumTokens.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 44d0b940d7a..db7b55ef0d5 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -17164,6 +17164,20 @@ const configs = { ] }, }, + "kyorai": { + "methodology": "Kyorai is a swap front end with no pools of its own, so TVL is empty. Pool2 is the KAMIRAI-WBNB PancakeSwap V2 LP staked in the Kyorai farm.", + "bsc": { + "tvl": { + "__empty": true + }, + "pool2": { + "__pool2": [ + "0xceA42138b022014BdeA7C4EFc1CAF9A9e719b6D0", // farm + "0xBD92961CA33E137270Bf5Bcd902ed1BAEf9A38e0" // KAMIRAI-WBNB Cake-LP + ] + } + }, + }, "kyan-blue": { "arbitrum": { "owner": "0x9AdCbEd09f911060Ef36570dC411196A86Ffb644", From 1ad896af84d7ee2b93ee318a307a644711df8107 Mon Sep 17 00:00:00 2001 From: Fakhzan <74360680+devfakhzan@users.noreply.github.com> Date: Sat, 10 Oct 2026 05:15:37 +0800 Subject: [PATCH 182/988] Add Ouro DEX V2 and V3 TVL (Robinhood Chain) (#21531) --- registries/uniswapV2.js | 5 +++++ registries/uniswapV3.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index 0f5dbe6d3f3..96957abff7b 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -3249,6 +3249,11 @@ const uniV2Configs = { methodology: 'Value of the tokens held in the Architect Swap V2 pairs on Robinhood Chain, enumerated from the factory.', robinhood: '0xfa6253ee74F7956b022998F7bfa271990C8A82a8', }, + 'ouro-dex-v2': { + start: '2026-09-26', // factory deployed at block 72056067 (2026-09-25 07:41 UTC) + methodology: 'Value of the tokens held in the Ouro DEX V2 pairs on Robinhood Chain, enumerated from the factory. LP tokens staked in the Ouro farms are not added again.', + robinhood: '0xaf0660Fd4d96F4e925AE85eba7A90a74C727fA2F', + }, } module.exports = buildProtocolExports(uniV2Configs, uniV2ExportFn) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index dffc8007b07..00e7afb24af 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1919,6 +1919,11 @@ const uniV3Configs = { methodology: 'Value of the tokens held in the Architect Swap V3 pools on Robinhood Chain, discovered from factory PoolCreated events.', robinhood: { factory: '0x3FdaBf7AB5d871B89F1d9DA04Dc2E0733dB70CaF', fromBlock: 22361711 }, }, + 'ouro-dex-v3': { + start: '2026-09-26', // factory deployed at block 72056673 (2026-09-25 07:42 UTC) + methodology: 'Value of the tokens held in the Ouro DEX V3 pools on Robinhood Chain, discovered from factory PoolCreated events. Position NFTs staked in the Ouro farms are not added again.', + robinhood: { factory: '0x9a8442cb89fE713ce7C2f22852e61fBFFeE97EcF', fromBlock: 72056673 }, + }, } module.exports = buildProtocolExports(uniV3Configs, uniV3Export) From 1093bd8ce38380ba2fe5550e295c7ea6041f938f Mon Sep 17 00:00:00 2001 From: imw <60992624+imarshallwidjaja@users.noreply.github.com> Date: Sat, 10 Oct 2026 09:00:25 +1100 Subject: [PATCH 183/988] [tvl] RamsesX - add HyperEVM staking and preserve Arbitrum history (#21517) --- registries/uniswapV2.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index 96957abff7b..bfd896bfdfb 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -2758,11 +2758,15 @@ const uniV2Configs = { }, 'ramses': { _options: { hasStablePools: true, stablePoolSymbol: 'crAMM' }, - arbitrum: { factory: '0xAAA20D08e59F6561f242b08513D36266C5A29415', staking: ["0xAAA343032aA79eE9a6897Dab03bef967c3289a06", ADDRESSES.arbitrum.RAM] }, + arbitrum: { factory: '0xAAA20D08e59F6561f242b08513D36266C5A29415', staking: ['0xAAA343032aA79eE9a6897Dab03bef967c3289a06', ADDRESSES.arbitrum.RAM] }, }, 'ramses-legacy-v2': { _options: { hasStablePools: true, stablePoolSymbol: 'cAMM' }, - hyperliquid: '0xd0a07E160511c40ccD5340e94660E9C9c01b0D27', + methodology: 'Pool TVL is the value of tokens held in liquidity pools. HyperEVM staking is the RAM balance held by xRAM.', + hyperliquid: { + factory: '0xd0a07E160511c40ccD5340e94660E9C9c01b0D27', + staking: ['0xAE6D5FcE541216BDA471D311425B5412D9f1DEb9', '0x555570a286F15EbDFE42B66eDE2f724Aa1AB5555'], + }, arbitrum: '0xADd32480630A16dfAcEe6eeFcB3ab2181449Dc3B', polygon: '0xA87c8308722237F6442Ef4762B7287afB84fB191', robinhood: '0x43B2Bf9f33036a02fC7A00935571c2A6b0108e66', From aeae89187ef352e6572a0dcef2d2ad3ac9584d51 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 10 Oct 2026 12:27:02 +0200 Subject: [PATCH 184/988] fix broken --- projects/alpend/index.js | 6 +- projects/axelar/index.js | 1 + projects/helper/bitcoin-book/fetchers.js | 14 ++-- projects/helper/cache.js | 15 ++++- projects/helper/env.js | 1 + projects/justlock-io/index.js | 64 +++++++++++++++--- projects/karak/index.js | 4 +- projects/rlyfun/index.js | 40 +++++++++-- projects/sonicooo/index.js | 49 ++++++++------ projects/soulswap/index.js | 85 ++---------------------- 10 files changed, 154 insertions(+), 125 deletions(-) diff --git a/projects/alpend/index.js b/projects/alpend/index.js index 48759473882..867a2165044 100644 --- a/projects/alpend/index.js +++ b/projects/alpend/index.js @@ -24,10 +24,8 @@ function validateFeed(feed, caller) { async function getPools(caller) { const feed = await get(TVL_URL, FETCH_OPTS) validateFeed(feed, caller) - for (const pool of feed.pools) - if (!pool.coingeckoId) - throw new Error(`alpend: no coingecko id for ${pool.asset}`) - return feed.pools + // Newly listed assets (e.g. USDXLR) can appear before CCTools maps a coingecko id; skip them. + return feed.pools.filter(pool => pool.coingeckoId) } // Amounts are already decimal-adjusted; do not scale them again. diff --git a/projects/axelar/index.js b/projects/axelar/index.js index 4d4d78bdc01..ddadee885fe 100644 --- a/projects/axelar/index.js +++ b/projects/axelar/index.js @@ -104,6 +104,7 @@ Object.keys(escrows).forEach(chain => { module.exports.evmos = { tvl: () => ({}) } module.exports.kujira = { tvl: () => ({}) } module.exports.migaloo = { tvl: () => ({}) } +module.exports.carbon = { tvl: () => ({}) } module.exports.timetravel = false; diff --git a/projects/helper/bitcoin-book/fetchers.js b/projects/helper/bitcoin-book/fetchers.js index f580f6de7a5..7b06f0f7d0e 100644 --- a/projects/helper/bitcoin-book/fetchers.js +++ b/projects/helper/bitcoin-book/fetchers.js @@ -269,10 +269,16 @@ module.exports = { return Array.from(new Set(staticAddresses)) }, zeusZBTC: async () => { - const API_URL = 'https://indexer.zeuslayer.io/api/v2/chainlink/proof-of-reserves' - const data = await getConfig('zeus/zbtc', API_URL) - const list = data.result.map(item => item.address) - return list + // indexer.zeuslayer.io is gone; reserve addresses from https://zeusnetwork.xyz/developers/bitcoin-on-chain-por-hioggkgl + return [ + 'bc1p698gf9gm8j34gvars97j6spsgrlxlhvyfajt2tsz2vnw9fcat9cqjcjn4v', // Zeus Foundation (Guardian) + 'bc1p96utmwdngv3xwdn90d7wg4tyqke70fs6js8ajgqkk89zn08z8d5q8xzchd', // Mechanism Capital (Guardian) + 'bc1pd46txhc0a3t8juc2r4njyuk4rv3099dcn039ny0hzgt24tgx3qlszg5e6f', // Animoca Ventures (Guardian) + 'bc1p795t8whcfpl6uyxj38enzt43cg8scphrgvn2e79y3xgflv6s6nrsrmudk6', // Anagram (Guardian) + 'bc1pq7pr972ckfwrwrprqw5en54ytr58jndcaafr780hm35ttz4ekmas3fctx4', // Axia8 (Guardian) + 'bc1qlw9h7fspehfvrgyhnr334936y2x6vurw7svxq3', // Institutional #1 + 'bc1purewdvplqykhwp90fenpqjd0sksw7uzvuwxv9guffkf0ma7hurtsys9ey0', // guardian reserves were swept here on 2025-11-18, pays out redemptions + ] }, binanceFetcher: async () => { const staticAddresses = await getConfig('binance-cex/btc', undefined, { diff --git a/projects/helper/cache.js b/projects/helper/cache.js index ea485b69221..912e1a762fc 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -57,6 +57,10 @@ async function _setCache(project, chain, json) { await setCache(project, chain, json) } +function isHtml(data) { + return typeof data === 'string' && /^\s*<(!doctype html|html)/i.test(data) +} + async function getConfig(project, endpoint, { fetcher } = {}) { resetCache() if (!project || (!endpoint && !fetcher)) throw new Error('Missing parameters') @@ -76,6 +80,13 @@ async function getConfig(project, endpoint, { fetcher } = {}) { if (!json) throw new Error('Invalid data') + // an html page (parked domain, cloudflare error, etc.) should never replace a non-html cache + if (isHtml(json)) { + const currentCache = await getCache(key, project) + if (!isHtml(currentCache)) + throw new Error('Fetched html config, keeping the old cache: ' + project) + } + // check if the the response is a proper json, if not we might have an endpoint issue and we should keep the old cache instead of overwriting it with bad data try { if (typeof json === 'string') { @@ -83,10 +94,10 @@ async function getConfig(project, endpoint, { fetcher } = {}) { } } catch (e) { // not json, maybe csv or something else, we just cache it as is - const currentCache = await getCache(project, key) + const currentCache = await getCache(key, project) if (typeof currentCache !== 'string' && Object.keys(currentCache).length > 0) { sdk.log(project, 'fetched non-json config, but we have valid json cache, so we keep the old cache') - throw new Error('Fetched non-json config, but we have valid json cache, so we keep the old cache: ' + projects) + throw new Error('Fetched non-json config, but we have valid json cache, so we keep the old cache: ' + project) } } diff --git a/projects/helper/env.js b/projects/helper/env.js index 88111056133..6a9b1ada1ab 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -40,6 +40,7 @@ const DEFAULTS = { IOTA_RPC: "https://api.mainnet.iota.cafe", MEGAETH_ARCHIVAL_RPC: 'https://megaeth.blockscout.com/api/eth-rpc', SHIDO_RPC: 'https://shidoscan.net/api/eth-rpc', + ACE_RPC: 'https://explorer-endurance.fusionist.io/api/eth-rpc', BITKUB_RPC: 'https://www.kubscan.com/api/eth-rpc', REI_RPC: 'https://scan.rei.network/api/eth-rpc', PEPU_RPC: 'https://pepuscan.com/api/eth-rpc', diff --git a/projects/justlock-io/index.js b/projects/justlock-io/index.js index e25dd5736ac..9c92c551768 100644 --- a/projects/justlock-io/index.js +++ b/projects/justlock-io/index.js @@ -1,13 +1,59 @@ -const { get } = require('../helper/http') +const { post } = require('../helper/http') +const ADDRESSES = require('../helper/coreAssets.json') + +const GATEWAY = 'https://mainnet.radixdlt.com' +// JustLock Locker component (package_rdx1p4k2vlr6rejahqfdazv2qff7dl5d88dxkpechapfx77exgv96wu8mk, https://github.com/just-lock/locker) +const LOCKER = 'component_rdx1cpae8nqhyeu2pz6z89vwca8085xels52lhsfrutnvagxz53u3p4yvl' +const CORE = new Set(Object.values(ADDRESSES.radixdlt)) + +async function getFungibles(address) { + const first = await post(`${GATEWAY}/state/entity/details`, { addresses: [address], aggregation_level: 'Global' }) + const at_ledger_state = { state_version: first.ledger_state.state_version } + const items = [...first.items[0].fungible_resources.items] + let cursor = first.items[0].fungible_resources.next_cursor + while (cursor) { + const page = await post(`${GATEWAY}/state/entity/page/fungibles/`, { address, cursor, aggregation_level: 'Global', at_ledger_state }) + items.push(...page.items) + cursor = page.next_cursor + } + return items +} + +async function getDetails(addresses, opt_ins) { + const items = [] + for (let i = 0; i < addresses.length; i += 20) + items.push(...(await post(`${GATEWAY}/state/entity/details`, { addresses: addresses.slice(i, i + 20), opt_ins })).items) + return Object.fromEntries(items.map(i => [i.address, i])) +} + +const getMeta = (item, key) => item.metadata?.items?.find(m => m.key === key)?.value?.typed?.value + +// counts locked liquidity only: native pool units held by the locker, valued at their share of the pool's core-asset side +// (doubled for the paired token); pools without XRD/WETH are skipped, raw locked tokens and LP NFTs are not counted +async function tvl(api) { + const locked = (await getFungibles(LOCKER)).filter(i => +i.amount > 0) + const resources = await getDetails(locked.map(i => i.resource_address), { explicit_metadata: ['pool'] }) + + const positions = [] + for (const { resource_address, amount } of locked) { + const resource = resources[resource_address] + const pool = getMeta(resource, 'pool') + if (pool) positions.push({ pool, share: +amount / +resource.details.total_supply }) + } + + const pools = await getDetails([...new Set(positions.map(p => p.pool))]) + for (const { pool, share } of positions) { + const vaults = pools[pool].fungible_resources.items + const core = vaults.filter(v => CORE.has(v.resource_address)) + if (!core.length) continue + const multiplier = vaults.length / core.length + core.forEach(v => api.add(v.resource_address, +v.amount * share * multiplier)) + } +} + module.exports = { + timetravel: false, misrepresentedTokens: true, + methodology: 'Liquidity pool units locked in the JustLock locker component, read from the Radix gateway and valued at the XRD/WETH side of each pool, doubled for the paired token.', radixdlt: { tvl }, - timetravel: false, } - -async function tvl(api) { - const { tvl_usd } = await get('https://api.justlock.io/tvl_by_types', { timeout: 30000 }) - api.addUSDValue(tvl_usd["FungibleResource-NativePoolUnit"]) - api.addUSDValue(tvl_usd["NonFungibleResource-PrecisionPool"]) - api.addUSDValue(tvl_usd["NonFungibleResource-QuantaSwap"]) -} \ No newline at end of file diff --git a/projects/karak/index.js b/projects/karak/index.js index 401b75379be..829c3712338 100644 --- a/projects/karak/index.js +++ b/projects/karak/index.js @@ -26,7 +26,7 @@ const karak_v1_tvl = async (api, { factory }) => { } const karak_v2_tvl = async (api, { factory, block }) => { - const logs = await getLogs2({ api, target: factory, fromBlock: block, eventAbi }) + const logs = await getLogs2({ api, target: factory, fromBlock: block, eventAbi, onlyUseExistingCache: api.chain === 'mantle' }) const vaults = logs.map(log => log[1]) const tokens = logs.map(log => log[2]) return sumTokens2({ api, tokensAndOwners2: [tokens, vaults], ...getSumTokens(api) }) @@ -42,3 +42,5 @@ Object.keys(config).forEach(chain => { const factories = config[chain] module.exports[chain] = { tvl: (api) => tvl(api, factories) } }) + +module.exports.karak.tvl = () => ({}) // the chain is killed? \ No newline at end of file diff --git a/projects/rlyfun/index.js b/projects/rlyfun/index.js index 21071e2932e..fb4554c3594 100644 --- a/projects/rlyfun/index.js +++ b/projects/rlyfun/index.js @@ -1,14 +1,44 @@ +const { post } = require('../helper/http') +const ADDRESSES = require('../helper/coreAssets.json') -const { get } = require('../helper/http') +const GATEWAY = 'https://mainnet.radixdlt.com' +// EarlyPump component (pump_home); its `launches` store maps launch id -> (token, EarlyCurves bonding curve component) +const LAUNCHES_KVS = 'internal_keyvaluestore_rdx1krtyftm7ly5fcwj7p9n4ksan9atxcvwhdpg3mnuc42atsdtc5nyu3v' +const XRD = ADDRESSES.radixdlt.XRD + +async function getCurveComponents(at_ledger_state) { + const keys = [] + let cursor + do { + const page = await post(`${GATEWAY}/state/key-value-store/keys`, { key_value_store_address: LAUNCHES_KVS, cursor, at_ledger_state, limit_per_page: 100 }) + keys.push(...page.items.map(i => ({ key_hex: i.key.raw_hex }))) + cursor = page.next_cursor + } while (cursor) + + const components = [] + for (let i = 0; i < keys.length; i += 100) { + const { entries } = await post(`${GATEWAY}/state/key-value-store/data`, { key_value_store_address: LAUNCHES_KVS, keys: keys.slice(i, i + 100), at_ledger_state }) + entries.forEach(e => components.push(e.value.programmatic_json.fields[1].value)) + } + return components +} async function tvl(api) { - const { tvl } = await get('https://api.radlock.io/tvl/rlyfun') - return { - 'radix': tvl + const { ledger_state } = await post(`${GATEWAY}/status/gateway-status`, {}) + const at_ledger_state = { state_version: ledger_state.state_version } + const components = await getCurveComponents(at_ledger_state) + + for (let i = 0; i < components.length; i += 20) { + const { items } = await post(`${GATEWAY}/state/entity/details`, { addresses: components.slice(i, i + 20), aggregation_level: 'Global', at_ledger_state }) + for (const item of items) { + const xrd = item.fungible_resources.items.find(f => f.resource_address === XRD) + if (xrd) api.add(XRD, +xrd.amount) + } } } module.exports = { timetravel: false, - radixdlt: { tvl } + methodology: 'XRD held in every rly.fun bonding curve, read on-chain from the Radix gateway. Curves are listed from the launches registry of the EarlyPump component.', + radixdlt: { tvl }, } diff --git a/projects/sonicooo/index.js b/projects/sonicooo/index.js index adcad29052e..e57c66493e0 100644 --- a/projects/sonicooo/index.js +++ b/projects/sonicooo/index.js @@ -1,25 +1,34 @@ -const { request, gql } = require('graphql-request'); -const { toUSDTBalances } = require('../helper/balances'); +const { queryCanister, decodeCandid, hashCandidLabel } = require('../helper/chain/icp') -const graphUrl_v3 = 'https://v3.api.sonic.ooo' +const SWAP_CANISTER = '3xwpq-ziaaa-aaaah-qcn4a-cai' +const CANDID_LABELS_MAP = Object.fromEntries(['token0', 'token1', 'reserve0', 'reserve1'].map(label => [hashCandidLabel(label), label])) -const graphQuery = gql` -query get_tvl($timestamp: Int!) { - sonicDayData(dateTo: $timestamp, dateFrom: 0) { - totalLiquidityUSD - } -}` +// ICP ledgers have no price feed keyed by canister id, so only tokens with a coingecko listing are counted +const tokens = { + 'ryjl3-tyaaa-aaaaa-aaaba-cai': { decimals: 8, coingeckoId: 'internet-computer' }, // ICP + 'utozz-siaaa-aaaam-qaaxq-cai': { decimals: 8, coingeckoId: 'internet-computer' }, // WICP + 'mxzaz-hqaaa-aaaar-qaada-cai': { decimals: 8, coingeckoId: 'bitcoin' }, // ckBTC + 'ss2fx-dyaaa-aaaar-qacoq-cai': { decimals: 18, coingeckoId: 'ethereum' }, // ckETH + 'xevnm-gaaaa-aaaar-qafnq-cai': { decimals: 6, coingeckoId: 'usd-coin' }, // ckUSDC + '2ouva-viaaa-aaaaq-aaamq-cai': { decimals: 8, coingeckoId: 'openchat' }, // CHAT + '7pail-xaaaa-aaaas-aabmq-cai': { decimals: 8, coingeckoId: 'bob-3' }, // BOB + 'ca6gz-lqaaa-aaaaq-aacwa-cai': { decimals: 8, coingeckoId: 'icpswap-token' }, // ICS + 'lkwrt-vyaaa-aaaaq-aadhq-cai': { decimals: 8, coingeckoId: 'origyn-foundation' }, // OGY + 'jwcfb-hyaaa-aaaaj-aac4q-cai': { decimals: 8, coingeckoId: 'origyn-foundation' }, // OGY (legacy ledger) +} -const tvl = async ({ timestamp }) => { - const { sonicDayData: data_v3 } = await request(graphUrl_v3, graphQuery, { timestamp }); - const now = Math.floor(Date.now() / 1000); - const dayOffset = Math.floor((now - timestamp) / 86400); - const targetDay = data_v3[data_v3.length - 1 - dayOffset]; - const supply_v3 = Number(targetDay?.totalLiquidityUSD) || 0; - return toUSDTBalances(supply_v3); -}; +async function tvl(api) { + const [pairs] = decodeCandid(await queryCanister({ canisterId: SWAP_CANISTER, methodName: 'getAllPairs' }), CANDID_LABELS_MAP) + for (const { token0, token1, reserve0, reserve1 } of pairs) { + for (const [token, reserve] of [[token0, reserve0], [token1, reserve1]]) { + const config = tokens[token] + if (config) api.addCGToken(config.coingeckoId, Number(reserve) / 10 ** config.decimals) + } + } +} module.exports = { - misrepresentedTokens: true, - icp: { tvl } -} \ No newline at end of file + timetravel: false, + methodology: 'TVL is the sum of reserves of all pairs in the Sonic swap canister, read on-chain via getAllPairs.', + icp: { tvl }, +} diff --git a/projects/soulswap/index.js b/projects/soulswap/index.js index 857e8a21b0c..c9cc15cdf6d 100644 --- a/projects/soulswap/index.js +++ b/projects/soulswap/index.js @@ -1,79 +1,4 @@ const { staking } = require('../helper/staking.js'); -const sdk = require("@defillama/sdk"); -const { request, gql } = require("graphql-request"); -const { BigNumber } = require('bignumber.js'); - -// https://thegraph.com/hosted-service/subgraph/soulswapfantom/coffinbox -const graphUrls = { - 'fantom': sdk.graph.modifyEndpoint('FhS8cRWsTPZwXfmn7b8YGvKii2h2ghr2v7ah5T8oiDmo'), - 'avax': sdk.graph.modifyEndpoint('6WonmxWbw3MSVXVR5P4VhC8jWBEG5RkipWzxhAA67hoP'), -} - -const coffinboxQuery = gql` -query get_coffinboxes($block: Int, $tokensSkip: Int) { - coffinBoxes( - first: 100, - # block: { number: $block } - ) { - id - tokens ( - skip: $tokensSkip - first: 1000 - orderBy: totalSupplyBase - orderDirection: desc - ) { - id - symbol - name - decimals - totalSupplyBase # totalSupplyElastic - } - totalTokens - } - } -` - -function underworldLending(chain, borrowed) { - return async (api) => { - // Retrieve coffin boxes tokens held in contract - const boxTokens = [] - const block = api.block - const transform = x => `${chain}:${x}` - - // Query graphql endpoint and add tokenAndOwner to list - const { coffinBoxes } = await request( - graphUrls[chain], - coffinboxQuery, - { block, tokensSkip: 0 } - ) - coffinBoxes.forEach(async box => { - boxTokens.push(...box.tokens.map(t => [t.id, box.id])) - if (box.totalTokens > box.tokens.length) { - throw (`More tokens (${box.totalTokens}) in coffin box than returned by graphql api, probably over the 1000 tokens limit`) - } - }) - - // Sum all tokens - const balances = {} - - // What is retrieved before this line and stored as balances is what's left in the coffinbox, so real TVL. - // Now compute borrowed = supply minus tvl where supply is retrieved from thegraph - if (borrowed) { - const borrowed_balances = {} - coffinBoxes.forEach(box => { - box.tokens.forEach(async token => - sdk.util.sumSingleBalance(borrowed_balances, transform(token.id), token.totalSupplyBase) - ) - }) - for (const [key, value] of Object.entries(balances)) { - borrowed_balances[key] = BigNumber.max(0, BigNumber(borrowed_balances[key]).minus(balances[key])); - } - return borrowed_balances - } else { - return balances - } - } -} const { getUniTVL } = require('../helper/unknownTokens') const abis = { @@ -91,15 +16,15 @@ const soul_avax = '0x11d6DD25c1695764e64F439E32cc7746f3945543' module.exports = { misrepresentedTokens: true, - fantom:{ + fantom: { staking: staking(farm_fantom, soul_fantom), tvl: getUniTVL({ factory: factory_fantom, useDefaultCoreAssets: true, abis, }), - borrowed: underworldLending('fantom', true) + borrowed: () => ({}), // underworld subgraph is gone, and it reported supply rather than borrows }, - avax:{ + avax: { staking: staking(farm_avax, soul_avax), tvl: getUniTVL({ factory: factory_avax, useDefaultCoreAssets: true, abis, }), - borrowed: underworldLending('avax', true) + borrowed: () => ({}), }, - methodology: "Counts liquidity on the exchange, staked soul, and underworld assets.", + methodology: "Counts liquidity on the exchange and staked soul.", } From 6656782872a773a13a7f250c835a2737d339c325 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Sat, 10 Oct 2026 07:03:11 -0400 Subject: [PATCH 185/988] Add Wager predict (#21545) Co-authored-by: floc Co-authored-by: nisuscold --- registries/sumTokens/data3.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index a9a51efcae5..e1ed5a135f1 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1152,5 +1152,12 @@ module.exports = { ADDRESSES.null ] }, - } + }, + "wager-predict": { + "methodology": "USDW held by the Wager Predict market contracts on BSC: trader collateral in SpotEngine, LP deposits in the Vault and resolution bonds in the ResolutionModule.", + "start": "2026-10-05", + "bsc": { + "tvl": { "owners": ["0x76b91e83f2A12dc52E33f856eeA300E5B3A62c0c", "0x88d163d40D6BFe0Ad2b17f4a90A03053fEbf3014", "0xdfc40D309C0D8f4Cc42863991C8e606eD330e1E8"], "tokens": ["0xe5eBE2AE0a036C955bfF58291826C50F7d670D43"] }, + } + }, } From d040bce61149123ddc4c80370ff456c74cf5bedf Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Sat, 10 Oct 2026 09:18:26 -0400 Subject: [PATCH 186/988] fix peddles (#21549) --- projects/peddles/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/peddles/index.js b/projects/peddles/index.js index e368420ce0c..182ee594b1d 100644 --- a/projects/peddles/index.js +++ b/projects/peddles/index.js @@ -1,15 +1,17 @@ -const { uniV4HookOnChainExport } = require('../helper/uniswapV4') +const { uniV4HookOnChainExport, uniV4HookExport } = require('../helper/uniswapV4') // Peddles (https://peddles.xyz): every launch is one Uniswap v4 pool carrying PeddlesFeeHook, with the // launch liquidity locked in it. Pools are found from the PoolManager Initialize logs filtered to the hook // and valued on chain from tick liquidity via StateView. // Each chain has its own hook (CREATE2 against per-chain constructor arguments), so nothing is shared. const hooks = { - base: '0xAB8E39207718f519865D6f0d52eFB31b231D40cc', robinhood: '0xfe055282E3cD471A8b2cd922d31E75ECd3bBc0CC', bsc: '0x39D760601731025e0F02A3e5D232445797fAC0CC', arc: '0x317e34De0298F23bd41bf9A853289e227E9cC0CC', } +const subgraphHooks = { + base: '0xAB8E39207718f519865D6f0d52eFB31b231D40cc', +} module.exports = { doublecounted: true, // the pools live in the Uniswap v4 PoolManager, so Uniswap v4 TVL counts them too @@ -20,3 +22,7 @@ module.exports = { Object.keys(hooks).forEach((chain) => { module.exports[chain] = { tvl: uniV4HookOnChainExport({ hook: hooks[chain] }) } }) + +Object.keys(subgraphHooks).forEach((chain) => { + module.exports[chain] = { tvl: uniV4HookExport({ hook: subgraphHooks[chain] }) } +}) From 3b0779f2e0cd5db6158565e57405dbc2392fc0a1 Mon Sep 17 00:00:00 2001 From: Raphael Zerbib <44400280+Sithey@users.noreply.github.com> Date: Sat, 10 Oct 2026 16:54:18 +0300 Subject: [PATCH 187/988] add monad mrox token to rockawayx vault (#21533) --- projects/rockawayx/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/rockawayx/index.js b/projects/rockawayx/index.js index 560cdc7ac27..1b1519fb0c1 100644 --- a/projects/rockawayx/index.js +++ b/projects/rockawayx/index.js @@ -112,6 +112,9 @@ const configs = { monad: { morpho: [ '0xA2fa4CeD4E2d448D084f5a15011b3564922119d6' + ], + midasTokens: [ + '0x6CF55183eA297ba200Cf88419Bba156EBA2Ed206' ] } } From b934d0d2eee605cd2a5f665a334f34105fd629b7 Mon Sep 17 00:00:00 2001 From: CryptoAstuce Date: Sun, 11 Oct 2026 13:25:52 +0200 Subject: [PATCH 188/988] mosh: throw when a vault or range count read fails (#21553) Co-authored-by: Claude --- projects/mosh/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/mosh/index.js b/projects/mosh/index.js index 8d66e46a446..beb1e4ecdce 100644 --- a/projects/mosh/index.js +++ b/projects/mosh/index.js @@ -54,11 +54,12 @@ async function swarmBalances(api, ownToken) { if (!swarms.length) return api.getBalances() const memecoins = await api.multiCall({ abi: 'address:memecoin', calls: swarms, permitFailure: true }) - const vaultCounts = await api.multiCall({ abi: 'uint256:vaultCount', calls: swarms, permitFailure: true }) + // counts say how many vaults exist: a failed read must fail the run, not read as zero vaults + const vaultCounts = await api.multiCall({ abi: 'uint256:vaultCount', calls: swarms }) // the launched token is only needed to build a range's pool key const hasPair = (i) => Boolean(memecoins[i]) && memecoins[i] !== nullAddress - const vaultCalls = swarms.flatMap((s, i) => Array.from({ length: Number(vaultCounts[i] ?? 0) }, (_, j) => ({ target: s, params: [j], swarm: i }))) + const vaultCalls = swarms.flatMap((s, i) => Array.from({ length: Number(vaultCounts[i]) }, (_, j) => ({ target: s, params: [j], swarm: i }))) const vaults = await api.multiCall({ abi: 'function vaults(uint256) view returns (address)', calls: vaultCalls.map(({ target, params }) => ({ target, params })) }) const swarmOfVault = vaults.map((_, k) => vaultCalls[k].swarm) @@ -88,8 +89,9 @@ async function swarmBalances(api, ownToken) { // ticks at its pool's current price. Venue 0 is the Pons pool; venue i > 0 is extraVenues(i - 1), // a hookless pool on the same pair. Both sides are counted, as for any liquidity manager's // positions. - const rangeCounts = await api.multiCall({ abi: 'uint256:openRangeCount', calls: vaults, permitFailure: true }) - const rangeCalls = vaults.flatMap((v, k) => Array.from({ length: Number(rangeCounts[k] ?? 0) }, (_, j) => ({ target: v, params: [j], vault: k }))) + // same for open ranges: a failed count must not drop the vault's liquidity silently + const rangeCounts = await api.multiCall({ abi: 'uint256:openRangeCount', calls: vaults }) + const rangeCalls = vaults.flatMap((v, k) => Array.from({ length: Number(rangeCounts[k]) }, (_, j) => ({ target: v, params: [j], vault: k }))) // a range or venue that does not read is skipped, not allowed to fail the whole run const ranges = rangeCalls.length ? await api.multiCall({ abi: RANGE_ABI, calls: rangeCalls.map(({ target, params }) => ({ target, params })), permitFailure: true }) : [] const extraKeys = [...new Set(rangeCalls.map((r, j) => ranges[j] && Number(ranges[j].venue) > 0 ? `${r.vault}:${Number(ranges[j].venue)}` : null).filter(Boolean))] From 98788bb1b293a102edca90ff721f00855bbb4cee Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Sun, 11 Oct 2026 07:55:57 -0400 Subject: [PATCH 189/988] include mosh idle reserves (#21562) --- projects/mosh/index.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/projects/mosh/index.js b/projects/mosh/index.js index beb1e4ecdce..3199f5a11fd 100644 --- a/projects/mosh/index.js +++ b/projects/mosh/index.js @@ -27,6 +27,9 @@ const STATE_VIEW = '0xf3334192d15450cdd385c8b70e03f9a6bd9e673b' const RANGE_ABI = 'function ranges(uint256) view returns (uint8 venue, int24 tickLower, int24 tickUpper, uint128 liquidity, bytes32 salt)' const EXTRA_VENUE_ABI = 'function extraVenues(uint256) view returns (uint24 fee, int24 tickSpacing)' const GET_SLOT0_ABI = 'function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)' +// Uniswap's V4Quoter on Robinhood Chain (developers.uniswap.org/docs/protocols/v4/deployments) +const QUOTER = '0x8dc178efb8111bb0973dd9d722ebeff267c98f94' +const QUOTE_ABI = 'function quoteExactInputSingle(((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) poolKey, bool zeroForOne, uint128 exactAmount, bytes hookData) params) view returns (uint256 amountOut, uint256 gasEstimate)' // keccak256(abi.encode(PoolKey)): Uniswap v4's pool id function poolIdOf({ currency0, currency1, fee, tickSpacing, hooks }) { @@ -128,13 +131,39 @@ async function swarmBalances(api, ownToken) { if (counts(memecoins[i])) api.add(memecoins[i], BigInt(Math.floor(counterIs0 ? amount1 : amount0))) }) + // idle inventory: the launched token the vaults hold outside their ranges. Each swarm's idle balance + // is counted only at what selling all of it in one swap into its Pons pool would return (V4Quoter) + const idleSwarms = swarms.map((_, i) => i).filter(i => hasPair(i) && counts(memecoins[i])) + const idleVaults = vaults.map((v, k) => ({ v, k })).filter(({ k }) => idleSwarms.includes(swarmOfVault[k])) + if (idleVaults.length) { + const idleBalances = await api.multiCall({ abi: 'erc20:balanceOf', calls: idleVaults.map(({ v, k }) => ({ target: memecoins[swarmOfVault[k]], params: [v] })) }) + const idleOf = new Map() + const keyOf = new Map() + idleVaults.forEach(({ k }, j) => { + const i = swarmOfVault[k] + idleOf.set(i, (idleOf.get(i) ?? 0n) + BigInt(idleBalances[j])) + if (!keyOf.has(i) && ponsKeyOf(k)) keyOf.set(i, ponsKeyOf(k)) + }) + // a swarm whose token has not graduated has no Pons pool to sell into + const sells = [...idleOf].filter(([i, idle]) => idle > 0n && keyOf.has(i)).map(([i, idle]) => ({ i, idle, key: keyOf.get(i) })) + for (const { i, idle, key } of sells) { + const memeIs0 = key.currency0 !== counterOf[i] + const poolKey = [key.currency0, key.currency1, key.fee, key.tickSpacing, key.hooks] + const { amountOut } = await api.call({ abi: QUOTE_ABI, target: QUOTER, params: [[poolKey, memeIs0, idle.toString(), '0x']] }) + const { sqrtPriceX96 } = await api.call({ abi: GET_SLOT0_ABI, target: STATE_VIEW, params: poolIdOf(key) }) + const s2 = BigInt(sqrtPriceX96) ** 2n, q192 = 1n << 192n + const spotEquivalent = memeIs0 ? BigInt(amountOut) * q192 / s2 : BigInt(amountOut) * s2 / q192 + api.add(memecoins[i], spotEquivalent < idle ? spotEquivalent : idle) + } + } + return api.getBalances() } module.exports = { doublecounted: true, methodology: - "TVL is the pair asset (native ETH or the bundle's ERC20 pair asset) held by Mosh bundles on Robinhood Chain, by each bundle's swarm contract (open raises and backers' unclaimed fees) and by its agent vaults, plus both sides of the vaults' open Uniswap v4 ranges. Launched tokens the vaults hold outside their ranges are not counted. BUN is reported under staking wherever it appears. Range liquidity is also Uniswap v4 TVL, so the listing is double counted.", + "TVL is the pair asset (native ETH or the bundle's ERC20 pair asset) held by Mosh bundles on Robinhood Chain, by each bundle's swarm contract (open raises and backers' unclaimed fees) and by its agent vaults, plus both sides of the vaults' open Uniswap v4 ranges. Launched tokens the vaults hold idle, outside their ranges, are counted only when DefiLlama prices them and at no more than what selling all of them in one swap into their Pons pool would return, read from the Uniswap v4 quoter. BUN is reported under staking wherever it appears. Range liquidity is also Uniswap v4 TVL, so the listing is double counted.", robinhood: { tvl: (api) => swarmBalances(api, false), staking: (api) => swarmBalances(api, true), From 77cf21668cad24bf15079ba4dcf118c0ef462e1d Mon Sep 17 00:00:00 2001 From: bheluga Date: Sun, 11 Oct 2026 20:14:51 +0530 Subject: [PATCH 190/988] kpk ir: add new vaults (#21564) --- utils/scripts/kpkTreasuryIR.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/utils/scripts/kpkTreasuryIR.js b/utils/scripts/kpkTreasuryIR.js index 2b3a000596d..dddb8710301 100644 --- a/utils/scripts/kpkTreasuryIR.js +++ b/utils/scripts/kpkTreasuryIR.js @@ -340,10 +340,15 @@ const CURATED_VAULTS = { "0x9178eBE0691593184c1D785a864B62a326cc3509": "Morpho", // v1 USDC Yield "0xdaD4e51d64c3B65A9d27aD9F3185B09449712065": "Morpho", // v1 USDT Prime "0x870F0BF29A25A40E7CC087cD5C53e70C11F2C8A8": "Morpho", // v2 USDT Prime + "0xb5ce3CA2C774b72955C25875022FdD91f7a7B938": "Morpho", // v2 wARS Yield + "0x6251482812cE95d11b3E447FE6888b1a1bE66C25": "Morpho", // v2 EURe Yield + "0x7a72bcD2c3F7F7e4D6679170a0625bAB15D7DDa1": "Morpho", // v2 USDC Yield RWA "0x2B47c128b35DDDcB66Ce2FA5B33c95314a7de245": "Euler", // kpk USDC Prime RWA (Euler Earn) "0xB6D6D89ad4b4D61C15a293e28b74f77F6817fF48": "Euler", // kpk ETH Yield Term (Euler Earn) + "0x8BcD746976885b5832bAD07B4921E3f2dD1D3703": "Symbiotic", // kpk USDC RWA Liquidity (Symbiotic v2 Liquid Lane) "0x9396dcbf78fc526bb003665337c5e73b699571ef": "Gearbox", // Gearbox ETH "0xA9d17f6D3285208280a1Fd9B94479c62e0AABa64": "Gearbox", // Gearbox wstETH + "0xBd8Ec7444dB271635584Cc38F5d06C72eAB762f5": "Gearbox", // Gearbox frxUSD "0x9477df934574d47f240e18cd232e013118666690": "Aleph", // kpk Aleph rETH "0xf857caa91ea4007ec26aee2d039e870eb0fa91bf": "Aleph", // kpk Aleph stETH "0x6cbcc646d7422b734c6fc0954a1c3ca87b1b4ceb": "Aleph", // kpk Aleph osETH @@ -352,6 +357,14 @@ const CURATED_VAULTS = { "0x2C609d9CfC9dda2dB5C128B2a665D921ec53579d": "Morpho", // USDC Yield "0x5837e4189819637853a357aF36650902347F5e73": "Morpho", // USDC Yield v2 }, + base: { + "0x392B3CCf36C8adB8094F45573346B457414cD752": "Morpho", // v2 USDC Yield + }, + // arc is not a ZODIAC_CHAIN, so the on-chain sweep never reads this entry; it is + // here so the DeBank view's CURATED tag covers the vault if a mandate ever holds it + arc: { + "0xF0943081f646f21cF5BFBa8e0F670C4248ab0ba5": "Morpho", // v2 wARS Yield + }, } // Zodiac-managed institutional safes — each gated to its kpk mandate window (see TIME_GATED_ENTITIES) From f3fdebb1aa5538bfeb2a522c032cc4490ee033f2 Mon Sep 17 00:00:00 2001 From: Jordy Date: Sun, 11 Oct 2026 20:35:09 +0200 Subject: [PATCH 191/988] Add Nysa Solana TVL adapter (#21526) Co-authored-by: FelixBruguera --- projects/nysa/index.js | 63 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 projects/nysa/index.js diff --git a/projects/nysa/index.js b/projects/nysa/index.js new file mode 100644 index 00000000000..e09d1cb17d1 --- /dev/null +++ b/projects/nysa/index.js @@ -0,0 +1,63 @@ +const { BorshAccountsCoder } = require('@project-serum/anchor') +const { getMultipleAccounts, sumTokens2 } = require('../helper/solana') +const ADDRESSES = require('../helper/coreAssets.json') +const kaminoIdl = require('../kamino-lending/kamino-lending-idl.json') + +const PROGRAM = 'KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD' +const MARKET = 'F4uLsGZT4YnHDcemtoYDz2LBZKLmwTB1wzkwS6oqygvy' +// Live market configuration: https://github.com/Nysa-Finance/nysa-frontend/blob/main/src/config.js +const RESERVES = [ + ['rpTGWR3JDjjPfXLCg5Fx1GpSdUxPt1pxW7fwXGUT6js', 'A1KLoBrKBde8Ty9qtNQUtq3C2ortoC3u7twggz7sEto6'], // USDY + ['GQr5hXuRgHAmguh6EqcpeJXrMyqCQch4P6XkSvawwNk2', ADDRESSES.solana.USDC], +] +const coder = new BorshAccountsCoder(kaminoIdl) + +/** + * Load Nysa's reserves and reject missing or mismatched on-chain accounts. + * @param {object} api DefiLlama chain API used for Solana account reads. + * @returns {Promise} Decoded reserves with verified program, market, and mint. + */ +async function getReserves(api) { + const accounts = await getMultipleAccounts(RESERVES.map(([address]) => address), { api }) + return RESERVES.map(([address, mint], i) => { + const account = accounts[i] + if (!account) throw new Error(`Nysa: missing reserve ${address}`) + if (account.owner.toString() !== PROGRAM) throw new Error(`Nysa: unexpected program owner for reserve ${address}`) + + const reserve = coder.decode('Reserve', account.data) + if (reserve.lendingMarket.toString() !== MARKET) throw new Error(`Nysa: unexpected lending market for reserve ${address}`) + if (reserve.liquidity.mintPubkey.toString() !== mint) throw new Error(`Nysa: unexpected mint for reserve ${address}`) + return reserve + }) +} + +/** + * Sum underlying tokens held in the reserves' liquidity supply vaults. + * @param {object} api DefiLlama chain API receiving raw token balances. + * @returns {Promise} Vault balances, excluding borrowed-out tokens. + */ +async function tvl(api) { + const reserves = await getReserves(api) + return sumTokens2({ api, tokenAccounts: reserves.map(reserve => reserve.liquidity.supplyVault.toString()) }) +} + +/** + * Add outstanding debt in raw token units, truncating sub-atomic Q60 dust. + * @param {object} api DefiLlama chain API receiving borrowed token balances. + * @returns {Promise} Resolves after adding debt for each validated reserve. + */ +async function borrowed(api) { + const reserves = await getReserves(api) + for (const reserve of reserves) { + // Q60 debt -> raw token units. Use integer arithmetic and discard sub-atomic dust. + const amount = BigInt(reserve.liquidity.borrowedAmountSf.toString()) / (1n << 60n) + api.add(reserve.liquidity.mintPubkey.toString(), amount.toString()) + } +} + +module.exports = { + doublecounted: true, // DefiLlama confirmed these deposits overlap Kamino Lend TVL. + timetravel: false, + methodology: 'Counts USDY collateral and unborrowed USDC held in the liquidity supply vaults of Nysa\'s curated Kamino market on Solana. Outstanding reserve debt is reported separately as borrowed. Collateral receipt tokens, undistributed incentives, and Farm Points are not added to TVL. These deposits overlap Kamino Lend TVL, so the adapter is marked doublecounted.', + solana: { tvl, borrowed }, +} From 4634ed6f7d629a7b5827708c1032cb047a0523b9 Mon Sep 17 00:00:00 2001 From: piratemonkee <200669807+piratemonkee@users.noreply.github.com> Date: Mon, 12 Oct 2026 06:47:08 -0400 Subject: [PATCH 192/988] gondi-v3: add MultiSourceLoan v3.2 escrow, fix methodology (#21568) Co-authored-by: Claude Opus 5.5 --- registries/sumTokens.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index db7b55ef0d5..0cee857b60a 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -15510,7 +15510,7 @@ const configs = { }, }, "gondi": { - "methodology": "Counts the floor value of all deposited NFTs with Chainlink price feeds.", + "methodology": "Counts the floor value of the NFTs held as loan collateral by GONDI's escrow (MultiSourceLoan) and user vault contracts, priced with DefiLlama's NFT collection prices. Collections without a DefiLlama price are not counted.", "ethereum": { "owners": [ "0xCa5a494Ca20483e21ec1E41FE1D9461Da77595Bd" @@ -15519,7 +15519,7 @@ const configs = { }, }, "gondi-v2": { - "methodology": "Counts the floor value of all deposited NFTs with Chainlink price feeds.", + "methodology": "Counts the floor value of the NFTs held as loan collateral by GONDI's escrow (MultiSourceLoan) and user vault contracts, priced with DefiLlama's NFT collection prices. Collections without a DefiLlama price are not counted.", "ethereum": { "owners": [ "0x478f6F994C6fb3cf3e444a489b3AD9edB8cCaE16", @@ -15529,12 +15529,13 @@ const configs = { }, }, "gondi-v3": { - "methodology": "Counts the floor value of all deposited NFTs with Chainlink price feeds.", + "methodology": "Counts the floor value of the NFTs held as loan collateral by GONDI's escrow (MultiSourceLoan) and user vault contracts, priced with DefiLlama's NFT collection prices. Collections without a DefiLlama price are not counted.", "ethereum": { "owners": [ "0xf65b99ce6dc5f6c556172bcc0ff27d3665a7d9a8", "0x823de2c44369e94cac3da789ad4b6493e27e4bfe", - "0xf41b389e0c1950dc0b16c9498eae77131cc08a56" + "0xf41b389e0c1950dc0b16c9498eae77131cc08a56", + "0xe365ff3cad44d19cb7aba81df8ffd6818a66ac0a" ], "resolveNFTs": true }, From 2a82ad378de0377f48299f35f90b423e4275eae2 Mon Sep 17 00:00:00 2001 From: Jean Brasse <51783223+JeanBrasse@users.noreply.github.com> Date: Mon, 12 Oct 2026 15:24:54 +0400 Subject: [PATCH 193/988] mimo-protocol (Parallel) treasury: correct DAO multisig addresses (#21566) Co-authored-by: Claude Opus 5.5 --- registries/treasury.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/registries/treasury.js b/registries/treasury.js index b45f3843c08..4af314bb379 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -3890,7 +3890,7 @@ const configs = { "0x0d45b129dc868963025Db79A9074EA9c9e32Cae4",//sUSDp v1 "0xd3a452B305C8285c0Dd7b8537665c734d3D279eF"//sUSDp v2 ], - owners: ["0x25Fc7ffa8f9da3582a36633d04804F0004706F9b", "0x3De64eed7A43C40E33dc837dec1119DcA0a677b4"], + owners: ["0x25Fc7ffa8f9da3582a36633d04804F0004706F9b"], ownTokens: ["0x6c0aeceeDc55c9d55d8B99216a670D85330941c3", "0x90b831fa3bebf58e9744a14d638e25b4ee06f9bc"] }, fantom: { @@ -3898,7 +3898,7 @@ const configs = { nullAddress, "0x04068da6c83afcfa0e13ba15a6696662335d5b75" ], - owners: ["0x174162ddecE9d0b7B68fd945e38c3372C4C818ba", "0xA67FC89D5312812D3413A83418fc75ff78148a7E"], + owners: ["0x174162ddecE9d0b7B68fd945e38c3372C4C818ba"], ownTokens: ["0x1d1764f04de29da6b90ffbef372d1a45596c4855",], }, hyperliquid: { @@ -3907,7 +3907,7 @@ const configs = { "0xBE65F0F410A72BeC163dC65d46c83699e957D588", "0x9B3a8f7CEC208e247d97dEE13313690977e24459" ], - owners: ["0x5C1232b4F5fdb34d487C934ADF5d4e5c01fE34be"], + owners: ["0xC5201FFE258a95Af986E7cD1fcaD54f3f63f2C95"], ownTokens: [] }, ink: { @@ -3918,6 +3918,14 @@ const configs = { owners: ["0xC5201FFE258a95Af986E7cD1fcaD54f3f63f2C95"], ownTokens: [] }, + linea: { + tokens: [ + nullAddress, + "0x8fCf9118fdD359f6277cDd143c2Da206e64140F3" + ], + owners: ["0xC5201FFE258a95Af986E7cD1fcaD54f3f63f2C95"], + ownTokens: [] + }, optimism: { tokens: [ nullAddress, @@ -3932,7 +3940,7 @@ const configs = { ADDRESSES.polygon.USDC, "0x1250304F66404cd153fA39388DDCDAec7E0f1707" ], - owners: ["0x2046c0416A558C40cb112E5ebB0Ca764c3C5c32a", "0x6fb6a0a35b33e230d0149d49858e1a313a2ad4a7"], + owners: ["0x2046c0416A558C40cb112E5ebB0Ca764c3C5c32a"], ownTokens: ["0x7790dd69aa10eD3f1271E41CD7222D2a7d2D5948", "0xadac33f543267c4d59a8c299cf804c303bc3e4ac"] }, scroll: { From a948777e53cab9a67bb5f4f5b1deca3a2013eb52 Mon Sep 17 00:00:00 2001 From: pazhik <133212006+MonteNegroX@users.noreply.github.com> Date: Mon, 12 Oct 2026 15:25:53 +0400 Subject: [PATCH 194/988] Add Capsule TVL adapter on Robinhood Chain (#21565) Co-authored-by: ccipherx --- registries/sumTokens.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 0cee857b60a..0adfe5e43ac 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -3563,6 +3563,16 @@ const configs = { ] }, }, + "capsulepull": { + "methodology": "TVL is the USDG balance of the CapsuleLend contract on Robinhood Chain. That balance is principal still held by a funded loan. It drops when the owner withdraws the principal, the loan is repaid, or the loan defaults and the stablecoin leaves the contract. The Solana card vault and the Robinhood treasury wallet are not counted.", + "start": 1791718674, + "robinhood": { + "owner": "0xa7F89DE1FE71Aa4D37A9179231787b2aC1a4DcFc", // CapsuleLend + "tokens": [ + ADDRESSES.robinhood.USDG + ] + }, + }, "carbon": { "misrepresentedTokens": true, "methodology": "Counts as TVL the ETH asset deposited through StakingETH Contract, and we count Staking and Pool2 parts in the same way", From a447db3c60121057af0f25c98902eea399fe6adf Mon Sep 17 00:00:00 2001 From: vaultexfun Date: Mon, 12 Oct 2026 13:27:27 +0200 Subject: [PATCH 195/988] Add Vaultex TVL (#21561) Co-authored-by: ccipherx --- projects/vaultex/index.js | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 projects/vaultex/index.js diff --git a/projects/vaultex/index.js b/projects/vaultex/index.js new file mode 100644 index 00000000000..6bd1a052411 --- /dev/null +++ b/projects/vaultex/index.js @@ -0,0 +1,61 @@ +const { getConnection } = require('../helper/solana') +const { PublicKey } = require('@solana/web3.js') +const { sleep } = require('../helper/utils') + +// Vaultex (https://vaultex.fun): Solana meme coin launchpad built on Meteora's +// Dynamic Bonding Curve. Coins can be paired with several quote assets (SOL, +// USDC, PUMP and others), one DBC config per quote asset. Every Vaultex config +// carries the same partner fee claimer, which is fixed at config creation, so +// configs are found by it. Pools created against those configs are Vaultex coins. +const DBC_PROGRAM = new PublicKey('dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN') +const VAULTEX_FEE_CLAIMER = '4wwpefxyZ2nqeePNa2fctMuu5273wrzkUuoy5wC2QeP2' + +// Anchor discriminators, sha256("account:")[0..8], base58 +const POOL_CONFIG_DISC = '5RKzUGPpkkA' // PoolConfig +const VIRTUAL_POOL_DISC = 'cmrfVvtHrjd' // VirtualPool + +// PoolConfig: 8 disc | 32 quote_mint | 32 fee_claimer | ... +const CONFIG_QUOTE_MINT_OFFSET = 8 +const CONFIG_FEE_CLAIMER_OFFSET = 40 +// VirtualPool: config pubkey @72, quote_reserve u64 @240, is_migrated u8 @305 +const POOL_CONFIG_OFFSET = 72 +const QUOTE_RESERVE_OFFSET = 240 +const IS_MIGRATED_OFFSET = 305 + +async function tvl(api) { + const connection = getConnection() + + const configs = await connection.getProgramAccounts(DBC_PROGRAM, { + filters: [ + { memcmp: { offset: 0, bytes: POOL_CONFIG_DISC } }, + { memcmp: { offset: CONFIG_FEE_CLAIMER_OFFSET, bytes: VAULTEX_FEE_CLAIMER } }, + ], + dataSlice: { offset: CONFIG_QUOTE_MINT_OFFSET, length: 32 }, + }) + + for (const { pubkey, account } of configs) { + const quoteMint = new PublicKey(account.data).toBase58() + // one getProgramAccounts per config; spaced so public RPCs don't rate-limit (429) + await sleep(1200) + const pools = await connection.getProgramAccounts(DBC_PROGRAM, { + filters: [ + { memcmp: { offset: 0, bytes: VIRTUAL_POOL_DISC } }, + { memcmp: { offset: POOL_CONFIG_OFFSET, bytes: pubkey.toBase58() } }, + ], + dataSlice: { offset: QUOTE_RESERVE_OFFSET, length: IS_MIGRATED_OFFSET - QUOTE_RESERVE_OFFSET + 1 }, + }) + for (const { account: { data } } of pools) { + // migration moves the reserve to DAMM v2 but leaves quote_reserve unchanged + if (data.readUInt8(IS_MIGRATED_OFFSET - QUOTE_RESERVE_OFFSET) !== 0) continue + // quote_reserve excludes the unclaimed protocol, partner and creator fees that sit in the same quote vault + api.add(quoteMint, data.readBigUInt64LE(0).toString()) + } + } +} + +module.exports = { + timetravel: false, + methodology: + 'TVL is the quote asset (SOL, USDC, PUMP and others) held as reserves in Vaultex bonding curves on Meteora Dynamic Bonding Curve. Vaultex pools are the pools created against DBC configs whose partner fee claimer is the Vaultex treasury. Launched tokens and unclaimed trading fees are not counted. Graduated curves are excluded: their liquidity moves to Meteora DAMM v2 and is counted there.', + solana: { tvl }, +} From 5af17662c87b02a1e588585b9883d7f8d4de4dd1 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Mon, 12 Oct 2026 14:06:53 +0200 Subject: [PATCH 196/988] Add 30s timeouts to TVL-critical API calls (#21529) --- projects/bitstamp/index.js | 2 +- projects/cbETH/index.js | 2 +- projects/compound-v3/index.js | 2 +- projects/lista-lending/index.js | 2 +- projects/uniswap-v2/index.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/bitstamp/index.js b/projects/bitstamp/index.js index 8866c35b303..2b1099d37ab 100644 --- a/projects/bitstamp/index.js +++ b/projects/bitstamp/index.js @@ -58,7 +58,7 @@ function getAllData() { const PER_PAGE = 100 while (true) { sdk.log('fetching page', page) - const data = await get(`https://www.bitstamp.net/api/v2/wallet_transparency/?perPage=${PER_PAGE}&page=${page}`) + const data = await get(`https://www.bitstamp.net/api/v2/wallet_transparency/?perPage=${PER_PAGE}&page=${page}`, { timeout: 30000 }) const allWallets = Object.values(data.wallets ?? {}).flat() if (!allWallets.length) break // empty page => no more wallets diff --git a/projects/cbETH/index.js b/projects/cbETH/index.js index b5142669873..781850ca14c 100644 --- a/projects/cbETH/index.js +++ b/projects/cbETH/index.js @@ -8,7 +8,7 @@ module.exports = { timetravel: false, ethereum: { tvl: async () => { - const data = await get("https://api.exchange.coinbase.com/wrapped-assets/CBETH") + const data = await get("https://api.exchange.coinbase.com/wrapped-assets/CBETH", { timeout: 30000 }) // Convert circulating cbETH to the amount of underlying ETH backing the wrapper const circulatingSupply = new BigNumber(data.circulating_supply || 0) const conversionRate = new BigNumber(data.conversion_rate || 0) diff --git a/projects/compound-v3/index.js b/projects/compound-v3/index.js index 08486c54be1..b43112e4f95 100644 --- a/projects/compound-v3/index.js +++ b/projects/compound-v3/index.js @@ -41,7 +41,7 @@ async function fetchMarkets() { const cached = await getCache('config-cache', CACHE_PROJECT) Object.entries(cached ?? {}).forEach(([chain, markets]) => Array.isArray(markets) && markets.forEach(m => add(chain, m))) - const res = await get(MARKETS_API) + const res = await get(MARKETS_API, { timeout: 30000 }) res.forEach(({ chain_id, comet }) => { const chain = chainIdToName[chain_id] if (!chain) return sdk.log(`compound-v3: unknown chain id ${chain_id} in markets API`) diff --git a/projects/lista-lending/index.js b/projects/lista-lending/index.js index 98cccacbf1a..69b5579d20b 100644 --- a/projects/lista-lending/index.js +++ b/projects/lista-lending/index.js @@ -20,7 +20,7 @@ async function fetchMarketList() { const list = [] let total = Infinity for (let page = 1; list.length < total; page++) { - const { data } = await get(MARKET_LIST_URL + page) + const { data } = await get(MARKET_LIST_URL + page, { timeout: 30000 }) total = data?.total ?? 0 const pageList = data?.list ?? [] if (!pageList.length) break diff --git a/projects/uniswap-v2/index.js b/projects/uniswap-v2/index.js index 61900a474a8..7fe0599dd6c 100644 --- a/projects/uniswap-v2/index.js +++ b/projects/uniswap-v2/index.js @@ -47,7 +47,7 @@ graphChains.forEach(chain => { async function tvlViaGraph(api) { const endpoint = `https://interface.gateway.uniswap.org/v2/uniswap.explore.v1.ExploreStatsService/ProtocolStats?connect=v1&encoding=json&message=%7B%22chainId%22%3A%22${api.chainId}%22%7D` - const res = await get(endpoint, { headers: { 'origin': 'https://app.uniswap.org' } }) + const res = await get(endpoint, { headers: { 'origin': 'https://app.uniswap.org' }, timeout: 30000 }) const v2 = res.dailyProtocolTvl.v2 const oneDayBefore = api.timestamp - 86400 * 5 const oneDayAfter = api.timestamp + 86400 / 3 From 73fc7f11a17f1342c96274d636d648384b4a1977 Mon Sep 17 00:00:00 2001 From: kenny-august Date: Mon, 12 Oct 2026 07:10:03 -0500 Subject: [PATCH 197/988] upshift: skip wrapper vaults to avoid double counting (#21535) Co-authored-by: Claude Opus 5.5 --- projects/upshift/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/upshift/index.js b/projects/upshift/index.js index dbd2e9fce74..8cfc45c07c2 100644 --- a/projects/upshift/index.js +++ b/projects/upshift/index.js @@ -67,6 +67,9 @@ async function getVaultsConfig() { for (const vault of vaults) { // Filter out vaults where is_visible is false if (vault.status !== "active") continue; + // Wrapper vaults deposit into another Upshift vault (underlying_vault_address), + // so their assets are already counted in that underlying vault's TVL. + if (vault.underlying_vault_address) continue; const chainName = chainIdToName[vault.chain]; if (!chainName) continue; // Skip unsupported chains @@ -102,7 +105,7 @@ async function sumV2Vaults(api, vaults) { const solanaVaultsTvl = async (api) => { const vaults = await getConfig('upshift/vaults', vaultsApiEndpoint); const addresses = vaults - .filter(v => v.status === 'active' && v.chain === SOLANA_CHAIN_ID) + .filter(v => v.status === 'active' && v.chain === SOLANA_CHAIN_ID && !v.underlying_vault_address) .map(v => v.address); if (!addresses.length) return; From fe5a51c5b10ac6772c8495e27aa045ac8ceff0cc Mon Sep 17 00:00:00 2001 From: "Kacper K." Date: Mon, 12 Oct 2026 15:35:28 +0200 Subject: [PATCH 198/988] Team Finance: add missing lockers and locked V3 positions (#21532) --- projects/team-finance/config.js | 62 ++++++++++--- projects/team-finance/index.js | 154 ++++++++++++++++++++++++++++++-- 2 files changed, 195 insertions(+), 21 deletions(-) diff --git a/projects/team-finance/config.js b/projects/team-finance/config.js index d666f02f5d6..3ee79c192bf 100644 --- a/projects/team-finance/config.js +++ b/projects/team-finance/config.js @@ -19,13 +19,13 @@ module.exports = { kava: [ { contract: "0xa9ec655dac35d989c0c8be075b1106dcd32502d6", - contractABI: abi_v2, + contractABI: abi, }, ], polygon: [ { contract: "0x3eF7442dF454bA6b7C1deEc8DdF29Cfb2d6e56c7", - contractABI: abi_v2, + contractABI: abi, }, { contract: "0x586c21a779c24efd2a8af33c9f7df2a2ea9af55c", @@ -45,19 +45,19 @@ module.exports = { arbitrum: [ { contract: "0xE0B0D2021293Bee9715e1Db3be31b55C00F72A75", - contractABI: abi_v2, + contractABI: abi, }, ], base: [ { contract: "0x4f0fd563be89ec8c3e7d595bf3639128c0a7c33a", - contractABI: abi_v2, + contractABI: abi, }, ], fantom: [ { contract: "0xccebbe9e2b8f46c2c6862238e60a396af790b63e", - contractABI: abi_v2, + contractABI: abi, blacklist: ["0xc2995a065106b5c5c738b2320387460ebd12c12d"], // KyberSwap LP WFTM-DOA }, ], @@ -66,6 +66,10 @@ module.exports = { contract: "0x05b711Df32d73ECaa877d45a637a2eB415e7995f", contractABI: abi_v2, }, + { + contract: "0x4f0fd563be89ec8c3e7d595bf3639128c0a7c33a", + contractABI: abi, + }, ], /* etherlink: [ { @@ -77,7 +81,7 @@ module.exports = { blast: [ { contract: "0x624a4cb48a52a29d97eb1127bd0585ea1e02143c", - contractABI: abi_v2, + contractABI: abi, }, ], /* zksync: [ @@ -89,50 +93,80 @@ module.exports = { mantle: [ { contract: "0xd03450a71b81d408fc3d4f4bf928ca4da5328b14", - contractABI: abi_v2, + contractABI: abi, }, ], pulse: [ { contract: "0xe2fe530c047f2d85298b07d9333c05737f1435fb", - contractABI: abi_v2, + contractABI: abi, }, ], odyssey: [ { contract: "0x5dd3d67af1b31823dd3eee8548bdc070640c14b8", - contractABI: abi_v2, + contractABI: abi, }, ], flare: [ { contract: "0x93ff61ac1ab23c5847c422d03be359c2b6c723c7", - contractABI: abi_v2, + contractABI: abi, }, ], klaytn: [ { chain: "klaytn", contract: "0xb5c902ee211bae91ddb5c30b502c7ac6dfcd73f7", - contractABI: abi_v2, + contractABI: abi, }, ], lukso: [ { contract: "0x7c2aa307c3542d8346bea3290385359c78778934", - contractABI: abi_v2, + contractABI: abi, }, ], berachain: [ { contract: "0x5dd3d67af1b31823dd3eee8548bdc070640c14b8", - contractABI: abi_v2, + contractABI: abi, + }, + ], + xlayer: [ + { + contract: "0xf5cf29567350ebad9854ea22f3281d508ef1b96c", + contractABI: abi, + }, + ], + unichain: [ + { + contract: "0xfee008747a9c216e1edf4157fe0176bd32560efe", + contractABI: abi, + }, + ], + monad: [ + { + contract: "0x3a7de5f29557405f5d9fd06b570a53b966a78e8e", + contractABI: abi, + }, + ], + robinhood: [ + { + contract: "0x3a7de5f29557405f5d9fd06b570a53b966a78e8e", + contractABI: abi, + }, + ], + arc: [ + { + contract: "0x154479ca34d77a176e74c038b70df102d9be9935", + contractABI: abi, }, ], bsc: [ { contract: "0x0c89c0407775dd89b12918b9c0aa42bf96518820", - contractABI: abi_v2, + contractABI: abi, blacklist: [ "0x6c7c87d9868b1db5a0f62d867baa90e0adfa7cfd", //TNNS "0xf2619476bd0ca0eda08744029c66b62a904c2bf8", //JRIT diff --git a/projects/team-finance/index.js b/projects/team-finance/index.js index 67930864585..b4a1ec67235 100644 --- a/projects/team-finance/index.js +++ b/projects/team-finance/index.js @@ -1,32 +1,172 @@ const { getCache, setCache, } = require("../helper/cache") const { vestingHelper, } = require("../helper/unknownTokens") +const { getCoreAssets, getUniqueAddresses, } = require("../helper/tokenMapping") +const { getSqrtPriceX96AtTick, } = require("../helper/utils/tick") const config = require("./config") const project = 'bulky/team-finance' +const v3PositionsAbi = 'function positions(uint256) view returns (uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)' +const algebraPositionsAbi = 'function positions(uint256) view returns (uint88 nonce, address operator, address token0, address token1, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)' + +// Uniswap V3 style position managers whose positions can be locked with lockNFT +const positionManagers = { + ethereum: { + '0xc36442b4a4522e871399cd717abdd847ab11fe88': {}, // Uniswap + '0x46a15b0b27311cedf172ab29e4f4766fbe7f4364': {}, // PancakeSwap + }, + bsc: { + '0x46a15b0b27311cedf172ab29e4f4766fbe7f4364': {}, // PancakeSwap + '0x7b8a01b39d58278b5de7e48c8449c9f4f5170613': {}, // Uniswap + }, + base: { + '0x03a520b32c04bf3beef7beb72e919cf822ed34f1': {}, // Uniswap + '0x46a15b0b27311cedf172ab29e4f4766fbe7f4364': {}, // PancakeSwap + }, + arbitrum: { + '0xc36442b4a4522e871399cd717abdd847ab11fe88': {}, // Uniswap + }, + polygon: { + '0xc36442b4a4522e871399cd717abdd847ab11fe88': {}, // Uniswap + '0xb7402ee99f0a008e461098ac3a27f4957df89a40': {}, // SushiSwap + '0x8ef88e4c7cfbbac1c163f7eddd4b578792201de6': { isAlgebra: true, }, // QuickSwap + }, + avax: { + '0x655c406ebfa14ee2006250925e54ec43ad184f8b': {}, // Uniswap + }, + flare: { + '0xee5ff5bc5f852764b5584d92a4d592a53dc527da': {}, // SparkDEX + }, + unichain: { + '0x943e6e07a7e8e791dafc44083e54041d743c46e9': {}, // Uniswap + }, + robinhood: { + '0x73991a25c818bf1f1128deaab1492d45638de0d3': {}, // Uniswap + }, + arc: { + '0x39654a85a4c05127f5fd6ed22caec077a0fb1377': {}, // Uniswap + }, +} + async function tvl(api) { const chain = api.chain const args = config[chain] const cache = (await getCache(project, chain)) || {} if (!cache.vaults) cache.vaults = {} + const v3Positions = {} // position manager -> [{ id, locker }] for (const { contractABI, contract, blacklist, } of args) { - if (!cache.vaults[contract]) cache.vaults[contract] = { tokens: [], } + // `nfts` and `lastId` were added later, so a vault cached before that is rescanned once + if (!cache.vaults[contract]?.nfts) cache.vaults[contract] = { tokens: [], nfts: {}, lastId: 0, } const cCache = cache.vaults[contract] - let tokens = await api.fetchList({ lengthAbi: contractABI.depositId, itemAbi: contractABI.getDepositDetails, target: contract, permitFailure: true, startFrom: cCache.tokens.length }) - tokens = tokens.filter(i => i).map(i => i._tokenAddress) - cCache.tokens.push(...tokens) + // deposit ids start at 1 and run up to depositId inclusive + const deposits = await api.fetchList({ lengthAbi: contractABI.depositId, itemAbi: contractABI.getDepositDetails, target: contract, permitFailure: true, startFromOne: true, startFrom: cCache.lastId + 1 }) + // stop at the first failed read so it is retried on the next run + const failedAt = deposits.findIndex(i => !i) + const read = failedAt === -1 ? deposits : deposits.slice(0, failedAt) + cCache.lastId += read.length + + for (const { _tokenAddress, _isNFT, _tokenId, } of read) { + if (!_isNFT) { + cCache.tokens.push(_tokenAddress) + continue + } + const nft = _tokenAddress.toLowerCase() + if (!cCache.nfts[nft]) cCache.nfts[nft] = [] + cCache.nfts[nft].push(String(_tokenId)) + } await vestingHelper({ api, cache, useDefaultCoreAssets: true, owner: contract, tokens: cCache.tokens, blacklist, }) + + for (const [nft, ids] of Object.entries(cCache.nfts)) { + if (!positionManagers[chain]?.[nft]) continue + if (!v3Positions[nft]) v3Positions[nft] = [] + // a position can be withdrawn and locked again, which gives it a second deposit + v3Positions[nft].push(...[...new Set(ids)].map(id => ({ id, locker: contract }))) + } } await setCache(project, chain, cache) + + const whitelistedTokens = getUniqueAddresses(getCoreAssets(chain), chain) + for (const [nftAddress, positions] of Object.entries(v3Positions)) + await addV3Positions({ api, nftAddress, positions, whitelistedTokens, ...positionManagers[chain][nftAddress] }) +} + +// Values each position by its core asset side. Positions without a core asset are skipped. +async function addV3Positions({ api, nftAddress, positions, whitelistedTokens, isAlgebra = false }) { + // a position id outlives its lock, so count it only while the locker still owns it + const owners = await api.multiCall({ abi: 'function ownerOf(uint256) view returns (address)', target: nftAddress, calls: positions.map(p => p.id), permitFailure: true }) + const lockedIds = positions.filter((p, i) => owners[i]?.toLowerCase() === p.locker.toLowerCase()).map(p => p.id) + if (!lockedIds.length) return + + const isCore = token => whitelistedTokens.includes(token.toLowerCase()) + const infos = (await api.multiCall({ abi: isAlgebra ? algebraPositionsAbi : v3PositionsAbi, target: nftAddress, calls: lockedIds, permitFailure: true })) + .filter(info => info && +info.liquidity > 0 && (isCore(info.token0) || isCore(info.token1))) + if (!infos.length) return + + const factory = await api.call({ target: nftAddress, abi: 'address:factory' }) + const pools = await api.multiCall({ + target: factory, + abi: isAlgebra ? 'function poolByPair(address, address) view returns (address)' : 'function getPool(address, address, uint24) view returns (address)', + calls: infos.map(i => ({ params: isAlgebra ? [i.token0, i.token1] : [i.token0, i.token1, i.fee] })), + }) + const sqrtPrices = await api.multiCall({ + abi: isAlgebra ? 'function globalState() view returns (uint160 price)' : 'function slot0() view returns (uint160 sqrtPriceX96)', + calls: pools, + }) + + // Core asset amount per pool. When only one side is a core asset, the other side adds its value at the + // pool price, but never more than the core side, as with a V2 pair. So a position that is out of range + // and holds only the core asset counts once, and a project token can not be valued above its liquidity. + const poolAmounts = {} + infos.forEach((info, i) => { + const { amount0, amount1 } = getPositionAmounts(info, sqrtPrices[i]) + const price = (Number(sqrtPrices[i]) / 2 ** 96) ** 2 // token1 per token0 + const core0 = isCore(info.token0) + const core1 = isCore(info.token1) + if (core0 && core1) { + addPoolAmount(pools[i], info.token0, amount0, 0) + addPoolAmount(pools[i], info.token1, amount1, 0) + } else if (core1) { + addPoolAmount(pools[i], info.token1, amount1, Math.min(amount0 * price || 0, amount1)) + } else { + addPoolAmount(pools[i], info.token0, amount0, Math.min(amount1 / price || 0, amount0)) + } + }) + + // Positions with huge liquidity next to a range edge are very sensitive to float precision, so never + // count more of a core asset than the pool holds + const entries = Object.values(poolAmounts) + const poolBalances = await api.multiCall({ abi: 'erc20:balanceOf', calls: entries.map(e => ({ target: e.token, params: e.pool })) }) + entries.forEach((e, i) => { + const scale = e.core > 0 ? Math.min(1, +poolBalances[i] / e.core) : 0 + api.add(e.token, (e.core + e.other) * scale) + }) + + function addPoolAmount(pool, token, core, other) { + const key = `${pool}-${token}` + if (!poolAmounts[key]) poolAmounts[key] = { pool, token, core: 0, other: 0 } + poolAmounts[key].core += core + poolAmounts[key].other += other + } +} + +function getPositionAmounts({ tickLower, tickUpper, liquidity }, sqrtPriceX96) { + const sp = Number(sqrtPriceX96) / 2 ** 96 + const sa = Number(getSqrtPriceX96AtTick(+tickLower)) / 2 ** 96 + const sb = Number(getSqrtPriceX96AtTick(+tickUpper)) / 2 ** 96 + liquidity = Number(liquidity) + if (sp <= sa) return { amount0: liquidity * (sb - sa) / (sa * sb), amount1: 0 } + if (sp >= sb) return { amount0: 0, amount1: liquidity * (sb - sa) } + return { amount0: liquidity * (sb - sp) / (sp * sb), amount1: liquidity * (sp - sa) } } module.exports = { - methodology: `Counts each LP pair's native token and - stable balance, adjusted to reflect locked pair's value. - Balances and merged across multiple locker to return sum TVL per chain`, + methodology: `Counts each LP pair's native token and + stable balance, adjusted to reflect locked pair's value. + Balances and merged across multiple locker to return sum TVL per chain. + Locked Uniswap V3 style positions count their native token and stable side the same way`, misrepresentedTokens: true, isHeavyProtocol: true, }; From 17e081fa0c73b1d55f3bef2922907d61fe6f6abf Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 12 Oct 2026 16:19:04 +0200 Subject: [PATCH 199/988] update @defillama/sdk version --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index e0846d615d7..0ded5adceab 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", - "@defillama/sdk": "5.0.236", + "@defillama/sdk": "5.0.238", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", "@supercharge/promise-pool": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 36633becb38..08d51ab06ba 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^0.30.1 version: 0.30.1(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) '@defillama/sdk': - specifier: 5.0.236 - version: 5.0.236(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) + specifier: 5.0.238 + version: 5.0.238(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) '@project-serum/anchor': specifier: ^0.26.0 version: 0.26.0(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -269,8 +269,8 @@ packages: peerDependencies: '@solana/web3.js': ^1.68.0 - '@defillama/sdk@5.0.236': - resolution: {integrity: sha512-mKSzmrAf0rWg6U1hS9lNi4wZ5olESmQQTgq5/5GRInS2YOZFOJXFLlF2AP9RvgYwbEdbSnDWfpsoElWH3NAzXw==} + '@defillama/sdk@5.0.238': + resolution: {integrity: sha512-wkSVkSgWstwG4DCd4KcyTZT+8551v+0Leo2yL6yMmeKY0iEzA2p0c1NBwP3IOQVdLVdK0ahVFrWpWY3p/cPpjQ==} peerDependencies: '@solana/web3.js': '>=1.73.0' peerDependenciesMeta: @@ -1941,7 +1941,7 @@ snapshots: bn.js: 5.2.2 buffer-layout: 1.2.2 - '@defillama/sdk@5.0.236(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': + '@defillama/sdk@5.0.238(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': dependencies: '@aws-sdk/client-s3': 3.913.0 '@elastic/elasticsearch': 8.19.1(supports-color@7.2.0) From 5922131db3c10819f327c421a2da028a452feeb0 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 12 Oct 2026 10:40:45 -0400 Subject: [PATCH 200/988] Fix Metric and add Metric V1 (#21580) Co-authored-by: Semen --- projects/metric-v1/index.js | 46 ++++++++++++++++++++++++++++++ projects/metric/index.js | 57 ++++++++++++++++++++++++------------- 2 files changed, 83 insertions(+), 20 deletions(-) create mode 100644 projects/metric-v1/index.js diff --git a/projects/metric-v1/index.js b/projects/metric-v1/index.js new file mode 100644 index 00000000000..eadb53f3759 --- /dev/null +++ b/projects/metric-v1/index.js @@ -0,0 +1,46 @@ +// Metric V1 pools (the DefiLlama listing that pairs with dimension-adapters +// dexs/metric-v1). Two MetricOmmPoolFactory generations, both deployed through +// CreateX to the same address on every chain; pools hold their own token0/token1 +// reserves, so TVL is the sum of both balances per pool. +// +// Current factory, deployed in one wave on 2026-09-15 and the only approved +// factory in Metric's network config since then: +// https://etherscan.io/address/0x2a53833cc95548cf52c7b159110e22D3a9018f32 +// https://basescan.org/address/0x2a53833cc95548cf52c7b159110e22D3a9018f32 +// Retired factory (2026-09-22; pools drained, kept so historical TVL refills +// still see them): +// https://etherscan.io/address/0x622911384e7973439b8be305f5e3Fc3c5736EDe4 +// https://basescan.org/address/0x622911384e7973439b8be305f5e3Fc3c5736EDe4 +const FACTORY = '0x2a53833cc95548cf52c7b159110e22D3a9018f32' +const RETIRED_FACTORY = '0x622911384e7973439b8be305f5e3Fc3c5736EDe4' + +const config = { + ethereum: [FACTORY, RETIRED_FACTORY], + base: [FACTORY, RETIRED_FACTORY], + arbitrum: [FACTORY, RETIRED_FACTORY], + robinhood: [FACTORY, RETIRED_FACTORY], + hyperliquid: [FACTORY, RETIRED_FACTORY], + bsc: [FACTORY], + polygon: [FACTORY], + avax: [FACTORY], + monad: [FACTORY], + megaeth: [FACTORY], +} + +Object.keys(config).forEach(chain => { + const factories = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const ownerTokens = [] + for (const factory of factories) { + // pool ids start at 1, nextPoolIdx is the id the next pool will get + const pools = await api.fetchList({ lengthAbi: 'nextPoolIdx', itemAbi: 'function idxToPool(uint256) view returns (address)', target: factory, startFrom: 1 }) + const immutables = await api.multiCall({ abi: 'function getImmutables() view returns (address factory, address token0, address token1)', calls: pools }) + immutables.forEach(({ token0, token1 }, i) => ownerTokens.push([[token0, token1], pools[i]])) + } + return api.sumTokens({ ownerTokens }) + }, + } +}) + +module.exports.methodology = 'TVL is the sum of token0 and token1 balances held by every pool created by the Metric V1 pool factories (current and retired). Pools are enumerated on-chain from each factory (idxToPool up to nextPoolIdx).' diff --git a/projects/metric/index.js b/projects/metric/index.js index 206cff2b5a9..ce2b804462b 100644 --- a/projects/metric/index.js +++ b/projects/metric/index.js @@ -1,23 +1,40 @@ -const { getConfig } = require('../helper/cache') +const { getLogs2 } = require('../helper/cache/getLogs') -// const API_BASE = "https://api.metric.xyz"; -const API_BASE = "http://54.199.103.16:8080"; -const chainConfig = { - ethereum: "ethereum", - base: 'base', - arbitrum: "arbitrum", - bsc: "bsc", - avax: "avax", - polygon: "polygon", - megaeth: "megaeth", - hyperliquid: "hyperevm", - monad: "monad", -}; +// Metric's first-generation MetricOmmPoolFactory (CreateX, same address on every +// chain). Pools are discovered from its PoolCreated events; each pool holds its +// own token0/token1 reserves, so TVL is the sum of both balances per pool. +// The previous version of this adapter read the pool list from a Metric API that +// has since been shut down; the on-chain scan replaces it 1:1. +// https://etherscan.io/address/0xe22F9fc0f04486dE25ed6CF1800a4a47aFD82e0C +// https://basescan.org/address/0xe22F9fc0f04486dE25ed6CF1800a4a47aFD82e0C +const FACTORY = '0xe22F9fc0f04486dE25ed6CF1800a4a47aFD82e0C' -Object.keys(chainConfig).forEach((key) => module.exports[key] = { tvl }) +const POOL_CREATED_EVENT = 'event PoolCreated(address indexed token0, address indexed token1, address indexed priceProvider, address pool, bytes32 poolId)' -async function tvl(api) { - const pools = await getConfig(`metric-pools/${api.chain}`, `${API_BASE}/${chainConfig[api.chain]}/metadata`) - const ownerTokens = pools.map(i => [[i.token0, i.token1], i.poolAddress]) - return api.sumTokens({ ownerTokens }) -} \ No newline at end of file +// fromBlock = factory deployment block per chain; the same values drive the +// volume adapter for this factory (DefiLlama/dimension-adapters, dexs/metric). +const config = { + ethereum: { fromBlock: 24521317 }, + base: { fromBlock: 42570144 }, + arbitrum: { fromBlock: 435210755 }, + bsc: { fromBlock: 82964761 }, + avax: { fromBlock: 78822864 }, + polygon: { fromBlock: 83380134 }, + megaeth: { fromBlock: 9083666 }, + hyperliquid: { fromBlock: 30774348 }, + monad: { fromBlock: 64807339 }, + robinhood: { fromBlock: 9477535 }, +} + +Object.keys(config).forEach(chain => { + const { fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ api, target: FACTORY, eventAbi: POOL_CREATED_EVENT, fromBlock }) + const ownerTokens = logs.map(({ token0, token1, pool }) => [[token0, token1], pool]) + return api.sumTokens({ ownerTokens }) + }, + } +}) + +module.exports.methodology = 'TVL is the sum of token0 and token1 balances held by every pool created by the Metric pool factory. Pools are discovered on-chain from the factory PoolCreated events.' From 1604f3e6cf527474b29107999f6a27cd3a9adb7e Mon Sep 17 00:00:00 2001 From: Himbit <97770895+Dinoxv@users.noreply.github.com> Date: Mon, 12 Oct 2026 21:49:39 +0700 Subject: [PATCH 201/988] Add Bitcoin Swap (btcwchain, chain 482120): Uniswap V2 TVL (#21528) Co-authored-by: Dinoxv Co-authored-by: Claude Opus 5.5 --- projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 4 ++++ projects/helper/env.js | 4 ++++ registries/uniswapV2.js | 3 +++ 4 files changed, 12 insertions(+) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index bbefed53335..5894c61b777 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -75,6 +75,7 @@ "bsc", "bsquared", "bsv", + "btcwchain", "btn", "btnx", "btr", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 911921ce3ea..c09c71e01f7 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1993,6 +1993,10 @@ "ggchain": { "bUSDT": "0xe77F05c01DaC30901de8346c23242C4284DCb4AB" }, + "btcwchain": { + "WBTCW": "0xA7182E25e635108AD401E3be78f1c2A4593B8831", + "USDC_E": "0x7b56B7B06B8e586064787E7FfE466Ab6B78C31C7" + }, "zora": { "USDzC": "0xcccccccc7021b32ebb4e8c08314bd62f7c653ec4" }, diff --git a/projects/helper/env.js b/projects/helper/env.js index 6a9b1ada1ab..bedde2a7b91 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -80,6 +80,10 @@ const DEFAULTS = { ARC_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', ARC_RPC_MULTICALL_V3: '0xcA11bde05977b3631167028862bE2a173976CA11', ARC_MULTICALL_CHUNK_SIZE: '50', + // Bitcoin Swap (482120): canonical Multicall3 is not deployed; this is the verified Multicall3 deployment on the chain. + BTCWCHAIN_RPC: 'https://rpc.btcw.tech', + BTCWCHAIN_RPC_CHAIN_ID: '482120', + BTCWCHAIN_RPC_MULTICALL: '0xA0093EA76633A983364cb2582959870eaffDdea0', RLS_ARCHIVAL_RPC: 'https://mainnet-archive.rayls.com', CRONOS_RPC: 'https://evm.cronos.org,https://rpc.vvs.finance,https://cronos.drpc.org,https://cronos.rpc.sentio.xyz,https://evm-cronos.crypto.org', // chains with no provider in the SDK providers list (chainid.network RPCs) diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index bfd896bfdfb..3a64bbbd899 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -238,6 +238,9 @@ const uniV2Configs = { 'biokript': { bsc: '0x795802cb01a7be4be2f7f114b232a83b3adce64a', }, + 'bitcoin-swap': { + btcwchain: '0x453F946CB371a2039137453BAafFb83FF4ccf9f7', + }, 'bitgenie-dex': { merlin: '0xEa51E2E458aE7Cb921d47fC463Ac4fED7ae65a41', }, From 2cc05322533e23ef84c52568969c040aa27aac27 Mon Sep 17 00:00:00 2001 From: ajibolahuds Date: Mon, 12 Oct 2026 17:02:14 +0200 Subject: [PATCH 202/988] Add Aera Lend TVL adapter on Cookie Chain (#21522) Co-authored-by: FelixBruguera --- projects/aera-lend/index.js | 110 ++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 projects/aera-lend/index.js diff --git a/projects/aera-lend/index.js b/projects/aera-lend/index.js new file mode 100644 index 00000000000..206dfeade4d --- /dev/null +++ b/projects/aera-lend/index.js @@ -0,0 +1,110 @@ +const { PublicKey } = require('@solana/web3.js') +const { getConnection, getTokenAccountBalances } = require('../helper/solana') + +// Aera Lend is an overcollateralized money market on Cookie Chain: users lend COOK, and +// borrow COOK against bCOOK (BakeYourStake's liquid staking token) posted as collateral. +// +// Every asset sits in one `Reserve` account per mint. Each reserve keeps its tokens in a +// single `liquidity_vault` token account (PDA ["liquidity_vault", reserve], owned by the +// reserve), so TVL is the balance of those vaults: idle COOK that lenders supplied, plus +// all bCOOK collateral. Borrowed COOK has left the vault and is reported under `borrowed`. +const PROGRAM = new PublicKey('AerafpFHsY4N16i4KufPJQyURryxKtYgCr6oZMwbp76q') + +// Anchor discriminator for `Reserve` = sha256("account:Reserve")[:8] = 2bf2ccca1af73b7f. +const RESERVE_DISCRIMINATOR_HEX = '2bf2ccca1af73b7f' +const RESERVE_DISCRIMINATOR_B58 = '8MMas8GHex6' + +// `Reserve` layout (IDL order, after the 8-byte discriminator): +// market 8, liquidity_mint 40, liquidity_vault 72, share_mint 104, oracle 136, +// liquidity_decimals 168 (u8), available_liquidity 169 (u64), share_mint_supply 177 (u64), +// borrowed_principal 185 (u128), borrow_index 201 (u128, 1e18 fixed point), +// last_update_slot 217 (u64), accrued_fees 225 (u64), then `ReserveConfig` from 233: +// 11 u16 bps fields (optimal_utilization 243, min/optimal/max_borrow_rate 245/247/249), +// supply/borrow/per-wallet caps (3 u64), 3 bools, slots_per_year 282 (u64). +const LIQUIDITY_MINT_OFFSET = 40 +const LIQUIDITY_VAULT_OFFSET = 72 +const AVAILABLE_LIQUIDITY_OFFSET = 169 +const BORROWED_PRINCIPAL_OFFSET = 185 +const BORROW_INDEX_OFFSET = 201 +const LAST_UPDATE_SLOT_OFFSET = 217 +const OPTIMAL_UTILIZATION_OFFSET = 243 +const MIN_BORROW_RATE_OFFSET = 245 +const OPTIMAL_BORROW_RATE_OFFSET = 247 +const MAX_BORROW_RATE_OFFSET = 249 +const SLOTS_PER_YEAR_OFFSET = 282 +const RESERVE_MIN_LEN = SLOTS_PER_YEAR_OFFSET + 8 +const FIXED_POINT_SCALE = 10n ** 18n +const BPS = 10_000n + +const readU128 = (data, offset) => data.readBigUInt64LE(offset) + (data.readBigUInt64LE(offset + 8) << 64n) +const readU16 = (data, offset) => BigInt(data.readUInt16LE(offset)) + +// `Reserve::current_borrowed_amount`: principal x index, rounded up. +const debtAt = (principal, index) => (principal * index + FIXED_POINT_SCALE - 1n) / FIXED_POINT_SCALE + +// The stored borrow_index only advances when a transaction runs `accrue_interest`, so the +// debt is projected to the current slot exactly as the program would accrue it: +// index x (1 + rate_per_slot x elapsed), with the rate from the kinked utilization curve. +function currentDebt(data, principal, slot) { + const index = readU128(data, BORROW_INDEX_OFFSET) + const lastUpdateSlot = data.readBigUInt64LE(LAST_UPDATE_SLOT_OFFSET) + const borrowed = debtAt(principal, index) + if (principal === 0n || slot <= lastUpdateSlot) return borrowed + + const gross = data.readBigUInt64LE(AVAILABLE_LIQUIDITY_OFFSET) + borrowed + const utilization = gross === 0n ? 0n : (borrowed * BPS) / gross + const kink = readU16(data, OPTIMAL_UTILIZATION_OFFSET) + const minRate = readU16(data, MIN_BORROW_RATE_OFFSET) + const optimalRate = readU16(data, OPTIMAL_BORROW_RATE_OFFSET) + const maxRate = readU16(data, MAX_BORROW_RATE_OFFSET) + const rateBps = utilization <= kink + ? minRate + ((optimalRate - minRate) * utilization) / kink + : optimalRate + ((maxRate - optimalRate) * (utilization - kink)) / (BPS - kink) + const ratePerSlot = (rateBps * FIXED_POINT_SCALE) / (BPS * data.readBigUInt64LE(SLOTS_PER_YEAR_OFFSET)) + const growth = FIXED_POINT_SCALE + ratePerSlot * (slot - lastUpdateSlot) + return debtAt(principal, (index * growth) / FIXED_POINT_SCALE) +} + +async function getReserves(connection) { + const accounts = await connection.getProgramAccounts(PROGRAM, { + filters: [{ memcmp: { offset: 0, bytes: RESERVE_DISCRIMINATOR_B58 } }], + }) + const slot = await connection.getSlot() + const reserves = [] + for (const { pubkey, account } of accounts) { + const data = account.data + if (data.subarray(0, 8).toString('hex') !== RESERVE_DISCRIMINATOR_HEX) continue + if (data.length < RESERVE_MIN_LEN) throw new Error(`Unrecognised Aera Reserve layout: ${pubkey.toBase58()}`) + reserves.push({ + mint: new PublicKey(data.subarray(LIQUIDITY_MINT_OFFSET, LIQUIDITY_MINT_OFFSET + 32)).toBase58(), + vault: new PublicKey(data.subarray(LIQUIDITY_VAULT_OFFSET, LIQUIDITY_VAULT_OFFSET + 32)).toBase58(), + borrowed: currentDebt(data, readU128(data, BORROWED_PRINCIPAL_OFFSET), BigInt(slot)), + }) + } + // The program is live with a COOK and a bCOOK reserve; finding none means a bad RPC + // response or a layout change, and must not be reported as zero TVL. + if (!reserves.length) throw new Error('aera-lend: no Reserve accounts found') + return reserves +} + +async function tvl(api) { + const connection = getConnection(api.chain) + const reserves = await getReserves(connection) + // No `allowError`: every vault comes out of a live Reserve and is never closed, so a + // missing vault is an RPC or layout fault that must fail rather than under-report. + const balances = await getTokenAccountBalances(reserves.map(r => r.vault), { chain: api.chain }) + for (const [mint, amount] of Object.entries(balances)) api.add(mint, amount) +} + +async function borrowed(api) { + const connection = getConnection(api.chain) + const reserves = await getReserves(connection) + for (const { mint, borrowed } of reserves) api.add(mint, borrowed.toString()) +} + +module.exports = { + doublecounted: true, + timetravel: false, + methodology: 'TVL is the tokens held in the liquidity vault of every Aera reserve on Cookie Chain: COOK supplied by lenders and not lent out, plus bCOOK posted as collateral. bCOOK is BakeYourStake\'s liquid staking token, and the COOK backing it is already counted in BakeYourStake\'s TVL, so this listing is marked doublecounted. Borrowed is the outstanding COOK debt: borrowed_principal x borrow_index, with the stored index (updated only when a transaction touches the reserve) advanced to the current slot along the reserve interest-rate curve, so interest not yet written on-chain is included.', + cookiechain: { tvl, borrowed }, +} From 3738d96cae269f177afff1b677a32e4dbcee1191 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Mon, 12 Oct 2026 18:10:38 +0200 Subject: [PATCH 203/988] fix(test): honest harness output (#21538) --- test.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test.js b/test.js index 190158566d2..1fd35807697 100644 --- a/test.js +++ b/test.js @@ -223,7 +223,7 @@ function validateHallmarks(hallmark) { try { await getTvl(unixTimestamp, ethBlock, chainBlocks, usdTvls, tokensBalances, usdTokenBalances, tvlFunction, storedKey,); } catch (e) { - failedKeys.push({ storedKey, error: e && e.message ? e.message : String(e) }) + failedKeys.push({ storedKey, error: formatFailureError(e) }) console.error(`Error pulling TVL for ${storedKey}:`, e) return; } @@ -310,6 +310,14 @@ function validateHallmarks(hallmark) { })().catch(handleError); +function formatFailureError(e) { + if (e && e.message) return e.message + if (e && typeof e === 'object') { + try { return JSON.stringify(e).slice(0, 500) } catch { return String(e) } + } + return String(e) +} + function checkExportKeys(module, filePath, chains) { let _filePath = filePath filePath = filePath.split(path.sep) @@ -324,8 +332,10 @@ function checkExportKeys(module, filePath, chains) { || /v\d+\.js$/.test(filePath[1]) // matches .../projects/projectXYZ/v1.js ))) - ) - process.exit(0) + ) { + console.error(`Not an adapter path, nothing tested: ${_filePath} (expected projects//index.js)`) + process.exit(2) + } const blacklistedRootExportKeys = ['tvl', 'staking', 'pool2', 'borrowed', 'treasury', 'offers', 'vesting']; const rootexportKeys = Object.keys(module).filter(item => typeof module[item] !== 'object'); From 9c7d33270e5847c92436fb792d0184efcd0005ee Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 12 Oct 2026 12:13:27 -0400 Subject: [PATCH 204/988] Add Quotum staking (#21585) Co-authored-by: quotumorg <337712588+quotumorg@users.noreply.github.com> --- registries/stakingOnly.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/registries/stakingOnly.js b/registries/stakingOnly.js index 5cd0d4dcb2d..1a1e6d15ab3 100644 --- a/registries/stakingOnly.js +++ b/registries/stakingOnly.js @@ -1424,6 +1424,12 @@ const configs = { staking: [['0xe44c35ec2896983accce2a38dc1668793e85956d', '0xc1f46adf341145369eee9fbe0d84fa1cb0c24706'], '0x1776e1F26f98b1A5dF9cD347953a26dd3Cb46671'], }, }, + "quotum": { + "methodology": "Staking is QUOTUM principal deposited in QuotumStaking. The protocol's own token is excluded from ordinary TVL. TaxSink funds earmarked for inference payments and buybacks are excluded from TVL.", + "robinhood": { + staking: ["0x7F1d2b117aBac121f99cEED7f80e5925fFF37A53", "0xFE936755185353b63a81dD72b47533Eb6021018E"] + } + } } module.exports = buildProtocolExports(configs, stakingOnlyExportFn) From 625663407e4928c114b0c310df2ff1272c8d171e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 12 Oct 2026 18:43:35 +0200 Subject: [PATCH 205/988] migrate to the sdk --- projects/helper/env.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/projects/helper/env.js b/projects/helper/env.js index bedde2a7b91..86487d1062b 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -66,8 +66,6 @@ const DEFAULTS = { PROPTECH_RPC: "https://mainnet.ptekcoin.com", FLARE_ARCHIVAL_RPC: 'https://flare-explorer.flare.network/api/eth-rpc', PROM_RPC: 'https://promscan.io/api/eth-rpc,https://prom-rpc.eu-north-2.gateway.fm', - PROM_RPC_MULTICALL: '0xfF785aF3De8C2cb5727A8665984E741c16679131', - NIBIRU_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', RISE_ARCHIVAL_RPC: 'https://explorer.risechain.com/api/eth-rpc', // public rpc.risechain.com caps eth_getLogs at 5000 blocks // PAST block is served only by drpc: blockdaemon answers "state at block N is pruned" and // rpc.mainnet.arc.io 429s every archival read, even a single batch of 50 after sitting idle. @@ -77,8 +75,6 @@ const DEFAULTS = { // explorer.arc.io/api/eth-rpc answers every programmatic request with HTTP 403. ARC_ARCHIVAL_RPC: 'https://rpc.arc-scan.org,https://rpc.blockdaemon.mainnet.arc.io,https://rpc.nodeflare.app/arc/public', // public archive fallbacks; use <=100k-block log ranges // Arc is not in the SDK Multicall3 deployment map; canonical Multicall3 is deployed there. - ARC_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', - ARC_RPC_MULTICALL_V3: '0xcA11bde05977b3631167028862bE2a173976CA11', ARC_MULTICALL_CHUNK_SIZE: '50', // Bitcoin Swap (482120): canonical Multicall3 is not deployed; this is the verified Multicall3 deployment on the chain. BTCWCHAIN_RPC: 'https://rpc.btcw.tech', From a39ca7a4957a8dc6df2a281358dcfce5b0d33c73 Mon Sep 17 00:00:00 2001 From: eden Date: Tue, 13 Oct 2026 00:33:42 +0700 Subject: [PATCH 206/988] remove dup btc wallets - poloniex (#21586) --- projects/helper/bitcoin-book/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index b28d8b3140f..1ae4bb4bc30 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -60,12 +60,9 @@ module.exports = { "poloniex-cex": [ "1LgW4RA5iE98khRJ58Bhx5RLABP3QGjn9y", "33Mz8zrWx6yei6itk2mjfCytdKJZEwKeM6", - "1McbLy27nLVzJ4ubMnFm3jxnQ3nbq2mpr2", "1PrHfPbcLyHTUHxjizAgauCNXvjnh5LEex", "1NBX1UZE3EFPTnYNkDfVhRADvVc8v6pRYu", - "17vH7EX655n5L4iPAfVXPn3rVzZbrgKYBC", "14XKsv8tT6tt8P8mfDQZgNF8wtN5erNu5D", - "13hxUsGWnJgH2vzscAUrYm7pxgWzTvez7x", "1M3Y4dgeg8zVdQ41BXTaWyFUUmc2e6fF2b", "1QJt83Cb6S6Tm5chFwyn46XSBGYbS8unXB", "13r8PhQ9Gk1KavpJzjc8ELjEw3kBQKLRHq", From d14b1b534ae33f2cb20c72eb9f2c80470e82f355 Mon Sep 17 00:00:00 2001 From: Ulysse Ramage Date: Mon, 12 Oct 2026 19:49:47 +0200 Subject: [PATCH 207/988] spectra: exclude faulty mevUSDC from Avalanche TVL (#21576) --- projects/spectra/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/projects/spectra/index.js b/projects/spectra/index.js index 1526714cc56..8d2bc5de91d 100644 --- a/projects/spectra/index.js +++ b/projects/spectra/index.js @@ -182,6 +182,17 @@ const tvl = async (api) => { allIBTBalances[ibt] = (allIBTBalances[ibt] || 0) + balance; } + if (api.chain === 'avax') { + // mevUSDC and its wrapper have faulty valuations on Avalanche. + const excludedIBTs = new Set([ + '0x4dc1ce9b9f9ef00c144bfad305f16c62293dc0e8', + '0x92fbb58342164546325602588599b05802c69bbe', + ]) + for (const ibt of Object.keys(allIBTBalances)) { + if (excludedIBTs.has(ibt.toLowerCase())) delete allIBTBalances[ibt] + } + } + const assets = await api.multiCall({ calls: Object.keys(allIBTBalances).map((ibt) => ({ target: ibt })), abi: abi.vault.asset }) const assetsBalances = await api.multiCall({ calls: Object.entries(allIBTBalances).map(([ibt, balance]) => ({ target: ibt, params: [BigInt(balance)] })), abi: abi.vault.convertToAsset, permitFailure :true }) From fcad79e0e56a96739921f6de725fde32ca5a4720 Mon Sep 17 00:00:00 2001 From: Surfacing-8671 Date: Mon, 12 Oct 2026 21:03:41 +0300 Subject: [PATCH 208/988] Add Bush (Robinhood) (#21575) Co-authored-by: surfacing8671 --- registries/balancer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registries/balancer.js b/registries/balancer.js index f4cdb164341..1bbd3bf1382 100644 --- a/registries/balancer.js +++ b/registries/balancer.js @@ -153,6 +153,10 @@ const configs = { _options: { helperType: 'v3' }, bsc: { vault: '0xb61cb1E8EF4BB1b74bB858B8B60d82d79488F13D', fromBlock: 60471472 }, }, + 'bush': { + _options: { helperType: 'v3' }, + robinhood: { vault: '0xB055000fbE3cc9bDE7742C583a86cc6283E3fF85', fromBlock: 24180135 }, + }, // ===== Balancer V1 (v1Tvl) ===== 'valueliquid': { From b3fb232e9020e9db49a6ba84705b117c8ead18d8 Mon Sep 17 00:00:00 2001 From: yelidrissi <37309512+yelidrissi@users.noreply.github.com> Date: Mon, 12 Oct 2026 15:04:57 -0300 Subject: [PATCH 209/988] steakhouse: add missing Morpho vaults (#21582) --- registries/curators.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/registries/curators.js b/registries/curators.js index 0bd921061a8..800c0eb391c 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -1274,6 +1274,14 @@ const configs = { '0x6f48cE6380693808682E43140E3Eeb877a096Aa1', // USDC T-Prime Instant '0xBEEFFF4716a49418D69c251cab8759bB107e57C8', // USDC Turbo '0xBEEFFFDE1CABD3d8A3cd4fd5e04DbA51B9D4Ac39', // XAUT Turbo + '0xbeef04cCAfe3FB25dEc704afe592e846B8C7fd06', // Steakhouse ARSs + '0xBEEFFF9291CB0898ae42626C662f3175d4B69F7F', // Steakhouse High Yield Turbo USDT + '0xbeef0A65206ba55319851836c91f3Fd8864a2E39', // Project Nexus Prime Alpha Vault + '0xbeef06DB5Aad37A31a99Ae8aE3120618845c5A23', // Grove x Steakhouse USDG + '0xbeef05061FE51eA482BD1b68041353490b3a5934', // Grove x Steakhouse USDG + '0xbeef0819C768893e9E29189429C25339DFbE7BA5', // Grove x Steakhouse USDG + '0xBeEff4fD39F8e48b6a6e475445D650cb11e9599F', // Grove x Steakhouse RLUSD + '0xbeef08Db223ad823164A4B13CBD6bd8b5d507b41', // Grove x Steakhouse PYUSD ], mellow: [ '0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc', @@ -1304,6 +1312,10 @@ const configs = { '0xBEEff02DE231f8B08c627C769edC73e7AcE47264', // Steakhouse Morpho V2 '0xBEEFFFe68dFc2D3BD1ABdAd37c70634973b16478', // USDC Turbo '0xBeEfF0be997Cca5B1c13A7433c2004637975739e', // Ethena x Steakhouse USDC (deployed via a factory wrapper, missed by the owner filter) + '0xbeef0786756810478b88982DE00F3CD7fdB8e7c7', // Grove x Steakhouse USDC + '0xbeef0Eb37DdB8f88BDf167c498c6429676fF7947', // Grove x Steakhouse USDC + '0xbeef0e6B6EC67b1E56bb938782f445473441bf15', // Techblock x Steakhouse USDC + '0x34ddDAb96C40788FC94eabeEFF71e2082d85Fc0E', // Ethena USDC Turbo ], }, corn: { @@ -1314,6 +1326,7 @@ const configs = { unichain: { morphoVaultOwners: [ '0x0A0e559bc3b0950a7e448F0d4894db195b9cf8DD', + '0x0000aeB716a0DF7A9A1AAd119b772644Bc089dA8', ], }, arbitrum: { @@ -1326,6 +1339,9 @@ const configs = { morpho: [ '0xBEEFFF13dD098De415e07F033daE65205B31A894', // USDC Turbo '0xBEEFFFFE0E9b26bBe3B5cE851539366991C3BF39', // XAUT0 Turbo + '0xbeeFf72B77e7584a450E887125F25E8D8819016a', // Steakhouse USDG Pro + '0xbeeff96dD606189562dDBBdE0cdB1c13f984680b', // Steakhouse High Yield USDC + '0xbeefff50b7Bb6D1a6c6A9b97b60b5cAa24B6b5CC', // Steakhouse High Yield USDT ], }, katana: { @@ -1346,6 +1362,8 @@ const configs = { morpho: [ '0xBEEF0C61DA39F7EA2bFa7B0f9d6338A3a2DD2fF0', // Steakhouse USDC '0xBEEF067C9D2591aCCAB7d1C336a41ca3bd45b8f5', // Steakhouse mUSD + '0x7f8DC4d700964ce0a288A10cE1D904a1300354Be', // Steakhouse USDC Reserved + '0x7c3Bfb0FD70e6591d1747d12EAFCf329C904f35F', // Steakhouse mUSD Reserved ], }, polygon: { @@ -1363,6 +1381,14 @@ const configs = { '0xbEeFF0fb1Dc19344A87b8479dAb60A2e16160737', // Ethena x Steakhouse USDG '0xBEEff039907422219Fb367e525954DDC092854d9', // Grove x Steakhouse USDG '0xbeEfFF136E3684273e6aA75A1669B784B373A4FD', // Steakhouse Turbo USDG + '0xB97a135C344862bbacbB585A3B0Db051698CF905', // Ethena USDG Turbo + ], + }, + arc: { + morpho: [ + '0xbeef0016cb2Fd5C352ea7CA08a9f54739DFa7298', // Steakhouse Prime USDC + '0xbeef0007d5A04246F5382957035Df34f7e82102e', // Steakhouse Prime USDC + '0xbeef00be37BdE921BAE06fad223125BAB16c41D1', // Steakhouse Prime EURC ], }, solana: { From bfa068c9922ab496d94e2f3770ca48e123e2bced Mon Sep 17 00:00:00 2001 From: routebuilder Date: Mon, 12 Oct 2026 20:11:22 +0200 Subject: [PATCH 210/988] add Grove x Steakhouse USDC vault on Base (#21542) --- projects/grove/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/grove/index.js b/projects/grove/index.js index 591bf212e6d..527c8514e88 100644 --- a/projects/grove/index.js +++ b/projects/grove/index.js @@ -49,6 +49,7 @@ const morphoVaultConfigs = { base: [ '0xBeEf2d50B428675a1921bC6bBF4bfb9D8cF1461A', // grove-bbqUSDC '0xbeef0e0834849aCC03f0089F01f4F1Eeb06873C9', // steakUSDC-V2 + '0xbeef0786756810478b88982DE00F3CD7fdB8e7c7', // Grove x Steakhouse USDC ], robinhood: [ '0xBEEff039907422219Fb367e525954DDC092854d9', // Grove x Steakhouse USDG From 57dc5d9b35000cf994830ca082b9b9e1ec5f6947 Mon Sep 17 00:00:00 2001 From: Shinotsukai Date: Mon, 12 Oct 2026 19:13:59 +0100 Subject: [PATCH 211/988] moat adapter (#21578) --- projects/the-moats/index.js | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 projects/the-moats/index.js diff --git a/projects/the-moats/index.js b/projects/the-moats/index.js new file mode 100644 index 00000000000..7e1c2e34b78 --- /dev/null +++ b/projects/the-moats/index.js @@ -0,0 +1,49 @@ +const config = { + avax: { + factory: '0xD0b5249EA2f93E54B90ff0737B4d78AA13a222BC', + }, + robinhood: { + factory: '0x5CffC369eD14BFcD730031B137FbCEccd0a49560', + }, + monad: { + factory: '0xcd1901A5AB6CaA8D706D44009609f3c0E04760C4', + }, + bsc: { + factory: '0xcd1901A5AB6CaA8D706D44009609f3c0E04760C4', + }, + base: { + factory: '0xcd1901A5AB6CaA8D706D44009609f3c0E04760C4', + } +} + +async function tvl(api) { + const { factory } = config[api.chain] || {} + if (!factory) return + + // Fetch all deployed moat contracts from the factory + const moats = await api.call({ + target: factory, + abi: 'address[]:getAllDeployedContracts', + }) + + if (!moats || moats.length === 0) return + + // Fetch the staking token configured for each moat + const stakingTokens = await api.multiCall({ + calls: moats, + abi: 'address:stakingToken', + }) + + // Tally the balance of each staking token held in its corresponding moat contract + return api.sumTokens({ tokensAndOwners2: [stakingTokens, moats] }) +} + +module.exports = { + start: '2025-03-01', + methodology: + 'TVL counts the total value of staking tokens deposited and locked across all Moats', +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl } +}) From 54cc60e665c9aae2eca6af6fa900189d19e4fca8 Mon Sep 17 00:00:00 2001 From: Benoit Nolens Date: Mon, 12 Oct 2026 20:25:15 +0200 Subject: [PATCH 212/988] textile: add polygon and count vault idle balances in Aave (#21541) Co-authored-by: Claude Opus 5.5 (1M context) --- projects/textile/index.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/projects/textile/index.js b/projects/textile/index.js index 7e50baa8f46..487be5df452 100644 --- a/projects/textile/index.js +++ b/projects/textile/index.js @@ -1,4 +1,5 @@ const { cachedGraphQuery } = require("../helper/cache"); +const { nullAddress } = require("../helper/unwrapLPs"); // Textile is a non-custodial on-chain FX DEX. Market makers ("Stitch" bots) quote // both sides of each corridor from their own wallets, and swaps settle atomically @@ -11,10 +12,30 @@ const ENDPOINT = "https://api.textilecredit.com/graphql"; const CHAINS = { ethereum: 1, bsc: 56, + polygon: 137, base: 8453, celo: 42220, }; +// Some makers are Textile OperatorVaults. A vault can park idle settlement asset in +// Aave v3 through its own yield adapter (vault.yieldAdapter(), zero when off), which +// holds the aTokens (adapter.yieldToken()). On an emergency pull the adapter sends +// aTokens back to the vault, so the aToken is counted on both. +async function getYieldPositions(api, owners) { + const adapters = await api.multiCall({ abi: "address:yieldAdapter", calls: owners, permitFailure: true }); + const vaults = owners + .map((vault, i) => ({ vault, adapter: adapters[i] })) + .filter(({ adapter }) => adapter && adapter !== nullAddress); + if (!vaults.length) return []; + + // permitFailure: a non-vault maker contract could expose yieldAdapter() too; skip it rather than fail the chain + const yieldTokens = await api.multiCall({ abi: "address:yieldToken", calls: vaults.map((v) => v.adapter), permitFailure: true }); + return vaults.flatMap(({ vault, adapter }, i) => yieldTokens[i] ? [ + [yieldTokens[i], adapter], + [yieldTokens[i], vault], + ] : []); +} + async function tvl(api) { const chainId = CHAINS[api.chain]; @@ -37,12 +58,13 @@ async function tvl(api) { ...new Set(pools.flatMap((p) => [p.collateralAsset, p.debtAsset])), ]; - return api.sumTokens({ owners, tokens }); + const tokensAndOwners = await getYieldPositions(api, owners); + return api.sumTokens({ owners, tokens, tokensAndOwners }); } module.exports = { methodology: - "Textile is a non-custodial FX DEX; market makers (Stitch bots) quote from their own wallets and swaps settle atomically through a stateless reactor, so no funds sit in protocol contracts. TVL is the corridor-token inventory those makers hold on each chain, read from the Textile subgraph (makers + pools) and summed on-chain.", + "Textile is a non-custodial FX DEX; market makers (Stitch bots) quote from their own wallets and swaps settle atomically through a stateless reactor, so no funds sit in protocol contracts. TVL is the corridor-token inventory those makers hold on each chain, read from the Textile subgraph (makers + pools) and summed on-chain. For makers that are Textile OperatorVaults, idle settlement asset the vault has supplied to Aave v3 through its yield adapter is counted too, via the adapter's aToken balance.", }; Object.keys(CHAINS).forEach((chain) => { From 59bef3714cd5d8defd944fd45cb38359a06446de Mon Sep 17 00:00:00 2001 From: "@elkiyo.eth" <114088505+elkiyo@users.noreply.github.com> Date: Mon, 12 Oct 2026 13:29:22 -0500 Subject: [PATCH 213/988] AutoRange: fix Robinhood factory address, add Avalanche (#21567) Co-authored-by: Harold Giraldo Valencia Co-authored-by: Claude Opus 5.5 --- projects/autorange/index.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/projects/autorange/index.js b/projects/autorange/index.js index a73ad484e71..916e177a0b0 100644 --- a/projects/autorange/index.js +++ b/projects/autorange/index.js @@ -18,7 +18,7 @@ const config = { '0x80Fe1F70FDc272CAd6db179a5f691A169AA48636', // legacy compound V9 ], robinhood: [ - '0x58111317A2920F8b40fd9A5a7596c105530B425e', // official (compound) + '0x40b2eE9E4AcC3B218218c3e4c8C48B40C2adb311', // official (compound) '0xFb78eC2DeEF1aBEe421E981A239ae949Ae4E26B2', // legacy compound V8 ], base: [ @@ -27,6 +27,15 @@ const config = { ethereum: [ '0x1d5630534d3Eb7504fb936e141c5E2BE468FAa9e', // official (compound) ], + avax: [ + '0x866165d601406B6bAB78B431f84746d510Ee82bc', // official (compound) + ], +}; + +// Uniswap V3 NonfungiblePositionManager on chains the shared helper has no +// built-in default for. +const nftAddresses = { + avax: '0x655C406EBFa14EE2006250925e54ec43AD184f8B', }; async function tvl(api) { @@ -45,7 +54,10 @@ async function tvl(api) { const ownerTokens = vaults.map((v, i) => [[token0s[i], token1s[i]], v]); - await sumTokens2({ api, ownerTokens, owners: vaults, resolveUniV3: true }); + const nftAddress = nftAddresses[api.chain]; + const uniV3ExtraConfig = nftAddress ? { nftAddress } : undefined; + + await sumTokens2({ api, ownerTokens, owners: vaults, resolveUniV3: true, uniV3ExtraConfig }); } module.exports = { @@ -56,4 +68,5 @@ module.exports = { robinhood: { tvl }, base: { tvl }, ethereum: { tvl }, + avax: { tvl }, }; From 31fe0b3cf714afe03574078519b3e5281f82735c Mon Sep 17 00:00:00 2001 From: routebuilder Date: Mon, 12 Oct 2026 20:30:07 +0200 Subject: [PATCH 214/988] reserve: separate log cache keys for folio and governed-folio discovery (#21499) --- projects/reserve/helper.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/reserve/helper.js b/projects/reserve/helper.js index 788c55d6dac..267324a748a 100644 --- a/projects/reserve/helper.js +++ b/projects/reserve/helper.js @@ -170,6 +170,7 @@ const _getFolioLogs = async (api, folioDeployers) => { eventAbi: "event FolioDeployed(address indexed folioOwner, address indexed folio, address folioAdmin)", fromBlock: deployer.startBlock, onlyArgs: true, + extraKey: "folio-deployed", }).catch(() => []), getLogs({ api, @@ -177,6 +178,7 @@ const _getFolioLogs = async (api, folioDeployers) => { eventAbi: "event GovernedFolioDeployed(address indexed stToken, address indexed folio, address ownerGovernor, address ownerTimelock, address tradingGovernor, address tradingTimelock)", fromBlock: deployer.startBlock, onlyArgs: true, + extraKey: "governed-folio-deployed", }).catch(() => []) ]) ); From 6cd55c3ef76316088578d6d70559d22604ca1ab0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 12 Oct 2026 20:34:20 +0200 Subject: [PATCH 215/988] more conservative --- projects/pancake-swap/pcs-v2-onchain.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/pancake-swap/pcs-v2-onchain.js b/projects/pancake-swap/pcs-v2-onchain.js index b4d68303351..e4e7a950343 100644 --- a/projects/pancake-swap/pcs-v2-onchain.js +++ b/projects/pancake-swap/pcs-v2-onchain.js @@ -6,7 +6,7 @@ module.exports = { tvl: async (api) => { if (!process.env.PCS_PULL) throw new Error("PCS_PULL environment variable not set. Please set it to 'true' to enable TVL calculation.") - const tvlFunction = getUniTVL({ factory: '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73', useDefaultCoreAssets: true, skipUnknownTokens: true, waitBetweenCalls: 1000, queryBatched: 42000, memoryOptimization: true, }) + const tvlFunction = getUniTVL({ factory: '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73', useDefaultCoreAssets: true, skipUnknownTokens: true, waitBetweenCalls: 5000, queryBatched: 10000, memoryOptimization: true, }) return tvlFunction(api) } }, From 257ce61b207ec84cde476231fd273405834c4cd4 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Mon, 12 Oct 2026 20:52:52 +0200 Subject: [PATCH 216/988] Add 30s timeout to morpho-blue exclusions and sunswap-v4 pool list fetches (#21546) --- projects/morpho-blue/exclusions.js | 2 +- projects/sunswap-v4/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/morpho-blue/exclusions.js b/projects/morpho-blue/exclusions.js index ca8ab361fbe..385c9e97a00 100644 --- a/projects/morpho-blue/exclusions.js +++ b/projects/morpho-blue/exclusions.js @@ -48,7 +48,7 @@ async function getExclusions() { const kinds = Object.keys(KINDS) const bundle = await getConfig('morpho-blue/exclusions', undefined, { fetcher: async () => { - const files = await Promise.all(kinds.map(f => get(`${BASE_URL}/${f}.csv`))) + const files = await Promise.all(kinds.map(f => get(`${BASE_URL}/${f}.csv`, { timeout: 30000 }))) const fetched = {} kinds.forEach((k, i) => { const rows = parseCsv(files[i], KINDS[k]) diff --git a/projects/sunswap-v4/index.js b/projects/sunswap-v4/index.js index 38a4bd709ea..37f70311838 100644 --- a/projects/sunswap-v4/index.js +++ b/projects/sunswap-v4/index.js @@ -31,7 +31,7 @@ async function getTokens() { const seenPools = new Set() // Fetch one page past MAX_PAGES: it must be empty, otherwise the list was cut off and TVL would be partial. for (let pageNo = 1; pageNo <= MAX_PAGES + 1; pageNo++) { - const { data } = await get(`${POOL_LIST_API}&pageNo=${pageNo}&pageSize=${PAGE_SIZE}`) + const { data } = await get(`${POOL_LIST_API}&pageNo=${pageNo}&pageSize=${PAGE_SIZE}`, { timeout: 30000 }) if (!Array.isArray(data)) throw new Error(`sunswap-v4: unexpected pool list response for page ${pageNo}`) if (!data.length) break // an empty page is the end of the list if (pageNo > MAX_PAGES) throw new Error(`sunswap-v4: pool list has more than ${MAX_PAGES} pages`) From f899588ba5e2fc71203a5b51e114a6163e02b167 Mon Sep 17 00:00:00 2001 From: Ravenhood Date: Mon, 12 Oct 2026 20:53:38 +0200 Subject: [PATCH 217/988] Add Flock Manager TVL adapter (leveraged farming, Robinhood Chain) (#21540) Co-authored-by: dev256lag Co-authored-by: FelixBruguera --- projects/flock-manager/index.js | 110 ++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 projects/flock-manager/index.js diff --git a/projects/flock-manager/index.js b/projects/flock-manager/index.js new file mode 100644 index 00000000000..2d106ec7604 --- /dev/null +++ b/projects/flock-manager/index.js @@ -0,0 +1,110 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +// Flock Manager on Robinhood Chain: auto-compounding gauge LP vaults, plus a +// Tarot-core lending layer that takes those vault shares as collateral. +// +// Value flows LP -> vault (staked in the DEX gauge) -> vault shares -> +// collateral -> borrow from the borrowables. Counting both the vault LP and +// the collateral would count the same assets twice, because the collateral +// contract holds nothing but the vault share wrapper. So TVL is: +// +// the LP the vaults have staked, unwrapped to its two underlying tokens +// + the idle underlying sitting in each borrowable (lender supply not lent) +// +// and the collateral contracts are never summed. Vault LP that pairs with RVH, +// the parent protocol's token, is reported under pool2 instead of tvl. +// +// The Ravenhood lending vaults (rvhUSDG/rvhWETH/rvhUP) are deliberately +// absent: they are depositors INTO the borrowables, so their balances are +// already inside the borrowable figures above. +const LEND_FACTORY = '0x8F50BCb1f34D22adAe05955E1994b0153603cB16' +const VAULT_FACTORY = '0x4c2302416bf50B4F11dDEE7A8feA2D1BA96d8EfE' +const RVH = '0x96765066f6a040a21EB027167D2315B707c82633' + +const abi = { + allVaultsLength: 'uint256:allVaultsLength', + allVaults: 'function allVaults(uint256) view returns (address)', + allLendingPoolsLength: 'uint256:allLendingPoolsLength', + allLendingPools: 'function allLendingPools(uint256) view returns (address)', + getLendingPool: 'function getLendingPool(address) view returns (bool initialized, uint24 lendingPoolId, address collateral, address borrowable0, address borrowable1)', + underlying: 'address:underlying', + gauge: 'address:gauge', + token0: 'address:token0', + token1: 'address:token1', + totalBorrows: 'function totalBorrows() view returns (uint112)', +} + +// Both factories enumerate, so markets and vaults are discovered rather than +// listed here. A new market needs no change to this adapter. +async function getBorrowables(api) { + const pools = await api.fetchList({ + lengthAbi: abi.allLendingPoolsLength, + itemAbi: abi.allLendingPools, + target: LEND_FACTORY, + }) + const poolData = await api.multiCall({ target: LEND_FACTORY, abi: abi.getLendingPool, calls: pools }) + const borrowables = [] + poolData.forEach((pool) => { + if (pool.initialized) borrowables.push(pool.borrowable0, pool.borrowable1) + }) + return borrowables +} + +// The vaults stake their LP in the DEX gauge, so the LP is not held by the +// vault address. Read each vault's gauge balance, then let resolveLP unwrap it. +async function addVaultLp(api, isPool2) { + const vaults = await api.fetchList({ + lengthAbi: abi.allVaultsLength, + itemAbi: abi.allVaults, + target: VAULT_FACTORY, + }) + const lps = await api.multiCall({ abi: abi.underlying, calls: vaults }) + const gauges = await api.multiCall({ abi: abi.gauge, calls: vaults }) + const token0s = await api.multiCall({ abi: abi.token0, calls: lps }) + const token1s = await api.multiCall({ abi: abi.token1, calls: lps }) + const staked = await api.multiCall({ + abi: 'erc20:balanceOf', + calls: vaults.map((vault, i) => ({ target: gauges[i], params: vault })), + }) + + const isRvh = (token) => token.toLowerCase() === RVH.toLowerCase() + lps.forEach((lp, i) => { + const hasRvh = isRvh(token0s[i]) || isRvh(token1s[i]) + if (hasRvh === isPool2) api.add(lp, staked[i]) + }) + return sumTokens2({ api, resolveLP: true }) +} + +async function tvl(api) { + await addVaultLp(api, false) + + // Lending side. Only the idle balance: anything lent out is reported under + // borrowed instead, so the two never overlap. + const borrowables = await getBorrowables(api) + const tokens = await api.multiCall({ abi: abi.underlying, calls: borrowables }) + return sumTokens2({ api, tokensAndOwners: tokens.map((token, i) => [token, borrowables[i]]) }) +} + +async function pool2(api) { + return addVaultLp(api, true) +} + +async function borrowed(api) { + const borrowables = await getBorrowables(api) + const tokens = await api.multiCall({ abi: abi.underlying, calls: borrowables }) + const debts = await api.multiCall({ abi: abi.totalBorrows, calls: borrowables }) + api.add(tokens, debts) + return api.getBalances() +} + +module.exports = { + timetravel: true, + doublecounted: true, + // Both factories went live on 2026-10-01 (blocks 77687484 and 77687985) and + // the first market followed at 77688034. Starting on the 2nd rather than + // the 1st so no historical query lands on a block where the factories have + // no code yet, which would revert rather than report zero. + start: '2026-10-02', + methodology: 'TVL is the up-v2 LP staked by the Flock Manager auto-compounding vaults, read from each vault\'s gauge balance and unwrapped into its underlying tokens, plus the idle underlying held by each Flock Lend borrowable. Vault LP paired with RVH, the protocol\'s token, is reported as pool2. Collateral contracts are not counted because they hold only vault shares, a wrapper around LP already counted. The LP is also counted by the up-v2 listing, so the protocol is marked as double counted. Borrowed is the outstanding debt of each borrowable and is reported separately, not included in TVL.', + robinhood: { tvl, pool2, borrowed }, +} From 139b24cdfac8be0b2b5c3c88aba20923a448fe2f Mon Sep 17 00:00:00 2001 From: 0xfff <125829532+keyuyuan@users.noreply.github.com> Date: Mon, 12 Oct 2026 15:48:56 -0400 Subject: [PATCH 218/988] Add HedgeHood Stock Yield (Robinhood Chain covered-call vault) (#21559) Co-authored-by: Claude Opus 5.5 --- projects/hedgehood-stock-yield/index.js | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 projects/hedgehood-stock-yield/index.js diff --git a/projects/hedgehood-stock-yield/index.js b/projects/hedgehood-stock-yield/index.js new file mode 100644 index 00000000000..2082b3ac038 --- /dev/null +++ b/projects/hedgehood-stock-yield/index.js @@ -0,0 +1,38 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking') + +// Stock Yield by HedgeHood: weekly covered-call vaults on Robinhood Chain stock tokens. +// Each vault (BrokerEpochVault) holds depositors' stock, sells one weekly call against it to a quoted +// option buyer and pays the premium out in USDG. Source verified on Sourcify, e.g. +// https://sourcify.dev/server/v2/contract/4663/0xe35B7D7bf1212b89478ddAba2946ADEd59BEC0a9 +const VAULTS = [ + '0xe35B7D7bf1212b89478ddAba2946ADEd59BEC0a9', // NVDA Printer (hNVDA), deployed at block 84792706 +] +// Deposits require staking HEDGE in this gate +const HEDGE = '0x3f9108a3bECa998C14c6dda822a7e8EaEb88E20D' +const HEDGE_STAKING_GATE = '0x48ae41142bb0Ddd18DC49BD659b55207FAcE64d8' + +async function tvl(api) { + const stocks = await api.multiCall({ abi: 'address:stock', calls: VAULTS }) + // managedBalances = depositor stock (active + queued deposits + redeemed but unclaimed) and earned, unclaimed USDG + // premiums. It leaves out the option buyer's escrowed premium before settlement, the buyer's exercised stock, + // fees owed to the protocol and unsolicited transfers. + const balances = await api.multiCall({ + abi: 'function managedBalances() view returns (uint256 stockAmount, uint256 usdgAmount)', + calls: VAULTS, + }) + balances.forEach(({ stockAmount, usdgAmount }, i) => { + api.add(stocks[i], stockAmount) + api.add(ADDRESSES.robinhood.USDG, usdgAmount) + }) +} + +module.exports = { + methodology: + "TVL counts what depositors own in each Stock Yield vault, read from the vault's managedBalances(): the stock token (active, queued for the next epoch, and redeemed but not yet claimed) plus earned premiums not yet claimed, in USDG. The option buyer's premium is counted once the epoch settles and it is credited to depositors; the protocol fee, the buyer's exercised stock and the separately funded exit pool are excluded. Staking counts HEDGE staked in the deposit gate.", + start: 1791614176, // 2026-10-10 06:36:16 UTC, first vault's deployment block 84792706 + robinhood: { + tvl, + staking: staking(HEDGE_STAKING_GATE, HEDGE), + }, +} From 961f881452c230519dac200970f202c92ad687e2 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Mon, 12 Oct 2026 21:54:55 +0200 Subject: [PATCH 219/988] Floor echo-lending TVL balances at zero (#21554) --- projects/echo-lending/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/echo-lending/index.js b/projects/echo-lending/index.js index 76d7fbbb59e..c314ec8d2ef 100644 --- a/projects/echo-lending/index.js +++ b/projects/echo-lending/index.js @@ -32,6 +32,7 @@ async function getData() { item.balance -= +aTokenBalance - +variableDebt item.debt -= +variableDebt } + item.balance = Math.max(0, item.balance) } return resources.filter(i => i.uToken); } From 6830a556a0f55504c7991f47544e4b001a9930f7 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Mon, 12 Oct 2026 22:19:52 +0200 Subject: [PATCH 220/988] Remove pawnfi-lending phantom borrowed figure from 2023 exploit bad debt (#21548) Co-authored-by: FelixBruguera --- projects/pawnfi-lending/index.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/projects/pawnfi-lending/index.js b/projects/pawnfi-lending/index.js index e610e5d3865..341238b5ced 100644 --- a/projects/pawnfi-lending/index.js +++ b/projects/pawnfi-lending/index.js @@ -17,16 +17,23 @@ async function getPawnNFTTokens(api) { return logs.map(log => log.pieceToken) } +// Account that drained the pools in the June 2023 exploit (borrows on 2023-06-17 across ETH, WBTC, USDT +// and USDC). Its debt will never be repaid, so it is excluded from borrowed. +const EXPLOITER = '0xb618d91fe014bfcb9c8d440468b6c78e9ada9da1' + async function borrowed(api) { const blacklistedTokens = await getPawnNFTTokens(api) const items = await api.call({ abi: ABI.cTokenMetadataAll, target: Lending, params: [LendCToken], }) - items.forEach((v) => { - if (blacklistedTokens.includes(v.underlyingAssetAddress)) return - api.add(v.underlyingAssetAddress, v.totalBorrows) + const markets = items.filter(i => !blacklistedTokens.includes(i.underlyingAssetAddress)) + const cTokens = markets.map(i => i.cToken) + const totalBorrows = await api.multiCall({ abi: 'uint256:totalBorrows', calls: cTokens }) + const exploiterDebt = await api.multiCall({ abi: 'function borrowBalanceStored(address) view returns (uint256)', calls: cTokens.map(target => ({ target, params: [EXPLOITER] })) }) + markets.forEach((m, i) => { + const debt = BigInt(totalBorrows[i]) - BigInt(exploiterDebt[i]) + if (debt > 0n) api.add(m.underlyingAssetAddress, debt.toString()) }) } - async function tvl(api) { const blacklistedTokens = await getPawnNFTTokens(api) const items = await api.call({ abi: ABI.cTokenMetadataAll, target: Lending, params: [LendCToken], }) @@ -38,6 +45,8 @@ module.exports = mergeExports([{ ethereum: { tvl, borrowed }, }, nftTvl]) +module.exports.methodology = 'TVL is the underlying held by the lending markets plus the NFTs held by the protocol. Borrowed is outstanding debt in each market, excluding the debt of the June 2023 exploiter, which is bad debt.' + module.exports.hallmarks = [ ['2023-06-16', 'Protocol was exploited'], ] From eaabd8c4fe756e7dc90d6e1547aa31efbba2eebf Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 12 Oct 2026 22:20:00 +0200 Subject: [PATCH 221/988] pcs: use graph --- projects/pancake-swap/pcs-v2-onchain.js | 32 +++++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/projects/pancake-swap/pcs-v2-onchain.js b/projects/pancake-swap/pcs-v2-onchain.js index e4e7a950343..4a22ade23ac 100644 --- a/projects/pancake-swap/pcs-v2-onchain.js +++ b/projects/pancake-swap/pcs-v2-onchain.js @@ -1,13 +1,35 @@ +const { get } = require('../helper/http') const { getUniTVL } = require('../helper/unknownTokens') +// same data as the TVL chart on https://pancakeswap.finance/info +const INFO_TVL_URL = 'https://explorer.pancakeswap.com/api/cached/protocol/chart/v2/bsc/tvl?groupBy=1D' +const MAX_AGE = 2 * 24 * 3600 + +async function infoTvl(api) { + const data = await get(INFO_TVL_URL) + const latest = data.at(-1) + const age = api.timestamp - Date.parse(latest.bucket) / 1e3 + if (!(+latest.tvlUSD > 0) || age > MAX_AGE) throw new Error(`stale or empty pancakeswap info tvl: ${JSON.stringify(latest)}`) + api.addUSDValue(+latest.tvlUSD) +} + +async function onchainTvl(api) { + if (!process.env.PCS_PULL) + throw new Error("PCS_PULL environment variable not set. Please set it to 'true' to enable TVL calculation.") + const tvlFunction = getUniTVL({ factory: '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73', useDefaultCoreAssets: true, skipUnknownTokens: true, waitBetweenCalls: 5000, queryBatched: 10000, memoryOptimization: true, }) + return tvlFunction(api) +} module.exports = { bsc: { tvl: async (api) => { - if (!process.env.PCS_PULL) - throw new Error("PCS_PULL environment variable not set. Please set it to 'true' to enable TVL calculation.") - const tvlFunction = getUniTVL({ factory: '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73', useDefaultCoreAssets: true, skipUnknownTokens: true, waitBetweenCalls: 5000, queryBatched: 10000, memoryOptimization: true, }) - return tvlFunction(api) + try { + return await infoTvl(api) + } catch (e) { + throw e + console.error('pancakeswap info tvl failed, falling back to on-chain:', e.message) + return onchainTvl(api) + } } }, -} \ No newline at end of file +} From 1b5607098038149666812c685ad7e3577d1d6b45 Mon Sep 17 00:00:00 2001 From: OxForged Date: Mon, 12 Oct 2026 13:33:24 -0700 Subject: [PATCH 222/988] add DeepCore TVL (#21560) Co-authored-by: Claude Opus 5.5 --- projects/deepcore/config.js | 99 +++++++++++++++++++++++ projects/deepcore/index.js | 155 ++++++++++++++++++++++++++++++++++++ 2 files changed, 254 insertions(+) create mode 100644 projects/deepcore/config.js create mode 100644 projects/deepcore/index.js diff --git a/projects/deepcore/config.js b/projects/deepcore/config.js new file mode 100644 index 00000000000..f8f45b9059b --- /dev/null +++ b/projects/deepcore/config.js @@ -0,0 +1,99 @@ +/** + * DeepCore Protocol - deployment registry (TVL adapter). + * + * Adding a chain is ONE entry here plus the matching entry in the dimension + * adapter. The two repositories cannot import from each other, so this file is a + * hand-maintained mirror of `chainConfig` in dimension-adapters + * `dexs/deepcore.ts`; keep every address, block and start date identical. + * + * DeepCore uses the same contract addresses on every chain. `fromBlock` is the + * block of the CLPoolManager deployment receipt on that chain (BinPoolManager + * follows it) - the floor for the Initialize scan. `start` is that block's UTC + * date, as a 'YYYY-MM-DD' string. + * + * `blacklistedTokens` are tokens the adapter must never report a balance for + * (upstream's own `sumTokens2` parameter): tokens with no economic meaning by + * construction, such as a protocol's own test tokens. None today. + */ + +/** + * Tokens with no economic meaning by construction, per chain slug. Empty: + * DeepCore has no test tokens on any chain it is deployed to. + * + * This is NOT where to put a token that is real but thinly traded. + */ +const DEEPCORE_TEST_TOKENS = {}; + +const VAULT = "0x405515DB94aDBF3A827349f2C096809639581D09"; +const CL_POOL_MANAGER = "0xE23978EBBf83Eab3f0226674d1183b5D3ED32FeC"; +const BIN_POOL_MANAGER = "0x004a786C4cB79358e2f86467B0eBFD87028648F4"; + +// HyperEVM is DefiLlama's "hyperliquid"; BNB Chain "bsc"; Robinhood Chain "robinhood". +const DEPLOYMENTS = { + hyperliquid: { + chainId: 999, + vault: VAULT, + clPoolManager: CL_POOL_MANAGER, + binPoolManager: BIN_POOL_MANAGER, + fromBlock: 48129462, + start: "2026-10-10", + }, + bsc: { + chainId: 56, + vault: VAULT, + clPoolManager: CL_POOL_MANAGER, + binPoolManager: BIN_POOL_MANAGER, + fromBlock: 126766127, + start: "2026-10-10", + }, + base: { + chainId: 8453, + vault: VAULT, + clPoolManager: CL_POOL_MANAGER, + binPoolManager: BIN_POOL_MANAGER, + fromBlock: 52409470, + start: "2026-10-10", + }, + robinhood: { + chainId: 4663, + vault: VAULT, + clPoolManager: CL_POOL_MANAGER, + binPoolManager: BIN_POOL_MANAGER, + fromBlock: 84732137, + start: "2026-10-10", + }, +}; + +/** + * The helpers over a deployment table. Built from `DEPLOYMENTS` for export; the + * factory is exported too so the offline tests can drive the exact same logic + * against a synthetic table. + */ +const buildRegistry = (deployments) => { + /** A chain counts as live once it has a Vault, a pool manager and a start date. */ + const isConfigured = (chain) => { + const d = deployments[chain]; + return Boolean( + d && d.vault && (d.clPoolManager || d.binPoolManager) && d.start, + ); + }; + + /** Chains the adapter exports: every row with real contracts, and only those. */ + const enabledChains = () => Object.keys(deployments).filter(isConfigured); + + /** Both pool managers for a chain, skipping any that is not deployed. */ + const poolManagers = (chain) => + [deployments[chain].clPoolManager, deployments[chain].binPoolManager].filter(Boolean); + + /** Tokens never to report for a chain, lower-cased. Empty for most chains. */ + const blacklistedTokens = (chain) => + (deployments[chain].blacklistedTokens || []).map((t) => t.toLowerCase()); + + return { DEPLOYMENTS: deployments, isConfigured, enabledChains, poolManagers, blacklistedTokens }; +}; + +module.exports = { + DEEPCORE_TEST_TOKENS, + buildRegistry, + ...buildRegistry(DEPLOYMENTS), +}; diff --git a/projects/deepcore/index.js b/projects/deepcore/index.js new file mode 100644 index 00000000000..17c2c8a52fd --- /dev/null +++ b/projects/deepcore/index.js @@ -0,0 +1,155 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getLogs2 } = require("../helper/cache/getLogs"); +const { nullAddress } = require("../helper/tokenMapping"); +const { sliceIntoChunks } = require("../helper/utils"); +const { + DEPLOYMENTS, + enabledChains, + poolManagers, + blacklistedTokens, +} = require("./config"); + +/** + * DeepCore Protocol - TVL. + * + * DeepCore is a Uniswap-v4-style singleton AMM forked from PancakeSwap Infinity. The + * shape that matters here: a single `Vault` custodies EVERY token in the protocol. + * The two pool managers - `CLPoolManager` (concentrated liquidity) and + * `BinPoolManager` (liquidity book) - register with the Vault as "apps" and never + * hold funds; the Vault tracks per-app balances internally in `reservesOfApp`, but + * the ERC20 balance lives on the Vault. + * + * So TVL is the Vault's token balances. There is nothing to enumerate and sum over + * per-pool contracts the way a v2-style DEX would, and reading balances off the + * pool managers would return zero. + * + * What still has to be enumerated is the TOKEN UNIVERSE - which tokens to ask the + * Vault about. That comes from the `Initialize` logs of both pool managers, which + * carry `currency0`/`currency1` for every pool ever created. Native currency is the + * zero address in a pool key, and `sumTokens2` routes `nullAddress` to + * `eth_getBalance` on the owner, so it needs no special handling. + * + * Hooks: DeepCore hooks can take their own delta and custody tokens, exactly as in + * Uniswap v4. Any pool with a non-null `hooks` address therefore also gets its pair + * summed against that hook, mirroring `projects/uniswap-v4`. The hook address is + * taken from each pool's OWN Initialize log, never from a "current hook" constant: + * `poolKey.hooks` is part of the pool id, so a pool stays bound to the hook it was + * created with even after a newer version of that hook exists. (A DeepCore hook's + * accrued fees are ERC-6909 claims INSIDE the Vault until someone calls `redeem`, + * so they are already inside the Vault's ERC20 balance; summing the hook's own + * balance as well cannot double count, because tokens sit in exactly one of the + * two places at a time.) + * + * --------------------------------------------------------------------------- + * UNPRICED TOKENS ARE EXCLUDED ON PURPOSE + * --------------------------------------------------------------------------- + * `config.js` names, per chain, tokens that must never be reported: tokens with no + * economic meaning by construction, such as a protocol's own test tokens (none + * today). They are dropped BEFORE the + * balance read, and the same list is passed to `sumTokens2` as + * `blacklistedTokens` so upstream's own filter agrees. A test balance is never + * reported - not as a balance the price server happens to value at nothing today + * and might value at something tomorrow. No token is ever given a price + * here, and none defaults to $1: pricing is upstream's job, and a token upstream + * cannot price contributes nothing rather than a guess. + * + * --------------------------------------------------------------------------- + * TOPIC0 COLLISION + * --------------------------------------------------------------------------- + * The Vault, both pool managers and the shared `ProtocolFees` base declare 34 + * events but only 22 distinct signatures - `ProtocolFeeUpdated`, `Paused`, + * `Unpaused`, `ProtocolFeeControllerUpdated`, `DynamicLPFeeUpdated` and + * `OwnershipTransferred` are byte-identical across contracts and collide on topic0. + * The two `Initialize` events do not collide today (CL carries sqrtPriceX96+tick, + * Bin carries activeId) but nothing guarantees that. Each `getLogs2` call below is + * therefore scoped to ONE pool manager address and decoded with that manager's own + * abi. Never query these by topic alone. + * + * --------------------------------------------------------------------------- + * WHAT IS EXPORTED + * --------------------------------------------------------------------------- + * Exactly the chains in `config.js` that have contracts: HyperEVM ("hyperliquid"), + * BNB Chain ("bsc"), Base ("base") and Robinhood Chain ("robinhood"). A row without + * a Vault, a pool manager and a start date is never exported, so the adapter never + * reports $0 TVL as a fact about a deployment that does not exist. + */ + +const CL_INITIALIZE_EVENT = + "event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint160 sqrtPriceX96, int24 tick)"; +const BIN_INITIALIZE_EVENT = + "event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint24 activeId)"; + +const initializeEventFor = (chain, manager) => + manager.toLowerCase() === String(DEPLOYMENTS[chain].binPoolManager).toLowerCase() + ? BIN_INITIALIZE_EVENT + : CL_INITIALIZE_EVENT; + +async function tvl(api) { + const chain = api.chain; + const { vault, fromBlock } = DEPLOYMENTS[chain]; + const excluded = new Set(blacklistedTokens(chain)); + + const tokenSet = new Set(); + // hook -> the tokens of every pool bound to it. Keyed so a hook shared by many + // pools is asked about each token ONCE: every DeepCore launch pool on a chain uses + // the same launch guard with the same quote currency, and one [pair, hook] entry + // per pool would sum that guard's quote balance once per launch (unless upstream + // happens to deduplicate owner/token pairs, which this file does not rely on). + const hookTokens = new Map(); + + for (const manager of poolManagers(chain)) { + const logs = await getLogs2({ + api, + target: manager, + fromBlock, + eventAbi: initializeEventFor(chain, manager), + }); + + for (const log of logs) { + // Excluded tokens never reach a balance call, so a pool made only of them + // contributes nothing - not a zero, nothing. + const pair = [log.currency0, log.currency1] + .map((t) => String(t).toLowerCase()) + .filter((t) => !excluded.has(t)); + for (const token of pair) tokenSet.add(token); + // A hook may hold its own balances (hook deltas / hook-owned liquidity). + // The hook comes from THIS pool's log, so a pool bound to an older hook + // deployment is still counted against that hook. + const hook = String(log.hooks).toLowerCase(); + if (pair.length && hook !== nullAddress) { + if (!hookTokens.has(hook)) hookTokens.set(hook, new Set()); + for (const token of pair) hookTokens.get(hook).add(token); + } + } + } + + const ownerTokens = []; + for (const [hook, tokens] of hookTokens) ownerTokens.push([Array.from(tokens), hook]); + + // Everything else sits on the Vault. Chunked so a chain with many pools does not + // build one multicall with tens of thousands of entries. + for (const tokens of sliceIntoChunks(Array.from(tokenSet), 1000)) { + ownerTokens.push([tokens, vault]); + } + + // The same exclusion is handed to sumTokens2 so upstream's filter and ours can + // never disagree about a token that slipped in through another path. + return sumTokens2({ + api, + ownerTokens, + permitFailure: true, + blacklistedTokens: Array.from(excluded), + }); +} + +module.exports = { + methodology: + "DeepCore is a singleton AMM: one Vault custodies every token for the whole protocol, and pool managers hold nothing. TVL is the Vault's balance of every token that has appeared as currency0 or currency1 in an Initialize event from CLPoolManager or BinPoolManager, plus any balance held by the hook contract each pool was created with. Native currency appears as the zero address in a pool key and is read as the Vault's native balance. Tokens with no market by construction (a protocol's own test tokens) are excluded by address and not counted at any value.", +}; + +for (const chain of enabledChains()) { + module.exports[chain] = { + tvl, + start: DEPLOYMENTS[chain].start, + }; +} From a2d551c9a9782b0e60ab79f6c0937d67dcf4fdfe Mon Sep 17 00:00:00 2001 From: Dani Date: Mon, 12 Oct 2026 22:40:36 +0200 Subject: [PATCH 223/988] deepcore: inline config, root start, trim comments (#21588) --- projects/deepcore/config.js | 99 -------------------- projects/deepcore/index.js | 175 ++++++++---------------------------- 2 files changed, 38 insertions(+), 236 deletions(-) delete mode 100644 projects/deepcore/config.js diff --git a/projects/deepcore/config.js b/projects/deepcore/config.js deleted file mode 100644 index f8f45b9059b..00000000000 --- a/projects/deepcore/config.js +++ /dev/null @@ -1,99 +0,0 @@ -/** - * DeepCore Protocol - deployment registry (TVL adapter). - * - * Adding a chain is ONE entry here plus the matching entry in the dimension - * adapter. The two repositories cannot import from each other, so this file is a - * hand-maintained mirror of `chainConfig` in dimension-adapters - * `dexs/deepcore.ts`; keep every address, block and start date identical. - * - * DeepCore uses the same contract addresses on every chain. `fromBlock` is the - * block of the CLPoolManager deployment receipt on that chain (BinPoolManager - * follows it) - the floor for the Initialize scan. `start` is that block's UTC - * date, as a 'YYYY-MM-DD' string. - * - * `blacklistedTokens` are tokens the adapter must never report a balance for - * (upstream's own `sumTokens2` parameter): tokens with no economic meaning by - * construction, such as a protocol's own test tokens. None today. - */ - -/** - * Tokens with no economic meaning by construction, per chain slug. Empty: - * DeepCore has no test tokens on any chain it is deployed to. - * - * This is NOT where to put a token that is real but thinly traded. - */ -const DEEPCORE_TEST_TOKENS = {}; - -const VAULT = "0x405515DB94aDBF3A827349f2C096809639581D09"; -const CL_POOL_MANAGER = "0xE23978EBBf83Eab3f0226674d1183b5D3ED32FeC"; -const BIN_POOL_MANAGER = "0x004a786C4cB79358e2f86467B0eBFD87028648F4"; - -// HyperEVM is DefiLlama's "hyperliquid"; BNB Chain "bsc"; Robinhood Chain "robinhood". -const DEPLOYMENTS = { - hyperliquid: { - chainId: 999, - vault: VAULT, - clPoolManager: CL_POOL_MANAGER, - binPoolManager: BIN_POOL_MANAGER, - fromBlock: 48129462, - start: "2026-10-10", - }, - bsc: { - chainId: 56, - vault: VAULT, - clPoolManager: CL_POOL_MANAGER, - binPoolManager: BIN_POOL_MANAGER, - fromBlock: 126766127, - start: "2026-10-10", - }, - base: { - chainId: 8453, - vault: VAULT, - clPoolManager: CL_POOL_MANAGER, - binPoolManager: BIN_POOL_MANAGER, - fromBlock: 52409470, - start: "2026-10-10", - }, - robinhood: { - chainId: 4663, - vault: VAULT, - clPoolManager: CL_POOL_MANAGER, - binPoolManager: BIN_POOL_MANAGER, - fromBlock: 84732137, - start: "2026-10-10", - }, -}; - -/** - * The helpers over a deployment table. Built from `DEPLOYMENTS` for export; the - * factory is exported too so the offline tests can drive the exact same logic - * against a synthetic table. - */ -const buildRegistry = (deployments) => { - /** A chain counts as live once it has a Vault, a pool manager and a start date. */ - const isConfigured = (chain) => { - const d = deployments[chain]; - return Boolean( - d && d.vault && (d.clPoolManager || d.binPoolManager) && d.start, - ); - }; - - /** Chains the adapter exports: every row with real contracts, and only those. */ - const enabledChains = () => Object.keys(deployments).filter(isConfigured); - - /** Both pool managers for a chain, skipping any that is not deployed. */ - const poolManagers = (chain) => - [deployments[chain].clPoolManager, deployments[chain].binPoolManager].filter(Boolean); - - /** Tokens never to report for a chain, lower-cased. Empty for most chains. */ - const blacklistedTokens = (chain) => - (deployments[chain].blacklistedTokens || []).map((t) => t.toLowerCase()); - - return { DEPLOYMENTS: deployments, isConfigured, enabledChains, poolManagers, blacklistedTokens }; -}; - -module.exports = { - DEEPCORE_TEST_TOKENS, - buildRegistry, - ...buildRegistry(DEPLOYMENTS), -}; diff --git a/projects/deepcore/index.js b/projects/deepcore/index.js index 17c2c8a52fd..581f001f24b 100644 --- a/projects/deepcore/index.js +++ b/projects/deepcore/index.js @@ -2,154 +2,55 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); const { getLogs2 } = require("../helper/cache/getLogs"); const { nullAddress } = require("../helper/tokenMapping"); const { sliceIntoChunks } = require("../helper/utils"); -const { - DEPLOYMENTS, - enabledChains, - poolManagers, - blacklistedTokens, -} = require("./config"); -/** - * DeepCore Protocol - TVL. - * - * DeepCore is a Uniswap-v4-style singleton AMM forked from PancakeSwap Infinity. The - * shape that matters here: a single `Vault` custodies EVERY token in the protocol. - * The two pool managers - `CLPoolManager` (concentrated liquidity) and - * `BinPoolManager` (liquidity book) - register with the Vault as "apps" and never - * hold funds; the Vault tracks per-app balances internally in `reservesOfApp`, but - * the ERC20 balance lives on the Vault. - * - * So TVL is the Vault's token balances. There is nothing to enumerate and sum over - * per-pool contracts the way a v2-style DEX would, and reading balances off the - * pool managers would return zero. - * - * What still has to be enumerated is the TOKEN UNIVERSE - which tokens to ask the - * Vault about. That comes from the `Initialize` logs of both pool managers, which - * carry `currency0`/`currency1` for every pool ever created. Native currency is the - * zero address in a pool key, and `sumTokens2` routes `nullAddress` to - * `eth_getBalance` on the owner, so it needs no special handling. - * - * Hooks: DeepCore hooks can take their own delta and custody tokens, exactly as in - * Uniswap v4. Any pool with a non-null `hooks` address therefore also gets its pair - * summed against that hook, mirroring `projects/uniswap-v4`. The hook address is - * taken from each pool's OWN Initialize log, never from a "current hook" constant: - * `poolKey.hooks` is part of the pool id, so a pool stays bound to the hook it was - * created with even after a newer version of that hook exists. (A DeepCore hook's - * accrued fees are ERC-6909 claims INSIDE the Vault until someone calls `redeem`, - * so they are already inside the Vault's ERC20 balance; summing the hook's own - * balance as well cannot double count, because tokens sit in exactly one of the - * two places at a time.) - * - * --------------------------------------------------------------------------- - * UNPRICED TOKENS ARE EXCLUDED ON PURPOSE - * --------------------------------------------------------------------------- - * `config.js` names, per chain, tokens that must never be reported: tokens with no - * economic meaning by construction, such as a protocol's own test tokens (none - * today). They are dropped BEFORE the - * balance read, and the same list is passed to `sumTokens2` as - * `blacklistedTokens` so upstream's own filter agrees. A test balance is never - * reported - not as a balance the price server happens to value at nothing today - * and might value at something tomorrow. No token is ever given a price - * here, and none defaults to $1: pricing is upstream's job, and a token upstream - * cannot price contributes nothing rather than a guess. - * - * --------------------------------------------------------------------------- - * TOPIC0 COLLISION - * --------------------------------------------------------------------------- - * The Vault, both pool managers and the shared `ProtocolFees` base declare 34 - * events but only 22 distinct signatures - `ProtocolFeeUpdated`, `Paused`, - * `Unpaused`, `ProtocolFeeControllerUpdated`, `DynamicLPFeeUpdated` and - * `OwnershipTransferred` are byte-identical across contracts and collide on topic0. - * The two `Initialize` events do not collide today (CL carries sqrtPriceX96+tick, - * Bin carries activeId) but nothing guarantees that. Each `getLogs2` call below is - * therefore scoped to ONE pool manager address and decoded with that manager's own - * abi. Never query these by topic alone. - * - * --------------------------------------------------------------------------- - * WHAT IS EXPORTED - * --------------------------------------------------------------------------- - * Exactly the chains in `config.js` that have contracts: HyperEVM ("hyperliquid"), - * BNB Chain ("bsc"), Base ("base") and Robinhood Chain ("robinhood"). A row without - * a Vault, a pool manager and a start date is never exported, so the adapter never - * reports $0 TVL as a fact about a deployment that does not exist. - */ - -const CL_INITIALIZE_EVENT = - "event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint160 sqrtPriceX96, int24 tick)"; -const BIN_INITIALIZE_EVENT = - "event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint24 activeId)"; +// same addresses on every chain; the Vault custodies the tokens of every pool +const VAULT = "0x405515DB94aDBF3A827349f2C096809639581D09"; +const CL_POOL_MANAGER = "0xE23978EBBf83Eab3f0226674d1183b5D3ED32FeC"; +const BIN_POOL_MANAGER = "0x004a786C4cB79358e2f86467B0eBFD87028648F4"; + +// fromBlock: CLPoolManager deployment block +const config = { + hyperliquid: { fromBlock: 48129462 }, + bsc: { fromBlock: 126766127 }, + base: { fromBlock: 52409470 }, + robinhood: { fromBlock: 84732137 }, +}; -const initializeEventFor = (chain, manager) => - manager.toLowerCase() === String(DEPLOYMENTS[chain].binPoolManager).toLowerCase() - ? BIN_INITIALIZE_EVENT - : CL_INITIALIZE_EVENT; +const managers = [ + [CL_POOL_MANAGER, "event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint160 sqrtPriceX96, int24 tick)"], + [BIN_POOL_MANAGER, "event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint24 activeId)"], +]; async function tvl(api) { - const chain = api.chain; - const { vault, fromBlock } = DEPLOYMENTS[chain]; - const excluded = new Set(blacklistedTokens(chain)); - - const tokenSet = new Set(); - // hook -> the tokens of every pool bound to it. Keyed so a hook shared by many - // pools is asked about each token ONCE: every DeepCore launch pool on a chain uses - // the same launch guard with the same quote currency, and one [pair, hook] entry - // per pool would sum that guard's quote balance once per launch (unless upstream - // happens to deduplicate owner/token pairs, which this file does not rely on). - const hookTokens = new Map(); - - for (const manager of poolManagers(chain)) { - const logs = await getLogs2({ - api, - target: manager, - fromBlock, - eventAbi: initializeEventFor(chain, manager), - }); - - for (const log of logs) { - // Excluded tokens never reach a balance call, so a pool made only of them - // contributes nothing - not a zero, nothing. - const pair = [log.currency0, log.currency1] - .map((t) => String(t).toLowerCase()) - .filter((t) => !excluded.has(t)); - for (const token of pair) tokenSet.add(token); - // A hook may hold its own balances (hook deltas / hook-owned liquidity). - // The hook comes from THIS pool's log, so a pool bound to an older hook - // deployment is still counted against that hook. - const hook = String(log.hooks).toLowerCase(); - if (pair.length && hook !== nullAddress) { - if (!hookTokens.has(hook)) hookTokens.set(hook, new Set()); - for (const token of pair) hookTokens.get(hook).add(token); - } + const { fromBlock } = config[api.chain]; + const tokens = new Set(); + const hookTokens = {}; + + for (const [target, eventAbi] of managers) { + const logs = await getLogs2({ api, target, fromBlock, eventAbi }); + for (const { currency0, currency1, hooks } of logs) { + const pair = [currency0, currency1].map((t) => t.toLowerCase()); + pair.forEach((t) => tokens.add(t)); + const hook = hooks.toLowerCase(); + if (hook === nullAddress) continue; + hookTokens[hook] = hookTokens[hook] || new Set(); + pair.forEach((t) => hookTokens[hook].add(t)); } } - const ownerTokens = []; - for (const [hook, tokens] of hookTokens) ownerTokens.push([Array.from(tokens), hook]); - - // Everything else sits on the Vault. Chunked so a chain with many pools does not - // build one multicall with tens of thousands of entries. - for (const tokens of sliceIntoChunks(Array.from(tokenSet), 1000)) { - ownerTokens.push([tokens, vault]); - } + // hooks can hold their own balances, as in uniswap-v4 + const ownerTokens = Object.entries(hookTokens).map(([hook, t]) => [[...t], hook]); + for (const chunk of sliceIntoChunks([...tokens], 1000)) ownerTokens.push([chunk, VAULT]); - // The same exclusion is handed to sumTokens2 so upstream's filter and ours can - // never disagree about a token that slipped in through another path. - return sumTokens2({ - api, - ownerTokens, - permitFailure: true, - blacklistedTokens: Array.from(excluded), - }); + return sumTokens2({ api, ownerTokens, permitFailure: true }); } module.exports = { methodology: - "DeepCore is a singleton AMM: one Vault custodies every token for the whole protocol, and pool managers hold nothing. TVL is the Vault's balance of every token that has appeared as currency0 or currency1 in an Initialize event from CLPoolManager or BinPoolManager, plus any balance held by the hook contract each pool was created with. Native currency appears as the zero address in a pool key and is read as the Vault's native balance. Tokens with no market by construction (a protocol's own test tokens) are excluded by address and not counted at any value.", + "DeepCore is a singleton AMM: one Vault custodies every token for the whole protocol, and pool managers hold nothing. TVL is the Vault's balance of every token that has appeared as currency0 or currency1 in an Initialize event from CLPoolManager or BinPoolManager, plus any balance held by the hook contract each pool was created with. Native currency appears as the zero address in a pool key and is read as the Vault's native balance.", + start: "2026-10-10", }; -for (const chain of enabledChains()) { - module.exports[chain] = { - tvl, - start: DEPLOYMENTS[chain].start, - }; -} +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl }; +}); From e5c4535df5ce9193b5f7f350943c4018553a4c23 Mon Sep 17 00:00:00 2001 From: Maxi Date: Mon, 12 Oct 2026 18:10:12 -0300 Subject: [PATCH 224/988] Odyssey: page smart accounts, add Robinhood Chain (#21587) Co-authored-by: ccipherx --- projects/odyssey/index.js | 102 ++++---------------------------------- 1 file changed, 11 insertions(+), 91 deletions(-) diff --git a/projects/odyssey/index.js b/projects/odyssey/index.js index 8809f17b4e5..74b352311ce 100644 --- a/projects/odyssey/index.js +++ b/projects/odyssey/index.js @@ -1,97 +1,17 @@ -const sdk = require("@defillama/sdk"); -const { cachedGraphQuery } = require("../helper/cache"); +// PositionRegistry, same address on every chain +const REGISTRY = '0xee156d8ea7b96a5524ccc3cf9283ab85e80e9534' -const graphs = { - ethereum: sdk.graph.modifyEndpoint('BguCyHCbhwRK4MB4DCFmHLR7KNeDKHE64iDXAY6dp4cR'), - base: sdk.graph.modifyEndpoint('5b3mwB9M2TFkD259vzED9sUe8A8j3V2HDobuCgoe8pVh'), - optimism: sdk.graph.modifyEndpoint('2tkJQ566D58MzdKzwShZESwgEdTkdWCxCmBKgPyf44bb'), - plasma: 'https://api.goldsky.com/api/public/project_cmhc2ll2b3q1q01xw0u0pf76c/subgraphs/odyssey-subgraph-plasma/1.0.8/gn', -} - -const queries = { - current: `query get_current_positions { - positionRegistries(first: 1) { - smartAccounts { - positions(where: {totalDeposited_gt: 0}) { - totalDeposited - asset - } - } - } - }`, - previous: `query get_tvl($time_start: BigInt, $time_end: BigInt) { - positionRegistrySnapshots( - first: 1000 - where: { - createdAt_gt: $time_start - createdAt_lt: $time_end - } - ) { - id - dayStartTimestamp - smartAccountSnapshots { - positionSnapshots(where: {totalDeposited_gt: 0}) { - totalDeposited - position { - asset - } - } - } - } - }` +async function tvl(api) { + const positions = await api.call({ target: REGISTRY, abi: 'address[]:getPositions' }) + const assets = await api.multiCall({ abi: 'address:asset', calls: positions }) + const amounts = await api.multiCall({ abi: 'uint256:depositedAmount', calls: positions }) + api.add(assets, amounts) } module.exports = { - misrepresentedTokens: true, + methodology: 'Sums the collateral each Odyssey position contract holds in its underlying lending market (Morpho Blue, Aave V3, Compound V3, Euler V2, Metronome Synth), read on-chain via depositedAmount() for every position in the PositionRegistry. Leveraged positions are counted at full collateral, including the part bought with borrowed funds.', } -Object.keys(graphs).forEach(chain => { - module.exports[chain] = { - tvl: async (api) => { - if ( Date.now() / 1000 - api.timestamp > 60 * 60 * 24 ) { - // do historical query - let depositedBalances = {} - const { positionRegistrySnapshots } = await cachedGraphQuery(`odyssey-${chain}-historical`, graphs[chain], queries.previous, { variables: { time_start: api.timestamp - 60 * 60 * 24, time_end: api.timestamp } }) - if (positionRegistrySnapshots && positionRegistrySnapshots.length > 0) { - positionRegistrySnapshots.forEach(({ smartAccountSnapshots, id, dayStartTimestamp }) => { - const registry = id.substring(0, id.indexOf('-')) - const balances = {} - smartAccountSnapshots.forEach(saSnapshot => { - saSnapshot.positionSnapshots.forEach(positionSnapshot => { - const asset = positionSnapshot.position.asset - const amount = Number(positionSnapshot.totalDeposited) - if (!balances[asset]) balances[asset] = 0 - balances[asset] += amount - }) - }) - if (!depositedBalances[registry]) depositedBalances[registry] = {balances, dayStartTimestamp } - else if (depositedBalances[registry] && depositedBalances[registry].dayStartTimestamp < dayStartTimestamp) depositedBalances[registry] = {balances, dayStartTimestamp } - }) - Object.values(depositedBalances).forEach(({ balances }) => { - Object.entries(balances).forEach(([asset, amount]) => { - api.add(asset, amount) - }) - }) - } - } else { - // do current query - const { positionRegistries } = await cachedGraphQuery(`odyssey-${chain}-current-2`, graphs[chain], queries.current) - const balances = {} - if (positionRegistries && positionRegistries[0] && positionRegistries[0].smartAccounts) { - positionRegistries[0].smartAccounts.forEach(smartAccount => { - smartAccount.positions.forEach(position => { - const asset = position.asset - const amount = Number(position.totalDeposited) - if (!balances[asset]) balances[asset] = 0 - balances[asset] += amount - }) - }) - } - Object.entries(balances).forEach(([asset, amount]) => { - api.add(asset, amount) - }) - } - return api.getBalances() - } - } -}) \ No newline at end of file +;['ethereum', 'base', 'optimism', 'plasma', 'robinhood'].forEach(chain => { + module.exports[chain] = { tvl } +}) From da116a95c378a666369b5a0416c070772e6af709 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 13 Oct 2026 09:10:36 +0200 Subject: [PATCH 225/988] fix pcs-v2 --- projects/pancake-swap/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/pancake-swap/index.js b/projects/pancake-swap/index.js index 3e7601c4c07..74a6891241a 100644 --- a/projects/pancake-swap/index.js +++ b/projects/pancake-swap/index.js @@ -3,10 +3,10 @@ const axios = require('axios'); const { getLogs } = require('../helper/cache/getLogs') const { request, } = require("graphql-request"); const { toUSDTBalances } = require('../helper/balances') -const { stakings } = require('../helper/staking') const { getUniTVL } = require('../helper/unknownTokens') const { dexExport } = require('../helper/chain/aptos'); const { getExports } = require('../helper/heroku-api'); +const bscGraphResponse = require('./pcs-v2-onchain.js') const graphEndpoint = 'https://proxy-worker.pancake-swap.workers.dev/bsc-exchange' @@ -97,7 +97,8 @@ module.exports = { misrepresentedTokens: true, methodology: 'TVL accounts for the liquidity on all AMM pools, using the TVL chart on https://pancakeswap.finance/info as the source. Staking accounts for the CAKE locked in MasterChef (0x73feaa1eE314F8c655E354234017bE2193C9E24E)', bsc: { - tvl: getExports('pcs-v2', ['bsc']).bsc.tvl, + // tvl: getExports('pcs-v2', ['bsc']).bsc.tvl, + tvl: bscGraphResponse.bsc.tvl, }, ethereum: { tvl: getUniTVL({ factory: '0x1097053Fd2ea711dad45caCcc45EfF7548fCB362', useDefaultCoreAssets: true, }) From b6d4ce6e23f165c4dc98c2f5035eb50648169d3f Mon Sep 17 00:00:00 2001 From: Dakra <83468031+MysticDakra@users.noreply.github.com> Date: Tue, 13 Oct 2026 01:05:56 -0700 Subject: [PATCH 226/988] fix(hypersurface): include current PremiumPool and MarginPool TVL (#21591) --- registries/sumTokens.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 0adfe5e43ac..7f4558eb5ba 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -16298,7 +16298,7 @@ const configs = { }, }, "hypersurface": { - "methodology": "TVL includes tokens in MarginPool, HedgedPool, and Hedger contracts of every collateral pool (USDT0-collateral and USDC-collateral on HyperEVM, USDC-collateral on Base). LP positions held by the Hedger are unwrapped to their underlying tokens.", + "methodology": "TVL includes tokens in MarginPool, PremiumPool, HedgedPool, and Hedger contracts of every collateral pool (USDT0-collateral and USDC-collateral on HyperEVM, USDC-collateral on Base). LP positions held by the Hedger are unwrapped to their underlying tokens.", "hyperliquid": { "owners": [ "0x7D2e4b4d7ba55C423F5CCe194ae8194eFD1C6e35", @@ -16306,7 +16306,9 @@ const configs = { "0xa8c9403BDf554C047Ad91a448DDb24208Ab5313c", "0x7FfD5706C916499676D707f3ec3F0c9b928E7A95", "0xe0F9cA7FD12E31F5d720A93d04722d6DFbAD59e7", - "0x220f86b641ec63f4832CC30a663Bb26b15259Ee2" + "0x220f86b641ec63f4832CC30a663Bb26b15259Ee2", + "0x6806c2c11d9aa3464792d10455a6480d793eedc1", + "0x724a3031f22a5d8b8ec45fcf66de398dedba4edf" ], "tokens": [ ADDRESSES.hyperliquid.USDT0, From 90f50438416b36e747c8aceb924ad1ad220ff477 Mon Sep 17 00:00:00 2001 From: daonarchy Date: Tue, 13 Oct 2026 15:07:25 +0700 Subject: [PATCH 227/988] Add sprout adapter (#21589) Co-authored-by: daonarchy <219096321+daonarchy@users.noreply.github.com> --- projects/sprout/index.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 projects/sprout/index.js diff --git a/projects/sprout/index.js b/projects/sprout/index.js new file mode 100644 index 00000000000..1c2aba48c7c --- /dev/null +++ b/projects/sprout/index.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const WINJ = '0x0000000088827d2d103ee2d9A6b781773AE03FfB' +const USDC = '0xa00C59fF5a080D2b954d0c75e46E22a0c371235a' +const SPROUT = '0x503f2A7bAc1E2ff2800Aa92EdB82abeF0bFA631E' + +const owners = [ + '0x1333692eB905823df110762525c26f7489BB9300', + '0xd948740da926E8908A08414879490d0D8F96D463', + '0xeBF62508F322137EE0986935Ee3b4A60a3F0D227', +] + +module.exports = { + methodology: 'TVL is the wINJ, USDC and native INJ reserves held by the three Sprout LaunchpadCore bonding curve contracts (current and two previous versions). SPROUT held as quote-asset reserves is reported under staking. Launched tokens are excluded, and liquidity that graduated to Choice is not counted.', + injective: { + tvl: sumTokensExport({ owners, tokens: [WINJ, USDC, ADDRESSES.null] }), + staking: sumTokensExport({ owners, tokens: [SPROUT] }), + }, +} From 66d6b8b86798535910515b6fa077bf04cfd82c37 Mon Sep 17 00:00:00 2001 From: Five Stars <146636499+fivestarsfi@users.noreply.github.com> Date: Tue, 13 Oct 2026 11:30:33 +0300 Subject: [PATCH 228/988] Add Resu Protocol, clear Syde old addresses (#21569) Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/resu/index.js | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 projects/resu/index.js diff --git a/projects/resu/index.js b/projects/resu/index.js new file mode 100644 index 00000000000..a061659286b --- /dev/null +++ b/projects/resu/index.js @@ -0,0 +1,48 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/chain/ton') +const VAULTS = { + base: [ + '0x80669f196620597AC5740416CB85754761Ccb786', // MSFT + '0xb555F9D5eF631868cF070Fe3466765E26502693A', // NVDA + ], + arbitrum: [ + '0x8a8CB825f4CCd2e93604e828f62C3ce3f5C8F464', // WETH + ], + hyperliquid: [ + '0x53F7e94a0edd3CFb958332842ec1fEce566f941d', // HLP + ], + monad: [ + '0x804E56c448A14611ECAC4cf07a222878820e3876', // aprMON + ], + robinhood: [ + '0x5285F357Eb16E6fd40ba73fCA4F37776A3A5d129', // SPY + ], +} + +const navTvl = (vaults) => async (api) => { + const navs = await api.multiCall({ abi: 'uint256:nav', calls: vaults }) + navs.forEach((nav) => api.addUSDValue(Number(nav) / 1e18)) +} + +module.exports = { + methodology: + 'TVL is the net asset value locked in each Resu pool. On EVM chains the ' + + "pool's OracleVault.nav() returns its value in USD (read from Chainlink / " + + 'HyperCore oracles); on TON it is the base jetton (tsTON, tsUSDe) held by ' + + 'each pool. Solana is live on devnet only and is excluded.', + base: { tvl: navTvl(VAULTS.base) }, + arbitrum: { tvl: navTvl(VAULTS.arbitrum) }, + hyperliquid: { tvl: navTvl(VAULTS.hyperliquid) }, + monad: { tvl: navTvl(VAULTS.monad) }, + robinhood: { tvl: navTvl(VAULTS.robinhood) }, + ton: { + tvl: sumTokensExport({ + owners: [ + 'EQCYM6Xhwy-xbfzJtkUrKVjPH2iSjJzkyeq2l9lWFXaqOMTa', // tsTON pool + 'EQC-EijLoFEAy-pMuvxjlRtQ4yqmKO62ZnptY0J3VvAgVwdE', // tsUSDe pool + ], + tokens: [ADDRESSES.ton.tsTON, ADDRESSES.ton.tsUSDe], + onlyWhitelistedTokens: true, + }), + }, +} From 6210cdcf0925accefcc1dda278d734bec38fc52c Mon Sep 17 00:00:00 2001 From: sonevibegrok Date: Tue, 13 Oct 2026 04:35:56 -0400 Subject: [PATCH 229/988] Add SoneVibe (DEX + Lending) TVL adapter (#21590) --- projects/sonevibe/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/sonevibe/index.js diff --git a/projects/sonevibe/index.js b/projects/sonevibe/index.js new file mode 100644 index 00000000000..e6352972d36 --- /dev/null +++ b/projects/sonevibe/index.js @@ -0,0 +1,30 @@ +// SoneVibe: VibeSwap (Uniswap V2-style DEX) + SoneVibe Lending (Compound V2-style) +// Addresses: https://github.com/SoneVibe/Lending/blob/main/docs/networks.json +const { getUniTVL } = require('../helper/cache/uniswap') +const { compoundExports2 } = require('../helper/compound') +const { mergeExports } = require('../helper/utils') + +const dex = { + soneium: '0x06C0b58287794a0bdce20ce768b601CA974618DC', + astar: '0x1b404A1e41cCe5f98DC9CBF0c1372F8b68e2588c', + bsc: '0xaf905e66038EcE89e03D843B35a11D262053B630', +} + +const lending = { + // V_Master has no getAllMarkets(), so markets are pinned (from networks.json) + soneium: { comptroller: '0x1126859aB6911Fc3b4f86f2F65E7B6F2eEDe5185', markets: ['0x7CA06966B0c07C5e35aA180643E98bB3057EBb27', '0xDB3e66b87c42C7F3599fbdcBFe08DfF0689A6D77', '0x96ae93Df119c131469b38e3d558899F23678dCFb'] }, + astar: { comptroller: '0x4B07FedD55C65373Dec9d983EA279D7d65259ec7', markets: ['0x40f4bFA1e152Ac5a9b066C0BEc5BD83227F8520A', '0xA7f41D0f41ec8aeb5d57c0E5850F0dB28Ca68E54', '0xe5cE001dD3439A198b2A19567D5F3CD6cd30e61f'] }, +} + +const dexExports = {} +Object.entries(dex).forEach(([chain, factory]) => { + dexExports[chain] = { tvl: getUniTVL({ factory, useDefaultCoreAssets: true }) } +}) + +const lendingExports = {} +Object.entries(lending).forEach(([chain, config]) => { + lendingExports[chain] = compoundExports2(config) +}) + +module.exports = mergeExports([dexExports, lendingExports]) +module.exports.methodology = 'DEX TVL: reserves of all VibeSwap pairs created by the factory (core assets only). Lending TVL: underlying tokens held by SoneVibe cTokens listed by the comptroller; borrowed = total borrows.' From f32c6011030dfc592f1660d1e6696aab8820b665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Tue, 13 Oct 2026 19:55:38 +0530 Subject: [PATCH 230/988] symbiosis: Tron TVL reads $0 since 10-08, the Tron portal moved (#21593) --- projects/symbiosis-finance/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 12615ae2471..32dd798da33 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -182,7 +182,7 @@ module.exports = { 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', // USDT ], holders: [ - 'TNu3QZx8U2YAZTUsB3csii1L8QVgUAY3no' // portal + 'TD4tamFrCq7KvQEB1LArNXr9sKFC6GaAmt' // portal ] }, { From bdf43de577d765e7c1b266bca7e02db1cb711b6d Mon Sep 17 00:00:00 2001 From: semyon-metric Date: Tue, 13 Oct 2026 17:26:42 +0300 Subject: [PATCH 231/988] [update] metric - mark the first-generation factory adapter dead (#21599) --- projects/metric/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/metric/index.js b/projects/metric/index.js index ce2b804462b..0cdfe65e0ee 100644 --- a/projects/metric/index.js +++ b/projects/metric/index.js @@ -38,3 +38,9 @@ Object.keys(config).forEach(chain => { }) module.exports.methodology = 'TVL is the sum of token0 and token1 balances held by every pool created by the Metric pool factory. Pools are discovered on-chain from the factory PoolCreated events.' + +// The first-generation factory was decommissioned on 2026-10-07: its pools were +// drained (TVL went from ~$1.0M to ~$3.7k by 2026-10-08) and their price +// providers switched off. The live Metric pools belong to the factory tracked +// by projects/metric-v1. +module.exports.deadFrom = '2026-10-08' From 2203bf1cb2d039eccef44ddc0ce86c37e24cdbcd Mon Sep 17 00:00:00 2001 From: Igor Igamberdiev <118828668+frankresearcher@users.noreply.github.com> Date: Tue, 13 Oct 2026 17:26:58 +0300 Subject: [PATCH 232/988] Add new Armitage vault (#21595) --- registries/curators.js | 1 + 1 file changed, 1 insertion(+) diff --git a/registries/curators.js b/registries/curators.js index 800c0eb391c..f437924f75a 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -247,6 +247,7 @@ const configs = { '0xBf29043164660C60A2a72Cd15FFe2304e87B6838', '0x500aE64100D7DbDb640531085C2F5d40cDC8930D', '0x3d5EcCb62974178236A768A7ef14D3ce468Fbe91', + '0xcf609F8327E68b42AF54F9D529b9f65d68038435', ], }, }, From 168e1136a52b8e33c972a97cf0ee0568cd8c0298 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Tue, 13 Oct 2026 16:27:13 +0200 Subject: [PATCH 233/988] Default 30s timeout on shared helper/http get/post (#21594) --- projects/helper/http.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/helper/http.js b/projects/helper/http.js index 9efe47e5413..38739977bb1 100644 --- a/projects/helper/http.js +++ b/projects/helper/http.js @@ -5,6 +5,10 @@ const { getEnv } = require('./env') const getCacheData = {} +// One default here beats a timeout in every caller: axios default is no +// timeout (hangs forever), which froze whole runs on dead upstreams. +const DEFAULT_TIMEOUT = 30000 + async function getCache(endpoint) { if (!getCacheData[endpoint]) getCacheData[endpoint] = get(endpoint) return getCacheData[endpoint] @@ -31,7 +35,7 @@ async function get(endpoint, options = {}) { if (!options.headers) options.headers = {} options.headers['Authorization'] = tonApiKey } - const data = (await axios.get(endpoint, options)).data + const data = (await axios.get(endpoint, { timeout: DEFAULT_TIMEOUT, ...options })).data return data } catch (e) { sdk.log(e.message) @@ -45,7 +49,7 @@ async function getWithMetadata(endpoint) { async function post(endpoint, body, options) { try { - const data = (await axios.post(endpoint, body, options)).data + const data = (await axios.post(endpoint, body, { timeout: DEFAULT_TIMEOUT, ...options })).data return data } catch (e) { sdk.log(e.message) From c9b9b5e67fe8bee894ef49a955500f0ad4a54d5f Mon Sep 17 00:00:00 2001 From: Tom <75627352+tomrpl@users.noreply.github.com> Date: Tue, 13 Oct 2026 16:30:05 +0200 Subject: [PATCH 234/988] morpho-midnight: exclude withdrawable from borrowed (#21602) --- projects/morpho-midnight/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/projects/morpho-midnight/index.js b/projects/morpho-midnight/index.js index ba3bd4c21a7..349fd4c7899 100644 --- a/projects/morpho-midnight/index.js +++ b/projects/morpho-midnight/index.js @@ -51,12 +51,17 @@ async function tvl(api) { async function borrowed(api) { const { midnight } = config[api.chain] const markets = await getMarkets(api) - const totalUnits = await api.multiCall({ abi: 'function totalUnits(bytes32) view returns (uint128)', target: midnight, calls: markets.map(m => ({ params: [m.id] })) }) - markets.forEach((market, i) => api.add(market.loanToken, totalUnits[i])) + const calls = markets.map(m => ({ params: [m.id] })) + const [totalUnits, withdrawable] = await Promise.all([ + api.multiCall({ abi: 'function totalUnits(bytes32) view returns (uint128)', target: midnight, calls }), + api.multiCall({ abi: 'function withdrawable(bytes32) view returns (uint128)', target: midnight, calls }), + ]) + // totalUnits = outstanding debt + withdrawable (repaid, not yet withdrawn, already counted in tvl) + markets.forEach((market, i) => api.add(market.loanToken, BigInt(totalUnits[i]) - BigInt(withdrawable[i]))) } module.exports = { - methodology: 'Every Midnight market is enumerated on-chain from MarketCreated events. TVL is the collateral held in the Midnight contract. Borrowed is outstanding debt read per-market from totalUnits.', + methodology: 'Every Midnight market is enumerated on-chain from MarketCreated events. TVL is the collateral held in the Midnight contract. Borrowed is outstanding debt, read per market as totalUnits minus withdrawable (repaid assets not yet withdrawn by lenders, which stay in the contract and are already counted in TVL).', } Object.keys(config).forEach(chain => { From 377532c977e7d44e5ec0f06335a50777c7af7ba5 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 13 Oct 2026 14:33:30 -0400 Subject: [PATCH 235/988] add bsc to flying tulip and deduplicate ftusd and lend funds (#21611) --- projects/flying-tulip-ftusd/index.js | 71 +++++++++++++------- projects/flying-tulip-lend/index.js | 98 ++++++++++++++++------------ 2 files changed, 105 insertions(+), 64 deletions(-) diff --git a/projects/flying-tulip-ftusd/index.js b/projects/flying-tulip-ftusd/index.js index ca7284dc75e..8727cd1632e 100644 --- a/projects/flying-tulip-ftusd/index.js +++ b/projects/flying-tulip-ftusd/index.js @@ -3,13 +3,27 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const MINT_AND_REDEEM = { ethereum: '0xaa48ecbc843cf7e9a29155d112b8cb27902bd23c', sonic: '0x0c6f8ec81c3ea5bff06f6cd0791780f9f050ee31', + bsc: '0x7d73863178a3ecb9767f0be1bf50f55305a52743', +} + +// Flying Tulip Delta-Neutral strategy on each chain and the Flying Tulip Lend position manager it +// supplies into. Its ftUSD backing sits in Lend, read as the strategy's position there. The same +// list is in flying-tulip-lend, which subtracts these positions so they are counted once. +// positionToken() and token() revert on the Ethereum strategy when called through multicall, so the +// strategy is listed here rather than detected. +const DELTA_NEUTRAL = { + ethereum: { strategy: '0xe0E445967256EE60111e243e0F0F94DD1D351A59', positionManager: '0xbe4050a73a7Fb384c65E885a15C33461A4B20055' }, + sonic: { strategy: '0x6EC218FC45aC0C7B83D16557befABB62ed7455Ae', positionManager: '0xbe4050a73a7Fb384c65E885a15C33461A4B20055' }, + bsc: { strategy: '0x7eF4ED045E693E10E6ed08ac71438b661f09817A', positionManager: '0xB36d39C72d66153B7f32E1320BEe3280657353Bd' }, } const COLLATERAL_INFO_ABI = 'function collateralInfo(address) view returns (tuple(address yieldWrapper, uint8 decimals, bool enabled, uint16 mintFeeBps, uint16 redeemFeeBps, uint256 maxValueFtUSD, uint256 mintPriceHardcapWad, uint256 totalIn, uint256 totalOut, uint256 totalFtUSDBurned, uint256 totalFtUSDMinted))' +const GET_BALANCE_ABI = 'function getBalance(address user, address asset) view returns (uint256 avail, uint256 holdBal)' async function tvl(api) { const mr = MINT_AND_REDEEM[api.chain] + const dn = DELTA_NEUTRAL[api.chain] const collaterals = await api.fetchList({ target: mr, lengthAbi: 'uint256:collateralCount', @@ -18,36 +32,47 @@ async function tvl(api) { const wrappers = (await api.multiCall({ target: mr, abi: COLLATERAL_INFO_ABI, calls: collaterals })) .map(i => i.yieldWrapper) - const strategyLists = await Promise.all(wrappers.map(target => api.fetchList({ - target, - lengthAbi: 'uint256:numberOfStrategies', - itemAbi: 'function strategies(uint256) view returns (address)', - }))) - const flat = strategyLists.flatMap((strats, i) => strats.map(strategy => ({ strategy, wrapper: wrappers[i] }))) - - const [positions, underlyings] = await Promise.all([ - api.multiCall({ abi: 'address:positionToken', calls: flat.map(s => ({ target: s.strategy })), permitFailure: true }), - api.multiCall({ abi: 'address:token', calls: flat.map(s => ({ target: s.strategy })), permitFailure: true }), - ]) - - // positionToken != token -> external (aToken, spToken) - // positionToken == token -> ft strategy (e.g. ftDNS-USDC) - // deprecated strategies revert both calls - skip them - const tokensAndOwners = flat - .map((s, i) => { - if (!positions[i] || !underlyings[i]) return null - return positions[i].toLowerCase() !== underlyings[i].toLowerCase() - ? [positions[i], s.strategy] - : [s.strategy, s.wrapper] + // idle collateral held by each wrapper and by each of its strategies + const tokensAndOwners = collaterals.map((collateral, i) => [collateral, wrappers[i]]) + const dnCollaterals = [] + const external = [] + for (let i = 0; i < wrappers.length; i++) { + const strategies = await api.fetchList({ + target: wrappers[i], + lengthAbi: 'uint256:numberOfStrategies', + itemAbi: 'function strategies(uint256) view returns (address)', }) - .filter(Boolean) + for (const strategy of strategies) { + tokensAndOwners.push([collaterals[i], strategy]) + if (strategy.toLowerCase() === dn.strategy.toLowerCase()) dnCollaterals.push(collaterals[i]) + else external.push(strategy) + } + } + + // Delta-Neutral backing supplied into Flying Tulip Lend + const dnPositions = await api.multiCall({ + target: dn.positionManager, + abi: GET_BALANCE_ABI, + calls: dnCollaterals.map(token => ({ params: [dn.strategy, token] })), + }) + dnPositions.forEach((p, i) => api.add(dnCollaterals[i], BigInt(p.avail) + BigInt(p.holdBal))) + + // external yield receipts (aToken, spToken) held by the other strategies + const positions = await api.multiCall({ abi: 'address:positionToken', calls: external }) + const underlyings = await api.multiCall({ abi: 'address:token', calls: external }) + external.forEach((strategy, i) => { + if (positions[i].toLowerCase() === underlyings[i].toLowerCase()) + throw new Error(`flying-tulip-ftusd: strategy ${strategy} has no receipt token, add it to DELTA_NEUTRAL or handle it`) + tokensAndOwners.push([positions[i], strategy]) + }) return sumTokens2({ api, tokensAndOwners }) } module.exports = { methodology: - 'Sums collateral backing ftUSD by enumerating each MintAndRedeem-registered ftYieldWrapperV2 and reading positionToken() on each of their strategies. External-receipt strategies (Aave, Spark) contribute the receipt balance at the strategy address. Other strategies (Flying Tulip Delta-Neutral) contribute their strategy shares held by the parent wrapper, priced server-side at 1:1 with the underlying asset.', + 'Sums the collateral backing ftUSD across each MintAndRedeem-registered ftYieldWrapperV2: idle collateral held by the wrappers and their strategies, external yield receipts (Aave, Spark) held by the strategies, and the Flying Tulip Delta-Neutral strategy\'s full position in Flying Tulip Lend, read from the Lend position manager. flying-tulip-lend subtracts that position, so it is counted once.', ethereum: { tvl }, sonic: { tvl }, + bsc: { tvl }, } diff --git a/projects/flying-tulip-lend/index.js b/projects/flying-tulip-lend/index.js index 05335977753..a654e6460af 100644 --- a/projects/flying-tulip-lend/index.js +++ b/projects/flying-tulip-lend/index.js @@ -19,65 +19,80 @@ const RESERVES = { { token: ADDRESSES.ethereum.WBTC, wrapper: '0x1A5730c71576D77048E9FdC79DD40e4B1E8Fe042' }, // WBTC -> ftWBTC { token: '0x5DD1A7A369e8273371d2DBf9d83356057088082c', wrapper: '0x7127BB9d9ad0f47B8dA9087e634D67F3946F840E' }, // FT -> ftFT { token: ADDRESSES.ethereum.WSTETH, wrapper: '0x01980BD1B58313bD3767f6adc75Af8b6464f3db7' }, // wstETH -> ftWstETH (stakedNative) + { token: '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E', wrapper: '0xa41686c6018056b44a7027f4c912e6153cfb5c63' }, // crvUSD -> ftcrvUSD + { token: '0x0655977FEb2f289A4aB78af67BAB0d17aAb84367', wrapper: '0xefab1b1856bbe0b6d78f2552614e34efad1eb6c6' }, // scrvUSD -> ftscrvUSD + { token: ADDRESSES.ethereum.USDG, wrapper: '0x8b419a64d95738b3dfcb55a35da7918dfd366bb0' }, // USDG -> ftUSDG + { token: ADDRESSES.ethereum.sUSDe, wrapper: '0xbc940f911744670523c3d4ebc56e1e28489591d7' }, // sUSDe -> ftsUSDe // { token: '0xF7D85EC4E7710f71992752eac2111312e73E9C9C', wrapper: '0xc67D966f761e8cf13Faa0a1E774425290c8453d9' }, // ftUSD -> ftFtUSD - excluded to prevent flying-tulip-ftusd double count ], + bsc: [ + { token: ADDRESSES.bsc.USDC, wrapper: '0x39285fa9992a3a87e1c2e1476c1404e2cfdd1931' }, // USDC -> ftUSDC + { token: ADDRESSES.bsc.USDT, wrapper: '0xfe040beef432fb924f871e9c76180b557a13533c' }, // USDT -> ftUSDT + { token: ADDRESSES.bsc.WBNB, wrapper: '0xa07adcafc7709685836cf357fa537ae2b3061156' }, // WBNB -> ftWBNB (wNative) + { token: '0x77734e70b6E88b4d82fE632a168EDf6e700912b6', wrapper: '0x2d3587fbd9a8fd4d4dd76e0102bc0063776e5bf6' }, // asBNB -> ftasBNB (stakedNative) + { token: ADDRESSES.bsc.FDUSD, wrapper: '0x41cb54680d1baa26b85bc97641854e59964dbe38' }, // FDUSD -> ftFDUSD + { token: ADDRESSES.bsc.ETH, wrapper: '0x5625ad05ed1031dceff37b3383fdd17b202a4f74' }, // ETH -> ftETH + { token: ADDRESSES.bsc.BTCB, wrapper: '0x440be5cb3663c8d33fd29d5fcf1ad78d684e4dcd' }, // BTCB -> ftBTCB + { token: '0xa2E3356610840701BDf5611a53974510Ae27E2e1', wrapper: '0xfcce797c51da526156b14faa6a9d0e44af570a62' }, // wBETH -> ftwBETH + { token: '0x205812CdBed920aFf76C6580abD681a46D11efc7', wrapper: '0xee62f248c22f279a39252727e0a17052d85ac7f6' }, // QQQB -> ftQQQB + ], } const LENDING_LENS = { sonic: '0x3682168023e6ba8d1f995fda1d920827c5a8a43e', ethereum: '0x3682168023e6ba8d1f995fda1d920827c5a8a43e', // CREATE2 deterministic, same as Sonic + bsc: '0xc374d2ae274f31bf53c561d0b4024136cc692f48', +} + +// ftUSD's Delta-Neutral strategy supplies ftUSD collateral into Lend. flying-tulip-ftusd counts its +// position in each ftUSD collateral token (same list there), so those are subtracted here to count +// them once. The strategy's other Lend positions (its hedge, e.g. stS, wstETH) stay in Lend. +const DELTA_NEUTRAL = { + ethereum: { strategy: '0xe0E445967256EE60111e243e0F0F94DD1D351A59', positionManager: '0xbe4050a73a7Fb384c65E885a15C33461A4B20055', mintAndRedeem: '0xaa48ecbc843cf7e9a29155d112b8cb27902bd23c' }, + sonic: { strategy: '0x6EC218FC45aC0C7B83D16557befABB62ed7455Ae', positionManager: '0xbe4050a73a7Fb384c65E885a15C33461A4B20055', mintAndRedeem: '0x0c6f8ec81c3ea5bff06f6cd0791780f9f050ee31' }, + bsc: { strategy: '0x7eF4ED045E693E10E6ed08ac71438b661f09817A', positionManager: '0xB36d39C72d66153B7f32E1320BEe3280657353Bd', mintAndRedeem: '0x7d73863178a3ecb9767f0be1bf50f55305a52743' }, } const ASSET_STATE_ABI = 'function assetState(address) view returns (uint256 cash, uint256 borrows, uint256 reserves, uint256 utilWad)' - -const FTUSD_DEDUP_SONIC = { - positionManager: '0xbe4050a73a7Fb384c65E885a15C33461A4B20055', - user: '0x6EC218FC45aC0C7B83D16557befABB62ed7455Ae', // ftDNS-USDC strategy -} -const GET_BALANCE_ABI = 'function getBalance(address,address) view returns (uint256)' +const GET_BALANCE_ABI = 'function getBalance(address user, address asset) view returns (uint256 avail, uint256 holdBal)' async function tvl(api) { - const reserves = RESERVES[api.chain] || [] - - // Total supplied per reserve = cash + borrows. - // - // `cash` is the idle liquidity that still sits in the system, split between: - // - underlying held at the ftYieldWrapperV2 (not deployed yet) - // - yield receipt (aToken, spToken, ...) held at each of the wrapper's strategies - // - // `borrows` is the outstanding debt: tokens lent out to borrowers that have - // left the wrapper. We have to add this back via LendingLens.assetState - // otherwise the adapter under-reports TVL by the entire borrow book. + const reserves = RESERVES[api.chain] - // 1) cash side - const strategyLists = await Promise.all(reserves.map(({ wrapper: target }) => api.fetchList({ - target, - lengthAbi: 'uint256:numberOfStrategies', - itemAbi: 'function strategies(uint256) view returns (address)', - }))) - const strategies = strategyLists.flat() - - const positions = strategies.length - ? await api.multiCall({ abi: 'address:positionToken', calls: strategies.map(target => ({ target })) }) - : [] - - const tokensAndOwners = [ - ...reserves.map(r => [r.token, r.wrapper]), - ...strategies.map((s, i) => [positions[i], s]), - ] + // Cash only: underlying held at each ftYieldWrapperV2 plus the yield receipt (aToken, spToken, ...) + // held by each of its strategies. Outstanding debt is reported under borrowed. + const tokensAndOwners = reserves.map(r => [r.token, r.wrapper]) + for (const { wrapper } of reserves) { + const strategies = await api.fetchList({ + target: wrapper, + lengthAbi: 'uint256:numberOfStrategies', + itemAbi: 'function strategies(uint256) view returns (address)', + }) + if (!strategies.length) continue + const positions = await api.multiCall({ abi: 'address:positionToken', calls: strategies }) + strategies.forEach((strategy, i) => tokensAndOwners.push([positions[i], strategy])) + } await sumTokens2({ api, tokensAndOwners }) - // Sonic only: subtract ftDNS-USDC's lend exposure (already tracked by flying-tulip-ftusd) - if (api.chain === 'sonic') { - const { positionManager, user } = FTUSD_DEDUP_SONIC - const bal = await api.call({ target: positionManager, abi: GET_BALANCE_ABI, params: [user, ADDRESSES.sonic.USDC_e] }) - api.add(ADDRESSES.sonic.USDC_e, -BigInt(bal)) - } + // subtract ftUSD's Delta-Neutral position in ftUSD collateral tokens, counted under flying-tulip-ftusd + const { strategy, positionManager, mintAndRedeem } = DELTA_NEUTRAL[api.chain] + const ftusdCollaterals = new Set((await api.fetchList({ + target: mintAndRedeem, + lengthAbi: 'uint256:collateralCount', + itemAbi: 'function collateralAt(uint256) view returns (address)', + })).map(t => t.toLowerCase())) + const shared = reserves.filter(r => ftusdCollaterals.has(r.token.toLowerCase())) + const dnPositions = await api.multiCall({ + target: positionManager, + abi: GET_BALANCE_ABI, + calls: shared.map(r => ({ params: [strategy, r.token] })), + }) + dnPositions.forEach((p, i) => api.add(shared[i].token, -(BigInt(p.avail) + BigInt(p.holdBal)))) } async function borrowed(api) { - const reserves = RESERVES[api.chain] || [] + const reserves = RESERVES[api.chain] const states = await api.multiCall({ target: LENDING_LENS[api.chain], abi: ASSET_STATE_ABI, @@ -88,7 +103,8 @@ async function borrowed(api) { module.exports = { methodology: - 'TVL: for each Lend reserve, sums the underlying balance held at its ftYieldWrapperV2 plus the yield receipt (aToken, spToken, etc.) held by each of the wrapper\'s strategies. ftDNS-USDC\'s USDC balance is subtracted to prevent doublecounting with flying-tulip-ftusd. Borrowed: sums outstanding debt per reserve via LendingLens.assetState.borrows.', + 'TVL: for each Lend reserve, sums the underlying balance held at its ftYieldWrapperV2 plus the yield receipt (aToken, spToken, etc.) held by each of the wrapper\'s strategies, minus the position of ftUSD\'s Delta-Neutral strategy in ftUSD collateral tokens, which is counted under flying-tulip-ftusd. When ftUSD\'s position exceeds a reserve\'s idle cash, part of it is lent out, so that token can show a negative balance. Borrowed: sums outstanding debt per reserve via LendingLens.assetState.borrows.', sonic: { tvl, borrowed }, ethereum: { tvl, borrowed }, + bsc: { tvl, borrowed }, } From e3d4bed6e62d68ebeacda6fc4f58281d887eb274 Mon Sep 17 00:00:00 2001 From: Dani Date: Wed, 14 Oct 2026 10:25:48 +0200 Subject: [PATCH 236/988] gondi-v3: move to projects/, add borrowed (compact log cache) (#21617) Co-authored-by: Guimar Vaca Sittic <200669807+piratemonkee@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- projects/gondi-v3/index.js | 98 ++++++++++++++++++++++++++++++++++++++ registries/sumTokens.js | 12 ----- 2 files changed, 98 insertions(+), 12 deletions(-) create mode 100644 projects/gondi-v3/index.js diff --git a/projects/gondi-v3/index.js b/projects/gondi-v3/index.js new file mode 100644 index 00000000000..43ce48608e4 --- /dev/null +++ b/projects/gondi-v3/index.js @@ -0,0 +1,98 @@ +const { sumTokensExport } = require('../helper/sumTokens') +const { getLogs2 } = require('../helper/cache/getLogs') + +const TRANCHE = 'tuple(uint256 loanId, uint256 floor, uint256 principalAmount, address lender, uint256 accruedInterest, uint256 startTime, uint256 aprBps)[] tranche' +const LOAN_FIELDS = `address borrower, uint256 nftCollateralTokenId, address nftCollateralAddress, address principalAddress, uint256 principalAmount, uint256 startTime, uint256 duration, ${TRANCHE}, uint256 protocolFee` + +const loanEvents = (loan, loanLiquidated) => ({ + LoanEmitted: `event LoanEmitted(uint256 loanId, uint256[] offerId, ${loan} loan, uint256 fee)`, + LoanRefinanced: `event LoanRefinanced(uint256 renegotiationId, uint256 oldLoanId, uint256 newLoanId, ${loan} loan, uint256 fee)`, + LoanRefinancedFromNewOffers: `event LoanRefinancedFromNewOffers(uint256 loanId, uint256 newLoanId, ${loan} loan, uint256[] offerIds, uint256 totalFee)`, + LoanRepaid: 'event LoanRepaid(uint256 loanId, uint256 totalRepayment, uint256 fee)', + LoanLiquidated: loanLiquidated, + LoanSentToLiquidator: 'event LoanSentToLiquidator(uint256 loanId, address liquidator)', + LoanForeclosed: 'event LoanForeclosed(uint256 loanId)', +}) + +// v3.2 appends `bool lenderRefinanceDisabled` to Loan and `bool foreclosed` to LoanLiquidated, so its event topics differ +const V3_1_EVENTS = loanEvents(`tuple(${LOAN_FIELDS})`, 'event LoanLiquidated(uint256 loanId)') +const V3_2_EVENTS = loanEvents(`tuple(${LOAN_FIELDS}, bool lenderRefinanceDisabled)`, 'event LoanLiquidated(uint256 loanId, bool foreclosed)') + +const CLOSING_EVENTS = ['LoanRepaid', 'LoanLiquidated', 'LoanSentToLiquidator', 'LoanForeclosed'] + +const loanContracts = { + ethereum: [ + { target: '0xf65b99ce6dc5f6c556172bcc0ff27d3665a7d9a8', fromBlock: 20663554, events: V3_1_EVENTS }, // MultiSourceLoan v3 + { target: '0xf41B389E0C1950dc0B16C9498eaE77131CC08A56', fromBlock: 23370217, events: V3_1_EVENTS }, // MultiSourceLoan v3.1 + { target: '0xE365fF3cad44d19cb7aBa81df8ffd6818A66Ac0a', fromBlock: 25875847, events: V3_2_EVENTS }, // MultiSourceLoan v3.2 + ], + hyperliquid: [ + { target: '0x6ad675624ec8320e5806858cd5db101a0b927fd9', fromBlock: 15759157, events: V3_1_EVENTS }, // MultiSourceLoan v3.1 + ], + robinhood: [ + { target: '0x0e79e08e9E35388382b7FebB26Bc73F80465e2fB', fromBlock: 40089270, events: V3_1_EVENTS }, // MultiSourceLoan v3.1 + ], +} + +const principalOf = (loan) => loan.tranche.reduce((sum, { principalAmount }) => sum + principalAmount, 0n).toString() + +// [openedLoanId, closedLoanId, principalAddress, principal]: a refinance closes the old id and opens a new one +const toEntry = { + LoanEmitted: ({ loanId, loan }) => [String(loanId), null, loan.principalAddress, principalOf(loan)], + LoanRefinanced: ({ oldLoanId, newLoanId, loan }) => [String(newLoanId), String(oldLoanId), loan.principalAddress, principalOf(loan)], + LoanRefinancedFromNewOffers: ({ loanId, newLoanId, loan }) => [String(newLoanId), String(loanId), loan.principalAddress, principalOf(loan)], +} +CLOSING_EVENTS.forEach(name => toEntry[name] = ({ loanId }) => [null, String(loanId)]) + +// the logs cache keeps one small entry per loan event instead of the raw log +const compactCache = (name) => ({ cache, logs }) => { + if (!Array.isArray(cache.logs)) cache.logs = [] + logs.forEach(log => cache.logs.push(toEntry[name](log))) + return cache +} + +// MultiSourceLoan only stores keccak(loan) per loan id, so open loans are rebuilt from its events +async function addOpenLoans(api, { target, fromBlock, events }) { + const entries = await Promise.all(Object.entries(events).map(([name, eventAbi]) => + getLogs2({ api, target, fromBlock, eventAbi, extraKey: name, customCacheFunction: compactCache(name) }) + )) + + const loans = {} + const closed = new Set() + entries.flat().forEach(([opened, closedId, token, principal]) => { + if (opened) loans[opened] = [token, principal] + if (closedId) closed.add(closedId) + }) + + Object.entries(loans) + .filter(([loanId]) => !closed.has(loanId)) + .forEach(([, [token, principal]]) => api.add(token, principal)) +} + +async function borrowed(api) { + for (const loanContract of loanContracts[api.chain]) await addOpenLoans(api, loanContract) +} + +module.exports = { + methodology: "Counts the floor value of the NFTs held as loan collateral by GONDI's escrow (MultiSourceLoan) and user vault contracts, priced with DefiLlama's NFT collection prices. Collections without a DefiLlama price are not counted. Borrowed is the outstanding principal of open loans, rebuilt from the MultiSourceLoan loan events: a loan stops counting once it is repaid, refinanced into a new loan, or liquidated.", + ethereum: { + tvl: sumTokensExport({ + owners: [ + '0xf65b99ce6dc5f6c556172bcc0ff27d3665a7d9a8', + '0x823de2c44369e94cac3da789ad4b6493e27e4bfe', + '0xf41b389e0c1950dc0b16c9498eae77131cc08a56', + '0xe365ff3cad44d19cb7aba81df8ffd6818a66ac0a', + ], + resolveNFTs: true, + }), + borrowed, + }, + hyperliquid: { + tvl: () => ({}), + borrowed, + }, + robinhood: { + tvl: () => ({}), + borrowed, + }, +} diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 7f4558eb5ba..79633885466 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -15538,18 +15538,6 @@ const configs = { "resolveNFTs": true }, }, - "gondi-v3": { - "methodology": "Counts the floor value of the NFTs held as loan collateral by GONDI's escrow (MultiSourceLoan) and user vault contracts, priced with DefiLlama's NFT collection prices. Collections without a DefiLlama price are not counted.", - "ethereum": { - "owners": [ - "0xf65b99ce6dc5f6c556172bcc0ff27d3665a7d9a8", - "0x823de2c44369e94cac3da789ad4b6493e27e4bfe", - "0xf41b389e0c1950dc0b16c9498eae77131cc08a56", - "0xe365ff3cad44d19cb7aba81df8ffd6818a66ac0a" - ], - "resolveNFTs": true - }, - }, "goosefx-v2": { "timetravel": false, "solana": { From 818521ba8e26b96b2d4b56422a53740657dffe57 Mon Sep 17 00:00:00 2001 From: JSMP <122794657+jpgpng342@users.noreply.github.com> Date: Wed, 14 Oct 2026 04:29:23 -0400 Subject: [PATCH 237/988] Track tvl of BSC superearn. (#21615) Co-authored-by: jasmin-avalon <122794657+jasmin-avalon@users.noreply.github.com> --- projects/avalon-finance-superearn/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/avalon-finance-superearn/index.js b/projects/avalon-finance-superearn/index.js index fd658bad135..591d1fb2087 100644 --- a/projects/avalon-finance-superearn/index.js +++ b/projects/avalon-finance-superearn/index.js @@ -6,7 +6,12 @@ const evmConfig = { vaultAddress: '0xf297230fA5614545B427616148a74C888620d659', // USDC vaultStableTokenAddress: ADDRESSES.ethereum.USDC, - }, + }, + bsc: { + vaultAddress: '0xC6497A4d3Db7ED4b39157EBAC5583E2B1e22C6eD', + // USDC + vaultStableTokenAddress: ADDRESSES.bsc.USDC, + } } const moveConfig = { From e08047d73eeb2756fd2553855a3f39e2469151c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Wed, 14 Oct 2026 14:00:21 +0530 Subject: [PATCH 238/988] stader: track the two HBARX pool contracts on hedera (#21608) --- projects/stader/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/stader/index.js b/projects/stader/index.js index efc14f62b06..2027bb28f69 100644 --- a/projects/stader/index.js +++ b/projects/stader/index.js @@ -4,6 +4,10 @@ const { sumTokensExport } = require("../helper/sumTokens"); // HBARX staking contract, holds the staked HBAR // https://stader.gitbook.io/stader/hedera/smart-contracts const HBARX_STAKING = "0.0.1412503"; +// Two pool contracts from the same deployer. Around 00:00 UTC each day the staking +// contract moves all of its HBAR into these for ~15 minutes and then pulls it back, +// so reading only HBARX_STAKING at that time returns 0. They hold 1 HBAR otherwise. +const HBARX_POOLS = ["0.0.1412476", "0.0.1412488"]; async function ethTvl(api) { return await api.call({ abi: "uint256:totalAssets", target: "0xcf5ea1b38380f6af39068375516daf40ed70d299" }); @@ -13,7 +17,7 @@ module.exports = { timetravel: false, methodology: "We aggregated the assets staked across Stader staking protocols", /*terra: { tvl },*/ - hedera: { tvl: sumTokensExport({ owners: [HBARX_STAKING] }) }, + hedera: { tvl: sumTokensExport({ owners: [HBARX_STAKING, ...HBARX_POOLS] }) }, fantom: { tvl: () => ({}) }, terra2: { tvl: () => ({}) }, bsc: { tvl: () => ({}), }, From 1f45e431af715df0d80eb3824ce6f7cb5e81c5a1 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Wed, 14 Oct 2026 10:31:18 +0200 Subject: [PATCH 239/988] Add Galaxy and Keyrock Arc Morpho vaults to curator registry (#21606) --- registries/curators.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/registries/curators.js b/registries/curators.js index f437924f75a..502bb5d2c16 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -671,6 +671,11 @@ const configs = { base: { morphoVaultOwners: ["0x42D510eDeb9257f8D920d5B9f5109D95cB22419d"], }, + arc: { + morpho: [ + '0x8E357432CC12ff425c36432F312968aEb16112AF', // Galaxy USDC, $89.7M 2026-10-13; curator "Galaxy Curation" per Morpho UI; 100% one MarketV1 market + ], + }, }, }, }, @@ -802,6 +807,11 @@ const configs = { '0xbA75546ACD56b3a9142f94F179b03970eE4283Fd', // initial owner — Keyrock V1/V2 vaults ], }, + arc: { + morpho: [ + '0x5bEfAb92a5A3D60F578Cb51EEb4e4FD50a1e3123', // Keyrock Prime USDC, $75.0M 2026-10-13; curator "Keyrock" per Morpho UI; 100% one MarketV1 market + ], + }, } }, }, From 457122adb7c72af08900814d0b00c2fee1b6f3cc Mon Sep 17 00:00:00 2001 From: keepdotcoffee <296388594+keepdotcoffee@users.noreply.github.com> Date: Wed, 14 Oct 2026 16:31:48 +0800 Subject: [PATCH 240/988] Fix Keep RH Full TVL factory migration (#21605) Co-authored-by: keepdotcoffee --- projects/keep-protocol/index.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/projects/keep-protocol/index.js b/projects/keep-protocol/index.js index 45ad625e47c..f1b19663d07 100644 --- a/projects/keep-protocol/index.js +++ b/projects/keep-protocol/index.js @@ -7,9 +7,14 @@ const PROGRAM_IDS = [ new PublicKey("2ww3589FBTgwbCd9sbpBjosiDszsigoqArh5xuc7F2Ve"), // Idea Mode ]; -// Robinhood Chain production deployment (2026-07-15). Each project is an -// independent Launchpad clone that directly holds refundable Paxos USDG. -const RH_FACTORY = "0x032EAfc08388283e94E44Fb0eA26A004D44ba40d"; +// Robinhood Chain production deployments. Each project is an independent +// Launchpad clone that directly holds refundable Paxos USDG. Keep both the +// original production factory and the current metadata-v1 factory so TVL +// remains continuous across the factory migration. +const RH_FACTORIES = [ + "0x032EAfc08388283e94E44Fb0eA26A004D44ba40d", // original production factory + "0xC3f2831429F51aCe9243aCe75819488e3566CA7b", // metadata-v1 factory, block 86016310 +]; // Anchor account discriminator for LaunchpadState (base58 of the first 8 bytes). const LAUNCHPAD_DISC = "VgW83Wf4icd"; @@ -45,11 +50,12 @@ async function tvl(api) { } async function robinhoodTvl(api) { - const launchpads = await api.fetchList({ - target: RH_FACTORY, + const launchpadLists = await Promise.all(RH_FACTORIES.map((target) => api.fetchList({ + target, lengthAbi: "uint64:nextProjectId", itemAbi: "function launchpadOf(uint64) view returns (address)", - }); + }))); + const launchpads = [...new Set(launchpadLists.flat())]; await api.sumTokens({ owners: launchpads, tokens: [ADDRESSES.robinhood.USDG] }); } From 63500ef77c341c762d87fce012e79e90931e7b50 Mon Sep 17 00:00:00 2001 From: Red Tiger <129599634+redtigercrypto@users.noreply.github.com> Date: Wed, 14 Oct 2026 10:48:30 +0200 Subject: [PATCH 241/988] Add Qualia Upshift curator TVL adapter (#21224) Co-authored-by: ccipherx --- registries/sumTokens.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 79633885466..5d63ed20f41 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -23470,6 +23470,22 @@ const configs = { ] }, }, + "qualia": { + "doublecounted": true, + "methodology": "Counts the WMON held by the Kintsu superMON vault on Monad and the USDe held by the HLPe vault on Hyperliquid, both Upshift vaults curated by Qualia. Assets the vault operator reports as deployed outside the vaults are not counted. The vaults are also counted under Upshift.", + "monad": { + "owner": "0x792C7c5fB5C996E588b9F4A5FB201C79974e267C", // Kintsu superMON + "tokens": [ + ADDRESSES.monad.WMON + ] + }, + "hyperliquid": { + "owner": "0x8fFDcd8A96d293f45aA044d10b899F9D71897E8a", // HLPe + "tokens": [ + ADDRESSES.hyperliquid.USDe + ] + }, + }, "quantum-unit": { "methodology": "count all contract balance", "bsc": { From 8c2f9fcd3eb1487ef552d1b9334a2a4c028c7199 Mon Sep 17 00:00:00 2001 From: THT <97409746+tiagoterron@users.noreply.github.com> Date: Wed, 14 Oct 2026 10:51:12 +0200 Subject: [PATCH 242/988] Add Pumper Protocol (Stable): TVL, pool2, staking, treasury (#21607) Co-authored-by: terron Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/pumper-protocol/index.js | 72 +++++++++++++++++++++++++++++++ registries/treasury.js | 18 ++++++++ 2 files changed, 90 insertions(+) create mode 100644 projects/pumper-protocol/index.js diff --git a/projects/pumper-protocol/index.js b/projects/pumper-protocol/index.js new file mode 100644 index 00000000000..8dd4c9f48ab --- /dev/null +++ b/projects/pumper-protocol/index.js @@ -0,0 +1,72 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +// Pumper Protocol (pumper.tools) on Stable. +// +// Every launchpad generation registers its launches in PumperProtocolRegistry, +// so the registry's allTokens list is the exact set of Pumper launches. +// - V3 launchpads hold their tokens' Uniswap V3 LP NFTs (stableswap position +// manager) themselves. That liquidity is also counted as stableswap DEX +// TVL, hence doublecounted. +// - V4 and Lock launchpads register Pumper's own Uniswap V4 PoolManager +// instead of a pool; the PoolManager holds those launches' liquidity. Lock +// launchpads also escrow curve raises before migration, in the launchpad +// itself (v2) or in a per-launch vault (v3+). +// Only the stablecoin side (USDT0 / WgUSDT) is counted; launched tokens are +// not priced. + +const REGISTRY = '0x7Cd190e5Ba34C1Ec8FE07F78EddB026719940492' +const V4_POOL_MANAGER = '0x3F95674d4C0c2FB1525DA536e0A57f4A86902665' + +const PUMPER = '0xd86800D5b021F5D79350C2F742Bbb1ecc010Bf82' +const USDT0 = '0x779Ded0c9e1022225f8E0630b35a9b54bE713736' +const WGUSDT = '0x817997Ca8394E26CCE3dE3A076a4889b27DbF9dE' +const QUOTE_TOKENS = [USDT0, WGUSDT] +// PumperRewardLocker: staked PUMPER +const PUMPER_STAKING = [ + '0x1276021Cf10aD7b3f9677Ee5A70827146Cc1b5CF', // WgUSDT reward pool (legacy) + '0x9CA420D62cb4Aa52c2E86096aa3b0bD072a1334B', // USDT0 reward pool +] + +async function getLaunches(api) { + const tokens = await api.fetchList({ lengthAbi: 'totalTokens', itemAbi: 'allTokens', target: REGISTRY }) + const records = await api.multiCall({ + abi: 'function tokens(address) view returns (address creator, address pool, address launchpad)', + target: REGISTRY, + calls: tokens, + }) + const launches = records.map((r, i) => ({ token: tokens[i], pool: r.pool, launchpad: r.launchpad })) + const isV4 = (l) => l.pool.toLowerCase() === V4_POOL_MANAGER.toLowerCase() + return { + v3Launchpads: [...new Set(launches.filter((l) => !isV4(l)).map((l) => l.launchpad))], + v4Launches: launches.filter(isV4), + } +} + +async function tvl(api) { + const { v3Launchpads, v4Launches } = await getLaunches(api) + const v4Launchpads = [...new Set(v4Launches.map((l) => l.launchpad))] + // vaultOf exists only on the Lock launchpads that escrow in a per-launch vault + const vaults = await api.multiCall({ + abi: 'function vaultOf(address) view returns (address)', + calls: v4Launches.map((l) => ({ target: l.launchpad, params: [l.token] })), + permitFailure: true, + }) + const escrows = [V4_POOL_MANAGER, ...v4Launchpads, ...vaults.filter((v) => v && !/^0x0+$/.test(v))] + return sumTokens2({ + api, + owners: [...v3Launchpads, ...escrows], + tokens: QUOTE_TOKENS, + resolveUniV3: true, + uniV3WhitelistedTokens: QUOTE_TOKENS, + }) +} + +async function staking(api) { + return sumTokens2({ api, owners: PUMPER_STAKING, tokens: [PUMPER] }) +} + +module.exports = { + doublecounted: true, // V3 launch liquidity is also stableswap DEX TVL + methodology: 'TVL is the USDT0/WgUSDT side of the liquidity of every token launched on Pumper Launchpad: the Uniswap V3 LP positions held by the V3 launchpads, the liquidity in Pumper\'s Uniswap V4 PoolManager used by the V4 and Lock launchpads, and curve raises escrowed by the Lock launchpads before migration. Launches are taken from PumperProtocolRegistry. Staking is PUMPER staked in the Pumper Staking Pool (PUMPER reward lockers). Launched tokens\' own Pumper Launchpad staking pools are not counted, since launched tokens have no price.', + stable: { tvl, staking }, +} diff --git a/registries/treasury.js b/registries/treasury.js index 4af314bb379..fb0b1e80d14 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -4638,6 +4638,24 @@ const configs = { uniV3nftsAndOwners: [['0xE9baC8f0100C3229AbddE01D692c6e5791d3b544', '0x940e79c49d73ce46884f57087e0c78b608da57c6']], }, }, + 'treasury/pumper-protocol': { + stable: { + tokens: [ADDRESSES.stable.USDT0, '0x817997Ca8394E26CCE3dE3A076a4889b27DbF9dE'], // USDT0, WgUSDT + owners: [ + '0x88417F6cF37DAf2055f325B9de4498B8da2f4359', // PumperTreasuryVaultV3 + '0x3d641ad57af4cFb9C354e7554dDbcf29033b699A', // PumperTreasuryVault V2 (abandoned) + '0x5198a9A0c4f44f1494d4931697cC693CA3673320', // PumperTreasuryVault V1 + '0x600191784c1F56fE1930Cb9A084c23d47d76aDD6', // PumperTreasuryVault V2 + '0xD3173b0CC00FAAdb8D3FBF9035DA2B26491eC170', // PumperTreasuryVault V2 (abandoned) + '0xF4F918bdc3B4e2717D05034C8a079c5c1Ae3d7Ee', // PumperTreasuryVault V2 (abandoned) + '0xb961cE542585F15DC447eF97a11A3392DbD11F06', // admin vault (10% launchpad cut) + '0x19f2A134F39dF26370E09B36A7817D23Eec6fE6A', // PumperLpGaugeV3: team PUMPER/USDT0 LP, admin-removable + '0x859f6F2Fe604B2d132a969EdA2b406a0293801d3', // PumperGoldGauge + ], + ownTokens: ['0xd86800D5b021F5D79350C2F742Bbb1ecc010Bf82'], // PUMPER + resolveUniV3: true, + }, + }, 'treasury/push': { ethereum: { owners: ['0x19Ff5f2C05aC6a303aF6d5002C99686e823EBE72'], From 3b9f27684b4b30a4fce22927aa0baa0f784cfa92 Mon Sep 17 00:00:00 2001 From: hisham-takadao Date: Wed, 14 Oct 2026 16:51:58 +0800 Subject: [PATCH 243/988] Add TVL adapter for The LifeDAO BTC-ETH Vault (#21616) Co-authored-by: ccipherx --- registries/sumTokens.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 5d63ed20f41..fa52c66bb4f 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -27780,12 +27780,18 @@ const configs = { }, }, "the-lifedao": { - "methodology": "TVL is calculated by unwrapping the Savings Vault's Uniswap V3 USDC/USDT LP position on Arbitrum into its underlying token balances.", + "methodology": "Counts idle USDC in the Savings Vault and BTC-ETH Investment Vault, the Uniswap V3 LP positions both vaults hold (USDC/USDT and WBTC/WETH), and idle WBTC/WETH in the BTC-ETH strategy, on Arbitrum.", "arbitrum": { - "owner": "0x6d1bD94Cd572e51Aa018aE6Bf909BA61F8F8d4f9", + "owners": [ + "0x6d1bD94Cd572e51Aa018aE6Bf909BA61F8F8d4f9", + "0x86565284b9e6c29da4c401b3C59128F8672C216D", + "0x317c1b07442bb945FF139517c0F6fa91d0C0d0b7" + ], "resolveUniV3": true, "tokens": [ - ADDRESSES.arbitrum.USDC + ADDRESSES.arbitrum.USDC_CIRCLE, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.WETH ] }, }, From a08e292aa29e5bc371ee6ae46e782f8c6a9b2e41 Mon Sep 17 00:00:00 2001 From: Dani Date: Wed, 14 Oct 2026 10:53:10 +0200 Subject: [PATCH 244/988] torch: fail loudly on dex v2 api, drop dead yield api leg (#21619) Co-authored-by: Lionel Git-si <3989784+navionis@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- projects/torch/index.js | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/projects/torch/index.js b/projects/torch/index.js index dd49173bbb8..329abbedeb0 100644 --- a/projects/torch/index.js +++ b/projects/torch/index.js @@ -6,26 +6,7 @@ const DEX_V1 = 'EQCaEOMOR2SRcXTVSolw--rY62ghCoCRjn4Is3bBdnqYwIVZ' // DEX V1 Rout const YIELD_ROUTER = 'EQDYU6gxBxFT3arWR-N9RFTfqAoQKyWk4JMgTBNOM2KL18Dw' // Yield Router Contract async function tvl(api) { - let yieldTvl = 0 - let dexV2Tvls = { tvl: 0 } - - try { - const tokenTvl = await get('https://yield-api.torch.finance/tvl') // Yield API - yieldTvl = tokenTvl.reduce((acc, data) => { - acc += Number(data.tvl) / 1e9 - return acc - }, 0) - } catch (e) { - console.log("Failed to fetch yield TVL, defaulting to 0:", e.message) - } - - try { - dexV2Tvls = await get('http://api.torch.finance/metrics/tvl') // DEX V2 API - } catch (e) { - console.log("Failed to fetch DEX V2 TVL, defaulting to 0:", e.message) - } - - const totalTvl = yieldTvl + dexV2Tvls.tvl + const dexV2Tvls = await get('http://api.torch.finance/metrics/tvl', { timeout: 30000 }) // DEX V2 API await sumTokens({ api, @@ -33,7 +14,7 @@ async function tvl(api) { tokens: [ADDRESSES.ton.TON], }); - api.add(ADDRESSES.ton.USDT, totalTvl * 1e6) + api.add(ADDRESSES.ton.USDT, dexV2Tvls.tvl * 1e6) } module.exports = { From c46f9dbcec62921b044490b5c15120b6d67a0f75 Mon Sep 17 00:00:00 2001 From: Dani Date: Wed, 14 Oct 2026 10:54:17 +0200 Subject: [PATCH 245/988] credix: scope borrowed to production markets (resolves #21614) (#21618) Co-authored-by: Lionel Git-si <3989784+navionis@users.noreply.github.com> --- projects/credix/index.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/projects/credix/index.js b/projects/credix/index.js index 65a5c31e172..e09453c4151 100644 --- a/projects/credix/index.js +++ b/projects/credix/index.js @@ -5,6 +5,7 @@ const { getProvider, sumTokens2, } = require("../helper/solana"); const MARKET_SEED_FINTECH = "credix-marketplace"; const MARKET_SEED_RECEIVABLES = "receivables-factoring"; +const PRODUCTION_MARKET_SEEDS = new Set([MARKET_SEED_FINTECH, MARKET_SEED_RECEIVABLES]); const USDC = ADDRESSES.solana.USDC; const programId = new PublicKey("CRDx2YkdtYtGZXGHZ59wNv1EwKHQndnRc1gT4p8i2vPX"); const encodeSeedString = (seedString) => @@ -50,6 +51,8 @@ async function tvl() { module.exports = { timetravel: false, + methodology: + "TVL is the USDC held by the two production pool signing authorities (credix-marketplace and receivables-factoring) on Solana. Borrowed is poolOutstandingCredit on those same two markets; test/simulation markets and the protocol treasury are excluded.", solana: { tvl, borrowed, @@ -57,26 +60,21 @@ module.exports = { }; async function borrowed(api) { - + const provider = getProvider(); const program = constructProgram(provider); - const states = await program.account.globalMarketState.all(); + const seeds = [...PRODUCTION_MARKET_SEEDS]; + const pdas = await Promise.all( + seeds.map(async (seed) => (await findGlobalMarketStatePDA(seed))[0]) + ); + const states = await program.account.globalMarketState.fetchMultiple(pdas); - states.forEach(({ account }) => { + states.forEach((account, i) => { + if (!account) throw new Error(`credix: missing globalMarketState for market ${seeds[i]}`) api.add(account.baseTokenMint.toBase58(), account.poolOutstandingCredit.toString()) }) } -async function tvl1(api) { - - const provider = getProvider(); - const program = constructProgram(provider); - const states = await program.account.globalMarketState.all(); - - const tokenAccounts = states.map(({ account }) => account.treasuryPoolTokenAccount.toBase58()) - return sumTokens2({ tokenAccounts }) -} - const idl = { version: '3.11.0', name: 'credix', From b696d7332acd36cb686652bacc895691ac490e44 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 14 Oct 2026 12:16:08 +0200 Subject: [PATCH 246/988] feat: align Zyfai adapter with current vaults (USDT, PYUSD and others) (#21621) Co-authored-by: Cursor --- projects/zyfai/base.js | 12 +++++++++++- projects/zyfai/ethereum.js | 15 +++++++++++++++ projects/zyfai/index.js | 4 ++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/projects/zyfai/base.js b/projects/zyfai/base.js index 4ead7f5d7a0..14cf97c6c15 100644 --- a/projects/zyfai/base.js +++ b/projects/zyfai/base.js @@ -7,7 +7,8 @@ const BASE_AAVE_POOLS = { }; const FLUID_POOL_ADDRESSES = { 'USDC': '0xf42f5795D9ac7e9D757dB633D693cD548Cfd9169', - 'wstETH': '0x896E39f0E9af61ECA9dD2938E14543506ef2c2b5' + 'wstETH': '0x896E39f0E9af61ECA9dD2938E14543506ef2c2b5', + 'EURC': '0x1943FA26360f038230442525Cf1B9125b5DCB401', }; const MORPHO_POOL_ADDRESSES = { 'Universal - USDC': '0xB7890CEE6CF4792cdCC13489D36D9d42726ab863', @@ -40,6 +41,7 @@ const MORPHO_POOL_ADDRESSES = { 'Clearstar Core ETH V2': '0xBCA4E2E24A7cFa776E4282CC8Eb06f04738b71da', 'Steakhouse High Yield USDC V2': '0xbeeff7aE5E00Aae3Db302e4B0d8C883810a58100', 'Noon Ecosystem Vault': '0x8B12106a70FE2F8bB255F691f1CF9a9ccfB278AF', + 'Yearn OG USDC V2': '0xe7D0DBE3493830e2Ab62619211A2BfF0Fc60dB42', }; const SPARK_POOL_ADDRESSES = { 'USDC': '0x3128a0F7f0ea68E7B7c9B00AFa7E41045828e858' @@ -83,6 +85,8 @@ const SUPERFORM_POOLS = { 'Flagship Base WETH SuperVault': '0x0e70c10fa06931f7b878653a15aecc86145c1af7', 'Flagship Base CBBTC SuperVault': '0xfc8a6526ffcd8248b8d0f8dac8037dbe438924ce', 'NVDAC': '0xc441a2cc3a528b6312740448a70cc4d40f4d7bfc', + 'GOOGLC': '0x363600ac7173e8d91bcfee68d711bb93e992c110', + 'AAPLC': '0x301a1ceb684d62833101b373ab6c395349b24033', }; const BASE_YEARN_POOLS = { @@ -97,6 +101,11 @@ const IPOR_POOLS = { 'Apple Carry Trade': '0x31744e44d6af88225c1dbefbe5df8308faea641b', 'Meta Carry Trade': '0xcd19f18884bf388b866d05cdd1ae351133821f01', 'Google Carry Trade': '0x01dbdb9748ecf71b1ffbb62f5cb41318531ba362', + USDC: '0xd46a3c2d958d0a2cb098d48c48dc19fe3a710f37', +}; + +const AUTOFINANCE_POOLS = { + USDC: '0x9c6864105AEC23388C89600046213a44C384c831', // baseUSD }; // const BASE_YO_PROTOCOL_POOLS = { @@ -119,6 +128,7 @@ const allPoolTokens = [ ...Object.values(BASE_EULER_POOLS), ...Object.values(BASE_YEARN_POOLS), ...Object.values(IPOR_POOLS), + ...Object.values(AUTOFINANCE_POOLS), // ...Object.values(BASE_YO_PROTOCOL_POOLS), // ...Object.values(BASE_LAZY_SUMMER_POOLS), COMPOUND_TOKEN_ADDRESS, diff --git a/projects/zyfai/ethereum.js b/projects/zyfai/ethereum.js index 6106394c22e..10b2562882c 100644 --- a/projects/zyfai/ethereum.js +++ b/projects/zyfai/ethereum.js @@ -4,6 +4,7 @@ const AAVE_POOLS = { WETH: '0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8', // aEthWETH wstETH: '0x0B925eD163218f6662a35e0f0371Ac234f9E9371', // aEthWSTETH cbBTC: '0x5c647cE0Ae10658ec44FA4E11A51c96e94efd1Dd', // aEthcbBTC + PYUSD: '0x0C0d01AbF3e6aDfcA0989eBbA9d6e85dD58EaB1E', // aEthPYUSD }; const COMPOUND_POOLS = { USDC: '0xc3d688B66703497DAA19211EEdff47f25384cdc3', // cUSDCv3 @@ -58,6 +59,18 @@ const COMPOUND_POOLS = { 'KPK USDC Prime': '0x4Ef53d2cAa51C447fdFEEedee8F07FD1962C9ee6', 'Api3 dCOMP USDC': '0x36cfe1568461E499391ef0A555300F1ae2da2439', 'Hyperithm USDC Apex': '0x777791C4d6DC2CE140D00D2828a7C93503c67777', + 'Wintermute USDT Select': '0x500aE64100D7DbDb640531085C2F5d40cDC8930D', + 'Gauntlet USDT Frontier': '0xE571B648569619566CF6ce1060C97B621CB635D3', + 'Wintermute USDT Prime': '0xBf29043164660C60A2a72Cd15FFe2304e87B6838', + 'Uniswap USDT': '0xb8274eFADB953FE9ae052D481a3FC5B6A3ceD703', + 'PayPal USD Main': '0xb576765fB15505433aF24FEe2c0325895C559FB2', + 'Sentora Huma PST Main': '0x8381a156958711E230f325428B5eb4b6555C75D9', + 'Sentora mWIN Main': '0x7cBcfc4F64be199eDE6db1D916ddcdb69f666B57', + 'Sentora PRIME Main': '0xC21b08C16458202593D4D9B26b9984Ee67b38BbD', + 'Steakhouse Prime Instant PYUSD': '0xbeef00B5d83C1188F07A5184230a805639c39f04', + 'Keyrock USDC V2': '0x04422053aDDbc9bB2759b248B574e3FCA76Bc145', + 'KPK ETH Prime': '0xBb50A5341368751024ddf33385BA8cf61fE65FF9', + 'Pendle Ecosystem USDC V2': '0x55C1B6e461a6334B567bAF0FEb5D728715446f05', }; // Fluid (Ethereum mainnet) @@ -87,6 +100,8 @@ const COMPOUND_POOLS = { 'Euler Earn USDC': '0x3B4802FDb0E5d74aA37d58FD77d63e93d4f9A4AF', 'Euler Prime WETH': '0xD8b27CF359b7D15710a5BE299AF6e7Bf904984C2', 'K3 Capital Prime USDC': '0x797DD80692c3b2dAdabCe8e30C07fDE5307D48a9', + 'K3 Capital Earn USDT': '0xb072b2779F1EF1A6A9D2d5fAa1766F341B92aB3a', + USDC: '0xe0a80d35bB6618CBA260120b279d357978c42BCE', // eUSDC-22 }; // Wasabi Protocol (Ethereum mainnet) diff --git a/projects/zyfai/index.js b/projects/zyfai/index.js index 6db6d7455e2..2db63c02327 100644 --- a/projects/zyfai/index.js +++ b/projects/zyfai/index.js @@ -148,6 +148,9 @@ const ARBITRUM_DOLOMITE_POOLS = { 'USDC': '0x444868B6e8079ac2c55eea115250f92C2b2c4D14', 'WETH': '0xf7b5127B510E568fdC39e6Bb54e2081BFaD489AF', }; +const ARBITRUM_AUTOFINANCE_POOLS = { + USDC: '0xf63b7F49B4f5Dc5D0e7e583Cfd79DC64E646320c', // arbUSD +}; const arbitrumPoolTokens = [ ...Object.values(COMPOUND_POOLS), ...Object.values(ARBITRUM_AAVE_POOLS), @@ -158,6 +161,7 @@ const arbitrumPoolTokens = [ ...Object.values(ARBITRUM_EULER_POOLS), ...Object.values(ARBITRUM_HARVEST_POOLS), ...Object.values(ARBITRUM_DOLOMITE_POOLS), + ...Object.values(ARBITRUM_AUTOFINANCE_POOLS), ] // --- inlined from ./plasma --- From 3bbc875ae5ac7c9b1640eefaad313f8c9ea17d2f Mon Sep 17 00:00:00 2001 From: kpk-giel Date: Wed, 14 Oct 2026 11:16:50 +0100 Subject: [PATCH 247/988] kpk: add YO Ecosystem and Arbitrum EURe Yield, drop the deprecated Ethereum EURe vault (#21622) Co-authored-by: Claude Opus 5.5 --- projects/kpk/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/kpk/index.js b/projects/kpk/index.js index dc799cc195c..c2026dbbd47 100644 --- a/projects/kpk/index.js +++ b/projects/kpk/index.js @@ -54,8 +54,8 @@ const configs = { "0xdaD4e51d64c3B65A9d27aD9F3185B09449712065", //Morpho v1 USDT Prime "0x870F0BF29A25A40E7CC087cD5C53e70C11F2C8A8", //Morpho v2 USDT Prime "0xb5ce3CA2C774b72955C25875022FdD91f7a7B938", //Morpho v2 wARS Yield - "0x6251482812cE95d11b3E447FE6888b1a1bE66C25", //Morpho v2 EURe Yield "0x7a72bcD2c3F7F7e4D6679170a0625bAB15D7DDa1", //Morpho v2 USDC Yield RWA + "0x355A1c6A3f1946d4DbD7cE932492925AB9F261a7", //Morpho v2 YO Ecosystem ], // Other ERC-4626 vaults (non-Morpho) @@ -91,6 +91,7 @@ const configs = { morpho: [ "0x2C609d9CfC9dda2dB5C128B2a665D921ec53579d", //Morpho USDC Yield "0x5837e4189819637853a357aF36650902347F5e73", //Morpho USDC Yield v2 + "0x7bfdE3A7bd346Da92521D384563F89BB45dE1f60", //Morpho v2 EURe Yield ], }, base: { From 957054f576b7da1f1acaf38929881184cf1c817d Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 14 Oct 2026 11:17:30 +0100 Subject: [PATCH 248/988] Morpho (#21610) --- projects/morpho-blue/config.js | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/projects/morpho-blue/config.js b/projects/morpho-blue/config.js index bcf6b427ff6..24fbb59f4a0 100644 --- a/projects/morpho-blue/config.js +++ b/projects/morpho-blue/config.js @@ -2,13 +2,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const config = { ethereum: { morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb", - blackList: [ - "0x8413D2a624A9fA8b6D3eC7b22CF7F62E55D6Bc83", - ADDRESSES.base.USDC, - ADDRESSES.optimism.WSTETH, - '0x84b78bc998e4b1a63f2cf9ebfe76c55fc96a5a9b', - '0x52c66b5e7f8fde20843de900c5c8b4b0f23708a0' // AZND token used to artificially inflate Morpho total deposit metric - ], fromBlock: 18883124, blacklistedMarketIds: [ "0x1dca6989b0d2b0a546530b3a739e91402eee2e1536a2d3ded4f5ce589a9cd1c2", @@ -31,7 +24,6 @@ const config = { }, base: { morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb", - blackList: ["0x6ee1955afb64146b126162b4ff018db1eb8f08c3", '0xda1c2c3c8fad503662e41e324fc644dc2c5e0ccd', '0x46415998764c29ab2a25cbea6254146d50d22687', '0x5e331e9ae6e1a5d375f699811736527222a9db15', '0x2dc205f24bcb6b311e5cdf0745b0741648aebd3d', '0xadcdd085ad2887758255090589f72237bdd33d8a', '0xcb327b99ff831bf8223cced12b1338ff3aa322fa', '0xadcdd085ad2887758255090589f72237bdd33d8e', '0x4bcaf180df5b13c0441fe41a66e9638a2a410c6d'], // HERMES token used to artificially inflate Morpho total deposit metric fromBlock: 13977148, blacklistedMarketIds: [ '0xff0f2bd52ca786a4f8149f96622885e880222d8bed12bbbf5950296be8d03f89', // bad debt due to resolv hack @@ -42,11 +34,6 @@ const config = { }, arbitrum: { morphoBlue: "0x6c247b1F6182318877311737BaC0844bAa518F5e", - blackList: [ - "0xf8b3fa720a9cd8abeed5a81f11f80cd8f93e6b57", - "0x010700ab046dd8e92b0e3587842080df36364ed3", // K token inflated by Kinto exploit - '0x57587e47a0af9d1bb93c0d4b3df671b053ab4366', // GLVT token - verify backing - ], fromBlock: 296446593, blacklistedMarketIds: [ "0xfdb8221edcae73f73485d55c30e706906114bc2ff4634870c5c57e8fb83eae6a", // K/USDC bad debt from Kinto exploit @@ -68,7 +55,6 @@ const config = { }, polygon: { morphoBlue: "0x1bF0c2541F820E775182832f06c0B7Fc27A25f67", - blackList: ["0x45d4a31854f09a257ff6b3c3ae0d0f479a898da9", "0xaffcf1312772583d9d0b9f6e68f5767154b29dfd", "0xa39c45a857bb82df069f63ca8741a02ebe7e9719", "0xc69e948a9a5c123704580c46332f90cff1cb215b", "0x316c0b5cd67aa7c2da7a576d3724e3763981d08f", "0xd59a2e7d5110dc379910925aa0472a13e09a093e", "0xc7a357293a35ce4c8d7f2000571043313987aab7", "0xf14c4fd60765e36d63f6c8b8161bd41ba995fb44", "0x338a4ef6953b36e67ccf7cffe50ebc74b1d64387", "0x12fd05a9306affc946cb13301d88a102400544d2", "0x8a874eb137d99415bad95c5d4399bc691849d02f", "0x365ab7828ea541c1d6e30472a1a1e7d07600a6bd", "0xc7056597f3a816202486b5082b3291a2023c9633", "0x2faaa34f387e6485671faeda7c021ee6af961d35"], fromBlock: 66931042, }, scroll: { @@ -113,7 +99,7 @@ const config = { // }, hyperliquid: { morphoBlue: "0x68e37dE8d93d3496ae143F2E900490f6280C57cD", - blackList: ['0x66a1e37c9b0eaddca17d3662d6c05f4decf3e110'], + blackList: ['0x0aD339d66BF4AeD5ce31c64Bc37B3244b6394A77'], // USR on hyperevm; the entry here was the ethereum address fromBlock: 1988429, }, plume_mainnet: { @@ -176,7 +162,6 @@ const config = { }, monad: { morphoBlue: "0xD5D960E8C380B724a48AC59E2DfF1b2CB4a1eAee", - blackList: ['0x4917a5ec9fcb5e10f47cbb197abe6ab63be81fe8'], // AZND token used to artificially inflate Morpho total deposit metric fromBlock: 31907457, }, stable: { From 2bd814a00f9d7f57c4d9c2628a1e471e3acd4c21 Mon Sep 17 00:00:00 2001 From: M Armaghan Raza <67154539+ArmaghanRazaChaudhary@users.noreply.github.com> Date: Wed, 14 Oct 2026 15:48:35 +0500 Subject: [PATCH 249/988] Add Stax TVL adapter (Robinhood Chain) (#21552) --- projects/stax/index.js | 55 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 projects/stax/index.js diff --git a/projects/stax/index.js b/projects/stax/index.js new file mode 100644 index 00000000000..437000d8d61 --- /dev/null +++ b/projects/stax/index.js @@ -0,0 +1,55 @@ +// Stax (stax.finance) -- tokenized-stock index baskets on Robinhood Chain. +// TVL = the stock tokens and USDG held as basket collateral by the two Stax vaults +// (v19 and V2) and by the V2 community-basket clones created through the Stax factory. +// Baskets are discovered from the vaults' BasketCreated events and the factory's list, +// and each basket's token list is read on-chain, so new baskets and tickers are picked +// up without an adapter change. A failed read of an existing basket throws (no silent +// under-reporting). +// Not counted: STAX staked in StaxStaking (governance token), USDG parked in the +// rewards distributor, protocol fee buckets. +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getLogs2 } = require("../helper/cache/getLogs"); + +const VAULTS = [ + { address: "0x13045D3Dab253fDB15181C16f135D612fa8546E6", fromBlock: 46338037 }, // StaxVaultV2 "v19" -- commodities, retailfavorites, mag7, mag7cap + { address: "0xAda84161033C0Cc54EF21CEeF913A8fEC4239b33", fromBlock: 68883165 }, // StaxVaultV2 (V2) -- newer baskets +]; +const USER_BASKET_FACTORY = "0x1de6a6bD0C62097A7559A29a76e41985558f9918"; // StaxUserBasketFactoryV2 +const USDG = "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"; + +const abi = { + basketCreated: "event BasketCreated(uint256 indexed basketId, address token, string name)", + getBasketComposition: "function getBasketComposition(uint256 basketId) view returns (address[] tickers, uint256[] weights)", + getComposition: "function getComposition() view returns (address[] tickers, uint256[] weights)", + basketCount: "uint256:basketCount", + baskets: "function baskets(uint256) view returns (address)", +}; + +async function tvl(api) { + const owners = VAULTS.map((v) => v.address); + const tokens = new Set([USDG]); + const addTickers = (comps) => comps.forEach((c) => c.tickers.forEach((t) => tokens.add(t))); + + // Vault baskets: ids from BasketCreated events (exact, no cap); compositions must all resolve. + for (const vault of VAULTS) { + const created = await getLogs2({ api, target: vault.address, eventAbi: abi.basketCreated, fromBlock: vault.fromBlock }); + const ids = created.map((e) => e.basketId); + if (!ids.length) continue; + addTickers(await api.multiCall({ abi: abi.getBasketComposition, calls: ids.map((id) => ({ target: vault.address, params: [id] })) })); + } + + // Community baskets: clones hold their own collateral. + const clones = await api.fetchList({ lengthAbi: abi.basketCount, itemAbi: abi.baskets, target: USER_BASKET_FACTORY }); + if (clones.length) { + addTickers(await api.multiCall({ abi: abi.getComposition, calls: clones })); + owners.push(...clones); + } + + return sumTokens2({ api, owners, tokens: [...tokens] }); +} + +module.exports = { + methodology: + "TVL is the tokenized-stock tokens and USDG held as basket collateral by the Stax vaults and community-basket contracts on Robinhood Chain, read from each basket's on-chain composition and priced individually. Staked STAX and undistributed rewards are excluded.", + robinhood: { tvl }, +}; From e45cedd504a718f1a52cd24f4a6c2554050511b1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 14 Oct 2026 18:11:19 +0200 Subject: [PATCH 250/988] update blofin --- cex/blofin-cex.js | 73 ++++++++++++++++++++++++--- projects/helper/bitcoin-book/index.js | 3 ++ 2 files changed, 69 insertions(+), 7 deletions(-) diff --git a/cex/blofin-cex.js b/cex/blofin-cex.js index b26c41eeeb9..b2a01e61d74 100644 --- a/cex/blofin-cex.js +++ b/cex/blofin-cex.js @@ -1,3 +1,5 @@ +const EVM_MAIN = "0x7Ff8bbf9C8AB106db589e7863fb100525F61CCe5" + module.exports = { bitcoin: 'blofinCex', bsc: { @@ -6,6 +8,10 @@ module.exports = { "0xdBdf80D997cFAaAC6150cD0cEC2C127fDaD7A823", "0xe5e6c3ced4670697b7cB27a53649a3ED321c18ee", "0x7Ff8bbf9C8AB106db589e7863fb100525F61CCe5", + "0x88C984990573d385949deB571ed21eaD63301045", + "0xFFE011d9B70f616B424E820aA36deba198D947c7", + "0x9FBED2f9b8407a5B48D2106586Bb9824e32F3507", + "0x3B463Ee8099f7f65E852524dD316d80375172D54", ], }, ethereum: { @@ -33,7 +39,6 @@ module.exports = { "94xmX5J92nZLanLvRstmxhgiS8kN8SVfFQ2zPKYB3Ynb", "E3Gd8Hd1yKdkHTQnbenNVBgV2p1MrrenQnVU4SkJD4zx", "3oWiTmU5QpTbSuTCVULybWsXc3DVxixdABxJPerLgTai", - "94xmX5J92nZLanLvRstmxhgiS8kN8SVfFQ2zPKYB3Ynb", "3V11R3pEGSt5XeRaoLDcCdkAB8zVSaKRCm8y3uKBgnsr", "DTLR1QKfH3QWLDm3wkRZqxiH1NQSH4szWxTjGqHCQQSa", "G2dBDN1k6EJdSQNTSeSZ9smwYkFhEgsNNG3mtRE1PVXb", @@ -50,6 +55,8 @@ module.exports = { owners: [ "0x1cA5aa5b1dd8D948bB0971A5fB1762FE172E0040", "0x7Ff8bbf9C8AB106db589e7863fb100525F61CCe5", + "0xe5e6c3ced4670697b7cB27a53649a3ED321c18ee", + "0x3B463Ee8099f7f65E852524dD316d80375172D54", ], }, tron: { @@ -59,7 +66,6 @@ module.exports = { "TRzpEdrAwHXPQYWvXHJArpcac2WV3gXMr3", "TVNRJgNsVMjDPethVVToz9aSvZq9SVgDXv", "THTGgHWFXwgaZEDdaQmR6iuUEa7NKfCUtH", - "TDFHcjw2PiDLjoqxXedaSSEtA1osqu8J6c", "TGJUBfrpYsm2K61jEAqm35f7A9P5XpRNjC", "TTRSjzeqYRghvxZXRdXsiUASt6iU91qtUu", "TEVoZgTB3WsjTjDnxm4BY8CHsULmAjboSA", @@ -85,17 +91,20 @@ module.exports = { }, cardano: { owners: [ + "addr1q833jsn0lvsd2wfr3u9kk7meclwkavmtzc0uarm6tt0zxrlrr9pxl7eq65uj8rctddahn37ad6ekk9sle68h5kk7yv8sazw8h2", "addr1qxdx2vxw9mdqkwq4eyss4xd03g9amv5ahw7je9d7ms748ey6v5cvutk6pvuptjfpp2v6lzstmkefmwaa9j2mahpa20jqudqquv", "addr1qx7ulwm3gkfxdxzsvsd3a8j8tfxql2j75tc572wk73zyz9kg6jsax3gztqfqneqsw05k7vl4r74zt9aaxe93gsxdx8lqjzrfdz", "addr1q9pnql2ut22sw3695jxcegfu8f273jyw78u8605tlx3gj0vf7nsu5v2rrpxpxwsx5ekxx07m3yy4jry5v706aqa4gklq7mwa54", + "addr1qx7tz48uycv3aeawm3fvkjl3hsy8gvxmmwplv6v6tcsvstm76dn2mjkc8mdyccz5aulxe436dxyhkajj3exp92u6vaesqjs8wq", ], }, algorand: { - owners: [], + owners: ["BCXQLC5SV7342EOG7Y7LWDYH2MSDAQE2ANBCDVFCT34GVV5YTOF7JFDOEE"], }, aptos: { owners: [ "0xc16f4401c43f0f787c37f80b21411e8db9d2d7a8f29cf2ede6dbeb9729f3b320", + "0x4573c284f084ee3ba947de170a21626b02120e5b959c66639c8bf1a1b347f59a", ], }, avax: { @@ -106,10 +115,11 @@ module.exports = { ], }, berachain: { - owners: ["0x7Ff8bbf9C8AB106db589e7863fb100525F61CCe5"], + owners: [EVM_MAIN], }, litecoin: { owners: [ + "LQX6xwvEYGb9Axmw87DaLS3CfmGUo95zmA", "Ldjngq3HdTzVLwGLj7TpryQUaFtqydo3HZ", "ltc1qywl4m70amwmrtecxsjz0m08hj64dekmv536asn", "LNUyAM2BssY6CqSN5BNoNTAY4W1q4uV7Eb", @@ -126,23 +136,72 @@ module.exports = { owners: [ "EQCBcLfo7OvsKSVXjqnKY_XpuOEIQtb-acHnk5hS7j9Shl0t", "UQABlbgTwNXZds4fnfdDnQ9GG-vUrebORaA4hbRmleZP5M3e", + "UQACQwlVmqFj4vNW4qLRL1CAaVf4E29K09RIBb_MrFslD-c4", ], }, ripple: { owners: [ "rKBRWUTreGNU9d3pL2gYUo23jn4UdKiAoS", + "r4dPeHxzw2x3X5GvLdYDHRoDsCnCpE1L8d", "rPkX96xtMY2cxQ4Az3N54MB2vTHrp1PTjK", "rBSojpgcRp9LvBguQXzrvNAyuzkP4Z8pZr", "rJMH2SNxmr7e3wsp6jbsQoGRWzqiAzsFny", ], }, hyperliquid: { - owners: ["0x7Ff8bbf9C8AB106db589e7863fb100525F61CCe5"], + owners: [EVM_MAIN], }, mantle: { - owners: ["0x7Ff8bbf9C8AB106db589e7863fb100525F61CCe5"], + owners: [EVM_MAIN], }, doge: { - owners: ["DCH2NkFZ7k5ombczgUNeDrijHeaQUdNJbA"], + owners: [ + "DBCpqeBCPkJzh6Mx7CbEvZu97vSGV6h6bL", + "D62Ki2tM7ybiJghwiGyCzJJqVaUntH5mhy", + "DSpmFnjRUBYQ1yiKtVq7z6MJyjrZbwjba9", + "DR6K8k17AYvGRKaScC4zdG8EPwf5CbNh5W", + "DCH2NkFZ7k5ombczgUNeDrijHeaQUdNJbA", + ], + }, + icp: { + owners: ["f6593c63bbf0881b7673c4352441821a6c3ae1320a5e233cb685f777d96c403f"], + }, + stellar: { + owners: [ + "GCUM66OWLFF7UNMC6SA5BEXBWKBZUPZRLHUJD2OWQGHLMINZUAMOPREO", + "GD33JVOKJC7PJMETV43UOYVMUU5KXWQQ4UPTPCQTIOG44MLSFS64PCH6", + ], + }, + celestia: { + owners: ["celestia1g2uxd7f04ev8ume2tt8lujmryjz3zw6llz0jln"], + }, + cosmos: { + owners: ["cosmos1g2uxd7f04ev8ume2tt8lujmryjz3zw6lwg7z97"], + }, + polkadot: { + owners: ["15s3n5i8wJJyCuL859FTyiA5K5pmbwvB4npx39RTre9Q68Lz"], + }, + sui: { + owners: [ + "0x67b573a009d571986b4ea665fff05baee488a1f8ea47bb60fbb7e81ee1cc7529", + "0xbc8d3755db823aee2d5ed3754d0fd2f4b45649b7ee7a0f38eb8cb8f54875686b", + ], + }, + bittensor: { + owners: ["5G6iyCpKi1pw6338xR2dFsq1rAqStXBTMbGeG5YpVG98HE9J"], + }, + zcash: { + owners: ["t1UHQQqwqefF6UYyYdZtnpvnF5vBEiC9b8P"], + }, + dash: { + owners: ["Xy3gi2zmGKB8QHPcqn85vK6yNs1S49NPkU"], }, + plasma: { owners: [EVM_MAIN] }, + robinhood: { owners: [EVM_MAIN] }, + monad: { owners: [EVM_MAIN] }, + arc: { owners: [EVM_MAIN] }, + klaytn: { owners: [EVM_MAIN] }, + sei: { owners: [EVM_MAIN] }, + plume_mainnet: { owners: [EVM_MAIN] }, + linea: { owners: [EVM_MAIN] }, } diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index 1ae4bb4bc30..00335f0436a 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -487,6 +487,9 @@ module.exports = { "1L153qzyQdrnYuPDeGyyBEHmXyUqWXHzTn", "bc1qwyc5km9j23enhtfke96wt9ejqe9hwdpg222f7f", "1BKWQjCcRGjs9TozqbUEiPnehtzGVmHPXT", + "bc1q9v9lcpmzk8wf9uvv07szm5t445rnr2capk5mey", + "bc1qtkrjaaqy3l42zmu7wrw7wn44xkzxxtqespjavk", + "19XXnYoRw1diwT7MWksBfJ9HoWUKmZV2FG", ], btse: ["bc1qaxyju6n2x2tednv8e7hgnhnz44vrfcmuhjxpfk"], bybit: [ From b5ba324cf72bcfff567e17939cf61efbaada8d34 Mon Sep 17 00:00:00 2001 From: Chimpy Developer <86309030+chimpydev@users.noreply.github.com> Date: Wed, 14 Oct 2026 18:51:28 +0100 Subject: [PATCH 251/988] Create index.js (#21633) --- projects/fang/index.js | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 projects/fang/index.js diff --git a/projects/fang/index.js b/projects/fang/index.js new file mode 100644 index 00000000000..a22a0357dd0 --- /dev/null +++ b/projects/fang/index.js @@ -0,0 +1,60 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { staking } = require("../helper/staking"); + +const gfangTokenAddress = "0x6376010d9D1F64de70D9e83c4093c8294515aC28"; +const fangGenesisAddress = '0xC01B68919Cd0297B1bf43E4942880E98682D3bbF' +// const gfangRewardPoolAddress = "0xe6E0A10eb298F0aC4170f2502cF7b201375BBc85"; +const masonryAddress = "0x33Be17082Bd477dC804EdabBa1A8D777Da3F668d"; + +async function fangGenesisTVL(api) { + const tokens = [ + "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73", // WETH + "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168", // USDG + "0x63C12667638f2Ae6fC6ae09B43D98Ec84a8586eA", // wsNET + "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC", // NVDA + "0x117cc2133c37B721F49dE2A7a74833232B3B4C0C", // SPY + "0x2E8c31162b855A2ffa90F6F8634643Ad6F111e18", // AI + "0x39dBED3a2bd333467115dE45665cC57F813C4571", // PONS + "0x020bfC650A365f8BB26819deAAbF3E21291018b4", // CASHCAT + "0x84d6BB25d3b013c784bE60dC598c920588F452bC", // fBOMB + "0x96765066f6a040a21EB027167D2315B707c82633", // RVH + "0x4e5195469A0360f5dfe811730C9CCaCFF0a0FeeE", // r33 + "0x5BaaeC1B70864f01dbdb747358FF59F2E2cCF7D5", // GIGA + "0x378A50eaC56f45Fb74e4cE7F1962dbCA33515c14", // MCD + "0x9FE4d78202F97E982546Fd5f63E2418FEf8E4ea2", // S33 + "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34", // USDE + "0xab093dEF657F15dF31b33922A95e047aDd645B29", // SHROOM + ] + + return sumTokens2({ api, tokens, owner: fangGenesisAddress, }) +} + + +// const pool2 = async (api) => { +// let gauges = await api.call({ abi: 'address[]:getAllGauges', target: '0x9F59398D0a397b2EEB8a6123a6c7295cB0b0062D' }) +// let pools = await api.multiCall({ abi: 'address:stake', calls: gauges, permitFailure: true }) +// const pools2 = [] +// const gauges2 = [] +// pools.forEach((pool, i) => { +// if (!pool) return; +// pools2.push(pool) +// gauges2.push(gauges[i]) +// }) +// const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: gauges2.map(gauge => ({ target: gauge, params: gfangRewardPoolAddress })) }) +// api.add(pools2, bals) +// return sumTokens2({ api, tokens: pools2, }) +// }; + + +module.exports = { + methodology: "Pool2 deposits consist of FANG/USDG and GFANG/USDG LP tokens deposits while the staking TVL consists of the GFANGs tokens locked within the Masonry contract(0x33Be17082Bd477dC804EdabBa1A8D777Da3F668d).", + hallmarks: [ + ['2025-10-14', 'Genesis Phase Started'] + ], + robinhood: { + tvl: fangGenesisTVL, + // pool2, + staking: staking(masonryAddress, gfangTokenAddress), + }, +}; \ No newline at end of file From 8c4077c94204e576c2fed4974d9799da01738f56 Mon Sep 17 00:00:00 2001 From: Muhammad Amoo Date: Wed, 14 Oct 2026 19:32:10 +0100 Subject: [PATCH 252/988] add bot-oracle tvl adapter (#21550) Co-authored-by: FelixBruguera --- projects/bot-oracle/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/bot-oracle/index.js diff --git a/projects/bot-oracle/index.js b/projects/bot-oracle/index.js new file mode 100644 index 00000000000..554b0d9777f --- /dev/null +++ b/projects/bot-oracle/index.js @@ -0,0 +1,27 @@ +const sdk = require('@defillama/sdk') +const ADDRESSES = require('../helper/coreAssets.json') + +// OracleCoordinator v3 — ERC1967 UUPS proxy; address is permanent across upgrades. +// Holds escrowed request fees + accrued (unwithdrawn) protocol fees. +const COORDINATOR = '0x9A39fc7A9385F820CC9820E291519762DA0720a3' +// Superseded v1 coordinator — empty today, but its escrow balance matters for +// historical refills before the v3 cutover. +const COORDINATOR_V1 = '0x8f487264E1B183F588CAc678D000754D3bd9B07E' +// OperatorRegistry — ERC1967 UUPS proxy. Holds operator stake bonds +// (slashable on fraudulent fulfillment). +const OPERATOR_REGISTRY = '0xfC059C84744843B1651bfa414D5500c0dF8Ca9D1' + +// Balances are native BOT, but bot:0x0000...0000 has no price feed; WBOT is +// priced and 1:1 by construction, so we denominate in it (same convention as +// dexlaunch's wnative on this chain). +async function tvl(api) { + const { output: bals } = await sdk.api.eth.getBalances({ targets: [COORDINATOR_V1, COORDINATOR, OPERATOR_REGISTRY], chain: 'bot', block: await api.getBlock() }) + bals.forEach(({ balance }) => api.add(ADDRESSES.bot.WBOT, balance)) +} + +module.exports = { + methodology: + 'TVL counts native BOT held by OracleCoordinator (fees escrowed while requests are in flight plus accrued protocol fees pending treasury withdrawal) and BOT bonds operators post to OperatorRegistry, which secure fulfillments and are slashable on fraud. Native BOT balances are reported as WBOT (1:1 wrapped native).', + start: '2026-10-05', // first fulfilled request on mainnet (block 25665263) + bot: { tvl }, +} From 49becd97e1c1e59d4c56606537d90d6f70961606 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Wed, 14 Oct 2026 20:44:49 +0200 Subject: [PATCH 253/988] Fix withdraw log cache key casing in inception-lrt (#21596) --- projects/inception-lrt/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/inception-lrt/index.js b/projects/inception-lrt/index.js index e9a30e7da12..9a6057903a0 100644 --- a/projects/inception-lrt/index.js +++ b/projects/inception-lrt/index.js @@ -34,7 +34,7 @@ const eventAbis = { const tvl = async (api) => { for (const vault of symbioticVaults) { const depositedLogs = await getLogs({ api, extraKey: `deposited-${vault}`, fromBlock: 20126194, target: vault, eventAbi: eventAbis.deposit, onlyArgs: true }) - const withdrawLogs = await getLogs({ api, extrakey: `withdraw-${vault}`, fromBlock: 20126194, target: vault, eventAbi: eventAbis.withdraw, onlyArgs: true }) + const withdrawLogs = await getLogs({ api, extraKey: `withdraw-${vault}`, fromBlock: 20126194, target: vault, eventAbi: eventAbis.withdraw, onlyArgs: true }) depositedLogs.forEach(e => api.add(wstETH, e[2])); withdrawLogs.forEach(e => api.add(wstETH, -e[3])); From 671536f8e2c47cdc690592080eca11ee350dbe0d Mon Sep 17 00:00:00 2001 From: vladislavshad <85482010+vladislavshad@users.noreply.github.com> Date: Wed, 14 Oct 2026 21:51:32 +0300 Subject: [PATCH 254/988] [feat] Ditto Earn - add settled-backing TVL on Ethereum and Mezo (#21551) Co-authored-by: FelixBruguera --- projects/ditto-earn/index.js | 93 ++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 projects/ditto-earn/index.js diff --git a/projects/ditto-earn/index.js b/projects/ditto-earn/index.js new file mode 100644 index 00000000000..36ac770f9d5 --- /dev/null +++ b/projects/ditto-earn/index.js @@ -0,0 +1,93 @@ +const ADDRESSES = require('../helper/coreAssets.json'); + +// Maintained deployment inventory: https://docs.dittonetwork.io/ditto-earn +// Roots only: custody links and registered Ethereum strategies are read at api.block. +// Each root maps to its deploy block. +const YIELD_SPLIT = '0x62507A876309639096D08E7F77AC9CfB67Df8011'; +const YIELD_SPLITS = { [YIELD_SPLIT]: 24322294 }; +const MUSD_VAULTS = { + '0x762a17f2B3164ea5010C1C88085AeAC8872957D0': 11046210, // August 11 pilot; still funded + '0x9171Cb787C3fEEbBC808D07CaB62B1d789CE14F8': 12045506, // September 23 V2 +}; +const RECEIVERS = { + '0x7817548BE174C22DecDe831Ea9d514927fD0D286': 25730917, // pilot, Ethereum + '0x73e97D42f341713e2ED10E55964C066d924a8106': 26040404, // V2, Ethereum +}; +const ZERO = '0x0000000000000000000000000000000000000000'; +/** Deduplicate custody addresses case-insensitively and exclude the zero address. */ +const unique = addresses => [...new Set(addresses.map(address => address.toLowerCase()))].filter(address => address !== ZERO); + +/** Roots already deployed at the requested block. */ +async function deployed(api, roots) { + const block = await api.getBlock(); + return Object.keys(roots).filter(address => block >= roots[address]); +} + +/** + * Count settled MUSD/mUSDC cash across vaults and their on-chain custody links. + * Excludes posted NAV, queue liabilities and transfers in flight. + * @param {object} api DeFiLlama Mezo API pinned to the requested block. + * @returns {Promise} Underlying asset balances without duplicate owners. + */ +async function mezoTvl(api) { + const vaults = await deployed(api, MUSD_VAULTS); + if (!vaults.length) return api.getBalances(); + const assets = await api.multiCall({ abi: 'address:asset', calls: vaults }); + if (assets.some(asset => asset.toLowerCase() !== ADDRESSES.mezo.MUSD.toLowerCase())) + throw new Error('Ditto MUSD vault asset changed'); + const queues = await api.multiCall({ abi: 'address:queue', calls: vaults }); + const executors = unique(await api.multiCall({ abi: 'address:executor', calls: vaults })); + const swaps = await api.multiCall({ abi: 'address:swapAdapter', calls: executors }); + const bridges = await api.multiCall({ abi: 'address:bridgeAdapter', calls: executors }); + const owners = unique([...vaults, ...queues, ...executors, ...swaps, ...bridges]); + // Actual cash, not queue liabilities or the vault's operator-posted totalAssets/NAV. + return api.sumTokens({ tokens: [ADDRESSES.mezo.MUSD, ADDRESSES.mezo.mUSDC], owners, skipDuplicates: true }); +} + +/** + * Count Yield Split underlying, registered external strategy exposure and cash. + * Excludes intra-Ditto receipts and avoids counting pending claims twice. + * @param {object} api DeFiLlama Ethereum API pinned to the requested block. + * @returns {Promise} Settled underlying asset balances. + */ +async function ethereumTvl(api) { + const yieldSplit = await deployed(api, YIELD_SPLITS); + if (yieldSplit.length) await api.erc4626Sum({ calls: yieldSplit, isOG4626: true }); + const receivers = await deployed(api, RECEIVERS); + if (!receivers.length) return api.getBalances(); + const tokens = await api.multiCall({ abi: 'address:usdc', calls: receivers }); + if (tokens.some(token => token.toLowerCase() !== ADDRESSES.ethereum.USDC.toLowerCase())) + throw new Error('Ditto receiver asset changed'); + const bridges = await api.multiCall({ abi: 'address:bridgeAdapter', calls: receivers }); + const counts = await api.multiCall({ abi: 'uint256:adapterCount', calls: receivers }); + const calls = receivers.flatMap((target, index) => { + const count = Number(counts[index]); + if (!Number.isSafeInteger(count) || count < 0 || count > 100) + throw new Error('Invalid Ditto strategy registry length'); + return Array.from({ length: count }, (_, params) => ({ target, params })); + }); + const strategies = unique(await api.multiCall({ abi: 'function adapterAt(uint256) view returns (address)', calls })); + if (strategies.length) { + const assets = await api.multiCall({ abi: 'address:asset', calls: strategies }); + if (assets.some(asset => asset.toLowerCase() !== ADDRESSES.ethereum.USDC.toLowerCase())) + throw new Error('Ditto strategy asset changed'); + const shells = await api.multiCall({ abi: 'address:shell', calls: strategies }); + // If a receiver allocates into our own Yield Split, its whole vault is already + // counted above. Do not count that intra-Ditto receipt exposure a second time. + const external = strategies.filter((_, index) => shells[index].toLowerCase() !== YIELD_SPLIT.toLowerCase()); + const managed = await api.multiCall({ abi: 'uint256:totalManaged', calls: external }); + managed.forEach(amount => api.add(ADDRESSES.ethereum.USDC, amount)); + } + // totalManaged = shell.convertToAssets(shell.balanceOf(adapter)). Unbonded + // USDC sits outside that share balance: add its cash once, not pendingClaimable too. + const owners = unique([...receivers, ...bridges, ...strategies]); + return api.sumTokens({ token: ADDRESSES.ethereum.USDC, owners, skipDuplicates: true }); +} + +module.exports = { + start: '2026-01-26', // Yield Split creation: Ethereum block 24322294 + doublecounted: true, // Spark Savings; Yield Split also deposits into Aave, Morpho and Fluid. + methodology: 'Counts settled underlying assets in Ditto Earn vaults, custody contracts and registered strategies on each chain. Yield Split uses ERC-4626 totalAssets net of accrued performance fees; MUSD uses actual MUSD/mUSDC cash and Ethereum USDC backing, not posted NAV. Funded withdrawal cash remains counted until claim. Excludes bridge transfers in flight, receipt tokens, native gas and treasury holdings. External lending/savings exposure overlaps Spark Savings, Aave, Morpho and Fluid.', + ethereum: { tvl: ethereumTvl }, + mezo: { tvl: mezoTvl }, +}; From c39a8b018a2444c11f0c57254bb754ae11c58565 Mon Sep 17 00:00:00 2001 From: octoman-molina Date: Wed, 14 Oct 2026 15:52:56 -0400 Subject: [PATCH 255/988] JUSD Finance: report full vault value as TVL (#21583) Co-authored-by: Claude --- projects/jusd-finance/index.js | 47 ++++++++++------------------------ 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/projects/jusd-finance/index.js b/projects/jusd-finance/index.js index 4eb2be44252..ac9edecaaa7 100644 --- a/projects/jusd-finance/index.js +++ b/projects/jusd-finance/index.js @@ -1,17 +1,15 @@ const ADDRESSES = require('../helper/coreAssets.json') -// JUSD deploys USDC into curated credit strategies, issued through two vaults: -// Accountable on Ethereum and Venzo on Arbitrum. -// tvl: USDC held idle in each vault. borrowed: the rest of each vault's assets -// (its share supply valued with convertToAssets), i.e. USDC lent to the strategy -// borrower or deployed off chain. On Arbitrum most shares tokenize an existing -// off-chain strategy position, evidenced by the issuer's proof of reserves. +// JUSD allocates deposited USDC across yield strategies, principally delta-neutral +// funding trades plus lending. It is issued through two vaults: Accountable on +// Ethereum and Venzo on Arbitrum. TVL is each vault's share supply valued in USDC +// with convertToAssets(), which covers idle USDC and capital deployed to strategies. const VAULTS = { ethereum: [ - '0x2B5895b716311A1eaC8f93fB88C56aF9eC8C1A69', // JUSD Credit Vault (Accountable) + '0x2B5895b716311A1eaC8f93fB88C56aF9eC8C1A69', // JUSD vault (Accountable) ], arbitrum: [ - '0x9519217E8926A2B39BAcD2d6EC3EfD02503595E2', // JPEG Fixed-Rate Credit (Venzo) + '0x9519217E8926A2B39BAcD2d6EC3EfD02503595E2', // JUSD vault (Venzo) ], } @@ -21,36 +19,19 @@ const USDC = { arbitrum: ADDRESSES.arbitrum.USDC_CIRCLE, } -async function vaultState(api) { +async function tvl(api) { const vaults = VAULTS[api.chain] - const usdc = USDC[api.chain] const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: vaults }) - const [assets, idle] = await Promise.all([ - api.multiCall({ - abi: 'function convertToAssets(uint256) view returns (uint256)', - calls: vaults.map((vault, i) => ({ target: vault, params: [supplies[i]] })), - }), - api.multiCall({ abi: 'erc20:balanceOf', calls: vaults.map((vault) => ({ target: usdc, params: [vault] })) }), - ]) - return { usdc, assets, idle } -} - -async function tvl(api) { - const { usdc, idle } = await vaultState(api) - idle.forEach((amount) => api.add(usdc, amount)) -} - -async function borrowed(api) { - const { usdc, assets, idle } = await vaultState(api) - assets.forEach((amount, i) => { - const lent = BigInt(amount) - BigInt(idle[i]) - if (lent > 0n) api.add(usdc, lent.toString()) + const assets = await api.multiCall({ + abi: 'function convertToAssets(uint256) view returns (uint256)', + calls: vaults.map((vault, i) => ({ target: vault, params: [supplies[i]] })), }) + assets.forEach((amount) => api.add(USDC[api.chain], amount)) } module.exports = { - methodology: 'TVL is the USDC held idle in the two JUSD vaults, the Accountable vault on Ethereum and the Venzo vault on Arbitrum. Borrowed is the rest of each vault\'s assets, its share supply valued in USDC with convertToAssets(), which is USDC lent to the strategy borrower or deployed off chain. The Ethereum vault is also part of Accountable, so this listing is marked as double counted.', + methodology: 'TVL is the USDC value of the two JUSD vaults, the Accountable vault on Ethereum and the Venzo vault on Arbitrum: each vault\'s share supply valued with convertToAssets(), covering idle USDC and capital allocated to strategies (principally delta-neutral funding trades, plus lending). The Ethereum vault is also part of Accountable, so this listing is marked as double counted.', doublecounted: true, - ethereum: { tvl, borrowed }, - arbitrum: { tvl, borrowed }, + ethereum: { tvl }, + arbitrum: { tvl }, } From 31016930b67d6e20bd724d4060d88a8ce2826d98 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 14 Oct 2026 17:15:10 -0400 Subject: [PATCH 256/988] optimize orca (#21640) --- projects/orca/index.js | 55 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/projects/orca/index.js b/projects/orca/index.js index 262dec553ff..39853ab9301 100644 --- a/projects/orca/index.js +++ b/projects/orca/index.js @@ -1,7 +1,8 @@ -const { getProvider, sumTokens2, exportDexTVL, } = require('../helper/solana') +const { getProvider, sumTokens2, exportDexTVL, transformBalances, blacklistedTokens_default, } = require('../helper/solana') const { Program, AnchorProvider } = require("@project-serum/anchor"); const sdk = require('@defillama/sdk') const { Connection, PublicKey } = require('@solana/web3.js') +const { sleep, sliceIntoChunks } = require('../helper/utils') // const eclipseRpc = 'https://eclipse.helius-rpc.com' const eclipseRpc = 'https://mainnetbeta-rpc.eclipse.xyz' @@ -26,28 +27,44 @@ async function eclipseTvl (api) { const WHIRLPOOL_PROGRAM_ID = new PublicKey('whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc') -// Whirlpool account (dataSize=653), we slice bytes 133-245 to get the vaults +// Whirlpool account (dataSize=653), we slice bytes 49-245 to get liquidity and the vaults +const LIQUIDITY_OFFSET = 49 const VAULT_A_OFFSET = 133 -const SLICE_LEN = 112 -// original_offset - VAULT_A_OFFSET -const VAULT_A_IN_SLICE = 0 -const VAULT_B_IN_SLICE = 80 +const SLICE_LEN = 196 +// original_offset - LIQUIDITY_OFFSET +const VAULT_A_IN_SLICE = 84 +const VAULT_B_IN_SLICE = 164 // circumvent RPC scan-limit on getProgramAccounts const PREFIX_BUCKETS = 256 const SWEEP_CONCURRENCY = 3 +const BALANCE_CONCURRENCY = 3 + +// the solana RPC rate limits (429) bursts, back off instead of failing the whole pool +async function withRetry(fn, retries = 5) { + for (let i = 0; ; i++) { + try { + return await fn() + } catch (e) { + if (i >= retries) throw e + await sleep(1000 * 2 ** i) + } + } +} async function fetchPrefix(conn, prefix) { - const accounts = await conn.getProgramAccounts(WHIRLPOOL_PROGRAM_ID, { + const accounts = await withRetry(() => conn.getProgramAccounts(WHIRLPOOL_PROGRAM_ID, { filters: [ { dataSize: 653 }, { memcmp: { offset: VAULT_A_OFFSET, bytes: Buffer.from([prefix]).toString('base64'), encoding: 'base64' } }, ], - dataSlice: { offset: VAULT_A_OFFSET, length: SLICE_LEN }, - }) + dataSlice: { offset: LIQUIDITY_OFFSET, length: SLICE_LEN }, + })) const vaults = [] for (const { account } of accounts) { const d = account.data + // ~half of all whirlpools have no in-range liquidity and hold <1% of the value, skip them + if (d.readBigUInt64LE(0) === 0n && d.readBigUInt64LE(8) === 0n) continue vaults.push(new PublicKey(d.slice(VAULT_A_IN_SLICE, VAULT_A_IN_SLICE + 32)).toBase58()) vaults.push(new PublicKey(d.slice(VAULT_B_IN_SLICE, VAULT_B_IN_SLICE + 32)).toBase58()) } @@ -67,7 +84,25 @@ async function tvl(api) { }, }) - return sumTokens2({ api, tokenAccounts: allVaults, allowError: true }) + // sumTokens2 reads token accounts one chunk at a time with a sleep in between, too slow for ~100k+ vaults + // only the mint (0-32) and amount (64-72) of each token account are needed + const infos = [] + await sdk.util.runInPromisePool({ + concurrency: BALANCE_CONCURRENCY, + items: sliceIntoChunks(allVaults, 99), + processor: async (accounts) => { + infos.push(...await withRetry(() => sdk.chains.svm.getAccounts({ chain: api.chain, accounts, dataSlice: { offset: 0, length: 72 }, chunkSize: 99, concurrency: 1 }))) + }, + }) + const tokenBalances = {} + for (const info of infos) { + if (!info) continue + const d = Buffer.from(info.data[0], 'base64') + const mint = new PublicKey(d.subarray(0, 32)).toBase58() + if (blacklistedTokens_default.includes(mint)) continue + sdk.util.sumSingleBalance(tokenBalances, mint, d.readBigUInt64LE(64).toString()) + } + return transformBalances({ tokenBalances, balances: api.getBalances(), chain: api.chain }) } /* async function orcaPoolTvlViaConfig() { From 6d4fa8dee6fcf52d0886bfd196c29a75e9d5c658 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Thu, 15 Oct 2026 09:28:14 +0200 Subject: [PATCH 257/988] Binance: add ADA reserves leg (~$103M) (#21642) --- projects/binance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/binance/index.js b/projects/binance/index.js index 36cf9f37108..da10491a440 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -12,6 +12,7 @@ const LOCK_INFO_ENDPOINT = "https://www.binance.com/bapi/tokencanal/v2/tokencana const binanceToDefillama = { BTC: 'bitcoin', + ADA: 'cardano', ETH: 'ethereum', BEP20: 'bsc', BSC: 'bsc', From ac8bcfb7e7b406f6f175357c16ec9e51feba4bbc Mon Sep 17 00:00:00 2001 From: PareStocks Date: Thu, 15 Oct 2026 18:28:35 +1100 Subject: [PATCH 258/988] PARE: add Ethereum (sUSDx yield vaults) (#21643) Co-authored-by: Claude Fable 5.1 --- registries/sumTokens/data3.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index e1ed5a135f1..3512b3f10dd 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -997,8 +997,14 @@ module.exports = { } }, "pare": { - "methodology": "Stock Tokens deposited in PARE StripVaults on Robinhood Chain. Each vault holds the stock backing one series of principal (pToken) and yield (yToken) tokens until maturity.", + "methodology": "Stock Tokens deposited in PARE StripVaults on Robinhood Chain, and yield-bearing dollars (sUSDx) deposited in PARE YieldVaults on Ethereum. Each vault holds what backs one series of principal (pToken) and yield (yToken) tokens until maturity.", "start": "2026-09-02", + "ethereum": { + "tokensAndOwners": [ + // YieldVaults hold the share they split (sUSDx, Staked USDx). The PT/sUSDx pools are Uniswap v4 and count under Uniswap. + ["0xEB892628D1E58BC475A6dCB7F5dBC4F591632AA4", "0xFB0c70eaDdc3717A9c95E3D6c5B791244437a25c"], // pUSDx-MAR27, audited build, 2026-10-10 + ], + }, "robinhood": { "tokensAndOwners": [ // audited build, 2026-09-18, maturity 2027-12-31 From f010076abe505dedef6748719e9af889400e6ec6 Mon Sep 17 00:00:00 2001 From: loveyuanfandj-glitch Date: Thu, 15 Oct 2026 15:31:32 +0800 Subject: [PATCH 259/988] SoDEX: include bridged soUSDC in Base TVL (#21645) --- registries/sumTokens.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index fa52c66bb4f..3ce852ce259 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -25643,7 +25643,9 @@ const configs = { // DEFI.ssi "0x164ffdaE2fe3891714bc2968f1875ca4fA1079D0", // MEME.ssi - "0xdd3acDBDc7b358Df453a6CB6bCA56C92aA5743aA" + "0xdd3acDBDc7b358Df453a6CB6bCA56C92aA5743aA", + // soUSDC + "0xb88A0269C0b7E665F15DE46F634e02cE81E361c9" ], // bridge From fb73cff531a4e5d679782333c9f0552c3004e5ea Mon Sep 17 00:00:00 2001 From: rossgalloway <58150151+rossgalloway@users.noreply.github.com> Date: Thu, 15 Oct 2026 08:36:21 +0100 Subject: [PATCH 260/988] =?UTF-8?q?Include=20Yearn=20USDC=E2=80=99s=20init?= =?UTF-8?q?ial=20owner=20in=20curation=20discovery=20(#21638)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- registries/curators.js | 1 + 1 file changed, 1 insertion(+) diff --git a/registries/curators.js b/registries/curators.js index 502bb5d2c16..878418cc889 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -1709,6 +1709,7 @@ const configs = { blockchains: { ethereum: { morphoVaultOwners: [ + '0x0Dca0FDC170baA4CA9c1dCd37Ffe01f97bCfD504', '0xFc5F89d29CCaa86e5410a7ad9D9d280d4455C12B', '0x50B75d586929Ab2F75dC15f07E1B921b7C4Ba8fA', '0x75a1253432356f90611546a487b5350CEF08780D', From e01b388f302c18ffd619c6b5075692046ec25249 Mon Sep 17 00:00:00 2001 From: Bordrless Date: Thu, 15 Oct 2026 02:41:56 -0500 Subject: [PATCH 261/988] Add Bordrless (#21644) Co-authored-by: BordrlessDex <339355703+BordrlessDex@users.noreply.github.com> Co-authored-by: ccipherx --- projects/bordrless/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/bordrless/index.js diff --git a/projects/bordrless/index.js b/projects/bordrless/index.js new file mode 100644 index 00000000000..8e41d03b7bd --- /dev/null +++ b/projects/bordrless/index.js @@ -0,0 +1,31 @@ +const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') +const { sumTokens2 } = require('../helper/solana') + +// $BORDR, the protocol's own token: its wrapped supply sits in the treasury wallet, so it is not counted. +const BORDR = '6Mix12LiHrQFojaQEnfPUC65Qkwd6X4Y5Qg93oFbordr' + +// Every SOL and SPL token on the Bordrless standard sits in its bridge vault; the list comes from the +// Bordrless API, the balances from the chain. +async function vaults() { + return getConfig('bordrless/vaults', undefined, { + fetcher: async () => { + const list = await get('https://bordrless.app/api/stats/defillama/vaults') + if (!Array.isArray(list) || !list.some((v) => v.native)) throw new Error('bordrless: bad vault list') + return list + }, + }) +} + +async function tvl(api) { + const list = (await vaults()).filter((v) => v.underlyingMint !== BORDR) + const solOwners = list.filter((v) => v.native).map((v) => v.vault) + const tokenAccounts = list.filter((v) => !v.native).map((v) => v.vault) + return sumTokens2({ api, tokenAccounts, solOwners }) +} + +module.exports = { + timetravel: false, + methodology: 'TVL is the SOL and SPL tokens held in the Bordrless bridge vaults, which back every bridged asset traded on the Bordrless DEX and launchpad. Coins launched on Bordrless and $BORDR are not counted.', + solana: { tvl }, +} From e24e9c9657ff63d9bb28a6666ca748b7e86994d8 Mon Sep 17 00:00:00 2001 From: Andrew <121315827+Kittrian@users.noreply.github.com> Date: Thu, 15 Oct 2026 02:51:09 -0500 Subject: [PATCH 262/988] QuantumPools: count all live V2/V2.1 vaults (Robinhood, Base, BSC, Arbitrum, Ethereum); move to projects/quantumpools (#21636) Co-authored-by: ccipherx --- registries/sumTokens.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 3ce852ce259..f3e299c7ae1 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -23496,16 +23496,28 @@ const configs = { }, }, "quantumpools": { - "methodology": "TVL is the value of every Uniswap V3 concentrated-liquidity position held by the QuantumPools vaults on Base and Robinhood Chain, unwrapped to underlying token amounts at the current pool tick.", + "methodology": "TVL is the value of every Uniswap V3 and PancakeSwap V3 concentrated-liquidity position held by the QuantumPools V2/V2.1 vaults, unwrapped to underlying token amounts at the current pool tick.", "doublecounted": true, "start": "2026-09-28", + // [position manager, vault]: each vault binds one position manager "robinhood": { - "owner": "0x5433f385F538Fa11b8A25B82230a306d25dF8EB3", - "resolveUniV3": true + "uniV3nftsAndOwners": [ + ["0x73991a25C818Bf1f1128dEAaB1492D45638DE0D3", "0x5433f385F538Fa11b8A25B82230a306d25dF8EB3"], + ["0x73991a25C818Bf1f1128dEAaB1492D45638DE0D3", "0xd3AAb853758c81c09C4510D1b05b9152F71B30F5"], + ["0x46A15B0b27311cedF172AB29E4f4766fbE7F4364", "0xeBdfa133432bC0321ed1073Fe776F4701956E0e7"], + ] }, "base": { - "owner": "0x9597f68203d1bc85744A5Fc11D890aA7777e386B", - "resolveUniV3": true + "uniV3nftsAndOwners": [ + ["0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1", "0x9597f68203d1bc85744A5Fc11D890aA7777e386B"], + ["0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1", "0x0e8A7c9Fd76e718202B3c3530f3B587ba52FB1A8"], + ] + }, + "bsc": { + "uniV3nftsAndOwners": [ + ["0x46A15B0b27311cedF172AB29E4f4766fbE7F4364", "0x9597f68203d1bc85744A5Fc11D890aA7777e386B"], + ["0x7b8A01B39D58278b5DE7e48c8449c9f4F5170613", "0x57cB3160D59e967D3ac62620Fc69f7e0898d2690"], + ] }, }, "quenta": { From 23854d551c781d936c4f3afcb730949a3e22ba72 Mon Sep 17 00:00:00 2001 From: rossgalloway <58150151+rossgalloway@users.noreply.github.com> Date: Thu, 15 Oct 2026 08:58:54 +0100 Subject: [PATCH 263/988] Fix remaining Yearn Finance TVL overlaps (#21637) Co-authored-by: ccipherx --- projects/yearn/index.js | 119 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 115 insertions(+), 4 deletions(-) diff --git a/projects/yearn/index.js b/projects/yearn/index.js index c4476674b64..8db7eef5d9e 100644 --- a/projects/yearn/index.js +++ b/projects/yearn/index.js @@ -1,5 +1,6 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') +const sdk = require('@defillama/sdk') const kongEndpoint = 'https://kong.yearn.fi/api/rest' @@ -9,12 +10,80 @@ const V2_STRATEGY_ABI = 'function strategies(address) view returns (uint256 perf // Yearn V2 vaults contain a MAXIMUM_STRATEGIES constant that Kong's strategiesCount can exceed, so cap at 20. const MAX_V2_STRATEGIES = 20 -// Cross-asset routes that can't be auto-detected, the strategy isn't a vault and the child asset differs. -const crossAssetNestedVaults = [ +// Registered intermediary routes: the strategy address differs from its child vault. +// Parent-scoped mappings avoid treating a reused strategy as an unrelated vault's +// allocation. Recheck destination getters and cap deductions by actual holdings. +// Include zero-debt converters too: DAI-2 -> Yearn Term USDS and yvUSD -> Spark +// USDS can receive allocations later. Term USDS resolves to 0xe852..., not USDS-1. +// If that destination is absent from the counted inventory, do not deduct it. +// The two DAI-1 routes at the end were already handled by the upstream adapter. +const registeredNestedVaults = [ + { chainId: 1, parent: '0x132d8d2c76db3812403431facb00f3453fc42125', strategy: '0x901fe4d83c5475bf9bdbcf0dc2574d5db1ca9cda', child: '0x774b4cbc2703ce83fb3b828b7c782d1cd983b04a', getter: 'yVault' }, + { chainId: 1, parent: '0x1635b506a88fbf428465ad65d00e8d6b6e5846c3', strategy: '0xdd38062704b09b897fd8ad652ce8294985fb3d33', child: '0x75a291f0232add37d72dd1dcff55b715755ecdee', getter: 'yVault' }, + { chainId: 1, parent: '0x19d3364a399d251e894ac732651be8b0e4e85001', strategy: '0x3d6532c589a11117a4494d9725bb8518c731f1be', child: '0xda816459f1ab5631232fe5e97a05bbbb94970c95', getter: 'yVault' }, + { chainId: 1, parent: '0x2a38b9b0201ca39b17b460ed2f11e4929559071e', strategy: '0x7320541570ad6fec3ebc67685268948a50d4cb48', child: '0x63bd3bbb6c5cb6e457c3f3cbb2d8aa2536e319f1', getter: 'yVault' }, + { chainId: 1, parent: '0x2dfb14e32e2f8156ec15a2c21c3a6c053af52be8', strategy: '0x47128518d9cad921af60ed42568a69781d710cd5', child: '0xa540744dedbda9ef64cf753f0e851efe4a419ea9', getter: 'yVault' }, + { chainId: 1, parent: '0x3b27f92c0e212c671ea351827edf93db27cc0c65', strategy: '0xe07d1e27d93eda41ab091fc91a2026df41763b56', child: '0x310b7ea7475a0b449cfd73be81522f1b88efafaa', getter: 'yVault' }, + { chainId: 1, parent: '0x5f18c75abdae578b483e5f43f12a39cf75b973a9', strategy: '0x36822d0b11f4594380181ce6e76bd4986d46c389', child: '0xa354f35829ae975e850e23e9615b11da1b3dc4de', getter: 'yVault' }, + { chainId: 1, parent: '0x5fa5b62c8af877cb37031e0a3b2f34a78e3c56a6', strategy: '0x343a52634b2464a87146c44ed8005577937f885c', child: '0xad86df2e8f989c828b25a7da5eb1ec363283fa3f', getter: 'yVault' }, + { chainId: 1, parent: '0x7da96a3891add058ada2e826306d812c638d87a7', strategy: '0xb0eb24077563db8b88384949011dc46410c0a31d', child: '0x3b27f92c0e212c671ea351827edf93db27cc0c65', getter: 'yVault' }, + { chainId: 1, parent: '0x8cc94ccd0f3841a468184aca3cc478d2148e1757', strategy: '0x199cffcc256d4195a81b10eb7695bf02d43e3b02', child: '0x944d749017053e0d37ec206c9898716a21e0b2e2', getter: 'yVault' }, + { chainId: 1, parent: '0xa258c4606ca8206d8aa700ce2143d7db854d168c', strategy: '0x85907b1af27fd04a5efabc0fb7162f8690a6b82f', child: '0xc56413869c6cdf96496f2b1ef801fedbdfa7ddb0', getter: 'yVault' }, + { chainId: 1, parent: '0xa354f35829ae975e850e23e9615b11da1b3dc4de', strategy: '0xd5aadcd054a00eff71bcb922cddc70752fa2bc68', child: '0xbe53a109b494e5c9f97b9cd39fe969be68bf6204', getter: 'yVault' }, + { chainId: 1, parent: '0xa696a63cc78dffa1a63e9e50587c197387ff6c7e', strategy: '0x8b64692c42ac08a7275aff3e2cc59e7401c471d5', child: '0x751f0cc6115410a3ee9ec92d08f46ff6da98b708', getter: 'yVault' }, + { chainId: 1, parent: '0xa74d4b67b3368e83797a35382afb776baae4f5c8', strategy: '0x85b360dee557135d8903225939699dd644d33cb8', child: '0x4cbb6a5ec00ceec252a7091559484f7adb83165f', getter: 'yVault' }, + { chainId: 1, parent: '0xa9fe4601811213c340e850ea305481aff02f5b28', strategy: '0xe5f7f2e59b259e11ecf2ff76fdf5dc7438363a3f', child: '0xa258c4606ca8206d8aa700ce2143d7db854d168c', getter: 'yVault' }, + { chainId: 1, parent: '0xb4ada607b9d6b2c9ee07a275e9616b84ac560139', strategy: '0xaad21781fe48048264d89da52423097e4397ff36', child: '0xb37094c1b5614bd6ece40afb295c26f4377069d3', getter: 'yVault' }, + { chainId: 1, parent: '0xbe53a109b494e5c9f97b9cd39fe969be68bf6204', strategy: '0x39c0aec5738ed939876245224afc7e09c8480a52', child: '0x182863131f9a4630ff9e27830d945b1413e347e8', getter: 'vault', parentAsset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', childAsset: '0xdc035d45d973e3ec169d2276ddab16f1e407384f', parentDecimals: 6, childDecimals: 18 }, + { chainId: 1, parent: '0xbfedbcbe27171c418cdabc2477042554b1904857', strategy: '0xa7074434aa4419ed18f220152bcaa989b3b9d8c1', child: '0x77e829fff18c14ad9bb88963acb0010a0506de88', getter: 'yVault' }, + { chainId: 1, parent: '0xd6ea40597be05c201845c0bfd2e96a60bacde267', strategy: '0xb2f45226d0b1ebe7ce3c7b0a53eb4a82e032060d', child: '0xae6ed98b1bd9aadd3185160324e0e011159b61d3', getter: 'yVault' }, + { chainId: 1, parent: '0xda816459f1ab5631232fe5e97a05bbbb94970c95', strategy: '0xa7496763f035e73ec6b56f4c86312cc1874a01e3', child: '0x028ec7330ff87667b6dfb0d94b954c820195336c', getter: 'yVault' }, + { chainId: 1, parent: '0xdcd90c7f6324cfa40d7169ef80b12031770b4325', strategy: '0x9084b5a98e3b4b257affd82ae4a1753f87906dce', child: '0x5b8c556b8b2a78696f0b9b830b3d67623122e270', getter: 'yVault' }, + { chainId: 1, parent: '0xe14d13d8b3b85af791b2aadd661cdbd5e6097db1', strategy: '0x0a5157244e4f82f100a461ca65c7b05c8dacf835', child: '0xdb25ca703181e7484a155dd612b06f57e12be5f0', getter: 'yVault' }, + { chainId: 1, parent: '0xe537b5cc158eb71037d4125bdd7538421981e6aa', strategy: '0x906a5fb545d177ba441a57b3a24eaeda555d29e3', child: '0x8078198fc424986ae89ce4a910fc109587b6abf3', getter: 'yVault' }, + { chainId: 1, parent: '0x92545bce636e6ee91d88d2d017182cd0bd2fc22e', strategy: '0x6164217caa4ff58fb722d726391875ac0c5fb541', child: '0xe852db931ac6f02490a32695f09ee79a31f53821', getter: 'vault', parentAsset: '0x6b175474e89094c44da98b954eedeac495271d0f', childAsset: '0xdc035d45d973e3ec169d2276ddab16f1e407384f', parentDecimals: 18, childDecimals: 18 }, + { chainId: 1, parent: '0x696d02db93291651ed510704c9b286841d506987', strategy: '0x9e0a5943dfc1a85b48c191aa7c10487297aa675b', child: '0xc9f01b5c6048b064e6d925d1c2d7206d4feef8a3', getter: 'vault', parentAsset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', childAsset: '0xdc035d45d973e3ec169d2276ddab16f1e407384f', parentDecimals: 6, childDecimals: 18 }, { chainId: 1, parent: '0x028ec7330ff87667b6dfb0d94b954c820195336c', strategy: '0xaedf7d5f3112552e110e5f9d08c9997adce0b78d', child: '0x182863131f9a4630ff9e27830d945b1413e347e8' }, // DAI-1 -> (DAI/USDS) -> USDS-1 { chainId: 1, parent: '0x028ec7330ff87667b6dfb0d94b954c820195336c', strategy: '0xff03dce6d95aa7a30b75efbafd11384221b9f9b5', child: '0xbe53a109b494e5c9f97b9cd39fe969be68bf6204' }, // DAI-1 -> (DAI/USDC) -> USDC-1 ] +// The Ethereum sender's USDC debt backs vbUSDC deposited in Katana. Confirm +// reciprocal counterparts and the counted destination before removing anything. +// Both assets use six decimals; cap the deduction by debt and remote ownership. +async function remoteOverlap(api, vaults, strategyAbi) { + const parent = '0x696d02db93291651ed510704c9b286841d506987' + const strategy = '0xc5b16e7efe1ca05714477b8edcab4dee9b93a27c' + const holder = '0xefeebaacdc5640a123fe282652503ea4fd499d14' + const child = '0x80c34bd3a3569e126e7055831036aa7b212cb159' + + if (api.chainId !== 1 || !vaults.some(v => v.address.toLowerCase() === parent)) return new Map() + const remote = new sdk.ChainApi({ chain: 'katana', timestamp: api.timestamp }) + const inventory = await getConfig('yearn/vaults-747474', 'https://kong.yearn.fi/api/rest/list/vaults/747474?origin=yearn') + if (!inventory.some(v => v.chainId === 747474 && v.address.toLowerCase() === child)) return new Map() + const chain = await api.call({ target: strategy, abi: 'uint256:REMOTE_CHAIN_ID' }) + const counterpart = await api.call({ target: strategy, abi: 'address:REMOTE_COUNTERPART' }) + const reverse = await remote.call({ target: holder, abi: 'address:REMOTE_COUNTERPART' }) + const destination = await remote.call({ target: holder, abi: 'address:vault' }) + const asset = await api.call({ target: parent, abi: 'address:asset' }) + const remoteAsset = await remote.call({ target: child, abi: 'address:asset' }) + if (Number(chain) !== 747474 || counterpart.toLowerCase() !== holder || + reverse.toLowerCase() !== strategy || destination.toLowerCase() !== child || + asset.toLowerCase() !== '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' || + remoteAsset.toLowerCase() !== '0x203a662b0bd271a6ed5a60edfbd04bfce608fd36') + throw new Error('Yearn Katana overlap route changed') + const debt = await api.call({ target: parent, abi: strategyAbi, params: [strategy] }) + const shares = BigInt(await remote.call({ target: child, abi: 'erc20:balanceOf', params: [holder] })) + const supply = BigInt(await remote.call({ target: child, abi: 'erc20:totalSupply' })) + const assets = BigInt(await remote.call({ target: child, abi: 'uint256:totalAssets' })) + if (shares > supply) throw new Error('Invalid Yearn remote ownership') + const owned = supply ? assets * shares / supply : 0n + const countedSender = vaults.some(v => v.address.toLowerCase() === strategy) + const owed = countedSender + ? BigInt(await api.call({ target: strategy, abi: 'uint256:totalAssets' })) + : BigInt(debt.currentDebt) + return new Map([[countedSender ? strategy : parent, owned < owed ? owned : owed]]) +} + async function getDebts(api, activeVaults) { // get version from apiVersion instead of Kong's `v3` flag (some 3.x vaults are flagged v2). // V3 exposes get_default_queue(); V2 a slot-indexed withdrawalQueue. @@ -34,8 +103,20 @@ async function getDebts(api, activeVaults) { let slot = 0 v2.forEach(({ vault }) => { for (let i = 0; i < Math.min(vault.strategiesCount, MAX_V2_STRATEGIES); i++) edges.push({ vault: vault.address, strategy: v2QueueRes[slot++], v3: false }) }) + const registered = registeredNestedVaults.filter(route => + route.chainId === api.chainId && route.getter && + edges.some(edge => edge.vault.toLowerCase() === route.parent && edge.strategy?.toLowerCase() === route.strategy) && + activeVaults.some(({ vault }) => vault.address.toLowerCase() === route.child)) + await Promise.all([...new Set(registered.map(route => route.getter))].map(async getter => { + const routes = registered.filter(route => route.getter === getter) + const destinations = await api.multiCall({ abi: `address:${getter}`, calls: routes.map(route => route.strategy) }) + routes.forEach((route, i) => { + if (destinations[i].toLowerCase() !== route.child) throw new Error(`Yearn router destination changed: ${route.strategy}`) + }) + })) + const countedVaults = new Set(activeVaults.map(({ vault }) => vault.address.toLowerCase())) - const crossAssetStrategies = new Set(crossAssetNestedVaults.map(e => e.strategy)) + const crossAssetStrategies = new Set(registeredNestedVaults.map(e => e.strategy)) const nested = edges.filter(e => e.strategy && (countedVaults.has(e.strategy.toLowerCase()) || crossAssetStrategies.has(e.strategy.toLowerCase()))) // Per-strategy debt: V3 currentDebt, V2 totalDebt @@ -46,6 +127,30 @@ async function getDebts(api, activeVaults) { v3Nested.forEach((e, i) => { e.currentDebt = v3Debts[i].currentDebt }) v2Nested.forEach((e, i) => { e.currentDebt = v2Debts[i].totalDebt }) + const routes = registeredNestedVaults.filter(route => route.getter) + const mapped = nested.map(edge => ({ + edge, + route: routes.find(route => route.chainId === api.chainId && + route.parent === edge.vault.toLowerCase() && route.strategy === edge.strategy.toLowerCase()), + })).filter(({ route }) => route && countedVaults.has(route.child)) + const shares = await api.multiCall({ abi: 'erc20:balanceOf', calls: mapped.map(({ edge, route }) => ({ target: route.child, params: [edge.strategy] })) }) + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: mapped.map(({ route }) => route.child) }) + mapped.forEach(({ edge, route }, i) => { + const child = activeVaults.find(({ vault }) => vault.address.toLowerCase() === route.child) + const supply = BigInt(supplies[i]), held = BigInt(shares[i]) + if (held > supply) throw new Error('Invalid Yearn router ownership') + let owned = supply ? BigInt(child.balance) * held / supply : 0n + const parent = activeVaults.find(({ vault }) => vault.address.toLowerCase() === route.parent) + const parentAsset = parent.vault.asset.address.toLowerCase(), childAsset = child.vault.asset.address.toLowerCase() + // Registered converters exchange DAI/USDC/USDS at 1:1. Normalize the + // child's raw asset units into parent units; do not assume equal decimals. + if (route.parentAsset) { + if (parentAsset !== route.parentAsset || childAsset !== route.childAsset) throw new Error('Yearn converter asset changed') + owned = owned * 10n ** BigInt(route.parentDecimals) / 10n ** BigInt(route.childDecimals) + } else if (parentAsset !== childAsset) throw new Error('Yearn router asset changed') + if (owned < BigInt(edge.currentDebt)) edge.currentDebt = owned.toString() + }) + const debtsByVault = new Map() for (const e of nested) { const list = debtsByVault.get(e.vault.toLowerCase()) ?? [] @@ -62,7 +167,7 @@ function buildNestedDebtByVault(vaults) { // Key by parent+strategy so reusing the same strategy contract from another // vault cannot accidentally activate a cross-asset deduction. const crossAssetEdgeByDebt = new Map( - crossAssetNestedVaults.map(edge => [`${edge.chainId}:${edge.parent}:${edge.strategy}`, edge]) + registeredNestedVaults.map(edge => [`${edge.chainId}:${edge.parent}:${edge.strategy}`, edge]) ) const nestedDebtByVault = new Map() @@ -186,14 +291,20 @@ async function tvl(api) { // is subtracted from the vault's own totalAssets (in its own asset), so the // child keeps its full real balance and no token conversion is needed. const nestedDebtByVault = buildNestedDebtByVault(vaults) + for (const [parent, debt] of await remoteOverlap(api, vaults, V3_STRATEGY_ABI)) + nestedDebtByVault.set(parent, (nestedDebtByVault.get(parent) ?? 0n) + debt) // V2 vaults expose token(), while ERC-4626/V3 vaults expose asset(). Trying // both lets the same loop cover both generations. const tokens = await api.multiCall({ abi: 'address:token', calls, permitFailure: true }) const tokensAlt = await api.multiCall({ abi: 'address:asset', calls, permitFailure: true }) + const countedVaults = new Set(calls.filter((_, i) => tokens[i] || tokensAlt[i]).map(address => address.toLowerCase())) bals.forEach((bal, i) => { const token = tokens[i] || tokensAlt[i] + // A wrapper's assets are shares in another counted vault. The underlying + // vault already includes all of these assets, including deployed shares. + if (token && token.toLowerCase() !== calls[i].toLowerCase() && countedVaults.has(token.toLowerCase())) return const nestedDebt = nestedDebtByVault.get(vaults[i].address.toLowerCase()) // Remove the portion this vault has deployed into other counted vaults, From c2b235933d159d14b110ad7924370d047115ef5b Mon Sep 17 00:00:00 2001 From: Miracle Otugo <67126036+MirakoolDev@users.noreply.github.com> Date: Thu, 15 Oct 2026 09:03:57 +0100 Subject: [PATCH 264/988] Add PFWA Markets, PFWA Sherwood and Credence, plus the PFWA and Credence treasuries (PFWA ecosystem, Robinhood Chain + Polygon) (#21623) --- projects/pfwa-credence/index.js | 57 ++++++++++++++++++++++++++++++ projects/pfwa-markets/index.js | 27 ++++++++++++++ projects/pfwa-sherwood/index.js | 20 +++++++++++ projects/treasury/pfwa-credence.js | 21 +++++++++++ projects/treasury/pfwa.js | 23 ++++++++++++ 5 files changed, 148 insertions(+) create mode 100644 projects/pfwa-credence/index.js create mode 100644 projects/pfwa-markets/index.js create mode 100644 projects/pfwa-sherwood/index.js create mode 100644 projects/treasury/pfwa-credence.js create mode 100644 projects/treasury/pfwa.js diff --git a/projects/pfwa-credence/index.js b/projects/pfwa-credence/index.js new file mode 100644 index 00000000000..6e607bd9a5f --- /dev/null +++ b/projects/pfwa-credence/index.js @@ -0,0 +1,57 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') + +// Credence (credence.pfwa.fun, part of PFWA): a token deployer on Robinhood Chain. Every token it deploys is tied to a +// live Polymarket prediction: the token's trading fees fund the bet, and winnings buy back and burn the token. +// Only cash is counted: ETH, WETH and dollar stablecoins sitting in Credence's vault contracts. +// Not counted: Polymarket outcome shares (CTF ERC-1155 positions) held by the PolyVaults, the launched meme tokens and +// their curve / pool liquidity, $PFWA, launch fees in the launcher contracts (protocol revenue) and fees not yet +// collected from Pons. + +// Robinhood Chain: every vault factory keeps an onchain list (vaultCount / allVaults) +const VAULT_FACTORIES = [ + '0x17d0f24ADbD613C046eB25c0cc054333c5481F05', // CredenceVaultFactory (v1) + '0x099684533Dc729457650AB2424811AF9c79032D8', // CredenceVaultFactoryV2 + '0xD9e709c55Ce2680B99E982Ce1AAb24890dD39D55', // 18 Sep 2026 rehearsal factory, retired (one vault) + '0xade0E3e0218d53A89E607F312DB9CeA2DFcC5D10', // CreatorFeeVaultFactory: creator vaults, fees held until the named X account claims +] + +// Polygon +const POLY_VAULT_FACTORY_V1 = '0xC20E838e509B248638812FB3dAa1c8B63D6183C0' // keeps no list: its vaults come from PolyVaultCreated +const POLY_VAULT_FACTORY_V1_BLOCK = 93361845 +const POLY_VAULT_FACTORIES = [ + '0x69CD45c4d89CA8Cfe37c2ED1F869306e031d58F9', // PolyVaultFactoryV2 + '0xD9e709c55Ce2680B99E982Ce1AAb24890dD39D55', // 18 Sep 2026 rehearsal factory, retired +] + +const listVaults = (api, target) => api.fetchList({ lengthAbi: 'uint256:vaultCount', itemAbi: 'function allVaults(uint256) view returns (address)', target }) + +async function robinhoodTvl(api) { + const owners = (await Promise.all(VAULT_FACTORIES.map((factory) => listVaults(api, factory)))).flat() + return api.sumTokens({ owners, tokens: [ADDRESSES.null, ADDRESSES.robinhood.WETH, ADDRESSES.robinhood.USDG] }) +} + +async function polygonTvl(api) { + const owners = await getLogs2({ + api, + target: POLY_VAULT_FACTORY_V1, + fromBlock: POLY_VAULT_FACTORY_V1_BLOCK, + eventAbi: 'event PolyVaultCreated(address indexed vault, address indexed owner, bytes32 conditionId)', + transform: (log) => log.vault, + }) + for (const factory of POLY_VAULT_FACTORIES) { + const vaults = await listVaults(api, factory) + // a vault the guardian removed (e.g. one made with a leaked launcher key) is no longer part of the protocol + const live = await api.multiCall({ abi: 'function isVault(address) view returns (bool)', target: factory, calls: vaults }) + owners.push(...vaults.filter((_, i) => live[i])) + } + // pUSD is Polymarket's collateral (USDC.e wrapped 1:1); USDC.e is what fees arrive in from Robinhood Chain + return api.sumTokens({ owners, tokens: [ADDRESSES.polygon.PUSD, ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDC_CIRCLE] }) +} + +module.exports = { + methodology: 'Cash held by Credence vaults. Robinhood Chain: the ETH, WETH and USDG in every CredenceVault (v1, v2 and the retired rehearsal factory, listed onchain by each factory\'s vaultCount/allVaults), i.e. trading fees waiting to be bridged to the bet or used for a buyback, and in every deployed CreatorFeeVault (fees held until the named X account claims them). Polygon: the pUSD, USDC.e and USDC in every PolyVault (v1 vaults from the v1 factory\'s PolyVaultCreated events, v2 vaults from PolyVaultFactoryV2.allVaults), i.e. fees waiting to buy the outcome and winnings waiting to go home. Polymarket outcome shares (CTF ERC-1155 positions) are never counted, nor are the launched meme tokens, their curve or pool liquidity, $PFWA, or launch fees held by the launcher contracts.', + start: '2026-09-07', + robinhood: { tvl: robinhoodTvl }, + polygon: { tvl: polygonTvl }, +} diff --git a/projects/pfwa-markets/index.js b/projects/pfwa-markets/index.js new file mode 100644 index 00000000000..ab5dcb4a78f --- /dev/null +++ b/projects/pfwa-markets/index.js @@ -0,0 +1,27 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +// PFWA Markets: prediction markets on Robinhood Chain (pfwa.fun). +// Every outcome of a market is its own bonding-curve token contract, and that contract holds the ETH paid in for it: +// open positions while the market is live, then the winners' unclaimed payout once it resolves. +// Each factory also holds the markets' bonus pots (its totalBonusPotLocked) in its own ETH balance. +const FACTORIES = [ + '0x2502aB7E69dDb3157683A82E603360Ada9B6E647', // PFWAMarketFactory v1 (legacy) + '0x7B38e940Cd649bc0C701c42eE1A6ceff75584afa', // PFWAMarketFactory v2 (current) +] + +async function tvl(api) { + const owners = [...FACTORIES] + for (const factory of FACTORIES) { + const count = await api.call({ abi: 'uint256:marketCount', target: factory }) + const calls = Array.from({ length: Number(count) }, (_, i) => i) + const optionTokens = await api.multiCall({ abi: 'function getOptionTokenAddresses(uint256) view returns (address[])', target: factory, calls }) + owners.push(...optionTokens.flat()) + } + return sumTokens2({ api, owners, tokens: [nullAddress] }) +} + +module.exports = { + methodology: 'Lists every market from both PFWAMarketFactory contracts (marketCount, getOptionTokenAddresses) and counts the native ETH held by each outcome token contract (open positions and unclaimed winnings), plus the ETH each factory holds for the markets\' bonus pots. Only ETH is counted; the outcome tokens themselves and the $PFWA token are not.', + start: '2026-07-29', + robinhood: { tvl }, +} diff --git a/projects/pfwa-sherwood/index.js b/projects/pfwa-sherwood/index.js new file mode 100644 index 00000000000..674c6ca0630 --- /dev/null +++ b/projects/pfwa-sherwood/index.js @@ -0,0 +1,20 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +// Sherwood (sherwood.pfwa.fun, part of PFWA): a PvP arena game built into Uniswap v4 hooks on Robinhood Chain. +// Each season's hook keeps the game's money in its own ETH balance: the round pots, prizes and referral rewards not claimed yet, +// and the ETH set aside for the $PFWA / $IMD buyback-and-burns. +// The pools' liquidity sits in the Uniswap v4 PoolManager, belongs to the LPs and is Uniswap's TVL, so it is not counted. +const HOOKS = [ + '0x0C9DDD9E45817252D56f70ec015A4E828212a0cc', // Season 1, ETH/$PFWA pool + '0xc33c907127b94303F578d6Be551C36F45939e0cC', // Season 2, ETH/$IMD pool +] + +async function tvl(api) { + return sumTokens2({ api, owners: HOOKS, tokens: [nullAddress] }) +} + +module.exports = { + methodology: 'Counts the native ETH held by the Sherwood game hooks (Season 1 on the ETH/$PFWA pool, Season 2 on the ETH/$IMD pool): round pots, unclaimed prizes and referral rewards, and the ETH reserved for buyback-and-burns. Liquidity in the Uniswap v4 pools is not counted, since it belongs to the LPs and is already part of Uniswap\'s TVL.', + start: '2026-10-08', + robinhood: { tvl }, +} diff --git a/projects/treasury/pfwa-credence.js b/projects/treasury/pfwa-credence.js new file mode 100644 index 00000000000..98b0c869a1e --- /dev/null +++ b/projects/treasury/pfwa-credence.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require('../helper/treasury') + +// Credence (credence.pfwa.fun, part of PFWA) on Robinhood Chain. +// The Credence Safe owns the launchers and is the CreatorFeeVaultFactory's protocolRecipient, so it receives the +// protocol's cut of creator vault fees. Launch fees stay in the launcher contracts until their owner withdraws them, so +// those balances are counted too. +const CREDENCE_SAFE = '0x85eb79DBCc50eB3DA0Ee10460109991E863d2666' +const LAUNCHERS = [ + '0x6EF3e8b1291463434850fb6ED466858A043D8525', // CredenceLauncherV2, owned by the Safe + '0x0903EB2fBccf7bF9eC86b4cb2894A7a9E5Adab5c', // CreatorLauncher, owned by the Safe + '0x69CD45c4d89CA8Cfe37c2ED1F869306e031d58F9', // 18 Sep 2026 rehearsal launcher, retired, owned by the Safe + '0xdF2eBF0bc156880BbE03d8eD330B2A2431d74019', // CredenceDeployer (v1 launcher), owned by the PFWA team wallet +] + +module.exports = treasuryExports({ + robinhood: { + owners: [CREDENCE_SAFE, ...LAUNCHERS], + tokens: [nullAddress, ADDRESSES.robinhood.WETH, ADDRESSES.robinhood.USDG], + }, +}) diff --git a/projects/treasury/pfwa.js b/projects/treasury/pfwa.js new file mode 100644 index 00000000000..4ea09734102 --- /dev/null +++ b/projects/treasury/pfwa.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require('../helper/treasury') + +// PFWA treasury on Robinhood Chain: the platformAddress of both PFWAMarketFactory contracts, so it receives PFWA Markets' +// protocol fees (trading fees, early-sell penalties, market creation fees). It holds ETH and the ecosystem token $PFWA. +const PFWA_TREASURY = '0xa0a6e5C0F17DA5e5337C9CD5bf353C61BA375c0D' +const PFWA = '0xa934bA4F59070149d37A93F8A002Af79BAe35563' + +module.exports = treasuryExports({ + robinhood: { + owners: [PFWA_TREASURY], + tokens: [nullAddress, ADDRESSES.robinhood.WETH, ADDRESSES.robinhood.USDG], + ownTokens: [PFWA], + }, +}) + +// $PFWA has a CoinGecko listing (predict-fwa) but no Robinhood Chain price in DefiLlama's price feed yet, so its +// balance is added by the CoinGecko id (the helper's own ownTokens bucket would value it at 0) +module.exports.robinhood.ownTokens = async (api) => { + const balance = await api.call({ abi: 'erc20:balanceOf', target: PFWA, params: PFWA_TREASURY }) + api.addCGToken('predict-fwa', balance / 1e18) + return api.getBalances() +} From 0dbddbe4802d54c2de9e2e83f602af0ac6622eb4 Mon Sep 17 00:00:00 2001 From: movefastonAptos Date: Thu, 15 Oct 2026 14:06:21 +0600 Subject: [PATCH 265/988] Add MoveFast adapter (#21620) Co-authored-by: movefastonAptos <341938842+movefastonAptos@users.noreply.github.com> --- projects/movefast/index.js | 68 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 projects/movefast/index.js diff --git a/projects/movefast/index.js b/projects/movefast/index.js new file mode 100644 index 00000000000..281dbe75f33 --- /dev/null +++ b/projects/movefast/index.js @@ -0,0 +1,68 @@ +const { GraphQLClient } = require("graphql-request"); +const { getResources } = require("../helper/chain/aptos"); + +const graphQLClient = new GraphQLClient("https://api.mainnet.aptoslabs.com/v1/graphql"); + +// every MoveFast launch is a sticky object created under 0xdead, so the creator +// address is what identifies the set of pools without a hardcoded token list +const POOL_OWNER = "0x000000000000000000000000000000000000000000000000000000000000dead"; +// Both MoveFast deployments, matched by their full type. A bare "::pool::Pool" +// suffix would also match a Pool published by someone else, and enumeration keys +// on 0xdead, which other protocols use too, so an unrelated reserve could land +// in MoveFast TVL. +const POOL_TYPES = new Set([ + "0xdef6b8f06dd82104a4bd3957eb715290cc615dc5a4acd432efadd64d23975d34::pool::Pool", + "0x8f79b6d87aca62ff5e3e9a555e69e409a3c76b7eb1283249c6998497ef1ac6d7::pool::Pool", +]); + +const TOKENS_QUERY = `query MoveFastTokens($creator: String!, $limit: Int!, $offset: Int!) { + fungible_asset_metadata( + where: { creator_address: { _eq: $creator } } + order_by: { asset_type: asc } + limit: $limit + offset: $offset + ) { + asset_type + } +}`; + +async function launchedTokens() { + const limit = 100; + const tokens = []; + for (let offset = 0; ; offset += limit) { + const { fungible_asset_metadata: rows } = await graphQLClient.request(TOKENS_QUERY, { + creator: POOL_OWNER, + limit, + offset, + }); + tokens.push(...rows.map((row) => row.asset_type)); + if (rows.length < limit) return tokens; + } +} + +const tvl = async (api) => { + const tokens = await launchedTokens(); + const resources = await Promise.all(tokens.map((token) => getResources(token))); + + resources.forEach((list) => { + const pool = list.find((resource) => POOL_TYPES.has(resource.type)); + // quote_reserve is the quote actually deposited by traders. the curve also + // carries a virtual_quote term used only for pricing, which is never + // deposited and can never be withdrawn, so it is left out of TVL. + if (!pool || pool.data.quote_reserve === undefined) return; + api.add(pool.data.quote.inner, pool.data.quote_reserve); + }); +}; + +module.exports = { + timetravel: false, + misrepresentedTokens: false, + methodology: + "MoveFast launches each token as a sticky object created under 0xdead that holds a Pool " + + "resource. TVL is the sum of every pool's quote_reserve, the quote asset (APT, USDC, USDt, " + + "WBTC) that traders have deposited and that backs sells. The bonding curve also carries a " + + "virtual_quote term used only for pricing; it is never deposited and cannot be withdrawn, so " + + "counting it would overstate TVL roughly tenfold. Unsold token inventory held by the pool and " + + "unclaimed creator fees are excluded as well.", + aptos: { tvl }, +}; From 505fe9a42090a3e67e8d7fed3f6373dfaec39adf Mon Sep 17 00:00:00 2001 From: Captain Zach <3989784+navionis@users.noreply.github.com> Date: Thu, 15 Oct 2026 03:42:27 -0500 Subject: [PATCH 266/988] Fix Bitstamp TVL drops from truncated wallet fetch (#21639) --- projects/bitstamp/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/projects/bitstamp/index.js b/projects/bitstamp/index.js index 2b1099d37ab..ce443a5aff5 100644 --- a/projects/bitstamp/index.js +++ b/projects/bitstamp/index.js @@ -53,6 +53,7 @@ function getAllData() { return getConfig('bitstamp', undefined, { fetcher: async () => { let page = 1 + let emptyRetries = 0 const walletChainMapping = {} // Bitstamp caps per_page at 100; larger values return HTTP 400 const PER_PAGE = 100 @@ -60,7 +61,16 @@ function getAllData() { sdk.log('fetching page', page) const data = await get(`https://www.bitstamp.net/api/v2/wallet_transparency/?perPage=${PER_PAGE}&page=${page}`, { timeout: 30000 }) const allWallets = Object.values(data.wallets ?? {}).flat() - if (!allWallets.length) break // empty page => no more wallets + // wallet list is appended to over time, so a page can transiently come + // back empty mid-list; retry a few times before accepting it as the end + if (!allWallets.length) { + if (++emptyRetries < 3) { + await new Promise(resolve => setTimeout(resolve, 3000)) + continue + } + break // several consecutive empty pages => no more wallets + } + emptyRetries = 0 allWallets.forEach(({ address, network }) => { if (!walletChainMapping[network]) From 14e2008e8854634fffa9aa6ba72e4d18b9b36750 Mon Sep 17 00:00:00 2001 From: keepdotcoffee <296388594+keepdotcoffee@users.noreply.github.com> Date: Thu, 15 Oct 2026 17:10:04 +0800 Subject: [PATCH 267/988] Count RH Full launch pool liquidity in Keep TVL (#21631) Co-authored-by: keepdotcoffee --- projects/keep-protocol/index.js | 91 +++++++++++++++++++++++++++++---- 1 file changed, 81 insertions(+), 10 deletions(-) diff --git a/projects/keep-protocol/index.js b/projects/keep-protocol/index.js index f1b19663d07..e0963e70b40 100644 --- a/projects/keep-protocol/index.js +++ b/projects/keep-protocol/index.js @@ -1,5 +1,7 @@ const { PublicKey } = require("@solana/web3.js"); const { getConnection, sumTokens2 } = require("../helper/solana"); +const { getLogs2 } = require("../helper/cache/getLogs"); +const { addUniV3LikePosition } = require("../helper/unwrapLPs"); const ADDRESSES = require("../helper/coreAssets.json"); const PROGRAM_IDS = [ @@ -12,10 +14,20 @@ const PROGRAM_IDS = [ // original production factory and the current metadata-v1 factory so TVL // remains continuous across the factory migration. const RH_FACTORIES = [ - "0x032EAfc08388283e94E44Fb0eA26A004D44ba40d", // original production factory - "0xC3f2831429F51aCe9243aCe75819488e3566CA7b", // metadata-v1 factory, block 86016310 + { address: "0x032EAfc08388283e94E44Fb0eA26A004D44ba40d", fromBlock: 10334365 }, // original production factory + { address: "0xC3f2831429F51aCe9243aCe75819488e3566CA7b", fromBlock: 86016310 }, // metadata-v1 factory ]; +const RH_STATE_VIEW = "0xF3334192D15450CdD385c8B70e03f9A6bD9E673b"; +const RH_PROJECT_CREATED = "event ProjectCreated(uint64 indexed projectId, address indexed launchpad, address indexed token, address creator, uint8 mode)"; +const RH_BOOTSTRAPPED = "event Bootstrapped(bytes32 indexed poolId, uint256 launchTs, uint128 liquidity, int24 launchTick)"; +const RH_POOL_KEY = "function poolKey() view returns (address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)"; +const RH_SLOT0 = "function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)"; +const RH_POSITION_INFO = "function getPositionInfo(bytes32 poolId, address owner, int24 tickLower, int24 tickUpper, bytes32 salt) view returns (uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128)"; +const ZERO_SALT = `0x${"0".repeat(64)}`; +const MIN_TICK = -887272; +const MAX_TICK = 887272; + // Anchor account discriminator for LaunchpadState (base58 of the first 8 bytes). const LAUNCHPAD_DISC = "VgW83Wf4icd"; @@ -50,24 +62,83 @@ async function tvl(api) { } async function robinhoodTvl(api) { - const launchpadLists = await Promise.all(RH_FACTORIES.map((target) => api.fetchList({ - target, + const launchpadLists = await Promise.all(RH_FACTORIES.map(({ address }) => api.fetchList({ + target: address, lengthAbi: "uint64:nextProjectId", itemAbi: "function launchpadOf(uint64) view returns (address)", }))); const launchpads = [...new Set(launchpadLists.flat())]; await api.sumTokens({ owners: launchpads, tokens: [ADDRESSES.robinhood.USDG] }); + + // RH Full seeds a full-range position in the singleton Uniswap V4 + // PoolManager. There is no per-pool ERC20 balance, so derive the position's + // current reserves from StateView and the live tick. The launched token side + // is excluded; it is minted by Keep and has no independent collateral value. + const launches = []; + for (const { address, fromBlock } of RH_FACTORIES) { + const created = await getLogs2({ api, target: address, eventAbi: RH_PROJECT_CREATED, fromBlock, extraKey: "projects" }); + for (const log of created) { + const bootstrapped = await getLogs2({ api, target: log.launchpad, eventAbi: RH_BOOTSTRAPPED, fromBlock, extraKey: "bootstrapped" }); + for (const boot of bootstrapped) launches.push({ launchpad: log.launchpad, token: log.token, poolId: boot.poolId }); + } + } + if (!launches.length) return; + + const keys = await api.multiCall({ abi: RH_POOL_KEY, calls: launches.map(({ launchpad }) => ({ target: launchpad })) }); + const live = launches.map((launch, i) => { + const key = keys[i]; + const currency0 = key?.currency0 ?? key?.[0]; + const currency1 = key?.currency1 ?? key?.[1]; + const tickSpacing = Number(key?.tickSpacing ?? key?.[3]); + if (!currency0 || !currency1 || !tickSpacing) return null; + const token = launch.token.toLowerCase(); + const usdg = ADDRESSES.robinhood.USDG.toLowerCase(); + const validOrder = (currency0.toLowerCase() === token && currency1.toLowerCase() === usdg) + || (currency0.toLowerCase() === usdg && currency1.toLowerCase() === token); + if (!validOrder) return null; + return { + ...launch, + token0: currency0, + token1: currency1, + tickLower: Math.trunc(MIN_TICK / tickSpacing) * tickSpacing, + tickUpper: Math.trunc(MAX_TICK / tickSpacing) * tickSpacing, + }; + }).filter(Boolean); + if (!live.length) return; + + const [slot0, positions] = await Promise.all([ + api.multiCall({ abi: RH_SLOT0, target: RH_STATE_VIEW, calls: live.map(({ poolId }) => ({ params: [poolId] })) }), + api.multiCall({ + abi: RH_POSITION_INFO, + target: RH_STATE_VIEW, + calls: live.map(({ poolId, launchpad, tickLower, tickUpper }) => ({ params: [poolId, launchpad, tickLower, tickUpper, ZERO_SALT] })), + }), + ]); + + live.forEach((launch, i) => { + const slot = slot0[i]; + const liquidity = Number(positions[i]?.liquidity ?? positions[i]?.[0] ?? 0); + if (!slot || !liquidity || slot.tick === undefined) return; + addUniV3LikePosition({ + api, + token0: launch.token0, + token1: launch.token1, + liquidity, + tickLower: launch.tickLower, + tickUpper: launch.tickUpper, + tick: Number(slot.tick), + }); + api.removeTokenBalance(launch.token); + }); } module.exports = { methodology: - "TVL is the refundable stablecoin held in keep.coffee's own per-launch vaults/contracts: " + - "USDC vault PDAs for both Full Launch and Idea Mode on Solana, and Paxos USDG held " + - "directly by Launchpad clones on Robinhood " + - "Chain. It covers active raises, post-bootstrap refund reserves, cancelled-raise balances " + - "and failed-raise refund pools. Liquidity seeded into Raydium or Uniswap V4 is excluded " + - "because it is counted by those protocols and is permanently locked after success.", + "TVL is the refundable stablecoin held in keep.coffee's per-launch vaults/contracts, plus the USDG side of RH Full's full-range Uniswap V4 launch positions. " + + "It covers active raises, post-bootstrap refund reserves, cancelled-raise balances and failed-raise refund pools; the launched-token side of each pool is excluded because it is minted by Keep and has no independent collateral value. " + + "The RH V4 liquidity is also counted by the underlying Uniswap V4 listing.", + doublecounted: true, timetravel: false, solana: { tvl }, robinhood: { tvl: robinhoodTvl }, From cffa36285f960c5c46ff1f197344b49eca023b1b Mon Sep 17 00:00:00 2001 From: daik1 Date: Thu, 15 Oct 2026 18:11:46 +0900 Subject: [PATCH 268/988] Add JPY DeFi TVL adapter (Ethereum) (#21646) --- projects/jpydf/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/jpydf/index.js diff --git a/projects/jpydf/index.js b/projects/jpydf/index.js new file mode 100644 index 00000000000..31b690f2e5b --- /dev/null +++ b/projects/jpydf/index.js @@ -0,0 +1,22 @@ +const vaults = [ + '0x6042755ecca71a1be9c7091441ca5beaa6b520e4', // wstETH + '0x087ebaf3f1b094b2046912a5e5f0bad78df3eaa7', // USDC +] + +async function tvl(api) { + for (const vault of vaults) { + const underlying = await api.call({ target: vault, abi: 'address:underlying' }) + const buffer = await api.call({ target: vault, abi: 'uint256:bufferBalance' }) + api.add(underlying, buffer) + const strategies = await api.fetchList({ target: vault, lengthAbi: 'getStrategiesCount', itemAbi: 'strategies' }) + const assets = await api.multiCall({ abi: 'uint256:estimatedTotalUnderlying', calls: strategies }) + assets.forEach(amount => api.add(underlying, amount)) + } +} + +module.exports = { + doublecounted: true, // wstETH is also counted by Lido; allocated USDC overlaps Aave V3 / Morpho. + methodology: 'Underlying assets in the production CollateralVault buffers, excluding protected backstop reserves, plus the underlying value of each registered Strategy position, including accrued yield. Counts deposits whether or not used in a Trove, and assets pending withdrawal until paid out. JPYdf, dToken balances, debt, external LP positions and Treasury balances are not added. Assets deployed to Lido, Aave V3 and Morpho overlap those protocols.', + start: '2026-09-30', + ethereum: { tvl }, +} From 764c7bf1ca85f044b58519c575baacd28f1ae343 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 15 Oct 2026 14:42:40 +0530 Subject: [PATCH 269/988] =?UTF-8?q?oroswap:=20update=20denom=20(uzig=20->?= =?UTF-8?q?=20azig),=20decimals=20(6=20->=2018)=20and=20pair=20pag?= =?UTF-8?q?=E2=80=A6=20(#21632)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/oroswap/index.js | 62 +++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/projects/oroswap/index.js b/projects/oroswap/index.js index c6d8c4c4703..527cc8d6d4e 100644 --- a/projects/oroswap/index.js +++ b/projects/oroswap/index.js @@ -12,41 +12,42 @@ const STZIG_DENOM = 'coin.zig109f7g2rzl2aqee7z6gffn8kfe9cpqx0mjkk7ethmx8m2hq4xpe const VALDORA_STAKER_CONTRACT = 'zig18nnde5tpn76xj3wm53n0tmuf3q06nruj3p6kdemcllzxqwzkpqzqk7ue55'; /** - * Fetches the conversion rate from stZIG to uZIG using the redeem-side quote from the Valdora Staker contract + * Fetches the conversion rate from stZIG to aZIG using the redeem-side quote from the Valdora Staker contract * * How it works: - * 1. Query the contract with reverse_st_zig_price: "If I redeem X uZIG worth of stZIG, how much stZIG do I get?" - * 2. The contract responds with stzig_amount (amount of stZIG received for probe_uzig uZIG) - * 3. We invert this: uzig_per_stzig = probe_uzig / stzig_amount + * 1. Query the contract with reverse_st_zig_price: "If I redeem X aZIG worth of stZIG, how much stZIG do I get?" + * 2. The contract responds with stzig_amount (amount of stZIG received for probe_azig aZIG) + * 3. We invert this: azig_per_stzig = probe_azig / stzig_amount * * We use a large probe amount (1,000 ZIG) for precision: * - Larger probe = more precision in integer division * - Reduces rounding errors when calculating the ratio - * - Result is scaled by 1e6 to maintain precision (returns ratio * 1,000,000) + * - Result is scaled by 1e6 (stZIG has 6 decimals), so it is aZIG per 1 whole stZIG * - * Returns the ratio of uZIG per 1 stZIG, scaled by 1e6 (or null if query fails) - * Example: if 1 stZIG = 0.989 ZIG, returns ~989,000 + * Returns the ratio of aZIG per 1 stZIG, scaled by 1e6 (or null if query fails) + * Example: if 1 stZIG = 1.07 ZIG, returns ~1,070,000,000,000,000,000 */ -async function fetchUzigPerStzig() { - // Use 1,000 ZIG (1 billion uZIG) as probe for better precision in integer math - // This is the amount of uZIG we're "simulating" a redeem with - const probeUzig = 1_000_000_000; // 1,000 ZIG in uZIG (base units with 6 decimals) +async function fetchAzigPerStzig() { + // Use 1,000 ZIG as probe for better precision in integer math + // This is the amount of aZIG we're "simulating" a redeem with + // After ZIGChain's v5 upgrade, uzig is changed to azig and decimals changed from 6 to 18 + const probeAzig = 1_000_000_000_000_000_000_000n; // 1,000 ZIG in aZIG (base units with 18 decimals) - // Query: "If I redeem this much uZIG, how much stZIG do I get?" + // Query: "If I redeem this much aZIG, how much stZIG do I get?" // The contract uses reverse pricing logic (redeem path) const { stzig_amount } = await queryContract({ contract: VALDORA_STAKER_CONTRACT, chain: 'zigchain', - data: { reverse_st_zig_price: { amount: String(probeUzig) } }, + data: { reverse_st_zig_price: { amount: String(probeAzig) } }, }); if (!stzig_amount || stzig_amount === '0') return null; - // Calculate: uzig_per_stzig = probe_uzig / stzig_amount + // Calculate: azig_per_stzig = probe_azig / stzig_amount // We scale by 1e6 to maintain precision: (probe * 1e6) / stzig_amount // This gives us the ratio scaled by 1,000,000 - // Example: if probe=1e9 and stzig_amount=989580475, then ratio_scaled = ~1,010,528 - return (BigInt(probeUzig) * 1_000_000n) / BigInt(stzig_amount); + // Example: if probe=1e21 and stzig_amount=932580520, then ratio_scaled = ~1,072,293,000,000,000,000 + return (probeAzig * 1_000_000n) / BigInt(stzig_amount); } function sleep(ms) { @@ -93,7 +94,12 @@ async function getAllPairs() { allPairs.push(...response.pairs); const lastPair = response.pairs[response.pairs.length - 1]; - const nextCursor = { asset_infos: lastPair.asset_infos, pair_type: lastPair.pair_type }; + // After ZIGChain's v5 upgrade, uzig is changed to azig. Pools not yet migrated still + // return uzig, which makes the factory skip pairs, so the cursor must use azig + const assetInfos = lastPair.asset_infos.map(info => + info.native_token && info.native_token.denom === 'uzig' ? { native_token: { denom: 'azig' } } : info + ); + const nextCursor = { asset_infos: assetInfos, pair_type: lastPair.pair_type }; if (response.pairs.length < limit) { break; } @@ -149,30 +155,30 @@ async function tvl(api) { } const balances = api.getBalances(); - // Convert stZIG balances to uZIG equivalent for TVL calculation + // Convert stZIG balances to aZIG equivalent for TVL calculation const stzigKeyRaw = STZIG_DENOM; const stzigKeyPrefixed = `zigchain:${STZIG_DENOM}`; const stzigBalStr = balances[stzigKeyPrefixed] || balances[stzigKeyRaw]; if (stzigBalStr) { // Fetch the current conversion rate from on-chain quote (redeem path) - const ratioScaled = await fetchUzigPerStzig(); + const ratioScaled = await fetchAzigPerStzig(); if (ratioScaled) { - // Convert stZIG balance to uZIG equivalent - // Formula: uzig_equivalent = (stzig_balance * ratio_scaled) / 1_000_000 - // We divide by 1_000_000 to remove the scaling we added in fetchUzigPerStzig + // Convert stZIG balance to aZIG equivalent + // Formula: azig_equivalent = (stzig_balance * ratio_scaled) / 1_000_000 + // We divide by 1_000_000 to remove the scaling we added in fetchAzigPerStzig const stzigBal = BigInt(stzigBalStr); - const uzigEq = (stzigBal * ratioScaled) / 1_000_000n; + const azigEq = (stzigBal * ratioScaled) / 1_000_000n; - // Remove stZIG from balances (we've converted it to uZIG) + // Remove stZIG from balances (we've converted it to aZIG) delete balances[stzigKeyPrefixed]; delete balances[stzigKeyRaw]; - // Add the uZIG equivalent to the existing uZIG balance - const uzigKey = 'zigchain:uzig'; - const currentUzig = balances[uzigKey] ? BigInt(balances[uzigKey]) : 0n; - balances[uzigKey] = (currentUzig + uzigEq).toString(); + // Add the aZIG equivalent to the existing aZIG balance + const azigKey = 'zigchain:azig'; + const currentAzig = balances[azigKey] ? BigInt(balances[azigKey]) : 0n; + balances[azigKey] = (currentAzig + azigEq).toString(); } } return transformBalances('zigchain', balances); From 284f602e307bfc8e2ae96733b999cf136ad1c77b Mon Sep 17 00:00:00 2001 From: merrulpo3 Date: Thu, 15 Oct 2026 05:14:42 -0400 Subject: [PATCH 270/988] Add Everstrike TVL adapter with stablecoin support (#21635) --- projects/everstrike/index.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 projects/everstrike/index.js diff --git a/projects/everstrike/index.js b/projects/everstrike/index.js new file mode 100644 index 00000000000..8eb547cd54c --- /dev/null +++ b/projects/everstrike/index.js @@ -0,0 +1,32 @@ +const { sumTokensExport } = require("../helper/sumTokens"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const contracts = { + ethereum: "0x558FCAcE07fBf6A3D4449240685f29Ad6669fd81", + optimism: "0xB9C1EC4647301828Bb10f6B52584201D1C16bC8F", + bsc: "0x777108936Ed411b0598c1E35266FD92e76Cf834d", + polygon: "0x4f48c6a228a0bf0c03dc53765930c0cb06f1ecd0", + base: "0xe26a4561b3d213f1479196e43fc532fb89142abd", + arbitrum: "0xAC66779A566143069A8E8590bDeaBe685054927F", +}; + +const stablecoins = { + ethereum: [ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT], + optimism: [ADDRESSES.optimism.USDC, ADDRESSES.optimism.USDC_CIRCLE, ADDRESSES.optimism.USDT], + bsc: [ADDRESSES.bsc.USDC, ADDRESSES.bsc.USDT], + polygon: [ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDC_CIRCLE, ADDRESSES.polygon.USDT], + base: [ADDRESSES.base.USDC], + arbitrum: [ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.USDT], +}; + +const adapter = { + methodology: "Counts USDC and USDT balances held by Everstrike's custody contract on each supported chain. Includes native and legacy bridged USDC where both are deployed.", +}; + +for (const [chain, owner] of Object.entries(contracts)) { + adapter[chain] = { + tvl: sumTokensExport({ owner, tokens: stablecoins[chain] }), + }; +} + +module.exports = adapter; From c2adda5bcae2754a23c7943b036704ff1f1856f7 Mon Sep 17 00:00:00 2001 From: Captain Zach <3989784+navionis@users.noreply.github.com> Date: Thu, 15 Oct 2026 04:18:39 -0500 Subject: [PATCH 271/988] Add Mezo Swap adapter (#21641) --- projects/mezo-swap/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/mezo-swap/index.js diff --git a/projects/mezo-swap/index.js b/projects/mezo-swap/index.js new file mode 100644 index 00000000000..65361cccfed --- /dev/null +++ b/projects/mezo-swap/index.js @@ -0,0 +1,25 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const FACTORIES = [ + '0x83FE469C636C4081b87bA5b3Ae9991c6Ed104248', // basic pools (volatile + stable) + '0xBB24AF5c6fB88F1d191FA76055e30BF881BeEb79', // concentrated liquidity pools +] + +async function tvl(api) { + for (const factory of FACTORIES) { + const pools = await api.fetchList({ + target: factory, + lengthAbi: 'uint256:allPoolsLength', + itemAbi: 'function allPools(uint256) view returns (address)', + }) + const token0s = await api.multiCall({ abi: 'address:token0', calls: pools }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: pools }) + const tokensAndOwners = pools.flatMap((pool, i) => [[token0s[i], pool], [token1s[i], pool]]) + await sumTokens2({ api, tokensAndOwners }) + } +} + +module.exports = { + methodology: 'Counts the underlying token balances held by every Mezo Swap pool, across both the basic pool factory and the concentrated-liquidity (Slipstream) factory.', + mezo: { tvl }, +} From 32cecd89c44c1b8a7d82add2f5f346e6c6c9d60e Mon Sep 17 00:00:00 2001 From: routebuilder Date: Thu, 15 Oct 2026 13:35:10 +0200 Subject: [PATCH 272/988] Throw on folio discovery failures instead of silently zeroing (reserve) (#21628) --- projects/reserve/helper.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/reserve/helper.js b/projects/reserve/helper.js index 267324a748a..1b3d87eb17f 100644 --- a/projects/reserve/helper.js +++ b/projects/reserve/helper.js @@ -171,7 +171,7 @@ const _getFolioLogs = async (api, folioDeployers) => { fromBlock: deployer.startBlock, onlyArgs: true, extraKey: "folio-deployed", - }).catch(() => []), + }), getLogs({ api, target: deployer.address, @@ -179,7 +179,7 @@ const _getFolioLogs = async (api, folioDeployers) => { fromBlock: deployer.startBlock, onlyArgs: true, extraKey: "governed-folio-deployed", - }).catch(() => []) + }) ]) ); @@ -216,7 +216,7 @@ const _getStakingTokenLogs = async (api, governanceDeployers) => { eventAbi: "event DeployedGovernedStakingToken(address indexed underlying, address indexed stToken, address governor, address timelock)", fromBlock: deployer.startBlock, onlyArgs: true, - }).catch(() => []) + }) ) ); From d1ee6e647f0efb8333ba4f9a364414417a4e1e67 Mon Sep 17 00:00:00 2001 From: Nullmask Date: Thu, 15 Oct 2026 19:02:23 +0400 Subject: [PATCH 273/988] Nullmask: add Base, BSC and Robinhood (#21652) --- registries/sumTokens.js | 3 +++ registries/treasury.js | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index f3e299c7ae1..506369adb39 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -20743,6 +20743,9 @@ const configs = { "nullmask": { start: '2026-10-01', ethereum: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT] }, + base: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null, ADDRESSES.base.USDC] }, + bsc: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT] }, + robinhood: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null] }, }, "numbers": { "misrepresentedTokens": true, diff --git a/registries/treasury.js b/registries/treasury.js index fb0b1e80d14..c1475a4dc34 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -4127,6 +4127,18 @@ const configs = { owners: ['0xDD85F4AfDE114dc7c480b012Feaa83152a0C0D09'], // pool treasury(), receives swept protocol fees tokens: [nullAddress, ADDRESSES.ethereum.USDT], }, + base: { + owners: ['0xDD85F4AfDE114dc7c480b012Feaa83152a0C0D09'], // pool treasury(), receives swept protocol fees + tokens: [nullAddress, ADDRESSES.base.USDC], + }, + bsc: { + owners: ['0xDD85F4AfDE114dc7c480b012Feaa83152a0C0D09'], // pool treasury(), receives swept protocol fees + tokens: [nullAddress, ADDRESSES.bsc.USDT], + }, + robinhood: { + owners: ['0xDD85F4AfDE114dc7c480b012Feaa83152a0C0D09'], // pool treasury(), receives swept protocol fees + tokens: [nullAddress], + }, solana: { owners: [ 'GRbpmTbmDeGn8BXHXb1jfEeUT6sGAt7Da44YpWxCS8nr', // ops wallet From 5f2fe10becd453777d77a0ed1d9fe09660f1d105 Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Thu, 15 Oct 2026 16:23:42 +0100 Subject: [PATCH 274/988] sumbiosis add xlayer chain support (#21625) --- projects/symbiosis-finance/config.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 32dd798da33..15604049083 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -561,5 +561,14 @@ module.exports = { '0xE75C7E85FE6ADd07077467064aD15847E6ba9877' // portal ] }, + { + name: 'xlayer', + tokens: [ + '0xb6ceceab302e2e4948951ee7843fc24e92933061', // USDC + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62' // portal + ] + }, ] } \ No newline at end of file From 6b5199739503aa1ba781a3e73674382d246da8aa Mon Sep 17 00:00:00 2001 From: Michael Torres Date: Thu, 15 Oct 2026 08:49:46 -0700 Subject: [PATCH 275/988] Add AlphaPrimer yield vault (Arbitrum) (#21634) Co-authored-by: Michael Torres <3359301+mictorres-alpha@users.noreply.github.com> Co-authored-by: FelixBruguera --- registries/erc4626.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/registries/erc4626.js b/registries/erc4626.js index 235fcfe16cc..91514c3533d 100644 --- a/registries/erc4626.js +++ b/registries/erc4626.js @@ -516,7 +516,12 @@ const configs = { doublecounted: true, methodology: "Underlying assets in Otomate ERC-4626 vaults on Ink, measured with totalAssets net of accrued protocol fees. Assets are supplied to Tydro and already included in Tydro TVL.", ink: ['0x919C57BF59484798Ff2f90018640fd0A08242aC2', '0x2baA4C3f66Fa6f0c2d56242BaAE446a4De878B98', '0xcc7DcF43b17D8EdC437a6e33a6A325C57eba1ED7', '0x59046e5a0cbb5b64981b4668a31ab3a5ed0e7dd0'] - } + }, + 'alphaprimer': { + doublecounted: true, + methodology: 'TVL is the USDC held by the AlphaPrimer vault, read via ERC-4626 totalAssets(). Deposits are supplied to Aave V3, Compound V3 or Fluid on Arbitrum, so they are also counted under those protocols.', + arbitrum: ['0x87Ef5c25203886b1026ad907E7f84fBAABdF1fa9'], + }, } module.exports = buildProtocolExports(configs, erc4626ExportFn) From 655894f196c3d99cd8dde752040a7ebbcd91c141 Mon Sep 17 00:00:00 2001 From: eden Date: Thu, 15 Oct 2026 22:53:41 +0700 Subject: [PATCH 276/988] remove dup btc wallets - poloniex (#21653) --- projects/helper/bitcoin-book/index.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index 00335f0436a..366c8d07418 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -61,13 +61,6 @@ module.exports = { "1LgW4RA5iE98khRJ58Bhx5RLABP3QGjn9y", "33Mz8zrWx6yei6itk2mjfCytdKJZEwKeM6", "1PrHfPbcLyHTUHxjizAgauCNXvjnh5LEex", - "1NBX1UZE3EFPTnYNkDfVhRADvVc8v6pRYu", - "14XKsv8tT6tt8P8mfDQZgNF8wtN5erNu5D", - "1M3Y4dgeg8zVdQ41BXTaWyFUUmc2e6fF2b", - "1QJt83Cb6S6Tm5chFwyn46XSBGYbS8unXB", - "13r8PhQ9Gk1KavpJzjc8ELjEw3kBQKLRHq", - "1NVuvqYpZPnWSd5Fvx15dq6u39ongzxLL2", - "1KVpuCfhftkzJ67ZUegaMuaYey7qni7pPj", "1DMpkJ5QHu6rnWehZjVkZxsRTW7VRHk7yk", ], ainn: [ From b8407a493cd4c9c64545946ba4c3daa32e305bde Mon Sep 17 00:00:00 2001 From: ross <92001561+z0r0z@users.noreply.github.com> Date: Fri, 16 Oct 2026 03:46:39 +0700 Subject: [PATCH 277/988] Update Tacit TVL: count the CollateralEngine wstETH escrow and the pool's ERC20 balances (#21658) --- registries/sumTokens/data3.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 3512b3f10dd..295ba4ff2d0 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1135,15 +1135,19 @@ module.exports = { } }, "tacit": { - "methodology": "TVL is the ETH held by Tacit's shielded pools: the ETH wrapped into the ConfidentialPool on Ethereum, and the ETH shielded in the TacitEvmPool on Ethereum, Base and Robinhood Chain. Balances are read from the pool contracts.", + "methodology": "TVL is the assets held by Tacit's contracts: the ETH, USDC, USDT and wstETH wrapped into the ConfidentialPool on Ethereum, the ETH shielded in the TacitEvmPool on Ethereum, Base and Robinhood Chain, and the wstETH escrowed in the CollateralEngine that backs Bitcoin locks. Balances are read from the contracts; Tacit's own token (TAC) is not counted.", "start": "2026-09-17", "ethereum": { "owners": [ "0x000000000Ed1eabD231Be41d93b719056F7febFC", - "0x000000c2A20657CE25f2Ba99737933D031AFBEE9" + "0x000000c2A20657CE25f2Ba99737933D031AFBEE9", + "0x000000003f608BDdF0ca45934003ffb9DbDF70DB" ], "tokens": [ - ADDRESSES.null + ADDRESSES.null, + ADDRESSES.ethereum.WSTETH, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT ] }, "base": { From d6708d5df0befe985e8838d4aa7128780782ad7b Mon Sep 17 00:00:00 2001 From: 0xSigil Date: Fri, 16 Oct 2026 06:05:11 +0900 Subject: [PATCH 278/988] phos: count XEF on Xphere (#21648) --- projects/helper/coreAssets.json | 3 ++- projects/phos-launchpad/index.js | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index c09c71e01f7..2b0659d36d2 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1540,7 +1540,8 @@ "XPLA": "axpla" }, "xp": { - "wXP": "0x8c290B96768210Dc1Ab64970Ff62F0F97be00431" + "wXP": "0x8c290B96768210Dc1Ab64970Ff62F0F97be00431", + "XEF": "0x80252C2D06bbd85699c555fc3633D5B8eE67C9AD" }, "chihuahua": { "HUAHUA": "uhuahua" diff --git a/projects/phos-launchpad/index.js b/projects/phos-launchpad/index.js index dabcc1c62b8..84377ab398a 100644 --- a/projects/phos-launchpad/index.js +++ b/projects/phos-launchpad/index.js @@ -2,17 +2,18 @@ const { getLogs2 } = require('../helper/cache/getLogs') const { nullAddress } = require('../helper/tokenMapping') const FACTORY = '0xc5DF918b40BeAad05bd84F88FD39550AedEB4c71' +const XEF = '0x80252C2D06bbd85699c555fc3633D5B8eE67C9AD' const LaunchCreated = 'event LaunchCreated(address indexed launch, address indexed creator, bytes params, uint256 time)' async function tvl(api) { const logs = await getLogs2({ api, target: FACTORY, fromBlock: 48581493, eventAbi: LaunchCreated }) - return api.sumTokens({ owners: logs.map((i) => i.launch), tokens: [nullAddress] }) + return api.sumTokens({ owners: logs.map((i) => i.launch), tokens: [nullAddress, XEF] }) } module.exports = { methodology: - 'Sums the native XP held by every sale contract the Phos launchpad factory has created on Xphere: contributions to sales that are still selling, unclaimed refunds owed by failed ones, and the platform fee a graduated sale holds until an admin withdraws it. A graduated sale keeps none of its liquidity, that sits in the pool the Phos Swap adapter reads.', + 'Sums the native XP and the XEF held by every sale contract the Phos launchpad factory has created on Xphere: contributions to sales that are still selling, unclaimed refunds owed by failed ones, and the platform fee a graduated sale holds until an admin withdraws it. A sale raises in one of the two. A graduated sale keeps none of its liquidity, that sits in the pool the Phos Swap adapter reads.', start: '2026-09-14', xp: { tvl }, } From 4cc7b3d6d2ed98d4b168e88d337e6ef4ec8718b5 Mon Sep 17 00:00:00 2001 From: OmkarK97 <121169132+OmkarK97@users.noreply.github.com> Date: Fri, 16 Oct 2026 12:29:24 +0530 Subject: [PATCH 279/988] alpend: asset-agnostic methodology (#21663) --- projects/alpend/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/alpend/index.js b/projects/alpend/index.js index 867a2165044..4a3593d458f 100644 --- a/projects/alpend/index.js +++ b/projects/alpend/index.js @@ -58,7 +58,7 @@ async function borrowed(api) { module.exports = { timetravel: false, methodology: - 'Alpend is a lending protocol on the Canton Network. Users supply CC, USDCx, and CBTC as collateral to earn yield, ' + + 'Alpend is a lending protocol on the Canton Network. Users supply assets to its lending pools as collateral to earn yield, ' + 'and borrow against that collateral; interest accrues on-chain via reserve indices. ' + 'TVL is the amount of each asset supplied to Alpend\'s lending pools minus the amount borrowed out of them, i.e. the assets held by the pool operator party; ' + 'the borrowed tab is the gross amount currently borrowed out of those pools. ' + From 4a6ef31a4eed4f24882a7d82bff50306b40b6d6c Mon Sep 17 00:00:00 2001 From: routebuilder Date: Fri, 16 Oct 2026 09:00:16 +0200 Subject: [PATCH 280/988] add missing Binance DOT AssetHub reserves (#21660) --- projects/binance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/binance/index.js b/projects/binance/index.js index da10491a440..a14df719455 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -51,6 +51,7 @@ const binanceToDefillama = { SCROLL: "scroll", SONIC: "sonic", PLASMA: "plasma", + STATEMINT: 'polkadot', } const withdrawalAddresses = [ From 3ed091f8ef40ebd5cdb3237746d1f196d83595a8 Mon Sep 17 00:00:00 2001 From: ashtonmerlin <100565380+ashtonmerlin@users.noreply.github.com> Date: Fri, 16 Oct 2026 15:12:24 +0800 Subject: [PATCH 281/988] Remove 4 Merlin BTC(M-BTC) LP addresses (#21650) --- projects/helper/bitcoin-book/index.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index 366c8d07418..88d22476d1f 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -297,11 +297,6 @@ module.exports = { 'bc1pyz7l3u2wdhvdwgej0n6myhp6wzrr0qa3982l7zq5v3k5f6fxgmyqg5vkxu' ], merlin: [ - // Current reserve wallets and predecessor balances: https://merlinbitcoin.org/ - "3EtJpUAgSgHgUYkTSG12tocDgYbc2TBHQ3", // Rotated from 3FYAoJau on 2026-09-16. - "1M1T6sUtZP4UdsnvMJvQA7BbTrV1Y5c1QR", // Rotated from 1DthDPh7 on 2026-09-16. - "3FYAoJauXw17sBn5BwqbS4kkzRGeXmbN6r", - "1DthDPh76r4vGbnJqTSyYGmFPoiXUpityn", "bc1qtu66zfqxj6pam6e0zunwnggh87f5pjr7vdr5cd", "15zVuow5e9Zwj4nTrxSH3Rvupk32wiKEsr", "bc1q4gfsheqz7ll2wdgfwjh2l5hhr45ytc4ekgxaex", From 8fad360e708dba8474b3f630267888088e5c9a17 Mon Sep 17 00:00:00 2001 From: Priors <331423553+priors-agents@users.noreply.github.com> Date: Fri, 16 Oct 2026 09:30:44 +0200 Subject: [PATCH 282/988] Add Priors (Robinhood Chain): credit pool TVL, borrowed, staking (#21656) Co-authored-by: agent.p Co-authored-by: ccipherx --- projects/priors/index.js | 71 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 projects/priors/index.js diff --git a/projects/priors/index.js b/projects/priors/index.js new file mode 100644 index 00000000000..ead9d7f3514 --- /dev/null +++ b/projects/priors/index.js @@ -0,0 +1,71 @@ +// Priors: unsecured USDG credit lines for ERC-8004 agents on Robinhood Chain, from one pool (CreditPoolV2). +// Lenders deposit USDG for pool shares; backers ("roots") lock pool shares to vouch lines for agents; agents borrow +// and repay. Stock-token collateral can back a line through the StockVault. +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const USDG = ADDRESSES.robinhood.USDG +const PRIORS = '0xeDBf91223639800BCd5756815CAf908Df3b890bE' + +const POOL_V2 = '0x281210097f0de7A8FB6F87310AF0f089c9C8DE21' +// v1 is paused (no new lines or loans; its records were imported into v2), but lenders who have not withdrawn still +// hold USDG in it. +const POOL_V1 = '0x0259889e6EBab1a18CeE7e62Bc5B9648FB6C44e5' +const STOCK_VAULT = '0xbEcd07EC689988e16b870C121756C4c2C8cb02B6' // proxy +// deployment blocks: a contract is read only from its own +const POOL_V1_BLOCK = 68593823 +const POOL_V2_BLOCK = 71702617 +const STOCK_VAULT_BLOCK = 74826641 +// USDG bonds an agent's owner posts for an automatic invite; returned when the line closes. +const INVITE_BONDS = ['0x8BE478c754D9124D11e78dB20F5bf4dA45403275', '0x346d3360B7258a18E8a2a55fe20E0F467113a53A'] +// $PRIORS stakers' escrow behind agents' lines (v2, v3, v4, v5, and the v5 deployment retired on 2026-10-11). +const SEAT_VAULTS = [ + '0x6D934C07a33E7285cE691A9B258cdB53F18e6B5F', + '0x59D155C42A9263fA7596867b992bB3e84dF680a9', + '0xb1c3a04496238D62E3c93118C297163855e22192', + '0xC999014C6218EC41f0aE412d49AE8f2aA4c539fD', + '0xdE29D3A627d77CFA13c5331C1B7B181a4C5B752E', +] + +// Root backers' stakes (Priors' treasury contracts, the seat vaults' and the stock vault's roots among them) are pool +// shares: their USDG is already in the pool's balance and is not counted again. +async function tvl(api) { + // before the stock vault's deployment there is no collateral list to read; after it, a failed read is an error + const stockTokens = (await api.getBlock()) >= STOCK_VAULT_BLOCK ? await api.call({ target: STOCK_VAULT, abi: 'address[]:assetList' }) : [] + return sumTokens2({ + api, + tokensAndOwners: [ + [USDG, POOL_V2], + [USDG, POOL_V1], + ...INVITE_BONDS.map((owner) => [USDG, owner]), + ...SEAT_VAULTS.map((owner) => [USDG, owner]), + [USDG, STOCK_VAULT], + ...stockTokens.map((token) => [token, STOCK_VAULT]), + ], + }) +} + +// Principal of the open loans; the fee is paid at repayment and is not counted. +async function borrowed(api) { + // only the pools deployed at the queried block; a failed read from one of them is an error, never a zero + const block = await api.getBlock() + const pools = [[POOL_V2, POOL_V2_BLOCK], [POOL_V1, POOL_V1_BLOCK]].filter(([, from]) => block >= from).map(([pool]) => pool) + if (!pools.length) return + const out = await api.multiCall({ abi: 'uint256:totalPrincipalOut', calls: pools }) + out.forEach((amount) => api.add(USDG, amount)) +} + +async function staking(api) { + return api.sumTokens({ owners: SEAT_VAULTS, tokens: [PRIORS] }) +} + +module.exports = { + methodology: + 'TVL is the USDG held by the Priors credit pool (v2, and lenders still in the paused v1), the USDG invite bonds, and the stock tokens deposited as collateral in the StockVault. Backers\' stakes are pool shares inside the pool\'s USDG, so they are not added again. Borrowed is the principal of the open loans (totalPrincipalOut). Staking is the $PRIORS escrowed in the seat vaults behind agents\' lines.', + start: '2026-09-21', + robinhood: { + tvl, + borrowed, + staking, + }, +} From 8925621fe5afeb5d74b061175f9990820e326657 Mon Sep 17 00:00:00 2001 From: ssadkov Date: Fri, 16 Oct 2026 12:32:32 +0500 Subject: [PATCH 283/988] yield-ai: retry Aptos reads so a rate limit does not freeze TVL (#21651) Co-authored-by: Cursor Co-authored-by: ccipherx --- projects/helper/env.js | 1 + projects/yield-ai/index.js | 134 +++++++++++++++++++++---------------- 2 files changed, 79 insertions(+), 56 deletions(-) diff --git a/projects/helper/env.js b/projects/helper/env.js index 86487d1062b..5f1c779eba8 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -121,6 +121,7 @@ const ENV_KEYS = [ 'TATUM_API_KEY', 'TEAM_WEBHOOK', 'HIRO_API_KEY', + 'APTOS_API_KEY', ] Object.keys(DEFAULTS).forEach(i => { diff --git a/projects/yield-ai/index.js b/projects/yield-ai/index.js index 31c4621f19b..d55e7e1a530 100644 --- a/projects/yield-ai/index.js +++ b/projects/yield-ai/index.js @@ -4,6 +4,7 @@ const { GraphQLClient, gql } = require("graphql-request"); const { sliceIntoChunks } = require("../helper/utils"); const { PromisePool } = require("@supercharge/promise-pool"); const sdk = require('@defillama/sdk'); +const { getEnv } = require("../helper/env"); const VAULT = "0x333d1890e0aa3762bb256f5caeeb142431862628c63063801f44c152ef154700"; @@ -111,9 +112,9 @@ function normalizeObjectAddress(obj) { } /** - * Exponential backoff with jitter. The public fullnode answers bursts with 429, and a failed - * Echelon read now fails the run instead of dropping the safe, so a short linear backoff is not - * enough to ride out a rate-limit window. + * Exponential backoff with jitter. The public fullnode and the Aptos indexer answer bursts with + * 429, and a failed read fails the run instead of dropping that safe, so a short linear backoff + * is not enough to ride out a rate-limit window. */ async function retryAsync(fn, attempts = 8) { let lastError; @@ -326,11 +327,13 @@ async function resolveHyperionPoolAddress(pos) { if (known?.poolAddress) return known.poolAddress; // liquidity_pool_address_safe returns a (bool exists, address) tuple - const res = await function_view({ - functionStr: `${HYPERION_DEX}::pool_v3::liquidity_pool_address_safe`, - args: [pos.tokenA, pos.tokenB, pos.feeTier], - chain: "aptos", - }); + const res = await retryAsync(() => + function_view({ + functionStr: `${HYPERION_DEX}::pool_v3::liquidity_pool_address_safe`, + args: [pos.tokenA, pos.tokenB, pos.feeTier], + chain: "aptos", + }) + ); const [exists, addr] = Array.isArray(res) ? res : [false, null]; return exists ? normalizeAptosAddress(addr) : null; } @@ -344,11 +347,13 @@ async function getHyperionPoolCurrentTick(poolAddress) { return hyperionCurrentTickCache.get(pool); } - const res = await function_view({ - functionStr: `${HYPERION_DEX}::pool_v3::current_tick_and_price`, - args: [pool], - chain: "aptos", - }); + const res = await retryAsync(() => + function_view({ + functionStr: `${HYPERION_DEX}::pool_v3::current_tick_and_price`, + args: [pool], + chain: "aptos", + }) + ); const tickRaw = Array.isArray(res) ? res[0] : res; const tick = decodeI32Tick(tickRaw); hyperionCurrentTickCache.set(pool, tick); @@ -363,11 +368,13 @@ async function resolveHyperionPositionAmounts(pos) { if (hasLiveA || hasLiveB) return { amountA, amountB }; if (pos.position) { - const routerRes = await function_view({ - functionStr: `${HYPERION_DEX}::router_v3::get_amount_by_liquidity`, - args: [pos.position], - chain: "aptos", - }); + const routerRes = await retryAsync(() => + function_view({ + functionStr: `${HYPERION_DEX}::router_v3::get_amount_by_liquidity`, + args: [pos.position], + chain: "aptos", + }) + ); if (Array.isArray(routerRes)) { amountA = toIntegerString(routerRes[0]); amountB = toIntegerString(routerRes[1]); @@ -396,20 +403,24 @@ async function resolveHyperionPositionAmounts(pos) { * @returns {{ safeAddresses: string[] }} */ async function fetchExistingSafes() { - const totalRaw = await function_view({ - functionStr: `${VAULT}::vault::get_total_safes`, - chain: "aptos", - }); + const totalRaw = await retryAsync(() => + function_view({ + functionStr: `${VAULT}::vault::get_total_safes`, + chain: "aptos", + }) + ); const total = Math.max(0, Number(totalRaw) || 0); const safeOut = []; for (let start = 0; start < total; start += PAGE_SIZE) { const limit = Math.min(PAGE_SIZE, total - start); - const pageRaw = await function_view({ - functionStr: `${VAULT}::vault::get_safes_range_info`, - args: [String(start), String(limit)], - chain: "aptos", - }); + const pageRaw = await retryAsync(() => + function_view({ + functionStr: `${VAULT}::vault::get_safes_range_info`, + args: [String(start), String(limit)], + chain: "aptos", + }) + ); const rows = unwrapVector(pageRaw).map(normalizeSafeRow); for (const row of rows) { if (!truthyExists(row.exists)) continue; @@ -509,14 +520,17 @@ async function tvl(api) { const { adds: echelonAdds, totalsByAsset: echelonTotalsByAsset } = await sumEchelonSafePositions(api, safeAddresses); - const graphQLClient = new GraphQLClient(INDEXER_URL); + // the SDK sends the same key on fullnode views + const indexerHeaders = {}; + const apiKey = getEnv("APTOS_API_KEY"); + if (apiKey) indexerHeaders.Authorization = `Bearer ${apiKey}`; + const graphQLClient = new GraphQLClient(INDEXER_URL, { headers: indexerHeaders }); const faTotalsByAsset = new Map(); for (const batch of sliceIntoChunks(safeAddresses, OWNER_BATCH_SIZE)) { - const { current_fungible_asset_balances: rows } = await graphQLClient.request( - FA_BALANCES_QUERY, - { addresses: batch } + const { current_fungible_asset_balances: rows } = await retryAsync(() => + graphQLClient.request(FA_BALANCES_QUERY, { addresses: batch }) ); const list = rows || []; @@ -537,13 +551,16 @@ async function tvl(api) { await PromisePool.withConcurrency(COIN_BALANCE_CONCURRENCY) .for(safeAddresses) + .handleError((e) => { throw e; }) .process(async (addr) => { - const bal = await function_view({ - functionStr: COIN_BALANCE_FN, - type_arguments: [APT_TYPE_ARG], - args: [addr], - chain: "aptos", - }); + const bal = await retryAsync(() => + function_view({ + functionStr: COIN_BALANCE_FN, + type_arguments: [APT_TYPE_ARG], + args: [addr], + chain: "aptos", + }) + ); const balStr = toIntegerString(bal); if (!balStr || balStr === "0") return; api.add(APT, balStr); @@ -556,32 +573,37 @@ async function tvl(api) { .for(safeAddresses) .handleError((e) => { throw e; }) // throws on public rpcs instead of dropping hyperion tvl .process(async (safe) => { - const configExists = await function_view({ - functionStr: `${VAULT}::vault::hyperion_lp_config_exists`, - args: [safe], - chain: "aptos", - }) - .then((res) => { - const v = Array.isArray(res) ? res[0] : res; - return v === true || v === "true" || v === 1 || v === "1"; - }); + const configExists = await retryAsync(() => + function_view({ + functionStr: `${VAULT}::vault::hyperion_lp_config_exists`, + args: [safe], + chain: "aptos", + }) + ).then((res) => { + const v = Array.isArray(res) ? res[0] : res; + return v === true || v === "true" || v === 1 || v === "1"; + }); if (!configExists) return; - const positionsRaw = await function_view({ - functionStr: `${VAULT}::vault::get_hyperion_positions`, - args: [safe], - chain: "aptos", - }); + const positionsRaw = await retryAsync(() => + function_view({ + functionStr: `${VAULT}::vault::get_hyperion_positions`, + args: [safe], + chain: "aptos", + }) + ); const positionAddresses = unwrapPositionAddresses(positionsRaw); if (!positionAddresses.length) return; for (const positionAddr of positionAddresses) { - const posRaw = await function_view({ - functionStr: `${VAULT}::vault::get_hyperion_position`, - args: [safe, positionAddr], - chain: "aptos", - }).catch(()=>null); + const posRaw = await retryAsync(() => + function_view({ + functionStr: `${VAULT}::vault::get_hyperion_position`, + args: [safe, positionAddr], + chain: "aptos", + }) + ); const pos = normalizeHyperionPosition(posRaw, positionAddr); if (!pos || pos.closed) continue; From aa1281d483bea9ee38f649e431299141091f9138 Mon Sep 17 00:00:00 2001 From: Dani Date: Fri, 16 Oct 2026 09:40:23 +0200 Subject: [PATCH 284/988] Add Borro (Robinhood Chain Morpho curator) adapter (resolves #21655) (#21664) Co-authored-by: Borro Markets Co-authored-by: Claude Opus 5.5 --- projects/borro/index.js | 147 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 projects/borro/index.js diff --git a/projects/borro/index.js b/projects/borro/index.js new file mode 100644 index 00000000000..e16b361615e --- /dev/null +++ b/projects/borro/index.js @@ -0,0 +1,147 @@ +const { getLogs2 } = require("../helper/cache/getLogs") +const abi = require("../helper/abis/morpho.json") +const { nullAddress } = require("../helper/tokenMapping") + +// Borro (borro.markets) lends stock tokens on Robinhood Chain. It creates and curates its own +// isolated markets on the chain's shared Morpho Blue deployment, two per stock: +// - a stock-loan market: the stock token is the loan asset, Steakhouse USDG vault shares are the +// collateral, and shorters borrow the stock from it; +// - a USDG market: USDG is the loan asset and the Borro stock vault's shares (bNVDA etc.) are the +// collateral, so a lender can borrow USDG against the stock it has lent. +// Ten Morpho Vault V2s (one per stock plus a USDG vault) supply these markets through their adapters. +// +// The deployment is shared with other curators (Longbow and others), so the singleton's token +// balances cannot be attributed by a token union; the markets are enumerated instead and each is +// attributed from its own state, exactly as projects/longbow does on the same deployment. +// +// tvl per market = (totalSupplyAssets - totalBorrowAssets) + collateral +// the first term is the loan-asset cash Morpho still holds for the market; borrowed assets have +// left the contract and are reported under borrowed instead. Morpho exposes no aggregate collateral +// getter, so collateral is position() summed over the borrowers seen in SupplyCollateral. +// Collateral that is itself a Borro vault share (bNVDA posted on the USDG markets) is NOT added: +// the stock behind that share is already counted in the stock-loan market above, and adding the +// share again would double count it. +// tvl per vault = what the vault holds outside these markets: its asset sitting idle in the vault, +// plus whatever a non-market adapter holds (the USDG vault can park idle USDG in Steakhouse's USDG +// vault through a Morpho Vault V1 adapter). What the vaults supply into the markets is already +// inside totalSupplyAssets and is not added again. +// Marked double counted because Morpho Blue reports these markets too, and the Steakhouse shares +// posted as collateral are counted by Steakhouse. +const MORPHO = "0x9D53d5E3bd5E8d4Cbfa6DB1ca238AEA02E651010" +const FROM_BLOCK = 80804673 // Borro deployment block (2026-10-05) + +const USDG_VAULT = "0xF8e0ab443098c0738489B5BAFFbd32A1341F2289" // bUSDG + +// symbol: [stock vault (bSTOCK), stock-loan market id, USDG market id] +const desks = { + SPY: ["0xC3ED4a5A7dB4102F4Ed37Af26ef0d3f21e2360c1", "0x1cd22321a4d27054a8cd029c73c53432e8a231f8df1a3981b1ae1c274175d381", "0xb1453a889f92101054ab8095e0cc5e303f8c797f6ece3f688c7a1e1780a134a6"], + QQQ: ["0xbAD8A97dA1050092d6a14194D53E72D407D6cc17", "0xfbeb9596a8a0202dde46de7a49af15ee963c8678a71edb6dd1c8b283595cbdae", "0xea3cf9bf1f245dc905b007312ca7f9cc83ddd4f163398fa2ff22a829d8615454"], + NVDA: ["0x508E23274C39C60c345e35B1f0188bE180717CB9", "0x7ff4053d7caa99de7aa19febadcc2178377e8a31b163046539d6fb35c5abc08b", "0xf3524baf7647833311fe49cfea9153664b0284574e804f5078ec7e100fb86529"], + TSLA: ["0x60b3d353E7e5bD12ED4Ea2589C11B5603dd4c988", "0x5c0a634f28ac0f699be3b2db5265a935d63cfb680fd28bc5b225adaaabda8b88", "0x0036d2bac326d26797b9247d61db7b034290cad2bb210f1c6e6853ad0e4fbf0f"], + MSTR: ["0x2B74f8F2b76cd4e97265BC37FB2578a04B8437e9", "0x0fc6938b8b73689ee822ff59b775972931f33dfda49880b43b05a14396111a9d", "0xcc55ee44304cf35b1ad5b10512619a7101d0d4424750b8075338501d571dbccb"], + COIN: ["0x7BA71BCCeCb12860aE7E141B6b6F1f8B96d31257", "0x7eb15a4033030e5cbf34ea1823545b918d29e5e59e7d8c1d35aee2df3e114c98", "0xd6dd43ddb2ffeb1119e2df2a651b342b323ab34fa9bb39dfb5651717f909e997"], + PLTR: ["0xFE9419E70e5481F7a2dDddc18f856b09b3687B27", "0x85571555a4d98cb7efaf91ffd5a9d6b2db33d4a631c6b16633e537ac6cb4b590", "0x405485f81cee0d066bd29d3556b17f5c50b01f542314d52ca93612f1d0a315ca"], + SPCX: ["0x1261210E19052157fCe2064D9aa9A2140Bd89791", "0x4219a85fc09ae2ff5d3aa29013c67c89142f80a9c71d5c15ed7dbf9f6e14ae81", "0xb7da3d3030524ffc9438524054d4adf337904e228a842f8b35bf472ad16426e6"], + GME: ["0x328461fB01F54C2Ab73909EA947c583d0dC24C3d", "0xde233c6decb5b2ad4a2fd63ef8c95ee9b1934c0bd849e87fb5604e845ceb2c82", "0x75d38c9976e6d899662a19a39ac679cfbf711edb6e8ea4762ad2746c480f894c"], +} + +const vaults = [USDG_VAULT, ...Object.values(desks).map((d) => d[0])] +const vaultSet = new Set(vaults.map((v) => v.toLowerCase())) +const markets = Object.values(desks).flatMap((d) => [d[1], d[2]]) + +const vaultAbi = { + adaptersLength: "uint256:adaptersLength", + adapters: "function adapters(uint256) view returns (address)", + morphoVaultV1: "address:morphoVaultV1", + realAssets: "uint256:realAssets", +} + +const supplyCollateralAbi = "event SupplyCollateral(bytes32 indexed id, address indexed caller, address indexed onBehalf, uint256 assets)" +const positionAbi = "function position(bytes32 id, address user) view returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral)" + +// cache only the unique ":" pairs of Borro's markets, not every log on the shared singleton +const wanted = new Set(markets.map((i) => i.toLowerCase())) +function borrowerCache({ cache, logs }) { + const pairs = new Set(cache.logs ?? []) + logs.forEach(({ id, onBehalf }) => { + if (wanted.has(id.toLowerCase())) pairs.add(`${id.toLowerCase()}:${onBehalf.toLowerCase()}`) + }) + cache.logs = [...pairs] + return cache +} + +async function collateralByMarket(api) { + const toBlock = (await api.getBlock()) - 200 // the log cache is append-only, stay clear of reorgs at the tip + const pairs = await getLogs2({ api, target: MORPHO, eventAbi: supplyCollateralAbi, fromBlock: FROM_BLOCK, toBlock, extraKey: "borro-borrowers", customCacheFunction: borrowerCache }) + const calls = pairs.map((p) => ({ params: p.split(":") })) + const positions = await api.multiCall({ target: MORPHO, abi: positionAbi, calls }) + const net = {} + calls.forEach(({ params: [id] }, i) => { net[id] = (net[id] || 0n) + BigInt(positions[i].collateral) }) + return net +} + +async function marketState(api) { + const [params, data] = await Promise.all([ + api.multiCall({ target: MORPHO, abi: abi.morphoBlueFunctions.idToMarketParams, calls: markets }), + api.multiCall({ target: MORPHO, abi: abi.morphoBlueFunctions.market, calls: markets }), + ]) + return { params, data } +} + +// What the vaults hold outside Borro's markets: idle asset in the vault, and anything a Morpho +// Vault V1 adapter holds in another vault (the USDG vault's Steakhouse adapter). +async function vaultHoldings(api) { + const assets = await api.multiCall({ abi: "address:asset", calls: vaults }) + const idle = await api.multiCall({ abi: "erc20:balanceOf", calls: vaults.map((v, i) => ({ target: assets[i], params: v })) }) + vaults.forEach((_, i) => api.add(assets[i], idle[i])) + + const lengths = await api.multiCall({ abi: vaultAbi.adaptersLength, calls: vaults }) + const adapterCalls = [] + vaults.forEach((vault, i) => { + for (let j = 0; j < Number(lengths[i]); j++) adapterCalls.push({ target: vault, params: j, asset: assets[i] }) + }) + if (!adapterCalls.length) return + const adapters = await api.multiCall({ abi: vaultAbi.adapters, calls: adapterCalls }) + // Market adapters have no morphoVaultV1(); their positions are counted market by market above. + const parents = await api.multiCall({ abi: vaultAbi.morphoVaultV1, calls: adapters, permitFailure: true }) + const vaultV1Adapters = adapters.filter((_, i) => parents[i]) + if (!vaultV1Adapters.length) return + const held = await api.multiCall({ abi: vaultAbi.realAssets, calls: vaultV1Adapters }) + vaultV1Adapters.forEach((adapter, i) => api.add(adapterCalls[adapters.indexOf(adapter)].asset, held[i])) +} + +async function tvl(api) { + const [{ params, data }, collateral] = await Promise.all([marketState(api), collateralByMarket(api)]) + + markets.forEach((id, i) => { + const supplied = BigInt(data[i].totalSupplyAssets || 0) + const borrowedAssets = BigInt(data[i].totalBorrowAssets || 0) + // Morpho enforces totalBorrowAssets <= totalSupplyAssets; defensive floor only. + if (supplied > borrowedAssets) api.add(params[i].loanToken, supplied - borrowedAssets) + + const collateralToken = params[i].collateralToken + if (collateralToken === nullAddress || vaultSet.has(collateralToken.toLowerCase())) return // a Borro vault share: its stock is already counted + const held = collateral[id.toLowerCase()] || 0n + if (held > 0n) api.add(collateralToken, held) + }) + + await vaultHoldings(api) +} + +async function borrowed(api) { + const { params, data } = await marketState(api) + markets.forEach((_, i) => { + let amount = BigInt(data[i].totalBorrowAssets || 0) + const supplied = BigInt(data[i].totalSupplyAssets || 0) + if (amount > supplied) amount = supplied + if (amount > 0n) api.add(params[i].loanToken, amount) + }) +} + +module.exports = { + doublecounted: true, + start: "2026-10-05", + methodology: + "Counts the isolated Morpho Blue markets Borro creates and curates on Robinhood Chain: a stock-loan market and a USDG market per stock. For each market, TVL is the loan assets still held by Morpho for that market (supplied minus borrowed) plus the borrower collateral posted against it; outstanding debt is reported separately under borrowed. Collateral that is itself a Borro vault share (bNVDA and the rest, posted on the USDG markets) is not added, because the stock behind it is already counted in the stock-loan market. What Borro's Morpho Vault V2s hold outside these markets (idle, or parked in another Morpho vault through an adapter) is added as the vault's asset; what they supply into the markets is counted once, in the markets. Marked double counted because Morpho Blue reports the same markets.", + robinhood: { tvl, borrowed }, +} From 7720cad1d37278a7acae2212bc977414b29a1df0 Mon Sep 17 00:00:00 2001 From: rossgalloway <58150151+rossgalloway@users.noreply.github.com> Date: Fri, 16 Oct 2026 09:14:12 +0100 Subject: [PATCH 285/988] Include off-queue V3 strategies in Yearn TVL overlap calculations (#21659) Co-authored-by: ccipherx --- projects/yearn/index.js | 48 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/projects/yearn/index.js b/projects/yearn/index.js index 8db7eef5d9e..4b1a11d805b 100644 --- a/projects/yearn/index.js +++ b/projects/yearn/index.js @@ -84,16 +84,58 @@ async function remoteOverlap(api, vaults, strategyAbi) { return new Map([[countedSender ? strategy : parent, owned < owed ? owned : owed]]) } +async function getV3Strategies(api, vaults, activeVaults) { + if (!vaults.length) return [] + const queueAbi = 'function get_default_queue() view returns (address[])' + const queues = await api.multiCall({ + abi: queueAbi, calls: vaults.map(({ vault }) => vault.address), permitFailure: true, + }) + // An empty array is a confirmed empty queue; null is an unavailable read. + // Tokenized strategies also report 3.x, but expose management() instead of a queue. + const unavailable = vaults.map((_, i) => i).filter(i => queues[i] == null) + const managers = await api.multiCall({ + abi: 'address:management', calls: unavailable.map(i => vaults[i].vault.address), permitFailure: true, + }) + const retry = unavailable.filter((_, i) => managers[i] == null) + // Retry unclassified contracts strictly. Never silently skip an allocator + // whose queue could not be read, even if the other vaults were successful. + if (retry.length) { + const recovered = await api.multiCall({ abi: queueAbi, calls: retry.map(i => vaults[i].vault.address) }) + retry.forEach((index, i) => { + if (!Array.isArray(recovered[i])) throw new Error(`Cannot read Yearn V3 queue: ${vaults[index].vault.address}`) + queues[index] = recovered[i] + }) + } + // strategies() is a public mapping and add_strategy enforces the vault asset, so probing + // counted same-asset vaults and registered routers finds active strategies off the default queue. + const probes = [] + vaults.forEach(({ vault }, i) => { + const parent = vault.address.toLowerCase(), asset = vault.asset?.address?.toLowerCase() + if (!queues[i] || !asset) return + const queued = new Set(queues[i].map(a => a.toLowerCase())) + const candidates = new Set([ + ...activeVaults.filter(({ vault: v }) => v.asset?.address?.toLowerCase() === asset).map(({ vault: v }) => v.address.toLowerCase()), + ...registeredNestedVaults.filter(r => r.chainId === api.chainId && r.parent === parent).map(r => r.strategy), + ]) + candidates.forEach(strategy => { if (strategy !== parent && !queued.has(strategy)) probes.push({ i, target: vault.address, strategy }) }) + }) + const params = await api.multiCall({ abi: V3_STRATEGY_ABI, calls: probes.map(({ target, strategy }) => ({ target, params: [strategy] })) }) + const strategies = vaults.map((_, i) => (queues[i] ?? []).map(a => a.toLowerCase())) + probes.forEach(({ i, strategy }, j) => { if (BigInt(params[j].activation) > 0n) strategies[i].push(strategy) }) + return strategies +} + async function getDebts(api, activeVaults) { // get version from apiVersion instead of Kong's `v3` flag (some 3.x vaults are flagged v2). // V3 exposes get_default_queue(); V2 a slot-indexed withdrawalQueue. const withStrat = activeVaults.filter(({ vault }) => vault.strategiesCount > 0) const isV3 = ({ vault }) => (vault.apiVersion || '').startsWith('3') - const v3 = withStrat.filter(isV3) + const v3 = activeVaults.filter(isV3) const v2 = withStrat.filter(v => !isV3(v)) - // V3 exposes the whole queue in one call; V2 is slot-indexed, capped at MAX_V2_STRATEGIES - const v3Queues = await api.multiCall({ abi: 'function get_default_queue() view returns (address[])', calls: v3.map(({ vault }) => vault.address) }) + // V3 includes every active strategy that is a counted vault, even outside the default queue. + // V2 keeps its existing slot-indexed withdrawal queue and count limit. + const v3Queues = await getV3Strategies(api, v3, activeVaults) const v2QueueCalls = [] v2.forEach(({ vault }) => { for (let i = 0; i < Math.min(vault.strategiesCount, MAX_V2_STRATEGIES); i++) v2QueueCalls.push({ target: vault.address, params: [i] }) }) const v2QueueRes = await api.multiCall({ abi: 'function withdrawalQueue(uint256) view returns (address)', calls: v2QueueCalls }) From 54b1ac76e7ef00f5b0b7c15f7f20d254dd683a58 Mon Sep 17 00:00:00 2001 From: Dani Date: Fri, 16 Oct 2026 10:17:59 +0200 Subject: [PATCH 286/988] zyfai: count unpriced Base vault shares as underlying (#21665) Co-authored-by: Paul Co-authored-by: Cursor --- projects/zyfai/base.js | 15 ++++++++++----- projects/zyfai/index.js | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/projects/zyfai/base.js b/projects/zyfai/base.js index 14cf97c6c15..e2c19e955f1 100644 --- a/projects/zyfai/base.js +++ b/projects/zyfai/base.js @@ -85,8 +85,6 @@ const SUPERFORM_POOLS = { 'Flagship Base WETH SuperVault': '0x0e70c10fa06931f7b878653a15aecc86145c1af7', 'Flagship Base CBBTC SuperVault': '0xfc8a6526ffcd8248b8d0f8dac8037dbe438924ce', 'NVDAC': '0xc441a2cc3a528b6312740448a70cc4d40f4d7bfc', - 'GOOGLC': '0x363600ac7173e8d91bcfee68d711bb93e992c110', - 'AAPLC': '0x301a1ceb684d62833101b373ab6c395349b24033', }; const BASE_YEARN_POOLS = { @@ -101,9 +99,15 @@ const IPOR_POOLS = { 'Apple Carry Trade': '0x31744e44d6af88225c1dbefbe5df8308faea641b', 'Meta Carry Trade': '0xcd19f18884bf388b866d05cdd1ae351133821f01', 'Google Carry Trade': '0x01dbdb9748ecf71b1ffbb62f5cb41318531ba362', - USDC: '0xd46a3c2d958d0a2cb098d48c48dc19fe3a710f37', }; +// Share tokens with no Llama price. Held out of allPoolTokens and counted as underlying. +const UNPRICED_VAULTS = [ + '0xd46a3c2d958d0a2cb098d48c48dc19fe3a710f37', // IPOR Fusion USDC + '0x363600ac7173e8d91bcfee68d711bb93e992c110', // Superform GOOGLc + '0x301a1ceb684d62833101b373ab6c395349b24033', // Superform AAPLc +]; + const AUTOFINANCE_POOLS = { USDC: '0x9c6864105AEC23388C89600046213a44C384c831', // baseUSD }; @@ -137,5 +141,6 @@ const allPoolTokens = [ ] module.exports = { - allPoolTokens -}; \ No newline at end of file + allPoolTokens, + unpricedVaults: UNPRICED_VAULTS, +}; diff --git a/projects/zyfai/index.js b/projects/zyfai/index.js index 2db63c02327..0060a7eb1c8 100644 --- a/projects/zyfai/index.js +++ b/projects/zyfai/index.js @@ -1,4 +1,4 @@ -const { allPoolTokens: baseTokens } = require('./base'); +const { allPoolTokens: baseTokens, unpricedVaults: baseUnpricedVaults } = require('./base'); const { getConfig } = require('../helper/cache'); const { allPoolTokens: ethereumPoolTokens } = require('./ethereum'); @@ -195,6 +195,33 @@ const TOKENS = { sonic: sonicTokens, }; +// Llama drops these share tokens (no coins.llama.fi price). convertToAssets into the underlying, which is priced. +async function unpricedVaultsTvl(api, owners, vaults) { + const assets = await api.multiCall({ abi: 'address:asset', calls: vaults }); + const vaultAsset = {}; + vaults.forEach((vault, i) => { if (assets[i]) vaultAsset[vault.toLowerCase()] = assets[i]; }); + const okVaults = Object.keys(vaultAsset); + if (!okVaults.length) return; + + const calls = owners.flatMap(owner => okVaults.map(vault => ({ target: vault, params: [owner] }))); + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls }); + + const convertCalls = []; + const convertAssets = []; + balances.forEach((balance, i) => { + if (!balance || balance === '0') return; + convertCalls.push({ target: calls[i].target, params: [balance] }); + convertAssets.push(vaultAsset[calls[i].target.toLowerCase()]); + }); + if (!convertCalls.length) return; + + const amounts = await api.multiCall({ + abi: 'function convertToAssets(uint256) view returns (uint256)', + calls: convertCalls, + }); + amounts.forEach((amount, i) => { if (amount) api.add(convertAssets[i], amount); }); +} + async function tvl(api) { const owners = await getConfig('zyfai/'+api.chain, `https://api.zyf.ai/api/v1/data/active-wallets?chainId=${api.chainId}`); const cleanOwners = owners.filter(o => o !== ''); @@ -206,6 +233,10 @@ async function tvl(api) { ]); } + if (api.chain === 'base') { + await unpricedVaultsTvl(api, cleanOwners, baseUnpricedVaults); + } + return api.sumTokens({ownerTokens: cleanOwners.map(o => [TOKENS[api.chain], o])}); } From dd0192993ba83f8721f1089a907409f4c5684561 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 16 Oct 2026 14:22:51 +0100 Subject: [PATCH 287/988] morpho remove hardcoded list (#21668) --- projects/morpho-blue/config.js | 36 --------------------------- projects/morpho-blue/exclusions.js | 40 +++++++++++++++++++++++------- projects/morpho-blue/index.js | 2 +- 3 files changed, 32 insertions(+), 46 deletions(-) diff --git a/projects/morpho-blue/config.js b/projects/morpho-blue/config.js index 24fbb59f4a0..afe5338b032 100644 --- a/projects/morpho-blue/config.js +++ b/projects/morpho-blue/config.js @@ -3,43 +3,14 @@ const config = { ethereum: { morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb", fromBlock: 18883124, - blacklistedMarketIds: [ - "0x1dca6989b0d2b0a546530b3a739e91402eee2e1536a2d3ded4f5ce589a9cd1c2", - - // bad debt due to resolv hack - "0xd9e34b1eed46d123ac1b69b224de1881dbc88798bc7b70f504920f62f58f28cc", - "0xe1b65304edd8ceaea9b629df4c3c926a37d1216e27900505c04f14b2ed279f33", - "0x8e7cc042d739a365c43d0a52d5f24160fa7ae9b7e7c9a479bd02a56041d4cf77", - "0xcc39b6c92fd03ac608b9239618db8b80a4a2034b0450bdf47b404229571312da", - "0x1cfdc0154ae6b9f1887a8250f2582d55606e1a2008e65108fb83dd50a928593e", - - "0x0f9563442d64ab3bd3bcb27058db0b0d4046a4c46f0acd811dacae9551d2b129", // sdeUSD/USDC (91.5% LLTV) bad debt from sdeUSD exploit (Nov 2025) - "0x8eaf7b29f02ba8d8c1d7aeb587403dcb16e2e943e4e2f5f94b0963c2386406c9", // PAXG market - "0x11db9f2c7bda8c2af6a6a72db18aa5eb9290cb99cf75a3c0abacf1b84b8eaf77", // amphrETH market - "0x4b86442549b52826e0fc11770ec5154450cb3c5c14dc751a761d81dcfbe7a7b2", // RLP market - "0xbd1ad3b968f5f0552dbd8cf1989a62881407c5cccf9e49fb3657c8731caf0c1f", // deUSD market - "0xfd0d72a4f0469598b566b1bc5fe64835f828f90b1fb7d746148c086164cd4cc2", // AZND/USDC market, 0 liquidity and 1 borrower - "0x23a7d0ff682b323363fb8ba58327ed87001f6306e09b7fd7413bbe4698e749c8", // msY/USDC market - ], }, base: { morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb", fromBlock: 13977148, - blacklistedMarketIds: [ - '0xff0f2bd52ca786a4f8149f96622885e880222d8bed12bbbf5950296be8d03f89', // bad debt due to resolv hack - '0xe1986e80099257c65dd18091ec7e34752ae2336870a5649f20c450c9c4931fb8', // HERMES market - '0xa4ec527128b425ee3fcb7f60eca37677b63b3d003345ec2a72ef6a2e72da53fc', // RSS/USDC (77% LLTV) market, single supplier looping against self-issued RSS collateral - '0x41c08085ddcfd1dc1c5eb82d7dc031593d1a1a831958380e8b60469c45bf7d88', // RSS/USDC (77% LLTV) market, single supplier looping against self-issued RSS collateral - ] }, arbitrum: { morphoBlue: "0x6c247b1F6182318877311737BaC0844bAa518F5e", fromBlock: 296446593, - blacklistedMarketIds: [ - "0xfdb8221edcae73f73485d55c30e706906114bc2ff4634870c5c57e8fb83eae6a", // K/USDC bad debt from Kinto exploit - "0x9e90aec7d768403dacc9dd0d8320307fda3f980eed4df43e3e52168a1c667709", // xUSD market - "0xc7670063349ac19dfa324ead7bd7da2985ae931e1b09fb0e31b62c6486b730bd", // RLP market - ], }, fraxtal: { morphoBlue: "0xa6030627d724bA78a59aCf43Be7550b4C5a0653b", @@ -64,9 +35,6 @@ const config = { wc: { morphoBlue: "0xE741BC7c34758b4caE05062794E8Ae24978AF432", fromBlock: 9025669, - blacklistedMarketIds: [ - "0x5a96ea60ddb8ece11b0dd1176f05bbc44ec92197ba206adb086db559146cc964", // sdeUSD market - ], }, mode: { morphoBlue: "0xd85cE6BD68487E0AaFb0858FDE1Cd18c76840564", @@ -99,15 +67,11 @@ const config = { // }, hyperliquid: { morphoBlue: "0x68e37dE8d93d3496ae143F2E900490f6280C57cD", - blackList: ['0x0aD339d66BF4AeD5ce31c64Bc37B3244b6394A77'], // USR on hyperevm; the entry here was the ethereum address fromBlock: 1988429, }, plume_mainnet: { morphoBlue: "0x42b18785CE0Aed7BF7Ca43a39471ED4C0A3e0bB5", fromBlock: 765994, - blacklistedMarketIds: [ - "0x82e7ab8ccabaac59b5f397507ed031ebf19a9a5b2657c00c93bc2423cd0a890d", - ], }, lisk: { morphoBlue: "0x00cD58DEEbd7A2F1C55dAec715faF8aed5b27BF8", diff --git a/projects/morpho-blue/exclusions.js b/projects/morpho-blue/exclusions.js index 385c9e97a00..d7f7360cb94 100644 --- a/projects/morpho-blue/exclusions.js +++ b/projects/morpho-blue/exclusions.js @@ -1,9 +1,9 @@ const sdk = require('@defillama/sdk') -const { getConfig } = require('../helper/cache') +const { getConfig, getCache } = require('../helper/cache') const { get } = require('../helper/http') -// Morpho's own exclusion feed. Additive: unioned with the hardcoded lists in config.js, never a -// replacement - the feed is currently a strict subset of what we exclude by hand. +// Morpho's own exclusion feed, now the only source: every id we used to hardcode is covered by it, +// the six markets missing from markets.csv included - those are excluded by an assets.csv row on a leg. const BASE_URL = 'https://api.morpho.org/reporting/v1/exclusions' // required columns per file: a response that does not carry them is not a CSV we understand, // which is how an html error page served as 200 is told apart from a genuine header-only file @@ -44,6 +44,15 @@ function parseCsv(text, requiredColumns) { // a header-only file is a valid empty list; a missing key means we never got a usable version of it const isValidBundle = (bundle) => !!bundle && Object.keys(KINDS).every(k => Array.isArray(bundle[k])) +const countByGroup = (bundle) => { + const counts = {} + Object.keys(KINDS).forEach(k => bundle[k].forEach(row => { + const group = `${k}/${row.chain}` + counts[group] = (counts[group] || 0) + 1 + })) + return counts +} + async function getExclusions() { const kinds = Object.keys(KINDS) const bundle = await getConfig('morpho-blue/exclusions', undefined, { @@ -56,13 +65,27 @@ async function getExclusions() { }) // a partial or malformed fetch must not overwrite the cache - getConfig keeps the last good copy if (!isValidBundle(fetched)) throw new Error('morpho exclusions: incomplete or malformed feed') + // an exclusion retires by gaining an effective_to, never by vanishing, so a group that loses rows + // is a bad publish. Per chain and kind, because a total hides a whole chain dropping out: all five + // base asset rows can go while the total only falls 57 -> 52, re-admitting four base markets + const prior = await getCache('config-cache', 'morpho-blue/exclusions').catch(() => null) + if (isValidBundle(prior)) { + const before = countByGroup(prior) + const after = countByGroup(fetched) + const shrunk = Object.keys(before).filter(g => (after[g] || 0) < before[g]) + if (shrunk.length) { + const detail = shrunk.map(g => `${g} ${before[g]}->${after[g] || 0}`).join(', ') + // getConfig swallows the error, so log it here or nobody sees which group dropped + sdk.log('morpho exclusions: feed shrank, keeping cache:', detail) + throw new Error(`morpho exclusions: feed shrank (${detail}), keeping cache`) + } + } return fetched }, }) - if (!isValidBundle(bundle)) { - sdk.log('morpho-blue: no valid exclusion feed and no cache, running without feed exclusions') - return null - } + // fail closed: without a bundle every lookup would return an empty list and markets we exclude would + // silently re-enter accounting, so error out and leave the last good numbers standing instead + if (!isValidBundle(bundle)) throw new Error('morpho exclusions: no valid feed and no cache') return bundle } @@ -75,8 +98,7 @@ const getDateString = (api) => new Date((api.timestamp || Math.floor(Date.now() / 1e3)) * 1e3).toISOString().slice(0, 10) async function getRows(api, kind) { - const exclusions = await getExclusions() - const rows = (exclusions && exclusions[kind]) || [] + const rows = (await getExclusions())[kind] const dateString = getDateString(api) return rows.filter(row => row.chain === api.chain && isActive(row, dateString)) } diff --git a/projects/morpho-blue/index.js b/projects/morpho-blue/index.js index 61f62a47656..8fec1f4efe1 100644 --- a/projects/morpho-blue/index.js +++ b/projects/morpho-blue/index.js @@ -46,7 +46,7 @@ const getMarket = async (api) => { ].filter(i => !existingIds.has(i)).map(id => ({ id }))) } - // union with morpho's own feed, never a replacement - the feed is a subset of the list above + // blacklistedMarketIds is empty in config now; morpho's feed is the source, kept as a manual override const excluded = new Set([...blacklistedMarketIds.map(i => i.toLowerCase()), ...await getExcludedMarketIds(api)]) const all = logs.map((i) => i.id.toLowerCase()) From 660ef93471d31d06dc17839e6cb83908fd3b3739 Mon Sep 17 00:00:00 2001 From: arseny Date: Fri, 16 Oct 2026 16:57:43 +0200 Subject: [PATCH 288/988] Add Everstrat TVL adapter (#21600) Co-authored-by: FelixBruguera --- projects/everstrat/index.js | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 projects/everstrat/index.js diff --git a/projects/everstrat/index.js b/projects/everstrat/index.js new file mode 100644 index 00000000000..216e077395c --- /dev/null +++ b/projects/everstrat/index.js @@ -0,0 +1,68 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, addUniV3LikePosition } = require('../helper/unwrapLPs') +const { ethers } = require('ethers') + +const STRATEGY_MANAGER = '0x94916ab93C669E7c734f844dB019Ce9449a3b5C9' +const CONTROLLER = '0x9097868dcbda5a630729015DE1ddeCd66d74052c' +const AMM = '0x42c618D9457BE7cb3b836F7FD3332E2800C48a8b' + +const abi = { + strategies: 'address[]:strategies', + supportedERC20: 'address[]:supportedERC20', + pool: 'address:pool', + token0: 'address:token0', + token1: 'address:token1', + positionMain: 'function positionMain() view returns (int24 tickLower, int24 tickUpper)', + positionAlt: 'function positionAlt() view returns (int24 tickLower, int24 tickUpper)', + slot0: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)', + positions: 'function positions(bytes32 key) view returns (uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', +} + +// Each strategy's Uniswap V3 ranges (minted directly on the pool, no NFT) plus idle balances, idle ETH on the +// StrategyManager, Controller and AMM, and supported ERC-20s held by the StrategyManager. +async function tvl(api) { + const strategies = await api.call({ target: STRATEGY_MANAGER, abi: abi.strategies }) + const supported = await api.call({ target: STRATEGY_MANAGER, abi: abi.supportedERC20 }) + + const pools = await api.multiCall({ abi: abi.pool, calls: strategies }) + const token0s = await api.multiCall({ abi: abi.token0, calls: strategies }) + const token1s = await api.multiCall({ abi: abi.token1, calls: strategies }) + const mains = await api.multiCall({ abi: abi.positionMain, calls: strategies }) + const alts = await api.multiCall({ abi: abi.positionAlt, calls: strategies }) + const slot0s = await api.multiCall({ abi: abi.slot0, calls: pools }) + + const ranges = [] + strategies.forEach((strategy, i) => { + for (const { tickLower, tickUpper } of [mains[i], alts[i]]) { + if (+tickLower === 0 && +tickUpper === 0) continue // unused alt range + const key = ethers.solidityPackedKeccak256(['address', 'int24', 'int24'], [strategy, tickLower, tickUpper]) + ranges.push({ i, tickLower: +tickLower, tickUpper: +tickUpper, key }) + } + }) + const positions = await api.multiCall({ + abi: abi.positions, + calls: ranges.map(({ i, key }) => ({ target: pools[i], params: [key] })), + }) + ranges.forEach(({ i, tickLower, tickUpper }, j) => { + const { liquidity, tokensOwed0, tokensOwed1 } = positions[j] + addUniV3LikePosition({ api, token0: token0s[i], token1: token1s[i], liquidity: +liquidity, tickLower, tickUpper, tick: +slot0s[i].tick }) + api.add(token0s[i], tokensOwed0) + api.add(token1s[i], tokensOwed1) + }) + + const tokensAndOwners = [ + ...strategies.flatMap((s, i) => [[token0s[i], s], [token1s[i], s], [ADDRESSES.null, s]]), + ...supported.map((t) => [t, STRATEGY_MANAGER]), + [ADDRESSES.null, STRATEGY_MANAGER], + [ADDRESSES.null, CONTROLLER], + [ADDRESSES.null, AMM], + ] + return sumTokens2({ api, tokensAndOwners }) +} + +module.exports = { + doublecounted: true, // positions sit in Uniswap V3 pools, already counted in Uniswap's TVL + methodology: + "Counted by underlying token: the WETH and paired-token amounts in each strategy's Uniswap V3 ranges (including uncollected fees) and idle strategy balances, idle ETH held by the StrategyManager, Controller and AMM, and supported ERC-20s held by the StrategyManager. EVE, the protocol token, is not counted.", + ethereum: { tvl }, +} From f0f7bd4ea51df058b9f8b479a0ec6d7917e71f6d Mon Sep 17 00:00:00 2001 From: routebuilder Date: Fri, 16 Oct 2026 17:08:34 +0200 Subject: [PATCH 289/988] Fail loud on silent fallbacks (prices, discovery, imports, timeouts) (#21577) --- projects/euler-v2/index.js | 2 +- projects/helper/bitcoin-book/index.js | 6 +----- projects/justlock-io/index.js | 6 +++--- projects/morpho-blue/index.js | 2 +- projects/mosh/index.js | 9 +++++++-- projects/rlyfun/index.js | 8 ++++---- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/projects/euler-v2/index.js b/projects/euler-v2/index.js index 429ee4c8092..7c9ddd5e901 100644 --- a/projects/euler-v2/index.js +++ b/projects/euler-v2/index.js @@ -31,7 +31,7 @@ async function fetchPriceMap(api, addresses) { const tokens = [...new Set(addresses.filter(Boolean).map(a => a.toLowerCase()))] if (!tokens.length) return {} const keys = tokens.map(t => `${api.chain}:${t}`) - const prices = await sdk.coins.getPrices(keys, 'now').catch(() => ({})) + const prices = await sdk.coins.getPrices(keys, 'now') const out = {} Object.entries(prices).forEach(([k, v]) => { if (!v || !v.price) return diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index 88d22476d1f..d02cb8c89bb 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -1171,9 +1171,5 @@ module.exports = { }; imports.forEach(([key, file]) => { - try { - module.exports[key] = require(file); - } catch (e) { - console.error(`Error importing ${key} from ${file}:`, e); - } + module.exports[key] = require(file); }); diff --git a/projects/justlock-io/index.js b/projects/justlock-io/index.js index 9c92c551768..88c048a09c1 100644 --- a/projects/justlock-io/index.js +++ b/projects/justlock-io/index.js @@ -7,12 +7,12 @@ const LOCKER = 'component_rdx1cpae8nqhyeu2pz6z89vwca8085xels52lhsfrutnvagxz53u3p const CORE = new Set(Object.values(ADDRESSES.radixdlt)) async function getFungibles(address) { - const first = await post(`${GATEWAY}/state/entity/details`, { addresses: [address], aggregation_level: 'Global' }) + const first = await post(`${GATEWAY}/state/entity/details`, { addresses: [address], aggregation_level: 'Global' }, { timeout: 30000 }) const at_ledger_state = { state_version: first.ledger_state.state_version } const items = [...first.items[0].fungible_resources.items] let cursor = first.items[0].fungible_resources.next_cursor while (cursor) { - const page = await post(`${GATEWAY}/state/entity/page/fungibles/`, { address, cursor, aggregation_level: 'Global', at_ledger_state }) + const page = await post(`${GATEWAY}/state/entity/page/fungibles/`, { address, cursor, aggregation_level: 'Global', at_ledger_state }, { timeout: 30000 }) items.push(...page.items) cursor = page.next_cursor } @@ -22,7 +22,7 @@ async function getFungibles(address) { async function getDetails(addresses, opt_ins) { const items = [] for (let i = 0; i < addresses.length; i += 20) - items.push(...(await post(`${GATEWAY}/state/entity/details`, { addresses: addresses.slice(i, i + 20), opt_ins })).items) + items.push(...(await post(`${GATEWAY}/state/entity/details`, { addresses: addresses.slice(i, i + 20), opt_ins }, { timeout: 30000 })).items) return Object.fromEntries(items.map(i => [i.address, i])) } diff --git a/projects/morpho-blue/index.js b/projects/morpho-blue/index.js index 8fec1f4efe1..2461acf3f97 100644 --- a/projects/morpho-blue/index.js +++ b/projects/morpho-blue/index.js @@ -209,7 +209,7 @@ async function fetchPriceMap(api, addresses) { const tokens = [...new Set(addresses.filter(a => a && a.toLowerCase() !== nullAddress).map(a => a.toLowerCase()))] if (!tokens.length) return {} const keys = tokens.map(t => `${api.chain}:${t}`) - const prices = await sdk.coins.getPrices(keys, 'now').catch(() => ({})) + const prices = await sdk.coins.getPrices(keys, 'now') const out = {} Object.entries(prices).forEach(([k, v]) => { if (!v || !v.price) return diff --git a/projects/mosh/index.js b/projects/mosh/index.js index 3199f5a11fd..40c4bc72cef 100644 --- a/projects/mosh/index.js +++ b/projects/mosh/index.js @@ -50,8 +50,13 @@ async function swarmBalances(api, ownToken) { // a swarm's counter asset is fixed at creation; the legacy bundle predates counterIsNative() and is native ETH const native = await api.multiCall({ abi: 'bool:counterIsNative', calls: allSwarms, permitFailure: true }) const counters = await api.multiCall({ abi: 'address:counterAsset', calls: allSwarms, permitFailure: true }) - const allCounters = allSwarms.map((s, i) => (native[i] ?? LEGACY_SWARMS.includes(s)) ? nullAddress : counters[i]) - // a swarm whose counter asset did not read is skipped rather than allowed to fail the whole run + const allCounters = allSwarms.map((s, i) => { + const legacyNative = LEGACY_SWARMS.includes(s) // this pre-factory swarm predates counterIsNative() + if (native[i] == null && !legacyNative) throw new Error(`mosh: counterIsNative read failed for swarm ${s}`) + if (native[i] ?? legacyNative) return nullAddress + if (counters[i] == null) throw new Error(`mosh: counterAsset read failed for swarm ${s}`) + return counters[i] + }) const swarms = allSwarms.filter((_, i) => Boolean(allCounters[i])) const counterOf = allCounters.filter(Boolean) if (!swarms.length) return api.getBalances() diff --git a/projects/rlyfun/index.js b/projects/rlyfun/index.js index fb4554c3594..68ab378358f 100644 --- a/projects/rlyfun/index.js +++ b/projects/rlyfun/index.js @@ -10,26 +10,26 @@ async function getCurveComponents(at_ledger_state) { const keys = [] let cursor do { - const page = await post(`${GATEWAY}/state/key-value-store/keys`, { key_value_store_address: LAUNCHES_KVS, cursor, at_ledger_state, limit_per_page: 100 }) + const page = await post(`${GATEWAY}/state/key-value-store/keys`, { key_value_store_address: LAUNCHES_KVS, cursor, at_ledger_state, limit_per_page: 100 }, { timeout: 30000 }) keys.push(...page.items.map(i => ({ key_hex: i.key.raw_hex }))) cursor = page.next_cursor } while (cursor) const components = [] for (let i = 0; i < keys.length; i += 100) { - const { entries } = await post(`${GATEWAY}/state/key-value-store/data`, { key_value_store_address: LAUNCHES_KVS, keys: keys.slice(i, i + 100), at_ledger_state }) + const { entries } = await post(`${GATEWAY}/state/key-value-store/data`, { key_value_store_address: LAUNCHES_KVS, keys: keys.slice(i, i + 100), at_ledger_state }, { timeout: 30000 }) entries.forEach(e => components.push(e.value.programmatic_json.fields[1].value)) } return components } async function tvl(api) { - const { ledger_state } = await post(`${GATEWAY}/status/gateway-status`, {}) + const { ledger_state } = await post(`${GATEWAY}/status/gateway-status`, {}, { timeout: 30000 }) const at_ledger_state = { state_version: ledger_state.state_version } const components = await getCurveComponents(at_ledger_state) for (let i = 0; i < components.length; i += 20) { - const { items } = await post(`${GATEWAY}/state/entity/details`, { addresses: components.slice(i, i + 20), aggregation_level: 'Global', at_ledger_state }) + const { items } = await post(`${GATEWAY}/state/entity/details`, { addresses: components.slice(i, i + 20), aggregation_level: 'Global', at_ledger_state }, { timeout: 30000 }) for (const item of items) { const xrd = item.fungible_resources.items.find(f => f.resource_address === XRD) if (xrd) api.add(XRD, +xrd.amount) From 5012a6f02966d2a22f1c12ee8442e96de5d21832 Mon Sep 17 00:00:00 2001 From: vsiskin-accountable Date: Fri, 16 Oct 2026 17:14:56 +0200 Subject: [PATCH 290/988] accountable: add collateral fixed term vaults (#21601) --- projects/accountable/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/accountable/index.js b/projects/accountable/index.js index f0fe9efae87..9eee0c394b8 100644 --- a/projects/accountable/index.js +++ b/projects/accountable/index.js @@ -13,6 +13,7 @@ const FACTORIES = { '0x2A7F22f81A3d301b8f0EAf4f09a78558c91Fc69a', '0xB4082B8126AF8B5345CfB159AC5d4b4F05F54bC5', '0xC0f778b51bF9751BBccBF4e78A107026aDaDbe43', // yield factory + '0xcC2Af6B6B3a888D96166205B9bA27d7dba3a67DE', // collateral fixed term factory ], arbitrum: [ '0x2A7F22f81A3d301b8f0EAf4f09a78558c91Fc69a', @@ -33,11 +34,13 @@ const FACTORIES = { '0x2A7F22f81A3d301b8f0EAf4f09a78558c91Fc69a', '0xB4082B8126AF8B5345CfB159AC5d4b4F05F54bC5', '0xC0f778b51bF9751BBccBF4e78A107026aDaDbe43', // yield factory + '0xcC2Af6B6B3a888D96166205B9bA27d7dba3a67DE', // collateral fixed term factory ], bsc: [ '0xd51FaCdE443729A8302A8138f3e050e831Db413D', '0x6E659cD796aAB41419C70def7748Fff37Bf3967a', '0xdBdbb4F6B80CA00B2a8B1f929C1957eCecd1BAaB', // yield factory + '0xF9a0197f9dB6bd8171EBa53D21cb098597D23871', // collateral fixed term factory ], pharos: [ '0x2A7F22f81A3d301b8f0EAf4f09a78558c91Fc69a', From 4a0afd50c3563ace7a663e2f80c9a09ab7b2b4a7 Mon Sep 17 00:00:00 2001 From: vsiskin-accountable Date: Fri, 16 Oct 2026 17:15:32 +0200 Subject: [PATCH 291/988] accountable: count Tori Ecosystem Monad vault, now publicly listed (#21603) --- projects/accountable/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/accountable/index.js b/projects/accountable/index.js index 9eee0c394b8..7ae08dda371 100644 --- a/projects/accountable/index.js +++ b/projects/accountable/index.js @@ -74,7 +74,6 @@ const EXCLUDED_STRATEGIES = { '0x78f9486c71371bb5af50cbcdf4bacdc298ec8a97', '0x0d58d3a21adc8f60c81c00c13e7363cc56c6e061', '0xa783b87047dcdaf5d84f4843fae85a6c9e3343af', - '0x945dc31b38c811a0188b5b30cf1ea7721666cf7c', '0x33ca98cfca7f25735d8719e67f616fcc44d7771e', ], } From b29261f057dbdea2878a5a8a8a8bc38d46cfdd90 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 16 Oct 2026 19:04:14 +0200 Subject: [PATCH 292/988] blofin: track thor --- cex/blofin-cex.js | 3 +++ projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cex/blofin-cex.js b/cex/blofin-cex.js index b2a01e61d74..45848e6ce5e 100644 --- a/cex/blofin-cex.js +++ b/cex/blofin-cex.js @@ -196,6 +196,9 @@ module.exports = { dash: { owners: ["Xy3gi2zmGKB8QHPcqn85vK6yNs1S49NPkU"], }, + thorchain: { + owners: ["thor1acj55m7ycy59nvh9lyglq36kem7e9kvwut0fpz"], + }, plasma: { owners: [EVM_MAIN] }, robinhood: { owners: [EVM_MAIN] }, monad: { owners: [EVM_MAIN] }, diff --git a/projects/helper/env.js b/projects/helper/env.js index 5f1c779eba8..38a0b00b3c9 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -87,6 +87,7 @@ const DEFAULTS = { BCYPHER_RPC: 'https://mainapi.bchscan.io', // BC Hyper Chain, chainId 3030 // p2p/everstake neon proxies are gone (dns), thirdweb refuses the chain; blockscout's eth-rpc proxy still serves it NEON_EVM_RPC: 'https://neon.blockscout.com/api/eth-rpc', + THORCHAIN_LCD: 'https://gateway.liquify.com/chain/thorchain_api', } const ENV_KEYS = [ diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 61ed7cfc610..6e2e7b14526 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -20,7 +20,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'provenance', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', 'aura', 'xpla', 'bostrom', 'joltify', 'nibiru', 'kopi', 'elys', "pryzm", "mantra", 'agoric', 'band', 'axiome', 'allora', - 'celestia', 'dydx', 'dungeon', 'carbon', 'milkyway', 'regen', 'sommelier', 'stride', 'prom', 'babylon', 'xion', 'zigchain', + 'celestia', 'dydx', 'dungeon', 'carbon', 'milkyway', 'regen', 'sommelier', 'stride', 'prom', 'babylon', 'xion', 'zigchain', 'thorchain', 'akash', 'fetchhub' ] const caseSensitiveChains = [...ibcChains, ...svmChains, 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge', 'stellar', 'massa', 'aleo', From 416ee04bf06c093db135e38e2f5ce650bf2270c3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 16 Oct 2026 20:35:27 +0200 Subject: [PATCH 293/988] Support additional blockchain networks (#21673) --- projects/gate-io/index.js | 31 +++++++++++++++++++++++++++++- projects/helper/cex.js | 11 +++++++++++ projects/helper/chain/canton.js | 33 ++++++++++++++++++++++++++++++++ projects/helper/chain/conflux.js | 24 +++++++++++++++++++++++ projects/helper/chain/decred.js | 22 +++++++++++++++++++++ projects/helper/chain/iota.js | 16 +++++++++++++++- projects/helper/chain/mina.js | 27 ++++++++++++++++++++++++++ projects/helper/chain/nervos.js | 27 ++++++++++++++++++++++++++ projects/helper/chain/oasis.js | 27 ++++++++++++++++++++++++++ projects/helper/chain/theta.js | 24 +++++++++++++++++++++++ projects/helper/chains.json | 3 +++ projects/helper/env.js | 1 + projects/helper/sumTokens.js | 7 +++++++ projects/helper/tokenMapping.js | 2 +- projects/wcc/index.js | 14 +++----------- 15 files changed, 255 insertions(+), 14 deletions(-) create mode 100644 projects/helper/chain/canton.js create mode 100644 projects/helper/chain/conflux.js create mode 100644 projects/helper/chain/decred.js create mode 100644 projects/helper/chain/mina.js create mode 100644 projects/helper/chain/nervos.js create mode 100644 projects/helper/chain/oasis.js create mode 100644 projects/helper/chain/theta.js diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index 4ed6b7f12ac..94d77d1569b 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -7,6 +7,7 @@ const { sumTokens2: solanaSumTokens } = require("../helper/solana"); const { unwrapDolomiteDeposits } = require("../helper/unwrapLPs.js"); const { addHypercoreSpotBalances } = require("../helper/chain/hyperliquid.js"); const { sumTokens: cosmosSumTokens } = require("../helper/chain/cosmos.js"); +const { addThetaBalances } = require("../helper/chain/theta.js"); const config = { "ethereum": { @@ -557,6 +558,11 @@ const config = { "0xffeb0f61871acdb4838dfc6d5082f063e738e421" ] }, + "canton": { + "owners": [ + "Gate::1220660fcee9042e5d36a50eccee8b6ff3e79cc3612ad41b7ec056c5c6cddacf864b" + ] + }, "bittensor": { "owners": [ "5CNChyk2fnVgVSZDLAVVFb4QBTMGm6WfuQvseBG6hj8xWzKP", @@ -713,6 +719,27 @@ const config = { "DAG4TETUwraLYX1mYdC8ymUxxWsoNZPffUpDf4Ar" ] }, + "iota": { + "owners": [ + "0x62f36b79d7ea8ae189491854edd9318b29c75346792177b230a95f333ffa53ad" + ] + }, + "mina": { + "owners": [ + "B62qm7vP2JPj1d8XDmGUiv3GtwAfzuaxrdNsiXdWmZ7QqXZtzpVyGPG" + ] + }, + "decred": { + "owners": [ + "DshHFVeVJofCFKFDgzB1FyzvqkpMLDnLnFa" + ] + }, + "nervos": { + "owners": [ + "ckb1qyq8cakcjf490h7vj9gegzhj8pur7hsguz3qlu2e5u", + "ckb1qyqqjtaucwu2mzz67ndua5jvd2wrl5ejr73q2upyca" + ] + }, "core": { "owners": [ "0x0d0707963952f2fba59dd06f2b425ace40b492fe", @@ -1932,7 +1959,7 @@ const config = { }; // remove chains w/o historical tvl -const unsupportedChains = ['aeternity', 'beam', 'binance', 'bitchain', 'bitcoincash', 'bittensor', 'bone', 'callisto', 'clv', 'concordium', 'conflux', 'cmp', 'defichain', 'edg', 'elastos', 'elys', 'equilibrium', 'filecoin', 'findora', 'flow', 'fusion', 'heiko', 'hydra', 'icon', 'interlay', 'karura', 'kintsugi', 'kusuma', 'manta_atlantic', 'lisk', 'neo', 'neo3', 'near', 'nibiru', 'ontology', 'oasis', 'parallel', 'pokt', 'polkadex', 'proton', 'reef', 'rvn', 'shiden', 'sora', 'stafi', 'starcoin', 'syscoin', 'telos', 'thorchain', 'velas', 'venom', 'vite', 'waves', 'wax', 'zilliqa', 'secret', 'etn', 'zkfair', 'acala', 'harmony', +const unsupportedChains = ['aeternity', 'beam', 'binance', 'bitchain', 'bitcoincash', 'bittensor', 'bone', 'callisto', 'clv', 'concordium', 'cmp', 'defichain', 'edg', 'elastos', 'elys', 'equilibrium', 'filecoin', 'findora', 'flow', 'fusion', 'heiko', 'hydra', 'icon', 'interlay', 'karura', 'kintsugi', 'kusuma', 'manta_atlantic', 'lisk', 'neo', 'neo3', 'near', 'nibiru', 'ontology', 'parallel', 'pokt', 'polkadex', 'proton', 'reef', 'rvn', 'shiden', 'sora', 'stafi', 'starcoin', 'syscoin', 'telos', 'velas', 'venom', 'vite', 'waves', 'wax', 'zilliqa', 'secret', 'etn', 'zkfair', 'acala', 'harmony', 'vinu', 'rollux', 'aelf', 'ailayer', 'archway', ] @@ -2154,6 +2181,8 @@ const gateEarnTvl = { // same split as kava: config.sei carries the cosmos-side sei1... owners, so the // EVM-side native SEI held by the hot wallet is summed here sei: { tvl: earnTvl(api => api.sumTokens({ owners: ['0x0d0707963952f2fba59dd06f2b425ace40b492fe'], tokens: [ADDRESSES.null] })) }, + // config.theta counts TFUEL via the EVM rpc; native THETA lives in the account ledger, summed here + theta: { tvl: earnTvl(api => addThetaBalances(api, config.theta.owners)) }, } Object.entries(earnStakers).forEach(([chain, owners]) => { diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 619b1efd6eb..f68d5dc9a82 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -140,6 +140,10 @@ const defaultTokens = { '0x8de39b057cc6522230ab19c0205080a8663331ef', // WOJAK '0xa3ee21c306a700e682abcdfe9baa6a08f3820419', // CTC '0xba47214edd2bb43099611b208f75e4b42fdcfedc', // GOOGLON + '0x8ed97a637a790be1feff5e888d43629dc05408f6', // NPC + '0xaa7a9ca87d3694b5755f213b5d04094b8d0f0a6f', // TRAC + '0xeD35af169aF46a02eE13b9d79Eb57d6D68C1749e', // OMI + '0xb0076de78dc50581770bba1d211ddc0ad4f2a241', // EDGEX ], tron: [ nullAddress, @@ -172,6 +176,10 @@ const defaultTokens = { '0x7bebd226154e865954a87650faefa8f485d36081', // ZIG ], algorand: [], + cardano: [ + nullAddress, // ADA + '279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3f534e454b', // SNEK + ], solana: [ ADDRESSES.solana.USDC, // USDC ADDRESSES.solana.USDT, // USDT @@ -251,7 +259,9 @@ const defaultTokens = { '0xc07e1300dc138601fa6b0b59f8d0fa477e690589', // Q '0x9558a9254890b2a8b057a789f413631b9084f4a3', // AIN '0x55ad16bd573b3365f43a9daeb0cc66a73821b4a5', // AIOT + '0xd69a4b260ef021ccd4e1c5f5a4fb522b032ce831', // MCAT '0x10d4183389e99233db3cc981c43443ebd28ebd5e', // DGAI + '0x3d4f0513e8a29669b960f9dbca61861548a9a760', // BANANAS ], eos: [ ["eosio.token", "EOS", "eos"], @@ -284,6 +294,7 @@ const defaultTokens = { '0x22af33fe49fd1fa80c7149773dde5890d3c76f3b', // BNKR '0x16ee7ecac70d1028e7712751e2ee6ba808a7dd92', // FUN '0xe0cd4cacddcbf4f36e845407ce53e87717b6601d', // ICNT + '0xed6e000def95780fb89734c07ee2ce9f6dcaf110', // EDGE ], avax: [ nullAddress, diff --git a/projects/helper/chain/canton.js b/projects/helper/chain/canton.js new file mode 100644 index 00000000000..3d4a4cb7535 --- /dev/null +++ b/projects/helper/chain/canton.js @@ -0,0 +1,33 @@ +const sdk = require('@defillama/sdk') +const { get } = require('../http') +const { getEnv } = require('../env') + +// CANTON_API holds both the api base url and the key: ?key= +function getApiConfig() { + const value = getEnv('CANTON_API') + if (!value) throw new Error('CANTON_API is not set') + const url = new URL(value) + const key = url.searchParams.get('key') + if (!key) throw new Error('CANTON_API is missing the ?key= api key') + url.searchParams.delete('key') + return { baseUrl: url.toString().replace(/\/$/, ''), headers: { Authorization: `Bearer ${key}` } } +} + +// total CC (Canton Coin) held by a party, locked + unlocked +async function getPartyBalance(party) { + const { baseUrl, headers } = getApiConfig() + const { balance } = await get(`${baseUrl}/parties/${party}/balance`, { headers }) + return Number(balance.total_coin_holdings) +} + +async function sumTokens({ balances = {}, owners = [], api }) { + if (api) balances = api.getBalances() + for (const owner of owners) + sdk.util.sumSingleBalance(balances, 'canton-network', await getPartyBalance(owner)) + return balances +} + +module.exports = { + getPartyBalance, + sumTokens, +} diff --git a/projects/helper/chain/conflux.js b/projects/helper/chain/conflux.js new file mode 100644 index 00000000000..ec0077bacee --- /dev/null +++ b/projects/helper/chain/conflux.js @@ -0,0 +1,24 @@ +const sdk = require('@defillama/sdk') +const { post } = require('../http') + +// Conflux Core space (cfx:... addresses); eSpace 0x addresses go through the evm helpers +const RPC = 'https://main.confluxrpc.com' + +// native CFX balance (whole coins) of a core space address +async function getCfxBalance(owner) { + const { result, error } = await post(RPC, { jsonrpc: '2.0', id: 1, method: 'cfx_getBalance', params: [owner, 'latest_state'] }) + if (error) throw new Error(`conflux: cfx_getBalance failed for ${owner}: ${error.message}`) + return Number(BigInt(result)) / 1e18 +} + +async function sumTokens({ balances = {}, owners = [], api }) { + if (api) balances = api.getBalances() + for (const owner of owners) + sdk.util.sumSingleBalance(balances, 'conflux-token', await getCfxBalance(owner)) + return balances +} + +module.exports = { + getCfxBalance, + sumTokens, +} diff --git a/projects/helper/chain/decred.js b/projects/helper/chain/decred.js new file mode 100644 index 00000000000..57e02025581 --- /dev/null +++ b/projects/helper/chain/decred.js @@ -0,0 +1,22 @@ +const sdk = require('@defillama/sdk') +const { get } = require('../http') + +const DCRDATA_API = 'https://dcrdata.decred.org/api' + +// unspent DCR (whole coins) at an address +async function getDcrBalance(owner) { + const { dcr_unspent } = await get(`${DCRDATA_API}/address/${owner}/totals`) + return Number(dcr_unspent ?? 0) +} + +async function sumTokens({ balances = {}, owners = [], api }) { + if (api) balances = api.getBalances() + for (const owner of owners) + sdk.util.sumSingleBalance(balances, 'decred', await getDcrBalance(owner)) + return balances +} + +module.exports = { + getDcrBalance, + sumTokens, +} diff --git a/projects/helper/chain/iota.js b/projects/helper/chain/iota.js index b3d80fcee88..f06900f10c0 100644 --- a/projects/helper/chain/iota.js +++ b/projects/helper/chain/iota.js @@ -45,9 +45,23 @@ async function call(method, params, { withMetadata = false } = {}) { return withMetadata ? result : result.data } +// every coin balance (native IOTA included, as 0x2::iota::IOTA) held by the owners +async function sumTokens({ balances = {}, owners = [], blacklistedTokens = [], api }) { + if (api) balances = api.getBalances() + for (const owner of owners) { + const coins = await call('iotax_getAllBalances', [owner]) + for (const { coinType, totalBalance } of coins) { + if (blacklistedTokens.includes(coinType)) continue + sdk.util.sumSingleBalance(balances, coinType, totalBalance, 'iota') + } + } + return balances +} + module.exports = { endpoint: endpoint(), call, getObject, - getObjects + getObjects, + sumTokens, }; diff --git a/projects/helper/chain/mina.js b/projects/helper/chain/mina.js new file mode 100644 index 00000000000..cf4817bf80b --- /dev/null +++ b/projects/helper/chain/mina.js @@ -0,0 +1,27 @@ +const sdk = require('@defillama/sdk') +const { post } = require('../http') + +const GRAPHQL = 'https://api.minascan.io/node/mainnet/v1/graphql' +const MINA_DECIMALS = 9 + +// total MINA (whole coins) held by an account; unknown accounts return null, i.e. 0 +async function getMinaBalance(owner) { + const { data, errors } = await post(GRAPHQL, { + query: 'query($pk: PublicKey!) { account(publicKey: $pk) { balance { total } } }', + variables: { pk: owner }, + }) + if (errors?.length) throw new Error(`mina: ${errors[0].message}`) + return Number(data.account?.balance?.total ?? 0) / 10 ** MINA_DECIMALS +} + +async function sumTokens({ balances = {}, owners = [], api }) { + if (api) balances = api.getBalances() + for (const owner of owners) + sdk.util.sumSingleBalance(balances, 'mina-protocol', await getMinaBalance(owner)) + return balances +} + +module.exports = { + getMinaBalance, + sumTokens, +} diff --git a/projects/helper/chain/nervos.js b/projects/helper/chain/nervos.js new file mode 100644 index 00000000000..6ab82396968 --- /dev/null +++ b/projects/helper/chain/nervos.js @@ -0,0 +1,27 @@ +const sdk = require('@defillama/sdk') +const { get } = require('../http') + +// Nervos CKB L1 (ckb1... addresses), balances via the official explorer api +const EXPLORER_API = 'https://mainnet-api.explorer.nervos.org/api/v1' +const HEADERS = { Accept: 'application/vnd.api+json', 'Content-Type': 'application/vnd.api+json' } +const CKB_DECIMALS = 8 + +// total CKB (whole coins) held by an address +async function getCkbBalance(owner) { + const { data } = await get(`${EXPLORER_API}/addresses/${owner}`, { headers: HEADERS }) + const attributes = data?.[0]?.attributes + if (!attributes) throw new Error(`nervos: no explorer data for ${owner}`) + return Number(attributes.balance) / 10 ** CKB_DECIMALS +} + +async function sumTokens({ balances = {}, owners = [], api }) { + if (api) balances = api.getBalances() + for (const owner of owners) + sdk.util.sumSingleBalance(balances, 'nervos-network', await getCkbBalance(owner)) + return balances +} + +module.exports = { + getCkbBalance, + sumTokens, +} diff --git a/projects/helper/chain/oasis.js b/projects/helper/chain/oasis.js new file mode 100644 index 00000000000..1a5917aed2c --- /dev/null +++ b/projects/helper/chain/oasis.js @@ -0,0 +1,27 @@ +const sdk = require('@defillama/sdk') +const { get } = require('../http') + +// Oasis consensus layer (oasis1... addresses); the `oasis` chain itself is the Emerald EVM ParaTime, +// so this is only used for non-0x owners (see altEVMHelper in sumTokens.js) +const NEXUS_API = 'https://nexus.oasis.io/v1' +const ROSE_DECIMALS = 9 + +// ROSE (whole coins) held by a consensus account: liquid + staked + debonding +async function getRoseBalance(owner) { + const account = await get(`${NEXUS_API}/consensus/accounts/${owner}`) + const base = ['available', 'delegations_balance', 'debonding_delegations_balance'] + .reduce((sum, key) => sum + BigInt(account[key] ?? 0), 0n) + return Number(base) / 10 ** ROSE_DECIMALS +} + +async function sumTokens({ balances = {}, owners = [], api }) { + if (api) balances = api.getBalances() + for (const owner of owners) + sdk.util.sumSingleBalance(balances, 'oasis-network', await getRoseBalance(owner)) + return balances +} + +module.exports = { + getRoseBalance, + sumTokens, +} diff --git a/projects/helper/chain/theta.js b/projects/helper/chain/theta.js new file mode 100644 index 00000000000..a75badfcbea --- /dev/null +++ b/projects/helper/chain/theta.js @@ -0,0 +1,24 @@ +const axios = require('axios') + +// Theta mainnet keeps native THETA in the account ledger next to TFUEL; the EVM rpc +// (eth_getBalance) only exposes TFUEL, so THETA has to be read from the explorer api +const EXPLORER_API = 'https://explorer-api.thetatoken.org/api' + +// liquid native THETA (whole coins) held by an address; the explorer 404s for addresses +// that never had a ledger account, which means a zero balance +async function getThetaBalance(owner) { + const { status, data } = await axios.get(`${EXPLORER_API}/account/${owner.toLowerCase()}`, { validateStatus: s => s === 200 || s === 404 }) + if (status === 404) return 0 + return Number(data?.body?.balance?.thetawei ?? 0) / 1e18 +} + +async function addThetaBalances(api, owners) { + for (const owner of owners) + api.addCGToken('theta-token', await getThetaBalance(owner)) + return api.getBalances() +} + +module.exports = { + getThetaBalance, + addThetaBalances, +} diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 5894c61b777..083fe0f2705 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -125,6 +125,7 @@ "darwinia", "dash", "dchainmainnet", + "decred", "defichain", "defichain_evm", "defiverse", @@ -311,6 +312,7 @@ "milkomeda_a1", "milkyway", "milkyway_rollup", + "mina", "mint", "mixin", "mode", @@ -334,6 +336,7 @@ "neon_evm", "neony", "neox", + "nervos", "neutron", "new", "nibiru", diff --git a/projects/helper/env.js b/projects/helper/env.js index 38a0b00b3c9..86b22c95171 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -123,6 +123,7 @@ const ENV_KEYS = [ 'TEAM_WEBHOOK', 'HIRO_API_KEY', 'APTOS_API_KEY', + 'CANTON_API', // ?key= ] Object.keys(DEFAULTS).forEach(i => { diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index b7fb536e64a..a4033553c59 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -48,6 +48,12 @@ const helpers = { "constellation": require("./chain/constellation"), "supra": require("./chain/supra"), "icp": require("./chain/icp"), + "canton": require("./chain/canton"), + "conflux": require("./chain/conflux"), + "nervos": require("./chain/nervos"), + "iota": require("./chain/iota"), + "mina": require("./chain/mina"), + "decred": require("./chain/decred"), } svmChains.forEach(chain => { @@ -59,6 +65,7 @@ svmChains.forEach(chain => { const altEVMHelper = { "astar": require("./chain/astar"), "evmos": helpers.cosmos, + "oasis": require("./chain/oasis"), // oasis1... consensus accounts; 0x owners stay on the Emerald EVM path } const geckoMapping = { diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 6e2e7b14526..044237d65df 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -23,7 +23,7 @@ const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 's 'celestia', 'dydx', 'dungeon', 'carbon', 'milkyway', 'regen', 'sommelier', 'stride', 'prom', 'babylon', 'xion', 'zigchain', 'thorchain', 'akash', 'fetchhub' ] -const caseSensitiveChains = [...ibcChains, ...svmChains, 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge', 'stellar', 'massa', 'aleo', +const caseSensitiveChains = [...ibcChains, ...svmChains, 'canton', 'mina', 'decred', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge', 'stellar', 'massa', 'aleo', 'eclipse', 'acala', 'aelf', 'aeternity', 'alephium', 'bifrost', 'bittensor', 'verus', 'dash', 'qubic', 'constellation', 'supra', 'kaspa', 'bsv', 'arweave', 'pi', 'zcash', ] diff --git a/projects/wcc/index.js b/projects/wcc/index.js index 695845223cc..7ee62c63a7d 100644 --- a/projects/wcc/index.js +++ b/projects/wcc/index.js @@ -1,17 +1,9 @@ -const { get } = require('../helper/http') +const { sumTokensExport } = require('../helper/sumTokens') -const BASE_URL = 'https://lighthouse.cantonloop.com/api/parties/' const parties = ['vault0::12202c5d1340647acba2319bdc7785ec0af36affaf2f9318fde769690ddb91927acd','fee0::122047ae202c04cc73d5e928d731e4a025128c60f59e5a7597558fc6a5b6b733eb04'] -async function tvl(api){ - for (const party of parties) { - const { balance } = await get(BASE_URL + party + '/balance') - api.addGasToken(Number(balance.total_coin_holdings) * 1e18) - } -} - module.exports = { timetravel: false, - canton: { tvl }, + canton: { tvl: sumTokensExport({ owners: parties }) }, methodology: `TVL is the total CC balance held by custody parties on Canton Network.`, -}; \ No newline at end of file +}; From fd5c7951670a0a7e4967475a1e5b7f38a4f219c9 Mon Sep 17 00:00:00 2001 From: ProYield-Admin Date: Fri, 16 Oct 2026 17:13:26 -0400 Subject: [PATCH 294/988] Add ProYield TVL adapter (HyperEVM USDC vault) (#21612) Co-authored-by: FelixBruguera --- projects/proyield/index.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 projects/proyield/index.js diff --git a/projects/proyield/index.js b/projects/proyield/index.js new file mode 100644 index 00000000000..e2c6e41a7e2 --- /dev/null +++ b/projects/proyield/index.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// ProYield USDC vault on HyperEVM (chain id 999), deployed 2026-09-25. +// Non-custodial, guarded-beta vault: idle USDC plus USDC allocated to its +// registered yield strategies, all denominated in USDC. +const VAULT = '0x8954a73Bb36D17e4B212137Eb7B2328A1A14D1C1' + +async function tvl(api) { + const totalAssets = await api.call({ abi: 'uint256:totalAssets', target: VAULT }) + api.add(ADDRESSES.hyperliquid.USDC, totalAssets) +} + +module.exports = { + doublecounted: true, + methodology: + 'TVL is the ProYield vault\'s reported accounting value on HyperEVM (chain id 999), read from the vault\'s totalAssets() and denominated in USDC: idle USDC held by the vault plus USDC the vault has allocated to its registered yield strategies, including any returned amounts still recorded on-chain as in-flight. If USDC returned from a strategy remains recorded on-chain as in-flight without being credited, the reported amount may overstate the vault\'s backing. The vault is a capped guarded beta, so TVL is deliberately small while deposit caps are low. The protocol has no token counted in TVL.', + hyperliquid: { + tvl, + }, +} From 297c7d853793eadd5dcf8bb50683cce9a451b2f6 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Sat, 17 Oct 2026 14:59:30 +0200 Subject: [PATCH 295/988] add missing Binance XTZ reserves (#21670) --- projects/binance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/binance/index.js b/projects/binance/index.js index a14df719455..acfa9fec4eb 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -52,6 +52,7 @@ const binanceToDefillama = { SONIC: "sonic", PLASMA: "plasma", STATEMINT: 'polkadot', + XTZ: 'tezos', } const withdrawalAddresses = [ From 569391d40d0aea7a7a506b63832b55507f0ad78b Mon Sep 17 00:00:00 2001 From: routebuilder Date: Sat, 17 Oct 2026 15:01:29 +0200 Subject: [PATCH 296/988] add missing Binance SEI reserves (#21672) Co-authored-by: FelixBruguera --- projects/binance/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/binance/index.js b/projects/binance/index.js index acfa9fec4eb..09b7e3e7d5e 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -52,6 +52,7 @@ const binanceToDefillama = { SONIC: "sonic", PLASMA: "plasma", STATEMINT: 'polkadot', + SEIEVM: 'sei', XTZ: 'tezos', } @@ -141,7 +142,7 @@ const tvl = async (api) => { .map(({ address }) => address) .filter(Boolean) - const evmChains = ['ethereum', 'bsc', 'celo', 'chz', 'polygon', 'arbitrum', 'optimism', 'avax', 'fantom', 'base', 'era', 'manta', 'ronin', 'op_bnb', 'scroll', 'sonic', 'plasma'] + const evmChains = ['ethereum', 'bsc', 'celo', 'chz', 'polygon', 'arbitrum', 'optimism', 'avax', 'fantom', 'base', 'era', 'manta', 'ronin', 'op_bnb', 'scroll', 'sonic', 'plasma', 'sei'] const isEvm = evmChains.includes(chain) const lockInfoAddresses = [] From 2998eacbdddb59e22b1fd18863061fae5d81bec5 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Sat, 17 Oct 2026 15:04:10 +0200 Subject: [PATCH 297/988] add missing Binance KAIA reserves (#21677) Co-authored-by: FelixBruguera --- projects/binance/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/binance/index.js b/projects/binance/index.js index 09b7e3e7d5e..2035e7403ab 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -52,6 +52,7 @@ const binanceToDefillama = { SONIC: "sonic", PLASMA: "plasma", STATEMINT: 'polkadot', + KAIA: 'klaytn', SEIEVM: 'sei', XTZ: 'tezos', } @@ -142,7 +143,7 @@ const tvl = async (api) => { .map(({ address }) => address) .filter(Boolean) - const evmChains = ['ethereum', 'bsc', 'celo', 'chz', 'polygon', 'arbitrum', 'optimism', 'avax', 'fantom', 'base', 'era', 'manta', 'ronin', 'op_bnb', 'scroll', 'sonic', 'plasma', 'sei'] + const evmChains = ['ethereum', 'bsc', 'celo', 'chz', 'polygon', 'arbitrum', 'optimism', 'avax', 'fantom', 'base', 'era', 'manta', 'ronin', 'op_bnb', 'scroll', 'sonic', 'plasma', 'klaytn','sei'] const isEvm = evmChains.includes(chain) const lockInfoAddresses = [] From 68a86a00f67cc679d9e7c3b091d11ef6e32df11f Mon Sep 17 00:00:00 2001 From: routebuilder Date: Sat, 17 Oct 2026 15:14:09 +0200 Subject: [PATCH 298/988] add missing Binance KAVA reserves (#21676) Co-authored-by: FelixBruguera --- projects/binance/index.js | 3 ++- projects/helper/utils/cex.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/binance/index.js b/projects/binance/index.js index 2035e7403ab..bcc271dce10 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -52,6 +52,7 @@ const binanceToDefillama = { SONIC: "sonic", PLASMA: "plasma", STATEMINT: 'polkadot', + KAVAEVM: 'kava', KAIA: 'klaytn', SEIEVM: 'sei', XTZ: 'tezos', @@ -143,7 +144,7 @@ const tvl = async (api) => { .map(({ address }) => address) .filter(Boolean) - const evmChains = ['ethereum', 'bsc', 'celo', 'chz', 'polygon', 'arbitrum', 'optimism', 'avax', 'fantom', 'base', 'era', 'manta', 'ronin', 'op_bnb', 'scroll', 'sonic', 'plasma', 'klaytn','sei'] + const evmChains = ['ethereum', 'bsc', 'celo', 'chz', 'polygon', 'arbitrum', 'optimism', 'avax', 'fantom', 'base', 'era', 'manta', 'ronin', 'op_bnb', 'scroll', 'sonic', 'plasma', 'klaytn','sei', 'kava'] const isEvm = evmChains.includes(chain) const lockInfoAddresses = [] diff --git a/projects/helper/utils/cex.js b/projects/helper/utils/cex.js index 44770364357..09b7cf9a88a 100644 --- a/projects/helper/utils/cex.js +++ b/projects/helper/utils/cex.js @@ -31,7 +31,7 @@ const binanceNetworkMapping = { // STATEMINT: 'polkadot', // OPBNB: 'op_bnb', CELO: 'celo', - // KAVAEVM: 'kava', + KAVAEVM: 'kava', XLM: 'stellar', LUNC: 'terra', // 2 tokens From 05fad6de7f1ddef5149ca50a296d460085d28351 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 17 Oct 2026 16:57:46 +0200 Subject: [PATCH 299/988] update dtao --- projects/dtao/index.js | 1 + registries/uniswapV2.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/projects/dtao/index.js b/projects/dtao/index.js index fd99a1adbe6..22675c9cd65 100644 --- a/projects/dtao/index.js +++ b/projects/dtao/index.js @@ -44,6 +44,7 @@ async function tvl(api) { } module.exports = { + doublecounted: true, // excluded from defi tvl as not all deposits are from users timetravel: false, methodology: 'TVL is the TAO reserve of every subnet dTAO liquidity pool (SubtensorModule.SubnetTAO across all netuids), read from public chain RPC at a single finalized block. Root (netuid 0) is excluded because it is network staking rather than an AMM pool. Subnets whose pools are tracked by their own DefiLlama adapter (currently Chutes, netuid 64) are excluded to avoid double counting. Alpha-side reserves are not counted since most alpha tokens have no listed price.', diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index 3a64bbbd899..73f79c91bdf 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -694,6 +694,10 @@ const uniV2Configs = { }, 'ethervista': { ethereum: '0x9a27cb5ae0B2cEe0bb71f9A85C0D60f3920757B4', + _options: { + fetchBalances: true, + permitFailure: true, + }, }, 'ethwswap': { ethpow: '0x78376072F4945b2A5450B1A6B41a85ff20034527', From e39f511163f0591ac73cb0d074bc488779b1936c Mon Sep 17 00:00:00 2001 From: Infinite Minds Dev Date: Sat, 17 Oct 2026 11:24:33 -0400 Subject: [PATCH 300/988] STOCKMON: add Aetheryn birth vaults (Breeding v3 and v4) to Staking (#21627) Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/stockmon/index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/projects/stockmon/index.js b/projects/stockmon/index.js index 471e7c533fc..2048769d4dd 100644 --- a/projects/stockmon/index.js +++ b/projects/stockmon/index.js @@ -1,10 +1,17 @@ const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') -// Vaults by collection — Aetheryn joins this list when its vault deploys. +// Vaults by collection. const VAULTS = [ "0xb78edcb4de39355747c62e6d55209c01a2294ad8", // Genesis Vault ]; +// Aetheryn birth vaults: each Aetheryn's MON is held here until its owner redeems it. +const AETHERYN_BIRTH_VAULTS = [ + "0xa54221b56837d5f3707d0ed9883a01edf7dae2cf", // Aetheryn Birth Vault (Breeding v3) + "0xad2a6cbdb2c1b01c19d52585eee75b8e86f9989a", // Aetheryn Birth Vault (Breeding v4) +]; const WETH = ADDRESSES.robinhood.WETH.toLowerCase() +const MON = "0x7c646a41572b441527169c576ef0c0a40c667777" async function tvl(api) { const assetRegistry = await api.call({ abi: 'address:assetRegistry', target:'0xb78edcb4de39355747c62e6d55209c01a2294ad8' }); @@ -25,8 +32,9 @@ async function tvl(api) { } module.exports = { - methodology: "Value of stock tokens and holder-backed WETH held in STOCKMON vaults, excluding WETH claimable by the protocol treasury", + methodology: "TVL is the value of stock tokens and holder-backed WETH held in STOCKMON vaults, excluding WETH claimable by the protocol treasury. Staking is the MON held in the Aetheryn birth vaults (Breeding v3 and v4) that backs each Aetheryn", robinhood: { - tvl + tvl, + staking: sumTokensExport({ owners: AETHERYN_BIRTH_VAULTS, tokens: [MON] }), }, }; From c25980b9679d586ba5e37eb6d257fd4a3fef7b82 Mon Sep 17 00:00:00 2001 From: Ferengi69 <92767684+Ferengi69@users.noreply.github.com> Date: Sat, 17 Oct 2026 19:38:47 +0400 Subject: [PATCH 301/988] goo-exchange: count satellite pools as treasury (#21684) Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/treasury/goo-exchange.js | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 projects/treasury/goo-exchange.js diff --git a/projects/treasury/goo-exchange.js b/projects/treasury/goo-exchange.js new file mode 100644 index 00000000000..d477ba1c798 --- /dev/null +++ b/projects/treasury/goo-exchange.js @@ -0,0 +1,34 @@ +const { getLogs } = require('../helper/cache/getLogs') + +// satellite factory: same Uniswap V3 engine as the public goo exchange factory, but its pools hold +// treasury-owned liquidity and only the protocol's arbitrage contract can swap them +const SATELLITE_FACTORY = '0x649Fee51B30dce68Eed7B356F5Ec6185e3982ADf' +const GOO = '0x6572EADe9Fb17F4027baF92FEAC222B9AA746bd0' + +async function getPools(api) { + return getLogs({ + api, + target: SATELLITE_FACTORY, + fromBlock: 79897550, + eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool)', + onlyArgs: true, + }) +} + +async function tvl(api) { + const pools = await getPools(api) + return api.sumTokens({ ownerTokens: pools.map(i => [[i.token0, i.token1], i.pool]), blacklistedTokens: [GOO] }) +} + +async function ownTokens(api) { + const pools = await getPools(api) + return api.sumTokens({ owners: pools.map(i => i.pool), tokens: [GOO] }) +} + +module.exports = { + methodology: 'Tokens held by the satellite pools of goo exchange on Robinhood Chain: protocol-owned liquidity for GOO and its stock pairs, held by the treasury in private pools that only the protocol\'s arbitrage contract trades. GOO is reported as own tokens.', + robinhood: { + tvl, + ownTokens, + }, +} From 308b937860760045674762364f0e79803a2a76af Mon Sep 17 00:00:00 2001 From: bheluga Date: Sat, 17 Oct 2026 22:56:09 +0530 Subject: [PATCH 302/988] track cardboard and umbra v2 tvl (#21691) --- projects/cardboard/index.js | 12 ++++++++++++ projects/umbra-privacy-v2/index.js | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 projects/cardboard/index.js create mode 100644 projects/umbra-privacy-v2/index.js diff --git a/projects/cardboard/index.js b/projects/cardboard/index.js new file mode 100644 index 00000000000..b417242fd58 --- /dev/null +++ b/projects/cardboard/index.js @@ -0,0 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/solana') + +const VAULT_AUTHORITY = 'HrW16vpyqURMvR4CeRf1QYMucEGKusHuzPVz1V3h7R7B' + +module.exports = { + timetravel: false, + methodology: 'TVL is the USDC held by the Cardboard program: house LP funds, trader margin and balances, and fees not yet withdrawn.', + solana: { + tvl: sumTokensExport({ owner: VAULT_AUTHORITY, tokens: [ADDRESSES.solana.USDC] }), + }, +} diff --git a/projects/umbra-privacy-v2/index.js b/projects/umbra-privacy-v2/index.js new file mode 100644 index 00000000000..9fb28c94759 --- /dev/null +++ b/projects/umbra-privacy-v2/index.js @@ -0,0 +1,21 @@ +const { sumTokens2 } = require('../helper/solana') + +const TOKEN_VAULT = '2sjnjABJHPEZS8oVdp8nztPBUVUAT7uJawc8eQTMHTfa' +const SOL_VAULT = 'BxDCkvgZYRcCAnpywVw5j14AhkXehYvsXoCRiaodUs8s' + +const UMBRA_MINT = 'PRVT6TB7uss3FrUd2D9xs2zqDBsa3GbMJMwCQsgmeta' + +async function tvl(api) { + return sumTokens2({ api, owner: TOKEN_VAULT, solOwners: [SOL_VAULT], blacklistedTokens: [UMBRA_MINT] }) +} + +async function staking(api) { + return sumTokens2({ api, tokensAndOwners: [[UMBRA_MINT, TOKEN_VAULT]] }) +} + +module.exports = { + timetravel: false, + methodology: + 'TVL is the sum of the token balances held by the Umbra V2 shielded pool on Solana, read directly from chain state. V2 custodies every SPL token deposit in token accounts owned by a single vault authority, and native SOL deposits as the lamport balance of a single program-owned vault. Nothing is borrowed, lent or rehypothecated by Umbra itself, and Umbra\'s own token is counted under staking where users have deposited it into the pool.', + solana: { tvl, staking }, +} From e12d6c4503c658dfa6b2d43ad077bbf837ffed59 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 18 Oct 2026 10:55:34 +0200 Subject: [PATCH 303/988] update chutes --- projects/chutes/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/chutes/index.js b/projects/chutes/index.js index cd5c016fadf..dbe2c857d03 100644 --- a/projects/chutes/index.js +++ b/projects/chutes/index.js @@ -21,6 +21,7 @@ async function tvl(api) { } module.exports = { + doublecounted: true, // not all deposits here are from the users, it includes protocol emissions timetravel: false, methodology: 'Counts the TAO reserves of the Chutes (netuid 64) dTAO liquidity pool, read from SubtensorModule.SubnetTAO on public chain RPC.', bittensor: { tvl }, From 384289b795d52e517ea8cd7db644e17b82a94b04 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 18 Oct 2026 13:37:15 +0200 Subject: [PATCH 304/988] fix broken --- projects/helper/cache/getLogs.js | 11 ++++++++--- projects/range/index.js | 3 ++- test.js | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/projects/helper/cache/getLogs.js b/projects/helper/cache/getLogs.js index 8d4d96b8b30..33a8433ae89 100644 --- a/projects/helper/cache/getLogs.js +++ b/projects/helper/cache/getLogs.js @@ -113,6 +113,7 @@ async function getLogs({ target, // remove possible duplicates if (!customCacheFunction) cache.logs = cache.logs.filter(i => { + if (!i) return false let key = (i.transactionHash ?? i.hash) + (i.logIndex ?? i.index) if (!(i.hasOwnProperty('logIndex') || i.hasOwnProperty('index')) || !(i.hasOwnProperty('transactionHash') || i.hasOwnProperty('hash'))) { sdk.log(i, i.logIndex, i.index, i.transactionHash) @@ -159,8 +160,7 @@ async function getLogs({ target, let index = 0 while (allLogs.length) { - const logs = allLogs.splice(0, chunkSize) - allLogs = allLogs.slice(chunkSize) + const logs = allLogs.splice(0, chunkSize) // splice already removes the chunk from allLogs const chunkKey = `${key}-${index}` const hasMore = allLogs.length > 0 await setCache(cacheFolder, chunkKey, { logs, hasMore }) @@ -185,10 +185,15 @@ async function getLogs({ target, while (hasMore) { sdk.log(`Fetching more logs for ${key} from cache: ${index}`) const extraLogs = await getCache(cacheFolder, `${key}-${index}`, { checkIfRecent: true, }) + // a missing chunk means the cache is incomplete; refetch everything rather than return partial logs + if (!Array.isArray(extraLogs.logs)) { + sdk.log(`Missing log cache chunk ${key}-${index}, refetching from fromBlock`) + return defaultRes + } index++ hasMore = extraLogs.hasMore cache.logs = cache.logs.concat(extraLogs.logs) - sdk.log(cache.logs.length, 'logs fetched from cache', extraLogs.logs.length, 'more logs', extraLogs.hasMore ? 'and more to come' : 'no more logs') + sdk.log(cache.logs.length, 'logs fetched from cache', extraLogs.logs?.length, 'more logs', extraLogs.hasMore ? 'and more to come' : 'no more logs') } diff --git a/projects/range/index.js b/projects/range/index.js index a57e320239a..fa498bfbd74 100644 --- a/projects/range/index.js +++ b/projects/range/index.js @@ -75,6 +75,7 @@ Object.keys(config).forEach(chain => { eventAbi: 'event VaultCreated(address indexed uniPool, address indexed vault)', onlyArgs: true, fromBlock, + onlyUseExistingCache: true, }) logs.forEach((log) => allLogs.push({ factory, log, chain, factoryType })); } @@ -116,4 +117,4 @@ Object.keys(config).forEach(chain => { return api.getBalances() } } -}) \ No newline at end of file +}) diff --git a/test.js b/test.js index 1fd35807697..e0e9cda3574 100644 --- a/test.js +++ b/test.js @@ -470,7 +470,7 @@ async function computeTVL(balances, timestamp) { return undefined; } }) - .filter((item) => item !== undefined); + .filter((item) => item !== undefined) const unknownTokens = {} let tokenData = [] @@ -492,7 +492,7 @@ async function computeTVL(balances, timestamp) { if (queries.length > 6) { sdk.log(`Processed ${i}/${queryCount} queries, ${tokenData.length} responses received`) if (i < queryCount - 2) { - await sleep(5000) // avoid rate limiting + await sleep(100) // avoid rate limiting } } } catch (e) { From ae1836bf788182750dfc007dd5a65607fed5cb6d Mon Sep 17 00:00:00 2001 From: bheluga Date: Sun, 18 Oct 2026 18:14:52 +0530 Subject: [PATCH 305/988] fix stability tvl (#21701) --- projects/stability/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/stability/index.js b/projects/stability/index.js index 4e6ab6c3b82..77d4902b961 100644 --- a/projects/stability/index.js +++ b/projects/stability/index.js @@ -16,6 +16,11 @@ const config = { }, sonic: { vaultManager: '0x589a504f2ee9d054b483c700fa814863d639381e', + // vaults lending USDC into insolvent Silo markets (0 liquidity, unwithdrawable); their claim compounds as phantom interest + blacklistedVaults: [ + '0x8913582701B7c80E883F9E352c1653a16769B173', // C-USDC-S1 -> Silo xUSD/USDC (Stream-impacted) + '0xd248c4b6Ec709FEeD32851A9F883AfeaC294aD30', // C-USDC.e-S3 -> Silo PT-wstkscUSD-29MAY2025/USDC + ], }, } @@ -24,7 +29,8 @@ Object.keys(config).forEach(chain => { tvl: async function (api) { // Stability Platform Vaults // Get all vaults - const vaults = await api.call({ abi: abi.vaultAddresses, target: config[chain].vaultManager }); + const blacklist = new Set((config[chain].blacklistedVaults ?? []).map(v => v.toLowerCase())) + const vaults = (await api.call({ abi: abi.vaultAddresses, target: config[chain].vaultManager })).filter(v => !blacklist.has(v.toLowerCase())); // Get strategy addresses const strategies = await api.multiCall({ abi: abi.strategy, calls: vaults, }) From ed336ccbdf7167f358ecd357726601a46bff26bb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 18 Oct 2026 18:07:20 +0200 Subject: [PATCH 306/988] clean up dead adapters --- projects/ICDex/index.js | 60 +++- projects/LiquidOps/index.js | 125 --------- projects/accumulator/index.js | 24 -- projects/aeon-protocol/index.js | 2 +- projects/akiba/index.js | 25 -- projects/armsys/index.js | 4 +- projects/beekava/index.js | 21 -- projects/blum/api.js | 3 +- projects/btb-finance/index.js | 17 +- projects/colorpool/index.js | 57 +++- projects/cometa/index.js | 1 + projects/compx/index.js | 1 + projects/cotiTreasury.js | 15 - projects/crossbow/index.js | 5 +- projects/crunchynetwork-wtz/index.js | 24 -- projects/derive-v3/index.js | 6 +- projects/dexlyn-dex/index.js | 22 +- projects/ditto-earn/index.js | 2 +- projects/embr-bridge/index.js | 18 -- projects/fang/index.js | 12 +- projects/floe-labs/index.js | 1 + projects/flying-tulip-lend/index.js | 4 +- projects/fndzdao/index.js | 3 +- projects/funbear/index.js | 20 -- projects/gamutexchange/index.js | 14 - projects/helper/cex.js | 4 +- projects/helper/chain/algorand.js | 10 +- projects/helper/chain/ton.js | 21 +- projects/helper/chain/venom.js | 281 +++++++++++++++++++ projects/helper/coreAssets.json | 24 +- projects/helper/unknownTokens.js | 2 +- projects/helper/unwrapLPs.js | 10 +- projects/hinkal/registryTokens.js | 14 +- projects/ifpool/index.js | 21 -- projects/iotabee/index.js | 13 - projects/izumi/api.js | 13 +- projects/izumi/index.js | 1 + projects/jupiter-lend/index.js | 3 +- projects/kaDefi/index.js | 18 -- projects/kaleido-lending/index.js | 3 +- projects/kaleido-swap/index.js | 4 +- projects/kavastarter/index.js | 19 -- projects/kinetix/index.js | 13 - projects/kmex-io/index.js | 16 -- projects/lodestar-protocol/index.js | 2 +- projects/mangrove/index.js | 69 ----- projects/merryforge/index.js | 6 +- projects/metric/index.js | 46 ---- projects/movefast/index.js | 1 + projects/myso/index.js | 66 +---- projects/orchard/index.js | 2 +- projects/phos-launchpad/index.js | 3 +- projects/pumper-protocol/index.js | 3 +- projects/pxswap/index.js | 11 - projects/quicksilver/index.js | 43 --- projects/radlock/index.js | 50 +++- projects/rocket-vault/index.js | 1 + projects/rubyfinance/index.js | 28 -- projects/sailing-portfolios/index.js | 20 -- projects/scrt.js | 19 -- projects/secretswap.js | 26 -- projects/selfex/index.js | 15 - projects/sentora/index.js | 3 +- projects/shadeprotocol-derivatives/index.js | 43 --- projects/sienna-lend/index.js | 96 ------- projects/sienna/index.js | 53 ---- projects/skate-amm/index.js | 4 +- projects/stakedicp/index.js | 9 - projects/statics/index.js | 3 +- projects/stax/index.js | 3 +- projects/tangleswap/index.js | 40 --- projects/templarfi/index.js | 3 +- projects/tonswap/index.js | 23 -- projects/treasury/flrbank.js | 2 +- projects/treasury/merryforge.js | 6 +- projects/treasury/mosh.js | 3 +- projects/treasury/stockworks.js | 2 +- projects/truss-lp/index.js | 3 +- projects/turret/config.js | 112 ++++---- projects/udon/index.js | 2 +- projects/venomstake/index.js | 27 +- projects/vibrswap/index.js | 9 - projects/weave/index.js | 22 -- projects/web3world/index.js | 81 +++++- projects/yearn/index.js | 11 +- projects/yelay-v3/index.js | 42 ++- registries/deadAdapters.json | 286 +++++++++++++++++++- registries/erc4626.js | 2 +- registries/sumTokens.js | 20 +- registries/sumTokens/data1.js | 22 ++ registries/sumTokens/data3.js | 14 +- registries/treasury.js | 10 +- registries/uniswapV3Graph.js | 3 - 93 files changed, 1090 insertions(+), 1256 deletions(-) delete mode 100644 projects/LiquidOps/index.js delete mode 100644 projects/accumulator/index.js delete mode 100644 projects/akiba/index.js delete mode 100644 projects/beekava/index.js delete mode 100644 projects/cotiTreasury.js delete mode 100644 projects/crunchynetwork-wtz/index.js delete mode 100644 projects/embr-bridge/index.js delete mode 100644 projects/funbear/index.js delete mode 100644 projects/gamutexchange/index.js create mode 100644 projects/helper/chain/venom.js delete mode 100644 projects/ifpool/index.js delete mode 100644 projects/iotabee/index.js delete mode 100644 projects/kaDefi/index.js delete mode 100644 projects/kavastarter/index.js delete mode 100644 projects/kinetix/index.js delete mode 100644 projects/kmex-io/index.js delete mode 100644 projects/mangrove/index.js delete mode 100644 projects/metric/index.js delete mode 100644 projects/pxswap/index.js delete mode 100644 projects/quicksilver/index.js delete mode 100644 projects/rubyfinance/index.js delete mode 100644 projects/sailing-portfolios/index.js delete mode 100644 projects/scrt.js delete mode 100644 projects/secretswap.js delete mode 100644 projects/selfex/index.js delete mode 100644 projects/shadeprotocol-derivatives/index.js delete mode 100644 projects/sienna-lend/index.js delete mode 100644 projects/sienna/index.js delete mode 100644 projects/stakedicp/index.js delete mode 100644 projects/tangleswap/index.js delete mode 100644 projects/tonswap/index.js delete mode 100644 projects/vibrswap/index.js delete mode 100644 projects/weave/index.js diff --git a/projects/ICDex/index.js b/projects/ICDex/index.js index 7165878f0c1..f4af9144708 100644 --- a/projects/ICDex/index.js +++ b/projects/ICDex/index.js @@ -1,16 +1,52 @@ -const { get } = require("../helper/http"); -const { toUSDTBalances } = require("../helper/balances"); +const { icp } = require('@defillama/sdk').chains -module.exports = { - misrepresentedTokens: true, - icp: { tvl } -}; +// ICDexRouter: lists every trading pair canister; each pair holds its traders' deposits of both tokens +const ROUTER = 'i2ied-uqaaa-aaaar-qaaza-cai' +const LABELS = ['data', 'total', 'pair', 'token0', 'token1', 'dexName', 'canisterId', 'icrc1', 'icrc2', 'dip20', 'drc20', 'icp', 'ledger', 'other'] +const ICRC_STANDARDS = new Set(['icrc1', 'icrc2', 'icp']) // the ICP ledger also implements icrc1_balance_of + +// token ledger canister -> coingecko id (decimals are read from the ledger) +const tokens = { + 'ryjl3-tyaaa-aaaaa-aaaba-cai': 'internet-computer', // ICP + 'mxzaz-hqaaa-aaaar-qaada-cai': 'bitcoin', // ckBTC + 'ss2fx-dyaaa-aaaar-qacoq-cai': 'ethereum', // ckETH + 'xevnm-gaaaa-aaaar-qafnq-cai': 'usd-coin', // ckUSDC + 'cngnf-vqaaa-aaaar-qag4q-cai': 'tether', // ckUSDT + 'bptq2-faaaa-aaaar-qagxq-cai': 'wrapped-bitcoin', // ckWBTC + 'g4tto-rqaaa-aaaar-qageq-cai': 'chainlink', // ckLINK + 'ilzky-ayaaa-aaaar-qahha-cai': 'uniswap', // ckUNI + 'etik7-oiaaa-aaaar-qagia-cai': 'pepe', // ckPEPE + 'fxffn-xiaaa-aaaar-qagoa-cai': 'shiba-inu', // ckSHIB + '2ouva-viaaa-aaaaq-aaamq-cai': 'openchat', // CHAT + '7pail-xaaaa-aaaas-aabmq-cai': 'bob-3', // BOB + 'lkwrt-vyaaa-aaaaq-aadhq-cai': 'origyn-foundation', // OGY + 'ca6gz-lqaaa-aaaaq-aacwa-cai': 'icpswap-token', // ICS + '6c7su-kiaaa-aaaar-qaira-cai': 'gold-token', // GLDT + 'rh2pm-ryaaa-aaaan-qeniq-cai': 'windoge98', // EXE + 'jcmow-hyaaa-aaaaq-aadlq-cai': 'waterneuron', // WTN +} + +async function tvl(api) { + const { data } = await icp.callCandid({ + canisterId: ROUTER, method: 'getPairs', labels: LABELS, + args: [null, null], argTypes: [{ opt: 'nat' }, { opt: 'nat' }], + }) -async function tvl() { - let tvl = 0; - let tvls = await get("https://gwhbq-7aaaa-aaaar-qabya-cai.raw.icp0.io/v1/pools/tvls"); - if (tvls && tvls.pairs && tvls.pairs.length) { - tvl = tvls.pairs.reduce((a, item) => a + Number(item.tvl), 0); + const decimals = {} + for (const { '0': pairCanister, '1': { pair } } of data) { + for (const token of [pair.token0, pair.token1]) { + const ledger = token['0'] + const standard = Object.keys(token['2'])[0] + if (!tokens[ledger] || !ICRC_STANDARDS.has(standard)) continue + if (decimals[ledger] === undefined) decimals[ledger] = await icp.getIcrcDecimals({ ledger }) + const balance = await icp.getIcrcBalance({ ledger, owner: pairCanister }) + api.addCGToken(tokens[ledger], Number(balance) / 10 ** decimals[ledger]) + } } - return toUSDTBalances(tvl); +} + +module.exports = { + timetravel: false, + methodology: 'TVL is the balance of each ICDex trading pair canister (listed by the ICDexRouter) in both of its tokens, read from the token ledgers on-chain.', + icp: { tvl }, } diff --git a/projects/LiquidOps/index.js b/projects/LiquidOps/index.js deleted file mode 100644 index 4208d5db1ca..00000000000 --- a/projects/LiquidOps/index.js +++ /dev/null @@ -1,125 +0,0 @@ -const { post } = require("../helper/http.js") -const methodologies = require('../helper/methodologies'); - - -const endpoint = 'https://cu.ardrive.io' -const controllerId = 'SmmMv0rJwfIDVM3RvY2-P729JFYwhdGSeGo2deynbfY' -const geckoTickerTransformations = { - 'wAR': 'arweave', - 'wUSDC': 'usd-coin', - 'wUSDT': 'tether', - 'wETH': 'ethereum', - 'USDA': 'usd-coin', - 'vAR': 'arweave', - 'vUSDC': 'usd-coin', - 'vDAI': 'dai', - 'vETH': 'ethereum', -}; - - - -// Access AO on chain data via the node endpoint -async function DryRun(target, action) { - const response = await post(`${endpoint}/dry-run?process-id=${target}`, { - Id: "1234", Target: target, Owner: "1234", Anchor: "0", Data: "1234", - Tags: [ - ["Target", target], - ["Action", action], - ["Data-Protocol", "ao"], - ["Type", "Message"], - ["Variant", "ao.TN.1"] - ].map(([name, value]) => ({ name, value })) - }); - return response -} - - -function scaleBalance(amount, denomination) { - if (amount === "0") return 0; - const denominationVal = parseInt(denomination); - const len = amount.length; - - if (denominationVal >= len) { - return parseFloat("0." + "0".repeat(denominationVal - len) + amount.replace(/0+$/, "")); - } - - const integerPart = amount.substr(0, len - denominationVal); - const fractionalPart = amount.substr(len - denominationVal).replace(/0+$/, ""); - - if (fractionalPart === "") return parseInt(integerPart); - - return parseFloat(integerPart + "." + fractionalPart); -} - - -async function getTokenInfos(supportedTokens) { - - const tokenInfo = []; - - for (const balanceObject of supportedTokens) { - const infoRes = await DryRun(balanceObject.oToken, "Info"); - await new Promise(resolve => setTimeout(resolve, 1000)); // don't overload node - - const tagsObject = Object.fromEntries( - infoRes.Messages[0].Tags.map((tag) => [tag.name, tag.value]) - ); - const ticker = geckoTickerTransformations[balanceObject.ticker] || balanceObject.ticker; - - tokenInfo.push({ - ticker: `coingecko:${ticker}`, - cash: scaleBalance(tagsObject['Cash'], tagsObject['Denomination']), - totalBorrows: scaleBalance(tagsObject['Total-Borrows'], tagsObject['Denomination']) - }); - } - - return tokenInfo; -} - -async function tvl() { - const supportedTokensRes = await DryRun(controllerId, "Get-Tokens"); - await new Promise(resolve => setTimeout(resolve, 1000)); // don't overload node - const supportedTokens = JSON.parse(supportedTokensRes.Messages[0].Data); - const tokensInfo = await getTokenInfos(supportedTokens); - const combinedBalances = {}; - - // Check if we already have a balance for this ticker - tokensInfo.forEach(token => { - if (combinedBalances[token.ticker]) { - combinedBalances[token.ticker] += token.cash; - } else { - combinedBalances[token.ticker] = token.cash; - } - }); - - return combinedBalances; -} - - -async function borrowed() { - await new Promise(resolve => setTimeout(resolve, 5000)); // don't trigger both functions at the same time to not overload node - const supportedTokensRes = await DryRun(controllerId, "Get-Tokens"); - const supportedTokens = JSON.parse(supportedTokensRes.Messages[0].Data); - await new Promise(resolve => setTimeout(resolve, 1000)); // don't overload node - const tokensInfo = await getTokenInfos(supportedTokens); - const combinedBalances = {}; - - tokensInfo.forEach(token => { - // Check if we already have a balance for this ticker - if (combinedBalances[token.ticker]) { - combinedBalances[token.ticker] += token.totalBorrows; - } else { - combinedBalances[token.ticker] = token.totalBorrows; - } - }); - - return combinedBalances - -} - - -module.exports = { - deadFrom: '2026-10-07', // cu.ardrive.io is gone and public AO CUs only serve whitelisted processes - methodology: methodologies.lendingMarket, - ao: { tvl, borrowed }, -}; -// node test.js projects/LiquidOps/index.js diff --git a/projects/accumulator/index.js b/projects/accumulator/index.js deleted file mode 100644 index 4f13448db26..00000000000 --- a/projects/accumulator/index.js +++ /dev/null @@ -1,24 +0,0 @@ -const { getConfig } = require('../helper/cache') -const { sumUnknownTokens } = require('../helper/unknownTokens') - -const config = { - shimmer_evm: 'shimmer' -} - -module.exports = { - misrepresentedTokens: true, -}; - -Object.keys(config).forEach(chain => { - const chainKey = config[chain] - module.exports[chain] = { - tvl: async (api) => { - const data = await getConfig('potluck-protocol', 'https://newapi.potluckprotocol.com/vaults') - const vaults = data.filter(i => i.chain === chainKey).map(i => i.earnedTokenAddress) - const tokens = await api.multiCall({ calls: vaults, abi: 'address:want'}) - const bals = await api.multiCall({ calls: vaults, abi: 'uint256:balance'}) - api.addTokens(tokens, bals) - return sumUnknownTokens({ api, resolveLP: true, useDefaultCoreAssets: true, lps: tokens, }) - } - } -}) diff --git a/projects/aeon-protocol/index.js b/projects/aeon-protocol/index.js index 47b9e5afb18..045b2093d39 100644 --- a/projects/aeon-protocol/index.js +++ b/projects/aeon-protocol/index.js @@ -35,7 +35,7 @@ const CL_TOKENS = [ ADDRESSES.robinhood.USDG, // USDG '0xc6911796042b15d7Fa4F6CDe69e245DdCd3d9c31', // VIRTUAL (real Virtuals Protocol token, not issued by AEON) '0x56A98Db16Cf501b686c14BA00a5DeC02E87083FA', // ROBINFUN (real, independently-deployed token, not issued by AEON) - '0x020bfC650A365f8BB26819deAAbF3E21291018b4', // CASHCAT (real, independently-deployed token, not issued by AEON) + ADDRESSES.robinhood.CASHCAT, // CASHCAT (real, independently-deployed token, not issued by AEON) ] const vammFactoryTvl = getUniTVL({ factory: AEON_FACTORY, fetchBalances: true, abis: { allPairs: 'function allPools(uint256) view returns (address)', allPairsLength: 'uint256:allPoolsLength'}}) diff --git a/projects/akiba/index.js b/projects/akiba/index.js deleted file mode 100644 index fd0752aee6a..00000000000 --- a/projects/akiba/index.js +++ /dev/null @@ -1,25 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport, nullAddress, } = require('../helper/unknownTokens') - -const Contracts = { - kava: { - wkava: ADDRESSES.kava.WKAVA, - akiba: "0x8f5af8d2E06c976970752b5596BE05Cd518Adcdd", - bank: "0x0CA1088C075E5C9447D5C07984aCCc48c816D01D", // Pool - multiFeeDistribution: "0xa41045953C7fa32CCea9132997b2E7460db5ae3F", // Staking - chef: "0x6b2349b0B2b2b9c1B970a1d0E5AB4226d6Cb78c8", - lps: [ - "0xAd18F4d2087d954989d7b1f728AeE1941F7BC25F", // AKIBA_KAVA_LP - "0xc75Bd803C2671fC4C0d7350C88e8250e9F7E9805", // KAVAX_KAVA_LP - ] - }, -}; - -module.exports = { - deadFrom: '2026-09-30', - kava: { - tvl: sumTokensExport({ owner: Contracts.kava.bank, tokens: [Contracts.kava.wkava, nullAddress] }), - staking: sumTokensExport({ owner: Contracts.kava.multiFeeDistribution, tokens: [Contracts.kava.akiba], useDefaultCoreAssets: true, lps: Contracts.kava.lps}), - pool2: sumTokensExport({ owner: Contracts.kava.chef, tokens: Contracts.kava.lps, useDefaultCoreAssets: true, lps: Contracts.kava.lps}), - }, -}; diff --git a/projects/armsys/index.js b/projects/armsys/index.js index f1805a05fd7..9e2eb5fc427 100644 --- a/projects/armsys/index.js +++ b/projects/armsys/index.js @@ -42,7 +42,7 @@ const RH_POOLS = [ id: '0x53e74184f024eb01ceb7bbde68866bff3cc3ddf378c78745eb52bdd9ad7bcd91', slot0: '0x9c84d52b8bb441beb575d083100f114b0c56b9ce514618366619fcf1f9572272', token0: USDG, - token1: '0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec', // NVDA + token1: ADDRESSES.robinhood.NVDA, // NVDA }, { id: '0x0703d548618b02c35d53acc889c1edb792aabccde3217004cd7dabb604fad3bd', @@ -60,7 +60,7 @@ const RH_POOLS = [ { id: '0xdbd476102c84ca90d501b1330b11e9a6c092ab9a811a7f6a45b1d971872fab13', slot0: '0x73c3182a3e04b5204c9003d01a04aef154cff075754a41d6a39d64992f01a613', - token0: '0x4a0e65a3eccec6dbe60ae065f2e7bb85fae35eea', // SPCX + token0: ADDRESSES.robinhood.SPCX, // SPCX token1: USDG, }, ]; diff --git a/projects/beekava/index.js b/projects/beekava/index.js deleted file mode 100644 index a43fff00615..00000000000 --- a/projects/beekava/index.js +++ /dev/null @@ -1,21 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unknownTokens') - -const WkavaBeekLpAddress = "0x6F95ff58Cdbf17594882E7EF948687aC81c2fEE0"; - -const ERC20ContractWkavaAddress = ADDRESSES.kava.WKAVA; -const ERC20ContractBeekAddress = "0xb520e9C5123A450828c190cb6073583a5ecd0d74"; - -const POL_Pool_One = "0x00635507895D30801f60a2859990420013068ee0"; -const POL_Pool_Two = "0x339522a317E74ac1f7D4d8D9bDc3181a9801416E"; -const POL_Pool_Three = "0x8470991Ce998d336146104549A04690082f2B372"; -const owners = [POL_Pool_One, POL_Pool_Two, POL_Pool_Three,] - -module.exports = { - deadFrom: '2026-09-30', - kava: { - tvl: sumTokensExport({ owners, tokens: [ERC20ContractWkavaAddress] }), - pool2: sumTokensExport({ owners, tokens: [WkavaBeekLpAddress], lps: [WkavaBeekLpAddress], useDefaultCoreAssets: true, }), - staking: sumTokensExport({ owners, tokens: [ERC20ContractBeekAddress], lps: [WkavaBeekLpAddress], useDefaultCoreAssets: true, }), - } -}; diff --git a/projects/blum/api.js b/projects/blum/api.js index 8d4b7956594..4dad69c8150 100644 --- a/projects/blum/api.js +++ b/projects/blum/api.js @@ -3,8 +3,9 @@ const ADDRESSES = require("../helper/coreAssets.json") const { sumTokens } = require("../helper/chain/ton") const { getConfig } = require("../helper/cache") +// tonfunstats is dead (DNS fails) -> getConfig falls back to the cached list of ~370k bonding-curve contracts +// only TON balances are needed, so skip the per-chunk sleep and rely on the sdk's toncenter pacing async function fetchTvl(api) { - throw new Error('There is a bug') const res = await getConfig('blum', 'https://tonfunstats-eqnd7.ondigitalocean.app/api/v1/getServiceTokens?service=blum') await sumTokens({ api, tokens: [ADDRESSES.ton.TON], owners: res, onlyWhitelistedTokens: true, }) } diff --git a/projects/btb-finance/index.js b/projects/btb-finance/index.js index d842148a73d..5e831a5fa3a 100644 --- a/projects/btb-finance/index.js +++ b/projects/btb-finance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getLogs } = require('../helper/cache/getLogs') const { sumTokens2, unwrapSlipstreamNFT, unwrapUniswapV3NFT } = require('../helper/unwrapLPs') @@ -32,10 +33,10 @@ const config = { farms: [], gaugeVoter: '0x16613524e02ad97eDfeF371bC883F2F5d6C480A5', // Aerodrome voter, for gauges found from logs tokens: [ - '0x4200000000000000000000000000000000000006', // WETH - '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC - '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', // cbBTC - '0x940181a94A35A4569E4529A3CDfB74e38FD98631', // AERO + ADDRESSES.optimism.WETH_1, // WETH + ADDRESSES.base.USDC, // USDC + ADDRESSES.ethereum.cbBTC, // cbBTC + ADDRESSES.base.AERO, // AERO ], }, robinhood: { @@ -52,12 +53,12 @@ const config = { farms: [{ chef: '0x60380925A8b1007F70f60A6A42bffE391374B09a', nft: '0xA79F5775b0B49E51202c48DDF03F380FaA96f641' }], // Giga farm voters: [{ voter: '0x7F749fDD351C1Ceed82d76d7699CB631Eb8332a7', nft: '0x07F44c47743A2f36414A82b9F558ECFCf0EEdCEf' }], // UP gauges tokens: [ - '0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73', // WETH - '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168', // USDG + ADDRESSES.robinhood.WETH, // WETH + ADDRESSES.robinhood.USDG, // USDG '0x5BaaeC1B70864f01dbdb747358FF59F2E2cCF7D5', // GIGA '0x57C0E45cB534413D1C20A4240955d6bB250BB4F1', // UP '0xD1e861CC5Eee7eA88649206b74504D78CCD7AEeA', // LUTE - '0x39dbed3a2bd333467115de45665cc57f813c4571', // PONS + ADDRESSES.robinhood.PONS, // PONS ], }, } @@ -112,7 +113,7 @@ async function enumerated(api, target, owners) { async function stakedInGauges(api, voter, owners) { const pools = await api.fetchList({ lengthAbi: 'uint256:length', itemAbi: 'function pools(uint256) view returns (address)', target: voter }) const gauges = (await api.multiCall({ abi: 'function gauges(address) view returns (address)', target: voter, calls: pools })) - .filter(g => g && g !== '0x0000000000000000000000000000000000000000') + .filter(g => g && g !== ADDRESSES.null) const calls = gauges.flatMap(target => owners.map(owner => ({ target, params: [owner] }))) const staked = await api.multiCall({ abi: 'function stakedValues(address) view returns (uint256[])', calls, permitFailure: true }) return staked.flat().filter(id => id != null).map(String) diff --git a/projects/colorpool/index.js b/projects/colorpool/index.js index 771313b86fe..97fce276b67 100644 --- a/projects/colorpool/index.js +++ b/projects/colorpool/index.js @@ -1,13 +1,52 @@ const { get } = require("../helper/http") -module.exports = { - misrepresentedTokens: true, - chromia: { - tvl: async (api) => { - const {data} = await get('https://dex-api-mainnet.colorpool.xyz/pool/list?page=1&limit=2500&sortField=tvl&sortOrder=desc') - let total = 0 - data.forEach(i => total += Number(i.tvl)) - api.addUSDValue(total) +// Colorpool dex chain on Chromia; node list and RID from the dex.colorpool.xyz app config +const BLOCKCHAIN_RID = '19571DCB739CCDDC4BC8B96A01C7BDE9FCC389B566DD1B85737E892695674288' +const NODES = [ + 'https://dapps0.chromaway.com', + 'https://chromia-mainnet.w3coins.io:7740', + 'https://mainnet-dapp1.sunube.net:7740', + 'https://chromia.nocturnallabs.org:7740', +] + +// tokens the coins server prices as chromia: +const PRICED = new Set([ + '5f16d1545a0881f971b164f1601cbbf51c29efd0633b2730da18c403c3b428b5', // CHR + '9bacd576f40b6674aa76b8bfa1330077a3b94f581bfdb2ef806122c384dcdf25', // USDC + '9084de203ef2afc7c6bfd647660aa3265d3b9ef1105139077ed3c81b26e2976e', // ALICE + 'd85153c53bc78c6bf177113c5da873669f97bd46db1ab7411e2f8932c7cdd0a8', // D +]) + +async function query(type, params) { + const qs = new URLSearchParams({ type, ...params }).toString() + let lastError + for (const node of NODES) { + try { + return await get(`${node}/query/${BLOCKCHAIN_RID}?${qs}`) + } catch (e) { + lastError = e } } -} \ No newline at end of file + throw lastError +} + +async function tvl(api) { + const { data: pools } = await query('get_all_pool', { page: 1, page_size: 1000 }) + const { data: assets } = await query('get_all_asset', { page: 1, page_size: 10000 }) + const idBySymbol = Object.fromEntries(assets.map(({ symbol, id }) => [symbol, id.toLowerCase()])) + + // count both reserves when both tokens are priced, else twice the priced side + for (const { token0, token1, reserve0, reserve1 } of pools) { + const id0 = idBySymbol[token0], id1 = idBySymbol[token1] + const priced0 = PRICED.has(id0), priced1 = PRICED.has(id1) + if (priced0 && priced1) { api.add(id0, reserve0); api.add(id1, reserve1) } + else if (priced0) api.add(id0, BigInt(reserve0) * 2n) + else if (priced1) api.add(id1, BigInt(reserve1) * 2n) + } +} + +module.exports = { + timetravel: false, + methodology: 'TVL is the reserves of all Colorpool pools, read from the Colorpool dapp chain on Chromia (get_all_pool). Only priced tokens are counted; for pools with one priced token, that side is doubled.', + chromia: { tvl }, +} diff --git a/projects/cometa/index.js b/projects/cometa/index.js index 4595371d4ba..7a2286b1f98 100644 --- a/projects/cometa/index.js +++ b/projects/cometa/index.js @@ -12,6 +12,7 @@ async function tvl() { } module.exports = { + deadFrom: "2026-10-01", // abandoned? timetravel: false, misrepresentedTokens: true, algorand: { diff --git a/projects/compx/index.js b/projects/compx/index.js index b964dcb2848..fa616b4f0be 100644 --- a/projects/compx/index.js +++ b/projects/compx/index.js @@ -3,6 +3,7 @@ async function tvl() { } module.exports = { + deadFrom: "2025-01-01", misrepresentedTokens: true, algorand: { tvl, diff --git a/projects/cotiTreasury.js b/projects/cotiTreasury.js deleted file mode 100644 index 2cac3fe8a0e..00000000000 --- a/projects/cotiTreasury.js +++ /dev/null @@ -1,15 +0,0 @@ -const http = require("./helper/http"); - -async function staking() { - return { - 'coti': Number((await http.get("https://treasury-app.coti.io/get-total")).totalCotiInPool).toFixed(0), - }; -} - -module.exports = { - timetravel: false, - coti: { - tvl: async ()=> ({}), - staking, - } -}; diff --git a/projects/crossbow/index.js b/projects/crossbow/index.js index 7d62f63e7c4..a461fc84e2d 100644 --- a/projects/crossbow/index.js +++ b/projects/crossbow/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { ethers } = require('ethers') const { getLogs } = require('../helper/cache/getLogs') const { sumTokens2, addUniV3LikePosition, unwrapSlipstreamNFT } = require('../helper/unwrapLPs') @@ -33,8 +34,8 @@ const rangeId = (poolKey, tickLower, tickUpper) => // Everything else the vaults deal in is discovered from their own positions // rather than hardcoded, so a new listing needs no change here. const BASE_TOKENS = [ - '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168', // USDG - '0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73', // WETH + ADDRESSES.robinhood.USDG, // USDG + ADDRESSES.robinhood.WETH, // WETH ] async function tvl(api) { diff --git a/projects/crunchynetwork-wtz/index.js b/projects/crunchynetwork-wtz/index.js deleted file mode 100644 index 89f08ef3ef4..00000000000 --- a/projects/crunchynetwork-wtz/index.js +++ /dev/null @@ -1,24 +0,0 @@ -const { getTezosBalance } = require('../helper/chain/tezos') - -const wtzContracts = [ - "KT1BB3oNr5vUSw1CuPNb2zpYEVp376XrXWaJ", - "KT1H25LW5k4HQGm9hmNXzaxf3nqjsAEhQPah", - "KT1LpGZnT6dj6STSxHXmvSPqx39ZdPXAMpFz", - "KT1NBgqqJacbdoeNAg9MvrgPT9h6q6AGWvFA", - "KT1NGTDBKDPMrAYEufb72CLwuQJ7jU7jL6jD", -] - -async function tvl() { - let tezos = 0 - for (const contract of wtzContracts) - tezos += await getTezosBalance(contract) - return { tezos } -} - -module.exports = { - deadFrom: "2026-01-01", // abandoned - timetravel: false, - tezos: { - tvl - } -} diff --git a/projects/derive-v3/index.js b/projects/derive-v3/index.js index 3e892a70281..d5b3fd84002 100644 --- a/projects/derive-v3/index.js +++ b/projects/derive-v3/index.js @@ -10,10 +10,10 @@ const DRV = '0xB1D1eae60EEA9525032a6DCb4c1CE336a1dE71BE' // https://docs.derive.xyz/getting-started/custom-bridges const TOKEN_MAP = { '0x0762365e088fb8d285b295d782bb7b23690713e2': 'hyperliquid:' + ADDRESSES.hyperliquid.WHYPE, // HYPE OFT - '0xb5ead284cd00fd0eb37e84327a4ee781172a07d6': 'solana:So11111111111111111111111111111111111111112', // SOL OFT - '0xc2908db337aa16fb22b01bd4e8ff91460b23ff4b': 'solana:J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn', // jitoSOL OFT + '0xb5ead284cd00fd0eb37e84327a4ee781172a07d6': 'solana:' + ADDRESSES.solana.SOL, // SOL OFT + '0xc2908db337aa16fb22b01bd4e8ff91460b23ff4b': 'solana:' + ADDRESSES.solana.JitoSOL, // jitoSOL OFT '0x2e3023ca882ee359ebfa69b740be318df1b5cd7c': 'ethereum:' + ADDRESSES.ethereum.cbBTC, // cbBTC OFT from Base - '0x13fd17b60735be034b874e31ef4aed2cd613c9f9': 'flare:0xAd552A648C74D49E10027AB8a618A3ad4901c5bE', // FXRP OFT + '0x13fd17b60735be034b874e31ef4aed2cd613c9f9': 'flare:' + ADDRESSES.flare.FXRP, // FXRP OFT '0x1ebb06ae854f186030a80bb7b3e73d5f22240fd6': 'ethereum:' + ADDRESSES.ethereum.USDC, // Strands.DACAP.BitGo.USDC '0xee70394909906e9b5fe6d19d16b8c07058b06d74': 'ethereum:' + ADDRESSES.ethereum.USDT, // Strands.DACAP.BitGo.USDT } diff --git a/projects/dexlyn-dex/index.js b/projects/dexlyn-dex/index.js index 97cf7b86746..03bf50a8b66 100644 --- a/projects/dexlyn-dex/index.js +++ b/projects/dexlyn-dex/index.js @@ -1,7 +1,8 @@ const sdk = require("@defillama/sdk"); +const axios = require("axios"); const { getAccountAllResources, - invokeViewFunction, + rpcURL, COIN_INFO_STRUCT_TYPE, } = require("../helper/chain/supra"); const { transformBalances } = require("../helper/portedTokens"); @@ -41,11 +42,20 @@ const calculateDexlynTVL = async (api) => { let isCoreAssetX = coreTokens.includes(xCoinType); let isCoreAssetY = coreTokens.includes(yCoinType); if (isCoreAssetX || isCoreAssetY) { - let [reserveX, reserveY] = await invokeViewFunction( - GET_POOL_RESERVE_SIZE_FUNCTION_TYPE, - [xCoinType, yCoinType, curveType], - [] - ); + let reserves; + try { + // called directly (not via helper http.post) so the abort reason in the 400 body is kept + reserves = (await axios.post(`${rpcURL()}/rpc/v1/view`, { + function: GET_POOL_RESERVE_SIZE_FUNCTION_TYPE, + type_arguments: [xCoinType, yCoinType, curveType], + arguments: [], + })).data.result; + } catch (e) { + // locked pools abort get_reserves_size in liquidity_pool::assert_pool_unlocked; skip them + if (String(e?.response?.data?.message).includes("assert_pool_unlocked")) continue; + throw e; + } + let [reserveX, reserveY] = reserves; if (isCoreAssetX && isCoreAssetY) { sdk.util.sumSingleBalance(balances, xCoinType, reserveX); sdk.util.sumSingleBalance(balances, yCoinType, reserveY); diff --git a/projects/ditto-earn/index.js b/projects/ditto-earn/index.js index 36ac770f9d5..be1cb51f168 100644 --- a/projects/ditto-earn/index.js +++ b/projects/ditto-earn/index.js @@ -13,7 +13,7 @@ const RECEIVERS = { '0x7817548BE174C22DecDe831Ea9d514927fD0D286': 25730917, // pilot, Ethereum '0x73e97D42f341713e2ED10E55964C066d924a8106': 26040404, // V2, Ethereum }; -const ZERO = '0x0000000000000000000000000000000000000000'; +const ZERO = ADDRESSES.null; /** Deduplicate custody addresses case-insensitively and exclude the zero address. */ const unique = addresses => [...new Set(addresses.map(address => address.toLowerCase()))].filter(address => address !== ZERO); diff --git a/projects/embr-bridge/index.js b/projects/embr-bridge/index.js deleted file mode 100644 index 69f8bf206bd..00000000000 --- a/projects/embr-bridge/index.js +++ /dev/null @@ -1,18 +0,0 @@ -const { queryV1Beta1V2 } = require('../helper/chain/cosmos.js') - -module.exports = { - timetravel: false, - embr: { - tvl: async () => { - const balances = {} - let supply = await queryV1Beta1V2({ chain: 'embr', url: 'bank/v1beta1/supply', limit: 50 }) - - for (const { denom, amount } of supply) { - if (denom.startsWith('evm/')) { - balances[`embr:${denom.replace('evm/', '0x')}`] = amount - } - } - return balances - }, - }, -} diff --git a/projects/fang/index.js b/projects/fang/index.js index a22a0357dd0..842a2d67043 100644 --- a/projects/fang/index.js +++ b/projects/fang/index.js @@ -9,21 +9,21 @@ const masonryAddress = "0x33Be17082Bd477dC804EdabBa1A8D777Da3F668d"; async function fangGenesisTVL(api) { const tokens = [ - "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73", // WETH - "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168", // USDG + ADDRESSES.robinhood.WETH, // WETH + ADDRESSES.robinhood.USDG, // USDG "0x63C12667638f2Ae6fC6ae09B43D98Ec84a8586eA", // wsNET - "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC", // NVDA + ADDRESSES.robinhood.NVDA, // NVDA "0x117cc2133c37B721F49dE2A7a74833232B3B4C0C", // SPY "0x2E8c31162b855A2ffa90F6F8634643Ad6F111e18", // AI - "0x39dBED3a2bd333467115dE45665cC57F813C4571", // PONS - "0x020bfC650A365f8BB26819deAAbF3E21291018b4", // CASHCAT + ADDRESSES.robinhood.PONS, // PONS + ADDRESSES.robinhood.CASHCAT, // CASHCAT "0x84d6BB25d3b013c784bE60dC598c920588F452bC", // fBOMB "0x96765066f6a040a21EB027167D2315B707c82633", // RVH "0x4e5195469A0360f5dfe811730C9CCaCFF0a0FeeE", // r33 "0x5BaaeC1B70864f01dbdb747358FF59F2E2cCF7D5", // GIGA "0x378A50eaC56f45Fb74e4cE7F1962dbCA33515c14", // MCD "0x9FE4d78202F97E982546Fd5f63E2418FEf8E4ea2", // S33 - "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34", // USDE + ADDRESSES.avax.USDe, // USDE "0xab093dEF657F15dF31b33922A95e047aDd645B29", // SHROOM ] diff --git a/projects/floe-labs/index.js b/projects/floe-labs/index.js index 2311c9a08e5..29b61b3da82 100644 --- a/projects/floe-labs/index.js +++ b/projects/floe-labs/index.js @@ -79,4 +79,5 @@ async function borrowed(api) { module.exports = { methodology: 'TVL is calculated as the total collateral locked in active loans. Borrowed represents the total outstanding loan principal.', base: { tvl, borrowed }, + deadFrom: "2026-10-11", // project pivoted? }; diff --git a/projects/flying-tulip-lend/index.js b/projects/flying-tulip-lend/index.js index a654e6460af..efee60e8646 100644 --- a/projects/flying-tulip-lend/index.js +++ b/projects/flying-tulip-lend/index.js @@ -19,7 +19,7 @@ const RESERVES = { { token: ADDRESSES.ethereum.WBTC, wrapper: '0x1A5730c71576D77048E9FdC79DD40e4B1E8Fe042' }, // WBTC -> ftWBTC { token: '0x5DD1A7A369e8273371d2DBf9d83356057088082c', wrapper: '0x7127BB9d9ad0f47B8dA9087e634D67F3946F840E' }, // FT -> ftFT { token: ADDRESSES.ethereum.WSTETH, wrapper: '0x01980BD1B58313bD3767f6adc75Af8b6464f3db7' }, // wstETH -> ftWstETH (stakedNative) - { token: '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E', wrapper: '0xa41686c6018056b44a7027f4c912e6153cfb5c63' }, // crvUSD -> ftcrvUSD + { token: ADDRESSES.ethereum.CRVUSD, wrapper: '0xa41686c6018056b44a7027f4c912e6153cfb5c63' }, // crvUSD -> ftcrvUSD { token: '0x0655977FEb2f289A4aB78af67BAB0d17aAb84367', wrapper: '0xefab1b1856bbe0b6d78f2552614e34efad1eb6c6' }, // scrvUSD -> ftscrvUSD { token: ADDRESSES.ethereum.USDG, wrapper: '0x8b419a64d95738b3dfcb55a35da7918dfd366bb0' }, // USDG -> ftUSDG { token: ADDRESSES.ethereum.sUSDe, wrapper: '0xbc940f911744670523c3d4ebc56e1e28489591d7' }, // sUSDe -> ftsUSDe @@ -33,7 +33,7 @@ const RESERVES = { { token: ADDRESSES.bsc.FDUSD, wrapper: '0x41cb54680d1baa26b85bc97641854e59964dbe38' }, // FDUSD -> ftFDUSD { token: ADDRESSES.bsc.ETH, wrapper: '0x5625ad05ed1031dceff37b3383fdd17b202a4f74' }, // ETH -> ftETH { token: ADDRESSES.bsc.BTCB, wrapper: '0x440be5cb3663c8d33fd29d5fcf1ad78d684e4dcd' }, // BTCB -> ftBTCB - { token: '0xa2E3356610840701BDf5611a53974510Ae27E2e1', wrapper: '0xfcce797c51da526156b14faa6a9d0e44af570a62' }, // wBETH -> ftwBETH + { token: ADDRESSES.bsc.wBETH, wrapper: '0xfcce797c51da526156b14faa6a9d0e44af570a62' }, // wBETH -> ftwBETH { token: '0x205812CdBed920aFf76C6580abD681a46D11efc7', wrapper: '0xee62f248c22f279a39252727e0a17052d85ac7f6' }, // QQQB -> ftQQQB ], } diff --git a/projects/fndzdao/index.js b/projects/fndzdao/index.js index e7e4a018e45..0a8bc4f52d4 100644 --- a/projects/fndzdao/index.js +++ b/projects/fndzdao/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking') const { getCreateAddress } = require('ethers') const getTrackedAssetsAbi = "address[]:getTrackedAssets" const dispatcher = '0x07036f5385AE6F4049f7788bD960f9Dd7fecC241' const deploymentBlock = 18879113 -const zero = '0x0000000000000000000000000000000000000000' +const zero = ADDRESSES.null async function getVaults(api) { const block = await api.getBlock() diff --git a/projects/funbear/index.js b/projects/funbear/index.js deleted file mode 100644 index 8b661dcecf1..00000000000 --- a/projects/funbear/index.js +++ /dev/null @@ -1,20 +0,0 @@ -const FUNB = 'ethereum:0xd86c0b9b686f78a7a5c3780f03e700dbbad40e01'; -const stakeContractAddresses = { - unlockedStake: '0x1C4f227A2c7F62f88a7907cBF027403603A81A64', - yearlyStake: '0xb991FAeF710f2ae699c425a92482Fc5D3Ae0cCD7', -} - -async function staking(api) { - const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: Object.values(stakeContractAddresses) }) - supplies.forEach(i => api.add(FUNB, i, { skipChain: true })) - return api.getBalances() -} - -module.exports = { - deadFrom: '2026-09-30', - methodology: 'TVL counts staked FUNB coins on the platform itself.', - kava: { - tvl: () => 0, - staking, - } -}; diff --git a/projects/gamutexchange/index.js b/projects/gamutexchange/index.js deleted file mode 100644 index e8cbc541ea7..00000000000 --- a/projects/gamutexchange/index.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - deadFrom: '2026-09-30', - kava: { - tvl, - }, -}; - -async function tvl(api) { - const pools = await api.fetchList({ lengthAbi:'allPoolsLength' , itemAbi: 'allPools', target: '0xbD4C56E952c238389AEE995E1ed504cA646D199B'}) - const poolAbi = "function getPoolTokensAndBalances() view returns (address[] tokens, uint256[] balances)" - const poolDatas = await api.multiCall({ abi: poolAbi, calls: pools }) - const tokens = poolDatas.map(pool => pool.tokens).flat() - return api.sumTokens({ owner: '0x923A7273480e73439b73b065d096c58034968504', tokens,}) -} diff --git a/projects/helper/cex.js b/projects/helper/cex.js index f68d5dc9a82..e529ce8d7d2 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -491,8 +491,8 @@ const defaultTokens = { ], robinhood: [ nullAddress, - '0x39dbed3a2bd333467115de45665cc57f813c4571', // PONS - '0x020bfc650a365f8bb26819deaabf3e21291018b4', // CASHCAT + ADDRESSES.robinhood.PONS, // PONS + ADDRESSES.robinhood.CASHCAT, // CASHCAT ], } diff --git a/projects/helper/chain/algorand.js b/projects/helper/chain/algorand.js index 7b2d7f8ce37..45f40884da2 100644 --- a/projects/helper/chain/algorand.js +++ b/projects/helper/chain/algorand.js @@ -54,7 +54,15 @@ async function sumTokens({ owner, owners = [], tokens = [], token, balances, api if (owner) owners = [owner] if (token) tokens = [token] if (tokensAndOwners.length) owners = tokensAndOwners.map(i => i[1]) - const accounts = await Promise.all(owners.map(getAccountInfo)) + // closed accounts (balance 0, removed from the ledger) 404 on the indexer; they hold nothing, so count them as empty + const accounts = await Promise.all(owners.map(async (owner) => { + try { + return await getAccountInfo(owner) + } catch (e) { + if (/account not found/i.test(e?.message)) return { assets: [] } + throw e + } + })) accounts.forEach(({ assets }, i) => { if (tokensAndOwners.length) tokens = [tokensAndOwners[i][0]] assets.forEach(i => { diff --git a/projects/helper/chain/ton.js b/projects/helper/chain/ton.js index 2ae3d70cdd2..e69cb2405fc 100644 --- a/projects/helper/chain/ton.js +++ b/projects/helper/chain/ton.js @@ -55,13 +55,13 @@ async function getJettonsInfo(tokens) { const sumTokensAccount = rateLimited(_sumTokensAccount) -async function sumTokens({ api, tokens, owners = [], owner, onlyWhitelistedTokens = false, useTonApiForPrices = true }) { +async function sumTokens({ api, tokens, owners = [], owner, onlyWhitelistedTokens = false, useTonApiForPrices = true, sleepMs }) { if (!api) throw new Error('api is required') if (owner) owners.push(owner) owners = getUniqueAddresses(owners, api.chain) - if (tokens.includes(ADDRESSES.null)) await addTonBalances({ api, addresses: owners }) + if (tokens.includes(ADDRESSES.null)) await addTonBalances({ api, addresses: owners, sleepMs }) if (onlyWhitelistedTokens && tokens.length === 1 && tokens.includes(ADDRESSES.ton.TON)) return sumTokens2({ api, }) for (const addr of owners) { @@ -104,18 +104,25 @@ async function addJettonBalances({ api, jettonAddress, addresses, chunkSize = 39 } } -async function addTonBalances({ api, addresses }) { +// toncenter v3 accountStates is GET-only and 414s past ~64k url chars: friendly addresses are 48 chars vs 66 raw, +// so 1200 per request fits (raw form caps out around 600). There is no on-chain multicall on TON. +// sleepMs: extra pause between chunks on top of the sdk's per-service pacing; pass 0 for large lists +async function addTonBalances({ api, addresses, sleepMs = 3000, chunkSize = 1200 }) { api.log('Fetching TON balances', { addresses: addresses.length }) - const chunks = sliceIntoChunks(addresses, 399) + addresses = addresses.map(a => { + try { return ton.normalizeAddress(a) } catch (e) { return a } + }) + const chunks = sliceIntoChunks(addresses, chunkSize) let i = 0 for (const chunk of chunks) { - api.log('Fetching TON balances', { chunk: i++, chunks: chunks.length }) + if (i % 50 === 0) api.log('Fetching TON balances', { chunk: i, chunks: chunks.length }) + i++ const { accounts } = await ton.toncenterGet({ path: 'accountStates', params: { address: chunk.join(','), include_boc: false } }) accounts.forEach(({ balance }) => { api.add(ADDRESSES.null, balance) }) - if (addresses.length > 199) { - await sleep(3000) + if (addresses.length > 199 && sleepMs) { + await sleep(sleepMs) } } } diff --git a/projects/helper/chain/venom.js b/projects/helper/chain/venom.js new file mode 100644 index 00000000000..9adf77cc81b --- /dev/null +++ b/projects/helper/chain/venom.js @@ -0,0 +1,281 @@ +const crypto = require('crypto') +const { post } = require('../http') + +// Venom (Everscale/TVM) has no rpc method to run get-methods, so contract state is read by +// fetching the raw account (bag of cells) over jrpc and decoding the storage cells directly. +const JRPC = 'https://jrpc.venom.foundation/' + +// ---------------------------------------------------------------- bag of cells + +function parseBoc(b64) { + const buf = Buffer.from(b64, 'base64') + let p = 0 + const readUint = (n) => { let v = 0; for (let i = 0; i < n; i++) v = v * 256 + buf[p++]; return v } + if (buf.readUInt32BE(0) !== 0xb5ee9c72) throw new Error('venom: unsupported boc magic') + p = 4 + const flags = buf[p++] + const hasIdx = flags & 0x80 + const sizeBytes = flags & 0x07 + const offBytes = buf[p++] + const cellsNum = readUint(sizeBytes) + const rootsNum = readUint(sizeBytes) + readUint(sizeBytes) // absent + readUint(offBytes) // total cells size + const roots = [] + for (let i = 0; i < rootsNum; i++) roots.push(readUint(sizeBytes)) + if (hasIdx) p += cellsNum * offBytes + + const raw = [] + for (let i = 0; i < cellsNum; i++) { + const d1 = buf[p++], d2 = buf[p++] + const refsNum = d1 & 7 + const dataLen = Math.ceil(d2 / 2) + const data = buf.subarray(p, p + dataLen) + p += dataLen + let bits = Math.floor(d2 / 2) * 8 + if (d2 % 2) { // last byte is padded with a completion tag: a 1 bit followed by zeros + const last = data[dataLen - 1] + let trailing = 0 + while (trailing < 8 && !((last >> trailing) & 1)) trailing++ + bits = (dataLen - 1) * 8 + (7 - trailing) + } + const refs = [] + for (let r = 0; r < refsNum; r++) refs.push(readUint(sizeBytes)) + raw.push({ data, bits, refs }) + } + const cells = raw.map((c) => ({ data: c.data, bits: c.bits, refs: [] })) + raw.forEach((c, i) => { cells[i].refs = c.refs.map((r) => cells[r]) }) + return cells[roots[0]] +} + +class Slice { + constructor(cell) { this.cell = cell; this.pos = 0; this.ref = 0 } + bit() { + if (this.pos >= this.cell.bits) throw new Error('venom: cell underflow') + const b = (this.cell.data[this.pos >> 3] >> (7 - (this.pos & 7))) & 1 + this.pos++ + return b + } + uint(n) { let v = 0n; for (let i = 0; i < n; i++) v = (v << 1n) | BigInt(this.bit()); return v } + skip(n) { this.pos += n } + loadRef() { return this.cell.refs[this.ref++] } + varUint(lenBits) { const len = Number(this.uint(lenBits)); return this.uint(len * 8) } +} + +// AccountStuff TL-B (jrpc returns the account without the account$1 tag) +// -> { balance (nanoVENOM), data (contract storage root cell) } +function parseAccount(cell) { + const s = new Slice(cell) + // addr_std$10 anycast:(Maybe Anycast) workchain:int8 address:bits256 + if (s.uint(2) !== 2n || s.bit()) throw new Error('venom: unexpected account address type') + s.skip(8 + 256) + // StorageInfo: used (cells, bits, public_cells as VarUInteger 7), last_paid:uint32, due_payment:(Maybe Grams) + s.varUint(3); s.varUint(3); s.varUint(3) + s.skip(32) + if (s.bit()) s.varUint(4) + // AccountStorage: last_trans_lt:uint64 balance:CurrencyCollection state:AccountState + s.skip(64) + const balance = s.varUint(4) + if (s.bit()) s.loadRef() // extra currencies + if (!s.bit()) throw new Error('venom: account is not active') + // StateInit: split_depth:(Maybe ## 5) special:(Maybe TickTock) code:(Maybe ^Cell) data:(Maybe ^Cell) ... + if (s.bit()) s.skip(5) + if (s.bit()) s.skip(2) + if (s.bit()) s.loadRef() // code + if (!s.bit()) throw new Error('venom: account has no data') + return { balance, data: s.loadRef() } +} + +// AccountStuff variant that also returns the code cell (needed for code hashes) +function parseAccountWithCode(cell) { + const s = new Slice(cell) + if (s.uint(2) !== 2n || s.bit()) throw new Error('venom: unexpected account address type') + s.skip(8 + 256) + s.varUint(3); s.varUint(3); s.varUint(3) + s.skip(32) + if (s.bit()) s.varUint(4) + s.skip(64) + const balance = s.varUint(4) + if (s.bit()) s.loadRef() + if (!s.bit()) throw new Error('venom: account is not active') + if (s.bit()) s.skip(5) + if (s.bit()) s.skip(2) + const code = s.bit() ? s.loadRef() : null + if (!s.bit()) throw new Error('venom: account has no data') + return { balance, code, data: s.loadRef() } +} + +// ---------------------------------------------------------------- cell hash (ordinary cells) + +function cellDepth(cell) { + if (cell._depth !== undefined) return cell._depth + cell._depth = cell.refs.length ? Math.max(...cell.refs.map(cellDepth)) + 1 : 0 + return cell._depth +} + +function cellHash(cell) { + if (cell._hash) return cell._hash + const fullBytes = Math.floor(cell.bits / 8) + const d1 = cell.refs.length + const d2 = Math.ceil(cell.bits / 8) + fullBytes + const dataLen = Math.ceil(cell.bits / 8) + const data = Buffer.from(cell.data.subarray(0, dataLen)) + if (cell.bits % 8) { // completion tag: 1 bit then zeros + const used = cell.bits % 8 + data[dataLen - 1] = (data[dataLen - 1] & (0xff << (8 - used))) | (1 << (7 - used)) + } + const parts = [Buffer.from([d1, d2]), data] + for (const r of cell.refs) { const d = cellDepth(r); parts.push(Buffer.from([d >> 8, d & 0xff])) } + for (const r of cell.refs) parts.push(cellHash(r)) + cell._hash = crypto.createHash('sha256').update(Buffer.concat(parts)).digest() + return cell._hash +} + +// ---------------------------------------------------------------- ABI 2.2 storage decoding + +function readAddress(s) { + const tag = Number(s.uint(2)) + if (tag === 0) return null // addr_none + if (tag !== 2 || s.bit()) throw new Error('venom: unsupported address encoding') + const wc = Number(BigInt.asIntN(8, s.uint(8))) + return `${wc}:${s.uint(256).toString(16).padStart(64, '0')}` +} + +const typeBits = (type, components) => { + if (type === 'tuple') return components.reduce(([b, r], c) => { + const [cb, cr] = typeBits(c.type, c.components) + return [b + cb, r + cr] + }, [0, 0]) + if (/^u?int\d+$/.test(type)) return [Number(type.match(/\d+/)[0]), 0] + if (type === 'bool') return [1, 0] + if (type === 'address') return [591, 0] + if (type === 'cell' || type === 'bytes' || type === 'string') return [0, 1] + if (type.startsWith('map(')) return [1, 1] + if (type.endsWith('[]')) return [33, 1] + throw new Error(`venom: unsupported abi type ${type}`) +} + +// HashmapE(n, X) node -> [{ key: BigInt, value: Slice }] +function parseHashmap(cell, keyLen) { + const out = [] + const walk = (c, prefix, n) => { + const s = new Slice(c) + let label = 0n, len + if (!s.bit()) { // hml_short$0 len:(Unary ~n) s:(n * Bit) + len = 0 + while (s.bit()) len++ + label = s.uint(len) + } else if (!s.bit()) { // hml_long$10 n:(#<= m) s:(n * Bit) + len = Number(s.uint(Math.ceil(Math.log2(n + 1)))) + label = s.uint(len) + } else { // hml_same$11 v:Bit n:(#<= m) + const v = s.bit() + len = Number(s.uint(Math.ceil(Math.log2(n + 1)))) + label = v ? (1n << BigInt(len)) - 1n : 0n + } + const key = (prefix << BigInt(len)) | label + const rest = n - len + if (rest === 0) return out.push({ key, value: s }) + walk(s.loadRef(), (key << 1n), rest - 1) + walk(s.loadRef(), (key << 1n) | 1n, rest - 1) + } + walk(cell, 0n, keyLen) + return out +} + +function readValue(s, type, components) { + if (/^uint\d+$/.test(type)) return s.uint(Number(type.slice(4))) + if (/^int\d+$/.test(type)) { const n = Number(type.slice(3)); return BigInt.asIntN(n, s.uint(n)) } + if (type === 'bool') return !!s.bit() + if (type === 'address') return readAddress(s) + if (type === 'cell' || type === 'bytes' || type === 'string') return s.loadRef() + if (type === 'tuple') { const v = {}; for (const c of components) v[c.name] = readValue(s, c.type, c.components); return v } + if (type.endsWith('[]')) { // uint32 length + HashmapE(32, T) + const itemType = type.slice(0, -2) + const length = Number(s.uint(32)) + const items = s.bit() ? parseHashmap(s.loadRef(), 32) : [] + const arr = new Array(length) + for (const { key, value } of items) arr[Number(key)] = readMapValue(value, 32, itemType, components) + return arr + } + const m = type.match(/^map\((u?int\d+|address),(.+)\)$/) + if (m) { + if (!s.bit()) return new Map() + const keyLen = m[1] === 'address' ? 267 : Number(m[1].match(/\d+/)[0]) + const entries = parseHashmap(s.loadRef(), keyLen) + return new Map(entries.map(({ key, value }) => [key, readMapValue(value, keyLen, m[2], components)])) + } + throw new Error(`venom: unsupported abi type ${type}`) +} + +// map / array values whose max size does not fit next to the key are stored in a ref; a ref'd tuple is +// laid out like top-level storage (max-size chaining), so it goes through decodeFields +function readMapValue(value, keyLen, type, components) { + const [vBits, vRefs] = typeBits(type, components) + if (keyLen + vBits <= 1023 && vRefs <= 4) return readValue(value, type, components) + const cell = value.loadRef() + return type === 'tuple' ? decodeFields(cell, components) : readValue(new Slice(cell), type, components) +} + +// decode a contract data cell given the ABI `fields` list; tuples are flattened field by field. The +// compiler lays storage out by *max* type sizes (address = 591 bits): once the running max size of a +// cell would exceed 1023 bits / 3 refs, the field continues in the cell referenced by the last ref. +// `until` stops after that field name, so fields past it never need to be supported. +function decodeFields(dataCell, fields, until) { + const flat = [] + const flatten = (list, path) => list.forEach((f) => f.type === 'tuple' + ? flatten(f.components, [...path, f.name]) + : flat.push({ ...f, path: [...path, f.name] })) + flatten(fields, []) + + let s = new Slice(dataCell) + let usedBits = 0, usedRefs = 0 + const result = {} + for (const f of flat) { + const [maxBits, maxRefs] = typeBits(f.type, f.components) + if (usedBits + maxBits > 1023 || usedRefs + maxRefs > 3) { + if (!s.cell.refs.length) throw new Error('venom: storage ended early') + s = new Slice(s.cell.refs[s.cell.refs.length - 1]) + usedBits = 0 + usedRefs = 0 + } + usedBits += maxBits + usedRefs += maxRefs + let target = result + f.path.slice(0, -1).forEach((p) => { target = target[p] = target[p] ?? {} }) + target[f.path[f.path.length - 1]] = readValue(s, f.type, f.components) + if (f.path.join('.') === until) break + } + return result +} + +async function getAccount(address, { withCode = false } = {}) { + const { result, error } = await post(JRPC, { jsonrpc: '2.0', id: 1, method: 'getContractState', params: { address } }) + if (error) throw new Error(`venom: getContractState failed for ${address}: ${error.message}`) + if (result?.type !== 'exists') throw new Error(`venom: account ${address} does not exist`) + const cell = parseBoc(result.account) + return withCode ? parseAccountWithCode(cell) : parseAccount(cell) +} + +// every account deployed with the given code (hex code hash), paginated with the jrpc continuation cursor +async function getAccountsByCodeHash(codeHash) { + const all = [] + let continuation + do { + const { result, error } = await post(JRPC, { jsonrpc: '2.0', id: 1, method: 'getAccountsByCodeHash', params: { codeHash, limit: 100, ...(continuation && { continuation }) } }) + if (error) throw new Error(`venom: getAccountsByCodeHash failed: ${error.message}`) + all.push(...result) + continuation = result.length === 100 ? result[result.length - 1] : undefined + } while (continuation) + return all +} + +module.exports = { + getAccount, + getAccountsByCodeHash, + cellHash, + decodeFields, + parseBoc, + parseAccount, + Slice, +} diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 2b0659d36d2..bc13167bc8f 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1303,7 +1303,8 @@ "eUSDT": "0x96b41289d90444b8add57e6f265db5ae8651df29", "sFLR": "0x12e605bc104e93b45e1ad99f9e555f659051c2bb", "USDT0": "0xe7cd86e13ac4309349f30b3435a9d337750fc82d", - "USDC_e": "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6" + "USDC_e": "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6", + "FXRP": "0xad552a648c74d49e10027ab8a618a3ad4901c5be" }, "ibc": { "JUNO": "EFF323CC632EC4F747C61BCE238A758EFDB7699C3226565F7C20DA06509D59A5", @@ -2253,6 +2254,7 @@ "HSUITE": "0x00000000000000000000000000000000000c01f3" }, "etica": { + "WEGAZ": "0x232fb2B87CAce92B2438054A7eB79B4081E3E11a", "ETI": "0x34c61EA91bAcdA647269d4e310A86b875c09946f" }, "morph": { @@ -2606,6 +2608,7 @@ }, "nibiru": { "NIBI": "unibi", + "WNIBI": "0x0CaCF669f8446BeCA826913a3c6B96aCD4b02a97", "USDC": "0x0829F361A05D993d5CEb035cA6DF3446b060970b", "USDT": "0x43F2376D5D03553aE72F4A8093bbe9de4336EB08", "WETH": "0xcdA5b77E2E2268D9E09c874c1b9A4c3F07b37555" @@ -2767,6 +2770,7 @@ "WVTCN": "0x1150fd1335b0a53347f8bfb763729a99fbeab2ef" }, "zigchain": { + "uzig": "uzig", "azig": "azig" }, "monad": { @@ -2829,6 +2833,24 @@ "WQIE": "0x0087904D95BEe9E5F24dc8852804b547981A9139" }, "robinhood": { + "PONS": "0x39dBED3a2bd333467115dE45665cC57F813C4571", + "CASHCAT": "0x020bfC650A365f8BB26819deAAbF3E21291018b4", + "AAPL": "0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9", + "AMD": "0x86923f96303D656E4aa86D9d42D1e57ad2023fdC", + "AMZN": "0x12f190a9F9d7D37a250758b26824B97CE941bF54", + "GOOGL": "0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3", + "META": "0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35", + "MRNA": "0x43B07D15cE533bEc5476d70C22a78a1B2B662155", + "MSTR": "0xec262a75e413fAfD0dF80480274532C79D42da09", + "MU": "0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD", + "NVDA": "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC", + "ON": "0xbBD09F72b025360FeE5C928053Dca6248d35be54", + "SKHY": "0x84CAb63bc87912E71ad199ff14A0bA45de68FeF8", + "SNDK": "0xB90A19fF0Af67f7779afF50A882A9CfF42446400", + "SPCX": "0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa", + "TSLA": "0x322F0929c4625eD5bAd873c95208D54E1c003b2d", + "USO": "0xa30FA36Db767ad9eD3f7a60fC79526fB4d56D344", + "WYFI": "0x9e7ABD3C9139D14E4c86DcE0e455AAB7A0C2FB3E", "WETH": "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73", "USDe": "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34", "USDG": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168" diff --git a/projects/helper/unknownTokens.js b/projects/helper/unknownTokens.js index 3cb7c9309ef..66ce8efc20f 100644 --- a/projects/helper/unknownTokens.js +++ b/projects/helper/unknownTokens.js @@ -179,7 +179,7 @@ function masterchefExports({ chain, masterchef, coreAssets = [], nativeTokens = const tokens = data.map(({ output }) => getToken(output).toLowerCase()) const tokenLPs = [...tokens].filter(i => !nativeTokens.includes(i)) - const tempBalances = await sumTokens2({ chain, block, owner: masterchef, tokens, transformAddress: a => a, blacklistedTokens, skipFixBalances: true, }) + const tempBalances = await sumTokens2({ chain, block, owner: masterchef, tokens, transformAddress: a => a, blacklistedTokens, skipFixBalances: true, permitFailure: true, }) nativeTokens.forEach(nativeToken => { if (tempBalances[nativeToken]) sdk.util.sumSingleBalance(balances.staking, transform(nativeToken), tempBalances[nativeToken]) delete tempBalances[nativeToken] diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 8568115dd20..5382ae9d135 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -690,11 +690,11 @@ const gasTokenSet = new Set(gasTokens) // ERC-20 views of the native coin: balanceOf returns the same number as eth_getBalance, so they are // read as the native balance and deduped per owner, otherwise listing both counts the coin twice const nativeTokenAliases = { - polygon: '0x0000000000000000000000000000000000001010', // POL (MRC20) - celo: '0x471ece3750da237f93b8e339c536989b8978a438', // CELO (GoldToken) - metis: '0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000', // METIS - arc: '0x3600000000000000000000000000000000000000', // USDC (6 decimals, native is 18) - stable: '0x779ded0c9e1022225f8e0630b35a9b54be713736', // USDT0 (6 decimals, native is 18) + polygon: ADDRESSES.polygon.WMATIC_1, // POL (MRC20) + celo: ADDRESSES.celo.CELO, // CELO (GoldToken) + metis: ADDRESSES.metis.Metis, // METIS + arc: ADDRESSES.arc.USDC, // USDC (6 decimals, native is 18) + stable: ADDRESSES.xlayer.USDT0, // USDT0 (6 decimals, native is 18) } /* tokensAndOwners [ diff --git a/projects/hinkal/registryTokens.js b/projects/hinkal/registryTokens.js index 6a6ccdebd72..480f0290f42 100644 --- a/projects/hinkal/registryTokens.js +++ b/projects/hinkal/registryTokens.js @@ -1710,14 +1710,14 @@ const ROBINHOOD_REGISTRY_TOKENS = [ ADDRESSES.swellchain.ENA, // ENA "0xc6911796042b15d7Fa4F6CDe69e245DdCd3d9c31", // VIRTUAL "0x8f86a15EC17cb3369d8b3E666dAdBC11daA82b79", // APE - "0x322F0929c4625eD5bAd873c95208D54E1c003b2d", // TSLA - "0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9", // AAPL - "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC", // NVDA - "0x12f190a9F9d7D37a250758b26824B97CE941bF54", // AMZN + ADDRESSES.robinhood.TSLA, // TSLA + ADDRESSES.robinhood.AAPL, // AAPL + ADDRESSES.robinhood.NVDA, // NVDA + ADDRESSES.robinhood.AMZN, // AMZN "0xe93237C50D904957Cf27E7B1133b510C669c2e74", // MSFT - "0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3", // GOOGL - "0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35", // META - "0xec262a75e413fAfD0dF80480274532C79D42da09", // MSTR + ADDRESSES.robinhood.GOOGL, // GOOGL + ADDRESSES.robinhood.META, // META + ADDRESSES.robinhood.MSTR, // MSTR "0x117cc2133c37B721F49dE2A7a74833232B3B4C0C", // SPY "0x0f17206447090e464C277571124dD2688E48AEA9", // QCOM ]; diff --git a/projects/ifpool/index.js b/projects/ifpool/index.js deleted file mode 100644 index bc1ef673ea1..00000000000 --- a/projects/ifpool/index.js +++ /dev/null @@ -1,21 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') - -const validatorContract = ADDRESSES.findora.FRA; -const validatorAddress = "0xb0dC7A676Ab09868eBef78E16e6AEA9e79F0f9Cf"; - -async function coinexTVL(api) { - const validatorInfo = await api.call({ - target: validatorContract, - abi: 'function getValidatorInfo(address validator) view returns (address, uint8, uint256, uint256, uint256, uint256, address[])', - params: [validatorAddress], - }); - api.add(ADDRESSES.findora.WCET, validatorInfo[2]) -} - -module.exports = { - methodology: "Counts staked CET tokens.", - timetravel: false, - csc: { - tvl: coinexTVL, - }, -}; diff --git a/projects/iotabee/index.js b/projects/iotabee/index.js deleted file mode 100644 index e26529ff226..00000000000 --- a/projects/iotabee/index.js +++ /dev/null @@ -1,13 +0,0 @@ -const { getConfig } = require('../helper/cache') -const { sumTokens2 } = require('../helper/unwrapLPs') - -const tvl = async (api) => { - const contracts = await getConfig('iotabee', 'https://dex.iotabee.com/v3/pools/overview') - return sumTokens2({ api, ownerTokens: contracts.map(({ token0, token1, contract }) => [[token0, token1,], contract]) }) -} - -module.exports = { - shimmer_evm: { - tvl - } -} diff --git a/projects/izumi/api.js b/projects/izumi/api.js index d58b9aa2d9e..f1a3d27a15b 100644 --- a/projects/izumi/api.js +++ b/projects/izumi/api.js @@ -1,8 +1,18 @@ const { unwrapNFTs } = require('./utils') const { getConfig: getConfigCache } = require('../helper/cache') +const { get } = require('../helper/http') +// the api answers failures with HTTP 200 + { is_success: false, data: {} }; throwing on those keeps getConfig +// from caching the error over the last good farm list (it fell back to the cache instead) async function getConfig(chainId) { - const data = await getConfigCache('izumi-liquidbox/'+chainId, `https://izumi.finance/api/v1/farm/compute?chainId=${chainId}`); + const data = await getConfigCache('izumi-liquidbox/' + chainId, undefined, { + fetcher: async () => { + const res = await get(`https://api.izumi.finance/api/v1/farm/compute?chainId=${chainId}`) + if (!res?.is_success || !res.data?.contracts) throw new Error(`izumi farm api error for ${chainId}: ${res?.error_code}`) + return res + } + }); + if (!data?.data?.contracts) throw new Error(`izumi farm config unavailable for chain ${chainId} (api failing, no good cached copy)`) return data.data; } @@ -16,6 +26,7 @@ const chains = { }; module.exports = { + deadFrom: "2026-09-30", // farms sunset? // ownTokens: ['IZI', 'IUSD'], } diff --git a/projects/izumi/index.js b/projects/izumi/index.js index 7c8ad5b8be1..4cce17b2854 100644 --- a/projects/izumi/index.js +++ b/projects/izumi/index.js @@ -41,6 +41,7 @@ function getTvl(chain, isPool2) { const chainKeys = Object.keys(indexExports).filter(chain => typeof indexExports[chain] === 'object' && indexExports[chain].tvl) module.exports = { + deadFrom: "2026-09-30", // farms sunset? timetravel: false, misrepresentedTokens: true, ...getExports("izumi", chainKeys, ['pool2']), diff --git a/projects/jupiter-lend/index.js b/projects/jupiter-lend/index.js index d6cdd9e76b1..f42d459dd1f 100644 --- a/projects/jupiter-lend/index.js +++ b/projects/jupiter-lend/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getConfig } = require('../helper/cache') const { getProvider, sumTokens2, getTokenAccountBalances } = require('../helper/solana') const { Program } = require("@coral-xyz/anchor"); @@ -26,7 +27,7 @@ const EXCHANGE_PRICE_PRECISION = 1e12 // these deposits are already counted in ethena's TVL const ETHENA_ATOKEN_ACCOUNTS = { '6ZaKSZfYLUvbWqDmHKWWZ7wtUo8aMidvE6k8U2oMXvjf': '2u1tszSeqZ3qBWF3uNGPFc8TzMk2tdiwknnRMWGWjGWH', // jUSDG -> USDG - '5pQu76BCLqLuePsdTdkRKsZA1Ch5YxahGBmHuPxUu1Da': '2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo', // jPYUSD -> PYUSD + '5pQu76BCLqLuePsdTdkRKsZA1Ch5YxahGBmHuPxUu1Da': ADDRESSES.solana.PYUSD, // jPYUSD -> PYUSD } async function tvl(api) { const tokenReserves = await getData(); diff --git a/projects/kaDefi/index.js b/projects/kaDefi/index.js deleted file mode 100644 index 34c3facfd37..00000000000 --- a/projects/kaDefi/index.js +++ /dev/null @@ -1,18 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unknownTokens'); - -const WkavaKafiLpAddress = "0xA4Bea6f776f483a304FD6980F8F8c861AB24DE07"; -const ERC20ContractWkavaAddress = ADDRESSES.kava.WKAVA; -const ERC20ContractKafiAddress = "0x7356deD08af181869B492fcd641f4aEfB74De3E7"; -const POL_Pool_One = "0xdf65B85E43dBa1F153325e7e4A0682B7DeBBFe0f"; -const POL_Pool_Two = "0x738d2b4b59A0A3AA4086bC44C40a45845bB73FCC"; - -module.exports = { - deadFrom: '2026-09-30', - kava: { - tvl: sumTokensExport({ owners: [POL_Pool_One, POL_Pool_Two], tokens: [ERC20ContractWkavaAddress], }), - staking: sumTokensExport({ owners: [POL_Pool_One, POL_Pool_Two], tokens: [ERC20ContractKafiAddress], useDefaultCoreAssets: true, lps: [WkavaKafiLpAddress], }), - } -}; - - diff --git a/projects/kaleido-lending/index.js b/projects/kaleido-lending/index.js index 3f10c3119e9..4625b8dd21c 100644 --- a/projects/kaleido-lending/index.js +++ b/projects/kaleido-lending/index.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') // Kaleido lending: a peer-to-peer market on an EIP-2535 diamond. Borrowers post collateral (EURC, cirBTC), // lenders list native USDC; the diamond holds both until loans are drawn/repaid. const DIAMOND = '0xE4e7f16DB22e6bb2E505fbC504d7B2B4B995A6E3' -const SENTINEL = '0x0000000000000000000000000000000000000001' // how the market registers native USDC +const SENTINEL = ADDRESSES.linea.WETH_1 // how the market registers native USDC const abi = { getAllCollateralToken: 'function getAllCollateralToken() view returns (address[])', diff --git a/projects/kaleido-swap/index.js b/projects/kaleido-swap/index.js index 1c3138f1aa6..bfd4f8a04bc 100644 --- a/projects/kaleido-swap/index.js +++ b/projects/kaleido-swap/index.js @@ -10,8 +10,8 @@ const LENDING = '0xE4e7f16DB22e6bb2E505fbC504d7B2B4B995A6E3' // Kaleido lending const WRAPPED_NATIVE = '0x8c6c0A4C5500c2bC196383B4D85feb7f08a5C75b' const FEES = [100, 500, 3000, 10000] -const ZERO = '0x0000000000000000000000000000000000000000' -const SENTINEL = '0x0000000000000000000000000000000000000001' +const ZERO = ADDRESSES.null +const SENTINEL = ADDRESSES.linea.WETH_1 // Pools are found with the factory's getPool for every pair of known Arc tokens (DefiLlama's Arc core assets plus // every token the Kaleido lending market has registered), in one batched call. Event logs are not used: Arc's public diff --git a/projects/kavastarter/index.js b/projects/kavastarter/index.js deleted file mode 100644 index e09560e3ff2..00000000000 --- a/projects/kavastarter/index.js +++ /dev/null @@ -1,19 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unknownTokens'); - -const KAST_LP = "0x821dd423c744cAa452C0Ae1651a9388009efbE5b"; - -const WKAVA = ADDRESSES.kava.WKAVA; -const KAVASTARTER = "0x32a57dCa514Cc601d3DDEe974f57Db9Dc2CfE83b"; - -const POL_Pool_One = "0x12450E12A7eC069b51b46C92Ac122D90DbD9A99D"; -const POL_Pool_Two = "0x9aedc0D09E0Ede60Ba5B5F969a955937af024c44"; -const POL_Pool_Three = "0x486F6f8cF46EC5CC584ec3f08C494E55a8484111"; - -module.exports = { - deadFrom: '2026-09-30', - kava: { - tvl: sumTokensExport({ owners: [POL_Pool_One, POL_Pool_Two], tokens: [WKAVA] }), - staking: sumTokensExport({ owner: POL_Pool_Three, tokens: [KAVASTARTER], lps: [KAST_LP], useDefaultCoreAssets: true, }) - } -}; diff --git a/projects/kinetix/index.js b/projects/kinetix/index.js deleted file mode 100644 index 2d2cc2e41b6..00000000000 --- a/projects/kinetix/index.js +++ /dev/null @@ -1,13 +0,0 @@ -const { gmxExports } = require('../helper/gmx') -const { staking } = require('../helper/staking'); - -const KAI_ADDRESS_KAVA = "0x52369B1539EA8F4e1eadEEF18D85462Dcf9a3658" -const veKAI_ADDRESS_KAVA = "0x2A0A26D08E2F7A8E86431Ddf6910Fe7cD59b9908" - -module.exports = { - deadFrom: '2026-09-30', - kava: { - tvl: gmxExports({ vault: "0xa721f9f61CECf902B2BCBDDbd83E71c191dEcd8b", }), - staking: staking(veKAI_ADDRESS_KAVA, KAI_ADDRESS_KAVA), - }, -}; \ No newline at end of file diff --git a/projects/kmex-io/index.js b/projects/kmex-io/index.js deleted file mode 100644 index c43aa64d1a1..00000000000 --- a/projects/kmex-io/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const { gmxExports } = require('../helper/gmx') -const { sumTokensExport } = require("../helper/unknownTokens") - -// Kava -const kmexVault = '0x15B29830D5bE7240c7a401fe0B0dA5086C9d84c5'; -const kmexStaking = '0x71dDDafFb0DB6BEDc9495Ef92c5700ec96527BFb'; // Staked KMX, sKMX -const kavaKMX = '0x599b05875866ceB7378452D9F432d5377825F44B'; -const kavaKMXKAVAPool = '0xA08848E7A4dbaEeE8eeAb93a05F437ed9Efa2162' - -module.exports = { - deadFrom: '2026-09-30', - kava: { - staking: sumTokensExport({ owner: kmexStaking, tokens: [kavaKMX],lps: [kavaKMXKAVAPool], useDefaultCoreAssets: true, }), - tvl: gmxExports({ vault: kmexVault, }) - }, -}; diff --git a/projects/lodestar-protocol/index.js b/projects/lodestar-protocol/index.js index e4f5a41d1ec..5c990d6092f 100644 --- a/projects/lodestar-protocol/index.js +++ b/projects/lodestar-protocol/index.js @@ -26,7 +26,7 @@ const BOOK = '0x9b479f47ef25E0Ed2134F38d3c4e1022A8695ed8' // LodestarLoanBook // ---- verified Flare mainnet token addresses (fork-proven in the audit) ---- const USDT0 = ADDRESSES.flare.USDT0 // 6dp - pool asset / borrow currency -const FXRP = '0xAd552A648C74D49E10027AB8a618A3ad4901c5bE' // 6dp - XRP (FAssets) +const FXRP = ADDRESSES.flare.FXRP // 6dp - XRP (FAssets) const SFLR = ADDRESSES.flare.sFLR // 18dp - Sceptre staked FLR (LST) const STXRP = '0x4c18ff3c89632c3dd62e796c0afa5c07c4c1b2b3' // 6dp - Firelight staked XRP (LST) diff --git a/projects/mangrove/index.js b/projects/mangrove/index.js deleted file mode 100644 index 1651bd6902e..00000000000 --- a/projects/mangrove/index.js +++ /dev/null @@ -1,69 +0,0 @@ -const abi = { - "openMarkets": "function openMarkets() view returns ((address,address,uint256)[])", - "offerList": "function offerList((address,address,uint256),uint256,uint256) view returns (uint256,uint256[],(uint256,uint256,int256,uint256)[])" - }; -const { BigNumber } = require("bignumber.js"); - -const mgvReaders = { - blast: "0x26fD9643Baf1f8A44b752B28f0D90AEBd04AB3F8", - arbitrum: "0x7E108d7C9CADb03E026075Bf242aC2353d0D1875", -}; - -const getOffers = async (api, mgvReader, { tkn0, tkn1, tickSpacing }) => { - let total = BigNumber(0); - let currentId = 0; - do { - const [newCurrId, _, offers] = await api.call({ - target: mgvReader, - abi: abi.offerList, - params: [[tkn0, tkn1, tickSpacing], currentId, 100], - }); - - for (let i = 0; i < offers.length; i++) { - const [_1, _2, _3, gives] = offers[i]; - - total = total.plus(BigNumber(gives)); - } - - currentId = Number(newCurrId); - } while (currentId !== 0); - - return total; -}; - -async function getMangroveTVL(api, mgvReader) { - const markets = await api.call({ - target: mgvReader, - abi: abi.openMarkets, - }); - - for (const market of markets) { - const [tkn0, tkn1, tickSpacing] = market; - const tkn0TPV = await getOffers(api, mgvReader, { - tkn0, - tkn1, - tickSpacing, - }); - const tkn1TPV = await getOffers(api, mgvReader, { - tkn0: tkn1, - tkn1: tkn0, - tickSpacing, - }); - - api.addTokens([tkn0, tkn1], [tkn0TPV, tkn1TPV]); - } -} - -module.exports = { - misrepresentedTokens: false, - methodology: - "TVL is calculated by getting the total promised liquidity on the orderbook on a specific block.", - start: '2024-02-27', - deadFrom: '2025-02-27', -}; - -for (const chain in mgvReaders) { - module.exports[chain] = { - tvl: (api) => getMangroveTVL(api, mgvReaders[chain]), - }; -} diff --git a/projects/merryforge/index.js b/projects/merryforge/index.js index 3d33a64d6a2..2b8f31db33f 100644 --- a/projects/merryforge/index.js +++ b/projects/merryforge/index.js @@ -14,9 +14,9 @@ const VIRTUAL = '0xc6911796042b15d7Fa4F6CDe69e245DdCd3d9c31' // first-wave Stock Token native-raise quotes const STOCK_NATIVE_RAISE = [ - '0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9', // AAPL - '0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC', // NVDA - '0x322F0929c4625eD5bAd873c95208D54E1c003b2d', // TSLA + ADDRESSES.robinhood.AAPL, // AAPL + ADDRESSES.robinhood.NVDA, // NVDA + ADDRESSES.robinhood.TSLA, // TSLA '0x117cc2133c37B721F49dE2A7a74833232B3B4C0C', // SPY '0xe93237C50D904957Cf27E7B1133b510C669c2e74', // MSFT ] diff --git a/projects/metric/index.js b/projects/metric/index.js deleted file mode 100644 index 0cdfe65e0ee..00000000000 --- a/projects/metric/index.js +++ /dev/null @@ -1,46 +0,0 @@ -const { getLogs2 } = require('../helper/cache/getLogs') - -// Metric's first-generation MetricOmmPoolFactory (CreateX, same address on every -// chain). Pools are discovered from its PoolCreated events; each pool holds its -// own token0/token1 reserves, so TVL is the sum of both balances per pool. -// The previous version of this adapter read the pool list from a Metric API that -// has since been shut down; the on-chain scan replaces it 1:1. -// https://etherscan.io/address/0xe22F9fc0f04486dE25ed6CF1800a4a47aFD82e0C -// https://basescan.org/address/0xe22F9fc0f04486dE25ed6CF1800a4a47aFD82e0C -const FACTORY = '0xe22F9fc0f04486dE25ed6CF1800a4a47aFD82e0C' - -const POOL_CREATED_EVENT = 'event PoolCreated(address indexed token0, address indexed token1, address indexed priceProvider, address pool, bytes32 poolId)' - -// fromBlock = factory deployment block per chain; the same values drive the -// volume adapter for this factory (DefiLlama/dimension-adapters, dexs/metric). -const config = { - ethereum: { fromBlock: 24521317 }, - base: { fromBlock: 42570144 }, - arbitrum: { fromBlock: 435210755 }, - bsc: { fromBlock: 82964761 }, - avax: { fromBlock: 78822864 }, - polygon: { fromBlock: 83380134 }, - megaeth: { fromBlock: 9083666 }, - hyperliquid: { fromBlock: 30774348 }, - monad: { fromBlock: 64807339 }, - robinhood: { fromBlock: 9477535 }, -} - -Object.keys(config).forEach(chain => { - const { fromBlock } = config[chain] - module.exports[chain] = { - tvl: async (api) => { - const logs = await getLogs2({ api, target: FACTORY, eventAbi: POOL_CREATED_EVENT, fromBlock }) - const ownerTokens = logs.map(({ token0, token1, pool }) => [[token0, token1], pool]) - return api.sumTokens({ ownerTokens }) - }, - } -}) - -module.exports.methodology = 'TVL is the sum of token0 and token1 balances held by every pool created by the Metric pool factory. Pools are discovered on-chain from the factory PoolCreated events.' - -// The first-generation factory was decommissioned on 2026-10-07: its pools were -// drained (TVL went from ~$1.0M to ~$3.7k by 2026-10-08) and their price -// providers switched off. The live Metric pools belong to the factory tracked -// by projects/metric-v1. -module.exports.deadFrom = '2026-10-08' diff --git a/projects/movefast/index.js b/projects/movefast/index.js index 281dbe75f33..90ccd97b51c 100644 --- a/projects/movefast/index.js +++ b/projects/movefast/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { GraphQLClient } = require("graphql-request"); const { getResources } = require("../helper/chain/aptos"); diff --git a/projects/myso/index.js b/projects/myso/index.js index c1ba6133ea7..46be326035c 100644 --- a/projects/myso/index.js +++ b/projects/myso/index.js @@ -1,63 +1,15 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); -const zlib = require("zlib"); -const { getCache, setCache, } = require("../helper/cache"); -const { get } = require("../helper/http"); -const mapChainToChainId = { - ethereum: 1, - arbitrum: 42161, -}; - -const brotliDecode = (stream) => { - return new Promise((resolve, reject) => { - let responseBuffer = []; - - stream.on("data", function handleStreamData(chunk) { - responseBuffer.push(chunk); - }); - - stream.on("error", function handleStreamError(err) { - reject(err); - }); - - stream.on("end", function handleStreamEnd() { - let responseData = Buffer.concat(responseBuffer); - - responseData = responseData.toString("utf8"); - - resolve(JSON.parse(responseData)); - }); - }); -}; - -const getPools = async (chainId) => { - const response = await get( - `https://api.myso.finance/chainIds/${chainId}/pools`, - { - decompress: false, - responseType: "stream", - transformResponse: (data) => { - return data.pipe(zlib.createBrotliDecompress()); - }, - } - ); - - const data = await brotliDecode(response); - - return data.pools.map((pool) => pool.poolAddress); -}; +// api.myso.finance (pool list) is gone; these are the ethereum pools it last returned +const pools = [ + "0x15315dFc9E2Cc4F7F5456323Ab7010a1A74a337d", + "0x9E29CE780eA28Ba83053b78473c19544F75c1113", + "0xb339953fC028B9998775C00594a74Dd1488eE2c6", + "0x331C54fD17A54dCdDb0215b9f02390cef7c7eE8F", + "0xEA9134ad24795549580C7c542134a670D0D19433", +]; async function tvl(api) { - const { chain } = api - const chainId = mapChainToChainId[chain]; - let pools - try { - pools = await getPools(chainId) - await setCache('myso', chainId, pools) - } catch (e) { - pools = await getCache('myso', chainId) - } - const data = await api.multiCall({ abi: "function getPoolInfo() view returns (address _loanCcyToken, address _collCcyToken, uint256 _maxLoanPerColl, uint256 _minLoan, uint256 _loanTenor, uint256 _totalLiquidity, uint256 _totalLpShares, uint256 _baseAggrBucketSize, uint256 _loanIdx)", calls: pools, @@ -68,7 +20,7 @@ async function tvl(api) { [data[i]._collCcyToken, owner], ]) .flat(); - return sumTokens2({ api, tokensAndOwners: toa, chain }); + return sumTokens2({ api, tokensAndOwners: toa }); } module.exports = { diff --git a/projects/orchard/index.js b/projects/orchard/index.js index a595e2b9462..4d57c323890 100644 --- a/projects/orchard/index.js +++ b/projects/orchard/index.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') -const AAPL = '0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9' // Apple stock token issued by Robinhood +const AAPL = ADDRESSES.robinhood.AAPL // Apple stock token issued by Robinhood const SEED = '0x5eED45d9cD4c21280db5b190D9c263f086401b9D' // Orchard's own token const ORCHARD_V1 = '0xEbB8b167c0992cFdc497A995a8Cf7167acAA0A1A' const ORCHARD_V2 = '0x86510b3df745C67a993A66CB08720Ed158d44549' // live since 2026-09-03; v1 stays open for claims diff --git a/projects/phos-launchpad/index.js b/projects/phos-launchpad/index.js index 84377ab398a..b361779abd7 100644 --- a/projects/phos-launchpad/index.js +++ b/projects/phos-launchpad/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getLogs2 } = require('../helper/cache/getLogs') const { nullAddress } = require('../helper/tokenMapping') const FACTORY = '0xc5DF918b40BeAad05bd84F88FD39550AedEB4c71' -const XEF = '0x80252C2D06bbd85699c555fc3633D5B8eE67C9AD' +const XEF = ADDRESSES.xp.XEF const LaunchCreated = 'event LaunchCreated(address indexed launch, address indexed creator, bytes params, uint256 time)' diff --git a/projects/pumper-protocol/index.js b/projects/pumper-protocol/index.js index 8dd4c9f48ab..234f772009b 100644 --- a/projects/pumper-protocol/index.js +++ b/projects/pumper-protocol/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') // Pumper Protocol (pumper.tools) on Stable. @@ -18,7 +19,7 @@ const REGISTRY = '0x7Cd190e5Ba34C1Ec8FE07F78EddB026719940492' const V4_POOL_MANAGER = '0x3F95674d4C0c2FB1525DA536e0A57f4A86902665' const PUMPER = '0xd86800D5b021F5D79350C2F742Bbb1ecc010Bf82' -const USDT0 = '0x779Ded0c9e1022225f8E0630b35a9b54bE713736' +const USDT0 = ADDRESSES.xlayer.USDT0 const WGUSDT = '0x817997Ca8394E26CCE3dE3A076a4889b27DbF9dE' const QUOTE_TOKENS = [USDT0, WGUSDT] // PumperRewardLocker: staked PUMPER diff --git a/projects/pxswap/index.js b/projects/pxswap/index.js deleted file mode 100644 index 5ec0243e6d1..00000000000 --- a/projects/pxswap/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk') -const { sumTokensExport } = require('../helper/unwrapLPs') - -const contract = "0x638B06F80FB28F109E65C9d5cC585aDf9A0c3f9f" -const usdcToken = "0xfa9343c3897324496a05fc75abed6bac29f8a40f" - -module.exports = { - deadFrom: '2026-09-30', - kava: { tvl: sumTokensExport({ owner: contract, tokens: [usdcToken]}) }, -} diff --git a/projects/quicksilver/index.js b/projects/quicksilver/index.js deleted file mode 100644 index f866bfb97b2..00000000000 --- a/projects/quicksilver/index.js +++ /dev/null @@ -1,43 +0,0 @@ -const sdk = require("@defillama/sdk"); -const { get } = require("../helper/http"); -const { endPoints } = require("../helper/chain/cosmos"); - -const coinGeckoIds = { - adydx: "dydx-chain", - uatom: "cosmos", - uosmo: "osmosis", - usomm: "sommelier", - uregen: "regen", - ujuno: "juno-network", - ustars: "stargaze", - usaga: "saga-2", - ubld: "agoric", - utia: "celestia", - aarch: "archway", - ppica: "picasso", - uflix: "omniflix-network", - inj: "injective", - uluna: "terra-luna-2", -}; - -async function tvl() { - const balances = {}; - const { zones } = await get(endPoints.quicksilver + "/quicksilver/interchainstaking/v1/zones", { timeout: 30000 }); - const { supply } = await get(endPoints.quicksilver + "/cosmos/bank/v1beta1/supply", { timeout: 30000 }); - - zones.forEach((zone) => { - const balance = supply.find((coin) => coin.denom === zone.local_denom); - if (!balance) return - const amount = balance.amount / Math.pow(10, zone.decimals) - const id = coinGeckoIds[zone.base_denom] - sdk.util.sumSingleBalance(balances, id, amount * zone.redemption_rate); - }); - - return balances; -} - -module.exports = { - timetravel: false, - methodology: "Sum of all the tokens that are liquid staked on Quicksilver", - quicksilver: { tvl }, -}; diff --git a/projects/radlock/index.js b/projects/radlock/index.js index 8e4bcf9fc10..9fbaeddd844 100644 --- a/projects/radlock/index.js +++ b/projects/radlock/index.js @@ -1,13 +1,53 @@ -const { get } = require('../helper/http') +const { sumTokens, queryAddresses } = require('../helper/chain/radixdlt') +const { post } = require('../helper/http') +const { sliceIntoChunks } = require('../helper/utils') + +// RadLock on-chain components (from app.radlock.io config) +const TOKEN_LOCK_SERVICE = 'component_rdx1crn49lcmzyuqpz4lgx8fulegk4pdzjz89lhegs4g5attrgxqjp4amc' +const TOKEN_VEST_SERVICE = 'component_rdx1cp7vsz98w06urq3n00rf9xz9jrlppyk0sukqrm4kvqvkjwucne6puh' + +const ENTITY_DETAILS_URL = 'https://mainnet.radixdlt.com/state/entity/details' async function tvl(api) { - const tokensLockedInXrdList = await get('https://api.radlock.io/token/locked?format=list&lpOnly=true', { timeout: 30000 }) - return { - 'radix': tokensLockedInXrdList.reduce((acc, token) => acc + +token.xrd, 0) + await sumTokens({ api, owners: [TOKEN_LOCK_SERVICE, TOKEN_VEST_SERVICE] }) + await unwrapPoolUnits(api) +} + +// Locked native pool units (e.g. Defiplaza TwoResourcePool LP) -> pro-rata share of the pool's reserves +async function unwrapPoolUnits(api) { + const balances = api.getBalances() + const tokens = Object.keys(balances).filter(i => i.startsWith('radixdlt:resource_')).map(i => i.replace('radixdlt:', '')) + if (!tokens.length) return + + const poolUnits = {} // pool address -> { lpToken, supply } + for (const chunk of sliceIntoChunks(tokens, 20)) { + const { items } = await post(ENTITY_DETAILS_URL, { addresses: chunk, opt_ins: { explicit_metadata: ['pool'] } }) + for (const item of items) { + const pool = item.metadata?.items?.find(i => i.key === 'pool')?.value?.typed?.value + if (typeof pool !== 'string' || !pool.startsWith('pool_')) continue + poolUnits[pool] = { lpToken: item.address, supply: +item.details?.total_supply } + } + } + + const pools = Object.keys(poolUnits) + if (!pools.length) return + const poolDetails = await queryAddresses({ addresses: pools }) + for (const pool of poolDetails) { + const { lpToken, supply } = poolUnits[pool.address] + const key = `radixdlt:${lpToken}` + const held = +balances[key] + delete balances[key] + if (!supply || !held) continue + const ratio = held / supply + pool.fungible_resources.items.forEach(({ resource_address, amount }) => { + if (resource_address === lpToken) return + api.add(resource_address, +amount * ratio) + }) } } module.exports = { timetravel: false, - radixdlt: { tvl } + methodology: 'Tokens held in the RadLock token lock and vesting components on Radix. Locked native pool units are unwrapped into the underlying pool reserves.', + radixdlt: { tvl }, } diff --git a/projects/rocket-vault/index.js b/projects/rocket-vault/index.js index 6d454a6448b..e8e322d355a 100644 --- a/projects/rocket-vault/index.js +++ b/projects/rocket-vault/index.js @@ -20,6 +20,7 @@ module.exports = { timetravel: false, misrepresentedTokens: false, doublecounted: true, + deadFrom: "2026-09-05", // paused after a hack methodology: "TVL is calculated by summing all USDC collateral deposited in Rocket Liquidity Provider vaults", arbitrum: { tvl }, }; \ No newline at end of file diff --git a/projects/rubyfinance/index.js b/projects/rubyfinance/index.js deleted file mode 100644 index 7daed905019..00000000000 --- a/projects/rubyfinance/index.js +++ /dev/null @@ -1,28 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require("../helper/unknownTokens") -const { stakingPriceLP, staking } = require("../helper/staking") - -const wkavaAddress = ADDRESSES.kava.WKAVA; -const rshareTokenAddress = "0x5547F680Ad0104273d0c007073B87f98dEF199c6"; -const rshareRewardPoolAddress = "0x63c8069EE16BA666800cECaFd99f4C75ad6dd7Aa"; -const boardroomAddress = "0x9832941dD0F80086399eC90eC6f6B2676791436a"; -const rshareKavaLp = "0x0E5787F2550ddE3D394207aCeFdDe3f0228c7f79"; -const rubyKavaLp = "0x41af8e310d639f3b91f640ab6d457c2302326e5c"; -const rubyRshareLp = "0x96CB0E7fA38e5FDE6679B55afdfb8678D18f2680"; -const rubyUsdcLp = "0x5FF7D68eE6e5f0bbE211B3c0d010160e3cD27Db9"; - -const Kavalps = [rubyKavaLp, rshareKavaLp, rubyRshareLp, rubyUsdcLp]; - -module.exports = { - deadFrom: '2026-09-30', - hallmarks: [ - ['2022-08-15', "incentives not given"] - ], - methodology: - "Pool2 deposits consist of RUBY/USDC, RUBY/KAVA, RSHARE/KAVA and RUBY/RSHARE LP deposits while the staking TVL consists of the RSHARE tokens locked within the Boardroom contract.", - kava: { - tvl: staking(rshareRewardPoolAddress, wkavaAddress), - pool2: sumTokensExport({ owner: rshareRewardPoolAddress, tokens: Kavalps, lps: Kavalps, resolveLP: true, useDefaultCoreAssets: true }), - staking: stakingPriceLP(boardroomAddress, rshareTokenAddress, rshareKavaLp), - }, -}; \ No newline at end of file diff --git a/projects/sailing-portfolios/index.js b/projects/sailing-portfolios/index.js deleted file mode 100644 index 59c5ea6a844..00000000000 --- a/projects/sailing-portfolios/index.js +++ /dev/null @@ -1,20 +0,0 @@ -const portfoliosTrackers = { - 'kava': '0x12c90425dD549DEdD455E223a897E438E2Dc0bbc', -}; - -async function tvl(api) { - const portfoliosTracker = portfoliosTrackers[api.chain] - const portfolios = await api.call({ - target: portfoliosTracker, - abi: 'function getTrackedPortfolios() external view returns (address[] memory)', - }) - const tokens = await api.multiCall({ abi: 'address[]:getPortfolioAssets', calls: portfolios}) - const ownerTokens = portfolios.map((portfolio, i) => [tokens[i], portfolio]) - return api.sumTokens({ ownerTokens, blacklistedTokens: ['0x47a663C082926d0d913cAcB89240c3f4bc409a88','0x2d519b9308aeb0c57921030dd5de4e88c44cec7c'] }) -} - -module.exports = { - deadFrom: '2026-09-30', - kava: { tvl, }, - methodology: 'The assets in the balancer are detected and counted.' -} diff --git a/projects/scrt.js b/projects/scrt.js deleted file mode 100644 index 4d6cbc4f847..00000000000 --- a/projects/scrt.js +++ /dev/null @@ -1,19 +0,0 @@ -const utils = require('./helper/utils.js'); - -const urls = ['https://api-bridge-mainnet.azurewebsites.net/tokens/?page=0&size=1000', 'https://bridge-bsc-mainnet.azurewebsites.net/tokens/?page=0&size=1000'] - -const tvl = async (api) => { - for (const url of urls) { - const { data } = await utils.fetchURL(url) - data.tokens.forEach(({ src_coin, totalLockedUSD }) => { - if (src_coin !== "UNILP-WSCRT-ETH" && src_coin !== "WSCRT") { - api.addUSDValue(Math.round(totalLockedUSD)) - } - }) - } -} - -module.exports = { - misrepresentedTokens: true, - secret: { tvl } -} \ No newline at end of file diff --git a/projects/secretswap.js b/projects/secretswap.js deleted file mode 100644 index 89d3ffec9cf..00000000000 --- a/projects/secretswap.js +++ /dev/null @@ -1,26 +0,0 @@ -const { get } = require('./helper/http') -const { transformDexBalances } = require('./helper/portedTokens') - -async function tvl() { - var { pools } = await get('https://api-bridge-mainnet.azurewebsites.net/secretswap_pools/?page=0&size=1000') - - pools.filter(i => +i.total_share > 0).map(i => i.address) - return transformDexBalances({ - chain: 'secret', - data: pools.filter(i => +i.total_share > 0).map(i => { - return { - token0: i.assets[0].info.token?.contract_addr ?? i.assets[0].info.native_token?.denom ?? i.assets[0].info.native_token?.base_denom, - token0Bal: i.assets[0].amount, - token1: i.assets[1].info.token?.contract_addr ?? i.assets[1].info.native_token?.denom ?? i.assets[1].info.native_token?.base_denom, - token1Bal: i.assets[1].amount, - } - }), - }) -} - -module.exports = { - misrepresentedTokens: true, - secret: { - tvl - }, -} \ No newline at end of file diff --git a/projects/selfex/index.js b/projects/selfex/index.js deleted file mode 100644 index bce8c286746..00000000000 --- a/projects/selfex/index.js +++ /dev/null @@ -1,15 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens') -const chains = ['kava'] - -const USDk = '0x472402d47da0587c1cf515dafbafc7bce6223106' -const KFT = "0xa0eeda2e3075092d66384fe8c91a1da4bca21788" -const kBRISE = '0xea616011e5ac9a5b91e22cac59b4ec6f562b83f9' - -module.exports = { - deadFrom: '2026-09-30', - misrepresentedTokens: true, -}; - -chains.forEach(chain => { - module.exports[chain] = { tvl: getUniTVL({ factory: '0x98a3567692Eb055fA1F05D616cad494DE9B05512', useDefaultCoreAssets: true, blacklistedTokens: [KFT, USDk, kBRISE] }) } -}) diff --git a/projects/sentora/index.js b/projects/sentora/index.js index 4adfc1009af..3d155506c40 100644 --- a/projects/sentora/index.js +++ b/projects/sentora/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getCuratorExport, getMorphoVaults } = require("../helper/curators"); const { getConfig } = require('../helper/cache') const { getProvider, getTokenSupplies } = require('../helper/solana') @@ -75,7 +76,7 @@ const customConfig = { solana: { // Earn side of the Sentora-curated market on the JupLend Ethena deployment juplend: [ - { fToken: '7T1qPZUPdaEhfQ6tXLvFeCoehyDfzdk76XbszbXyqgjx', mint: '2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo' }, // jlePYUSD -> PYUSD + { fToken: '7T1qPZUPdaEhfQ6tXLvFeCoehyDfzdk76XbszbXyqgjx', mint: ADDRESSES.solana.PYUSD }, // jlePYUSD -> PYUSD ], }, } diff --git a/projects/shadeprotocol-derivatives/index.js b/projects/shadeprotocol-derivatives/index.js deleted file mode 100644 index 698d833c264..00000000000 --- a/projects/shadeprotocol-derivatives/index.js +++ /dev/null @@ -1,43 +0,0 @@ -const { queryV1Beta1V2 } = require("../helper/chain/cosmos") -const { queryContract } = require("../helper/chain/secret") - -const STKD_SCRT_CONTRACT = 'secret1k6u0cy4feepm6pehnz804zmwakuwdapm69tuc4' -const DENOM = 'uscrt' - -function toBaseAmount(amount = 0) { - const [wholeAmount] = String(amount).split('.') - return BigInt(wholeAmount || 0) -} - -function sumAmounts(amounts) { - return amounts.reduce((sum, amount) => sum + toBaseAmount(amount), 0n) -} - -async function tvl(api) { - const [{ staking_info: stakingInfo }, unbonding] = await Promise.all([ - queryContract({ contract: STKD_SCRT_CONTRACT, data: { staking_info: { time: Math.floor(Date.now() / 1000) } } }), - queryV1Beta1V2({ chain: 'secret', url: `staking/v1beta1/delegators/${STKD_SCRT_CONTRACT}/unbonding_delegations` }), - ]) - - if (!stakingInfo) throw new Error('Missing staking_info response') - - let total = sumAmounts([ - stakingInfo.bonded_scrt, - stakingInfo.reserved_scrt, - stakingInfo.available_scrt, - stakingInfo.rewards, - ]) - total += unbonding.reduce((sum, item) => ( - sum + (item.entries || []).reduce((entrySum, entry) => entrySum + toBaseAmount(entry.balance), 0n) - ), 0n) - - api.add(DENOM, total.toString()) -} - -module.exports = { - timetravel: false, - methodology: 'TVL counts SCRT backing stkd-SCRT using the staking contract accounting plus active unbonding SCRT.', - secret: { - tvl - } -} diff --git a/projects/sienna-lend/index.js b/projects/sienna-lend/index.js deleted file mode 100644 index a791a7f3efc..00000000000 --- a/projects/sienna-lend/index.js +++ /dev/null @@ -1,96 +0,0 @@ -const { queryContract, } = require('../helper/chain/secret') -const { PromisePool } = require('@supercharge/promise-pool'); -const { sleep } = require('../helper/utils'); - -const LEND_OVERSEER_CONTRACT = "secret1pf88n9hm64mn58aw48jxfs2fsvzr07svnrrdlv"; - -let lendingMarkets = null - -async function getLendMarkets() { - if (!lendingMarkets) lendingMarkets = _get() - return lendingMarkets - - async function _get() { - let markets = [], hasMore = true, start = 0, limit = 30 - - while (hasMore) { - const { entries, total } = await queryContract({ - contract: LEND_OVERSEER_CONTRACT, data: { - markets: { - pagination: { - limit: 30, - start - } - } - } - }); - start += limit - hasMore = total > start - markets = markets.concat(entries.map(i => i.contract.address)); - } - - const data = [] - - const { errors } = await PromisePool.withConcurrency(3) - .for(markets) - .process(async (addr) => { - - let { total_borrows, total_supply, } = await queryContract({ contract: addr, data: { state: {} } }) - let exchange_rate = await queryContract({ contract: addr, data: { exchange_rate: {} } }) - const { address } = await queryContract({ contract: addr, data: { underlying_asset: {} } }) - // const { token_info: { decimals }} = await queryContract({ contract: address, data: { token_info: {} } }) - const scale = exchange_rate - data.push({ address, total_borrows: total_borrows * scale, total_supply: total_supply * scale }) - await sleep(1000) - }) - - if (errors && errors.length) - throw errors[0] - - return data - } - -} - -async function tvl(api) { - const data = await getLendMarkets() - data.forEach(i => { - api.add(i.address, i.total_supply - i.total_borrows) - }) - - return api.getBalances() -} - -async function borrowed(api) { - const data = await getLendMarkets() - data.forEach(i => { - api.add(i.address, i.total_borrows) - }) - - - return api.getBalances() -} - -async function staking(api) { - const SIENNA_SINGLE_SIDED_POOLS = [ - { address: "secret1ja57vrpqusx99rgvxacvej3vhzhh4rhlkdkd7w", version: 1 }, - { address: "secret109g22wm3q3nfys0v6uh7lqg68cn6244n2he4t6", version: 2 }, - { address: "secret1uta9zf3prn7lvc6whp8sqv7ynxmtz3jz9xkyu7", version: 3 } - ]; - - const SIENNA_TOKEN_ADDRESS = "secret1rgm2m5t530tdzyd99775n6vzumxa5luxcllml4"; - await Promise.all(SIENNA_SINGLE_SIDED_POOLS.map(async ({ address, version }) => { - if (version === 3) { - const fetchedPool = await queryContract({ contract: address, data: { rewards: { pool_info: { at: new Date().getTime() } } } }); - api.add('sienna', fetchedPool.rewards.pool_info.staked / 1e18, { skipChain: true }) - } else { - const fetchedPool = await queryContract({ contract: address, data: { pool_info: { at: new Date().getTime() } } }); - api.add('sienna', fetchedPool.pool_info.pool_locked / 1e18, { skipChain: true }) - } - })); - return api.getBalances() -} - -module.exports = { - secret: { tvl, borrowed, staking, } -} \ No newline at end of file diff --git a/projects/sienna/index.js b/projects/sienna/index.js deleted file mode 100644 index eac1f34d1f6..00000000000 --- a/projects/sienna/index.js +++ /dev/null @@ -1,53 +0,0 @@ -const { queryContract, } = require('../helper/chain/secret') -const { transformDexBalances } = require('../helper/portedTokens') -const { PromisePool } = require('@supercharge/promise-pool') -const sdk = require('@defillama/sdk') -const { sleep } = require('../helper/utils') - -async function tvl(api) { - const factiories = ["secret18sq0ux28kt2z7dlze2mu57d3ua0u5ayzwp6v2r", "secret1zvk7pvhtme6j8yw3ryv0jdtgg937w0g0ggu8yy"] - const data = [] - await Promise.all(factiories.map(i => getExchanges(i, data))) - return transformDexBalances({ data, chain: api.chain }) -} - -async function getExchanges(factory, data) { - const pools = [] - const limit = 30 - let hasMore = true - do { - const { list_exchanges: { exchanges } } = await queryContract({ contract: factory, data: { list_exchanges: { pagination: { start: pools.length, limit } } } }) - hasMore = exchanges.length === limit - - sdk.log(factory, exchanges.length, pools.length, hasMore) - pools.push(...exchanges) - const { errors } = await PromisePool.withConcurrency(10) - .for(exchanges) - .process(async (i) => { - let { address, contract } = i - if (!address) address = contract.address - const { pair_info } = await queryContract({ contract: address, data: "pair_info" }) - data.push({ - token0: transformToken(pair_info.pair.token_0), - token0Bal: pair_info.amount_0, - token1: transformToken(pair_info.pair.token_1), - token1Bal: pair_info.amount_1, - }) - await sleep(1000) - }) - - if (errors && errors.length) - throw errors[0] - - } while (hasMore) -} - -function transformToken(addr) { - if (!addr?.custom_token) throw new Error("No custom token") - return addr.custom_token.contract_addr -} - -module.exports = { - timetravel: false, - secret: { tvl } -} diff --git a/projects/skate-amm/index.js b/projects/skate-amm/index.js index 13c0ad5988e..a9c6b6b046a 100644 --- a/projects/skate-amm/index.js +++ b/projects/skate-amm/index.js @@ -37,8 +37,8 @@ const evm_config = { robinhood: [ { pool: '0x84e35a36da4C0185fe6BB07940b1e58f66441B79', token0: ADDRESSES.robinhood.WETH, token1: ADDRESSES.robinhood.USDG }, // WETH/USDG { pool: '0x066138b687F7dacd31937276a6E13E37339B5690', token0: '0xC9a981FEE1F9DEc688bb123ccDeCc63D0deBFC4e', token1: ADDRESSES.robinhood.USDG }, // GLD/USDG - { pool: '0x5D8aF540801103DeAdA9890F92615dfdB1F7811e', token0: '0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC', token1: ADDRESSES.robinhood.USDG }, // NVDA/USDG - { pool: '0xD275CbfAA90e22FaaB7e87Cd3774a2d6E64c853E', token0: '0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9', token1: ADDRESSES.robinhood.USDG }, // AAPL/USDG + { pool: '0x5D8aF540801103DeAdA9890F92615dfdB1F7811e', token0: ADDRESSES.robinhood.NVDA, token1: ADDRESSES.robinhood.USDG }, // NVDA/USDG + { pool: '0xD275CbfAA90e22FaaB7e87Cd3774a2d6E64c853E', token0: ADDRESSES.robinhood.AAPL, token1: ADDRESSES.robinhood.USDG }, // AAPL/USDG ], } diff --git a/projects/stakedicp/index.js b/projects/stakedicp/index.js deleted file mode 100644 index e538d6b6823..00000000000 --- a/projects/stakedicp/index.js +++ /dev/null @@ -1,9 +0,0 @@ -// canister h6uvl-xiaaa-aaaap-qaawa-cai has had its wasm module uninstalled, so the /tvl endpoint no longer exists -module.exports = { - deadFrom: '2026-10-07', // abandoned? - timetravel: false, - methodology: "TVL counts ICP deposited as collateral to mint stICP", - icp: { - tvl: () => ({}), - }, -}; diff --git a/projects/statics/index.js b/projects/statics/index.js index f3f832c039e..9247bd9e20f 100644 --- a/projects/statics/index.js +++ b/projects/statics/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { addUniV4PoolReserves } = require('../helper/uniswapV4') const STATICS = '0x2d8d6F4A93AcD7a916A5a654ec8b690bA3B3EAdd' -const WETH = '0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73' +const WETH = ADDRESSES.robinhood.WETH const GENESIS_VAULT = '0x8AAAF9a22f439589987B8f1e69d79ca4f648C297' const STATE_VIEW = '0xF3334192D15450CdD385c8B70E03f9a6Bd9E673b' diff --git a/projects/stax/index.js b/projects/stax/index.js index 437000d8d61..e2c88b031ed 100644 --- a/projects/stax/index.js +++ b/projects/stax/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') // Stax (stax.finance) -- tokenized-stock index baskets on Robinhood Chain. // TVL = the stock tokens and USDG held as basket collateral by the two Stax vaults // (v19 and V2) and by the V2 community-basket clones created through the Stax factory. @@ -15,7 +16,7 @@ const VAULTS = [ { address: "0xAda84161033C0Cc54EF21CEeF913A8fEC4239b33", fromBlock: 68883165 }, // StaxVaultV2 (V2) -- newer baskets ]; const USER_BASKET_FACTORY = "0x1de6a6bD0C62097A7559A29a76e41985558f9918"; // StaxUserBasketFactoryV2 -const USDG = "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"; +const USDG = ADDRESSES.robinhood.USDG; const abi = { basketCreated: "event BasketCreated(uint256 indexed basketId, address token, string name)", diff --git a/projects/tangleswap/index.js b/projects/tangleswap/index.js deleted file mode 100644 index 9c6d83f502a..00000000000 --- a/projects/tangleswap/index.js +++ /dev/null @@ -1,40 +0,0 @@ -const { staking } = require('../helper/staking') -const { cachedGraphQuery } = require('../helper/cache') -const { sumTokens2, } = require('../helper/unwrapLPs') -const { uniV3Export, } = require('../helper/uniswapV3') - -const config = { - shimmer_evm: { endpoint: 'https://shimmer.subgraph.tangleswap.space/subgraphs/name/tangleswap/shimmer-v3' }, -} -const query = `query getPools($lastId: String!) { - pools( - first: 1000 - where: {id_gt: $lastId} - ) { - id - token0 { id } - token1 { id } - } -}` - -async function tvl(api) { - const { endpoint } = config[api.chain] - const pools = await cachedGraphQuery('tangleswap/' + api.chain, endpoint, query, { fetchById: true, }) - return sumTokens2({ - api, - ownerTokens: pools.map(i => { - return [[i.token0.id, i.token1.id], i.id] - }) - }) -} - - -Object.keys(config).forEach(chain => { - module.exports[chain] = { tvl } -}) - -module.exports.milkomeda = uniV3Export({ milkomeda: { factory: "0xda2f048C128506e720b0b0b32F20432157dde1c7", fromBlock: 19701714, },}).milkomeda -module.exports.milkomeda.staking = staking('0xbDD88a555cB49b6b482850aA50c1c2C74fa3367a', '0x6085C822B7A4c688D114468B1380a0Ed1873a0B3') -module.exports.shimmer_evm.staking = staking('0x86eea5C341ece8f96D403eA9fB4d184A6a94C0E1', '0xE5f3dCC241Dd008E3c308e57cf4F7880eA9210F8') -// module.exports.shimmer_evm = uniV3Export({ milkomeda: { factory: "0xdf7bA717FB0D5ce579252f05167cD96d0fA77bCb", fromBlock: 19701714, },}).milkomeda -// module.exports.iotaevm = uniV3Export({ iotaevm: { factory: "0xdf7bA717FB0D5ce579252f05167cD96d0fA77bCb", fromBlock: 19701714, },}).iotaevm \ No newline at end of file diff --git a/projects/templarfi/index.js b/projects/templarfi/index.js index 5484ba2b5ee..c63a5bae7a9 100644 --- a/projects/templarfi/index.js +++ b/projects/templarfi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { default: BigNumber } = require('bignumber.js') const { call, sumSingleBalance } = require('../helper/chain/near') @@ -107,7 +108,7 @@ function detectCrossChainToken(tokenId) { // FXRP reaches Ethereum through a lock-and-mint bridge from Flare, so the // underlying liquidity stays locked on Flare and is attributed there if (tokenId === 'eth-0xce6170ea245dc8d1f275a710a062b70f125f0110.omft.near') { - return { chain: 'flare', token: 'flare:0xad552a648c74d49e10027ab8a618a3ad4901c5be' } + return { chain: 'flare', token: 'flare:' + ADDRESSES.flare.FXRP } } // Ethereum tokens via omnichain bridge diff --git a/projects/tonswap/index.js b/projects/tonswap/index.js deleted file mode 100644 index 93aff3b8a94..00000000000 --- a/projects/tonswap/index.js +++ /dev/null @@ -1,23 +0,0 @@ -const { post } = require('../helper/http') - -const url = 'https://api.flatqube.io/v1/pairs' - -const payload = { - currencyAddresses: [], - limit: 1000, - offset: 0, - ordering: "tvldescending", - whiteListUri: "https://raw.githubusercontent.com/broxus/flatqube-assets/master/manifest.json", -} - -const tvl = async (api) => { - const { pairs } = await post(url, payload) - pairs.forEach(( { tvl }) => { - api.addUSDValue(Math.round(tvl)) - }) -} - -module.exports = { - misrepresentedTokens: true, - everscale: { tvl } -}; diff --git a/projects/treasury/flrbank.js b/projects/treasury/flrbank.js index 7464e675928..970b7d7785a 100644 --- a/projects/treasury/flrbank.js +++ b/projects/treasury/flrbank.js @@ -15,7 +15,7 @@ module.exports = { ADDRESSES.flare.WFLR, SPARKDEX_LP, // SPARKDEX V2 LP (BANK/WFLR) ENOSYS_LP, // ENOSYS V2 LP (BANK/WFLR) - '0xAd552A648C74D49E10027AB8a618A3ad4901c5bE', // FXRP + ADDRESSES.flare.FXRP, // FXRP '0x4C18Ff3C89632c3Dd62E796c0aFA5c07c4c1B2b3', // stXRP ADDRESSES.flare.sFLR, // sFLR '0x6Cd3a5Ba46FA254D4d2E3C2B37350ae337E94a0F', // CDP diff --git a/projects/treasury/merryforge.js b/projects/treasury/merryforge.js index 63283ec56fd..74a9d38f8dc 100644 --- a/projects/treasury/merryforge.js +++ b/projects/treasury/merryforge.js @@ -10,9 +10,9 @@ const VIRTUAL = '0xc6911796042b15d7Fa4F6CDe69e245DdCd3d9c31' // first-wave Stock Token native-raise quotes const STOCK_NATIVE_RAISE = [ - '0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9', // AAPL - '0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC', // NVDA - '0x322F0929c4625eD5bAd873c95208D54E1c003b2d', // TSLA + ADDRESSES.robinhood.AAPL, // AAPL + ADDRESSES.robinhood.NVDA, // NVDA + ADDRESSES.robinhood.TSLA, // TSLA '0x117cc2133c37B721F49dE2A7a74833232B3B4C0C', // SPY '0xe93237C50D904957Cf27E7B1133b510C669c2e74', // MSFT ] diff --git a/projects/treasury/mosh.js b/projects/treasury/mosh.js index d44e3bbf511..67b165145aa 100644 --- a/projects/treasury/mosh.js +++ b/projects/treasury/mosh.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); // The Mosh treasury: a Safe on Robinhood Chain that receives Mosh's share of bundle fees and the raise @@ -9,7 +10,7 @@ module.exports = treasuryExports({ owners: [MOSH_TREASURY], tokens: [ nullAddress, - "0x5fc5360d0400a0fd4f2af552add042d716f1d168", // USDG + ADDRESSES.robinhood.USDG, // USDG "0xc9a981fee1f9dec688bb123ccdecc63d0debfc4e", // GLD ], ownTokens: ["0x07ebb29a38fbcb41563817e5e19f2cec619c90d2"], // BUN diff --git a/projects/treasury/stockworks.js b/projects/treasury/stockworks.js index 92538d58e8b..27df17146cb 100644 --- a/projects/treasury/stockworks.js +++ b/projects/treasury/stockworks.js @@ -13,7 +13,7 @@ const { nullAddress, treasuryExports } = require("../helper/treasury"); // balances alone reports ~$100 against ~$30k actually held. So we read the // controller's own position getters and convert liquidity to token amounts. const CONTROLLER = "0x37bBFeD61d9A8C3743D3E7318e635c37c9abdf8e"; // SpcxQuoteController -const SPCX = "0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa"; +const SPCX = ADDRESSES.robinhood.SPCX; const USDG = ADDRESSES.robinhood.USDG; // SPCXSTR itself is the protocol's own token and is deliberately NOT counted. diff --git a/projects/truss-lp/index.js b/projects/truss-lp/index.js index 2b44ad1626c..d4f35ca4429 100644 --- a/projects/truss-lp/index.js +++ b/projects/truss-lp/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') // TRUSS LP - automated concentrated-liquidity vaults on Aerodrome Slipstream (Base) // TVL = idle token0/token1 held by every vault + every Slipstream position the // AerodromeAtomicV3 contract has staked in a gauge on the vaults' behalf. @@ -32,7 +33,7 @@ async function tvl(api) { const uniqPools = [...new Set(pools.map(p => p.toLowerCase()))] const gauges = await api.multiCall({ target: VOTER, abi: abi.gauges, calls: uniqPools }) const live = uniqPools.map((p, i) => ({ pool: p, gauge: gauges[i] })) - .filter(x => x.gauge && x.gauge !== '0x0000000000000000000000000000000000000000') + .filter(x => x.gauge && x.gauge !== ADDRESSES.null) if (!live.length) return const nfpms = await api.multiCall({ abi: 'address:nft', calls: live.map(x => x.gauge) }) diff --git a/projects/turret/config.js b/projects/turret/config.js index b657231b2d1..47ebe4f00cb 100644 --- a/projects/turret/config.js +++ b/projects/turret/config.js @@ -8,71 +8,71 @@ module.exports = { nftMarket: '0x79F986A54965EB4AB2eB317d9c5e33074793Dd28', // { engine, collateral } per pooled credit market, comment is the collateral symbol engines: [ - { engine: '0xb9123E508bffEb32E0e7d5D2D8EE5917F54ccc63', collateral: '0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9' }, // AAPL + { engine: '0xb9123E508bffEb32E0e7d5D2D8EE5917F54ccc63', collateral: ADDRESSES.robinhood.AAPL }, // AAPL { engine: '0xEEE8622810616AC4A336B8cDb353D0Ddf11c884B', collateral: '0xe93237C50D904957Cf27E7B1133b510C669c2e74' }, // MSFT - { engine: '0xd76F143Bae0277Cc556D97ad978f18a0fdCd130e', collateral: '0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3' }, // GOOGL - { engine: '0x7c1abcfe307c6575487e182D94b767f1FC49ED22', collateral: '0x12f190a9F9d7D37a250758b26824B97CE941bF54' }, // AMZN - { engine: '0x96714F255609381C75c1E88D08846D9eD229dC62', collateral: '0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35' }, // META - { engine: '0x1916D155e580ff6f4A7724d630A27F2f12b6Eb85', collateral: '0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC' }, // NVDA - { engine: '0x6d13b38bb018f9fFdba625626e907210fb74421C', collateral: '0x86923f96303D656E4aa86D9d42D1e57ad2023fdC' }, // AMD - { engine: '0xb41276421e5aE67C0c31b2B04bCFA0DeE4e62A33', collateral: '0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD' }, // MU - { engine: '0xe07EEd598ACb608c69802D00BaFea6A3926c7980', collateral: '0x322F0929c4625eD5bAd873c95208D54E1c003b2d' }, // TSLA - { engine: '0x7b08E0E9520f3D4E2d59EF4EFc9db032E41399F8', collateral: '0x020bfC650A365f8BB26819deAAbF3E21291018b4' }, // CASHCAT + { engine: '0xd76F143Bae0277Cc556D97ad978f18a0fdCd130e', collateral: ADDRESSES.robinhood.GOOGL }, // GOOGL + { engine: '0x7c1abcfe307c6575487e182D94b767f1FC49ED22', collateral: ADDRESSES.robinhood.AMZN }, // AMZN + { engine: '0x96714F255609381C75c1E88D08846D9eD229dC62', collateral: ADDRESSES.robinhood.META }, // META + { engine: '0x1916D155e580ff6f4A7724d630A27F2f12b6Eb85', collateral: ADDRESSES.robinhood.NVDA }, // NVDA + { engine: '0x6d13b38bb018f9fFdba625626e907210fb74421C', collateral: ADDRESSES.robinhood.AMD }, // AMD + { engine: '0xb41276421e5aE67C0c31b2B04bCFA0DeE4e62A33', collateral: ADDRESSES.robinhood.MU }, // MU + { engine: '0xe07EEd598ACb608c69802D00BaFea6A3926c7980', collateral: ADDRESSES.robinhood.TSLA }, // TSLA + { engine: '0x7b08E0E9520f3D4E2d59EF4EFc9db032E41399F8', collateral: ADDRESSES.robinhood.CASHCAT }, // CASHCAT { engine: '0x8802c550b21C870dE29052CFAE5c719613440e87', collateral: '0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f' }, // SLV - { engine: '0xf7a3dE21eced50bF0E439822273DA503Fe10C7B7', collateral: '0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9' }, // AAPL + { engine: '0xf7a3dE21eced50bF0E439822273DA503Fe10C7B7', collateral: ADDRESSES.robinhood.AAPL }, // AAPL { engine: '0x1a3656f815BBb53cBFaA7e9F63AA97c42324A2C9', collateral: '0xe93237C50D904957Cf27E7B1133b510C669c2e74' }, // MSFT - { engine: '0x072E65420C618Ce0aa5ac5628bE8Cf471E5F5b5B', collateral: '0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3' }, // GOOGL - { engine: '0xEB39cd2bD899CF7A13B4e4b92050a56028e7473d', collateral: '0x12f190a9F9d7D37a250758b26824B97CE941bF54' }, // AMZN - { engine: '0x76224138d8057B970383c5A92d0C171EDf8ceb03', collateral: '0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35' }, // META - { engine: '0xad34D8Ee4965672dd989808abbcAa35A8895bFE8', collateral: '0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC' }, // NVDA - { engine: '0x695171F8FC059A3B1F3e8d7a201C0271aD436B77', collateral: '0x86923f96303D656E4aa86D9d42D1e57ad2023fdC' }, // AMD - { engine: '0xcAaC375E2d975359Bc5a8449eED9E281F359E234', collateral: '0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD' }, // MU - { engine: '0xe1E9cdAfDB792dF85C497F3752263d674105b0b4', collateral: '0x322F0929c4625eD5bAd873c95208D54E1c003b2d' }, // TSLA - { engine: '0xEfCAaD33fb0E309eD021e2fe85342C2e58951b9F', collateral: '0x020bfC650A365f8BB26819deAAbF3E21291018b4' }, // CASHCAT - { engine: '0x37DF02D0D721aB8a351333052535B2b7F1262F36', collateral: '0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9' }, // AAPL + { engine: '0x072E65420C618Ce0aa5ac5628bE8Cf471E5F5b5B', collateral: ADDRESSES.robinhood.GOOGL }, // GOOGL + { engine: '0xEB39cd2bD899CF7A13B4e4b92050a56028e7473d', collateral: ADDRESSES.robinhood.AMZN }, // AMZN + { engine: '0x76224138d8057B970383c5A92d0C171EDf8ceb03', collateral: ADDRESSES.robinhood.META }, // META + { engine: '0xad34D8Ee4965672dd989808abbcAa35A8895bFE8', collateral: ADDRESSES.robinhood.NVDA }, // NVDA + { engine: '0x695171F8FC059A3B1F3e8d7a201C0271aD436B77', collateral: ADDRESSES.robinhood.AMD }, // AMD + { engine: '0xcAaC375E2d975359Bc5a8449eED9E281F359E234', collateral: ADDRESSES.robinhood.MU }, // MU + { engine: '0xe1E9cdAfDB792dF85C497F3752263d674105b0b4', collateral: ADDRESSES.robinhood.TSLA }, // TSLA + { engine: '0xEfCAaD33fb0E309eD021e2fe85342C2e58951b9F', collateral: ADDRESSES.robinhood.CASHCAT }, // CASHCAT + { engine: '0x37DF02D0D721aB8a351333052535B2b7F1262F36', collateral: ADDRESSES.robinhood.AAPL }, // AAPL { engine: '0x8f4101368B25A5Ae2043891574BDDb8275572533', collateral: '0xe93237C50D904957Cf27E7B1133b510C669c2e74' }, // MSFT - { engine: '0xD49B1AF2f2e7e6340e8f419dAccCe68Ebb9378CD', collateral: '0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3' }, // GOOGL - { engine: '0xD2157493950813849824Ba7f29d726d777037F2E', collateral: '0x12f190a9F9d7D37a250758b26824B97CE941bF54' }, // AMZN - { engine: '0x74AbbC9724039B07527a611714b82aDfc19A2eD8', collateral: '0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35' }, // META - { engine: '0x73dB617B21b3E7Fd9056333902A1738463519DC8', collateral: '0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC' }, // NVDA - { engine: '0xf2948B3De193934A0b45bc34C57ff5E25BcDA558', collateral: '0x86923f96303D656E4aa86D9d42D1e57ad2023fdC' }, // AMD - { engine: '0x067aC120ec0D6e879f4C40426385EA0Ac3d2Cd0A', collateral: '0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD' }, // MU - { engine: '0xFA125B8406ed76E25962a20C340FE19bf41d3179', collateral: '0x322F0929c4625eD5bAd873c95208D54E1c003b2d' }, // TSLA - { engine: '0xee1f486Ea6827Cd9fB87c35629A05707FF13cc03', collateral: '0x020bfC650A365f8BB26819deAAbF3E21291018b4' }, // CASHCAT + { engine: '0xD49B1AF2f2e7e6340e8f419dAccCe68Ebb9378CD', collateral: ADDRESSES.robinhood.GOOGL }, // GOOGL + { engine: '0xD2157493950813849824Ba7f29d726d777037F2E', collateral: ADDRESSES.robinhood.AMZN }, // AMZN + { engine: '0x74AbbC9724039B07527a611714b82aDfc19A2eD8', collateral: ADDRESSES.robinhood.META }, // META + { engine: '0x73dB617B21b3E7Fd9056333902A1738463519DC8', collateral: ADDRESSES.robinhood.NVDA }, // NVDA + { engine: '0xf2948B3De193934A0b45bc34C57ff5E25BcDA558', collateral: ADDRESSES.robinhood.AMD }, // AMD + { engine: '0x067aC120ec0D6e879f4C40426385EA0Ac3d2Cd0A', collateral: ADDRESSES.robinhood.MU }, // MU + { engine: '0xFA125B8406ed76E25962a20C340FE19bf41d3179', collateral: ADDRESSES.robinhood.TSLA }, // TSLA + { engine: '0xee1f486Ea6827Cd9fB87c35629A05707FF13cc03', collateral: ADDRESSES.robinhood.CASHCAT }, // CASHCAT { engine: '0x79CB40DF1aD78d0395290431e1f42324900180FB', collateral: '0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f' }, // SLV { engine: '0x128998305d895e2Eb4bF0F0AD0653a3F1D01762D', collateral: '0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f' }, // SLV { engine: '0xBF838a4D081CD323a75135F55D8F6Bf531EDB273', collateral: '0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f' }, // SLV { engine: '0x03A206E3E54ff3e570Bf144c79D05BDA1432a2de', collateral: '0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f' }, // SLV { engine: '0xdF4B6A4Fea65deE443F1dDeD9935f5aeB3627f11', collateral: '0x117cc2133c37B721F49dE2A7a74833232B3B4C0C' }, // SPY { engine: '0x4eACCE95247928487D500ad74A372D5bB607Cf03', collateral: '0xD5f3879160bc7c32ebb4dC785F8a4F505888de68' }, // QQQ - { engine: '0x9c5bCa4278E3A8d464945A1113D0645d9203463c', collateral: '0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9' }, // AAPL + { engine: '0x9c5bCa4278E3A8d464945A1113D0645d9203463c', collateral: ADDRESSES.robinhood.AAPL }, // AAPL { engine: '0x46d7e1a043A8a2fb4315FEa0AF1da8D498192F19', collateral: '0xe93237C50D904957Cf27E7B1133b510C669c2e74' }, // MSFT - { engine: '0x9abd97c7fA668dc92d9C9d15dAf870CE8c79a4A8', collateral: '0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3' }, // GOOGL - { engine: '0x655e64DD4Dfdf5d79C1f92b5F524db4E296d2945', collateral: '0x12f190a9F9d7D37a250758b26824B97CE941bF54' }, // AMZN - { engine: '0x70EfbaA4336F2b51A1360C6E2fdd6150bEe40b39', collateral: '0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35' }, // META - { engine: '0x6892b9C2777ad59ad3199EA5D0D54EEF725f5271', collateral: '0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC' }, // NVDA - { engine: '0xa71072C88c75B355a530569FAE22a7729fBd553A', collateral: '0x86923f96303D656E4aa86D9d42D1e57ad2023fdC' }, // AMD - { engine: '0xe82750025Ea94ec9401658DCB6CB2b1c5F3cb925', collateral: '0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD' }, // MU - { engine: '0xCc8dA6DD324e998660eA503E582aB9dEE8655820', collateral: '0x322F0929c4625eD5bAd873c95208D54E1c003b2d' }, // TSLA + { engine: '0x9abd97c7fA668dc92d9C9d15dAf870CE8c79a4A8', collateral: ADDRESSES.robinhood.GOOGL }, // GOOGL + { engine: '0x655e64DD4Dfdf5d79C1f92b5F524db4E296d2945', collateral: ADDRESSES.robinhood.AMZN }, // AMZN + { engine: '0x70EfbaA4336F2b51A1360C6E2fdd6150bEe40b39', collateral: ADDRESSES.robinhood.META }, // META + { engine: '0x6892b9C2777ad59ad3199EA5D0D54EEF725f5271', collateral: ADDRESSES.robinhood.NVDA }, // NVDA + { engine: '0xa71072C88c75B355a530569FAE22a7729fBd553A', collateral: ADDRESSES.robinhood.AMD }, // AMD + { engine: '0xe82750025Ea94ec9401658DCB6CB2b1c5F3cb925', collateral: ADDRESSES.robinhood.MU }, // MU + { engine: '0xCc8dA6DD324e998660eA503E582aB9dEE8655820', collateral: ADDRESSES.robinhood.TSLA }, // TSLA { engine: '0x9023FB0cA32204EE4cCe39e3e664aaEF1cD0A418', collateral: '0x117cc2133c37B721F49dE2A7a74833232B3B4C0C' }, // SPY { engine: '0x27979092F64883E6322262862e30F914d284c971', collateral: '0xD5f3879160bc7c32ebb4dC785F8a4F505888de68' }, // QQQ { engine: '0x8FeE2C05DC41765C4e3D550F1c33FAD6E679aA6a', collateral: '0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f' }, // SLV - { engine: '0xC29907317d8e78E9f6455F22577361b5184b449e', collateral: '0x020bfC650A365f8BB26819deAAbF3E21291018b4' }, // CASHCAT + { engine: '0xC29907317d8e78E9f6455F22577361b5184b449e', collateral: ADDRESSES.robinhood.CASHCAT }, // CASHCAT ], // Token P2P markets. V1/V2 custody open-offer cash and collateral at the market contract. p2pMarkets: [ - { address: '0xe548566e61439E6c95231FD42c9F601257E24A4d', collateral: '0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9' }, // v2 + { address: '0xe548566e61439E6c95231FD42c9F601257E24A4d', collateral: ADDRESSES.robinhood.AAPL }, // v2 { address: '0x0029D5302e23BD56924F6047b385E6Dda114D3f4', collateral: '0xe93237C50D904957Cf27E7B1133b510C669c2e74' }, // v2 - { address: '0x3fA22c7FD391D1FCf682dfa64cb73f688cD7076C', collateral: '0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3' }, // v2 - { address: '0xc686015A9F64829A4015E66D174EAC1B58490c48', collateral: '0x12f190a9F9d7D37a250758b26824B97CE941bF54' }, // v2 - { address: '0x72dE275366E6579c2Da148e24Eef24a5143f14b8', collateral: '0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35' }, // v2 - { address: '0xD21Ac17FB08b56788C2c94e010F5f33190254810', collateral: '0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC' }, // v2 - { address: '0x1119e475d9a5609423e0b7aF4B1CcD7ef2c21034', collateral: '0x86923f96303D656E4aa86D9d42D1e57ad2023fdC' }, // v2 - { address: '0x1F10cf271f75a76E0698c9A02F20F88122891df2', collateral: '0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD' }, // v2 - { address: '0x2CEBccf207BFc929889dce41531eaBcf6A0cee11', collateral: '0x322F0929c4625eD5bAd873c95208D54E1c003b2d' }, // v2 + { address: '0x3fA22c7FD391D1FCf682dfa64cb73f688cD7076C', collateral: ADDRESSES.robinhood.GOOGL }, // v2 + { address: '0xc686015A9F64829A4015E66D174EAC1B58490c48', collateral: ADDRESSES.robinhood.AMZN }, // v2 + { address: '0x72dE275366E6579c2Da148e24Eef24a5143f14b8', collateral: ADDRESSES.robinhood.META }, // v2 + { address: '0xD21Ac17FB08b56788C2c94e010F5f33190254810', collateral: ADDRESSES.robinhood.NVDA }, // v2 + { address: '0x1119e475d9a5609423e0b7aF4B1CcD7ef2c21034', collateral: ADDRESSES.robinhood.AMD }, // v2 + { address: '0x1F10cf271f75a76E0698c9A02F20F88122891df2', collateral: ADDRESSES.robinhood.MU }, // v2 + { address: '0x2CEBccf207BFc929889dce41531eaBcf6A0cee11', collateral: ADDRESSES.robinhood.TSLA }, // v2 { address: '0x0a4dd132f38345B4F134Cd660a9A513648F360f0', collateral: '0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f' }, // v2 - { address: '0xCA632493fE346183243C359676356Ffb6D5aF37B', collateral: '0x020bfC650A365f8BB26819deAAbF3E21291018b4' }, // v2 - { address: '0x24718Dd2970bBD1aA58AFd05223ca247Ce33c1cA', collateral: '0x39dBED3a2bd333467115dE45665cC57F813C4571' }, // v2 + { address: '0xCA632493fE346183243C359676356Ffb6D5aF37B', collateral: ADDRESSES.robinhood.CASHCAT }, // v2 + { address: '0x24718Dd2970bBD1aA58AFd05223ca247Ce33c1cA', collateral: ADDRESSES.robinhood.PONS }, // v2 { address: '0xc79e3d2a66265c92e721def2162efdc21bdacfa7', collateral: '0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f' }, // v1 { address: '0x41a381b4B5A98B330d4482F8a7b1469C2F63496e', collateral: '0x117cc2133c37B721F49dE2A7a74833232B3B4C0C' }, // v2 { address: '0xed6f454080F32B3ff78F2bb048906E3dCC75f630', collateral: '0xD5f3879160bc7c32ebb4dC785F8a4F505888de68' }, // v2 @@ -84,18 +84,18 @@ module.exports = { ], // V3 markets custody in per-offer vaults enumerated via nextOfferId / vaults(id). p2pV3Markets: [ - { address: '0xbcA2c4E897C7A988B0Aead0FBE92BCB87e190d25', collateral: '0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9' }, + { address: '0xbcA2c4E897C7A988B0Aead0FBE92BCB87e190d25', collateral: ADDRESSES.robinhood.AAPL }, { address: '0x0855f435bE9Fd3c1f42Bd773a130A5D61b0Cb6EB', collateral: '0xe93237C50D904957Cf27E7B1133b510C669c2e74' }, - { address: '0x34A9a43A5FF778B4015E24A16E963A0B5E6Cfd93', collateral: '0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3' }, - { address: '0x69c13ce4b28b936340Ce900fD35Ee5c799b7F7EC', collateral: '0x12f190a9F9d7D37a250758b26824B97CE941bF54' }, - { address: '0x781E21C6156f817aEFce9Fd868DdBc1aD226B23a', collateral: '0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35' }, - { address: '0xC373430223CF4559530D846E3aa46268FeC05851', collateral: '0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC' }, - { address: '0xA5059918bd0c4107E0EF6E634f7aee1BAF93940f', collateral: '0x86923f96303D656E4aa86D9d42D1e57ad2023fdC' }, - { address: '0x7945070E9Be31EE0fF192BD2F96B5bF1f417F0E2', collateral: '0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD' }, - { address: '0x8467cC58E4D3Fa3F48d6A522E2D119C2157Be6F2', collateral: '0x322F0929c4625eD5bAd873c95208D54E1c003b2d' }, + { address: '0x34A9a43A5FF778B4015E24A16E963A0B5E6Cfd93', collateral: ADDRESSES.robinhood.GOOGL }, + { address: '0x69c13ce4b28b936340Ce900fD35Ee5c799b7F7EC', collateral: ADDRESSES.robinhood.AMZN }, + { address: '0x781E21C6156f817aEFce9Fd868DdBc1aD226B23a', collateral: ADDRESSES.robinhood.META }, + { address: '0xC373430223CF4559530D846E3aa46268FeC05851', collateral: ADDRESSES.robinhood.NVDA }, + { address: '0xA5059918bd0c4107E0EF6E634f7aee1BAF93940f', collateral: ADDRESSES.robinhood.AMD }, + { address: '0x7945070E9Be31EE0fF192BD2F96B5bF1f417F0E2', collateral: ADDRESSES.robinhood.MU }, + { address: '0x8467cC58E4D3Fa3F48d6A522E2D119C2157Be6F2', collateral: ADDRESSES.robinhood.TSLA }, { address: '0xA4de9578B8E94377420BF30e53D7dB7DBc8427B8', collateral: '0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f' }, - { address: '0x36dD2b90e8e8541CcAB1258465732c4e961A9657', collateral: '0x020bfC650A365f8BB26819deAAbF3E21291018b4' }, - { address: '0x17c1B3CaBc49a196Ec39B7BA8409226eDe756A20', collateral: '0x39dBED3a2bd333467115dE45665cC57F813C4571' }, + { address: '0x36dD2b90e8e8541CcAB1258465732c4e961A9657', collateral: ADDRESSES.robinhood.CASHCAT }, + { address: '0x17c1B3CaBc49a196Ec39B7BA8409226eDe756A20', collateral: ADDRESSES.robinhood.PONS }, { address: '0x9C1eC6c0C5Ff43307EaA58408ff9674A5D4d7D09', collateral: '0x117cc2133c37B721F49dE2A7a74833232B3B4C0C' }, { address: '0xd41B87Ca091cbbf35dF36Aad9153d94248003163', collateral: '0xD5f3879160bc7c32ebb4dC785F8a4F505888de68' }, { address: '0x795a763dD618f0A9868898143285B34AB0128DA8', collateral: '0xC9a981FEE1F9DEc688bb123ccDeCc63D0deBFC4e' }, diff --git a/projects/udon/index.js b/projects/udon/index.js index 3293a8f6e1f..abea6906b03 100644 --- a/projects/udon/index.js +++ b/projects/udon/index.js @@ -28,6 +28,6 @@ module.exports = { timetravel: false, chromia: { tvl: (api) => tvl(api, false), - borrowed: (api) => tvl(api, true), + borrowed: () => ({}), // hacked }, } \ No newline at end of file diff --git a/projects/venomstake/index.js b/projects/venomstake/index.js index f5fc5d64c8c..529ed416a7a 100644 --- a/projects/venomstake/index.js +++ b/projects/venomstake/index.js @@ -1,14 +1,23 @@ -const { post, get } = require('../helper/http') -const BigNumber = require('bignumber.js') +const { getAccount, Slice } = require('../helper/chain/venom') -async function fetchTvl() { - const { data: { tvl } } = await get('https://api.venomstake.com/v1/strategies/main', { timeout: 30000 }); - return { venom: BigNumber(tvl).div(1e9) }; +// StEverVault, address from the venomstake.com frontend +const VAULT = '0:9df94dffc0ca1768647f819c04b2cf00c484b3b756ba6ecde68d5fb62de1dfc7' + +// vault storage (ABI 2.2 fields): _pubkey uint256, _timestamp uint64, _constructorFlag bool, nonce uint128, +// governance uint256, 3 code cells (refs), stEverSupply uint128, totalAssets uint128, ... (rest chained in the 4th ref) +async function tvl(api) { + const { data } = await getAccount(VAULT) + const s = new Slice(data) + s.skip(256 + 64) + if (!s.bit()) throw new Error('venomstake: vault storage not initialized') + s.skip(128 + 256) + s.skip(128) // stEverSupply + const totalAssets = s.uint(128) + api.addCGToken('venom', Number(totalAssets) / 1e9) } module.exports = { timetravel: false, - venom: { - tvl: fetchTvl - } -}; + methodology: 'TVL is the totalAssets (VENOM held by the vault plus VENOM delegated to its DePool strategies) of the VenomStake StEverVault, decoded from the vault account state.', + venom: { tvl }, +} diff --git a/projects/vibrswap/index.js b/projects/vibrswap/index.js deleted file mode 100644 index 5ed2fbae651..00000000000 --- a/projects/vibrswap/index.js +++ /dev/null @@ -1,9 +0,0 @@ -const { iziswapExport } = require('../helper/iziswap') - -const poolHelpers = { - 'neon_evm': ['0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF'], -} // liquidityManager contracts - -Object.keys(poolHelpers).forEach(chain => { - module.exports[chain] = { tvl: iziswapExport({ poolHelpers: poolHelpers[chain] }), } -}) \ No newline at end of file diff --git a/projects/weave/index.js b/projects/weave/index.js deleted file mode 100644 index 1ccf21217c0..00000000000 --- a/projects/weave/index.js +++ /dev/null @@ -1,22 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') - -const WKAVA = ADDRESSES.kava.WKAVA; -const STRATEGY_CONTRACT = '0x9633a42E4f73F465DD421b22C09E2787493DaAdA' - -async function tvl(api) { - const strategyBalance = await api.call({ - abi: 'erc20:balanceOf', - target: WKAVA, - params: [STRATEGY_CONTRACT], - }); - - api.add(WKAVA, strategyBalance) -} - -module.exports = { - deadFrom: '2026-09-30', - methodology: 'gets the balance of the strategy contract', - kava: { - tvl, - } -}; \ No newline at end of file diff --git a/projects/web3world/index.js b/projects/web3world/index.js index 850b8ae0757..a3d3e99f239 100644 --- a/projects/web3world/index.js +++ b/projects/web3world/index.js @@ -1,22 +1,73 @@ -const { post } = require('../helper/http') +const { getAccount, getAccountsByCodeHash, cellHash, decodeFields } = require('../helper/chain/venom') -const url = "https://api.web3.world/v2/pools" +// api.web3.world is gone; pools are read from chain. Addresses come from the web3.world frontend config, +// storage layouts from the contract ABIs (web3.world bundle / broxus flatqube-contracts). +const DEX_ROOT = '0:8befb8324b036876ac5da268570031c10b0baa5c26bc7f69af17b2db20fc09b7' +const ST_VENOM_VAULT = '0:9df94dffc0ca1768647f819c04b2cf00c484b3b756ba6ecde68d5fb62de1dfc7' -const payload = { - limit: 1000, - offset: 0, - ordering: "tvldescending", - whiteListUri: "https://static.web3.world/assets/manifest.json" +const ST_VENOM = '0:74604c7a56419477d67329848d754d205f31870025a7135909e90e1726ad9a54' +// token roots (web3.world token manifest) -> coingecko id + decimals +const tokens = { + '0:77d36848bb159fa485628bc38dc37eadb74befa514395e09910f601b841f749e': ['venom', 9], // wVENOM + [ST_VENOM]: ['venom', 9], // stVENOM, scaled by the vault exchange rate + '0:8a4ed4483500caf2d4bb4b56c84df41009cc3d0ed6a9de05d853e26a30faeced': ['tether', 6], // USDT + '0:cda5e8d5953e1a09ffeb9f62316f2994019f10abe83c8f1b0aadfbc997bd79e6': ['usd-coin', 6], // USDC + '0:0447c738d8549c5ea92f1c945628367db4adcc706685f760c93f8b236bf8e7e4': ['dai', 18], // DAI + '0:4ff3c0f078889cbda817a5f5f2651824dea11a84f3857df27e76fee37d541877': ['wrapped-bitcoin', 8], // WBTC + '0:60b3ebf994515df7985cb62a9d141467edf2f869272baf507dc83d9ba2e1b199': ['ethereum', 18], // WETH + '0:0a75b9ad65982b02493491b00454b34dcecb9e63700d560fc001473659297661': ['binancecoin', 18], // BNB + '0:3558fbc02e33cd62a5c2702f9405e272c41ede875956d2179074fe25bb4d1ce8': ['fantom', 18], // FTM + '0:e04e68f58e85ea3ce3976356c4aefaa47c983bd9394bcf2a16c2252e7c27a39e': ['polygon-ecosystem-token', 18], // MATIC + '0:10d6d5c11f7ce319842b9ceb8bc9ee4d64f317cd99f1f4ce17985e7ef50e2d2d': ['avalanche-2', 18], // AVAX } -const tvl = async (api) => { - const { pools } = await post(url, payload, { timeout: 30000 }) - pools.forEach(({ tvl }) => { - api.addUSDValue(Math.round(tvl)) - }) +const ROOT_FIELDS = [{ name: '_pubkey', type: 'uint256' }, { name: '_timestamp', type: 'uint64' }, { name: '_constructorFlag', type: 'bool' }, { name: 'platform_code', type: 'cell' }, { name: '_nonce', type: 'uint32' }, { name: '_accountCode', type: 'cell' }, { name: '_accountVersion', type: 'uint32' }, { name: '_pairCodes', type: 'map(uint8,cell)' }, { name: '_pairVersions', type: 'map(uint8,uint32)' }, { name: '_poolCodes', type: 'map(uint8,cell)' }] + +const PAIR_FIELDS = [{ name: '_pubkey', type: 'uint256' }, { name: '_timestamp', type: 'uint64' }, { name: '_constructorFlag', type: 'bool' }, { name: 'platform_code', type: 'cell' }, { components: [{ name: 'price0To1Cumulative', type: 'uint256' }, { name: 'price1To0Cumulative', type: 'uint256' }], name: '_points', type: 'map(uint32,tuple)' }, { name: '_length', type: 'uint16' }, { components: [{ name: 'minInterval', type: 'uint8' }, { name: 'minRateDeltaNumerator', type: 'uint128' }, { name: 'minRateDeltaDenominator', type: 'uint128' }, { name: 'cardinality', type: 'uint16' }], name: '_options', type: 'tuple' }, { name: '_root', type: 'address' }, { name: '_vault', type: 'address' }, { name: '_active', type: 'bool' }, { name: '_currentVersion', type: 'uint32' }, { components: [{ name: 'denominator', type: 'uint128' }, { name: 'pool_numerator', type: 'uint128' }, { name: 'beneficiary_numerator', type: 'uint128' }, { name: 'referrer_numerator', type: 'uint128' }, { name: 'beneficiary', type: 'address' }, { name: 'threshold', type: 'map(address,uint128)' }, { name: 'referrer_threshold', type: 'map(address,uint128)' }], name: '_fee', type: 'tuple' }, { name: '_typeToRootAddresses', type: 'map(uint8,address[])' }, { name: '_typeToWalletAddresses', type: 'map(uint8,address[])' }, { name: '_typeToReserves', type: 'map(uint8,uint128[])' }] + +const POOL_FIELDS = [{ name: '_pubkey', type: 'uint256' }, { name: '_timestamp', type: 'uint64' }, { name: '_constructorFlag', type: 'bool' }, { name: 'platform_code', type: 'cell' }, { name: 'root', type: 'address' }, { name: 'vault', type: 'address' }, { name: 'active', type: 'bool' }, { name: 'current_version', type: 'uint32' }, { name: 'tokenData', type: 'tuple[]', components: [{ name: 'root', type: 'address' }, { name: 'wallet', type: 'address' }, { name: 'balance', type: 'uint128' }, { name: 'decimals', type: 'uint8' }, { name: 'accumulatedFee', type: 'uint128' }, { name: 'rate', type: 'uint256' }, { name: 'precisionMul', type: 'uint256' }, { name: 'decimalsLoaded', type: 'bool' }, { name: 'initialized', type: 'bool' }] }] + +const VAULT_FIELDS = [{ name: '_pubkey', type: 'uint256' }, { name: '_timestamp', type: 'uint64' }, { name: '_constructorFlag', type: 'bool' }, { name: 'nonce', type: 'uint128' }, { name: 'governance', type: 'uint256' }, { name: 'platformCode', type: 'cell' }, { name: 'accountCode', type: 'cell' }, { name: 'clusterCode', type: 'cell' }, { name: 'stEverSupply', type: 'uint128' }, { name: 'totalAssets', type: 'uint128' }] + +const PAIR_TYPE_TOKENS = 1n // _typeToRootAddresses / _typeToReserves key for the two pool tokens + +async function tvl(api) { + const vault = decodeFields((await getAccount(ST_VENOM_VAULT)).data, VAULT_FIELDS) + const stVenomRate = Number(vault.totalAssets) / Number(vault.stEverSupply) + const add = (root, amount, multiplier = 1) => { + const [cgId, decimals] = tokens[root] + const rate = root === ST_VENOM ? stVenomRate : 1 + api.addCGToken(cgId, Number(amount) / 10 ** decimals * rate * multiplier) + } + + const dexRoot = decodeFields((await getAccount(DEX_ROOT)).data, ROOT_FIELDS) + const codeHashes = (codes) => [...codes.values()].map((code) => cellHash(code).toString('hex')) + + // constant product pairs: count both reserves when both tokens are known, else twice the known side + for (const codeHash of codeHashes(dexRoot._pairCodes)) { + for (const pair of await getAccountsByCodeHash(codeHash)) { + const d = decodeFields((await getAccount(pair)).data, PAIR_FIELDS) + const roots = d._typeToRootAddresses.get(PAIR_TYPE_TOKENS) ?? [] + const reserves = d._typeToReserves.get(PAIR_TYPE_TOKENS) ?? [] + if (roots.length !== 2 || reserves[0] === undefined || reserves[1] === undefined) continue // not initialized + const known = roots.map((root) => !!tokens[root]) + if (known[0] && known[1]) { add(roots[0], reserves[0]); add(roots[1], reserves[1]) } + else if (known[0]) add(roots[0], reserves[0], 2) + else if (known[1]) add(roots[1], reserves[1], 2) + } + } + + // stable pools keep each token's balance in tokenData + for (const codeHash of codeHashes(dexRoot._poolCodes)) { + for (const pool of await getAccountsByCodeHash(codeHash)) { + const d = decodeFields((await getAccount(pool)).data, POOL_FIELDS) + for (const { root, balance } of d.tokenData) if (tokens[root]) add(root, balance) + } + } } module.exports = { - misrepresentedTokens: true, - venom: { tvl } -}; + timetravel: false, + methodology: 'TVL is the reserves of all Web3.World constant product pairs and stable pools, decoded from the pool account states found via the DexRoot pair/pool code hashes. Only tokens with a known price are counted; for pairs with one known token, that side is doubled.', + venom: { tvl }, +} diff --git a/projects/yearn/index.js b/projects/yearn/index.js index 4b1a11d805b..dbf4a5cc94b 100644 --- a/projects/yearn/index.js +++ b/projects/yearn/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') const sdk = require('@defillama/sdk') @@ -34,15 +35,15 @@ const registeredNestedVaults = [ { chainId: 1, parent: '0xa74d4b67b3368e83797a35382afb776baae4f5c8', strategy: '0x85b360dee557135d8903225939699dd644d33cb8', child: '0x4cbb6a5ec00ceec252a7091559484f7adb83165f', getter: 'yVault' }, { chainId: 1, parent: '0xa9fe4601811213c340e850ea305481aff02f5b28', strategy: '0xe5f7f2e59b259e11ecf2ff76fdf5dc7438363a3f', child: '0xa258c4606ca8206d8aa700ce2143d7db854d168c', getter: 'yVault' }, { chainId: 1, parent: '0xb4ada607b9d6b2c9ee07a275e9616b84ac560139', strategy: '0xaad21781fe48048264d89da52423097e4397ff36', child: '0xb37094c1b5614bd6ece40afb295c26f4377069d3', getter: 'yVault' }, - { chainId: 1, parent: '0xbe53a109b494e5c9f97b9cd39fe969be68bf6204', strategy: '0x39c0aec5738ed939876245224afc7e09c8480a52', child: '0x182863131f9a4630ff9e27830d945b1413e347e8', getter: 'vault', parentAsset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', childAsset: '0xdc035d45d973e3ec169d2276ddab16f1e407384f', parentDecimals: 6, childDecimals: 18 }, + { chainId: 1, parent: '0xbe53a109b494e5c9f97b9cd39fe969be68bf6204', strategy: '0x39c0aec5738ed939876245224afc7e09c8480a52', child: '0x182863131f9a4630ff9e27830d945b1413e347e8', getter: 'vault', parentAsset: ADDRESSES.ethereum.USDC, childAsset: ADDRESSES.ethereum.USDS, parentDecimals: 6, childDecimals: 18 }, { chainId: 1, parent: '0xbfedbcbe27171c418cdabc2477042554b1904857', strategy: '0xa7074434aa4419ed18f220152bcaa989b3b9d8c1', child: '0x77e829fff18c14ad9bb88963acb0010a0506de88', getter: 'yVault' }, { chainId: 1, parent: '0xd6ea40597be05c201845c0bfd2e96a60bacde267', strategy: '0xb2f45226d0b1ebe7ce3c7b0a53eb4a82e032060d', child: '0xae6ed98b1bd9aadd3185160324e0e011159b61d3', getter: 'yVault' }, { chainId: 1, parent: '0xda816459f1ab5631232fe5e97a05bbbb94970c95', strategy: '0xa7496763f035e73ec6b56f4c86312cc1874a01e3', child: '0x028ec7330ff87667b6dfb0d94b954c820195336c', getter: 'yVault' }, { chainId: 1, parent: '0xdcd90c7f6324cfa40d7169ef80b12031770b4325', strategy: '0x9084b5a98e3b4b257affd82ae4a1753f87906dce', child: '0x5b8c556b8b2a78696f0b9b830b3d67623122e270', getter: 'yVault' }, { chainId: 1, parent: '0xe14d13d8b3b85af791b2aadd661cdbd5e6097db1', strategy: '0x0a5157244e4f82f100a461ca65c7b05c8dacf835', child: '0xdb25ca703181e7484a155dd612b06f57e12be5f0', getter: 'yVault' }, { chainId: 1, parent: '0xe537b5cc158eb71037d4125bdd7538421981e6aa', strategy: '0x906a5fb545d177ba441a57b3a24eaeda555d29e3', child: '0x8078198fc424986ae89ce4a910fc109587b6abf3', getter: 'yVault' }, - { chainId: 1, parent: '0x92545bce636e6ee91d88d2d017182cd0bd2fc22e', strategy: '0x6164217caa4ff58fb722d726391875ac0c5fb541', child: '0xe852db931ac6f02490a32695f09ee79a31f53821', getter: 'vault', parentAsset: '0x6b175474e89094c44da98b954eedeac495271d0f', childAsset: '0xdc035d45d973e3ec169d2276ddab16f1e407384f', parentDecimals: 18, childDecimals: 18 }, - { chainId: 1, parent: '0x696d02db93291651ed510704c9b286841d506987', strategy: '0x9e0a5943dfc1a85b48c191aa7c10487297aa675b', child: '0xc9f01b5c6048b064e6d925d1c2d7206d4feef8a3', getter: 'vault', parentAsset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', childAsset: '0xdc035d45d973e3ec169d2276ddab16f1e407384f', parentDecimals: 6, childDecimals: 18 }, + { chainId: 1, parent: '0x92545bce636e6ee91d88d2d017182cd0bd2fc22e', strategy: '0x6164217caa4ff58fb722d726391875ac0c5fb541', child: '0xe852db931ac6f02490a32695f09ee79a31f53821', getter: 'vault', parentAsset: ADDRESSES.ethereum.DAI, childAsset: ADDRESSES.ethereum.USDS, parentDecimals: 18, childDecimals: 18 }, + { chainId: 1, parent: '0x696d02db93291651ed510704c9b286841d506987', strategy: '0x9e0a5943dfc1a85b48c191aa7c10487297aa675b', child: '0xc9f01b5c6048b064e6d925d1c2d7206d4feef8a3', getter: 'vault', parentAsset: ADDRESSES.ethereum.USDC, childAsset: ADDRESSES.ethereum.USDS, parentDecimals: 6, childDecimals: 18 }, { chainId: 1, parent: '0x028ec7330ff87667b6dfb0d94b954c820195336c', strategy: '0xaedf7d5f3112552e110e5f9d08c9997adce0b78d', child: '0x182863131f9a4630ff9e27830d945b1413e347e8' }, // DAI-1 -> (DAI/USDS) -> USDS-1 { chainId: 1, parent: '0x028ec7330ff87667b6dfb0d94b954c820195336c', strategy: '0xff03dce6d95aa7a30b75efbafd11384221b9f9b5', child: '0xbe53a109b494e5c9f97b9cd39fe969be68bf6204' }, // DAI-1 -> (DAI/USDC) -> USDC-1 ] @@ -68,8 +69,8 @@ async function remoteOverlap(api, vaults, strategyAbi) { const remoteAsset = await remote.call({ target: child, abi: 'address:asset' }) if (Number(chain) !== 747474 || counterpart.toLowerCase() !== holder || reverse.toLowerCase() !== strategy || destination.toLowerCase() !== child || - asset.toLowerCase() !== '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' || - remoteAsset.toLowerCase() !== '0x203a662b0bd271a6ed5a60edfbd04bfce608fd36') + asset.toLowerCase() !== ADDRESSES.ethereum.USDC || + remoteAsset.toLowerCase() !== ADDRESSES.katana.VB_USDC) throw new Error('Yearn Katana overlap route changed') const debt = await api.call({ target: parent, abi: strategyAbi, params: [strategy] }) const shares = BigInt(await remote.call({ target: child, abi: 'erc20:balanceOf', params: [holder] })) diff --git a/projects/yelay-v3/index.js b/projects/yelay-v3/index.js index 6460506c35d..847c33ed601 100644 --- a/projects/yelay-v3/index.js +++ b/projects/yelay-v3/index.js @@ -5,33 +5,45 @@ const abi = { const { getConfig } = require('../helper/cache'); const { staking } = require('../helper/staking') -// the vault list comes from lite.api.yelay.io which is intermittently 503; getConfig caches the last good response +// lite.api.yelay.io (vault list) has been returning 503 since ~2026-08; the static lists below come from +// https://github.com/YieldLayer/yelay-lite/tree/12166bb607ea55ef27089cc665746a8380c07893/deployments (+ main), +// and any extra vaults the api returns while it is up are merged in const vaultsEndpoint = (chainId) => `https://lite.api.yelay.io/v2/vaults?chainId=${chainId}`; const chains = [ - {chainId: 1, name: "ethereum"}, - {chainId: 146, name: "sonic"}, - {chainId: 8453, name: "base"}, + {chainId: 1, name: "ethereum", vaults: [ + '0x39DAc87bE293DC855b60feDd89667364865378cc', // USDC + '0x4d95E929ABb21b6C6C0FF1ff0Ac69609e02BB368', // WETH + '0x6545e81356CE709823EA8797E566A60934A9B110', // WBTC + '0x615989F57f6da73C3a1f96a347536941D88e7E0A', // USDC (current deployment) + ]}, + {chainId: 146, name: "sonic", vaults: [ + '0x56b0c5C989C65e712463278976ED26D6e07592ab', // USDC.e + '0x6880bb001417f123f824c573A07a991e0cD00daC', // wS + '0xAB865D95A574511a6c893C38A4D892275ca70570', // WETH + ]}, + {chainId: 8453, name: "base", vaults: [ + '0x0c6dAf9B4e0EB49A0c80c325da82EC028Cb8118B', // USDC + '0xf0533A9eb11b144aC3B9BbE134728D0F7F547c52', // WETH + '0x47a879ac3C9646116326B4A1462e1D477056Aff0', // cbBTC + ]}, ]; module.exports = { methodology: `Counting totalAssets held by vaults.`, }; -chains.forEach(({chainId, name}) => { +chains.forEach(({chainId, name, vaults: staticVaults}) => { module.exports[name] = { tvl: async (api) => { - const vaults = await getConfig(`yelay-v3/${name}`, vaultsEndpoint(chainId)); - if (!Array.isArray(vaults)) throw new Error(`yelay vault list unavailable for ${name} (api down and no cached copy)`) - const underlying = await api.multiCall({ - abi: abi.underlyingAsset, - calls: vaults.map((v) => v.address), - }); - const balances = await api.multiCall({ - abi: abi.totalAssets, - calls: vaults.map((v) => v.address), - }); + const apiVaults = await getConfig(`yelay-v3/${name}`, vaultsEndpoint(chainId)); + const vaults = [...new Set([ + ...staticVaults, + ...(Array.isArray(apiVaults) ? apiVaults.map((v) => v.address) : []), + ].map((v) => v.toLowerCase()))]; + const underlying = await api.multiCall({ abi: abi.underlyingAsset, calls: vaults }); + const balances = await api.multiCall({ abi: abi.totalAssets, calls: vaults }); underlying.forEach((u, i) => api.addTokens(u, balances[i])); return api.getBalances(); }, diff --git a/registries/deadAdapters.json b/registries/deadAdapters.json index 42c3155cae2..36dd10a7a84 100644 --- a/registries/deadAdapters.json +++ b/registries/deadAdapters.json @@ -5593,6 +5593,12 @@ }, "methodology": "Counts MIM and TLP (SASHI-MIM) on the treasury" }, + "scanto": { + "canto": { + "tvl": "_f" + }, + "deadFrom": "2026-09-26" + }, "scream": { "hallmarks": [ [ @@ -7119,6 +7125,13 @@ "tvl": "_f" } }, + "y2r": { + "misrepresentedTokens": true, + "canto": { + "tvl": "_f" + }, + "deadFrom": "2026-09-26" + }, "yetiFinance": { "misrepresentedTokens": true, "start": "2022-04-15", @@ -7333,17 +7346,278 @@ "tvl": "_f" } }, - "scanto": { - "canto": { + "LiquidOps": { + "deadFrom": "2026-10-07", + "methodology": "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.", + "ao": { + "tvl": "_f", + "borrowed": "_f" + } + }, + "accumulator": { + "misrepresentedTokens": true, + "shimmer_evm": { "tvl": "_f" }, - "deadFrom": "2026-09-26" + "deadFrom": "2026-10-18" }, - "y2r": { + "akiba": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f", + "staking": "_f", + "pool2": "_f" + } + }, + "beekava": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f", + "pool2": "_f", + "staking": "_f" + } + }, + "cotiTreasury": { + "deadFrom": "2026-10-11", + "timetravel": false, + "coti": { + "tvl": "_f", + "staking": "_f" + } + }, + "crunchynetwork-wtz": { + "deadFrom": "2026-01-01", + "timetravel": false, + "tezos": { + "tvl": "_f" + } + }, + "embr-bridge": { + "timetravel": false, + "embr": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, + "funbear": { + "deadFrom": "2026-09-30", + "methodology": "TVL counts staked FUNB coins on the platform itself.", + "kava": { + "tvl": "_f", + "staking": "_f" + } + }, + "gamutexchange": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f" + } + }, + "ifpool": { + "methodology": "Counts staked CET tokens.", + "timetravel": false, + "csc": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, + "iotabee": { + "shimmer_evm": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, + "kaDefi": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f", + "staking": "_f" + } + }, + "kavastarter": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f", + "staking": "_f" + } + }, + "kinetix": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f", + "staking": "_f" + } + }, + "kmex-io": { + "deadFrom": "2026-09-30", + "kava": { + "staking": "_f", + "tvl": "_f" + } + }, + "mangrove": { + "misrepresentedTokens": false, + "methodology": "TVL is calculated by getting the total promised liquidity on the orderbook on a specific block.", + "start": "2024-02-27", + "deadFrom": "2025-02-27", + "blast": { + "tvl": "_f" + }, + "arbitrum": { + "tvl": "_f" + } + }, + "metric": { + "ethereum": { + "tvl": "_f" + }, + "base": { + "tvl": "_f" + }, + "arbitrum": { + "tvl": "_f" + }, + "bsc": { + "tvl": "_f" + }, + "avax": { + "tvl": "_f" + }, + "polygon": { + "tvl": "_f" + }, + "megaeth": { + "tvl": "_f" + }, + "hyperliquid": { + "tvl": "_f" + }, + "monad": { + "tvl": "_f" + }, + "robinhood": { + "tvl": "_f" + }, + "methodology": "TVL is the sum of token0 and token1 balances held by every pool created by the Metric pool factory. Pools are discovered on-chain from the factory PoolCreated events.", + "deadFrom": "2026-10-08" + }, + "pxswap": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f" + } + }, + "quicksilver": { + "timetravel": false, + "methodology": "Sum of all the tokens that are liquid staked on Quicksilver", + "quicksilver": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, + "rubyfinance": { + "deadFrom": "2026-09-30", + "hallmarks": [ + [ + "2022-08-15", + "incentives not given" + ] + ], + "methodology": "Pool2 deposits consist of RUBY/USDC, RUBY/KAVA, RSHARE/KAVA and RUBY/RSHARE LP deposits while the staking TVL consists of the RSHARE tokens locked within the Boardroom contract.", + "kava": { + "tvl": "_f", + "pool2": "_f", + "staking": "_f" + } + }, + "sailing-portfolios": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f" + }, + "methodology": "The assets in the balancer are detected and counted." + }, + "scrt": { "misrepresentedTokens": true, - "canto": { + "secret": { "tvl": "_f" }, - "deadFrom": "2026-09-26" + "deadFrom": "2026-10-18" + }, + "secretswap": { + "misrepresentedTokens": true, + "secret": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, + "selfex": { + "deadFrom": "2026-09-30", + "misrepresentedTokens": true, + "kava": { + "tvl": "_f" + } + }, + "shadeprotocol-derivatives": { + "timetravel": false, + "methodology": "TVL counts SCRT backing stkd-SCRT using the staking contract accounting plus active unbonding SCRT.", + "secret": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, + "sienna": { + "timetravel": false, + "secret": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, + "sienna-lend": { + "secret": { + "tvl": "_f", + "borrowed": "_f", + "staking": "_f" + }, + "deadFrom": "2026-10-18" + }, + "stakedicp": { + "deadFrom": "2026-10-07", + "timetravel": false, + "methodology": "TVL counts ICP deposited as collateral to mint stICP", + "icp": { + "tvl": "_f" + } + }, + "tangleswap": { + "shimmer_evm": { + "tvl": "_f", + "staking": "_f" + }, + "milkomeda": { + "tvl": "_f", + "staking": "_f" + }, + "deadFrom": "2026-10-18" + }, + "tonswap": { + "misrepresentedTokens": true, + "everscale": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, + "vibrswap": { + "neon_evm": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, + "weave": { + "deadFrom": "2026-09-30", + "methodology": "gets the balance of the strategy contract", + "kava": { + "tvl": "_f" + } } } \ No newline at end of file diff --git a/registries/erc4626.js b/registries/erc4626.js index 91514c3533d..1d311d1f772 100644 --- a/registries/erc4626.js +++ b/registries/erc4626.js @@ -480,7 +480,7 @@ const configs = { '0x49A991e33B80d6c5F727242C778DbFeb606b6259', ], arbitrum: [ - '0xea7aaf1713348be6f3556d4b94a44ddff20f9e4b', + // '0xea7aaf1713348be6f3556d4b94a44ddff20f9e4b', '0x3163a647ff4c819b6286d2dbc8405a124c93eba6', '0x645c2712fda24a41ed61064054429e00cb4293bb', '0x3b1ef6cca0672bb08df2c817b37dca22a69b005f', diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 506369adb39..adb24f82dfd 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -7215,7 +7215,7 @@ const configs = { ], "tokens": [ ADDRESSES.robinhood.USDG, - "0x020bfc650a365f8bb26819deaabf3e21291018b4", // CASHCAT + ADDRESSES.robinhood.CASHCAT, // CASHCAT "0x98096d17e191b3da1d5f99a6d7b3584351b11e18" // BONER ] }, @@ -11341,7 +11341,7 @@ const configs = { "DSBCG2FORGX4RGZNSSPFM7DDPUDLFLMIJI3M4W2Y6CFVTVIFX45GOFLI7M", "5GEXLLGTAMM35R6JERPH2DNFZD4DPYSX5WFB5SN7KJJBSPJI2Q7AWEOQTM", "5SMZS7576XQOJ7LGLCD7KD4ZRDM5XMPWWDKYZZ5NM6VERF6AQLBWCV5ZOY", - "OWARNBYQ62VAERID5S25V3WRAVEH3DRN2ZBE2WG55CDCELO6FHRXO4A5ZA", + // "OWARNBYQ62VAERID5S25V3WRAVEH3DRN2ZBE2WG55CDCELO6FHRXO4A5ZA", "3FCD7HFUIO7GKD7YRCVDAGAO4SLVNGSBYLLPGUY2ILYTUQ3IE5KI2WGAUQ", "DNWJQGUOPYUHNQBN2Y42VC53J4TAOZWWWPWCRLKMC4NGT4LIAGTYMEIH6Q", "4WVMYYCZXGNPOD3FNN3SG5NY7VJ7DYFDCMDVNU4A6R3CKGFCM6PJDLZAWA", @@ -14669,7 +14669,7 @@ const configs = { "flare": { "owner": "0x4C18Ff3C89632c3Dd62E796c0aFA5c07c4c1B2b3", "tokens": [ - "0xad552a648c74d49e10027ab8a618a3ad4901c5be" + ADDRESSES.flare.FXRP ] }, }, @@ -14698,7 +14698,7 @@ const configs = { "0x7e1C6870be30c1f8216f0187C7f181C13c52977A" ], [ - "0xAd552A648C74D49E10027AB8a618A3ad4901c5bE", + ADDRESSES.flare.FXRP, "0x695b696E80f6f7137731eF509D64023F17550eCE" ], [ @@ -16042,13 +16042,13 @@ const configs = { "robinhood": { "owner": "0x43e4aa3204A2d3cee2E12532195E9a6b766a3639", "tokens": [ - "0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9", + ADDRESSES.robinhood.AAPL, "0xe93237C50D904957Cf27E7B1133b510C669c2e74", - "0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3", - "0x12f190a9F9d7D37a250758b26824B97CE941bF54", - "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC", - "0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35", - "0x322F0929c4625eD5bAd873c95208D54E1c003b2d", + ADDRESSES.robinhood.GOOGL, + ADDRESSES.robinhood.AMZN, + ADDRESSES.robinhood.NVDA, + ADDRESSES.robinhood.META, + ADDRESSES.robinhood.TSLA, ] } }, diff --git a/registries/sumTokens/data1.js b/registries/sumTokens/data1.js index c5c8c4f1c72..1a8cd248d98 100644 --- a/registries/sumTokens/data1.js +++ b/registries/sumTokens/data1.js @@ -780,4 +780,26 @@ module.exports = { "tokens": [ADDRESSES.morph.USDT0] } }, + "neby-dex": { + // pools from the last good graph.api.neby.exchange response (subgraph host no longer resolves) + "sapphire": { + "ownerTokens": [ + [["0x3cabbe76ea8b4e7a2c0a69812cbe671800379ec8", "0xed57966f1566de1a90042d07403021ea52ad4724"], "0x09eebb65a41cc45543e596ce1dc10d071265ad04"], + [["0x6665a6cae3f52959f0f653e3d04270d54e6f13d8", "0x8bc2b030b299964eefb5e1e0b36991352e56d2d3"], "0x2c47941cfdf58d2f9a9490d84fadecc284d63b0a"], + [["0x8bc2b030b299964eefb5e1e0b36991352e56d2d3", "0x97eec1c29f745dc7c267f90292aa663d997a601d"], "0x3a2976b76b9af12639878b87b4ccef2e951ca5aa"], + [["0x8bc2b030b299964eefb5e1e0b36991352e56d2d3", "0xa14167756d9f86aed12b472c29b257bbdd9974c2"], "0x419fe2b60f0ea02051b073b71f2326550d371f94"], + [["0x8bc2b030b299964eefb5e1e0b36991352e56d2d3", "0x932dd32885eee8dccdb8e0475cf2e9bfc8527f9d"], "0x6cdcf811073b358031239e3792aefcdd875498b0"], + [["0xa14167756d9f86aed12b472c29b257bbdd9974c2", "0xdd629e5241cbc5919847783e6c96b2de4754e438"], "0x85955d332de1ce53393f4dc6e3f0bb9d95436e56"], + [["0x2f301d3b045544a9d7ec3fa090cd78986f11f2e7", "0x3cabbe76ea8b4e7a2c0a69812cbe671800379ec8"], "0x9b62a385c488b5c088cb9ade548f18e3953d5581"], + [["0x8bc2b030b299964eefb5e1e0b36991352e56d2d3", "0xe4ea254e07c3403fc67ece108fb5eb039a246231"], "0xa0f83725a5a86e81992134ebdf6e7e4f2ff47886"], + [["0x932dd32885eee8dccdb8e0475cf2e9bfc8527f9d", "0x97eec1c29f745dc7c267f90292aa663d997a601d"], "0xb4f45dd65046aeeee0ec56df60074b5d1c89f067"], + [["0x8c4acd74ff4385f3b7911432fa6787aa14406f8b", "0x97eec1c29f745dc7c267f90292aa663d997a601d"], "0xbeb97bcda42c8de9e24fe7dfb0397dd4b069ddc3"], + [["0x3cabbe76ea8b4e7a2c0a69812cbe671800379ec8", "0x8bc2b030b299964eefb5e1e0b36991352e56d2d3"], "0xda6b7b88f5c659b08df37e6daf043d52b985e8ff"], + [["0x8bc2b030b299964eefb5e1e0b36991352e56d2d3", "0xb6dc6c8b71e88642cead3be1025565a9ee74d1c6"], "0xeafb04b5d4fb753c32dbb2ec32b3bf7cdc7f5144"], + [["0x3cabbe76ea8b4e7a2c0a69812cbe671800379ec8", "0xa14167756d9f86aed12b472c29b257bbdd9974c2"], "0xeb941037f8aa4ce8680666b8af62dd88b2227da2"], + [["0x8bc2b030b299964eefb5e1e0b36991352e56d2d3", "0x8c4acd74ff4385f3b7911432fa6787aa14406f8b"], "0xee91352a9aba9ae2ce677545ef138a9759e50629"], + [["0x3cabbe76ea8b4e7a2c0a69812cbe671800379ec8", "0xed57966f1566de1a90042d07403021ea52ad4724"], "0xf867baf89c435cea8d2938289924604bc95be3a2"], + ] + } + }, } diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 295ba4ff2d0..b218155f708 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -548,7 +548,7 @@ module.exports = { }, "sparkdex-perps": { "flare": { - "tvl": { "owners": ["0x74DA11B3Bb05277CF1cd3572a74d626949183e58"], "tokens": [ADDRESSES.flare.WFLR,ADDRESSES.flare.sFLR,ADDRESSES.morph.USDT0,"0xad552a648c74d49e10027ab8a618a3ad4901c5be"] }, + "tvl": { "owners": ["0x74DA11B3Bb05277CF1cd3572a74d626949183e58"], "tokens": [ADDRESSES.flare.WFLR,ADDRESSES.flare.sFLR,ADDRESSES.morph.USDT0,ADDRESSES.flare.FXRP] }, }, }, "corex": { @@ -855,7 +855,7 @@ module.exports = { "deepstate": { methodology: "TVL is the value of USDG, NVDA, and DEEP held by the Deepstate router as collateral for resting orders or as matched proceeds awaiting maker claims.", "robinhood": { - "tvl": { "owners": ["0x6cf19308C22FC82ea620Fa0B3E94948d20f27B96"], "tokens": [ADDRESSES.robinhood.USDG, "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC"] }, + "tvl": { "owners": ["0x6cf19308C22FC82ea620Fa0B3E94948d20f27B96"], "tokens": [ADDRESSES.robinhood.USDG, ADDRESSES.robinhood.NVDA] }, "staking": { "owners": ["0x6cf19308C22FC82ea620Fa0B3E94948d20f27B96"], "tokens": ["0x1DA24f6Bb623b9d1aFEae3F3146659A2662D6d27", "0xbfb7b3Ff3D498a559b946B836d26F0E168f273D5"] }, } }, @@ -1008,13 +1008,13 @@ module.exports = { "robinhood": { "tokensAndOwners": [ // audited build, 2026-09-18, maturity 2027-12-31 - ["0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9", "0x131179E65Ab5C0538f5191920233Fd9Dc31930d1"], // AAPL-DEC27 + [ADDRESSES.robinhood.AAPL, "0x131179E65Ab5C0538f5191920233Fd9Dc31930d1"], // AAPL-DEC27 ["0x117cc2133c37B721F49dE2A7a74833232B3B4C0C", "0xa0f77015E46e45c1A12B73466A08711a28Dac1A7"], // SPY-DEC27 ["0xD5f3879160bc7c32ebb4dC785F8a4F505888de68", "0xAb8e536C9E7c76C1045EDEb6096e9B37B26B4372"], // QQQ-DEC27 ["0x7066A64c24e4206CD62E83bf198c1E7EB361F51e", "0x1aC9599B91973A3d5d75F7594a47382223FEC0F5"], // PFE-DEC27 ["0x92FD66527192E3e61d4DDd13322Aa222DE86F9B5", "0x1d44BB0E2D09C35Cc116270E45F8782E7B51fF52"], // SGOV-DEC27 // launch build, 2026-09-02..04, still redeemable - ["0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9", "0x4C3B4CDd55b2E9e60eefcD93234A77D4AD53e365"], // AAPL-MAR27 + [ADDRESSES.robinhood.AAPL, "0x4C3B4CDd55b2E9e60eefcD93234A77D4AD53e365"], // AAPL-MAR27 ["0x117cc2133c37B721F49dE2A7a74833232B3B4C0C", "0x38EAE2c04F65861cD17914100125826de2b735c7"], // SPY-MAR27 ["0xD5f3879160bc7c32ebb4dC785F8a4F505888de68", "0x16daFbB03C4EF20967043185255532A8cadf79Ba"], // QQQ-MAR27 ["0x7066A64c24e4206CD62E83bf198c1E7EB361F51e", "0x0Fd9c2DCABf7780D051a519c654eb13Afec5a975"], // PFE-MAR28 @@ -1061,9 +1061,9 @@ module.exports = { "robinhood": { "owner": "0x3504aA69ca9C5A5Bc3dA312a6c761e9633251cFc", // ReserveVault "tokens": [ - "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC", // NVDA - "0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9", // AAPL - "0x322F0929c4625eD5bAd873c95208D54E1c003b2d", // TSLA + ADDRESSES.robinhood.NVDA, // NVDA + ADDRESSES.robinhood.AAPL, // AAPL + ADDRESSES.robinhood.TSLA, // TSLA ] }, }, diff --git a/registries/treasury.js b/registries/treasury.js index c1475a4dc34..0093a7915a8 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -1345,7 +1345,7 @@ const configs = { robinhood: { owners: ['0x2FE3C1cc641B2463CEE2857Ac520E111fbE11fDF'], ownTokens: ['0x26E82171eb01204eE114e2B8C34Be035B8bc029E'], - tokens: [nullAddress, ADDRESSES.robinhood.USDG, '0x322F0929c4625eD5bAd873c95208D54E1c003b2d'] + tokens: [nullAddress, ADDRESSES.robinhood.USDG, ADDRESSES.robinhood.TSLA] }, }, 'treasury/comdex': { @@ -4088,11 +4088,11 @@ const configs = { ADDRESSES.robinhood.USDG, '0x59F95461E68e0c77605299791E1449f175165B54', // NET/USDG POL '0xBeEff033F34C046626B8D0A041844C5d1A5409dd', // Steakhouse USDG (ERC-4626) - '0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec', // NVDA - '0x4a0e65a3eccec6dbe60ae065f2e7bb85fae35eea', // SPCX - '0xaf3d76f1834a1d425780943c99ea8a608f8a93f9', // AAPL + ADDRESSES.robinhood.NVDA, // NVDA + ADDRESSES.robinhood.SPCX, // SPCX + ADDRESSES.robinhood.AAPL, // AAPL '0xe93237c50d904957cf27e7b1133b510c669c2e74', // MSFT - '0x2e0847e8910a9732eb3fb1bb4b70a580adad4fe3', // GOOGL + ADDRESSES.robinhood.GOOGL, // GOOGL '0x6330d8c3178a418788df01a47479c0ce7ccf450b', // COIN ], ownTokens: ['0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf'], // NET diff --git a/registries/uniswapV3Graph.js b/registries/uniswapV3Graph.js index 25e6c8ded05..a6aa2745d46 100644 --- a/registries/uniswapV3Graph.js +++ b/registries/uniswapV3Graph.js @@ -47,9 +47,6 @@ const configs = { 'physica-finance': { planq: { graphURL: 'https://subgraph.planq.finance/subgraphs/name/ianlapham/uniswap-v3', name: 'physica-v3' }, }, - 'neby-dex': { - sapphire: { graphURL: 'https://graph.api.neby.exchange/dex', name: 'Neby Dex' }, - }, 'kinetix-v3': { kava: { graphURL: 'https://kava-graph-node.metavault.trade/subgraphs/name/kinetixfi/v3-subgraph', name: 'kinetixfi/kava-v3' }, base: { graphURL: 'https://api.studio.thegraph.com/query/55804/kinetixfi-base-v3/version/latest', name: 'kinetixfi/base-v3' }, From 114a345bc875b11e9c6956134bba900a3a63c70e Mon Sep 17 00:00:00 2001 From: bheluga Date: Sun, 18 Oct 2026 21:39:09 +0530 Subject: [PATCH 307/988] mark stability dead (#21706) --- projects/stability/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/stability/index.js b/projects/stability/index.js index 77d4902b961..6cf0ac9e2c9 100644 --- a/projects/stability/index.js +++ b/projects/stability/index.js @@ -40,4 +40,5 @@ Object.keys(config).forEach(chain => { assetsAmountsAll.forEach(([assets, amounts]) => api.add(assets, amounts)) }, } -}) \ No newline at end of file +}) +module.exports.deadFrom = '2026-04-01' From c6c0c221fe9b69336259b0e8e641b066660d67f5 Mon Sep 17 00:00:00 2001 From: eden Date: Sun, 18 Oct 2026 23:22:05 +0700 Subject: [PATCH 308/988] fix getLogs chunk bug (#21705) --- projects/helper/cache/getLogs.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/projects/helper/cache/getLogs.js b/projects/helper/cache/getLogs.js index 33a8433ae89..24ca683aa32 100644 --- a/projects/helper/cache/getLogs.js +++ b/projects/helper/cache/getLogs.js @@ -151,11 +151,9 @@ async function getLogs({ target, if (cache.logs.length < chunkSize) return setCache(cacheFolder, key, cache) - let allLogs = cache.logs - cache.logs = allLogs.slice(0, chunkSize) - allLogs = allLogs.slice(chunkSize) - cache.hasMore = allLogs.length > 0 - await setCache(cacheFolder, key, cache) + // write a copy, cache.logs is returned by fetchLogs and must keep all the logs + let allLogs = cache.logs.slice(chunkSize) + await setCache(cacheFolder, key, { ...cache, logs: cache.logs.slice(0, chunkSize), hasMore: allLogs.length > 0 }) let index = 0 From 9924b53aa5480aa0a2f2aaa33f60b0a1d76f5d71 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Sun, 18 Oct 2026 18:55:57 +0200 Subject: [PATCH 309/988] Add missing Binance ZEC reserves to binance-cex (#21609) Co-authored-by: FelixBruguera --- projects/binance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/binance/index.js b/projects/binance/index.js index bcc271dce10..fd98f94d0dd 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -13,6 +13,7 @@ const LOCK_INFO_ENDPOINT = "https://www.binance.com/bapi/tokencanal/v2/tokencana const binanceToDefillama = { BTC: 'bitcoin', ADA: 'cardano', + ZEC: 'zcash', ETH: 'ethereum', BEP20: 'bsc', BSC: 'bsc', From b07d926b55add678d8033f12dde8097da69def1b Mon Sep 17 00:00:00 2001 From: routebuilder Date: Sun, 18 Oct 2026 18:57:16 +0200 Subject: [PATCH 310/988] Record Balancer withdrawals-only transition on 30 Oct 2026 (#21597) --- registries/balancer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/registries/balancer.js b/registries/balancer.js index 1bbd3bf1382..d6fdc680daf 100644 --- a/registries/balancer.js +++ b/registries/balancer.js @@ -59,6 +59,7 @@ function balV2Chain(fromBlock) { const configs = { // ===== Balancer V2 (onChainTvl) ===== 'balancer': { + hallmarks: [['2026-10-30', 'Balancer pausable pools move to withdrawals-only']], ethereum: balV2Chain(12272146), polygon: balV2Chain(15832990), arbitrum: balV2Chain(222832), From aa791ca02ada6baebd49693f9f9b5d9d536a8d4e Mon Sep 17 00:00:00 2001 From: Jayakumar Date: Sun, 18 Oct 2026 22:30:27 +0530 Subject: [PATCH 311/988] Kuru: add the new Spot deployment to the existing adapter (#21581) Co-authored-by: Cursor --- projects/kuru/index.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/projects/kuru/index.js b/projects/kuru/index.js index cb87a1414ca..af5097302ab 100644 --- a/projects/kuru/index.js +++ b/projects/kuru/index.js @@ -1,34 +1,34 @@ const { getLogs2 } = require('../helper/cache/getLogs') const { sumTokens2 } = require('../helper/unwrapLPs') +// Being sunset in favor of the Spot deployment below; remove once it holds no funds. const MARGIN_ACCOUNT = '0x2A68ba1833cDf93fa9Da1EEbd7F46242aD8E90c5' const ROUTER = '0xd651346d7c789536ebf06dc72aE3C8502cd695CC' const START_BLOCK = 33384150 +const ACCOUNT_CORE = '0x264123a9B96Cc1193944cC25C188f1bD3dFa670e' +const SPOT_ROUTER = '0xBdDF3556701B7ECca5d69416CFfd7F86D37E52b3' +const SPOT_START_BLOCK = 113624576 + const MARKET_REGISTERED_EVENT = 'event MarketRegistered(address baseAsset, address quoteAsset, address market, address vaultAddress, uint32 pricePrecision, uint96 sizePrecision, uint32 tickSize, uint96 minSize, uint96 maxSize, uint256 takerFeeBps, uint256 makerFeeBps, uint96 kuruAmmSpread)' +const SPOT_MARKET_REGISTERED_EVENT = 'event SpotMarketRegistered(address indexed orderBook, address indexed baseToken, address indexed quoteToken, address operator, uint96 sizePrecision, uint32 pricePrecision, uint96 minQuoteNotional, uint32 tickSize, uint32 passiveSpreadTicks, uint8 quoteTokenDecimals, uint256 takerFeePps, uint256 makerFeePps)' async function tvl(api) { - const logs = await getLogs2({ - api, - target: ROUTER, - eventAbi: MARKET_REGISTERED_EVENT, - fromBlock: START_BLOCK, - useIndexer: true, - }) - - // Extract unique tokens from market events - const tokens = new Set() + const [markets, spotMarkets] = await Promise.all([ + getLogs2({ api, target: ROUTER, eventAbi: MARKET_REGISTERED_EVENT, fromBlock: START_BLOCK, useIndexer: true }), + getLogs2({ api, target: SPOT_ROUTER, eventAbi: SPOT_MARKET_REGISTERED_EVENT, fromBlock: SPOT_START_BLOCK, useIndexer: true }), + ]) - for (const { baseAsset, quoteAsset } of logs) { - tokens.add(baseAsset) - tokens.add(quoteAsset) - } + const tokensAndOwners = [ + ...markets.flatMap(({ baseAsset, quoteAsset }) => [[baseAsset, MARGIN_ACCOUNT], [quoteAsset, MARGIN_ACCOUNT]]), + ...spotMarkets.flatMap(({ baseToken, quoteToken }) => [[baseToken, ACCOUNT_CORE], [quoteToken, ACCOUNT_CORE]]), + ] - return sumTokens2({ api, owner: MARGIN_ACCOUNT, tokens: Array.from(tokens) }) + return sumTokens2({ api, tokensAndOwners }) } module.exports = { - methodology: 'TVL counts all tokens deposited in the Kuru MarginAccount contract. Market listings are discovered from Router.MarketRegistered events.', + methodology: 'TVL counts all tokens deposited in the Kuru AccountCore contract and, until it is retired, the earlier MarginAccount contract. Markets are discovered from SpotRouter.SpotMarketRegistered and Router.MarketRegistered events. Native MON is address(0).', monad: { tvl, }, From 7bec340cc4175d20787e43b18761732de94adac8 Mon Sep 17 00:00:00 2001 From: chaijinal-wq Date: Mon, 19 Oct 2026 01:06:39 +0800 Subject: [PATCH 312/988] Add Koo.xyz Arbitrum collateral TVL adapter (#21647) --- projects/koo/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/koo/index.js diff --git a/projects/koo/index.js b/projects/koo/index.js new file mode 100644 index 00000000000..11a58dd62b8 --- /dev/null +++ b/projects/koo/index.js @@ -0,0 +1,23 @@ +// Production protocol: https://app.koo.xyz/ and https://docs.koo.xyz/earn/yield-bearing-usdc +const { sumTokens2 } = require('../helper/unwrapLPs') + +const CORE = '0xA18b67e194d4f4bADe61d4e68cd135C63C438D1d' +const USDC = '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' +// Both receipt balances are denominated in six-decimal underlying USDC units. +const aArbUSDCn = '0x724dc807b04555b71ed48a6896b6f41593b8c637' +const compoundUSDC = '0x9c4ec768c28520b50860ea7a15bd7213a9ff58bf' + +async function tvl(api) { + const supported = await api.call({ target: CORE, abi: 'address[]:getSupportedAssets' }) + if (supported.some(asset => asset.toLowerCase() !== USDC.toLowerCase())) + throw new Error('Koo collateral assets changed; update the custody/strategy mapping') + + return sumTokens2({ api, owner: CORE, tokens: [USDC, aArbUSDCn, compoundUSDC] }) +} + +module.exports = { + // The yield-bearing collateral is also included by Aave V3 and Compound V3. + doublecounted: true, + methodology: 'Counts native USDC and the underlying USDC represented by Aave V3 and Compound V3 receipt balances held by the Arbitrum core protocol. This custody backs trading collateral and the live protocol Vault. Vault LP supply, pool-value/equity views, governance tokens and the separate fee pool are not added to the same assets again.', + arbitrum: { tvl }, +} From 5cc0efd8700094fad824f59cced967352b94e8e4 Mon Sep 17 00:00:00 2001 From: eden Date: Mon, 19 Oct 2026 03:38:02 +0700 Subject: [PATCH 313/988] optimize uniswap v4 adapter (#21708) --- projects/uniswap-v4/index.js | 92 +++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 27 deletions(-) diff --git a/projects/uniswap-v4/index.js b/projects/uniswap-v4/index.js index 53abbfc0eef..4e2f82d2260 100644 --- a/projects/uniswap-v4/index.js +++ b/projects/uniswap-v4/index.js @@ -1,3 +1,4 @@ +const sdk = require('@defillama/sdk'); const { sumTokens2 } = require("../helper/unwrapLPs"); const { getLogs2 } = require('../helper/cache/getLogs'); const { nullAddress } = require("../helper/tokenMapping"); @@ -6,7 +7,7 @@ const { cachedGraphQuery } = require("../helper/cache"); // from https://docs.uniswap.org/contracts/v4/deployments const config = { - ethereum: { factory: "0x000000000004444c5dc75cB358380D2e3dE08A90", fromBlock: 21688329, blacklistedTokens: ['0xb4357054c3da8d46ed642383f03139ac7f090343', '0x2f42b7d686ca3effc69778b6ed8493a7787b4d6e', + ethereum: { factory: "0x000000000004444c5dc75cB358380D2e3dE08A90", fromBlock: 21688329, useIndexerSql: true, blacklistedTokens: ['0xb4357054c3da8d46ed642383f03139ac7f090343', '0x2f42b7d686ca3effc69778b6ed8493a7787b4d6e', '0x8d010bf9C26881788b4e6bf5Fd1bdC358c8F90b8', // DOT was hacked '0xb90b2a35c65dbc466b04240097ca756ad2005295', // BOBO is mispriced '0x5888641e3e6cbea6d84ba81edb217bd691d3be38', // BOBO is mispriced @@ -18,52 +19,56 @@ const config = { '0xbdb37597c7e84d898a5536fbb6e4a5c2bcac640b', // BLOTIX mispriced ($45 vs circular SAFEMONEY pool) - ~$245M phantom TVL '0xc4abeddacfa65e25d6c942861fb3bdc9c00eeb13', // SAFEMONEY mispriced (circular vs BLOTIX) ] }, - optimism: { factory: "0x9a13f98cb987694c9f086b1f5eb990eea8264ec3", fromBlock: 130947675, blacklistedTokens: [ + optimism: { factory: "0x9a13f98cb987694c9f086b1f5eb990eea8264ec3", fromBlock: 130947675, useIndexerSql: true, blacklistedTokens: [ '0x8d010bf9c26881788b4e6bf5fd1bdc358c8f90b8', // DOT was hacked ]}, - base: { factory: "0x498581ff718922c3f8e6a244956af099b2652b2b", fromBlock: 25350988, - blacklistedTokens: [ - '0x8d010bf9c26881788b4e6bf5fd1bdc358c8f90b8', // DOT was hacked - '0xbc33b4d48f76d17a1800afcb730e8a6aaada7fe5', // vDOT was hacked - '0x570b1533f6daa82814b25b62b5c7c4c55eb83947', // BOBO is mispriced - ] - }, - arbitrum: { factory: "0x360e68faccca8ca495c1b759fd9eee466db9fb32", fromBlock: 297842872, blacklistedTokens: ['0x1a6b3a62391eccaaa992ade44cd4afe6bec8cff1', '0x3e4ffeb394b371aaaa0998488046ca19d870d9ba', + arbitrum: { factory: "0x360e68faccca8ca495c1b759fd9eee466db9fb32", fromBlock: 297842872, useIndexerSql: true, blacklistedTokens: ['0x1a6b3a62391eccaaa992ade44cd4afe6bec8cff1', '0x3e4ffeb394b371aaaa0998488046ca19d870d9ba', '0x8d010bf9c26881788b4e6bf5fd1bdc358c8f90b8', // DOT was hacked ] }, - polygon: { factory: "0x67366782805870060151383f4bbff9dab53e5cd6", fromBlock: 66980384 }, - blast: { factory: "0x1631559198a9e474033433b2958dabc135ab6446", fromBlock: 14377311 }, + polygon: { factory: "0x67366782805870060151383f4bbff9dab53e5cd6", fromBlock: 66980384, useIndexerSql: true }, + blast: { factory: "0x1631559198a9e474033433b2958dabc135ab6446", fromBlock: 14377311, useIndexerSql: true }, zora: { factory: "0x0575338e4c17006ae181b47900a84404247ca30f", fromBlock: 25434534 }, wc: { factory: "0xb1860d529182ac3bc1f51fa2abd56662b7d13f33", fromBlock: 9111872 }, ink: { factory: "0x360e68faccca8ca495c1b759fd9eee466db9fb32", fromBlock: 4580556 }, - soneium: { factory: "0x360e68faccca8ca495c1b759fd9eee466db9fb32", fromBlock: 2473300 }, - avax: { factory: "0x06380c0e0912312b5150364b9dc4542ba0dbbc85", fromBlock: 56195376 }, - bsc: { factory: "0x28e2ea090877bf75740558f6bfb36a5ffee9e9df", fromBlock: 45970610, blacklistedTokens: ['0xb4357054c3dA8D46eD642383F03139aC7f090343', '0x8145eb83744aac883b68ae34060bebb5031d8f5c', + soneium: { factory: "0x360e68faccca8ca495c1b759fd9eee466db9fb32", fromBlock: 2473300, useIndexerSql: true }, + avax: { factory: "0x06380c0e0912312b5150364b9dc4542ba0dbbc85", fromBlock: 56195376, useIndexerSql: true }, + bsc: { factory: "0x28e2ea090877bf75740558f6bfb36a5ffee9e9df", fromBlock: 45970610, useIndexerSql: true, blacklistedTokens: ['0xb4357054c3dA8D46eD642383F03139aC7f090343', '0x8145eb83744aac883b68ae34060bebb5031d8f5c', '0x8d010bf9c26881788b4e6bf5fd1bdc358c8f90b8', // DOT was hacked '0x7083609fce4d1d8dc0c979aab8c869ea2c873402', // DOT was hacked '0x44f161ae29361e332dea039dfa2f404e0bc5b5cc', // H hacked 2026-06-08 '0xac531eb26ca1d21b85126de8fb87e80e09002dcf', // fake SAND mispriced on BSC (~$5.6B phantom TVL) ] }, - unichain: { factory: "0x1F98400000000000000000000000000000000004", fromBlock: 1 }, - monad: { factory: "0x188d586ddcf52439676ca21a244753fa19f9ea8e", fromBlock: 29255895 }, - tempo: { factory: "0x33620f62c5b9b2086dd6b62f4a297a9f30347029", fromBlock: 6475880 }, - megaeth: { factory: "0xacb7e78fa05d562e0a5d3089ec896d57d057d38e", fromBlock: 7009653 }, - robinhood: { factory: "0x8366a39CC670B4001A1121B8F6A443A643e40951", fromBlock: 9070 }, - arc: { factory: "0x8366a39cc670b4001a1121b8f6a443a643e40951", fromBlock: 1946500 }, + unichain: { factory: "0x1F98400000000000000000000000000000000004", fromBlock: 1, useIndexerSql: true }, + monad: { factory: "0x188d586ddcf52439676ca21a244753fa19f9ea8e", fromBlock: 29255895, useIndexerSql: true }, + tempo: { factory: "0x33620f62c5b9b2086dd6b62f4a297a9f30347029", fromBlock: 6475880, useIndexerSql: true }, + megaeth: { factory: "0xacb7e78fa05d562e0a5d3089ec896d57d057d38e", fromBlock: 7009653, useIndexerSql: true }, + robinhood: { factory: "0x8366a39CC670B4001A1121B8F6A443A643e40951", fromBlock: 9070, useIndexerSql: true, skipHookBalances: true }, + arc: { factory: "0x8366a39cc670b4001a1121b8f6a443a643e40951", fromBlock: 1946500, useIndexerSql: true, skipHookBalances: true }, } const subgraphs = { // the xlayer subgraph has no price for xStocks, so their pools read $0 TVL there and the $100 filter drops them - xlayer: {endpoint: '2fc6nFafrPs4xybzHMnmD48qgUYoHTizhDk1mCJJUDjD', factory: '0x360E68faCcca8cA495c1B759Fd9EEe466db9FB32', noTvlFilter: true } + xlayer: { endpoint: '2fc6nFafrPs4xybzHMnmD48qgUYoHTizhDk1mCJJUDjD', factory: '0x360E68faCcca8cA495c1B759Fd9EEe466db9FB32', noTvlFilter: true }, + + // base moved to the subgraph below, the full pool list (15M+ launchpad pools) means ~30M balanceOf calls per run + // only pools the subgraph values above $100, balances are still pulled on-chain + base: { endpoint: 'Gqm2b5J85n1bhCyDMpGbtbVn4935EvvdyHdHrx3dibyj', factory: '0x498581ff718922c3f8e6a244956af099b2652b2b', skipHookBalances: true, blacklistedTokens: [ + '0x8d010bf9c26881788b4e6bf5fd1bdc358c8f90b8', // DOT was hacked + '0xbc33b4d48f76d17a1800afcb730e8a6aaada7fe5', // vDOT was hacked + '0x570b1533f6daa82814b25b62b5c7c4c55eb83947', // BOBO is mispriced + '0x454f8c3f1fc79a98363db6104a20ac59a02a3133', // GPX: 99.9% of supply sits unsold in hook 0x4519e2b0, ~$516M phantom TVL + ] }, } -function processResult(api, results, factory, blacklistedTokens = []) { +// skipHookBalances: count only what the PoolManager holds, for launchpad heavy chains where almost every pool has its own hook +// (base: hooks held ~0.3% of TVL but cost ~58% of the balance calls, and unsold launch inventory sits in hooks) +function processResult(api, results, factory, blacklistedTokens = [], skipHookBalances = false) { const tokenSet = new Set() const ownerTokens = [] results.forEach(pool => { tokenSet.add(pool.token0) tokenSet.add(pool.token1) - if (pool.hooks !== nullAddress) { + if (!skipHookBalances && pool.hooks !== nullAddress) { ownerTokens.push([[pool.token0, pool.token1], pool.hooks]) } }) @@ -92,24 +97,57 @@ Object.keys(subgraphs).forEach(chain => { }` const result = await cachedGraphQuery(`uniswap-v4/${chain}`, endpoint, query, { api, fetchById: true, useBlock: true }) const mappedResults = result.map(pool => { return { token0: pool.token0.id, token1: pool.token1.id, hooks: pool.hooks}}) - return processResult(api, mappedResults, factory, subgraphs[chain].blacklistedTokens) + return processResult(api, mappedResults, factory, subgraphs[chain].blacklistedTokens, subgraphs[chain].skipHookBalances) } } }) const eventAbi = "event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks, uint160 sqrtPriceX96, int24 tick)" +const initializeTopic = '0xdd466e674ea557f56295e2d0218a125ea4b4f0f6f3307b95f85e6110838d6438' + +// pool list from the clickhouse instead of the huge Initialize log cache, balances are still pulled on-chain +const poolsSql = ` + SELECT DISTINCT + concat('0x', substring(topic2, 27)) AS token0, + concat('0x', substring(topic3, 27)) AS token1, + concat('0x', substring(data, 155, 40)) AS hooks + FROM evm_indexer.logs + PREWHERE chain = {chain:UInt64} + AND short_address = {shortAddress:String} + AND short_topic0 = {shortTopic0:String} + AND block_number >= {fromBlock:UInt32} + AND block_number <= {toBlock:UInt32} + AND address = {factory:String} + AND topic0 = {topic0:String}` + +async function getPoolsFromIndexer(api, factory, fromBlock) { + await api.getBlock() + factory = factory.toLowerCase() + return sdk.queryIndexerSql(poolsSql, { + chain: api.chainId, factory, fromBlock, toBlock: api.block, + shortAddress: factory.slice(0, 10), topic0: initializeTopic, shortTopic0: initializeTopic.slice(0, 10), + }) +} Object.keys(config).forEach(chain => { - const { factory, fromBlock } = config[chain] + const { factory, fromBlock, useIndexerSql } = config[chain] module.exports[chain] = { tvl: async (api) => { if (!getEnv('IS_RUN_FROM_CUSTOM_JOB')) throw new Error('This job is not meant to be run directly, please use the custom job feature') + if (useIndexerSql) { + if (sdk.isIndexerSqlEnabled()) { + const pools = await getPoolsFromIndexer(api, factory, fromBlock) + return processResult(api, pools, factory, config[chain].blacklistedTokens, config[chain].skipHookBalances) + } + sdk.log(`uniswap-v4 ${chain}: indexer sql is not configured, falling back to getLogs`) + } + let compressType if (chain === 'base') compressType = 'v1' const logs = await getLogs2({ api, factory, eventAbi, fromBlock, compressType,}) const mappedLogs = logs.map(log => { return { token0: log.currency0, token1: log.currency1, hooks: log.hooks}}) - return processResult(api, mappedLogs, factory, config[chain].blacklistedTokens) + return processResult(api, mappedLogs, factory, config[chain].blacklistedTokens, config[chain].skipHookBalances) } } }) From f17e11157a303d30fc0aaf1de77d015ef60b1272 Mon Sep 17 00:00:00 2001 From: Jordy Date: Mon, 19 Oct 2026 09:20:59 +0200 Subject: [PATCH 314/988] Nysa: add RWA Prime Kamino Earn vault to TVL, update listing metadata (#21699) Co-authored-by: Claude Opus 5.5 --- projects/nysa/index.js | 99 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 88 insertions(+), 11 deletions(-) diff --git a/projects/nysa/index.js b/projects/nysa/index.js index e09d1cb17d1..820cd6579f8 100644 --- a/projects/nysa/index.js +++ b/projects/nysa/index.js @@ -2,15 +2,23 @@ const { BorshAccountsCoder } = require('@project-serum/anchor') const { getMultipleAccounts, sumTokens2 } = require('../helper/solana') const ADDRESSES = require('../helper/coreAssets.json') const kaminoIdl = require('../kamino-lending/kamino-lending-idl.json') +const kvaultIdl = require('../gauntlet/kvault-idl.json') const PROGRAM = 'KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD' +const VAULT_PROGRAM = 'KvauGMspG5k6rtzrqqn7WNn3oZdyKqLKwK2XWQ8FLjd' const MARKET = 'F4uLsGZT4YnHDcemtoYDz2LBZKLmwTB1wzkwS6oqygvy' -// Live market configuration: https://github.com/Nysa-Finance/nysa-frontend/blob/main/src/config.js +// Live market and vault configuration: https://github.com/Nysa-Finance/nysa-frontend/blob/main/src/config.js const RESERVES = [ ['rpTGWR3JDjjPfXLCg5Fx1GpSdUxPt1pxW7fwXGUT6js', 'A1KLoBrKBde8Ty9qtNQUtq3C2ortoC3u7twggz7sEto6'], // USDY ['GQr5hXuRgHAmguh6EqcpeJXrMyqCQch4P6XkSvawwNk2', ADDRESSES.solana.USDC], ] +// Kamino Earn vaults curated by Nysa +const VAULTS = [ + ['2Qxsj1hi95avkp7sANDmbVT5TwqRPGsutuvJasJK9xL7', ADDRESSES.solana.USDC], // RWA Prime +] +const EMPTY_ALLOCATION = '11111111111111111111111111111111' const coder = new BorshAccountsCoder(kaminoIdl) +const vaultCoder = new BorshAccountsCoder(kvaultIdl) /** * Load Nysa's reserves and reject missing or mismatched on-chain accounts. @@ -32,32 +40,101 @@ async function getReserves(api) { } /** - * Sum underlying tokens held in the reserves' liquidity supply vaults. + * Load Nysa's vaults and reject missing or mismatched on-chain accounts. + * @param {object} api DefiLlama chain API used for Solana account reads. + * @returns {Promise} Decoded vault states with verified program and token mint. + */ +async function getVaults(api) { + const accounts = await getMultipleAccounts(VAULTS.map(([address]) => address), { api }) + return VAULTS.map(([address, mint], i) => { + const account = accounts[i] + if (!account) throw new Error(`Nysa: missing vault ${address}`) + if (account.owner.toString() !== VAULT_PROGRAM) throw new Error(`Nysa: unexpected program owner for vault ${address}`) + + const vault = vaultCoder.decode('VaultState', account.data) + if (vault.tokenMint.toString() !== mint) throw new Error(`Nysa: unexpected mint for vault ${address}`) + return vault + }) +} + +/** + * Collect vault positions in reserves outside Nysa's market. Positions in Nysa's own reserves are skipped, + * because those reserves' supply vaults and debt are already counted. + * @param {object} api DefiLlama chain API used for Solana account reads. + * @param {object[]} vaults Decoded vault states. + * @returns {Promise<{ reserve: object, ctokens: bigint }[]>} External reserves with the vaults' combined cToken balance. + */ +async function getExternalAllocations(api, vaults) { + const own = new Set(RESERVES.map(([address]) => address)) + const ctokens = {} + for (const vault of vaults) + for (const { reserve, ctokenAllocation } of vault.vaultAllocationStrategy) { + const address = reserve.toString() + if (address === EMPTY_ALLOCATION || own.has(address) || ctokenAllocation.isZero()) continue + ctokens[address] = (ctokens[address] ?? 0n) + BigInt(ctokenAllocation.toString()) + } + + const addresses = Object.keys(ctokens) + const accounts = await getMultipleAccounts(addresses, { api }) + return addresses.map((address, i) => { + const account = accounts[i] + if (!account) throw new Error(`Nysa: missing vault reserve ${address}`) + if (account.owner.toString() !== PROGRAM) throw new Error(`Nysa: unexpected program owner for vault reserve ${address}`) + return { reserve: coder.decode('Reserve', account.data), ctokens: ctokens[address] } + }) +} + +/** + * Pro-rata share of a reserve amount for a cToken balance. + * @param {bigint} amount Reserve amount in raw token units. + * @param {bigint} ctokens cToken balance. + * @param {object} reserve Decoded reserve. + * @returns {string} Share in raw token units, truncated. + */ +function share(amount, ctokens, reserve) { + const supply = BigInt(reserve.collateral.mintTotalSupply.toString()) + return supply > 0n ? (amount * ctokens / supply).toString() : '0' +} + +/** + * Debt of a reserve in raw token units, truncating sub-atomic Q60 dust. + * @param {object} reserve Decoded reserve. + * @returns {bigint} Outstanding debt. + */ +function debtOf(reserve) { + return BigInt(reserve.liquidity.borrowedAmountSf.toString()) / (1n << 60n) +} + +/** + * Sum underlying tokens held in the reserves' liquidity supply vaults, plus vault tokens not deployed into them. * @param {object} api DefiLlama chain API receiving raw token balances. * @returns {Promise} Vault balances, excluding borrowed-out tokens. */ async function tvl(api) { - const reserves = await getReserves(api) + const [reserves, vaults] = await Promise.all([getReserves(api), getVaults(api)]) + // Idle vault tokens by the vault's own accounting, which leaves out reward tokens not yet paid into the vault. + vaults.forEach(vault => api.add(vault.tokenMint.toString(), vault.tokenAvailable.toString())) + for (const { reserve, ctokens } of await getExternalAllocations(api, vaults)) + api.add(reserve.liquidity.mintPubkey.toString(), share(BigInt(reserve.liquidity.availableAmount.toString()), ctokens, reserve)) return sumTokens2({ api, tokenAccounts: reserves.map(reserve => reserve.liquidity.supplyVault.toString()) }) } /** - * Add outstanding debt in raw token units, truncating sub-atomic Q60 dust. + * Add outstanding debt in raw token units, including the vaults' share of debt in external reserves. * @param {object} api DefiLlama chain API receiving borrowed token balances. * @returns {Promise} Resolves after adding debt for each validated reserve. */ async function borrowed(api) { - const reserves = await getReserves(api) - for (const reserve of reserves) { - // Q60 debt -> raw token units. Use integer arithmetic and discard sub-atomic dust. - const amount = BigInt(reserve.liquidity.borrowedAmountSf.toString()) / (1n << 60n) - api.add(reserve.liquidity.mintPubkey.toString(), amount.toString()) - } + const [reserves, vaults] = await Promise.all([getReserves(api), getVaults(api)]) + for (const reserve of reserves) + api.add(reserve.liquidity.mintPubkey.toString(), debtOf(reserve).toString()) + for (const { reserve, ctokens } of await getExternalAllocations(api, vaults)) + api.add(reserve.liquidity.mintPubkey.toString(), share(debtOf(reserve), ctokens, reserve)) } module.exports = { doublecounted: true, // DefiLlama confirmed these deposits overlap Kamino Lend TVL. timetravel: false, - methodology: 'Counts USDY collateral and unborrowed USDC held in the liquidity supply vaults of Nysa\'s curated Kamino market on Solana. Outstanding reserve debt is reported separately as borrowed. Collateral receipt tokens, undistributed incentives, and Farm Points are not added to TVL. These deposits overlap Kamino Lend TVL, so the adapter is marked doublecounted.', + methodology: 'Counts USDY collateral and unborrowed USDC held in the liquidity supply vaults of Nysa\'s curated Kamino market on Solana, plus USDC in Nysa\'s curated Kamino Earn vault (RWA Prime) that is not deployed into that market: idle vault USDC and the vault\'s share of unborrowed liquidity in any other Kamino reserve. Vault deposits into Nysa\'s own market are counted once, through the market. Outstanding debt, including the vault\'s share of debt in other reserves, is reported separately as borrowed. Collateral receipt tokens, vault shares, undistributed incentives, and Farm Points are not added to TVL. These deposits overlap Kamino TVL, so the adapter is marked doublecounted.', solana: { tvl, borrowed }, } From 28575ef13b3fa266692a273ded3365bcbcf2bb87 Mon Sep 17 00:00:00 2001 From: "Dr. Awesome Doge" Date: Mon, 19 Oct 2026 15:23:13 +0800 Subject: [PATCH 315/988] kton: count pKTON, KTON's premium pool, in its TVL (#21702) --- projects/kton/index.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/projects/kton/index.js b/projects/kton/index.js index 57d80c23016..de75918466e 100644 --- a/projects/kton/index.js +++ b/projects/kton/index.js @@ -1,11 +1,13 @@ const { call } = require('../helper/chain/ton'); const ADDRESSES = require("../helper/coreAssets.json"); const { BigNumber } = require('bignumber.js'); -// KTON Pool Contract Address +// KTON's pools: KTON, and pKTON, its premium pool (jetton +// EQCtD-q8vItSYffdO3p23-gcnFpPIpcGx9tE1ImQ3f3thV4l, metadata served from app.kton.io). const KTON_POOL_CONTRACT_ADDRESS = "EQA9HwEZD_tONfVz6lJS0PVKR5viEiEGyj9AuQewGQVnXPg0"; -async function getKtonData() { +const PKTON_POOL_CONTRACT_ADDRESS = "EQDsW2P6nuP1zopKoNiCYj2xhqDan0cBuULQ8MH4o7dBt_7a"; +async function getKtonData(pool) { const stacks = await call({ - target: KTON_POOL_CONTRACT_ADDRESS, + target: pool, abi: 'get_pool_full_data', params: [], rawStack: true, @@ -47,11 +49,13 @@ async function getKtonData() { module.exports = { timetravel: false, - methodology: 'KTON price is calculated by multiplying the KTON:TON ratio from the pool with the current TON price', + methodology: 'TVL is the TON staked in the KTON and pKTON pools: each pool\'s total_balance from get_pool_full_data', ton: { tvl: async (api) => { - const ktonData = await getKtonData(); - return api.add(ADDRESSES.ton.TON, ktonData.tvl); + for (const pool of [KTON_POOL_CONTRACT_ADDRESS, PKTON_POOL_CONTRACT_ADDRESS]) { + const { tvl } = await getKtonData(pool); + api.add(ADDRESSES.ton.TON, tvl); + } }, } }; \ No newline at end of file From f4d4530b1063f453ff0723b2f03fa68fb363bfe8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 19 Oct 2026 09:33:21 +0200 Subject: [PATCH 316/988] update @defillama/sdk version --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 0ded5adceab..d7ac4dad859 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", - "@defillama/sdk": "5.0.238", + "@defillama/sdk": "5.0.240", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", "@supercharge/promise-pool": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 08d51ab06ba..f1a19020c3a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^0.30.1 version: 0.30.1(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) '@defillama/sdk': - specifier: 5.0.238 - version: 5.0.238(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) + specifier: 5.0.240 + version: 5.0.240(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) '@project-serum/anchor': specifier: ^0.26.0 version: 0.26.0(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -269,8 +269,8 @@ packages: peerDependencies: '@solana/web3.js': ^1.68.0 - '@defillama/sdk@5.0.238': - resolution: {integrity: sha512-wkSVkSgWstwG4DCd4KcyTZT+8551v+0Leo2yL6yMmeKY0iEzA2p0c1NBwP3IOQVdLVdK0ahVFrWpWY3p/cPpjQ==} + '@defillama/sdk@5.0.240': + resolution: {integrity: sha512-+xiNNJQlnfNui6MklCKr9wWbSbQNJxEzADrIrVWaBTO6D4KndBX10FhjsbXZ++R8ymnyGhuqEaSif1OBVLVX2w==} peerDependencies: '@solana/web3.js': '>=1.73.0' peerDependenciesMeta: @@ -1941,7 +1941,7 @@ snapshots: bn.js: 5.2.2 buffer-layout: 1.2.2 - '@defillama/sdk@5.0.238(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': + '@defillama/sdk@5.0.240(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': dependencies: '@aws-sdk/client-s3': 3.913.0 '@elastic/elasticsearch': 8.19.1(supports-color@7.2.0) From bcafec31291fc1033282b575ce85f7dd8a7b4959 Mon Sep 17 00:00:00 2001 From: Dani Date: Mon, 19 Oct 2026 09:34:18 +0200 Subject: [PATCH 317/988] fix yearn asset check address casing (#21714) --- projects/yearn/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/yearn/index.js b/projects/yearn/index.js index dbf4a5cc94b..fd4e4cde7a2 100644 --- a/projects/yearn/index.js +++ b/projects/yearn/index.js @@ -69,8 +69,8 @@ async function remoteOverlap(api, vaults, strategyAbi) { const remoteAsset = await remote.call({ target: child, abi: 'address:asset' }) if (Number(chain) !== 747474 || counterpart.toLowerCase() !== holder || reverse.toLowerCase() !== strategy || destination.toLowerCase() !== child || - asset.toLowerCase() !== ADDRESSES.ethereum.USDC || - remoteAsset.toLowerCase() !== ADDRESSES.katana.VB_USDC) + asset.toLowerCase() !== ADDRESSES.ethereum.USDC.toLowerCase() || + remoteAsset.toLowerCase() !== ADDRESSES.katana.VB_USDC.toLowerCase()) throw new Error('Yearn Katana overlap route changed') const debt = await api.call({ target: parent, abi: strategyAbi, params: [strategy] }) const shares = BigInt(await remote.call({ target: child, abi: 'erc20:balanceOf', params: [holder] })) @@ -188,7 +188,7 @@ async function getDebts(api, activeVaults) { // Registered converters exchange DAI/USDC/USDS at 1:1. Normalize the // child's raw asset units into parent units; do not assume equal decimals. if (route.parentAsset) { - if (parentAsset !== route.parentAsset || childAsset !== route.childAsset) throw new Error('Yearn converter asset changed') + if (parentAsset !== route.parentAsset.toLowerCase() || childAsset !== route.childAsset.toLowerCase()) throw new Error('Yearn converter asset changed') owned = owned * 10n ** BigInt(route.parentDecimals) / 10n ** BigInt(route.childDecimals) } else if (parentAsset !== childAsset) throw new Error('Yearn router asset changed') if (owned < BigInt(edge.currentDebt)) edge.currentDebt = owned.toString() From 41988273719c1988d03b765c26d3b3c1832df677 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Mon, 19 Oct 2026 09:34:48 +0200 Subject: [PATCH 318/988] Bybit: add missing PoR chains (Stable, Kaia, Sei, Hedera) (#21711) --- cex/bybit.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cex/bybit.js b/cex/bybit.js index 0eec35e5f66..6dab7e8b45d 100644 --- a/cex/bybit.js +++ b/cex/bybit.js @@ -14,8 +14,9 @@ const CHAIN_MAP = { Solana: 'solana', Aptos: 'aptos', SUI: 'sui', TON: 'ton', ZKSync: 'era', ZKSyncEra: 'era', TRX: 'tron', Tron: 'tron', XRP: 'ripple', Scroll: 'scroll', TAIKO: 'taiko', LINEA: 'linea', Manta: 'manta', Litecoin: 'litecoin', Dogecoin: 'doge', Cosmos: 'cosmos', Celo: 'celo', - Polkadot: 'polkadot', KLAY: 'klaytn', KAVAEVM: 'kava', EOS: 'eos', Dydx: 'dydx', Sonic: 'sonic', + Polkadot: 'polkadot', KLAY: 'klaytn', KAIA: 'klaytn', KAVAEVM: 'kava', EOS: 'eos', Dydx: 'dydx', Sonic: 'sonic', HyperEVM: 'hyperliquid', PLASMA: 'plasma', MONAD: 'monad', Cardano: 'cardano', Starknet: 'starknet', + SEIEVM: 'sei', HBAR: 'hedera', STABLE: 'stable', } async function fetchLatestCsv() { From 166cc79e5781c6f1dc0470db7e757d076ed0b93d Mon Sep 17 00:00:00 2001 From: routebuilder Date: Mon, 19 Oct 2026 09:35:25 +0200 Subject: [PATCH 319/988] accountable: enumerate factory strategies via getStrategiesCount (#21707) --- projects/accountable/index.js | 54 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/projects/accountable/index.js b/projects/accountable/index.js index 7ae08dda371..83d64c55030 100644 --- a/projects/accountable/index.js +++ b/projects/accountable/index.js @@ -79,7 +79,6 @@ const EXCLUDED_STRATEGIES = { } const abis = { - strategyProxies: 'function strategyProxies(uint256) view returns (address)', strategyVaults: 'function strategyVaults(address) view returns (address)', convertToAssets: 'function convertToAssets(uint256) view returns (uint256)', asset: 'function asset() view returns (address)', @@ -87,43 +86,42 @@ const abis = { const NULL_ADDRESS = ADDRESSES.null +/** + * Collects vault addresses for the given chain by reading each registered + * factory's strategy count (getStrategiesCount) and enumerating the full + * strategy list through api.fetchList, which fails the run on a read error + * instead of silently truncating the list. Excluded strategies are skipped; + * EXTRA_VAULTS are added directly. + * @returns {Promise} lowercase vault addresses + */ async function getVaults(api) { const vaults = new Set() - const batchSize = 20 const factories = FACTORIES[api.chain] const excludedStrategies = new Set( (EXCLUDED_STRATEGIES[api.chain] || []).map((s) => s.toLowerCase()) ) for (const factory of factories) { - for (let start = 0; ; start += batchSize) { - const indexes = Array.from({ length: batchSize }, (_, i) => start + i) - - const strategies = await api.multiCall({ - target: factory, - abi: abis.strategyProxies, - calls: indexes.map((i) => ({ params: [i] })), - permitFailure: true, - }) - const allStrategies = strategies.filter((s) => s && s !== NULL_ADDRESS) - if (!allStrategies.length) break - const validStrategies = allStrategies.filter( - (s) => !excludedStrategies.has(s.toLowerCase()) - ) - if (!validStrategies.length) continue + const strategies = await api.fetchList({ + target: factory, + lengthAbi: 'getStrategiesCount', + itemAbi: 'strategyProxies', + }) + const validStrategies = strategies.filter( + (s) => s && s !== NULL_ADDRESS && !excludedStrategies.has(s.toLowerCase()) + ) + if (!validStrategies.length) continue - const factoryVaults = await api.multiCall({ - target: factory, - abi: abis.strategyVaults, - calls: validStrategies.map((strategy) => ({ params: [strategy] })), - permitFailure: true, - }) + const factoryVaults = await api.multiCall({ + target: factory, + abi: abis.strategyVaults, + calls: validStrategies.map((strategy) => ({ params: [strategy] })), + }) - factoryVaults.forEach((vault) => { - if (!vault || vault === NULL_ADDRESS) return - vaults.add(vault.toLowerCase()) - }) - } + factoryVaults.forEach((vault) => { + if (!vault || vault === NULL_ADDRESS) return + vaults.add(vault.toLowerCase()) + }) } for (const vault of (EXTRA_VAULTS[api.chain] || [])) From b36828a41602defb1b2d19f7a64bfaad5261f346 Mon Sep 17 00:00:00 2001 From: Andrei Yazepchyk <70756146+Yazep@users.noreply.github.com> Date: Mon, 19 Oct 2026 09:36:30 +0200 Subject: [PATCH 320/988] Add Akashi (Solana) TVL adapter (#21704) --- projects/akashi/index.js | 74 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 projects/akashi/index.js diff --git a/projects/akashi/index.js b/projects/akashi/index.js new file mode 100644 index 00000000000..1fbd80ee03e --- /dev/null +++ b/projects/akashi/index.js @@ -0,0 +1,74 @@ +const { PublicKey } = require('@solana/web3.js') +const bs58 = require('bs58').default || require('bs58') +const { getConnection, sumTokens2, TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID } = require('../helper/solana') + +// Akashi vaults: Senior/Junior USDC vaults whose deposits the vault program allocates to +// lending and credit protocols through adapter programs. Each vault keeps its cash in +// two token accounts (idle, and payout for funded withdrawals not yet claimed); each leg +// holds its protocol receipt token (jlUSDC, Kamino cTokens, syrupUSDC, PRIME, AUTO, PST) +// and a USDC transit account, all owned by the leg's authority PDA. +const PROGRAM_ID = new PublicKey('11pvmug4MazGHegPLFYn7RxSwoV7AkFF1LSbbNJ1QyF') + +// sha256("account:Vault")[0..8] +const VAULT_DISCRIMINATOR = Buffer.from([211, 8, 232, 43, 2, 152, 117, 119]) + +// Vault layout (Anchor/borsh, after the 8-byte discriminator): +// vault_id u64, admin Pubkey, +// params { executor Pubkey, min_coverage_bps u16, max_coverage_bps u16, +// premium_curve Vec<{u16,u16}>, senior_delay_secs u32, junior_notice_secs u32, +// min_deposit u64, vault_cap u64, idle_target_bps u16, idle_min_bps u16, +// max_valuation_age_slots u64, junior_seed u64 }, +// state u8, usdc_mint, senior_mint, junior_mint, idle_account, payout_account, +// senior_escrow, junior_escrow (Pubkey each), accounts_initialized bool, leg_count u8, ... +const PREMIUM_CURVE_LEN = 8 + 8 + 32 + 32 + 2 + 2 // offset of the curve's u32 length +const MAX_CURVE_POINTS = 4 // #[max_len(4)] in state.rs +const AFTER_CURVE = 4 + 4 + 8 + 8 + 2 + 2 + 8 + 8 // rest of params +const MAX_LEGS = 8 + +function decodeVault(address, data) { + let offset = PREMIUM_CURVE_LEN + const curveLen = data.readUInt32LE(offset) + if (curveLen > MAX_CURVE_POINTS) throw new Error(`akashi: unexpected Vault layout at ${address} (premium curve length ${curveLen})`) + offset += 4 + curveLen * 4 + AFTER_CURVE + 1 // + state + const key = (i) => new PublicKey(data.subarray(offset + 32 * i, offset + 32 * (i + 1))).toBase58() + const idleAccount = key(3) + const payoutAccount = key(4) + // false until init_vault_accounts runs: the account keys are still zero and the vault holds nothing + const accountsInitialized = data[offset + 32 * 7] === 1 + const legCount = data[offset + 32 * 7 + 1] + if (legCount > MAX_LEGS) throw new Error(`akashi: unexpected Vault layout at ${address} (leg count ${legCount})`) + return { idleAccount, payoutAccount, accountsInitialized, legCount } +} + +const legAuthority = (vault, index) => + PublicKey.findProgramAddressSync([Buffer.from('leg_auth'), vault.toBuffer(), Buffer.from([index])], PROGRAM_ID)[0].toBase58() + +async function tvl(api) { + const connection = getConnection() + const vaults = await connection.getProgramAccounts(PROGRAM_ID, { + filters: [{ memcmp: { offset: 0, bytes: bs58.encode(VAULT_DISCRIMINATOR) } }], + }) + const tokenAccounts = [] + const legAuthorities = [] + for (const { pubkey, account } of vaults) { + const { idleAccount, payoutAccount, accountsInitialized, legCount } = decodeVault(pubkey.toBase58(), account.data) + if (!accountsInitialized) continue + tokenAccounts.push(idleAccount, payoutAccount) + for (let i = 0; i < legCount; i++) legAuthorities.push(legAuthority(pubkey, i)) + } + // list each leg authority's token accounts ourselves so an RPC failure fails the run + // instead of silently dropping a leg + for (const owner of legAuthorities) + for (const programId of [TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID]) { + const { value } = await connection.getTokenAccountsByOwner(new PublicKey(owner), { programId }) + tokenAccounts.push(...value.map(({ pubkey }) => pubkey.toBase58())) + } + return sumTokens2({ api, tokenAccounts }) +} + +module.exports = { + timetravel: false, + doublecounted: true, // the legs' receipt tokens are deposits in Kamino Lend, Jupiter Lend, Maple, Hastra and Huma + methodology: 'Token balances held by every Akashi vault: USDC in each vault\'s idle and payout accounts (payout holds funded withdrawals not yet claimed), plus the protocol receipt tokens and USDC held by each leg\'s authority (jlUSDC, Kamino reserve cTokens, syrupUSDC, Hastra PRIME/AUTO, Huma PST). Those positions are also counted by Kamino Lend, Jupiter Lend, Maple, Hastra and Huma, so the TVL is marked double counted. An async exit still pending at the protocol (e.g. a Huma redemption request) holds no token and is counted once it settles.', + solana: { tvl }, +} From 1c46fd9eb249c0981fe7b4c2dff5cfeb260f505e Mon Sep 17 00:00:00 2001 From: CommunityV3 Date: Mon, 19 Oct 2026 15:37:01 +0800 Subject: [PATCH 321/988] Add CommunityV3 (Uniswap V3 deployment on Ethereum) (#21698) Co-authored-by: communityV3 <344321895+communityV3@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- registries/uniswapV3.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 00e7afb24af..bf3efbd4a36 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1924,6 +1924,12 @@ const uniV3Configs = { methodology: 'Value of the tokens held in the Ouro DEX V3 pools on Robinhood Chain, discovered from factory PoolCreated events. Position NFTs staked in the Ouro farms are not added again.', robinhood: { factory: '0x9a8442cb89fE713ce7C2f22852e61fBFFeE97EcF', fromBlock: 72056673 }, }, + 'communityv3': { + start: '2026-09-03', // factory deployed at block 25895766 + methodology: 'Value of the tokens held in every CommunityV3 pool on Ethereum, discovered from factory PoolCreated events.', + // unmodified Uniswap V3 deployment (same pool init code hash); factory owner burned, so protocol fee is permanently off + ethereum: { factory: '0x00a38533c68327aBE0Cc265436e036066E2D6B38', fromBlock: 25895766 }, + }, } module.exports = buildProtocolExports(uniV3Configs, uniV3Export) From b07d1a2df7c8f6eb574d3a9756497f8c0302f612 Mon Sep 17 00:00:00 2001 From: Stone <125890624+Stonepapa@users.noreply.github.com> Date: Mon, 19 Oct 2026 15:43:25 +0800 Subject: [PATCH 322/988] Update BSquared backed BTC addresses.- #17687 (#21713) Co-authored-by: ccipherx --- projects/helper/bitcoin-book/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index d02cb8c89bb..4c5e0f0bb7d 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -155,6 +155,9 @@ module.exports = { // Bitcoin Custodian Addresses "131fpYjELat58RVzPp2A9Bo8oNuKiP4vxg", "15G6tKbavXQ1ynipkZTPAMjEtuosN1Pkmg", + "13btmzTg63MpdozLoyeVYCeRbXe4dWN52a", + "1DtXWGnqWrZEk7XQarSkDUidbFdK7bj44n", + "1JABsaDFCi28sp2uAmbajNJ2NvEiEMETtM", "1Eyg5NRf5dTPeFGZ5CPJ5o6v1a3dYpeZsi", "155FvRapVDRbFYxaxGxJ9eCQjgr7X2yC6g", "bc1q745ywhqsssknaw8s5ycgkv0gulddnasn4tfsjwgm66tvgp2pqpys0zjzt8", From c75ccfa5ae266ef9e2c0e577339569b2b6a6162e Mon Sep 17 00:00:00 2001 From: routebuilder Date: Mon, 19 Oct 2026 10:02:25 +0200 Subject: [PATCH 323/988] Dolomite: exclude WLFIcx from tvl (#21709) --- projects/dolomite/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/dolomite/index.js b/projects/dolomite/index.js index ef1ae2b06bc..d1e3fdb3e82 100644 --- a/projects/dolomite/index.js +++ b/projects/dolomite/index.js @@ -48,6 +48,7 @@ const config = { ethereum: { margin: '0x003Ca23Fd5F0ca87D01F6eC6CD14A8AE60c2b97D', blacklistedTokens: [ '0xda5e1988097297dcdc1f90d4dfe7909e847cbef6', // WLFI - almost all of it is supplied by WLFI team multisig + '0x8af3b9d0e53186ae13b32fd783f42663bf48d389', // WLFIcx - concrete-issued WLFI, the deposit is already counted in concrete-xyz ] }, polygon_zkevm: { margin: '0x836b557Cf9eF29fcF49C776841191782df34e4e5', }, From 5561e5858a36986ab0106f71544ae3087c2c1774 Mon Sep 17 00:00:00 2001 From: daonarchy Date: Mon, 19 Oct 2026 15:03:01 +0700 Subject: [PATCH 324/988] sun: add missing USDD-USDT SunCurve pool (#21692) Co-authored-by: daonarchy <219096321+daonarchy@users.noreply.github.com> --- registries/sumTokens.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index adb24f82dfd..ba27320e41e 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -27012,6 +27012,13 @@ const configs = { ], "TNTfaTpkdd4AQDeqr8SGG7tgdkdjdhbP5c" ], + [ + [ + ADDRESSES.tron.USDT, + "TXDk8mbtRbXeYuMNS83CfKPaYYT8XWv9Hz" + ], + "THJCvwFmu6uDqKY59JbULHDgfddy2Zojty" + ], [ [ ADDRESSES.tron.USDC, From 8eba6a8a755b813ef4fb84eb88bd07bfabc1a44d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 19 Oct 2026 10:03:30 +0200 Subject: [PATCH 325/988] update @defillama/sdk version --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index d7ac4dad859..50165504eef 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", - "@defillama/sdk": "5.0.240", + "@defillama/sdk": "5.0.242", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", "@supercharge/promise-pool": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f1a19020c3a..b3bb2f58a8f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^0.30.1 version: 0.30.1(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) '@defillama/sdk': - specifier: 5.0.240 - version: 5.0.240(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) + specifier: 5.0.242 + version: 5.0.242(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) '@project-serum/anchor': specifier: ^0.26.0 version: 0.26.0(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -269,8 +269,8 @@ packages: peerDependencies: '@solana/web3.js': ^1.68.0 - '@defillama/sdk@5.0.240': - resolution: {integrity: sha512-+xiNNJQlnfNui6MklCKr9wWbSbQNJxEzADrIrVWaBTO6D4KndBX10FhjsbXZ++R8ymnyGhuqEaSif1OBVLVX2w==} + '@defillama/sdk@5.0.242': + resolution: {integrity: sha512-dDODx5N6hN3zBViMd5Pr8HS2+SGC774g4xQTaQLukP8cPOkCkYVfpLPm++WpeSpPCwgFcd4S9B1sxvJhfkXkTA==} peerDependencies: '@solana/web3.js': '>=1.73.0' peerDependenciesMeta: @@ -1941,7 +1941,7 @@ snapshots: bn.js: 5.2.2 buffer-layout: 1.2.2 - '@defillama/sdk@5.0.240(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': + '@defillama/sdk@5.0.242(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': dependencies: '@aws-sdk/client-s3': 3.913.0 '@elastic/elasticsearch': 8.19.1(supports-color@7.2.0) From 032b0561b48e79131b0afc31202ed1832b0ba2be Mon Sep 17 00:00:00 2001 From: Dimitar Zurnov <55513656+zurnov@users.noreply.github.com> Date: Mon, 19 Oct 2026 11:05:10 +0300 Subject: [PATCH 326/988] Add FBYT TVL adapter (Solana) (#21688) Co-authored-by: Claude Opus 5.5 --- projects/fbyt/index.js | 77 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 projects/fbyt/index.js diff --git a/projects/fbyt/index.js b/projects/fbyt/index.js new file mode 100644 index 00000000000..d3b9b1e47b1 --- /dev/null +++ b/projects/fbyt/index.js @@ -0,0 +1,77 @@ +const { createHash } = require('crypto') +const { PublicKey } = require('@solana/web3.js') +const { getConnection, getMultipleAccounts, getAssociatedTokenAddress, sumTokens2 } = require('../helper/solana') + +// FBYT production program (fbyt_vault). The staging program +// (FBYTcdsCZjCLSyCqffrxfuPGs6vUkyfnzB95FEEvZ9YW) is a separate program on the same cluster and is not counted. +const PROGRAM_ID = new PublicKey('DNgg2FmwchUHYx2QiZ9pNJn1q5zypMprkSWFLUnNDigm') + +// Anchor account discriminator: the first 8 bytes of sha256("account:") +const discriminator = (name) => createHash('sha256').update(`account:${name}`).digest().subarray(0, 8).toString('base64') +const byDiscriminator = (name) => ({ memcmp: { offset: 0, bytes: discriminator(name), encoding: 'base64' } }) + +// VaultPool layout: 8 discriminator, bump u8, index u64, admin_pool, money_manager, token_mint, ... +const VAULT_TOKEN_MINT_OFFSET = 81 +const VAULT_TOTAL_SHARES_OFFSET = 162 +// reserved: [{ mint: Pubkey, amount: u64 }; 2], tokens owed to investors that stay in the vault until claimed +const VAULT_RESERVED_OFFSET = 286 +const VAULT_RESERVED_SLOTS = 2 +const VAULT_RESERVED_SLOT_SIZE = 40 +const VAULT_PENDING_FEE_SHARES_OFFSET = 374 // only on accounts resized to 438 bytes + +// AssetRegistry layout: 8 discriminator, bump u8, vault_pool, asset_mints: Vec +const REGISTRY_VAULT_OFFSET = 9 +const REGISTRY_MINTS_LEN_OFFSET = 41 +const REGISTRY_MINTS_OFFSET = 45 + +const ZERO_KEY = PublicKey.default.toString() +const toKey = (data, offset) => new PublicKey(data.subarray(offset, offset + 32)).toString() + +async function tvl(api) { + const connection = getConnection() + const [vaults, registries] = await Promise.all([ + connection.getProgramAccounts(PROGRAM_ID, { filters: [byDiscriminator('VaultPool')] }), + connection.getProgramAccounts(PROGRAM_ID, { filters: [byDiscriminator('AssetRegistry')] }), + ]) + + // vault address -> set of mints it can hold (base token, every asset it has traded into, reserved claims) + const vaultMints = {} + for (const { pubkey, account: { data } } of vaults) { + const totalShares = data.readBigUInt64LE(VAULT_TOTAL_SHARES_OFFSET) + const pendingFeeShares = data.length >= VAULT_PENDING_FEE_SHARES_OFFSET + 8 ? data.readBigUInt64LE(VAULT_PENDING_FEE_SHARES_OFFSET) : 0n + if (totalShares === 0n && pendingFeeShares === 0n) continue // nobody holds a claim on this vault + const mints = new Set([toKey(data, VAULT_TOKEN_MINT_OFFSET)]) + for (let i = 0; i < VAULT_RESERVED_SLOTS; i++) { + const mint = toKey(data, VAULT_RESERVED_OFFSET + VAULT_RESERVED_SLOT_SIZE * i) + if (mint !== ZERO_KEY) mints.add(mint) + } + vaultMints[pubkey.toString()] = mints + } + + for (const { account: { data } } of registries) { + const vault = toKey(data, REGISTRY_VAULT_OFFSET) + if (!vaultMints[vault]) continue + const count = data.readUInt32LE(REGISTRY_MINTS_LEN_OFFSET) + for (let i = 0; i < count; i++) + vaultMints[vault].add(toKey(data, REGISTRY_MINTS_OFFSET + 32 * i)) + } + + // Vault token accounts are ATAs owned by the vault PDA (associated_token::authority = vault_pool on deposit and swap). + // The ATA address depends on the mint's token program (SPL Token or Token-2022). + const mints = [...new Set(Object.values(vaultMints).flatMap(set => [...set]))] + const mintInfos = await getMultipleAccounts(mints) + const tokenProgramOf = {} + mints.forEach((mint, i) => { if (mintInfos[i]) tokenProgramOf[mint] = mintInfos[i].owner }) + + const tokenAccounts = Object.entries(vaultMints).flatMap(([vault, set]) => + [...set].filter(mint => tokenProgramOf[mint]).map(mint => getAssociatedTokenAddress(mint, vault, tokenProgramOf[mint]))) + + // allowError: an ATA can be missing (never created, or closed once the vault sold the asset) + return sumTokens2({ api, tokenAccounts, allowError: true }) +} + +module.exports = { + timetravel: false, + methodology: 'Total value of all coins held in the smart contracts of the protocol: the token accounts owned by each FBYT vault on Solana. Only the production program is counted.', + solana: { tvl }, +} From 79581250710c0c3d30431cb45f884480375fbab0 Mon Sep 17 00:00:00 2001 From: monocurvehq Date: Mon, 19 Oct 2026 03:08:24 -0500 Subject: [PATCH 327/988] Add Monocurve (Solana launchpad) TVL adapter (#21700) Co-authored-by: monocurvehq <343095707+monocurvehq@users.noreply.github.com> --- projects/monocurve/index.js | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 projects/monocurve/index.js diff --git a/projects/monocurve/index.js b/projects/monocurve/index.js new file mode 100644 index 00000000000..0e25bce5fd2 --- /dev/null +++ b/projects/monocurve/index.js @@ -0,0 +1,41 @@ +const { PublicKey } = require('@solana/web3.js') +const { getConnection, sumTokens2 } = require('../helper/solana') + +const PROGRAM_ID = new PublicKey('BfkWpqxkBiZKiXdLB7FjzTu2r5qzBuCE4Dg9bKwgJ8a1') +// anchor discriminator: sha256("account:Curve")[0..8] +const CURVE_DISCRIMINATOR = Buffer.from(require('crypto').createHash('sha256').update('account:Curve').digest().subarray(0, 8)) + +// Curve layout (after the 8-byte discriminator): +// mint, thesis_hash, creator (32 bytes each), name, ticker, uri, fee_identity (borsh strings), +// quote_mint (32), quote_vault (32), quote_is_sol (1), ... +function decodeQuoteVault(data) { + let offset = 8 + 32 * 3 + for (let i = 0; i < 4; i++) offset += 4 + data.readUInt32LE(offset) + const quoteMint = new PublicKey(data.subarray(offset, offset + 32)).toString() + const quoteVault = new PublicKey(data.subarray(offset + 32, offset + 64)).toString() + const quoteIsSol = data[offset + 64] === 1 + return { quoteMint, quoteVault, quoteIsSol } +} + +async function tvl(api) { + const connection = getConnection() + const curves = await connection.getProgramAccounts(PROGRAM_ID, { + filters: [{ memcmp: { offset: 0, bytes: CURVE_DISCRIMINATOR.toString('base64'), encoding: 'base64' } }], + }) + + const solOwners = [] + const tokenAccounts = [] + for (const { account } of curves) { + const { quoteVault, quoteIsSol } = decodeQuoteVault(account.data) + if (quoteIsSol) solOwners.push(quoteVault) // lamport vault PDA holding the curve's SOL + else tokenAccounts.push(quoteVault) // token-quoted curves hold the quote asset in a token account + } + + return sumTokens2({ api, solOwners, tokenAccounts }) +} + +module.exports = { + timetravel: false, + methodology: 'TVL is the quote asset (SOL) held in the vaults of every Monocurve bonding curve. Curve accounts are read from the Monocurve program on-chain and the balance of each curve vault is summed.', + solana: { tvl }, +} From 8a66dfd54bc6b385dd7ba9422fd0b1a1dc051b24 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 19 Oct 2026 10:18:33 +0200 Subject: [PATCH 328/988] track bch - fixes #21574 --- cex/nonkyc.js | 23 ++----- cex/osl-hk.js | 13 ++-- cex/osl.js | 2 +- projects/binance/index.js | 1 + projects/helper/chain/bitcoincash.js | 20 +++++++ projects/helper/sumTokens.js | 1 + projects/helper/tokenMapping.js | 2 +- projects/hyperion/index.js | 90 ++++++---------------------- projects/resu/index.js | 20 +++---- 9 files changed, 64 insertions(+), 108 deletions(-) create mode 100644 projects/helper/chain/bitcoincash.js diff --git a/cex/nonkyc.js b/cex/nonkyc.js index b9480c25403..0bec97080bf 100644 --- a/cex/nonkyc.js +++ b/cex/nonkyc.js @@ -31,36 +31,27 @@ module.exports = { }, /* bitcoin: 'nonkyc', // remove it for now - /* + */ bitcoincash: { owners: [ 'qzfew0ck3kxjdytrr2vnycdjnnsyju3pwsrgsupqj2', ] }, - */ // we dont support bitcoincash on CEX dashboard - bsc: { + cardano: { owners: [ - '0x15d7619c8457e2F89ea28c720b1d7941C245d27e', - '0x473ba7D925b147024Ff5F6b19eC802DbB54E8acf' + 'addr1qy77lfdhpnxyl90t58amp2x3dz0lhgzttmw53g2nxe360x7aht5vw4djzh7jluu6jrl384l6u628ymh4yghgnfgk3kqsjymy5j' ] }, - cardano: { + doge: { owners: [ - 'addr1qy77lfdhpnxyl90t58amp2x3dz0lhgzttmw53g2nxe360x7aht5vw4djzh7jluu6jrl384l6u628ymh4yghgnfgk3kqsjymy5j' + 'DFbKm2cjt1Y36sKPQc6RQc3MsLmwcccTJx' ] }, - /* dash: { owners: [ 'XauVSyTHwQiwt5HLiMKEYhCZr9z4dwzyn4' ] - }, //// we dont support dash neither doge on CEX dashboard - doge: { - owners: [ - 'DFbKm2cjt1Y36sKPQc6RQc3MsLmwcccTJx' - ] }, - */ energi: { owners: [ '0x7b4D11b7fABC161bc09E3Ee86C3d34Dff40F5a47', @@ -73,13 +64,11 @@ module.exports = { '0x9a1Dfd705130ef60245d6FC798411f296f641119' ], }, - /* ethereumclassic: { owners: [ '0x5D738fBf1D8940BBE72Af847d88c517064DE76e7' ], - }, //we dont support ethclassic on CEX dashboard - */ + }, flare: { owners: [ '0x5D738fBf1D8940BBE72Af847d88c517064DE76e7', diff --git a/cex/osl-hk.js b/cex/osl-hk.js index b492ecad99b..43594de315e 100644 --- a/cex/osl-hk.js +++ b/cex/osl-hk.js @@ -767,13 +767,12 @@ module.exports = { "MQ9mZJu3X7m4CpMkvHia2nMRvY2q25kBA6", // client-cold ], }, - // defillama does not support bitcoincash at the moment - // bitcoincash: { - // owners: [ - // "bitcoincash:qqfys07mea9d3zq4ht6yvr4td2thr2w3cgq9nsews5", // house-cold - // "bitcoincash:qqtzeg448vf9tdhcdvguz5nf2pgvc78cw5fgzad4tz", // client-cold - // ], - // }, + bitcoincash: { + owners: [ + "bitcoincash:qqfys07mea9d3zq4ht6yvr4td2thr2w3cgq9nsews5", // house-cold + "bitcoincash:qqtzeg448vf9tdhcdvguz5nf2pgvc78cw5fgzad4tz", // client-cold + ], + }, ton: { owners: [ "UQD8mH9bP464QWAzcQl-e0XUepHKuSwLSLDcQs1VUWCe0Swb", // house-cold diff --git a/cex/osl.js b/cex/osl.js index 1ed3d7e494c..84f5fe33252 100644 --- a/cex/osl.js +++ b/cex/osl.js @@ -868,7 +868,7 @@ module.exports = { "MQ9mZJu3X7m4CpMkvHia2nMRvY2q25kBA6", // 3 ], }, - // defillama does not support bitcoincash at the moment + // duplicate of osl-hk // bitcoincash: { // owners: [ // "bitcoincash:qqfys07mea9d3zq4ht6yvr4td2thr2w3cgq9nsews5", // house-cold diff --git a/projects/binance/index.js b/projects/binance/index.js index fd98f94d0dd..51a5ec6a766 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -19,6 +19,7 @@ const binanceToDefillama = { BSC: 'bsc', CELO: 'celo', CHZ2: 'chz', + BCH: 'bitcoincash', HBAR: 'hedera', TRX: 'tron', TRON: 'tron', diff --git a/projects/helper/chain/bitcoincash.js b/projects/helper/chain/bitcoincash.js new file mode 100644 index 00000000000..8d3a315096b --- /dev/null +++ b/projects/helper/chain/bitcoincash.js @@ -0,0 +1,20 @@ +const { utxo } = require('@defillama/sdk').chains + +const CHAIN = 'bitcoincash' + +// BCH balance in base units (8 decimals); accepts cashaddr (with or without the +// `bitcoincash:` prefix) and legacy base58 addresses, the sdk rotates haskoin / blockchair / tatum +async function getBalance(addr) { + return Number(await utxo.getBalance({ chain: CHAIN, address: addr })) +} + +async function sumTokens({ api, owners = [] }) { + for (const owner of owners) { + const balance = await getBalance(owner) + api.addCGToken('bitcoin-cash', balance / 1e8) + } +} + +module.exports = { + sumTokens +} diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index a4033553c59..372df6c08f2 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -22,6 +22,7 @@ const helpers = { "near": require("./chain/near"), "bitcoin": require("./chain/bitcoin"), "litecoin": require("./chain/litecoin"), + "bitcoincash": require("./chain/bitcoincash"), "dash": require("./chain/dash"), "kaspa": require("./chain/kaspa"), "bsv": require("./chain/bsv"), diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 044237d65df..90a54a9f1f8 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -25,7 +25,7 @@ const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 's ] const caseSensitiveChains = [...ibcChains, ...svmChains, 'canton', 'mina', 'decred', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge', 'stellar', 'massa', 'aleo', 'eclipse', 'acala', 'aelf', 'aeternity', 'alephium', 'bifrost', 'bittensor', 'verus', 'dash', 'qubic', 'constellation', 'supra', - 'kaspa', 'bsv', 'arweave', 'pi', 'zcash', + 'kaspa', 'bsv', 'arweave', 'pi', 'zcash', 'bitcoincash', ] const transformTokens = { diff --git a/projects/hyperion/index.js b/projects/hyperion/index.js index fa6a1983fd3..14ab159e918 100644 --- a/projects/hyperion/index.js +++ b/projects/hyperion/index.js @@ -1,84 +1,32 @@ const { function_view } = require("../helper/chain/aptos"); -const { sleep } = require("../helper/utils"); +const { get } = require("../helper/http"); -const coinInfoCache = new Map(); -const PAIRED_COIN_DELAY_MS = 1000; -const MAX_RETRIES = 3; -const BASE_BACKOFF_MS = 1000; - -const hexToUtf8 = (hexStr) => Buffer.from(String(hexStr).replace(/^0x/, ''), 'hex').toString('utf-8'); - -const backoffMs = (i) => BASE_BACKOFF_MS * (i + 1) * (i + 1); - -async function callWithRetry(fn) { - let lastErr; - for (let i = 0; i <= MAX_RETRIES; i++) { - const sentinel = Symbol('ERR'); - const res = await fn().catch((e) => { lastErr = e; return sentinel; }); - if (res !== sentinel) return res; - if (i === MAX_RETRIES) throw lastErr; - await sleep(backoffMs(i)); - } -} - -async function _getPoolInfo(offset, limit) { - return function_view({ - functionStr: "0x8b4a2c4bb53857c718a04c020b98f8c2e1f99a68b0f57389a8bf5434cd22e05c::pool_v3::all_pools_with_info", - args: [String(offset), String(limit)], - type_arguments: [], - }); -} - -async function _getCoinInfo(faType) { - if (coinInfoCache.has(faType)) return coinInfoCache.get(faType); - - await sleep(PAIRED_COIN_DELAY_MS); - - const coinInfo = await callWithRetry(() => - function_view({ functionStr: "0x1::coin::paired_coin", args: [faType], type_arguments: [] }) - ); - - if (!coinInfo || !coinInfo.vec || coinInfo.vec.length === 0) { - coinInfoCache.set(faType, null); - return null; - } - - const v = coinInfo.vec[0]; - const out = `${v.account_address}::${hexToUtf8(v.module_name)}::${hexToUtf8(v.struct_name)}`; - coinInfoCache.set(faType, out); - return out; -} - -async function getPoolInfo() { - let offset = 0; - const limit = 100; - let pools = []; - let [data, pager] = await _getPoolInfo(offset, limit); - if (data.length) pools = pools.concat(data); - - while (offset + limit < pager.total) { - offset += limit; - [data, pager] = await _getPoolInfo(offset, limit); - if (data.length) pools = pools.concat(data); - } - return pools; -} +const HYPERION = "0x8b4a2c4bb53857c718a04c020b98f8c2e1f99a68b0f57389a8bf5434cd22e05c"; +// hyperion's own pool list: per pool tvlUSD, the two tokens (pool order) and their metadata +const POOL_LIST = "https://assets.hyperion.xyz/files/pool-list-new.json"; +// pools below this (per hyperion's list) are skipped; ~40 of ~350 pools hold >99.9% of tvl +const MIN_POOL_TVL_USD = 100; module.exports = { timetravel: false, isHeavyProtocol: true, - methodology: "Counts the total liquidity in all pools on Hyperion.", + methodology: `Counts the token reserves of Hyperion pools, read on-chain (pool_v3::pool_reserve_amount); pools Hyperion lists below $${MIN_POOL_TVL_USD} TVL are skipped.`, aptos: { tvl: async (api) => { - const pools = await getPoolInfo(); - api.log(`Hyperion Number of pools: ${pools.length}`); + const { data: list } = await get(POOL_LIST); + const pools = list.filter(({ tvlUSD }) => Number(tvlUSD) >= MIN_POOL_TVL_USD).map(({ pool }) => pool); + api.log(`Hyperion pools counted: ${pools.length} of ${list.length} listed`); + // FA tokens paired with a legacy coin are priced under the coin type + const token = (info, fa) => info?.coinType ?? fa; for (const pool of pools) { - const coin1 = (await _getCoinInfo(pool.token_a.inner)) || pool.token_a.inner; - const coin2 = (await _getCoinInfo(pool.token_b.inner)) || pool.token_b.inner; - - api.add(coin1, pool.token_a_reserve); - api.add(coin2, pool.token_b_reserve); + const [reserve1, reserve2] = await function_view({ + functionStr: `${HYPERION}::pool_v3::pool_reserve_amount`, + args: [pool.poolId], + type_arguments: [], + }); + api.add(token(pool.token1Info, pool.token1), reserve1); + api.add(token(pool.token2Info, pool.token2), reserve2); } }, }, diff --git a/projects/resu/index.js b/projects/resu/index.js index a061659286b..af0d80e8d3e 100644 --- a/projects/resu/index.js +++ b/projects/resu/index.js @@ -19,22 +19,20 @@ const VAULTS = { ], } -const navTvl = (vaults) => async (api) => { - const navs = await api.multiCall({ abi: 'uint256:nav', calls: vaults }) +const navTvl = async (api) => { + const vaults = VAULTS[api.chain] || [] + const navs = await api.multiCall({ abi: 'uint256:nav', calls: vaults, permitFailure: true, excludeFailed: true, }) navs.forEach((nav) => api.addUSDValue(Number(nav) / 1e18)) } module.exports = { methodology: - 'TVL is the net asset value locked in each Resu pool. On EVM chains the ' + - "pool's OracleVault.nav() returns its value in USD (read from Chainlink / " + - 'HyperCore oracles); on TON it is the base jetton (tsTON, tsUSDe) held by ' + - 'each pool. Solana is live on devnet only and is excluded.', - base: { tvl: navTvl(VAULTS.base) }, - arbitrum: { tvl: navTvl(VAULTS.arbitrum) }, - hyperliquid: { tvl: navTvl(VAULTS.hyperliquid) }, - monad: { tvl: navTvl(VAULTS.monad) }, - robinhood: { tvl: navTvl(VAULTS.robinhood) }, + 'TVL is the net asset value locked in each Resu pool', + base: { tvl: navTvl }, + arbitrum: { tvl: navTvl }, + hyperliquid: { tvl: navTvl }, + monad: { tvl: navTvl }, + robinhood: { tvl: navTvl }, ton: { tvl: sumTokensExport({ owners: [ From af650f1bf6a6678948902abe396182622e7bf34d Mon Sep 17 00:00:00 2001 From: Dani Date: Mon, 19 Oct 2026 10:26:17 +0200 Subject: [PATCH 329/988] ace-pro: add v5 vaults to erc4626 registry (#21715) Co-authored-by: acedotpro <281971425+acedotpro@users.noreply.github.com> --- registries/erc4626.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/registries/erc4626.js b/registries/erc4626.js index 1d311d1f772..e52ef2e3a30 100644 --- a/registries/erc4626.js +++ b/registries/erc4626.js @@ -522,6 +522,11 @@ const configs = { methodology: 'TVL is the USDC held by the AlphaPrimer vault, read via ERC-4626 totalAssets(). Deposits are supplied to Aave V3, Compound V3 or Fluid on Arbitrum, so they are also counted under those protocols.', arbitrum: ['0x87Ef5c25203886b1026ad907E7f84fBAABdF1fa9'], }, + 'ace-pro': { + start: '2026-09-29', + methodology: 'Counts LP assets reported by totalAssets() in the Ace.Pro V5 shared HYPE and USDC liquidity vaults on HyperEVM. Excludes round escrow, claimable payouts and protocol revenue held for the team and treasury, Lucky Draw prize pools and legacy vaults.', + hyperliquid: ['0xd39C426bd1a40b5cdB89B8CEb8464C4f78AbB29d', '0xf725Ac947c7B3EF790a3E68e2Ca2Fb48ce4023eD'], + }, } module.exports = buildProtocolExports(configs, erc4626ExportFn) From 16393be19ab590025229d5fc8695999bc3096ffd Mon Sep 17 00:00:00 2001 From: daonarchy Date: Mon, 19 Oct 2026 15:27:31 +0700 Subject: [PATCH 330/988] add Lucid Labs (#21687) Co-authored-by: daonarchy <219096321+daonarchy@users.noreply.github.com> Co-authored-by: ccipherx --- projects/lucid-labs/index.js | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 projects/lucid-labs/index.js diff --git a/projects/lucid-labs/index.js b/projects/lucid-labs/index.js new file mode 100644 index 00000000000..13cc09e77f2 --- /dev/null +++ b/projects/lucid-labs/index.js @@ -0,0 +1,58 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// Asset Controllers hold the native tokens on each asset's base chain +// and mint/burn the Lucid-wrapped versions on the other chains. +// Source: https://docs.lucidlabs.fi/developer-reference/deployed-contracts/controller-contracts +const config = { + arbitrum: [ + // L-USDC controller + ['0xaf88d065e77c8cC2239327C5EDb3A432268e5831', '0x3c3DC44fABc3a516E6A329734aEE36dA49F3BA21'], + ], + optimism: [ + // L-USDT controller + ['0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', '0x35Be3fa7e22B7FD7051248974cC44Bf88b8c5cc2'], + // MANTRA USDT controller + ['0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', '0x0569725992ee675f862bf0d25CA40fCfB2B69d6E'], + ], + avax: [ + // KiteAI USDC and WETH controllers + ['0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', '0x7144ADe61f4BEcD513658db3441a0CE286aE90fd'], + ['0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB', '0x1324Be9339e1618387d2405C6f4CE660447cB582'], + ], + celo: [ + // KiteAI USDT controller + ['0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e', '0xc620C68Cb63EA35e9930e240051A6A7C02D568A1'], + ], + base: [ + // MANTRA USDC and WETH controllers + ['0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', '0xFf54162d7061290A966119784a0F34663d00E190'], + ['0x4200000000000000000000000000000000000006', '0x47263861BD8E964425910FAA0870e9d0fb630876'], + ], + ethereum: [ + // RedBelly USDC.e, USDT, WETH, WBTC controllers + ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0x3b55a4C0691d4D62719D0BFaA435010fBF2F135f'], + ['0xdAC17F958D2ee523a2206206994597C13D831ec7', '0x4f65f6e8B436289513b5F3ce96B2D2f032fc207C'], + ['0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0xc0FCe0c5cdbbA2D7f7212F3C726b05d5d1b6cf0E'], + ['0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', '0x530d8C1fC48fa4b61Ac755be3bB3CbdCAcd20be9'], + ], +} + +module.exports = { + start: '2026-05-19', // last controller deployed 2026-05-18 + doublecounted: true, + methodology: + 'TVL is the native tokens locked in Lucid Asset Controller contracts on each asset\'s base chain, including the share each controller has deployed to its Aave V3 yield strategy (counted via the strategy\'s aToken balance). Wrapped Lucid tokens minted on other chains are not counted.', +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { + tvl: async (api) => { + const tokensAndOwners = [...config[chain]] + const strategies = (await api.multiCall({ abi: 'address:yieldStrategy', calls: config[chain].map(([, owner]) => owner) })) + .filter((s) => s !== ADDRESSES.null) + const aTokens = await api.multiCall({ abi: 'address:aToken', calls: strategies }) + aTokens.forEach((aToken, i) => tokensAndOwners.push([aToken, strategies[i]])) + return api.sumTokens({ tokensAndOwners }) + }, + } +}) From 15a380104ab234dc4bf324b37582abd0b31c4fcf Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Mon, 19 Oct 2026 10:50:03 +0100 Subject: [PATCH 331/988] fix(bitunix): add Ethereum reserve wallet (#21669) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- cex/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/cex/index.js b/cex/index.js index 846bcd0fcea..a29c7d9ccdf 100644 --- a/cex/index.js +++ b/cex/index.js @@ -418,6 +418,7 @@ const configs = { 'bitunix-cex': { ethereum: { owners: [ + "0x0988533bCB2e747351F08a365b33E46456C965A1", "0x76B0aB5067B3be922ef4698390Ca8bd5812A5080", "0x6Fe39F2831caF58529779EFDB73341Aa64df50Ab", "0x431CA183bD6c2fd4a160ac28363D1719f3F12779" From 032461799762e43a6a86f93a99f5774142166673 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 19 Oct 2026 08:03:37 -0400 Subject: [PATCH 332/988] yield ai fix (#21719) --- projects/yield-ai/index.js | 313 +++++++++++++++---------------------- 1 file changed, 130 insertions(+), 183 deletions(-) diff --git a/projects/yield-ai/index.js b/projects/yield-ai/index.js index d55e7e1a530..fc884220e37 100644 --- a/projects/yield-ai/index.js +++ b/projects/yield-ai/index.js @@ -27,9 +27,10 @@ const DLP_SHARE = const USDC = ADDRESSES.aptos.USDC_3; const INDEXER_URL = "https://api.mainnet.aptoslabs.com/v1/graphql"; +const INDEXER_PAGE_SIZE = 100; // the indexer caps responses at 100 rows +const INDEXER_TIMEOUT_MS = 30_000; const PAGE_SIZE = 50; const OWNER_BATCH_SIZE = 30; -const COIN_BALANCE_CONCURRENCY = 10; const ECHELON_CONCURRENCY = 4; const HYPERION_LP_CONCURRENCY = 8; @@ -46,19 +47,18 @@ const YIELD_AI_HYPERION_POOLS = [ }, ]; -const APT = ADDRESSES.aptos.APT; -const COIN_BALANCE_FN = "0x1::coin::balance"; -const APT_TYPE_ARG = ADDRESSES.aptos.APT; - +// Native APT is included: the indexer reports coin and FA APT as one 0x1::aptos_coin::AptosCoin row. const FA_BALANCES_QUERY = gql` - query YieldAiFaBalances($addresses: [String!]!) { - current_fungible_asset_balances(where: { owner_address: { _in: $addresses } }) { + query YieldAiFaBalances($addresses: [String!]!, $limit: Int!, $offset: Int!) { + current_fungible_asset_balances( + where: { owner_address: { _in: $addresses }, amount: { _gt: "0" } } + order_by: [{ owner_address: asc }, { storage_id: asc }] + limit: $limit + offset: $offset + ) { owner_address amount asset_type - metadata { - decimals - } } } `; @@ -112,11 +112,11 @@ function normalizeObjectAddress(obj) { } /** - * Exponential backoff with jitter. The public fullnode and the Aptos indexer answer bursts with - * 429, and a failed read fails the run instead of dropping that safe, so a short linear backoff - * is not enough to ride out a rate-limit window. + * Exponential backoff with jitter, for indexer requests only. Fullnode reads go through the SDK, + * which already retries transient errors (429, 5xx, timeouts) and skips deterministic ones such + * as Move aborts; wrapping those again multiplies the delays and can stall the run. */ -async function retryAsync(fn, attempts = 8) { +async function retryAsync(fn, attempts = 5) { let lastError; for (let i = 0; i < attempts; i += 1) { try { @@ -132,52 +132,41 @@ async function retryAsync(fn, attempts = 8) { throw lastError; } -async function getEchelonVaultResource(safe) { - return await retryAsync(() => - getResource(safe, ECHELON_VAULT_RESOURCE, "aptos") - ); -} - function unwrapScalar(res) { return Array.isArray(res) ? res[0] : res; } -let dlpNavPromise; - /** * DLP shares have no price feed, so they are counted as the USDC they redeem for, at the vault's * own on-chain NAV. Both views return 6-decimal base units, the same as USDC, so * usdc = shares * net_asset_value / num_shares needs no decimal adjustment. */ -function getDlpNav() { - if (!dlpNavPromise) { - dlpNavPromise = (async () => { - // Read both views at one ledger version, so NAV and share count describe the same vault - // state even if a contribution or redemption lands between the two calls. - const { ledger_version: ledgerVersion } = await retryAsync(() => aQuery("/v1", "aptos")); - const [nav, shares] = await Promise.all( - ["get_vault_net_asset_value", "get_vault_num_shares"].map((fn) => - retryAsync(() => - function_view({ - functionStr: `${DECIBEL}::vault::${fn}`, - args: [DLP_VAULT], - ledgerVersion, - chain: "aptos", - }) - ) - ) - ); - return { nav: BigInt(unwrapScalar(nav)), shares: BigInt(unwrapScalar(shares)) }; - })(); - } - return dlpNavPromise; +async function getDlpNav() { + // Read both views at one ledger version, so NAV and share count describe the same vault + // state even if a contribution or redemption lands between the two calls. + const { ledger_version: ledgerVersion } = await aQuery("/v1", "aptos"); + const viewAt = (fn) => + function_view({ + functionStr: `${DECIBEL}::vault::${fn}`, + args: [DLP_VAULT], + ledgerVersion, + chain: "aptos", + }); + const nav = await viewAt("get_vault_net_asset_value"); + const shares = await viewAt("get_vault_num_shares"); + return { nav: BigInt(unwrapScalar(nav)), shares: BigInt(unwrapScalar(shares)) }; } -async function addDlpAsUsdc(api, sharesRaw) { - const { nav, shares } = await getDlpNav(); - if (shares === 0n) return; - const usdc = (BigInt(sharesRaw) * nav) / shares; - if (usdc > 0n) api.add(USDC, usdc.toString()); +/** Per-run DLP pricer: the NAV is read once per run, never reused across runs. */ +function createDlpAdder(api) { + let navPromise; + return async (sharesRaw) => { + if (!navPromise) navPromise = getDlpNav(); + const { nav, shares } = await navPromise; + if (shares === 0n) return; + const usdc = (BigInt(sharesRaw) * nav) / shares; + if (usdc > 0n) api.add(USDC, usdc.toString()); + }; } /** Views return metadata inner; keep 0xa-style APT shorthand as-is (lower case). */ @@ -189,15 +178,6 @@ function normalizeUnderlyingTokenId(inner) { return s.startsWith("0x") ? s : `0x${s}`; } -function isNativeAptFaRow(assetType) { - if (!assetType || typeof assetType !== "string") return false; - return ( - assetType === APT || - assetType.toLowerCase() === APT.toLowerCase() || - assetType.endsWith("::aptos_coin::AptosCoin") - ); -} - function toIntegerString(v) { if (v == null) return null; if (typeof v === "bigint") return v.toString(); @@ -327,40 +307,34 @@ async function resolveHyperionPoolAddress(pos) { if (known?.poolAddress) return known.poolAddress; // liquidity_pool_address_safe returns a (bool exists, address) tuple - const res = await retryAsync(() => - function_view({ - functionStr: `${HYPERION_DEX}::pool_v3::liquidity_pool_address_safe`, - args: [pos.tokenA, pos.tokenB, pos.feeTier], - chain: "aptos", - }) - ); + const res = await function_view({ + functionStr: `${HYPERION_DEX}::pool_v3::liquidity_pool_address_safe`, + args: [pos.tokenA, pos.tokenB, pos.feeTier], + chain: "aptos", + }); const [exists, addr] = Array.isArray(res) ? res : [false, null]; return exists ? normalizeAptosAddress(addr) : null; } -const hyperionCurrentTickCache = new Map(); - -async function getHyperionPoolCurrentTick(poolAddress) { +async function getHyperionPoolCurrentTick(poolAddress, tickCache) { const pool = normalizeAptosAddress(poolAddress); if (!pool) return null; - if (hyperionCurrentTickCache.has(pool)) { - return hyperionCurrentTickCache.get(pool); + if (tickCache.has(pool)) { + return tickCache.get(pool); } - - const res = await retryAsync(() => - function_view({ - functionStr: `${HYPERION_DEX}::pool_v3::current_tick_and_price`, - args: [pool], - chain: "aptos", - }) - ); + + const res = await function_view({ + functionStr: `${HYPERION_DEX}::pool_v3::current_tick_and_price`, + args: [pool], + chain: "aptos", + }); const tickRaw = Array.isArray(res) ? res[0] : res; const tick = decodeI32Tick(tickRaw); - hyperionCurrentTickCache.set(pool, tick); + tickCache.set(pool, tick); return tick; } -async function resolveHyperionPositionAmounts(pos) { +async function resolveHyperionPositionAmounts(pos, tickCache) { let amountA = pos.amountA; let amountB = pos.amountB; const hasLiveA = amountA && amountA !== "0"; @@ -368,13 +342,11 @@ async function resolveHyperionPositionAmounts(pos) { if (hasLiveA || hasLiveB) return { amountA, amountB }; if (pos.position) { - const routerRes = await retryAsync(() => - function_view({ - functionStr: `${HYPERION_DEX}::router_v3::get_amount_by_liquidity`, - args: [pos.position], - chain: "aptos", - }) - ); + const routerRes = await function_view({ + functionStr: `${HYPERION_DEX}::router_v3::get_amount_by_liquidity`, + args: [pos.position], + chain: "aptos", + }); if (Array.isArray(routerRes)) { amountA = toIntegerString(routerRes[0]); amountB = toIntegerString(routerRes[1]); @@ -390,7 +362,7 @@ async function resolveHyperionPositionAmounts(pos) { const poolAddress = await resolveHyperionPoolAddress(pos); if (!poolAddress) return { amountA: null, amountB: null }; - const currentTick = await getHyperionPoolCurrentTick(poolAddress); + const currentTick = await getHyperionPoolCurrentTick(poolAddress, tickCache); return computeAmountsFromLiquidity({ liquidity: pos.liquidity, tickLower: pos.tickLower, @@ -403,24 +375,20 @@ async function resolveHyperionPositionAmounts(pos) { * @returns {{ safeAddresses: string[] }} */ async function fetchExistingSafes() { - const totalRaw = await retryAsync(() => - function_view({ - functionStr: `${VAULT}::vault::get_total_safes`, - chain: "aptos", - }) - ); + const totalRaw = await function_view({ + functionStr: `${VAULT}::vault::get_total_safes`, + chain: "aptos", + }); const total = Math.max(0, Number(totalRaw) || 0); const safeOut = []; for (let start = 0; start < total; start += PAGE_SIZE) { const limit = Math.min(PAGE_SIZE, total - start); - const pageRaw = await retryAsync(() => - function_view({ - functionStr: `${VAULT}::vault::get_safes_range_info`, - args: [String(start), String(limit)], - chain: "aptos", - }) - ); + const pageRaw = await function_view({ + functionStr: `${VAULT}::vault::get_safes_range_info`, + args: [String(start), String(limit)], + chain: "aptos", + }); const rows = unwrapVector(pageRaw).map(normalizeSafeRow); for (const row of rows) { if (!truthyExists(row.exists)) continue; @@ -434,7 +402,7 @@ async function fetchExistingSafes() { return { safeAddresses: [...new Set(safeOut)] }; } -async function sumEchelonSafePositions(api, safeAddresses) { +async function sumEchelonSafePositions(api, safeAddresses, addDlpAsUsdc) { if (!safeAddresses.length) return { adds: 0, totalsByAsset: new Map() }; // Use vault_exists first so we only read the resource for safes with positions @@ -443,13 +411,11 @@ async function sumEchelonSafePositions(api, safeAddresses) { .for(safeAddresses) .handleError((e) => { throw e; }) // a failed read must fail the run, not drop the safe's TVL .process(async (safe) => { - const res = await retryAsync(() => - function_view({ - functionStr: `${ECHELON}::lending::vault_exists`, - args: [safe], - chain: "aptos", - }) - ); + const res = await function_view({ + functionStr: `${ECHELON}::lending::vault_exists`, + args: [safe], + chain: "aptos", + }); const exists = Array.isArray(res) ? res[0] : res; if (exists === true || exists === "true") safesWithVault.push(safe); }); @@ -460,13 +426,11 @@ async function sumEchelonSafePositions(api, safeAddresses) { async function getMarketMetadata(market) { if (!marketMetadataCache.has(market)) { - const metadata = await retryAsync(() => - function_view({ - functionStr: `${ECHELON}::lending::market_asset_metadata`, - args: [market], - chain: "aptos", - }) - ); + const metadata = await function_view({ + functionStr: `${ECHELON}::lending::market_asset_metadata`, + args: [market], + chain: "aptos", + }); marketMetadataCache.set( market, padAptosAddress(normalizeObjectAddress(metadata)) @@ -479,9 +443,9 @@ async function sumEchelonSafePositions(api, safeAddresses) { .for(safesWithVault) .handleError((e) => { throw e; }) // a failed read must fail the run, not drop the safe's TVL .process(async (safe) => { - const vault = await getEchelonVaultResource(safe); - const collaterals = - vault?.data?.collaterals?.data || vault?.collaterals?.data || []; + const vault = await getResource(safe, ECHELON_VAULT_RESOURCE, "aptos"); + const collaterals = + vault?.data?.collaterals?.data || vault?.collaterals?.data || []; for (const collateral of collaterals) { const market = padAptosAddress( @@ -489,13 +453,11 @@ async function sumEchelonSafePositions(api, safeAddresses) { ); if (!market) continue; - const coins = await retryAsync(() => - function_view({ - functionStr: `${ECHELON}::lending::account_coins`, - args: [safe, market], - chain: "aptos", - }) - ); + const coins = await function_view({ + functionStr: `${ECHELON}::lending::account_coins`, + args: [safe, market], + chain: "aptos", + }); const amount = toIntegerString(coins); if (!amount || amount === "0") continue; @@ -505,7 +467,7 @@ async function sumEchelonSafePositions(api, safeAddresses) { adds += 1; const prev = totalsByAsset.get(asset) || 0n; totalsByAsset.set(asset, prev + BigInt(amount)); - if (asset === DLP_SHARE) await addDlpAsUsdc(api, amount); + if (asset === DLP_SHARE) await addDlpAsUsdc(amount); else api.add(asset, amount); } }); @@ -517,8 +479,9 @@ async function tvl(api) { const { safeAddresses } = await fetchExistingSafes(); if (!safeAddresses.length) return; + const addDlpAsUsdc = createDlpAdder(api); const { adds: echelonAdds, totalsByAsset: echelonTotalsByAsset } = - await sumEchelonSafePositions(api, safeAddresses); + await sumEchelonSafePositions(api, safeAddresses, addDlpAsUsdc); // the SDK sends the same key on fullnode views const indexerHeaders = {}; @@ -529,86 +492,70 @@ async function tvl(api) { const faTotalsByAsset = new Map(); for (const batch of sliceIntoChunks(safeAddresses, OWNER_BATCH_SIZE)) { - const { current_fungible_asset_balances: rows } = await retryAsync(() => - graphQLClient.request(FA_BALANCES_QUERY, { addresses: batch }) - ); - - const list = rows || []; + for (let offset = 0; ; offset += INDEXER_PAGE_SIZE) { + // a fresh signal per attempt, so a hung request is aborted and retried instead of + // blocking the run forever + const { current_fungible_asset_balances: rows = [] } = await retryAsync(() => + graphQLClient.request({ + document: FA_BALANCES_QUERY, + variables: { addresses: batch, limit: INDEXER_PAGE_SIZE, offset }, + signal: AbortSignal.timeout(INDEXER_TIMEOUT_MS), + }) + ); - for (const row of list) { - if (isNativeAptFaRow(row.asset_type)) continue; + for (const row of rows) { + const amtStr = toIntegerString(row.amount); + if (!amtStr || amtStr === "0" || /^-/.test(amtStr)) continue; - const amtStr = toIntegerString(row.amount); - if (!amtStr || amtStr === "0" || /^-/.test(amtStr)) continue; + const prev = faTotalsByAsset.get(row.asset_type) || 0n; + faTotalsByAsset.set(row.asset_type, prev + BigInt(amtStr)); - const prev = faTotalsByAsset.get(row.asset_type) || 0n; - faTotalsByAsset.set(row.asset_type, prev + BigInt(amtStr)); + if (padAptosAddress(row.asset_type) === DLP_SHARE) await addDlpAsUsdc(amtStr); + else api.add(row.asset_type, amtStr); + } - if (padAptosAddress(row.asset_type) === DLP_SHARE) await addDlpAsUsdc(api, amtStr); - else api.add(row.asset_type, amtStr); + if (rows.length < INDEXER_PAGE_SIZE) break; } } - await PromisePool.withConcurrency(COIN_BALANCE_CONCURRENCY) - .for(safeAddresses) - .handleError((e) => { throw e; }) - .process(async (addr) => { - const bal = await retryAsync(() => - function_view({ - functionStr: COIN_BALANCE_FN, - type_arguments: [APT_TYPE_ARG], - args: [addr], - chain: "aptos", - }) - ); - const balStr = toIntegerString(bal); - if (!balStr || balStr === "0") return; - api.add(APT, balStr); - }); - let hyperionAdds = 0; const hyperionTotalsByAsset = new Map(); + const tickCache = new Map(); await PromisePool.withConcurrency(HYPERION_LP_CONCURRENCY) .for(safeAddresses) .handleError((e) => { throw e; }) // throws on public rpcs instead of dropping hyperion tvl .process(async (safe) => { - const configExists = await retryAsync(() => - function_view({ - functionStr: `${VAULT}::vault::hyperion_lp_config_exists`, - args: [safe], - chain: "aptos", - }) - ).then((res) => { - const v = Array.isArray(res) ? res[0] : res; - return v === true || v === "true" || v === 1 || v === "1"; + const configRes = await function_view({ + functionStr: `${VAULT}::vault::hyperion_lp_config_exists`, + args: [safe], + chain: "aptos", }); + const configFlag = Array.isArray(configRes) ? configRes[0] : configRes; + const configExists = + configFlag === true || configFlag === "true" || configFlag === 1 || configFlag === "1"; if (!configExists) return; - const positionsRaw = await retryAsync(() => - function_view({ - functionStr: `${VAULT}::vault::get_hyperion_positions`, - args: [safe], - chain: "aptos", - }) - ); + const positionsRaw = await function_view({ + functionStr: `${VAULT}::vault::get_hyperion_positions`, + args: [safe], + chain: "aptos", + }); const positionAddresses = unwrapPositionAddresses(positionsRaw); if (!positionAddresses.length) return; for (const positionAddr of positionAddresses) { - const posRaw = await retryAsync(() => - function_view({ - functionStr: `${VAULT}::vault::get_hyperion_position`, - args: [safe, positionAddr], - chain: "aptos", - }) - ); + const posRaw = await function_view({ + functionStr: `${VAULT}::vault::get_hyperion_position`, + args: [safe, positionAddr], + chain: "aptos", + }); const pos = normalizeHyperionPosition(posRaw, positionAddr); if (!pos || pos.closed) continue; - const { amountA, amountB } = await resolveHyperionPositionAmounts(pos); + const { amountA, amountB } = await resolveHyperionPositionAmounts(pos, tickCache); if (amountA && amountA !== "0" && pos.tokenA) { hyperionAdds += 1; @@ -637,5 +584,5 @@ module.exports = { timetravel: false, doublecounted: true, aptos: { tvl }, - methodology: "Counts fungible-asset balances on Yield AI safe addresses (Aptos indexer), native APT via 0x1::coin::balance, Echelon supply positions held by safes, and open Hyperion CLMM LP positions. Decibel DLP vault shares (held or posted as Echelon collateral) are counted as USDC at the vault's on-chain net asset value per share. Echelon, Hyperion and Decibel are also tracked as separate protocols (doublecounted: true).", + methodology: "Counts fungible-asset balances on Yield AI safe addresses, including native APT (Aptos indexer), Echelon supply positions held by safes, and open Hyperion CLMM LP positions. Decibel DLP vault shares (held or posted as Echelon collateral) are counted as USDC at the vault's on-chain net asset value per share. Echelon, Hyperion and Decibel are also tracked as separate protocols (doublecounted: true).", }; From a04080721111465545646b90f953d650ed648cb4 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 19 Oct 2026 10:01:41 -0400 Subject: [PATCH 333/988] add new stellar vault to stellar defi hub (#21722) --- projects/stellarDefiHub/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/stellarDefiHub/index.js b/projects/stellarDefiHub/index.js index 3c7f19e5ce6..451c7045108 100644 --- a/projects/stellarDefiHub/index.js +++ b/projects/stellarDefiHub/index.js @@ -1,16 +1,27 @@ -const { getContractInstanceStorage } = require("../helper/chain/stellar"); +const { getContractInstanceStorage, callSoroban } = require("../helper/chain/stellar"); +// pre-deposit vaults: principal is tracked in instance storage const vaults = [ 'CA54LVHMAY7HGLMVPN4W72XJB4OGKVZBZX26FWN6JD4P3HJFWQUQEHJO', // XLM vault 'CAHEWHOPPDBQYFMAOLDOXXGUX2BCR7EXP4CWYCRY3NEAJB35YPZMMJFF', // USDC vault 'CAQRAXBU6G4AAX4BZ7R4WLB62TSVAQFS5ZXJDVXRLAU2NZ2ZTGU5QOYB', // PYUSD vault ] +// share vaults: total_assets includes funds deployed to subaccounts +const shareVaults = [ + 'CALFCZ4TY2CLHDHNJWCZX6JKYGUPV7P3GNQ3UVABXNE5JCV2E774APUM', // Evergreen vault +] + async function tvl(api) { for (const vault of vaults) { const { DepositAsset, TotalPrincipal } = await getContractInstanceStorage(vault) if (DepositAsset && TotalPrincipal) api.add(DepositAsset, TotalPrincipal.toString()) } + for (const vault of shareVaults) { + const { AssetAddress } = await getContractInstanceStorage(vault) + const totalAssets = await callSoroban(vault, 'total_assets') + api.add(AssetAddress, totalAssets.toString()) + } } module.exports = { From 1404922e8e950a25da2b62bbf456d9724294d395 Mon Sep 17 00:00:00 2001 From: 0xG00gly <94080626+0xG00gly@users.noreply.github.com> Date: Mon, 19 Oct 2026 16:56:57 +0200 Subject: [PATCH 334/988] Update plasma one (#21321) --- projects/plasma-one/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/projects/plasma-one/index.js b/projects/plasma-one/index.js index 0f07272834c..0f9732ee4c0 100644 --- a/projects/plasma-one/index.js +++ b/projects/plasma-one/index.js @@ -1,23 +1,28 @@ const { getAddress, getLogs2 } = require('../helper/cache/getLogs'); const ADDRESSES = require('../helper/coreAssets.json'); +const { staking } = require('../helper/staking'); const P1USD = "0x1cf1c71440ebd9cc998ce0b1b25ccef275c53d77"; const AAVE_PLASMA_USDT0 = "0x5D72a9d9A9510Cd8cBdBA12aC62593A58930a948"; const USDT0 = ADDRESSES.plasma.USDT0; +const WXPL = ADDRESSES.plasma.WXPL; const CHECKING_FACTORY = "0x42529Da25D82ba7810D7F51D614915B8c7e11aCC"; const ACCOUNT_CREATED_TOPIC = "0x9a758bc0bde621f0a72a82cdaa0f3652778d9ddb49d46f1ab3e150d3171a8732"; +const XPL_LOCK = "0xe035A6A5ABa726bD162E273a22fF85AE5f6E04C3"; // TVL = Earn Accounts TVL + Checking Accounts TVL // Earn Accounts TVL = Calculated by adding up the tokens inside the P1USD contract; // Checking Accounts TVL = Calculated by adding up the tokens inside all checking accounts; +// Staking = Calculated by adding up the WXPL locked by users (for one year) to unlock higher card tiers within Plasma One; async function tvl(api) { const logs = await getLogs2({ api, target: CHECKING_FACTORY, - topic: ACCOUNT_CREATED_TOPIC, + topics: [ACCOUNT_CREATED_TOPIC], fromBlock: 14534239, + extraKey: 'checking-accounts', }); const checkingContracts = logs.flatMap(log => [ @@ -27,9 +32,13 @@ async function tvl(api) { getAddress(log.topics[2]), ]); - await api.sumTokens({ tokens: [USDT0, AAVE_PLASMA_USDT0], owners: [P1USD, ...checkingContracts] }); + const owners = [P1USD, ...checkingContracts]; + await api.sumTokens({ tokensAndOwners: owners.flatMap(owner => [[USDT0, owner], [AAVE_PLASMA_USDT0, owner]]) }); } module.exports = { - plasma: { tvl }, + plasma: { + tvl, + staking: staking(XPL_LOCK, WXPL), + }, }; From 68d481ae37693e3cea6d56c7ee2aab0ec4f5f15e Mon Sep 17 00:00:00 2001 From: routebuilder Date: Mon, 19 Oct 2026 16:58:32 +0200 Subject: [PATCH 335/988] Add missing Binance WLD reserves to binance-cex (World Chain, ~40M) (#21720) --- projects/binance/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/binance/index.js b/projects/binance/index.js index 51a5ec6a766..fc44bdf0c2d 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -58,6 +58,7 @@ const binanceToDefillama = { KAIA: 'klaytn', SEIEVM: 'sei', XTZ: 'tezos', + WLD: 'wc', } const withdrawalAddresses = [ @@ -146,7 +147,7 @@ const tvl = async (api) => { .map(({ address }) => address) .filter(Boolean) - const evmChains = ['ethereum', 'bsc', 'celo', 'chz', 'polygon', 'arbitrum', 'optimism', 'avax', 'fantom', 'base', 'era', 'manta', 'ronin', 'op_bnb', 'scroll', 'sonic', 'plasma', 'klaytn','sei', 'kava'] + const evmChains = ['ethereum', 'bsc', 'celo', 'chz', 'polygon', 'arbitrum', 'optimism', 'avax', 'fantom', 'base', 'era', 'manta', 'ronin', 'op_bnb', 'scroll', 'sonic', 'plasma', 'klaytn','sei', 'kava', 'wc'] const isEvm = evmChains.includes(chain) const lockInfoAddresses = [] From 179060c8ade65bc5bbd8d74c4781e1632e241c69 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Mon, 19 Oct 2026 17:33:00 +0200 Subject: [PATCH 336/988] Bitstamp: track attested XRPL wallets (#21717) --- projects/bitstamp/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/bitstamp/index.js b/projects/bitstamp/index.js index ce443a5aff5..991459b2837 100644 --- a/projects/bitstamp/index.js +++ b/projects/bitstamp/index.js @@ -87,7 +87,12 @@ function getAllData() { walletChainMapping.avax = walletChainMapping['avalanche-c-chain'] walletChainMapping.xdc = walletChainMapping['xdc-network'] - walletChainMapping.ripple = config.ripple + walletChainMapping.ripple = { + owners: [...new Set([ + ...config.ripple.owners, + ...(walletChainMapping.xrpl?.owners ?? []).map(address => address.split('?')[0]), + ])], + } return walletChainMapping } }) From a29688643ecf5207b6403e125dc3d443006e8f57 Mon Sep 17 00:00:00 2001 From: daonarchy Date: Mon, 19 Oct 2026 22:35:54 +0700 Subject: [PATCH 337/988] benqi: add veQI staking TVL (#21697) Co-authored-by: daonarchy <219096321+daonarchy@users.noreply.github.com> --- projects/benqi/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/benqi/index.js b/projects/benqi/index.js index 65656996c35..7dbb4071ad6 100644 --- a/projects/benqi/index.js +++ b/projects/benqi/index.js @@ -1,9 +1,13 @@ const { compoundExports } = require('../helper/compound') const { pool2 } = require('../helper/pool2') +const { staking } = require('../helper/staking') const sdk = require('@defillama/sdk'); +const QI = "0x8729438EB15e2C8B576fCc6AeCdA6A148776C0F5" +const VEQI = "0x7Ee65Fdc1C534A6b4f9ea2Cc3ca9aC8d6c602aBd" + module.exports = { - methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", + methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets. Staking counts QI locked in the veQI contract.", avax: { tvl: sdk.util.sumChainTvls([ compoundExports("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "0x5C0401e81Bc07Ca70fAD469b451682c0d747Ef1c").tvl, @@ -13,6 +17,7 @@ module.exports = { compoundExports("0x486af39519b4dc9a7fccd318217352830e8ad9b4", '0x5C0401e81Bc07Ca70fAD469b451682c0d747Ef1c').borrowed, compoundExports("0xD7c4006d33DA2A0A8525791ed212bbCD7Aca763F").borrowed, ]), + staking: staking(VEQI, QI), pool2: pool2("0x784da19e61cf348a8c54547531795ecfee2affd1", "0xe530dc2095ef5653205cf5ea79f8979a7028065c") } -} \ No newline at end of file +} From ab11ebe457b7f3b029e3588206328311964a3d58 Mon Sep 17 00:00:00 2001 From: Erhnysr Date: Mon, 19 Oct 2026 18:42:57 +0300 Subject: [PATCH 338/988] curators: track the remaining Arc vaults of Galaxy, Bitwise and Gauntlet (#21696) --- projects/gauntlet/index.js | 5 +++++ registries/curators.js | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/projects/gauntlet/index.js b/projects/gauntlet/index.js index 13e53a7d1ae..8c429bf6500 100644 --- a/projects/gauntlet/index.js +++ b/projects/gauntlet/index.js @@ -163,6 +163,11 @@ const configs = { '0x9131eb40bd0bdce73c72755f1bb2cf39a9453341', // Gauntlet USDC Morpho vault ], }, + arc: { + morpho: [ + '0xdECcd53BE5453215821184824B519E04C7e00bC7', // Gauntlet USDC Prime (Morpho V2) + ], + }, } } diff --git a/registries/curators.js b/registries/curators.js index 878418cc889..dbea3a8de15 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -79,6 +79,11 @@ const configs = { '0x510F3b6621D9eA392d4F7632d02aBCf8ba92Bd6F', ], }, + arc: { + morpho: [ + '0x7610094B846657dCF166D59e42973db52c7015F9', // Bitwise Premium RWA USDC (Morpho V2); curator "Bitwise" per api.morpho.org + ], + }, } }, }, @@ -674,6 +679,7 @@ const configs = { arc: { morpho: [ '0x8E357432CC12ff425c36432F312968aEb16112AF', // Galaxy USDC, $89.7M 2026-10-13; curator "Galaxy Curation" per Morpho UI; 100% one MarketV1 market + '0x389abDf4355e0cF4f19298179991705a98f21c18', // Galaxy EURC (Morpho V2); curator "Galaxy Curation" per api.morpho.org ], }, }, From 47b75603c532b55bb89b67c29e6416837f21d5c8 Mon Sep 17 00:00:00 2001 From: MonetrixLab Date: Tue, 20 Oct 2026 00:03:30 +0800 Subject: [PATCH 339/988] Add Monetrix mxBTC TVL adapter (#21649) Co-authored-by: MonetrixLab <264903830+MonetrixLab@users.noreply.github.com> Co-authored-by: FelixBruguera --- projects/monetrix-mxbtc/index.js | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 projects/monetrix-mxbtc/index.js diff --git a/projects/monetrix-mxbtc/index.js b/projects/monetrix-mxbtc/index.js new file mode 100644 index 00000000000..71c3ec7344a --- /dev/null +++ b/projects/monetrix-mxbtc/index.js @@ -0,0 +1,38 @@ +// https://hyperevmscan.io/address/0x929f664f6662Aa18c64E52ecf3e16c6649049d55 +const BTC_ACCOUNTANT = '0x929f664f6662Aa18c64E52ecf3e16c6649049d55' +const UBTC = '0x9FDBdA0A5e284c32744D2f17Ee5c74B284993463' + +// First deposit into the current deployment: 2026-10-13 11:55:17 UTC. +// https://hyperevmscan.io/tx/0x5b7f1715ad0a90bfdcdb8b3e8039bb798c773414e765f8c49d5ea20b41fea8ba +const START_TIMESTAMP = 1791892517 + +async function tvl(api) { + if (api.timestamp && api.timestamp < START_TIMESTAMP) return + + // BtcAccountant returns net backing in EVM UBTC units (8 decimals), + // including HyperCore collateral and subtracting borrow liabilities. + const backing = await api.call({ + target: BTC_ACCOUNTANT, + abi: 'function totalBackingSigned() view returns (int256)', + }) + if (BigInt(backing) > 0n) api.add(UBTC, backing) +} + +module.exports = { + // HyperCore read precompiles do not provide reliable historical state. + // https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/json-rpc + timetravel: false, + // The accountant expresses the entire net equity, including the HYPE/USDC + // strategy overlay, in UBTC; use the existing UBTC price for that value. + misrepresentedTokens: true, + methodology: + 'TVL is the net collateral backing mxBTC, read on-chain from BtcAccountant.totalBackingSigned ' + + 'in 8-decimal UBTC units: UBTC in the BtcVault and RedeemEscrow on HyperEVM plus the ' + + 'Vault\'s HyperCore spot, supplied collateral and perpetual account equity, net of borrow liabilities. ' + + 'The accountant converts non-BTC equity to UBTC using HyperCore prices. ' + + 'smxBTC receipt tokens, the protocol-owned insurance fund, instant-exit buffers and undistributed ' + + 'yield in YieldEscrow are excluded. Only the current deployment is tracked; USDM and mxHYPE ' + + 'are separate Monetrix products.', + start: "2026-10-13", + hyperliquid: { tvl }, +} From 1e114542435423e22e1cd2371eb2d707b7e6db3f Mon Sep 17 00:00:00 2001 From: Nicorehov <141735610+Nicorehov@users.noreply.github.com> Date: Mon, 19 Oct 2026 21:03:13 +0200 Subject: [PATCH 340/988] Add Seeryx (Solana prediction market) TVL adapter (#21671) Co-authored-by: FelixBruguera --- projects/seeryx/index.js | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/seeryx/index.js diff --git a/projects/seeryx/index.js b/projects/seeryx/index.js new file mode 100644 index 00000000000..498158282f6 --- /dev/null +++ b/projects/seeryx/index.js @@ -0,0 +1,42 @@ +// Seeryx TVL adapter for DefiLlama (projects/seeryx/index.js). +// +// Seeryx is a prediction market on Solana: Up/Down crypto rounds and event markets resolved by UMA. Users' USDC +// never sit in a shared pool: every user has a proxy (the associated token account of their UserAccount PDA), every +// market keeps its collateral in an escrow (the ATA of the Market PDA). Kept fees (the ATA of the Fees PDA) are +// protocol revenue and are not counted. TVL = the USDC held by the user and market accounts. Both account kinds are enumerated from the program by their +// Anchor discriminators, so a new user or market is counted without any change here. +const { PublicKey } = require("@solana/web3.js"); +const { getConnection, sumTokens2, getAssociatedTokenAddress } = require("../helper/solana"); + +const PROGRAM_ID = "2uUbvYHqBH1HDVzABGPcqrjHodoBVcNkq6Nrv6MABaiv"; +const USDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; + +// Anchor account discriminators, sha256("account:")[0..8] +const DISCRIMINATORS = [ + Buffer.from([211, 33, 136, 16, 186, 110, 242, 127]), // UserAccount + Buffer.from([219, 190, 213, 55, 0, 227, 198, 154]), // Market +]; + +// One getProgramAccounts call (the public RPC rate-limits that method hard), reading only the first 8 bytes of +// every account of the program, then keeping the user and market accounts. +async function owners() { + const connection = getConnection(); + const accounts = await connection.getProgramAccounts(new PublicKey(PROGRAM_ID), { dataSlice: { offset: 0, length: 8 } }); + return accounts + .filter((a) => DISCRIMINATORS.some((d) => d.equals(a.account.data.subarray(0, 8)))) + .map((a) => a.pubkey.toBase58()); +} + +// Every one of those accounts keeps its USDC in its associated token account, so the token accounts are derived here +// and read in one batch (no getTokenAccountsByOwner per owner). +async function tvl(api) { + const tokenAccounts = (await owners()).map((o) => String(getAssociatedTokenAddress(USDC, o))); + return sumTokens2({ api, tokenAccounts, allowError: true }); +} + +module.exports = { + timetravel: false, + methodology: + "USDC held by the Seeryx program's accounts on Solana: every user's proxy (the token account of their UserAccount PDA), and every market's collateral escrow (the token account of the Market PDA). Protocol fees held by the Fees account are excluded. The accounts are enumerated from the program by their Anchor discriminators and their USDC balances summed; nothing is read from Seeryx's own API.", + solana: { tvl }, +}; From 5b4456b1234b56c7180c0a1af94079c86e9fdfcf Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 19 Oct 2026 21:11:24 +0200 Subject: [PATCH 341/988] fix broken --- projects/citrus/index.js | 3 +- projects/super-dca/index.js | 148 ++++++++-------------------------- projects/treasury/balancer.js | 2 +- registries/treasury.js | 2 +- 4 files changed, 39 insertions(+), 116 deletions(-) diff --git a/projects/citrus/index.js b/projects/citrus/index.js index 70276638b22..44d620ad211 100644 --- a/projects/citrus/index.js +++ b/projects/citrus/index.js @@ -166,8 +166,9 @@ const idl = { } }, { + // was a bool; newer offers store 2 here (pool kind), which the bool decoder rejects "name": "pool", - "type": "bool" + "type": "u8" } ] } diff --git a/projects/super-dca/index.js b/projects/super-dca/index.js index 488d57d7482..1aa7c7ba043 100644 --- a/projects/super-dca/index.js +++ b/projects/super-dca/index.js @@ -1,146 +1,68 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2 } = require('../helper/unwrapLPs') -const { request, gql } = require('graphql-request') -const sdk = require('@defillama/sdk') +const { getHookPools, addUniV4PoolReserves, chainConfig } = require('../helper/uniswapV4') -// Chain-specific configuration +// Pools are Uniswap v4 pools running a Super DCA hook; they are found from the PoolManager Initialize +// logs and valued from the tick data via StateView, so no subgraph is involved (the Super DCA subgraphs +// stall with indexing errors). Every pool pairs a listed asset with the DCA token: only the listed side +// is counted, the DCA side is dropped. const CONFIG = { optimism: { - STATE_VIEW: '0xc18a3169788f4f75a170290584eca6395c75ecdb', - POSM: '0x3C3Ea4B57a46241e54610e5f022E5c45859A1017', - FROM_BLOCK: 130947675, - SUBGRAPH_ID: '6RBtsmGUYfeLeZsYyxyKSUiaA6WpuC69shMEQ1Cfuj9u', + HOOKS: [ + '0xb4f4Ad63BCc0102B10e6227236e569Dce0d97A80', + '0x7098Bf7DFF80532aa6bbDB52DF4Ac4992Bec3A80', + ], WHITELISTED_TOKENS: [ ADDRESSES.optimism.USDC_CIRCLE, // USDC - ADDRESSES.null, // WETH + ADDRESSES.null, // ETH ADDRESSES.optimism.WBTC, // WBTC ADDRESSES.optimism.OP // OP ], - POOL_IDS: [ - // List of pools with the Super DCA Hook: 0xb4f4Ad63BCc0102B10e6227236e569Dce0d97A80 - '0x13b95815697f696c74bd1e7959d692d74476ec851b32be72e027cda8e9d05e35', // USDC-DCA - '0x7e9d1e1966665cfdaadcdef03caaf3099e18447bd45b3af8b04a9844e3882863', // ETH-DCA - '0x46224636f9ee95d76f57ec559b0099db863747ca5ac11e4db5b178b6ae269404', // WBTC-DCA - // List of pools with the Super DCA Hook: 0x7098Bf7DFF80532aa6bbDB52DF4Ac4992Bec3A80 - '0xfaf4de6b4f92e8c44735d8224ceb89f54b7e6d9137ad7fac238057f09db75964', // USDC-DCA - '0x8b3156a785bcf477d92f2f2a9d7827585d9d551525abb512b0769fbec34e9d22', // ETH-DCA - '0x4dca8e9159ff294dd7a384ce446721719b491d5075b3bee9c57f6899043562c9', // WBTC-DCA - '0xd6821af358d804a37fd82b956d80b2fcf74e6463069e7d8b2ffe86138087da36' // OP-DCA - ] }, base: { - STATE_VIEW: '0xA3c0c9b65baD0b08107Aa264b0f3dB444b867A71', - POSM: '0x7C5f5A4bBd8fD63184577525326123B519429bDc', - FROM_BLOCK: 30838244, - SUBGRAPH_ID: 'HNCFA9TyBqpo5qpe6QreQABAA1kV8g46mhkCcicu6v2R', + HOOKS: [ + '0xBc5F29A583a8d3ec76e03372659e01a22feE3A80', + ], WHITELISTED_TOKENS: [ ADDRESSES.base.USDC, // USDC - ADDRESSES.null, // WETH + ADDRESSES.null, // ETH ADDRESSES.bsc.WBTC, // WBTC '0x63706e401c06ac8513145b7687A14804d17f814b' // AAVE ], - POOL_IDS: [ - // List of pools with the Super DCA Hook: 0xBc5F29A583a8d3ec76e03372659e01a22feE3A80 - '0x9f0b3075f99fd5270b45f1742f71fe08a33737d053e3aaa1eb4e19b1b94d516e', // ETH-DCA - '0x870198ffb454503d5ce1b698c94bc98198c874d61e8a2994dd6e01ee04535f89', // USDC-DCA - '0xca8fb98187ca61e9c2360a93d41cffa5ecd5b5911b3e705f6fbcdc08b42fe0db', // WBTC-DCA - '0xc0ea512d5a20a822fcce987c10428d5b81d349bce55404456cbc6729eb0c3c6c' // AAVE-DCA - ] }, unichain: { - STATE_VIEW: '0x86e8631A016F9068C3f085fAF484Ee3F5fDee8f2', - POSM: '0x4529A01c7A0410167c5740C487A8DE60232617bf', - FROM_BLOCK: 32476763, - SUBGRAPH_ID: 'aa3YpPCxatg4LaBbLFuv2iBC8Jvs9u3hwt5GTpS4Kit', + HOOKS: [ + '0x8E89b081498095669007DA306dCd7Ce7cab43A80', + ], WHITELISTED_TOKENS: [ ADDRESSES.unichain.USDC, // USDC - ADDRESSES.null, // WETH + ADDRESSES.null, // ETH ADDRESSES.bsc.WBTC, // Layer Zero Wrapped Bitcoin (WBTC) ], - POOL_IDS: [ - // List of pools with the Super DCA Hook: 0x8E89b081498095669007DA306dCd7Ce7cab43A80 - '0xb48839b7f65765f3c482c5a44b5280786f03b39cf09696929dfb086184279618', // WBTC-DCA - '0x341b812b1e570a3143c3d10d09aa9fa87b9b2482a647f0e0f406dc22e3c74d25', // ETH-DCA - '0xfb28d77950a83643efdcae4e0d952d7d1f8f66c92253cc63d914531038ddbb3f' // USDC-DCA - ] - } -} - -const POSITIONS_QUERY = gql` - query getPositions($poolId: String!) { - transactions( - where: { - modifyLiquiditys_: { pool: $poolId } - transfers_: { tokenId_gte: "0" } - } - orderBy: timestamp - orderDirection: asc - first: 1000 - ) { - transfers(where: { tokenId_gte: "0" }) { - tokenId - } - } } -` - -// Get all position IDs for a specific poolId using subgraph -async function getAllPositionIdsForPool(api, poolId, config) { - const subgraphEndpoint = sdk.graph.modifyEndpoint(config.SUBGRAPH_ID) - const result = await request(subgraphEndpoint, POSITIONS_QUERY, { poolId }) - - // Extract unique token IDs - const tokenIdSet = new Set() - result.transactions.forEach(tx => { - tx.transfers.forEach(transfer => { - tokenIdSet.add(transfer.tokenId) - }) - }) - - const uniqueTokenIds = Array.from(tokenIdSet) - api.log(`Found ${uniqueTokenIds.length} unique position IDs for pool ${poolId}`) - return uniqueTokenIds } -function createTvlFunction(chain) { - return async (api) => { - const config = CONFIG[chain] - if (!config) throw new Error(`Config not found for chain: ${chain}`) - - // api.log(`Using ${config.POOL_IDS.length} hardcoded pool IDs for ${chain}`) +async function tvl(api) { + const { HOOKS, WHITELISTED_TOKENS } = CONFIG[api.chain] + const { poolManager, fromBlock, stateView } = chainConfig[api.chain] - // Get all position IDs for all our pools - const allPositionIds = [] - for (const poolId of config.POOL_IDS) { - const positionIds = await getAllPositionIdsForPool(api, poolId, config) - // api.log(`Pool ${poolId}: ${positionIds.length} positions`) - allPositionIds.push(...positionIds) - } + const pools = [] + for (const hook of HOOKS) + pools.push(...await getHookPools({ api, hook, poolManager, fromBlock })) + api.log(`${api.chain}: ${pools.length} Super DCA pools`) - // api.log(`Total positions found: ${allPositionIds.length}`) + await addUniV4PoolReserves({ api, pools, stateView }) - // Use the correct Uniswap v4 position resolver - return sumTokens2({ - api, - resolveUniV4: true, - uniV4ExtraConfig: { - whitelistedTokens: config.WHITELISTED_TOKENS, // Only count non-DCA tokens - positionIds: allPositionIds, - }, - }) - } + // drop the DCA side of every pool + const whitelist = new Set(WHITELISTED_TOKENS.map(i => i.toLowerCase())) + const poolTokens = new Set(pools.flatMap(p => [p.token0, p.token1]).map(i => i.toLowerCase())) + for (const token of poolTokens) + if (!whitelist.has(token)) api.removeTokenBalance(token) } module.exports = { doublecounted: true, methodology: "The TVL is calculated by summing the value of tokens in Uniswap V4 liquidity pools that have the Super DCA Hook associated with them. The value represents the value of all non-DCA tokens (e.g., ETH, USDC, WBTC, AAVE, etc.) in these pools.", - optimism: { - tvl: createTvlFunction('optimism'), - }, - base: { - tvl: createTvlFunction('base'), - }, - unichain: { - tvl: createTvlFunction('unichain'), - } -}; \ No newline at end of file + optimism: { tvl }, + base: { tvl }, + unichain: { tvl }, +}; diff --git a/projects/treasury/balancer.js b/projects/treasury/balancer.js index 1d9601f342c..6a6dd208d04 100644 --- a/projects/treasury/balancer.js +++ b/projects/treasury/balancer.js @@ -149,4 +149,4 @@ module.exports = treasuryExports({ } }); -module.exports.ethereum.tvl = async (api)=>karpatKeyTvl(api, "Balancer DAO", "BAL") \ No newline at end of file +// module.exports.ethereum.tvl = async (api)=>karpatKeyTvl(api, "Balancer DAO", "BAL") \ No newline at end of file diff --git a/registries/treasury.js b/registries/treasury.js index 0093a7915a8..7f56d856d9f 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -1322,7 +1322,7 @@ const configs = { zora: { owners: ['0x21AD6EF3979638D8E73747F22B92c4AAdE145d82'] }, metis: { owners: ['0x21AD6EF3979638D8E73747F22B92c4AAdE145d82'] }, celo: { owners: ['0x21AD6EF3979638D8E73747F22B92c4AAdE145d82'] }, - conflux: { owners: ['0x21AD6EF3979638D8E73747F22B92c4AAdE145d82'] }, + // conflux: { owners: ['0x21AD6EF3979638D8E73747F22B92c4AAdE145d82'] }, ronin: { owners: ['0x21AD6EF3979638D8E73747F22B92c4AAdE145d82'] }, lisk: { owners: ['0x21AD6EF3979638D8E73747F22B92c4AAdE145d82'] }, berachain: { owners: ['0x21AD6EF3979638D8E73747F22B92c4AAdE145d82'] }, From 9468c737503c9f92318c5fd8fc9107f9ab853f6d Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 19 Oct 2026 15:27:54 -0400 Subject: [PATCH 342/988] blacklist tokens in uniswap v4 arc (#21732) --- projects/uniswap-v4/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/uniswap-v4/index.js b/projects/uniswap-v4/index.js index 4e2f82d2260..38606be9b28 100644 --- a/projects/uniswap-v4/index.js +++ b/projects/uniswap-v4/index.js @@ -44,7 +44,16 @@ const config = { tempo: { factory: "0x33620f62c5b9b2086dd6b62f4a297a9f30347029", fromBlock: 6475880, useIndexerSql: true }, megaeth: { factory: "0xacb7e78fa05d562e0a5d3089ec896d57d057d38e", fromBlock: 7009653, useIndexerSql: true }, robinhood: { factory: "0x8366a39CC670B4001A1121B8F6A443A643e40951", fromBlock: 9070, useIndexerSql: true, skipHookBalances: true }, - arc: { factory: "0x8366a39cc670b4001a1121b8f6a443a643e40951", fromBlock: 1946500, useIndexerSql: true, skipHookBalances: true }, + arc: { + factory: "0x8366a39cc670b4001a1121b8f6a443a643e40951", + fromBlock: 1946500, + useIndexerSql: true, + skipHookBalances: true, + blacklistedTokens: [ + '0x9696b5e894afe749b3d4683b230e549f39678932', // USDB mispriced + '0xd794ce63002c4ae9da4f373f1ecb856187b7a375', // ATC only priced against USDB (1 ATC = 3909 USDB), unpriced today + ] + }, } const subgraphs = { // the xlayer subgraph has no price for xStocks, so their pools read $0 TVL there and the $100 filter drops them From 9bec0910367138ec01c6e8bfc857122a7d953f4b Mon Sep 17 00:00:00 2001 From: Richard | RUKUS Date: Mon, 19 Oct 2026 21:52:15 +0200 Subject: [PATCH 343/988] =?UTF-8?q?Add=20RUKUS=20=E2=80=94=20Robinhood=20C?= =?UTF-8?q?hain=20TVL=20adapter=20(#21674)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: FelixBruguera --- projects/rukus/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/rukus/index.js diff --git a/projects/rukus/index.js b/projects/rukus/index.js new file mode 100644 index 00000000000..4b95bf372e7 --- /dev/null +++ b/projects/rukus/index.js @@ -0,0 +1,19 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const INSTANT_FACTORY = '0x3019844dADA9A3764173cB6BaC6093ca6BF6D433' +const BACKED_FACTORY = '0x1B293936BCf87e77F2310303101F14E72EbA2b09' +const LAUNCH = 'event LaunchCreated(address indexed creator,address indexed token,address indexed market,uint16 creatorFeeBps,uint16 protocolFeeBps,uint256 creationFeePaid,uint256 foundingLaunchNumber,bool official,bytes32 metadataHash)' +const CAMPAIGN = 'event LiquidityProposalCreated(address indexed creator,address indexed escrow,bytes32 configHash,uint256 target,uint256 deadline,uint256 backerTokens,uint256 liquidityTokens,uint16 creatorFeeBps)' + +async function tvl(api) { + const launches = await getLogs2({ api, target: INSTANT_FACTORY, fromBlock: 89225477, eventAbi: LAUNCH, extraKey: 'rukus-instant-created' }) + const campaigns = await getLogs2({ api, target: BACKED_FACTORY, fromBlock: 89237576, eventAbi: CAMPAIGN, extraKey: 'rukus-backed-created' }) + const owners = [...launches.map(log => log.market), ...campaigns.map(log => log.escrow)] + return sumTokens2({ api, owners, tokens: [nullAddress] }) +} + +module.exports = { + methodology: 'Counts the ETH held by RUKUS Instant bonding curves and Backed campaign escrows, discovered from the two factories\' creation events. Launched tokens and liquidity moved to Uniswap V4 after graduation or settlement are not counted.', + robinhood: { tvl }, +} From c117aa98e28593599941acccee2b7bd853eefb06 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Mon, 19 Oct 2026 22:07:23 +0200 Subject: [PATCH 344/988] impermax: remove dead positions api endpoints (#21678) --- projects/impermax-v3/index.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/projects/impermax-v3/index.js b/projects/impermax-v3/index.js index 6575a89e24a..fd60b54925f 100644 --- a/projects/impermax-v3/index.js +++ b/projects/impermax-v3/index.js @@ -8,8 +8,7 @@ const config = { arbitrum: { factories: [ '0x4FF3262Ba2983Ee8950d9d082f03277a58BF7eb1' - ], - positionsApi: ['https://arbitrum-nftlp-uniswapv3.up.railway.app/positions'] // UniswapV3 + ] }, base: { factories: [ @@ -18,16 +17,13 @@ const config = { ], positionsApi: [ 'https://base-nftlp-uniswapv3.up.railway.app/positions', // UniswapV3 - 'https://base-nftlp-aerov3.up.railway.app/positions' // Aerodrome ] }, unichain: { factories: ['0x50E7116c4a9624a2d562Ee0Ab5209F3834C15E14'], - positionsApi: ['https://unichain-nftlp-uniswapv3.up.railway.app/positions'] }, hyperliquid: { factories: ['0x171d48161223a3ddb4659e093291f8f32f4e95ef'], - positionsApi: ['https://hyperevm-nftlp-hyperswapv3.up.railway.app/positions'] // Hyperswap } }; From f21f73af0433cb93515621767f18e214921e8778 Mon Sep 17 00:00:00 2001 From: OxForged Date: Mon, 19 Oct 2026 13:29:21 -0700 Subject: [PATCH 345/988] Peddles: fix TVL by reading the hook's PoolRegistered events (#21679) Co-authored-by: OxForged --- projects/peddles/index.js | 57 +++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/projects/peddles/index.js b/projects/peddles/index.js index 182ee594b1d..bb2ed69f531 100644 --- a/projects/peddles/index.js +++ b/projects/peddles/index.js @@ -1,28 +1,51 @@ -const { uniV4HookOnChainExport, uniV4HookExport } = require('../helper/uniswapV4') +const { getLogs2 } = require('../helper/cache/getLogs') +const { addUniV4PoolReserves, chainConfig } = require('../helper/uniswapV4') -// Peddles (https://peddles.xyz): every launch is one Uniswap v4 pool carrying PeddlesFeeHook, with the -// launch liquidity locked in it. Pools are found from the PoolManager Initialize logs filtered to the hook -// and valued on chain from tick liquidity via StateView. -// Each chain has its own hook (CREATE2 against per-chain constructor arguments), so nothing is shared. +// Peddles (https://peddles.xyz): every launch is one Uniswap v4 pool carrying the chain's Peddles fee hook, with the +// launch liquidity locked in it. +// +// Pools are found from the hook's own PoolRegistered events, not by scanning every Initialize log the shared +// Uniswap v4 PoolManager has ever emitted: on Robinhood that is hundreds of thousands of logs, and the hook +// address is not an indexed field of Initialize, so that scan cannot be narrowed and does not finish inside a run. +// PoolRegistered carries no tick spacing, so each pool's key is read from its Initialize log, looked up by the +// indexed pool id in the block the hook registered it (the launch initializes and registers in one transaction). +// Reserves are then rebuilt on chain from tick liquidity via StateView. const hooks = { - robinhood: '0xfe055282E3cD471A8b2cd922d31E75ECd3bBc0CC', - bsc: '0x39D760601731025e0F02A3e5D232445797fAC0CC', - arc: '0x317e34De0298F23bd41bf9A853289e227E9cC0CC', + base: { hook: '0xAB8E39207718f519865D6f0d52eFB31b231D40cc', fromBlock: 51855962 }, + robinhood: { hook: '0xfe055282E3cD471A8b2cd922d31E75ECd3bBc0CC', fromBlock: 76092920 }, + bsc: { hook: '0x39D760601731025e0F02A3e5D232445797fAC0CC', fromBlock: 125076797 }, + arc: { hook: '0x317e34De0298F23bd41bf9A853289e227E9cC0CC', fromBlock: 23687888 }, } -const subgraphHooks = { - base: '0xAB8E39207718f519865D6f0d52eFB31b231D40cc', + +const poolRegisteredAbi = 'event PoolRegistered(bytes32 indexed poolId, address indexed token, address indexed quote, address creator, uint16 creatorTaxBps, uint16 excessToCreatorBps, address rewards)' +const initializeAbi = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks, uint160 sqrtPriceX96, int24 tick)' +const INITIALIZE_TOPIC = '0xdd466e674ea557f56295e2d0218a125ea4b4f0f6f3307b95f85e6110838d6438' + +async function peddlesPools(api, { hook, fromBlock }) { + const { poolManager } = chainConfig[api.chain] + const registered = await getLogs2({ api, target: hook, eventAbi: poolRegisteredAbi, fromBlock, onlyArgs: false }) + const pools = [] + for (const log of registered) { + const id = log.args.poolId + const block = Number(log.blockNumber) + const [init] = await getLogs2({ api, target: poolManager, eventAbi: initializeAbi, topics: [INITIALIZE_TOPIC, id], fromBlock: block, toBlock: block + 1, skipCache: true }) + if (!init || init.hooks.toLowerCase() !== hook.toLowerCase()) continue + pools.push({ id, token0: init.currency0, token1: init.currency1, spacing: Number(init.tickSpacing) }) + } + return pools } module.exports = { doublecounted: true, // the pools live in the Uniswap v4 PoolManager, so Uniswap v4 TVL counts them too - methodology: 'Counts the liquidity in every Uniswap v4 pool created by a Peddles launch, i.e. every pool that runs the Peddles fee hook. Pools are found from the PoolManager Initialize logs and their reserves are rebuilt on chain from tick liquidity and the current price. Launch liquidity is locked in these pools. Fees the hook has accrued but not yet paid out are not counted.', + methodology: 'Counts the liquidity in every Uniswap v4 pool created by a Peddles launch. Pools are read from the Peddles fee hook\'s PoolRegistered events, each pool\'s key from its Initialize log, and reserves are rebuilt on chain from tick liquidity and the current price via StateView. Launch liquidity is locked in these pools. Fees the hook has accrued but not yet paid out are not counted.', start: '2026-09-27', } -Object.keys(hooks).forEach((chain) => { - module.exports[chain] = { tvl: uniV4HookOnChainExport({ hook: hooks[chain] }) } -}) - -Object.keys(subgraphHooks).forEach((chain) => { - module.exports[chain] = { tvl: uniV4HookExport({ hook: subgraphHooks[chain] }) } +Object.entries(hooks).forEach(([chain, config]) => { + module.exports[chain] = { + tvl: async (api) => { + const pools = await peddlesPools(api, config) + await addUniV4PoolReserves({ api, pools, stateView: chainConfig[chain].stateView }) + }, + } }) From 1e7c5b3c4ea00d3fa1b6e4f5a74fcf6aa449a544 Mon Sep 17 00:00:00 2001 From: Permapod Date: Tue, 20 Oct 2026 01:34:41 +0500 Subject: [PATCH 346/988] Permapod TVL Require Updates (#21307) Co-authored-by: saadaltaflaldins Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/perma-pod/index.js | 46 ++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/projects/perma-pod/index.js b/projects/perma-pod/index.js index 498de2d6b70..3f6c1117e2a 100644 --- a/projects/perma-pod/index.js +++ b/projects/perma-pod/index.js @@ -1,9 +1,15 @@ -const { queryContract } = require('../helper/chain/cosmos'); -const BigNumber = require('bignumber.js'); +const { queryContract, sumTokens } = require('../helper/chain/cosmos'); +const { transformBalances } = require('../helper/portedTokens'); +// Perma Pod v2 (relaunched 2026-09-28). The v1 red bank (zig1s3frrz…) was emptied by the +// migration and replaced; the pod2 red bank (zig1smfzaz…) never held user funds. const redBanks = [ - // 'zig1s3frrzltqaxvuzffvxg89uuad6nkcyqe3ucvrahynznaek3mhe4s75puyu', // Main market - migrated to a residual-sweeper after the hack, bank balance is empty - 'zig1smfzazs6eg86vz23p8t7dk3gr4nnwr5m40yae9cl2m7erx3rnm2sxecuyc', // BTC market + 'zig1qghek6p63r56j0dd5asxvc5fmu370l6yfql5spc2khsfzn0ennjqtwz3xz', // v2 red bank +]; + +// Idle (not lent) deposits inside credit accounts are held by the credit manager, not the red bank. +const creditManagers = [ + 'zig1dyp45f79ykkzk6vdafeq36dwfertzt67r5td4ys2j8uy9mpkzjgsrm8yr8', // v2 credit manager ]; async function getMarkets(chain, redBank) { @@ -15,7 +21,7 @@ async function getMarkets(chain, redBank) { const markets = await queryContract({ contract: redBank, chain, - data: { 'markets_v2': { 'limit': pageLimit, 'start_after': startAfter } }, + data: { markets_v2: { limit: pageLimit, start_after: startAfter } }, }); const marketsData = markets.data || markets; @@ -29,32 +35,36 @@ async function getMarkets(chain, redBank) { } async function getAllMarkets(chain) { - const results = await Promise.all(redBanks.map((rb) => getMarkets(chain, rb))); - return results.flat(); + const markets = []; + for (const redBank of redBanks) markets.push(...await getMarkets(chain, redBank)); + return markets; } async function tvl(api) { - const markets = await getAllMarkets(api.chain); - - markets.forEach(market => { - const netAmount = BigNumber(market.collateral_total_amount).minus(market.debt_total_amount); - api.add(market.denom, netAmount.toString()); - }); + // Only listed assets count: the credit manager accepts deposits of any denom. + const tokens = (await getAllMarkets(api.chain)).map((market) => market.denom); + return sumTokens({ api, owners: [...redBanks, ...creditManagers], tokens }); } async function borrowed(api) { const markets = await getAllMarkets(api.chain); - - markets.forEach(market => { - api.add(market.denom, market.debt_total_amount); - }); + markets.forEach((market) => api.add(market.denom, market.debt_total_amount)); + // maps azig to its price source (helper/tokenMapping.js) + return transformBalances(api.chain, api.getBalances()); } module.exports = { timetravel: false, - methodology: "Sum token balances by querying the total deposit amount for each asset across the Main and Solv red banks.", + methodology: + 'TVL is the tokens held by the protocol: each red bank market\'s supplied amount minus its borrowed amount, plus idle deposits held by the credit manager. Borrowed is the total debt across red bank markets.', zigchain: { tvl, borrowed, }, + hallmarks: [ + ['2025-11-16', 'Launch on ZigChain'], + ['2026-08-29', 'Exploit via mock LP-incentives contract; protocol paused'], + ['2026-09-28', 'Relaunch on v2 contracts; positions migrated'], + ['2026-10-01', 'v2 markets reopened'], + ], }; From 4ac1b7c488f4c8266f0d3a9b2be17bc4ebf79bb8 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 20 Oct 2026 09:07:14 +0100 Subject: [PATCH 347/988] remove (#21734) --- projects/mezo-swap/index.js | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 projects/mezo-swap/index.js diff --git a/projects/mezo-swap/index.js b/projects/mezo-swap/index.js deleted file mode 100644 index 65361cccfed..00000000000 --- a/projects/mezo-swap/index.js +++ /dev/null @@ -1,25 +0,0 @@ -const { sumTokens2 } = require('../helper/unwrapLPs') - -const FACTORIES = [ - '0x83FE469C636C4081b87bA5b3Ae9991c6Ed104248', // basic pools (volatile + stable) - '0xBB24AF5c6fB88F1d191FA76055e30BF881BeEb79', // concentrated liquidity pools -] - -async function tvl(api) { - for (const factory of FACTORIES) { - const pools = await api.fetchList({ - target: factory, - lengthAbi: 'uint256:allPoolsLength', - itemAbi: 'function allPools(uint256) view returns (address)', - }) - const token0s = await api.multiCall({ abi: 'address:token0', calls: pools }) - const token1s = await api.multiCall({ abi: 'address:token1', calls: pools }) - const tokensAndOwners = pools.flatMap((pool, i) => [[token0s[i], pool], [token1s[i], pool]]) - await sumTokens2({ api, tokensAndOwners }) - } -} - -module.exports = { - methodology: 'Counts the underlying token balances held by every Mezo Swap pool, across both the basic pool factory and the concentrated-liquidity (Slipstream) factory.', - mezo: { tvl }, -} From f800787f595702d9e93721813107d7c147e60aaa Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 20 Oct 2026 12:07:09 +0200 Subject: [PATCH 348/988] track aero-v2 --- projects/aero-lite/index.js | 6 ++++++ projects/aero-v2/index.js | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 projects/aero-v2/index.js diff --git a/projects/aero-lite/index.js b/projects/aero-lite/index.js index eface4381e2..d595d963243 100644 --- a/projects/aero-lite/index.js +++ b/projects/aero-lite/index.js @@ -12,6 +12,12 @@ const config = { '0xb89Df768aF2CFE637ceB352c587Fe8edAf491d03', // CL ], }, + base: {factories: ['0xC6bdE6e9F0CD71013E5FcF2dAAE2fA1c71Bb2F25']}, + optimism: {factories: ['0xf3384180f1F99Ff4448e836b7773e7B7A2D1fa3b']}, + arbitrum: {factories: ['0x2f1ea2c2dEf80FCa460c0dcF205C281a8116834b']}, + ethereum: {factories: ['0xAbD524b6f8dAae68314Ad2fD7698cb65b4f8D398']}, + ink: {factories: ['0xAbD524b6f8dAae68314Ad2fD7698cb65b4f8D398']}, + robinhood: {factories: ['0xAbD524b6f8dAae68314Ad2fD7698cb65b4f8D398']}, } const exportsList = [] diff --git a/projects/aero-v2/index.js b/projects/aero-v2/index.js new file mode 100644 index 00000000000..36a22e895f7 --- /dev/null +++ b/projects/aero-v2/index.js @@ -0,0 +1,19 @@ +const sdk = require('@defillama/sdk') +const { uniTvlExport } = require('../helper/unknownTokens.js') + +const abis = { + allPairsLength: 'uint256:allPoolsLength', + allPairs: 'function allPools(uint256) view returns (address)', +} +const stableTvl = uniTvlExport('chain', "0xaEd253F1aD84d99f2165256D701b2b481DD4CC16", { abis, hasStablePools: true, permitFailure: true, useDefaultCoreAssets: false, }).chain.tvl +const volatileTvl = uniTvlExport('chain', "0x9bc8b3F60D349d687Fb44A018967025E3741F9a5", { abis, permitFailure: true, }).chain.tvl + +const chains = ['optimism', 'base', 'arc', 'arbitrum', 'ethereum', 'ink', 'robinhood'] + +module.exports = { + misrepresentedTokens: true, +} + +chains.forEach(chain => { + module.exports[chain] = { tvl: sdk.util.sumChainTvls([stableTvl, volatileTvl]) } +}) From c6ad1462ea1a0a4e3bb17cabdfd20ad23a86cd60 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 20 Oct 2026 14:03:10 +0100 Subject: [PATCH 349/988] USDB (#21749) --- projects/uniswap-v4/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/uniswap-v4/index.js b/projects/uniswap-v4/index.js index 38606be9b28..dd30fc39b14 100644 --- a/projects/uniswap-v4/index.js +++ b/projects/uniswap-v4/index.js @@ -37,6 +37,7 @@ const config = { '0x7083609fce4d1d8dc0c979aab8c869ea2c873402', // DOT was hacked '0x44f161ae29361e332dea039dfa2f404e0bc5b5cc', // H hacked 2026-06-08 '0xac531eb26ca1d21b85126de8fb87e80e09002dcf', // fake SAND mispriced on BSC (~$5.6B phantom TVL) + '0xbe8d9ec5d3c9313e4af08d50b6f85af76a69a1f1', // USDB mispriced, same coingecko asset blacklisted on arc ] }, unichain: { factory: "0x1F98400000000000000000000000000000000004", fromBlock: 1, useIndexerSql: true }, From 772f4d623ce5b8d181a37de88c71937e90019159 Mon Sep 17 00:00:00 2001 From: BorroMarkets Date: Tue, 20 Oct 2026 09:58:48 -0400 Subject: [PATCH 350/988] Borro: add the AAPL, GOOGL and MSFT desks (#21681) Co-authored-by: Borro Markets Co-authored-by: Claude Opus 5.5 --- projects/borro/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/borro/index.js b/projects/borro/index.js index e16b361615e..04dab3851dd 100644 --- a/projects/borro/index.js +++ b/projects/borro/index.js @@ -8,7 +8,7 @@ const { nullAddress } = require("../helper/tokenMapping") // collateral, and shorters borrow the stock from it; // - a USDG market: USDG is the loan asset and the Borro stock vault's shares (bNVDA etc.) are the // collateral, so a lender can borrow USDG against the stock it has lent. -// Ten Morpho Vault V2s (one per stock plus a USDG vault) supply these markets through their adapters. +// Thirteen Morpho Vault V2s (one per stock plus a USDG vault) supply these markets through their adapters. // // The deployment is shared with other curators (Longbow and others), so the singleton's token // balances cannot be attributed by a token union; the markets are enumerated instead and each is @@ -43,6 +43,10 @@ const desks = { PLTR: ["0xFE9419E70e5481F7a2dDddc18f856b09b3687B27", "0x85571555a4d98cb7efaf91ffd5a9d6b2db33d4a631c6b16633e537ac6cb4b590", "0x405485f81cee0d066bd29d3556b17f5c50b01f542314d52ca93612f1d0a315ca"], SPCX: ["0x1261210E19052157fCe2064D9aa9A2140Bd89791", "0x4219a85fc09ae2ff5d3aa29013c67c89142f80a9c71d5c15ed7dbf9f6e14ae81", "0xb7da3d3030524ffc9438524054d4adf337904e228a842f8b35bf472ad16426e6"], GME: ["0x328461fB01F54C2Ab73909EA947c583d0dC24C3d", "0xde233c6decb5b2ad4a2fd63ef8c95ee9b1934c0bd849e87fb5604e845ceb2c82", "0x75d38c9976e6d899662a19a39ac679cfbf711edb6e8ea4762ad2746c480f894c"], + // added 2026-10-16 (deploy block 90133902) + AAPL: ["0x24Fe7bCAEB75bC2202A42ECD48a177a27782c64a", "0x5242d7dcb608526f2f76b3f6914b9adf34634cdf67220c54bfce0718540c4550", "0x4cb59d58f0752990c41de36de0fe47a28179f50e69eae0cc727011162614ddcc"], + GOOGL: ["0xf0731B1022ABD1e3f543Cfd837C7eBA42ED60E4f", "0x5826469e3b7df54fe18c921aafe850865552bc79b366a90ad0dc23c330ee0b75", "0x3abd7c179f694a9b3cf1008c97aa005ace5c6378e0298007154c563d3fd5b1a1"], + MSFT: ["0x8032C80a7817a3C4C401b096515B27b2CedA4e71", "0x00f685fcd58b2a04c6953ac74b5d6b8f288e45e9a393077acf6711d6c51957bf", "0x098b730c59fbac64a01db3d3e0751386c2a68ced08754170a74ffdb9c6d0ed57"], } const vaults = [USDG_VAULT, ...Object.values(desks).map((d) => d[0])] @@ -72,7 +76,8 @@ function borrowerCache({ cache, logs }) { async function collateralByMarket(api) { const toBlock = (await api.getBlock()) - 200 // the log cache is append-only, stay clear of reorgs at the tip - const pairs = await getLogs2({ api, target: MORPHO, eventAbi: supplyCollateralAbi, fromBlock: FROM_BLOCK, toBlock, extraKey: "borro-borrowers", customCacheFunction: borrowerCache }) + // the cache keeps only pairs for markets listed when it read the logs; the key changes when markets are added + const pairs = await getLogs2({ api, target: MORPHO, eventAbi: supplyCollateralAbi, fromBlock: FROM_BLOCK, toBlock, extraKey: "borro-borrowers-v2", customCacheFunction: borrowerCache }) const calls = pairs.map((p) => ({ params: p.split(":") })) const positions = await api.multiCall({ target: MORPHO, abi: positionAbi, calls }) const net = {} From 3741c9f58712a95103a242425b4d670b60fe8bb8 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 20 Oct 2026 15:14:00 +0100 Subject: [PATCH 351/988] btccx (#21751) --- projects/dolomite/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/dolomite/index.js b/projects/dolomite/index.js index d1e3fdb3e82..72dc9c3cadd 100644 --- a/projects/dolomite/index.js +++ b/projects/dolomite/index.js @@ -49,6 +49,7 @@ const config = { margin: '0x003Ca23Fd5F0ca87D01F6eC6CD14A8AE60c2b97D', blacklistedTokens: [ '0xda5e1988097297dcdc1f90d4dfe7909e847cbef6', // WLFI - almost all of it is supplied by WLFI team multisig '0x8af3b9d0e53186ae13b32fd783f42663bf48d389', // WLFIcx - concrete-issued WLFI, the deposit is already counted in concrete-xyz + '0x852724426b2851487b278a3377449bf26b06c1ba', // BTCcx - concrete-issued custodial BTC, the deposit is already counted in concrete-xyz (ctBTCcxPrime) ] }, polygon_zkevm: { margin: '0x836b557Cf9eF29fcF49C776841191782df34e4e5', }, From c8ea8d5f60b1b7ebe6cd53236296c1d85df77082 Mon Sep 17 00:00:00 2001 From: fa11up <249526019+fa11up@users.noreply.github.com> Date: Tue, 20 Oct 2026 10:30:15 -0400 Subject: [PATCH 352/988] Add INFER (imdUSD CDP) TVL + treasury adapters (#21680) Co-authored-by: fa11up Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- registries/sumTokens/data3.js | 8 ++++++++ registries/treasury.js | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index b218155f708..8c61fc4914a 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1170,4 +1170,12 @@ module.exports = { "tvl": { "owners": ["0x76b91e83f2A12dc52E33f856eeA300E5B3A62c0c", "0x88d163d40D6BFe0Ad2b17f4a90A03053fEbf3014", "0xdfc40D309C0D8f4Cc42863991C8e606eD330e1E8"], "tokens": ["0xe5eBE2AE0a036C955bfF58291826C50F7d670D43"] }, } }, + "infer": { + "methodology": "TVL is the sIMD (staked IMD) collateral locked in the imdUSD CDP vault by borrowers. Minted imdUSD and the Treasury's holdings are not counted.", + "start": "2026-10-11", + "ethereum": { + "owner": "0x0b69F8DA8D8cE521d74Ea69a7A3475B77302EF82", + "tokens": ["0x9Efa934D9fAd4AE28c998a40195646b965a97247"] + }, + }, } diff --git a/registries/treasury.js b/registries/treasury.js index 7f56d856d9f..bf671c3513f 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -6628,6 +6628,18 @@ const configs = { ownTokens: ["0x6b5204b0be36771253cc38e88012e02b752f0f36"], }, }, + 'treasury/infer': { + ethereum: { + owners: ['0x6Ac8fF96Fb8DCF5d79A8eF1E59D9AC23f2BD27Bc'], + tokens: [ + '0xD34a99Bc0f67aE1bbd63C660e6d0b0dd03E263B7', // IMD + '0x9Efa934D9fAd4AE28c998a40195646b965a97247', // sIMD + ADDRESSES.ethereum.USDC, + ], + ownTokens: ['0x53d0eA0A685220718Dc6a0a6e4617194C6F37921', '0x61aAF8a992A3143e2B0C9cB0030b9fE702854a25'], // INFER, imdUSD + fetchCoValentTokens: false, + }, + }, 'treasury/zyber-swap': { arbitrum: { tokens: [ From 001761e4f3f5a2864f8071ba61078b2858ab23c7 Mon Sep 17 00:00:00 2001 From: scathymedi Date: Tue, 20 Oct 2026 10:44:57 -0400 Subject: [PATCH 353/988] Lincoln Protocol (Robinhood Chain) (#21683) Co-authored-by: scathymedi <342484490+scathymedi@users.noreply.github.com> Co-authored-by: FelixBruguera --- registries/sumTokens/data3.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 8c61fc4914a..6bc01a14826 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1178,4 +1178,21 @@ module.exports = { "tokens": ["0x9Efa934D9fAd4AE28c998a40195646b965a97247"] }, }, + "lincoln-protocol": { + "methodology": "Each Lincoln privacy pool is an immutable contract holding a single asset (ETH, USDG or a Robinhood tokenized stock). TVL is the on-chain balance of every pool. Route adapters and relays hold no user funds between transactions, so they are not counted.", + "start": "2026-10-17", + "robinhood": { + "ownerTokens": [ + [[ADDRESSES.null], "0xF9c767CAb9B9A7dE8Dd959967269787880267ab2"], // ETH + [["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"], "0x5Cd4c081eb747406DAb66e22004324600f1928C9"], // USDG + [["0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC"], "0x4C8BAEb78b032EA3610E0F5D4C8B5Bb4fF5995f7"], // NVDA + [["0x117cc2133c37B721F49dE2A7a74833232B3B4C0C"], "0x8a29Db84A20B0A3CA528FAE0F69F50FfD39c6C39"], // SPY + [["0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35"], "0xA2078e02A631ae9218DBAa84987a24741bD24d10"], // META + [["0x322F0929c4625eD5bAd873c95208D54E1c003b2d"], "0xE8c619705B7452c2281cA8fA675a355846D34BFE"], // TSLA + [["0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3"], "0x31Bd720527D9875b444c0946c5795351a56d9d8B"], // GOOGL + [["0xD5f3879160bc7c32ebb4dC785F8a4F505888de68"], "0xd4375275F5FA231e238c9FF1237A8e8666Be6B62"], // QQQ + [["0xec262a75e413fAfD0dF80480274532C79D42da09"], "0x207Dc4DD4E40Ab280dF9eC10CD5Edf04685e9d88"], // MSTR + ] + }, + }, } From 2b4150df95e0ed9c6337afb98c9b1940bebff025 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 20 Oct 2026 15:55:24 +0100 Subject: [PATCH 354/988] Add OTHERWISE (Prediction Market, Base) (#21686) Co-authored-by: josh Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- registries/sumTokens/data3.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 6bc01a14826..6af33ae0c36 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1195,4 +1195,18 @@ module.exports = { ] }, }, + "otherwise": { + "methodology": "TVL is the balance of each market collateral token held by OTHERWISE's ConditionalTokens contract on Base, which escrows one unit of collateral for every outstanding YES + NO pair until the market is merged or redeemed. The order-book exchange contracts hold nothing between calls.", + "start": "2026-10-01", + "base": { + "owner": "0x80129e9b934b31809215FAE505004aAD500b9538", + "tokens": [ + "0x31C2C14134e6E3B7ef9478297F199331133Fc2d8", // wtSPYM + "0xFF05E1bD696900dc6A52CA35Ca61Bb1024eDa8e2", // wtMSTR + "0x5cDa0E1CA4ce2af96315f7F8963C85399c172204", // wtCOIN + "0x71C66449d2528E23514A9c197BFD55Ae9DB3B714", // wtTSM + "0x19F89aaEf8a93f38A974beca9776f09aB844887F", // wtSPCX + ] + }, + }, } From 705691c405169ebaf4302302b5472fac5e7f9f75 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 20 Oct 2026 16:54:05 +0100 Subject: [PATCH 355/988] Add new retired reserve address to sbtc.js (#21757) --- projects/helper/bitcoin-book/sbtc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/bitcoin-book/sbtc.js b/projects/helper/bitcoin-book/sbtc.js index 48a1c24397d..d7bf4883d66 100644 --- a/projects/helper/bitcoin-book/sbtc.js +++ b/projects/helper/bitcoin-book/sbtc.js @@ -15,6 +15,7 @@ const RETIRED_RESERVES = [ 'bc1pl033nz4lj7u7wz3l2k2ew3f7af4sdja8r25ernl00thflwempayswr5hvc', 'bc1prcs82tvrz70jk8u79uekwdfjhd0qhs2mva6e526arycu7fu25zsqhyztuy', 'bc1p6ys2ervatu00766eeqfmverzegg9fkprn3xjn0ppn70h53qu5vus3yzl0x', + 'bc1psptt20t7g8u0sz629k4y27c8lqd3kh6zqds4937s2hxecl7d7afsrhteyx', ] // secp256k1 From c5b6c1ea34ebfebde4e38aa57bcb68290305bf4e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 20 Oct 2026 17:55:35 +0200 Subject: [PATCH 356/988] update blofin --- cex/blofin-cex.js | 1 + projects/helper/bitcoin-book/index.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/cex/blofin-cex.js b/cex/blofin-cex.js index 45848e6ce5e..ad031aa45e4 100644 --- a/cex/blofin-cex.js +++ b/cex/blofin-cex.js @@ -96,6 +96,7 @@ module.exports = { "addr1qx7ulwm3gkfxdxzsvsd3a8j8tfxql2j75tc572wk73zyz9kg6jsax3gztqfqneqsw05k7vl4r74zt9aaxe93gsxdx8lqjzrfdz", "addr1q9pnql2ut22sw3695jxcegfu8f273jyw78u8605tlx3gj0vf7nsu5v2rrpxpxwsx5ekxx07m3yy4jry5v706aqa4gklq7mwa54", "addr1qx7tz48uycv3aeawm3fvkjl3hsy8gvxmmwplv6v6tcsvstm76dn2mjkc8mdyccz5aulxe436dxyhkajj3exp92u6vaesqjs8wq", + "addr1q93nv57v0xdfedm3c7p0wtd4nkrazdrfnkly9f0jk2uzq5trxefuc7v6njmhr3uz7ukmt8v86y6xn8d7g2jl9v4cypgs5jfku3", ], }, algorand: { diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index 4c5e0f0bb7d..e1faaee74d2 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -481,6 +481,18 @@ module.exports = { "bc1q9v9lcpmzk8wf9uvv07szm5t445rnr2capk5mey", "bc1qtkrjaaqy3l42zmu7wrw7wn44xkzxxtqespjavk", "19XXnYoRw1diwT7MWksBfJ9HoWUKmZV2FG", + "1LGr6KF5emU4Rcv3c7Wc3afHmAMrv3DkdH", + "12QXuVZgtKX778BaEDkxLGwQgNWicuqPLz", + "1HnQHvzTAf3UwE3QjQqqTysHXZ7VkacrAk", + "1BLUP7N6aWtCK7d1m7YotX45133ovvqoEC", + "1G1gDkRoSi7CGku8TEdAD1zi9UiYR9u4NT", + "1BFZkdFDn6Ytis96ThiQiEVU8GK2JPTu5g", + "18fqk53PMGnSoKZwj5jok6NhTHfMgRXS2o", + "19KgH9DUFTfCLD2kB2PTmeaiuRpvgR4qqH", + "1HKRR1uBxcj9xWyP4xpwTM2L65oXwTcr6W", + "19kiDf7Mqv9pYWhzCa6EK1nYYQEDEXER6Z", + "1E7EjV19u4yKdyXeEfR3H4Rpqpyzr1fJM6", + "13fYEp6iYQcpLzbV3HQLAkqrhiN3ZMfdem", ], btse: ["bc1qaxyju6n2x2tednv8e7hgnhnz44vrfcmuhjxpfk"], bybit: [ From 776e9506287aeb8cb4092f69fa8e1c26b05d3f68 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 20 Oct 2026 12:05:40 -0400 Subject: [PATCH 357/988] split golem network and foundation treasuries (#21756) --- projects/treasury/golem-foundation.js | 44 +++++++++++++++++ projects/treasury/golem.js | 71 ++++++++++++++++++--------- 2 files changed, 91 insertions(+), 24 deletions(-) create mode 100644 projects/treasury/golem-foundation.js diff --git a/projects/treasury/golem-foundation.js b/projects/treasury/golem-foundation.js new file mode 100644 index 00000000000..a5ddc8dd4bb --- /dev/null +++ b/projects/treasury/golem-foundation.js @@ -0,0 +1,44 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); +const { mergeExports, getStakedEthTVL } = require('../helper/utils'); + +const GLM = "0x7dd9c5cba05e151c895fde1cf355c9a1d5da6429"; +const withdrawalAddress = '0xba1951dF0C0A52af23857c5ab48B4C43A57E7ed1' // receives the staking rewards of the Foundation's validators + +// The beacon proxy only answers for the current state, so past dates use the deposits made to +// the withdrawal address: [timestamp of the first deposit that day, cumulative ETH deposited], +// from the deposit contract's DepositEvent logs. +const stakedHistory = [ + [1686056351, 64], // 2023-06-06 + [1686121535, 2048], // 2023-06-07 + [1690374791, 14848], // 2023-07-26 + [1690537727, 100064], // 2023-07-28 + [1706879363, 100416], // 2024-02-02 +] + +const utcDate = (timestamp) => new Date(timestamp * 1e3).toISOString().slice(0, 10) + +// A run for any day but today is a refill +const isHistoricalRun = (api) => utcDate(api.timestamp) !== utcDate(Math.floor(Date.now() / 1e3)) + +const liveStakedEth = getStakedEthTVL({ withdrawalAddress, proxy: true }) + +async function stakedEth(api) { + if (!isHistoricalRun(api)) return liveStakedEth(api) + const step = stakedHistory.findLast(([ts]) => api.timestamp >= ts) + if (step) api.addGasToken(step[1] * 1e18) + return api.getBalances() +} + +module.exports = mergeExports([ + treasuryExports({ + ethereum: { + tokens: [nullAddress, ADDRESSES.ethereum.WETH], + owners: [withdrawalAddress, '0x70a0a7be87deb51e1fab16d4f2bf00be1510e476', '0x3d4530082c3eb60f58af03f79b1ed3f40e591cd1'], + ownTokens: [GLM], + }, + }), + { ethereum: { tvl: stakedEth } }, +]) + +module.exports.methodology = "ETH, WETH and GLM held by the Golem Foundation wallets, plus the ETH staked in its validators (withdrawal address 0xba1951dF0C0A52af23857c5ab48B4C43A57E7ed1). Staked ETH is read from the beacon chain for the current day; past dates use the cumulative deposits made to that withdrawal address." diff --git a/projects/treasury/golem.js b/projects/treasury/golem.js index 7dc4a819b21..637ff828c5b 100644 --- a/projects/treasury/golem.js +++ b/projects/treasury/golem.js @@ -1,34 +1,57 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); -const { mergeExports } = require('../helper/utils'); +const { mergeExports, getStakedEthTVL } = require('../helper/utils'); -// Treasury +// Golem Network (Golem Factory). const treasury = "0x7da82c7ab4771ff031b66538d2fb9b0b047f6cf9"; const GLM = "0x7dd9c5cba05e151c895fde1cf355c9a1d5da6429"; +// withdrawal addresses of the Factory's validators, https://blog.golem.network/eth-staking-tests-summary/ +const withdrawalAddresses = [ + '0x4297cc867B85B63297c34af4268ced9CaFC66F5a', + '0x485aD74f70eA3ad814D1dfE7A9284085499DE682', + '0x3dD89506d79f53DaD1B252fb9301Bc95C9792354', + '0xFC6E18E22Ad11592494B3D541bA25Af63A807527', +] -module.exports = treasuryExports({ - ethereum: { - tokens: [ - // Ethereum Assets - nullAddress, - ], - owners: [treasury, '0x70a0a7be87deb51e1fab16d4f2bf00be1510e476', '0x3d4530082c3eb60f58af03f79b1ed3f40e591cd1'], - ownTokens: [GLM] - }, -}) - -async function tvl(api) { - if(api.timestamp > 1687828149){ - // Staked 100k ETH in validators - api.add(ADDRESSES.null, 100e3*1e18) - } +// The beacon proxy only answers for the current state, so past dates use the deposits made to +// these withdrawal addresses: [timestamp of the first deposit that day, cumulative ETH deposited], +// from the deposit contract's DepositEvent logs. +const stakedHistory = [ + [1719325163, 192], // 2024-06-25 + [1719871931, 6592], // 2024-07-01 + [1719878807, 9792], // 2024-07-02 + [1720539071, 9856], // 2024-07-09 + [1720628615, 29056], // 2024-07-10 + [1720679387, 85056], // 2024-07-11 + [1720791587, 91456], // 2024-07-12 + [1721048147, 104256], // 2024-07-15 + [1721396375, 117056], // 2024-07-19 + [1725282239, 136256], // 2024-09-02 +] + +const utcDate = (timestamp) => new Date(timestamp * 1e3).toISOString().slice(0, 10) + +// A run for any day but today is a refill +const isHistoricalRun = (api) => utcDate(api.timestamp) !== utcDate(Math.floor(Date.now() / 1e3)) + +const liveStakedEth = getStakedEthTVL({ withdrawalAddresses, proxy: true }) + +async function stakedEth(api) { + if (!isHistoricalRun(api)) return liveStakedEth(api) + const step = stakedHistory.findLast(([ts]) => api.timestamp >= ts) + if (step) api.addGasToken(step[1] * 1e18) return api.getBalances() } -module.exports = mergeExports([module.exports, { - ethereum: { tvl }, - -}]) +module.exports = mergeExports([ + treasuryExports({ + ethereum: { + tokens: [nullAddress], + owners: [treasury, '0xFC6E18E22Ad11592494B3D541bA25Af63A807527'], + ownTokens: [GLM], + }, + }), + { ethereum: { tvl: stakedEth } }, +]) -module.exports.methodology = "The Golem Foundation has staked 100,000 ETH on top of what they hold on the treasury address. https://golem.foundation/2023/12/05/diva-announcement.html . Wallet that accrues the staking rewards https://etherscan.io/address/0xba1951dF0C0A52af23857c5ab48B4C43A57E7ed1" +module.exports.methodology = "ETH and GLM held by the Golem Factory treasury, plus the ETH staked in its validators (withdrawal addresses from https://blog.golem.network/eth-staking-tests-summary/). Staked ETH is read from the beacon chain for the current day; past dates use the cumulative deposits made to those withdrawal addresses." From adb43d9b42b7bdaf3015ea104c67140d3f51ce51 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 20 Oct 2026 20:49:47 +0200 Subject: [PATCH 358/988] fix(btr): count hook-invested Euler/Aave liquidity in TVL (#21716) Co-authored-by: FelixBruguera --- projects/btr/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/projects/btr/index.js b/projects/btr/index.js index 67c700e468a..05257dbc35c 100644 --- a/projects/btr/index.js +++ b/projects/btr/index.js @@ -3,11 +3,18 @@ const FACTORY = '0xbbbbbbbbbd5e955E20F323cA1F95f8191fD0E0BF' async function tvl(api) { const pools = await api.fetchList({ lengthAbi: 'getOfficialPoolsCount', itemAbi: 'officialPools', target: FACTORY }) const tokens = await api.multiCall({ target: FACTORY, abi: 'function getPoolTokens(address pool) view returns (address[])', calls: pools }) - return api.sumTokens({ ownerTokens: pools.map((pool, i) => [tokens[i], pool]) }) + await api.sumTokens({ ownerTokens: pools.map((pool, i) => [tokens[i], pool]) }) + // liquidity a pool's yield hook placed in external venues belongs to its LPs: count the hook NAV + const legs = pools.flatMap((pool, i) => tokens[i].map(token => ({ pool, token }))) + const hooks = await api.multiCall({ abi: 'function getAssetHook(address) view returns (address target, uint32 flags, uint32 lastCreditAt)', calls: legs.map(l => ({ target: l.pool, params: [l.token] })) }) + const live = legs.map((l, i) => ({ ...l, hook: hooks[i].target })).filter(l => +l.hook) + const nav = await api.multiCall({ abi: 'uint256:navAssets', calls: live.map(l => l.hook) }) + live.forEach((l, i) => api.add(l.token, nav[i])) } module.exports = { - methodology: "Sums the token balances held by every official BTR pool listed by the PoolFactory. Tranches a pool has pushed to external venues (Euler/Aave) leave the pool and are not counted, since those venues are listed separately.", + doublecounted: true, + methodology: "Sums the token balances held by every official BTR pool listed by the PoolFactory, plus the liquidity each pool's yield hook has deposited in external lending markets or vaults (currently Aave and Euler) on the pool's behalf, valued at the hook's reported NAV. That liquidity is also counted in those venues' TVL.", start: '2026-10-01', monad: { tvl }, } From 916f638d09e8c5d60ffcec333e068a2aa0f56c9d Mon Sep 17 00:00:00 2001 From: clawdio331-source Date: Tue, 20 Oct 2026 22:59:18 +0400 Subject: [PATCH 359/988] gage: count Intent partner vaults, Intent cores and lend-asset generations (#21695) Co-authored-by: Claude Opus 5.5 --- projects/gage/index.js | 65 ++++++++++++++++++------------ projects/gage/universe.json | 79 ++++++++++++++++++++++++++++++++++++- 2 files changed, 116 insertions(+), 28 deletions(-) diff --git a/projects/gage/index.js b/projects/gage/index.js index f840bc400c4..546068cd8d1 100644 --- a/projects/gage/index.js +++ b/projects/gage/index.js @@ -1,6 +1,7 @@ -const ADDRESSES = require('../helper/coreAssets.json') // DefiLlama TVL adapter for gage. Every address comes from ./universe.json, generated from gage's deployment manifest; -// each one is published with its role at https://docs.gage.cash/protocol/addresses. +// each one is published with its role at https://docs.gage.cash/protocol/addresses, the Intent (partner lending) +// contracts at https://docs.gage.cash/protocol/bounty-targets. +const ADDRESSES = require('../helper/coreAssets.json') const { unwrapUniswapV3NFT, unwrapUniswapV4NFTs } = require('../helper/unwrapLPs') const U = require('./universe.json') @@ -115,15 +116,16 @@ async function engineLoans(api, engine) { } /** - * V2 engines keep each loan's collateral in its own account contract and lender USDG in the engine until the - * fourth slot fills. Whatever an account still holds is user value in custody, whatever the loan's state. + * V2 engines keep each loan's collateral in its own account contract and lender funds in the engine until the + * fourth slot fills. Whatever an account still holds is user value in custody, whatever the loan's state. An engine + * lends `asset`: USDG, or the stock token an Intent lend-asset generation's core lends, in raw units of it. */ async function engineTvl(api, groups) { for (const engine of U.engines) { const loans = (await engineLoans(api, engine)).filter((l) => Number(l.state) !== LOAN.NONE && lower(l.account) !== ZERO) let escrow = 0n for (const l of loans) escrow += fundingEscrow(l) - if (escrow > 0n) api.add(U.usdg, escrow.toString()) + if (escrow > 0n) api.add(engine.asset, escrow.toString()) const erc20 = loans.filter((l) => Number(l.kind) === KIND.ERC20 && !isExcluded(l.token)) if (erc20.length) { const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls: erc20.map((l) => ({ target: l.token, params: l.account })) }) @@ -163,29 +165,40 @@ async function addHoldings(api, tokensAndOwners) { } const EARN_VERSION = { hybrid: 2, earn: 3 } // Factory kind → strategy design: HybridVault (2), EarnVault (3). +const INTENT = 3 // An IntentVault keeps EarnVault's books (cash, reserve, unassigned cash, side pockets) in its asset. const POCKET_ABI = { 2: 'function pockets(uint256) view returns (uint256 dealId, address token, uint256 amount, uint256 supply, uint256 claimed)', 3: 'function pockets(uint256) view returns (uint256 loanId, address token, uint256 amount, uint256 supply, uint256 claimed, uint64 snapshotId)', } +/** Every vault a factory has created by the block, lowercased, or none before the factory existed. */ +async function factoryVaults(api, factory) { + const block = await api.getBlock() + if (block < factory.startBlock) return [] + const count = Number(await api.call({ target: factory.address, abi: 'uint256:count' })) + if (!count) return [] + return (await api.multiCall({ target: factory.address, abi: 'function vaults(uint256) view returns (address)', calls: range(count).map((i) => i - 1) })).map(lower) +} + /** - * Earn strategies: USDG idle in the strategy, USDG a repayment brought in that no loan outcome has booked yet, the - * strategy's position in the external ERC-4626 reserve at the reserve's own conversion, and collateral recovered from - * defaults into side pockets that depositors have not claimed yet. Principal a strategy has lent is engine principal - * and is reported under borrowed, never twice. + * Earn strategies and Intent partner vaults: what is idle in the vault, what a repayment brought in that no loan + * outcome has booked yet, the vault's position in its reserve at the reserve's own conversion (an external ERC-4626 + * for USDG; a lend-asset generation's closed reserve accepts nothing and converts zero), and collateral recovered from + * defaults, or a partner vault's early-repayment earnings, held in side pockets that depositors have not claimed yet. + * A partner vault keeps these books in the asset its generation lends. Principal a vault has lent is engine principal + * and is reported under borrowed, never twice; fees owed to the vault's manager and the protocol are not counted. */ async function earnTvl(api) { const block = await api.getBlock() - const vaults = new Map(U.earn.filter((s) => block >= s.startBlock).map((s) => [s.vault, s.version])) - for (const f of U.factories) { - if (block < f.startBlock) continue - const count = Number(await api.call({ target: f.address, abi: 'uint256:count' })) - if (count) (await api.multiCall({ target: f.address, abi: 'function vaults(uint256) view returns (address)', calls: range(count).map((i) => i - 1) })).forEach((v) => { if (!vaults.has(lower(v))) vaults.set(lower(v), EARN_VERSION[f.kind]) }) - } + const vaults = new Map(U.earn.filter((s) => block >= s.startBlock).map((s) => [s.vault, { version: s.version, asset: U.usdg }])) + for (const f of U.factories) (await factoryVaults(api, f)).forEach((v) => { if (!vaults.has(v)) vaults.set(v, { version: EARN_VERSION[f.kind], asset: U.usdg }) }) + for (const g of U.intent) (await factoryVaults(api, { address: g.factory, startBlock: g.startBlock })).forEach((v) => { if (!vaults.has(v)) vaults.set(v, { version: INTENT, asset: g.asset }) }) const list = [...vaults.keys()] if (!list.length) return - const v2 = list.filter((v) => vaults.get(v) === 2) - const v3 = list.filter((v) => vaults.get(v) === 3) + const version = (v) => vaults.get(v).version + const asset = (v) => vaults.get(v).asset + const v2 = list.filter((v) => version(v) === 2) + const v3 = list.filter((v) => version(v) === 3) const [cash, shares, reserves, pocketCounts, unassigned, harvested, assigned] = await Promise.all([ api.multiCall({ abi: 'uint256:cash', calls: list }), api.multiCall({ abi: 'uint256:reserveShares', calls: list }), @@ -196,13 +209,13 @@ async function earnTvl(api) { v2.length ? api.multiCall({ abi: 'uint256:assignedCash', calls: v2 }) : [], ]) const assets = await api.multiCall({ abi: 'function convertToAssets(uint256) view returns (uint256)', calls: list.map((_, i) => ({ target: reserves[i], params: [shares[i]] })) }) - list.forEach((_, i) => api.add(U.usdg, (BigInt(cash[i]) + BigInt(assets[i])).toString())) - unassigned.forEach((amount) => api.add(U.usdg, amount)) + list.forEach((v, i) => api.add(asset(v), (BigInt(cash[i]) + BigInt(assets[i])).toString())) + unassigned.forEach((amount, i) => api.add(asset(v3[i]), amount)) harvested.forEach((amount, i) => api.add(U.usdg, (BigInt(amount) - BigInt(assigned[i])).toString())) const pockets = [] - for (const version of [2, 3]) { - const calls = list.flatMap((target, i) => (vaults.get(target) === version ? range(pocketCounts[i]).map((id) => ({ target, params: [id] })) : [])) - if (calls.length) (await api.multiCall({ abi: POCKET_ABI[version], calls })).forEach((p, i) => pockets.push({ vault: calls[i].target, token: p.token, left: BigInt(p.amount) - BigInt(p.claimed) })) + for (const design of [2, 3]) { + const calls = list.flatMap((target, i) => (version(target) === design ? range(pocketCounts[i]).map((id) => ({ target, params: [id] })) : [])) + if (calls.length) (await api.multiCall({ abi: POCKET_ABI[design], calls })).forEach((p, i) => pockets.push({ vault: calls[i].target, token: p.token, left: BigInt(p.amount) - BigInt(p.claimed) })) } // A pocket holds its recovered asset for the holders of record until each one claims: amount minus claimed. for (const p of pockets) { @@ -221,8 +234,8 @@ async function tvl(api) { } /** - * Gross funded principal stays outstanding until repayment or the collateral claim. A legacy deal backed by an - * engine receipt is that engine's loan and is counted there. + * Gross funded principal stays outstanding until repayment or the collateral claim, in the asset each engine lends. + * A legacy deal backed by an engine receipt is that engine's loan and is counted there. */ async function borrowed(api) { for (const vault of U.vaults) { @@ -233,7 +246,7 @@ async function borrowed(api) { for (const engine of U.engines) { const loans = await engineLoans(api, engine) const amount = loans.filter((l) => Number(l.state) === LOAN.ACTIVE).reduce((sum, l) => sum + BigInt(l.principal), 0n) - if (amount > 0n) api.add(U.usdg, amount.toString()) + if (amount > 0n) api.add(engine.asset, amount.toString()) } } @@ -241,6 +254,6 @@ module.exports = { timetravel: true, // Historical runs need an archive RPC for Robinhood Chain. doublecounted: true, // LP collateral overlaps Uniswap V3/V4; the Earn reserve overlaps its own ERC-4626 listing. start: U.start, - methodology: 'Counts user collateral in custody across every Gage lending contract (listed at docs.gage.cash/protocol/addresses): the legacy deal vaults (ERC-20 collateral, including collateral awaiting withdrawal, and USDG escrowed for open bids) and the V2 engines (collateral held by each loan account, whatever the loan state, and USDG committed to loans that have not activated). Earn strategies add their idle USDG, repayments they have received but not yet booked, their position in the external ERC-4626 reserve and collateral recovered from defaults that depositors have not claimed yet. USDG credited for withdrawal (loan proceeds, repayments, withdrawn bids, protocol fees) is excluded. Vault-owned Uniswap V3/V4 NFTs are unwrapped into underlying principal without uncollected fees. Gross active loan principal is reported separately under borrowed until repayment, claim or a finalised default. Excludes GAGE, sGAGE, the internal receipt tokens, reward reserves, the treasury and the protocol-owned GAGE/sGAGE pool. Token balances are priced by DefiLlama.', + methodology: 'Counts user collateral in custody across every Gage lending contract (listed at docs.gage.cash/protocol/addresses, partner lending at docs.gage.cash/protocol/bounty-targets): the legacy deal vaults (ERC-20 collateral, including collateral awaiting withdrawal, and USDG escrowed for open bids) and the V2 engines, Intent cores included (collateral held by each loan account, whatever the loan state, and lender funds committed to loans that have not activated). Earn strategies and Intent partner vaults (every vault each Intent factory has created) add their idle cash, repayments they have received but not yet booked, their reserve position and what side pockets hold for depositors who have not claimed yet. Intent lend-asset generations lend a stock token instead of USDG: their amounts are counted in that token. USDG credited for withdrawal (loan proceeds, repayments, withdrawn bids, protocol fees) and fees owed to vault managers or the protocol are excluded. Vault-owned Uniswap V3/V4 NFTs are unwrapped into underlying principal without uncollected fees. Gross active loan principal is reported separately under borrowed until repayment, claim or a finalised default. Excludes GAGE, sGAGE, the internal receipt tokens, reward reserves, the treasury and the protocol-owned GAGE/sGAGE pool. Token balances are priced by DefiLlama.', [U.chain]: { tvl, borrowed }, } diff --git a/projects/gage/universe.json b/projects/gage/universe.json index fa45f3ee7e3..19a287d0dc3 100644 --- a/projects/gage/universe.json +++ b/projects/gage/universe.json @@ -11,13 +11,15 @@ ], "receipts": [ "0x2166a547bc27fef846c9858e3101b84d1a8d994e", - "0x647d46c0577453be8c75039f829740b5d2e44938" + "0x647d46c0577453be8c75039f829740b5d2e44938", + "0x789637f1f3fde2760d66b365f2cf7e30d2c7f6ca" ], "excludedTokens": [ "0x7163ae1b5aea2f09ebc609c52b4dcac0a7a4bc2d", "0x78c88cf8f6e612955526ceb501be82bf3279bd5d", "0x2166a547bc27fef846c9858e3101b84d1a8d994e", - "0x647d46c0577453be8c75039f829740b5d2e44938" + "0x647d46c0577453be8c75039f829740b5d2e44938", + "0x789637f1f3fde2760d66b365f2cf7e30d2c7f6ca" ], "stateView": "0xf3334192d15450cdd385c8b70e03f9a6bd9e673b", "v3Factories": [ @@ -74,6 +76,7 @@ { "name": "V2", "engine": "0x22658055b70b8b09616b1e0953f2a51cc66cf493", + "asset": "0x5fc5360d0400a0fd4f2af552add042d716f1d168", "cashoutRouter": "0x38e37cc00427dd2a930d2a31e29e4104530d671b", "startBlock": 58114969, "v3Manager": "0x73991a25c818bf1f1128deaab1492d45638de0d3", @@ -82,6 +85,7 @@ { "name": "V2", "engine": "0x08561c817a5bf5230f91c001800449f047e4c07d", + "asset": "0x5fc5360d0400a0fd4f2af552add042d716f1d168", "cashoutRouter": "0x8f0ddfbb88a4a70ef4c82ab237eb8407c6b6d866", "startBlock": 60445674, "v3Manager": "0x73991a25c818bf1f1128deaab1492d45638de0d3", @@ -90,10 +94,47 @@ { "name": "V3", "engine": "0xfee799ade96229c2c128bc5ed9e55f8d9d01a7e9", + "asset": "0x5fc5360d0400a0fd4f2af552add042d716f1d168", "cashoutRouter": "0x895285fdbbec09eada41fc3784117d5177427acc", "startBlock": 62950248, "v3Manager": "0x73991a25c818bf1f1128deaab1492d45638de0d3", "v4Manager": "0x58daec3116aae6d93017baaea7749052e8a04fa7" + }, + { + "name": "Intent V1, r9 code (Pashov final fixes, I-04 tenth-unit floor)", + "engine": "0x856e4232469b957150cb29a8ce9b60059449e87e", + "asset": "0x5fc5360d0400a0fd4f2af552add042d716f1d168", + "cashoutRouter": "0x3e7dc9bd908f5ba5aae43238c915e4f28a073ea7", + "startBlock": 88938673, + "v3Manager": "0x73991a25c818bf1f1128deaab1492d45638de0d3", + "v4Manager": "0x58daec3116aae6d93017baaea7749052e8a04fa7" + }, + { + "name": "Intent V1 GLD", + "engine": "0xf2b98f79040b4157373093cdda2a4f2cb3c838d8", + "asset": "0xc9a981fee1f9dec688bb123ccdecc63d0debfc4e", + "cashoutRouter": "0x4fb133edc4b72b81b2804b00b4e843ad34deca84", + "startBlock": 89095605, + "v3Manager": "0x73991a25c818bf1f1128deaab1492d45638de0d3", + "v4Manager": "0x58daec3116aae6d93017baaea7749052e8a04fa7" + }, + { + "name": "Intent V1 NVDA", + "engine": "0x380a536b1c8bf9e8c1035413497f767f76d30b6e", + "asset": "0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec", + "cashoutRouter": "0xdc5c966e05279fb860b4986c7483e431f1a3d482", + "startBlock": 89111601, + "v3Manager": "0x73991a25c818bf1f1128deaab1492d45638de0d3", + "v4Manager": "0x58daec3116aae6d93017baaea7749052e8a04fa7" + }, + { + "name": "Intent V1 HIMS", + "engine": "0x359bb9751f5c2cfdce5d034a9742e7a0a3ac8e54", + "asset": "0xccee82fe024c36fa15e1005ede3e9e4787e23d09", + "cashoutRouter": "0x4a9ef39ca35ff26e4f21099e8dd8914c1df8bb14", + "startBlock": 90058471, + "v3Manager": "0x73991a25c818bf1f1128deaab1492d45638de0d3", + "v4Manager": "0x58daec3116aae6d93017baaea7749052e8a04fa7" } ], "earn": [ @@ -141,5 +182,39 @@ "address": "0x124d74d5626d392e937c3410c0325ea464700682", "startBlock": 64910936 } + ], + "intent": [ + { + "id": "USDG", + "asset": "0x5fc5360d0400a0fd4f2af552add042d716f1d168", + "factory": "0x20a908d82885cf4e990a9f8f3f5a483687660822", + "core": "0x856e4232469b957150cb29a8ce9b60059449e87e", + "fillRouter": "0xf8560439d914fe1fc2c1a2faa5b19ed46f73208d", + "startBlock": 88949068 + }, + { + "id": "GLD", + "asset": "0xc9a981fee1f9dec688bb123ccdecc63d0debfc4e", + "factory": "0x0966d92887d41796fcf6f77159d543b1565fec0d", + "core": "0xf2b98f79040b4157373093cdda2a4f2cb3c838d8", + "fillRouter": "0x5f4c6be5cb0695f7a795debbed326d760dc30566", + "startBlock": 89095877 + }, + { + "id": "NVDA", + "asset": "0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec", + "factory": "0xcb848a80801bfcdb7fa43a6729013ecf319a000b", + "core": "0x380a536b1c8bf9e8c1035413497f767f76d30b6e", + "fillRouter": "0xda8bb629cfd4ffd8e0e00d7bf96fba35bbf354f4", + "startBlock": 89111885 + }, + { + "id": "HIMS", + "asset": "0xccee82fe024c36fa15e1005ede3e9e4787e23d09", + "factory": "0x48a234770e74d907071b8d310f06cf253a846e9d", + "core": "0x359bb9751f5c2cfdce5d034a9742e7a0a3ac8e54", + "fillRouter": "0x81495ca59861b17af926fad46d8b2d9f547479b7", + "startBlock": 90059003 + } ] } From 162bbf223713101eabda3c66a3b9479827925f10 Mon Sep 17 00:00:00 2001 From: Vipin <73279781+vipineth@users.noreply.github.com> Date: Wed, 21 Oct 2026 00:32:28 +0530 Subject: [PATCH 360/988] fix(wbtc): keep cached custody list when a chain feed fails (#21740) --- projects/helper/bitcoin-book/fetchers.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/helper/bitcoin-book/fetchers.js b/projects/helper/bitcoin-book/fetchers.js index 7b06f0f7d0e..50f543d38ab 100644 --- a/projects/helper/bitcoin-book/fetchers.js +++ b/projects/helper/bitcoin-book/fetchers.js @@ -75,16 +75,22 @@ module.exports = { fetcher: async () => { const { data: { natives } } = await get('https://openapi.wbtc.network/public/v1/chains') const addresses = new Set() + const failed = [] for (const { chainKey } of natives) { try { const { result } = await get(`https://wbtc.network/api/chain/${chainKey}/token/wbtc/addresses`) result.filter(i => i.chain === 'btc' && i.type === 'custodial' && isValidBitcoinAddress(i.address)) .forEach(i => addresses.add(i.address)) } catch (e) { + failed.push(chainKey) sdk.log('wbtc: skipping chain', chainKey, e.message) } } if (!addresses.size) throw new Error('wbtc: feed returned no custody addresses') + // the eth feed alone carries ~95% of the addresses, so a failed chain must not overwrite a good cache + const prior = await getCache('config-cache', 'wbtc/custody-addresses') + if (failed.length && Array.isArray(prior) && addresses.size < prior.length * 0.9) + throw new Error(`wbtc: ${failed.join(', ')} failed and list shrank ${prior.length} -> ${addresses.size}, keeping cache`) return [...addresses] } }) From 0fdb0c77912d7cb50317c4bc57e98075ae893579 Mon Sep 17 00:00:00 2001 From: vetrade Date: Tue, 20 Oct 2026 21:04:55 +0200 Subject: [PATCH 361/988] Add VeTrade V3 TVL on VeChain (#21730) --- registries/uniswapV3.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index bf3efbd4a36..46f5e59cf58 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1930,6 +1930,10 @@ const uniV3Configs = { // unmodified Uniswap V3 deployment (same pool init code hash); factory owner burned, so protocol fee is permanently off ethereum: { factory: '0x00a38533c68327aBE0Cc265436e036066E2D6B38', fromBlock: 25895766 }, }, + 'vetrade-v3': { + start: '2026-10-11', + vechain: { factory: '0xc2faf0f48fb7763b28e6f7e415c50b360cc1a096', fromBlock: 26117867 }, + }, } module.exports = buildProtocolExports(uniV3Configs, uniV3Export) From 0e1431e3c9bdbda924b1233d5c11411634002ed7 Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Tue, 20 Oct 2026 21:06:04 +0200 Subject: [PATCH 362/988] Add AllBlue V3 TVL adapter (Avalanche) and split it out of pumpspace (#21731) Co-authored-by: Claude Opus 5.5 --- projects/allblue-v3/index.js | 12 ++++++++++++ projects/pumpspace/index.js | 7 +------ 2 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 projects/allblue-v3/index.js diff --git a/projects/allblue-v3/index.js b/projects/allblue-v3/index.js new file mode 100644 index 00000000000..72946205402 --- /dev/null +++ b/projects/allblue-v3/index.js @@ -0,0 +1,12 @@ +const { getTridentTVL } = require('../helper/sushi-trident') + +// AllBlue V3 (Trident-style pools) on Avalanche. Pools are deployed behind EIP173 proxies +// whose admin is this factory/master deployer. +const ALLBLUE_V3_FACTORY = '0xE749c1cA2EA4f930d1283ad780AdE28625037CeD' + +module.exports = { + methodology: 'TVL is the sum of the token balances held by every AllBlue V3 pool on Avalanche. Pools are enumerated on-chain from the AllBlue V3 factory (totalPoolsCount/getPoolAddress) and each pool reports its assets via getAssets.', + avax: { + tvl: getTridentTVL({ factory: ALLBLUE_V3_FACTORY }), + }, +} diff --git a/projects/pumpspace/index.js b/projects/pumpspace/index.js index 1ef9d063207..0e2b77832a3 100644 --- a/projects/pumpspace/index.js +++ b/projects/pumpspace/index.js @@ -2,14 +2,10 @@ const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking') const { getUniTVL } = require('../helper/unknownTokens'); -const { getTridentTVL } = require('../helper/sushi-trident') const sdk = require('@defillama/sdk') -const CHAIN = 'avax' - // --- FACTORIES / CONTRACTS --- const LEGACY_PUMPSPACE_V2_FACTORY = '0x26B42c208D8a9d8737A2E5c9C57F4481484d4616' // V2 -const ALLBLUE_V3_FACTORY = '0xE749c1cA2EA4f930d1283ad780AdE28625037CeD' // V3/Trident const ALLBLUE_V2_FACTORY = '0x6FEa5651FaC99b854A961dbB41380AdB9F8F9a8b' // V2 // If you later expose staking for other MasterChefs, add here @@ -44,7 +40,7 @@ const TOKENS = { module.exports = { misrepresentedTokens: true, methodology: ` - TVL is computed by summing liquidity reserves across the legacy PumpSpace V2 deployment, the current AllBlue V2 deployment, and AllBlue V3 (Trident) on Avalanche. + TVL is computed by summing liquidity reserves across the legacy PumpSpace V2 deployment and the current AllBlue V2 deployment on Avalanche. AllBlue V3 is tracked separately in projects/allblue-v3. Legacy PumpSpace contracts remain included as part of the migration to AllBlue. The staking bucket includes supported tokens deposited in both legacy PumpSpace and current AllBlue MasterChef contracts. `, @@ -54,7 +50,6 @@ module.exports = { // v3FactoryTVL, getUniTVL({ factory: LEGACY_PUMPSPACE_V2_FACTORY, useDefaultCoreAssets: true }), getUniTVL({ factory: ALLBLUE_V2_FACTORY,useDefaultCoreAssets: true }), - getTridentTVL({ chain: CHAIN, factory:ALLBLUE_V3_FACTORY }), ]), staking: staking( MASTERCHEFS, From ebdc3132b090dcfca81fc4efcff648fa88c275f2 Mon Sep 17 00:00:00 2001 From: dev-thumb Date: Wed, 21 Oct 2026 03:07:03 +0800 Subject: [PATCH 363/988] Add anubi thumb (#21728) --- projects/thumb/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/thumb/index.js diff --git a/projects/thumb/index.js b/projects/thumb/index.js new file mode 100644 index 00000000000..24d21000b8a --- /dev/null +++ b/projects/thumb/index.js @@ -0,0 +1,26 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +const core = '0xebe7b6C1089D9F72aD07f34E36d898e44E5e27f3' +const fromBlock = 15317264 + +const tokenCreatedEvent = 'event TokenCreated(uint256 requestId, uint256 indexed presetId, address indexed creator, address indexed token, string name, string symbol, uint256 maxSupply, uint256 saleAmount, uint256 raiseAmount, uint256 initialPrice, address quoteAsset, address vault, address curveModule, address tradeModule, address migrateModule, address customData, address tokenModule, string tokenMetaUri, uint256 flags, bytes encodedTags)' + +async function tvl(api) { + const tokensAndOwners = await getLogs2({ + api, + target: core, + fromBlock, + eventAbi: tokenCreatedEvent, + extraKey: 'token-created', + useIndexer: false, // Anubi rejects log queries that extend beyond the latest block. + transform: log => [log.quoteAsset, log.vault], + }) + + return api.sumTokens({ tokensAndOwners }) +} + +module.exports = { + start: '2026-10-01', + methodology: 'Counts quote collateral held in Thumb launch vaults. Excludes minted launch-token inventory, fee recipients, treasury balances, and liquidity migrated to external DEX pools.', + anubi: { tvl }, +} From 5a78e7b7dfe7f2ef7afcf7d5e40441b6900be229 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Tue, 20 Oct 2026 21:07:59 +0200 Subject: [PATCH 364/988] add missing chains to backpack (#21727) --- projects/backpack/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/projects/backpack/index.js b/projects/backpack/index.js index 54ce3b476cd..4b19201cb79 100644 --- a/projects/backpack/index.js +++ b/projects/backpack/index.js @@ -44,12 +44,24 @@ const CHAINS = [ 'hyperliquid', 'sei', 'sui', + 'near', + '0g', + 'tempo', + 'zcash', + 'robinhood', + 'arc', + 'bitcoincash', ] const CHAIN_BLACKLISTS = { ethereum: [ADDRESSES.ethereum.sUSD_OLD], } +// 0G native has no entry in coreAssets; tempo native is unpriced and skipped +const NATIVE_TOKENS = { + '0g': [ADDRESSES.null], +} + CHAINS.forEach((chain) => { exportObj[chain] = { tvl: async (api) => { @@ -60,6 +72,7 @@ CHAINS.forEach((chain) => { const tokens = [ ...(Object.values(ADDRESSES[chain] || {})), ...(defaultTokens[chain] || []), + ...(NATIVE_TOKENS[chain] || []), ] let { owners, fungibleAssets } = entry From 05118d4f598ae8701e1d5a2d77b38a74c6f3a2cd Mon Sep 17 00:00:00 2001 From: routebuilder Date: Tue, 20 Oct 2026 21:08:34 +0200 Subject: [PATCH 365/988] Bybit: add missing Berachain PoR chain and BTC wallets (#21724) --- cex/bybit.js | 9 ++++++++- projects/helper/bitcoin-book/index.js | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cex/bybit.js b/cex/bybit.js index 6dab7e8b45d..4c6716d86cf 100644 --- a/cex/bybit.js +++ b/cex/bybit.js @@ -16,7 +16,7 @@ const CHAIN_MAP = { Manta: 'manta', Litecoin: 'litecoin', Dogecoin: 'doge', Cosmos: 'cosmos', Celo: 'celo', Polkadot: 'polkadot', KLAY: 'klaytn', KAIA: 'klaytn', KAVAEVM: 'kava', EOS: 'eos', Dydx: 'dydx', Sonic: 'sonic', HyperEVM: 'hyperliquid', PLASMA: 'plasma', MONAD: 'monad', Cardano: 'cardano', Starknet: 'starknet', - SEIEVM: 'sei', HBAR: 'hedera', STABLE: 'stable', + SEIEVM: 'sei', HBAR: 'hedera', STABLE: 'stable', Bera: 'berachain', } async function fetchLatestCsv() { @@ -86,8 +86,15 @@ const STATIC_OWNERS = { starknet: ['0x076601136372fcdbbd914eea797082f7504f828e122288ad45748b0c8b0c9696'], } +// Chains whose PoR balance sits in a token that has no default list in helper/cex.js +const EXTRA_TOKENS = { + berachain: ['0x0000000000000000000000000000000000000000', '0x779Ded0c9e1022225f8E0630b35a9b54bE713736'], // BERA, USDT0 +} + module.exports = { bitcoin: 'bybit' } for (const slug of new Set(Object.values(CHAIN_MAP))) module.exports[slug] = { owners: async () => (await getOwners())[slug] || [] } for (const [slug, owners] of Object.entries(STATIC_OWNERS)) module.exports[slug] = { owners } +for (const [slug, tokens] of Object.entries(EXTRA_TOKENS)) + module.exports[slug].tokens = tokens diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index e1faaee74d2..6663c574be0 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -522,6 +522,8 @@ module.exports = { "1HDnsptgeJ6fYFHCgd1TFzLSRpuVcV51GL", "1Nb9NUVWpjruzafXh2uKK5v5xxEEL1hPrH", "1P7o14PYsuiaj57DUDWoeD8f36fsc4VgVf", + "bc1qknl6p2cmw30cyx3fz4sdvjjqf6sj682qndcerk", + "bc1q3krff4s70lx4wfgnrr0ux2c09flcp5rgs2d8k6", ], cakeDefi: ["3GcSHxkKY8ADMWRam51T1WYxYSb2vH62VL"], coindcx: [ From becd45fc617cd8fee09aab5f72a3a3ec8fcc1732 Mon Sep 17 00:00:00 2001 From: FastEater <49999458+fasteater@users.noreply.github.com> Date: Tue, 20 Oct 2026 21:14:36 +0200 Subject: [PATCH 366/988] Add USD8 (#21726) Co-authored-by: ccipherx --- projects/usd8/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/usd8/index.js diff --git a/projects/usd8/index.js b/projects/usd8/index.js new file mode 100644 index 00000000000..d7d822432a6 --- /dev/null +++ b/projects/usd8/index.js @@ -0,0 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// https://usd8.fi/docs/addresses.html +const TREASURY = '0x0EaE2d44dfeb2154F60CD702Dc2C9c5aBb090F05' +const REGISTRY = '0x9BfF24a44Bb20F8D1f1dE86EcA56295c5Bb46430' +const USD8 = '0x2fE01f5E235eeaB9045066f873f531dE20f31947' + +async function tvl(api) { + // USDC backing USD8: idle in the Treasury plus USDC deployed to its reserve strategies. + const reserve = await api.call({ target: TREASURY, abi: 'uint256:getReserveBalance' }) + api.add(ADDRESSES.ethereum.USDC, reserve) + + // Cover Pools: single-asset ERC-4626 vaults that back USD8's DeFi insurance payouts. + const [assets, pools] = await api.call({ + target: REGISTRY, + abi: 'function coverPools() view returns (address[] assets, address[] poolAddrs)', + }) + const balances = await api.multiCall({ abi: 'uint256:totalAssets', calls: pools }) + // a USD8 cover pool holds USD8, which the reserve above already backs + assets.forEach((asset, i) => { if (asset.toLowerCase() !== USD8.toLowerCase()) api.add(asset, balances[i]) }) +} + +module.exports = { + methodology: 'TVL is the USDC reserve backing USD8 (held by the Treasury or deployed to its reserve strategies, read from Treasury.getReserveBalance) plus the assets deposited in USD8 Cover Pools (totalAssets of each pool listed by the Registry), excluding any USD8 Cover Pool since that USD8 is already backed by the reserve. Reserve USDC supplied to Morpho through a strategy is also counted in Morpho TVL.', + start: '2026-10-17', + doublecounted: true, + ethereum: { tvl }, +} From 3a44a2b48410ac0f315ab51e3c38bc6fcc92a9af Mon Sep 17 00:00:00 2001 From: dave <87349828+dav3trad3r@users.noreply.github.com> Date: Wed, 21 Oct 2026 05:15:18 +1000 Subject: [PATCH 367/988] Add bskts (index baskets on Robinhood Chain) (#21735) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/bskts/index.js | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/bskts/index.js diff --git a/projects/bskts/index.js b/projects/bskts/index.js new file mode 100644 index 00000000000..f6a96456750 --- /dev/null +++ b/projects/bskts/index.js @@ -0,0 +1,42 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// bskts (bskts.xyz): index baskets on Robinhood Chain. Each basket is a vault that holds +// its constituents (Stock Tokens and crypto) behind its own token, minted and redeemed at +// net asset value. Every basket is created by one factory, which lists them on-chain, and +// each basket reports its own constituents, so new baskets are picked up without an +// adapter change. +const FACTORY = '0xb7c27E044E8Acc8aB3f091a2F9d424A32723e4c3' + +// BSKTS, the index of baskets. It holds other baskets' shares, which are already counted +// in those baskets, so only the USDG it may carry between rebalances is counted here. +const INDEX_VAULT = '0xa71aaF7e54bd27140fe6EB25e008DaF31E2fFe3d' + +const abi = { + baskets: 'address[]:baskets', + constituentTokens: 'address[]:constituentTokens', + wants: 'function wants() view returns (address token0, address token1)', +} + +async function tvl(api) { + const baskets = await api.call({ target: FACTORY, abi: abi.baskets }) + const constituents = await api.multiCall({ abi: abi.constituentTokens, calls: baskets }) + + // Beefy CLM shares held by the yield baskets (WAFER, COMET) are already counted by Beefy + const tokens = [...new Set(constituents.flat().map((t) => t.toLowerCase()))] + const wants = await api.multiCall({ abi: abi.wants, calls: tokens, permitFailure: true }) + const clms = new Set(tokens.filter((_, i) => wants[i])) + + const ownerTokens = baskets.map((basket, i) => [ + constituents[i].filter((t) => !clms.has(t.toLowerCase())), + basket, + ]) + ownerTokens.push([[ADDRESSES.robinhood.USDG], INDEX_VAULT]) + return api.sumTokens({ ownerTokens }) +} + +module.exports = { + methodology: + 'TVL is the tokens held by every bskts basket vault on Robinhood Chain: the Stock Tokens and crypto behind each basket token, read from the vault itself. Baskets are listed on-chain by the bskts factory, and each basket reports its own constituents. The Beefy CLM vault shares held by the yield baskets are excluded, as Beefy already counts them. The BSKTS index holds other baskets\' shares, already counted, so only its USDG is added. Tokens in users\' own wallets and bskts accounts, open orders, and the Weekend Cover market are not counted.', + start: '2026-08-26', // the factory and the current basket vaults + robinhood: { tvl }, +} From 9bf8e258c4a16654dd69aa1c92f26fb561ee72c2 Mon Sep 17 00:00:00 2001 From: Code Monad Date: Wed, 21 Oct 2026 03:16:00 +0800 Subject: [PATCH 368/988] Add Prosper Alpha reserves and locked LP on Pharos (#21738) Co-authored-by: ccipherx --- projects/prosper-alpha/index.js | 59 +++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 projects/prosper-alpha/index.js diff --git a/projects/prosper-alpha/index.js b/projects/prosper-alpha/index.js new file mode 100644 index 00000000000..59a9b9f33fa --- /dev/null +++ b/projects/prosper-alpha/index.js @@ -0,0 +1,59 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') + +const WPROS = ADDRESSES.pharos.WPROS +const FACTORY = '0xefdbb0ea7647b0e21aef7a3b7a5d6a632c3116c8' +const LP_TIMELOCK = '0x152ecca16f86faa5d1fc2ed0a1b2baf5aacd794b' + +async function tvl(api) { + const logs = await getLogs2({ + api, + target: FACTORY, + fromBlock: 17516201, + eventAbi: 'event ProsperVaultLinked(address indexed r25Vault, bytes32 indexed campaignId, address indexed pToken, address market, address buyback)', + }) + const markets = [...new Map(logs.map(log => [log.market.toLowerCase(), log])).values()] + if (!markets.length) return + await api.sumTokens({ owners: markets.map(({ market }) => market), tokens: [WPROS] }) + + const externalPairs = await api.multiCall({ abi: 'address:externalPair', calls: markets.map(({ market }) => market) }) + const positions = new Map() + externalPairs.forEach((pair, i) => { + pair = pair.toLowerCase() + if (pair === ADDRESSES.null) return + const pToken = markets[i].pToken.toLowerCase() + if (positions.has(pair) && positions.get(pair) !== pToken) throw new Error('Conflicting Prosper pair tokens') + positions.set(pair, pToken) + }) + const pairs = [...positions.keys()] + if (!pairs.length) return + const [tokens0, tokens1, reserves, lpBalances, supplies] = await Promise.all([ + api.multiCall({ abi: 'address:token0', calls: pairs }), + api.multiCall({ abi: 'address:token1', calls: pairs }), + api.multiCall({ abi: 'function getReserves() view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)', calls: pairs }), + api.multiCall({ abi: 'erc20:balanceOf', calls: pairs.map(target => ({ target, params: LP_TIMELOCK })) }), + api.multiCall({ abi: 'erc20:totalSupply', calls: pairs }), + ]) + let total = 0n + pairs.forEach((pair, i) => { + const token0 = tokens0[i].toLowerCase() + const token1 = tokens1[i].toLowerCase() + const pToken = positions.get(pair) + let reserve + if (token0 === WPROS && token1 === pToken) reserve = reserves[i].reserve0 + else if (token1 === WPROS && token0 === pToken) reserve = reserves[i].reserve1 + else throw new Error('Unexpected Prosper pair assets') + const balance = BigInt(lpBalances[i]) + const supply = BigInt(supplies[i]) + if (balance === 0n || supply === 0n) return + if (balance > supply) throw new Error('Prosper LP balance exceeds total supply') + total += BigInt(reserve) * balance / supply + }) + api.add(WPROS, total.toString()) +} + +module.exports = { + methodology: 'Counts the WPROS held by Prosper bonding-curve markets on Pharos (discovered from the production Factory creation events), plus the WPROS side of graduated V2 pools whose LP tokens are held by the Prosper LpTimeLock, pro rata to the LP it holds. pTokens and LP held by others are excluded.', + start: '2026-09-13', + pharos: { tvl }, +} From 0accf1e653589dc0ff48382e3308cc97d191b5c3 Mon Sep 17 00:00:00 2001 From: Junghoon Ban Date: Wed, 21 Oct 2026 04:31:49 +0900 Subject: [PATCH 369/988] Add Gno.land support and GnoSwap TVL adapter (#21739) Co-authored-by: ccipherx --- projects/gnoswap/index.js | 61 +++++++++++++++++++++++++++++++++ projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 2 +- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 projects/gnoswap/index.js diff --git a/projects/gnoswap/index.js b/projects/gnoswap/index.js new file mode 100644 index 00000000000..dfff3de6f3f --- /dev/null +++ b/projects/gnoswap/index.js @@ -0,0 +1,61 @@ +const { get } = require('../helper/http') +const { PromisePool } = require('@supercharge/promise-pool') + +const RPC = 'https://rpc.gno.land' +const POOL = 'gno.land/r/gnoswap/pool' +const GOV_STAKER = 'gno.land/r/gnoswap/gov/staker' +const GNS = 'gno.land/r/gnoswap/gns.GNS' + +async function query(expression, pkgPath = POOL) { + const url = new URL(`${RPC}/abci_query`) + url.searchParams.set('path', JSON.stringify('vm/qeval_json')) + url.searchParams.set('data', `0x${Buffer.from(`${pkgPath}.${expression}`).toString('hex')}`) + const { result, error } = await get(url.toString()) + const response = result?.response?.ResponseBase + if (error || !response || response.Error || !response.Data) + throw new Error(`Gno query failed: ${expression}: ${JSON.stringify(error || response)}`) + const { results } = JSON.parse(Buffer.from(response.Data, 'base64').toString()) + if (!Array.isArray(results)) throw new Error(`Missing Gno query results: ${expression}`) + return results +} + +function integer(value) { + if (value?.T?.['@type'] !== '/gno.PrimitiveType' || !['32', '1024'].includes(value.T.value)) + throw new Error('Expected a Gno int or int64') + const bytes = Buffer.from(value.N || '', 'base64') + if (bytes.length !== 8) throw new Error('Invalid Gno integer encoding') + return bytes.readBigInt64LE().toString() +} + +async function tvl(api) { + const count = Number(integer((await query('GetPools().Size()'))[0])) + if (!Number.isSafeInteger(count) || count < 0) throw new Error('Invalid Gnoswap pool count') + + const { results, errors } = await PromisePool.withConcurrency(5) + .for(Array.from({ length: count }, (_, i) => i)) + .process(async index => { + const [key] = await query(`GetPools().GetByIndex(${index})`) + if (key?.T?.value !== '16' || typeof key.V?.value !== 'string') + throw new Error(`Missing Gnoswap pool key at index ${index}`) + const path = key.V.value + const parts = path.split(':') + if (parts.length !== 3) throw new Error(`Invalid Gnoswap pool path: ${path}`) + const balances = await query(`GetBalances(${JSON.stringify(path)})`) + if (balances.length !== 3 || Object.keys(balances[2]).length) + throw new Error(`Failed to read Gnoswap pool balances: ${path}`) + return parts.slice(0, 2).map((token, i) => ({ token, amount: integer(balances[i]) })) + }) + if (errors.length) throw errors[0] + results.flat().forEach(({ token, amount }) => api.add(token, amount)) +} + +async function staking(api) { + const [amount] = await query('GetTotalxGnsSupply()', GOV_STAKER) + api.add(GNS, integer(amount)) +} + +module.exports = { + timetravel: false, + methodology: 'TVL counts token reserves in GnoSwap pools. Staking counts GNS deposited in governance staking, including launchpad deposits, measured by the total xGNS supply.', + gnoland: { tvl, staking }, +} diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 083fe0f2705..9f5ef343dff 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -207,6 +207,7 @@ "genshiro", "gensyn", "ggchain", + "gnoland", "goat", "gochain", "godwoken", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 90a54a9f1f8..a7394d61c76 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -25,7 +25,7 @@ const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 's ] const caseSensitiveChains = [...ibcChains, ...svmChains, 'canton', 'mina', 'decred', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge', 'stellar', 'massa', 'aleo', 'eclipse', 'acala', 'aelf', 'aeternity', 'alephium', 'bifrost', 'bittensor', 'verus', 'dash', 'qubic', 'constellation', 'supra', - 'kaspa', 'bsv', 'arweave', 'pi', 'zcash', 'bitcoincash', + 'kaspa', 'bsv', 'arweave', 'pi', 'zcash', 'bitcoincash', 'gnoland', ] const transformTokens = { From 58eac6705f027e2f23541f427732cd5d8d6e2a13 Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Tue, 20 Oct 2026 22:00:42 +0200 Subject: [PATCH 370/988] choice-exchange: split v1 CosmWasm factory into its own adapter (#21741) --- projects/choice-exchange-v1/index.js | 11 +++++++++++ projects/choice-exchange/index.js | 27 ++++----------------------- 2 files changed, 15 insertions(+), 23 deletions(-) create mode 100644 projects/choice-exchange-v1/index.js diff --git a/projects/choice-exchange-v1/index.js b/projects/choice-exchange-v1/index.js new file mode 100644 index 00000000000..2321e87a4e1 --- /dev/null +++ b/projects/choice-exchange-v1/index.js @@ -0,0 +1,11 @@ +const { getFactoryTvl } = require("../terraswap/factoryTvl"); + +// terraswap-style CosmWasm factory on Injective +const factory = "inj1k9lcqtn3y92h4t3tdsu7z8qx292mhxhgsssmxg"; + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: "Liquidity on the DEX: the reserves of every pair contract created by the Choice Exchange v1 (CosmWasm) factory on Injective.", + injective: { tvl: getFactoryTvl(factory) }, +}; diff --git a/projects/choice-exchange/index.js b/projects/choice-exchange/index.js index e8ac1e683e1..2e92a00cd23 100644 --- a/projects/choice-exchange/index.js +++ b/projects/choice-exchange/index.js @@ -1,9 +1,6 @@ -const sdk = require("@defillama/sdk"); const { getLogs2 } = require("../helper/cache/getLogs"); -const { getFactoryTvl } = require("../terraswap/factoryTvl"); -// v1: terraswap-style CosmWasm factory on Injective -const v1Factory = "inj1k9lcqtn3y92h4t3tdsu7z8qx292mhxhgsssmxg"; +// v1 (the CosmWasm factory) is tracked separately in projects/choice-exchange-v1 // v2: an Infinity (Uniswap v4 style) fork on Injective EVM (chain id 1776). // Both pool managers custody every pool's tokens in the one singleton Vault, so @@ -27,7 +24,7 @@ const v2 = { ], }; -async function v2Tvl(api) { +async function tvl(api) { // `injective` is registered as both a cosmos and an EVM chain, and the sdk resolves // its block over the cosmos lcd. Same workaround as projects/pumex if (!api.block) api.block = (await api.provider.getBlockNumber()) - 20; @@ -44,26 +41,10 @@ async function v2Tvl(api) { await api.sumTokens({ owner: v2.vault, tokens: [...tokens], permitFailure: true }); } -async function tvl(api) { - // kept apart as a precaution: v1 prices its pairs off their own reserve ratios, - // and that pass walks every balance on the api it is handed, not just the ones it - // put there. The two eras do not share an address namespace today, so nothing is - // observably wrong with sharing one api - this just keeps it that way. - const v1Api = new sdk.ChainApi({ chain: api.chain }); - const v2Api = new sdk.ChainApi({ chain: api.chain }); - - await getFactoryTvl(v1Factory)(v1Api); - await v2Tvl(v2Api); - - api.addBalances(v1Api.getBalances()); - api.addBalances(v2Api.getBalances()); -} - module.exports = { - misrepresentedTokens: true, // v2 reads at the current EVM height, since the block for a timestamp cannot be - // resolved on this chain - see v2Tvl + // resolved on this chain - see tvl timetravel: false, - methodology: "Liquidity on the DEX: the CosmWasm (v1) pair contracts' reserves, plus the tokens the Infinity (v2) singleton Vault holds on Injective EVM, in every currency a pool was opened with.", + methodology: "Liquidity on the DEX: the tokens the Infinity (v2) singleton Vault holds on Injective EVM, in every currency a pool was opened with.", injective: { tvl }, }; From d9d7b6405f656b3934bacbae0e1a271d45798b20 Mon Sep 17 00:00:00 2001 From: "Daniel S.N Ayensu" <47149163+Nanasark@users.noreply.github.com> Date: Tue, 20 Oct 2026 21:12:11 +0000 Subject: [PATCH 371/988] add psm,hype, stable markets to delpho tvl (#21721) --- projects/delpho/index.js | 42 ++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/projects/delpho/index.js b/projects/delpho/index.js index 6a69a07434b..1b391160d3c 100644 --- a/projects/delpho/index.js +++ b/projects/delpho/index.js @@ -1,15 +1,19 @@ -const CONFIG_PROVIDER = '0xeC884577055e1f32f2579CAB9f348F4918Cd757f'; +const STABLE_CONFIG_PROVIDER = '0xeC884577055e1f32f2579CAB9f348F4918Cd757f'; +const HYPE_CONFIG_PROVIDER = '0x5663bC41DfF50d1b25b94C0Cba6fA5Bbd750D93C'; +const PSM = '0x4f5Cdd08eFdcF0e9a09e0eD10849f1102B17882d'; +const HYPE_CONFIG_START_BLOCK = 47188561; +const PSM_START_BLOCK = 47185389; -async function tvl(api) { +async function addMarketCollateral(api, configProvider) { const vault = await api.call({ abi: 'address:delphoVault', - target: CONFIG_PROVIDER, + target: configProvider, }); const tokens = await api.call({ abi: 'address[]:getAllSupportedTokens', - target: CONFIG_PROVIDER, + target: configProvider, }); const bals = await api.multiCall({ @@ -18,12 +22,38 @@ async function tvl(api) { }); api.addTokens(tokens, bals); + return tokens; +} + +async function tvl(api) { + const block = await api.getBlock(); + const stableTokens = await addMarketCollateral(api, STABLE_CONFIG_PROVIDER); + + + if (block >= HYPE_CONFIG_START_BLOCK) + await addMarketCollateral(api, HYPE_CONFIG_PROVIDER); + + if (block >= PSM_START_BLOCK) { + const liquid = await api.multiCall({ + abi: 'erc20:balanceOf', + calls: stableTokens.map(token => ({ target: token, params: [PSM] })), + }); + const deployed = await api.multiCall({ + abi: 'function totalDeployedByExecutors(address collateral) view returns (uint256)', + calls: stableTokens.map(token => ({ target: PSM, params: [token] })), + }); + + // Liquid reserves already include the buffer and undeployed executor funds. + // PSM deployment accounting is separate from each vault's totalCollateral. + api.addTokens(stableTokens, liquid); + api.addTokens(stableTokens, deployed); + } } module.exports = { methodology: - 'TVL is user collateral deposited into Delpho, read via the vault\'s totalCollateral view which aggregates buffer, allocated, and executor-deployed amounts. Supported collateral tokens are enumerated from the Delpho config provider (getAllSupportedTokens). USDV (minted debt) and sUSDV (staked USDV) are excluded to avoid double-counting.', + 'TVL includes collateral in the stable and HYPE market vaults, read via totalCollateral, and PSM stablecoin reserves, measured as token balances held by the PSM plus totalDeployedByExecutors. Supported collateral tokens are enumerated from each market config provider (getAllSupportedTokens). Vault totals already include buffer, allocated, and executor-deployed collateral. USDV (minted debt) and sUSDV (staked USDV) are excluded to avoid double-counting.', start: '2026-07-06', timetravel: true, hyperliquid: { tvl }, -}; \ No newline at end of file +}; From 544588191989b7392f74448aaf196cf89a5b8f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Wed, 21 Oct 2026 02:53:11 +0530 Subject: [PATCH 372/988] altura: mark dead from 2026-06-24 (#21762) --- registries/erc4626.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/registries/erc4626.js b/registries/erc4626.js index e52ef2e3a30..14041a32c47 100644 --- a/registries/erc4626.js +++ b/registries/erc4626.js @@ -135,6 +135,8 @@ const configs = { 'paimon': { bsc: ['0x8505c32631034A7cE8800239c08547e0434EdaD9'], }, 'sova': { base: ['0xdFc4047620bd71F3dd781f1048f6890b76281D36'], }, 'altura': { + // vault has held no liquidity and paid no withdrawals since 2026-06-23; totalAssets() is an oracle NAV re-reported unchanged since then + deadFrom: '2026-06-24', hyperliquid: ['0xd0Ee0CF300DFB598270cd7F4D0c6E0D8F6e13f29'], }, 'lendle-vault-allocator': { From 3e63021f3417cd3c9a5903f9ca028aff63132d3e Mon Sep 17 00:00:00 2001 From: Matthew <84196639+mteam88@users.noreply.github.com> Date: Tue, 20 Oct 2026 17:24:58 -0400 Subject: [PATCH 373/988] BaiBai: add cbBTC to TVL (#21769) --- registries/sumTokens/data3.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 6af33ae0c36..bcb5d11ac74 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1127,11 +1127,11 @@ module.exports = { } }, "baibai": { - "methodology": "TVL is the WETH and USDC held by the BaibaiCustodian contract, which custodies the maker liquidity that BaiBai quotes and settles swaps against.", + "methodology": "TVL is the WETH, cbBTC and USDC held by the BaibaiCustodian contract, which custodies the maker liquidity that BaiBai quotes and settles swaps against.", "start": "2026-09-05", "base": { "owner": "0xAaC48FEB93c5C97E0fb3c7C57E1633922A4ACDa3", - "tokens": [ADDRESSES.base.WETH, ADDRESSES.base.USDC] + "tokens": [ADDRESSES.base.WETH, ADDRESSES.base.cbBTC, ADDRESSES.base.USDC] } }, "tacit": { From 688ac393124d396d01e5da3da9d7e8655695254f Mon Sep 17 00:00:00 2001 From: routebuilder Date: Tue, 20 Oct 2026 23:28:59 +0200 Subject: [PATCH 374/988] helper(solana): remove duplicate native SOL check (#21745) --- projects/helper/solana.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 6366c400d2f..7d9ba469200 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -538,9 +538,9 @@ async function sumTokens2_historical({ const tokenAccountsSet = new Set(tokenAccountList); const solOwnersSet = new Set(getUniqueAddresses(solOwners, chain)); - // Helper to check if mint is native SOL (canonical: So11111..., Allium variant: Sol11111...) + // Helper to check if mint is native SOL const isNativeSOL = (mint) => { - return mint === ADDRESSES.solana.SOL || mint === ADDRESSES.solana.SOL; + return mint === ADDRESSES.solana.SOL; }; const tokenBalances = {}; From ad14258ec80d49a4565912f5447780fa0466628a Mon Sep 17 00:00:00 2001 From: Matteo Ludwig <132300160+mysteryxteo@users.noreply.github.com> Date: Tue, 20 Oct 2026 23:33:36 +0200 Subject: [PATCH 375/988] add bb84 (#21766) Co-authored-by: mysteryxteo --- registries/sumTokens/data3.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index bcb5d11ac74..12eb58fab41 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1209,4 +1209,12 @@ module.exports = { ] }, }, + "bb84": { + "methodology": "TVL is the USDC, EURC and ETH escrowed in the bb84 rollup's OptimismPortal on Ethereum, which locks the L1 side of every deposit until it is withdrawn from the L2.", + "start": "2026-09-30", + "ethereum": { + "owner": "0x83226921d6afb31f706b7840bca12655396f136c", + "tokens": [ADDRESSES.ethereum.USDC, "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c", ADDRESSES.null], // USDC, EURC, ETH + }, + }, } From 53ed97f09ed6f3d611ab022dee915b119cb00e34 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 21 Oct 2026 10:42:52 +0200 Subject: [PATCH 376/988] cex: track BTW --- projects/helper/cex.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index e529ce8d7d2..e7ee32ad3e2 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -262,6 +262,7 @@ const defaultTokens = { '0xd69a4b260ef021ccd4e1c5f5a4fb522b032ce831', // MCAT '0x10d4183389e99233db3cc981c43443ebd28ebd5e', // DGAI '0x3d4f0513e8a29669b960f9dbca61861548a9a760', // BANANAS + '0x444045b0ee1ee319a660a5e3d604ca0ffa35acaa', // BTW ], eos: [ ["eosio.token", "EOS", "eos"], From c11c3f8bfe7116a2dbd1cb33c5c5842ec17fb5df Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2026 15:04:09 +0530 Subject: [PATCH 377/988] feat: add Hyperliquid Earn TVL and borrowed balances (#21780) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/hyperliquid-earn/index.js | 57 ++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 projects/hyperliquid-earn/index.js diff --git a/projects/hyperliquid-earn/index.js b/projects/hyperliquid-earn/index.js new file mode 100644 index 00000000000..565432d44a9 --- /dev/null +++ b/projects/hyperliquid-earn/index.js @@ -0,0 +1,57 @@ +const sdk = require('@defillama/sdk') +const { AbiCoder, ZeroAddress } = require('ethers') +const BigNumber = require('bignumber.js') +const { post } = require('../helper/http') + +const RESERVE_STATE = '0x0000000000000000000000000000000000000812' +const TOKEN_INFO = '0x000000000000000000000000000000000000080c' +const coder = AbiCoder.defaultAbiCoder() +const reserveType = 'tuple(uint64 borrowYearlyRateBps, uint64 supplyYearlyRateBps, uint64 balance, uint64 utilizationBps, uint64 oraclePx, uint64 ltvBps, uint64 totalSupplied, uint64 totalBorrowed)' +const tokenType = 'tuple(string name, uint64[] spots, uint64 deployerTradingFeeShare, address deployer, address evmContract, uint8 szDecimals, uint8 weiDecimals, int8 evmExtraWeiDecimals)' + +function getTvl(borrowed = false) { + return async (api) => { + const markets = await post('https://api.hyperliquid.xyz/info', { type: 'allBorrowLendReserveStates' }) + if (!Array.isArray(markets) || !markets.length) + throw new Error('No Hyperliquid lending reserves returned') + + const provider = sdk.getProvider(api.chain) + const blockTag = await api.getBlock() + const read = async (target, token, type) => { + const result = await provider.call({ to: target, data: coder.encode(['uint64'], [token]), blockTag }) + return coder.decode([type], result)[0] + } + + for (const [token] of markets) { + const [reserve, info] = await Promise.all([ + read(RESERVE_STATE, token, reserveType), + read(TOKEN_INFO, token, tokenType), + ]) + const amount = borrowed ? reserve.totalBorrowed : reserve.totalSupplied - reserve.totalBorrowed + if (amount < 0n) throw new Error(`Negative net supply for Hyperliquid token ${token}`) + if (amount === 0n) continue + + if (token === 0) { + api.addCGToken('usd-coin', new BigNumber(amount.toString()).shiftedBy(-Number(info.weiDecimals)).toNumber()) + } else if (token === 150) { + api.addGasToken(new BigNumber(amount.toString()).shiftedBy(18 - Number(info.weiDecimals)).toFixed(0, BigNumber.ROUND_DOWN)) + } else { + if (info.evmContract === ZeroAddress) + throw new Error(`No EVM token mapping for Hyperliquid token ${token}`) + api.add(info.evmContract, new BigNumber(amount.toString()).shiftedBy(Number(info.evmExtraWeiDecimals)).toFixed(0, BigNumber.ROUND_DOWN)) + } + } + } +} + +module.exports = { + timetravel: false, + methodology: 'Reads HyperCore lending reserves through the HyperEVM reserve-state precompile. ' + + 'TVL is total supplied assets, including collateral, minus outstanding borrows; debt is reported separately as borrowed. ' + + 'Includes manual lending and portfolio-margin lending in the same reserves. ' + + 'The info API is used only to discover reserve token indices; balances and token metadata are read on-chain.', + hyperliquid: { + tvl: getTvl(), + borrowed: getTvl(true), + }, +} From 90c9bcac7b7024ac87cef0126875e6e141d34ce1 Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2026 15:23:13 +0530 Subject: [PATCH 378/988] Add historical Lighter LLP TVL adapter (#21781) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/lighter-llp/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/lighter-llp/index.js diff --git a/projects/lighter-llp/index.js b/projects/lighter-llp/index.js new file mode 100644 index 00000000000..c49b0931c00 --- /dev/null +++ b/projects/lighter-llp/index.js @@ -0,0 +1,27 @@ +const { get } = require('../helper/http') + +async function tvl(api) { + const timestamp = Math.floor(api.timestamp / 86400) * 86400 + const { code, resolution, pnl } = await get('https://mainnet.zklighter.elliot.ai/api/v2/pnl', { + params: { + by: 'index', + value: '281474976710654', + resolution: '1d', + start_timestamp: timestamp - 86400, + end_timestamp: timestamp, + }, + }) + const snapshot = Array.isArray(pnl) && pnl.find(point => point.timestamp === timestamp && point.is_final === true) + if (code !== 200 || resolution !== '1d' || !snapshot || !Number.isFinite(snapshot.total_equity) || snapshot.total_equity < 0) + throw new Error(`Missing or invalid Lighter LLP daily equity for ${timestamp}`) + api.addUSDValue(snapshot.total_equity) +} + +module.exports = { + timetravel: true, + misrepresentedTokens: true, + start: '2025-01-18', + doublecounted: true, + methodology: 'LLP total equity, including spot assets, from Lighter’s official API at the latest completed UTC-day boundary. Backing assets are also counted by Lighter Bridge.', + ethereum: { tvl }, +} From 7cbad1a1ef342ceacd8729c7cf8b7f7b07374cc7 Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2026 15:31:15 +0530 Subject: [PATCH 379/988] Assign Lighter LLP TVL to zkLighter (#21783) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/helper/chains.json | 1 + projects/lighter-llp/index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 9f5ef343dff..cd37246f5a1 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -549,6 +549,7 @@ "zkcro", "zkfair", "zklink", + "zklighter", "zksync", "zora", "zyx" diff --git a/projects/lighter-llp/index.js b/projects/lighter-llp/index.js index c49b0931c00..c91e6ae7710 100644 --- a/projects/lighter-llp/index.js +++ b/projects/lighter-llp/index.js @@ -23,5 +23,5 @@ module.exports = { start: '2025-01-18', doublecounted: true, methodology: 'LLP total equity, including spot assets, from Lighter’s official API at the latest completed UTC-day boundary. Backing assets are also counted by Lighter Bridge.', - ethereum: { tvl }, + zklighter: { tvl }, } From 49c557e40b7d5c9189e5c934c3e36a25720506f4 Mon Sep 17 00:00:00 2001 From: kellycryptos <75699356+kellycryptos@users.noreply.github.com> Date: Wed, 21 Oct 2026 14:19:41 +0100 Subject: [PATCH 380/988] feat: add Syn DAO on Arc (#21750) Co-authored-by: kellycryptos Co-authored-by: FelixBruguera --- projects/treasury/syndao.js | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 projects/treasury/syndao.js diff --git a/projects/treasury/syndao.js b/projects/treasury/syndao.js new file mode 100644 index 00000000000..145f1d5c91c --- /dev/null +++ b/projects/treasury/syndao.js @@ -0,0 +1,46 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs'); +const ADDRESSES = require('../helper/coreAssets.json') + +const SYN_TOKEN = '0x8f4b429794ABa4607d177b100Cc5e481D22d0ad4'; + +const TREASURY_CONTRACT = '0x8205e9782Fe54fD2aaD895b436B695db169F3d7B'; + +const ESCROW_CONTRACTS = [ + '0x99955b487aE5519a2b1Ff677f9bed3A6145b750d', + '0x2518d845C9d23AE52650f35C4E4E187BFD797f6B', + '0xC6BE1BCE9ADcad9d97a302D652839F399a699460', + '0xd1e4F8dfBD1e7eC75Fa58561909706af223c5e34', + '0x8eC5c246E976b512D7c157714e464D1A38CD59B6', + '0x11Ae69867785C36ADAcc40D383cd5f19d6288432', + '0x55bA23c48e3c5bE2A36a93A9124C3f7Cacac6B81', + '0x5821ACB8CD8601cCd3861dD66f459Cd9f0027Dd2', + '0xC566D6E70e76886f2aB253f165E6Bd4A69145025', + '0x3b56457A3f647CDf04Db064BD6f1Da9e883C185c', +]; + +async function tvl(api) { + return sumTokens2({ + api, + owners: [TREASURY_CONTRACT, ...ESCROW_CONTRACTS], + tokens: [ADDRESSES.arc.USDC, ADDRESSES.arc.EURC, ADDRESSES.arc.cirBTC, nullAddress], + }); +} + +async function ownTokens(api) { + return sumTokens2({ + api, + owners: [TREASURY_CONTRACT], + tokens: [SYN_TOKEN], + }); +} + +module.exports = { + timetravel: false, + misrepresentedTokens: false, + methodology: + 'Counts USDC, EURC, cirBTC, and native ARC gas token held in the Syn DAO treasury and active milestone escrow contracts on Arc Mainnet.', + arc: { + tvl, + ownTokens, + }, +}; From eef188e45452ee081a78b48b0ae4b37f04db00f9 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Wed, 21 Oct 2026 15:26:50 +0200 Subject: [PATCH 381/988] Add Arc and Robinhood chains to Binance reserves (#21784) --- projects/binance/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/binance/index.js b/projects/binance/index.js index fc44bdf0c2d..6850f150dd2 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -26,12 +26,14 @@ const binanceToDefillama = { AVAX: 'avax', ARB: 'arbitrum', ARBITRUM: 'arbitrum', + ARC: 'arc', AVAXC: 'avax', LTC: 'litecoin', MATIC: 'polygon', OP: 'optimism', OPTIMISM: 'optimism', RON: 'ronin', + ROBINHOOD: 'robinhood', XRP: 'ripple', SOL: 'solana', DOT: 'polkadot', @@ -147,7 +149,7 @@ const tvl = async (api) => { .map(({ address }) => address) .filter(Boolean) - const evmChains = ['ethereum', 'bsc', 'celo', 'chz', 'polygon', 'arbitrum', 'optimism', 'avax', 'fantom', 'base', 'era', 'manta', 'ronin', 'op_bnb', 'scroll', 'sonic', 'plasma', 'klaytn','sei', 'kava', 'wc'] + const evmChains = ['ethereum', 'bsc', 'celo', 'chz', 'polygon', 'arbitrum', 'arc', 'optimism', 'avax', 'fantom', 'base', 'era', 'manta', 'ronin', 'robinhood', 'op_bnb', 'scroll', 'sonic', 'plasma', 'klaytn','sei', 'kava', 'wc'] const isEvm = evmChains.includes(chain) const lockInfoAddresses = [] From af9cd1ccc0d5836145c6901c4cdf93c8a148a800 Mon Sep 17 00:00:00 2001 From: p22z <216714290+p22z@users.noreply.github.com> Date: Wed, 21 Oct 2026 15:38:16 +0200 Subject: [PATCH 382/988] tulip-capital: add Ember vaults (#21779) --- registries/curators.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/registries/curators.js b/registries/curators.js index dbea3a8de15..848a6d5c2a2 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -1554,6 +1554,8 @@ const configs = { "0xb09f761cb13baca8ec087ac476647361b6314f98", // Lagoon: Flagship cbBTC "0x7a12D4B719F5aA479eCD60dEfED909fb2A37e428", // Lagoon: RockSolid Looped ETH Vault "0xce0b790ae0d8cf91e01f3fb69025e14569b574f3", // Lagoon: Tulipa USDC + "0xaa1d6fa2bc21d5518dcbb0fa37e07b44c9899d26", // Ember: Tulipa Multi-Asset RWA (tulPRWA) + "0xbfda6fb6e61bdeb2a2ce3befebbd4939d0d828aa", // Ember: Enigma ONE USD, co-managed with Hilbert ], }, berachain: { @@ -1591,6 +1593,7 @@ const configs = { base: { erc4626: [ "0x61a8606e04d350dfa1d1aaa68b37260746ae47d4", // Creditcoop: Tulipa Credit Vault + "0x9c2dcdbdb3f0a0f628d1112bbcabd9ae75353df3", // Ember: Syntetika BTC Hilbert Basis+ (hBTC), co-managed with Hilbert ] } } From e9a2c1805285347c0d203a9ebc7d688951d5618e Mon Sep 17 00:00:00 2001 From: ssadkov Date: Wed, 21 Oct 2026 19:56:55 +0500 Subject: [PATCH 383/988] yield-ai: reduce Aptos reads and exclude ThalaAPT/ELON (#21776) Co-authored-by: FelixBruguera --- projects/yield-ai/index.js | 183 ++++++++++++++++++++----------------- 1 file changed, 98 insertions(+), 85 deletions(-) diff --git a/projects/yield-ai/index.js b/projects/yield-ai/index.js index fc884220e37..eae20de6e69 100644 --- a/projects/yield-ai/index.js +++ b/projects/yield-ai/index.js @@ -1,10 +1,11 @@ const ADDRESSES = require("../helper/coreAssets.json"); -const { aQuery, function_view, getResource } = require("../helper/chain/aptos"); +const { aQuery, function_view, getResources } = require("../helper/chain/aptos"); const { GraphQLClient, gql } = require("graphql-request"); const { sliceIntoChunks } = require("../helper/utils"); const { PromisePool } = require("@supercharge/promise-pool"); const sdk = require('@defillama/sdk'); const { getEnv } = require("../helper/env"); +const pLimit = require("p-limit"); const VAULT = "0x333d1890e0aa3762bb256f5caeeb142431862628c63063801f44c152ef154700"; @@ -13,6 +14,8 @@ const ECHELON = "0xc6bc659f1649553c1a3fa05d9727433dc03843baac29473c817d06d39e7621ba"; const ECHELON_VAULT_RESOURCE = `${ECHELON}::lending::Vault`; +const HYPERION_LP_RESOURCE = `${VAULT}::vault::VaultHyperionLp`; +const SAFE_RESOURCE = `${VAULT}::vault::VaultPosition`; const HYPERION_DEX = "0x8b4a2c4bb53857c718a04c020b98f8c2e1f99a68b0f57389a8bf5434cd22e05c"; @@ -25,6 +28,11 @@ const DLP_VAULT = const DLP_SHARE = "0x119860710560b43277b7663ff587081d57f167e2c156de7d60c483028bf9b146"; const USDC = ADDRESSES.aptos.USDC_3; +// These direct balances are intentionally excluded from Yield AI TVL. +const EXCLUDED_DIRECT_ASSETS = new Set([ + "0xfaf4e633ae9eb31366c9ca24214231760926576c7b625313b3688b5e900731f6::staking::ThalaAPT", + "0x51964f09020498a1421a2a3bafe8e1d9fa72574b60446486c599bc6f3e9fae29::echelon_coin::ELON", +]); const INDEXER_URL = "https://api.mainnet.aptoslabs.com/v1/graphql"; const INDEXER_PAGE_SIZE = 100; // the indexer caps responses at 100 rows @@ -33,6 +41,8 @@ const PAGE_SIZE = 50; const OWNER_BATCH_SIZE = 30; const ECHELON_CONCURRENCY = 4; const HYPERION_LP_CONCURRENCY = 8; +const RESOURCE_CONCURRENCY = 4; +const FULLNODE_CONCURRENCY = 4; /** Known Hyperion pools used by Yield AI safes (token_a/token_b = pool canonical order). */ const YIELD_AI_HYPERION_POOLS = [ @@ -70,26 +80,6 @@ function unwrapVector(raw) { return raw; } -function normalizeSafeRow(entry) { - if (Array.isArray(entry)) { - const [safe_address, owner, paused, exists] = entry; - return { safe_address, owner, paused, exists }; - } - return { - safe_address: entry.safe_address ?? entry.safeAddress, - owner: entry.owner, - paused: entry.paused, - exists: entry.exists, - }; -} - -function truthyExists(v) { - if (v === true) return true; - if (v === false || v == null) return false; - if (typeof v === "string") return v === "true" || v === "1"; - return Boolean(v); -} - function normalizeAptosAddress(addr) { if (!addr || typeof addr !== "string") return null; const trimmed = addr.trim(); @@ -132,6 +122,25 @@ async function retryAsync(fn, attempts = 5) { throw lastError; } +/** + * Cap all fullnode reads together. The SDK already retries transient errors (429, 5xx, timeouts); + * a rate limit that outlasts those retries fails the run instead of stalling it into a timeout. + */ +function createFullnodeReader() { + const limit = pLimit(FULLNODE_CONCURRENCY); + let reads = 0; + const read = (fn) => limit(() => { + reads++; + return fn(); + }); + return { + view: (options) => read(() => function_view(options)), + resources: (safe) => read(() => getResources(safe, "aptos")), + query: (path) => read(() => aQuery(path, "aptos")), + get reads() { return reads; }, + }; +} + function unwrapScalar(res) { return Array.isArray(res) ? res[0] : res; } @@ -141,12 +150,12 @@ function unwrapScalar(res) { * own on-chain NAV. Both views return 6-decimal base units, the same as USDC, so * usdc = shares * net_asset_value / num_shares needs no decimal adjustment. */ -async function getDlpNav() { +async function getDlpNav(reader) { // Read both views at one ledger version, so NAV and share count describe the same vault // state even if a contribution or redemption lands between the two calls. - const { ledger_version: ledgerVersion } = await aQuery("/v1", "aptos"); + const { ledger_version: ledgerVersion } = await reader.query("/v1"); const viewAt = (fn) => - function_view({ + reader.view({ functionStr: `${DECIBEL}::vault::${fn}`, args: [DLP_VAULT], ledgerVersion, @@ -158,10 +167,10 @@ async function getDlpNav() { } /** Per-run DLP pricer: the NAV is read once per run, never reused across runs. */ -function createDlpAdder(api) { +function createDlpAdder(api, reader) { let navPromise; return async (sharesRaw) => { - if (!navPromise) navPromise = getDlpNav(); + if (!navPromise) navPromise = getDlpNav(reader); const { nav, shares } = await navPromise; if (shares === 0n) return; const usdc = (BigInt(sharesRaw) * nav) / shares; @@ -301,13 +310,13 @@ function computeAmountsFromLiquidity({ return { amountA: amountAStr, amountB: amountBStr }; } -async function resolveHyperionPoolAddress(pos) { +async function resolveHyperionPoolAddress(pos, reader) { const key = pairKey(pos.tokenA, pos.tokenB); const known = key ? HYPERION_POOL_BY_PAIR.get(key) : null; if (known?.poolAddress) return known.poolAddress; // liquidity_pool_address_safe returns a (bool exists, address) tuple - const res = await function_view({ + const res = await reader.view({ functionStr: `${HYPERION_DEX}::pool_v3::liquidity_pool_address_safe`, args: [pos.tokenA, pos.tokenB, pos.feeTier], chain: "aptos", @@ -316,14 +325,14 @@ async function resolveHyperionPoolAddress(pos) { return exists ? normalizeAptosAddress(addr) : null; } -async function getHyperionPoolCurrentTick(poolAddress, tickCache) { +async function getHyperionPoolCurrentTick(poolAddress, tickCache, reader) { const pool = normalizeAptosAddress(poolAddress); if (!pool) return null; if (tickCache.has(pool)) { return tickCache.get(pool); } - const res = await function_view({ + const res = await reader.view({ functionStr: `${HYPERION_DEX}::pool_v3::current_tick_and_price`, args: [pool], chain: "aptos", @@ -334,7 +343,7 @@ async function getHyperionPoolCurrentTick(poolAddress, tickCache) { return tick; } -async function resolveHyperionPositionAmounts(pos, tickCache) { +async function resolveHyperionPositionAmounts(pos, tickCache, reader) { let amountA = pos.amountA; let amountB = pos.amountB; const hasLiveA = amountA && amountA !== "0"; @@ -342,7 +351,7 @@ async function resolveHyperionPositionAmounts(pos, tickCache) { if (hasLiveA || hasLiveB) return { amountA, amountB }; if (pos.position) { - const routerRes = await function_view({ + const routerRes = await reader.view({ functionStr: `${HYPERION_DEX}::router_v3::get_amount_by_liquidity`, args: [pos.position], chain: "aptos", @@ -359,10 +368,10 @@ async function resolveHyperionPositionAmounts(pos, tickCache) { } } - const poolAddress = await resolveHyperionPoolAddress(pos); + const poolAddress = await resolveHyperionPoolAddress(pos, reader); if (!poolAddress) return { amountA: null, amountB: null }; - const currentTick = await getHyperionPoolCurrentTick(poolAddress, tickCache); + const currentTick = await getHyperionPoolCurrentTick(poolAddress, tickCache, reader); return computeAmountsFromLiquidity({ liquidity: pos.liquidity, tickLower: pos.tickLower, @@ -374,8 +383,8 @@ async function resolveHyperionPositionAmounts(pos, tickCache) { /** * @returns {{ safeAddresses: string[] }} */ -async function fetchExistingSafes() { - const totalRaw = await function_view({ +async function fetchRegisteredSafes(reader) { + const totalRaw = await reader.view({ functionStr: `${VAULT}::vault::get_total_safes`, chain: "aptos", }); @@ -384,17 +393,16 @@ async function fetchExistingSafes() { const safeOut = []; for (let start = 0; start < total; start += PAGE_SIZE) { const limit = Math.min(PAGE_SIZE, total - start); - const pageRaw = await function_view({ - functionStr: `${VAULT}::vault::get_safes_range_info`, + const pageRaw = await reader.view({ + // Owner/policy are unused by TVL. Check existence during the resource read instead. + functionStr: `${VAULT}::vault::get_safes_range`, args: [String(start), String(limit)], chain: "aptos", }); - const rows = unwrapVector(pageRaw).map(normalizeSafeRow); - for (const row of rows) { - if (!truthyExists(row.exists)) continue; + for (const address of unwrapVector(pageRaw)) { // The view returns some safes without leading zeros; the indexer matches owner_address as an // exact 64-hex string, so an unpadded safe would silently lose its fungible-asset balances. - const s = padAptosAddress(row.safe_address); + const s = padAptosAddress(address); if (s) safeOut.push(s); } } @@ -402,31 +410,44 @@ async function fetchExistingSafes() { return { safeAddresses: [...new Set(safeOut)] }; } -async function sumEchelonSafePositions(api, safeAddresses, addDlpAsUsdc) { - if (!safeAddresses.length) return { adds: 0, totalsByAsset: new Map() }; - - // Use vault_exists first so we only read the resource for safes with positions - const safesWithVault = []; - await PromisePool.withConcurrency(ECHELON_CONCURRENCY) +/** A fully paginated resource read replaces both per-safe existence views. */ +async function fetchSafeResources(reader, safeAddresses) { + const { results } = await PromisePool.withConcurrency(RESOURCE_CONCURRENCY) .for(safeAddresses) - .handleError((e) => { throw e; }) // a failed read must fail the run, not drop the safe's TVL + .handleError((e) => { throw e; }) .process(async (safe) => { - const res = await function_view({ - functionStr: `${ECHELON}::lending::vault_exists`, - args: [safe], - chain: "aptos", - }); - const exists = Array.isArray(res) ? res[0] : res; - if (exists === true || exists === "true") safesWithVault.push(safe); + let resources; + try { + resources = await reader.resources(safe); + } catch (e) { + // A registry entry can outlive its object. Other read failures remain fatal. + if ((e.status ?? e.response?.status) === 404 && e.errorCode === "account_not_found") return null; + throw e; + } + if (!Array.isArray(resources)) throw new Error(`Invalid resources for safe ${safe}`); + // Matches get_safes_range_info's object::object_exists check. + if (!resources.some(({ type }) => type === "0x1::object::ObjectCore") || + !resources.some(({ type }) => type === SAFE_RESOURCE)) return null; + const vault = resources.find(({ type }) => type === ECHELON_VAULT_RESOURCE); + if (vault && (!vault.data || typeof vault.data !== "object")) + throw new Error(`Invalid Echelon resource for safe ${safe}`); + return { + safe, + echelonVault: vault?.data, + hasHyperion: resources.some(({ type }) => type === HYPERION_LP_RESOURCE), + }; }); + return results.filter(Boolean); +} +async function sumEchelonSafePositions(api, safeResources, addDlpAsUsdc, reader) { const marketMetadataCache = new Map(); let adds = 0; const totalsByAsset = new Map(); async function getMarketMetadata(market) { if (!marketMetadataCache.has(market)) { - const metadata = await function_view({ + const metadata = await reader.view({ functionStr: `${ECHELON}::lending::market_asset_metadata`, args: [market], chain: "aptos", @@ -440,12 +461,10 @@ async function sumEchelonSafePositions(api, safeAddresses, addDlpAsUsdc) { } await PromisePool.withConcurrency(ECHELON_CONCURRENCY) - .for(safesWithVault) + .for(safeResources.filter(({ echelonVault }) => echelonVault)) .handleError((e) => { throw e; }) // a failed read must fail the run, not drop the safe's TVL - .process(async (safe) => { - const vault = await getResource(safe, ECHELON_VAULT_RESOURCE, "aptos"); - const collaterals = - vault?.data?.collaterals?.data || vault?.collaterals?.data || []; + .process(async ({ safe, echelonVault }) => { + const collaterals = echelonVault.collaterals?.data || []; for (const collateral of collaterals) { const market = padAptosAddress( @@ -453,7 +472,7 @@ async function sumEchelonSafePositions(api, safeAddresses, addDlpAsUsdc) { ); if (!market) continue; - const coins = await function_view({ + const coins = await reader.view({ functionStr: `${ECHELON}::lending::account_coins`, args: [safe, market], chain: "aptos", @@ -476,12 +495,14 @@ async function sumEchelonSafePositions(api, safeAddresses, addDlpAsUsdc) { } async function tvl(api) { - const { safeAddresses } = await fetchExistingSafes(); + const reader = createFullnodeReader(); + const registered = await fetchRegisteredSafes(reader); + const safeResources = await fetchSafeResources(reader, registered.safeAddresses); + const safeAddresses = safeResources.map(({ safe }) => safe); if (!safeAddresses.length) return; - - const addDlpAsUsdc = createDlpAdder(api); + const addDlpAsUsdc = createDlpAdder(api, reader); const { adds: echelonAdds, totalsByAsset: echelonTotalsByAsset } = - await sumEchelonSafePositions(api, safeAddresses, addDlpAsUsdc); + await sumEchelonSafePositions(api, safeResources, addDlpAsUsdc, reader); // the SDK sends the same key on fullnode views const indexerHeaders = {}; @@ -504,6 +525,7 @@ async function tvl(api) { ); for (const row of rows) { + if (EXCLUDED_DIRECT_ASSETS.has(row.asset_type)) continue; const amtStr = toIntegerString(row.amount); if (!amtStr || amtStr === "0" || /^-/.test(amtStr)) continue; @@ -523,20 +545,10 @@ async function tvl(api) { const tickCache = new Map(); await PromisePool.withConcurrency(HYPERION_LP_CONCURRENCY) - .for(safeAddresses) - .handleError((e) => { throw e; }) // throws on public rpcs instead of dropping hyperion tvl - .process(async (safe) => { - const configRes = await function_view({ - functionStr: `${VAULT}::vault::hyperion_lp_config_exists`, - args: [safe], - chain: "aptos", - }); - const configFlag = Array.isArray(configRes) ? configRes[0] : configRes; - const configExists = - configFlag === true || configFlag === "true" || configFlag === 1 || configFlag === "1"; - if (!configExists) return; - - const positionsRaw = await function_view({ + .for(safeResources.filter(({ hasHyperion }) => hasHyperion)) + .handleError((e) => { throw e; }) // required position reads must not drop Hyperion TVL + .process(async ({ safe }) => { + const positionsRaw = await reader.view({ functionStr: `${VAULT}::vault::get_hyperion_positions`, args: [safe], chain: "aptos", @@ -546,7 +558,7 @@ async function tvl(api) { if (!positionAddresses.length) return; for (const positionAddr of positionAddresses) { - const posRaw = await function_view({ + const posRaw = await reader.view({ functionStr: `${VAULT}::vault::get_hyperion_position`, args: [safe, positionAddr], chain: "aptos", @@ -555,7 +567,7 @@ async function tvl(api) { const pos = normalizeHyperionPosition(posRaw, positionAddr); if (!pos || pos.closed) continue; - const { amountA, amountB } = await resolveHyperionPositionAmounts(pos, tickCache); + const { amountA, amountB } = await resolveHyperionPositionAmounts(pos, tickCache, reader); if (amountA && amountA !== "0" && pos.tokenA) { hyperionAdds += 1; @@ -576,13 +588,14 @@ async function tvl(api) { sdk.log( `Yield AI TVL: safes=${safeAddresses.length} | FA=${faTotalsByAsset.size} assets | ` + `Echelon=${echelonAdds} cells/${echelonTotalsByAsset.size} assets | ` + - `Hyperion=${hyperionAdds} cells/${hyperionTotalsByAsset.size} assets` + `Hyperion=${hyperionAdds} cells/${hyperionTotalsByAsset.size} assets | Fullnode=${reader.reads} reads` ); } module.exports = { timetravel: false, + isHeavyProtocol: true, doublecounted: true, aptos: { tvl }, - methodology: "Counts fungible-asset balances on Yield AI safe addresses, including native APT (Aptos indexer), Echelon supply positions held by safes, and open Hyperion CLMM LP positions. Decibel DLP vault shares (held or posted as Echelon collateral) are counted as USDC at the vault's on-chain net asset value per share. Echelon, Hyperion and Decibel are also tracked as separate protocols (doublecounted: true).", + methodology: "Counts fungible-asset balances on Yield AI safe addresses, including native APT (Aptos indexer), Echelon supply positions held by safes, and open Hyperion CLMM LP positions. Direct ThalaAPT and ELON balances are excluded. Decibel DLP vault shares (held or posted as Echelon collateral) are counted as USDC at the vault's on-chain net asset value per share. Echelon, Hyperion and Decibel are also tracked as separate protocols (doublecounted: true).", }; From ce05b7f02e1d9543a2b8192344b02baa0b8d3314 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Wed, 21 Oct 2026 16:57:47 +0200 Subject: [PATCH 384/988] Track Bitget reserves on nine additional chains (#21785) --- projects/bitget/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/bitget/index.js b/projects/bitget/index.js index 8a7c2fe3978..28a6a1fa2a4 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -86,7 +86,7 @@ const evmOwners = [ "0xa4856e07d14045014b2c3fece5460bd37b310f10", // add on 05/10/2026 ] -const evmChains = ["bsc","ethereum","arbitrum","optimism","era","fantom","cronos","avax","polygon","metis","kava","klaytn","base","hyperliquid","sonic","morph"] +const evmChains = ["bsc","ethereum","arbitrum","optimism","era","fantom","cronos","avax","polygon","metis","kava","klaytn","base","hyperliquid","sonic","morph","plasma","robinhood","arc","sei","monad","linea","scroll","wc","megaeth"] const config = { tron: { From 5c73bf5f0c085c6f6ffa734bf5d619cd3b10ff69 Mon Sep 17 00:00:00 2001 From: Guille Escobero <15904345+GuillermoEscobero@users.noreply.github.com> Date: Wed, 21 Oct 2026 23:19:34 +0800 Subject: [PATCH 385/988] zircuit-finance: track all strategies via StrategyManager.getStrategies() (#21782) --- projects/zircuit-finance/index.js | 43 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/projects/zircuit-finance/index.js b/projects/zircuit-finance/index.js index 628245bebbf..0a782c7fd2b 100644 --- a/projects/zircuit-finance/index.js +++ b/projects/zircuit-finance/index.js @@ -3,43 +3,42 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const config = { base: { - // Aave strategies: track aToken balances directly - aaveStrategies: [ - ['0x4e65fE4DbA92790696d040ac24Aa414708F5c0AB', '0xc91E44E9302288FE5Df24d6392875E5069E1aca7'], // aBasUSDC held by Aave V3 USDC strategy + // Strategy managers: every strategy they list is an ERC4626, use totalAssets + strategyManagers: [ + '0xf7E745658fa6f1fe8f2CAb47861a273991Cd3374', // USDC SM + '0x075193D36693DA7BA3Bb709cF63bEf070BA04D94', // USDT SM ], - // Monarq strategies: no discoverable yield token, use ERC4626 totalAssets - erc4626Strategies: [ - '0xe83EF4375d806c02387069f1b753b2ab76ab1dc5', // Monarq USDC Lender - '0x1A48Cec817Bcb5436EFE99BAb6dDe228Cc37e1Cc', // Monarq USDT Lender - ], - // Idle funds in strategy managers + // Idle funds in strategy managers and OFTs idleFunds: [ [ADDRESSES.base.USDC, '0xf7E745658fa6f1fe8f2CAb47861a273991Cd3374'], // USDC SM [ADDRESSES.base.USDT, '0x075193D36693DA7BA3Bb709cF63bEf070BA04D94'], // USDT SM + [ADDRESSES.base.USDC, '0xd7aBC360dfcF1B6dD0a03138235e12A2bc1c1C8B'], // USDC OFT + [ADDRESSES.base.USDT, '0x264D6474802Ef8bc1bc05F89F7d640D1E93c5330'], // USDT OFT ], }, ethereum: { - aaveStrategies: [ - ['0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c', '0x28966Ce36d0F25858dc5d10DfC2829F05C332C49'], // aEthUSDC held by Aave V3 USDC strategy - ['0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a', '0x6424c7548e214f89B64Ea5981c5A0c5Ec22b6e38'], // aEthUSDT held by Aave V3 USDT strategy + strategyManagers: [ + '0xf7E745658fa6f1fe8f2CAb47861a273991Cd3374', // USDC SM + '0x075193D36693DA7BA3Bb709cF63bEf070BA04D94', // USDT SM + ], + idleFunds: [ + [ADDRESSES.ethereum.USDC, '0xf7E745658fa6f1fe8f2CAb47861a273991Cd3374'], // USDC SM + [ADDRESSES.ethereum.USDT, '0x075193D36693DA7BA3Bb709cF63bEf070BA04D94'], // USDT SM + [ADDRESSES.ethereum.USDC, '0xd58E8c1c83d598aD76B5f0E26B4a25cdB885d190'], // USDC OFT Adapter + [ADDRESSES.ethereum.USDT, '0x2D342De4c58a871b3525740C58a1C112D5835865'], // USDT OFT Adapter ], - erc4626Strategies: [], - idleFunds: [], }, } Object.keys(config).forEach(chain => { - const { aaveStrategies, erc4626Strategies, idleFunds } = config[chain] + const { strategyManagers, idleFunds } = config[chain] module.exports[chain] = { tvl: async (api) => { - // Track aToken balances directly for Aave strategies - const tokensAndOwners = [...aaveStrategies, ...idleFunds] - - // Use ERC4626 totalAssets for Monarq strategies (mapped to underlying USDC/USDT) - if (erc4626Strategies.length) - await api.erc4626Sum({ calls: erc4626Strategies, isOG4626: true }) + // Use ERC4626 totalAssets for every strategy listed by the strategy managers + const strategies = await api.multiCall({ abi: 'address[]:getStrategies', calls: strategyManagers }) + await api.erc4626Sum({ calls: strategies.flat(), isOG4626: true }) - return sumTokens2({ api, tokensAndOwners }) + return sumTokens2({ api, tokensAndOwners: idleFunds }) } } }) From 6b81f9190a015864fe9915856dcb58847303ac8d Mon Sep 17 00:00:00 2001 From: Dmitrii Krasovskikh Date: Wed, 21 Oct 2026 21:16:34 +0300 Subject: [PATCH 386/988] - extended, add ARC chain; (#21790) --- registries/sumTokens/data1.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/registries/sumTokens/data1.js b/registries/sumTokens/data1.js index 1a8cd248d98..61f874b99b1 100644 --- a/registries/sumTokens/data1.js +++ b/registries/sumTokens/data1.js @@ -379,6 +379,17 @@ module.exports = { ADDRESSES.starknet.ETH, ADDRESSES.starknet.USDT ] + }, + "arc": { + "owners": [ + "0x4445AACaCC2dE174B77b37Eb27529ce0B36bC580", + "0x89103959Eef431bEa308027b8A5073c5ddc867A2" + ], + "tokens": [ + ADDRESSES.arc.USDC, + ADDRESSES.arc.WETH, + ADDRESSES.arc.cirBTC + ] } }, "Duality": { From 0bf6865e5c31bfc6dca539357228459089a1b8a4 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 21 Oct 2026 19:29:07 +0100 Subject: [PATCH 387/988] fixes (#21788) --- projects/bucket-protocol-v2/utils.js | 8 +--- projects/helper/bitcoin-book/fetchers.js | 3 ++ projects/lombard-btcb/index.js | 10 +++-- projects/rnt-lend/index.js | 57 ++++++++++++++++++++++++ projects/theo-network-thusd/index.js | 8 +++- 5 files changed, 75 insertions(+), 11 deletions(-) create mode 100644 projects/rnt-lend/index.js diff --git a/projects/bucket-protocol-v2/utils.js b/projects/bucket-protocol-v2/utils.js index 823f87e933a..fd227b2bd32 100644 --- a/projects/bucket-protocol-v2/utils.js +++ b/projects/bucket-protocol-v2/utils.js @@ -126,12 +126,8 @@ function mappingTokenAsset(type){ return ADDRESSES.sui.USDC case '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI': return ADDRESSES.sui.SUI - case '0x876a4b7bce8aeaef60464c11f4026903e9afacab79b9b142686158aa86560b50::xbtc::XBTC': - return ADDRESSES.sui.BTC - case '0x7438e8caf5c345fbd3772517380bf0ca432f53892dee65ee0dda3eb127993cd9::bfbtc::BFBTC': - return ADDRESSES.sui.BTC - case '0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC': - return ADDRESSES.sui.BTC + // xBTC, bfBTC and bridged wBTC price on their own coin types; mapping them onto sui.BTC marked + // bfBTC, a yield-bearing LST worth 1.1145 BTC per share, at 1 BTC and hid which one moved default: return type } diff --git a/projects/helper/bitcoin-book/fetchers.js b/projects/helper/bitcoin-book/fetchers.js index 50f543d38ab..1fce0f751c8 100644 --- a/projects/helper/bitcoin-book/fetchers.js +++ b/projects/helper/bitcoin-book/fetchers.js @@ -168,6 +168,9 @@ module.exports = { while (hasMore) { const { addresses: data, has_more } = await get(`${API_URL}?limit=${BATCH_SIZE}&offset=${offset}`); + if (!Array.isArray(data)) throw new Error(`lombard: bad address page at offset ${offset}`) + if (has_more && data.length < BATCH_SIZE) + throw new Error(`lombard: short page (${data.length}) at offset ${offset} with has_more set`) const newAddresses = data.map(a => a.btc_address); allAddresses.push(...newAddresses); diff --git a/projects/lombard-btcb/index.js b/projects/lombard-btcb/index.js index 4306608ea1a..bda259de40d 100644 --- a/projects/lombard-btcb/index.js +++ b/projects/lombard-btcb/index.js @@ -17,10 +17,14 @@ async function tvl(api) { ) const lbtcBackingInBTC = Number(data.balance) / 1e8 + if (!(lbtcBackingInBTC > 0)) throw new Error(`lombard-btcb: bad staking vault balance: ${data?.balance}`) - if (balances.bitcoin) { - balances.bitcoin = balances.bitcoin - lbtcBackingInBTC - } + // vault base balance is a subset of the deposit addresses, so a gross below it means a short read + // (equality is legitimate: it just means every deposited sat backs LBTC and this adapter nets to 0) + if (!(balances.bitcoin >= lbtcBackingInBTC)) + throw new Error(`lombard-btcb: gross ${balances.bitcoin} BTC below LBTC backing ${lbtcBackingInBTC} BTC`) + + balances.bitcoin = balances.bitcoin - lbtcBackingInBTC return balances } diff --git a/projects/rnt-lend/index.js b/projects/rnt-lend/index.js new file mode 100644 index 00000000000..04d1cbb0012 --- /dev/null +++ b/projects/rnt-lend/index.js @@ -0,0 +1,57 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// RNT Lend — Reental's Aave V3 fork on Polygon (RWA real-estate tokens as collateral, USDT0/USDC as borrowable assets) +// Pool: 0x67dC8037Db6309Dd5571D82c65F5f593F7da1505 +// PoolAddressesProvider: 0x717c2a6fa0820b04b9d4793daca33a229aec85ca +const POOL_DATA_PROVIDER = '0x5542ac41138f6a52a13c644f1db56bada71a4021' +const AAVE_ORACLE = '0x9e313d8cda997dceea20bea444720702958cd0f3' + +const abi = { + getAllReservesTokens: 'function getAllReservesTokens() view returns ((string symbol, address tokenAddress)[])', + getReserveTokensAddresses: 'function getReserveTokensAddresses(address asset) view returns (address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress)', + getReserveData: 'function getReserveData(address asset) view returns (uint256 unbacked, uint256 accruedToTreasuryScaled, uint256 totalAToken, uint256 totalStableDebt, uint256 totalVariableDebt, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, uint256 averageStableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex, uint40 lastUpdateTimestamp)', + getAssetsPrices: 'function getAssetsPrices(address[] assets) view returns (uint256[])', + BASE_CURRENCY_UNIT: 'uint256:BASE_CURRENCY_UNIT', +} + +// Assets DefiLlama already prices; everything else is a Reental property token (1 token = 100 EUR or 100 USD) +// that has no market price, so it is valued with the protocol's own AaveOracle (USD, 8 decimals). +const PRICED = new Set([ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC_CIRCLE].map(a => a.toLowerCase())) + +async function getReserves(api) { + const reserves = (await api.call({ target: POOL_DATA_PROVIDER, abi: abi.getAllReservesTokens })).map(r => r.tokenAddress) + const [decimals, prices, baseUnit] = await Promise.all([ + api.multiCall({ abi: 'erc20:decimals', calls: reserves }), + api.call({ target: AAVE_ORACLE, abi: abi.getAssetsPrices, params: [reserves] }), + api.call({ target: AAVE_ORACLE, abi: abi.BASE_CURRENCY_UNIT }), + ]) + return { reserves, decimals, prices, baseUnit } +} + +function addAmount(api, token, amount, decimals, price, baseUnit) { + if (!+amount) return + if (PRICED.has(token.toLowerCase())) return api.add(token, amount) + api.addUSDValue((Number(amount) / 10 ** Number(decimals)) * (Number(price) / Number(baseUnit))) +} + +async function tvl(api) { + const { reserves, decimals, prices, baseUnit } = await getReserves(api) + const tokenAddresses = await api.multiCall({ target: POOL_DATA_PROVIDER, abi: abi.getReserveTokensAddresses, calls: reserves }) + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls: reserves.map((token, i) => ({ target: token, params: tokenAddresses[i].aTokenAddress })) }) + reserves.forEach((token, i) => addAmount(api, token, balances[i], decimals[i], prices[i], baseUnit)) +} + +async function borrowed(api) { + const { reserves, decimals, prices, baseUnit } = await getReserves(api) + const data = await api.multiCall({ target: POOL_DATA_PROVIDER, abi: abi.getReserveData, calls: reserves }) + reserves.forEach((token, i) => { + const debt = BigInt(data[i].totalVariableDebt) + BigInt(data[i].totalStableDebt) + addAmount(api, token, debt.toString(), decimals[i], prices[i], baseUnit) + }) +} + +module.exports = { + misrepresentedTokens: true, + methodology: 'TVL is the balance of every reserve asset held by its aToken in the RNT Lend pool (Aave V3 fork). Borrowed is the total variable + stable debt of each reserve. USDT0 and USDC are priced by DefiLlama; Reental real-estate tokens (1 token = 100 EUR/USD of property) have no market price and are valued with the pool\'s own AaveOracle.', + polygon: { tvl, borrowed }, +} diff --git a/projects/theo-network-thusd/index.js b/projects/theo-network-thusd/index.js index a4e99faf207..51b25dd580b 100644 --- a/projects/theo-network-thusd/index.js +++ b/projects/theo-network-thusd/index.js @@ -9,12 +9,14 @@ const RESERVE = '0xEc417Ccb6dD26868Cca993a92F37217b1D4b3c2f' // thUSD reserve wa module.exports = { start: '2026-04-09', // thUSD deployed 2026-04-08 + misrepresentedTokens: true, // the off-chain metal residual is booked as USDC, not as the asset actually held methodology: 'thUSD TVL equals circulating thUSD supply, built from the reserve side. On-chain reserves held in the ' + 'thUSD reserve wallet — thBILL (valued at thBILL contract NAV via convertToAssets, not market price), ' + 'USDC and USDT — are reported as those assets. The remainder of supply is backed by physical gold and silver ' + 'purchased and leased through StoneX and Monetary Metals, part of it tokenized as thGOLD and thSLVR held in the ' + - 'reserve wallet, with the gold position hedged with CME gold futures, and is reported as thUSD. thBILL held in ' + + 'reserve wallet, with the gold position hedged with CME gold futures, and is reported as USDC — a dollar ' + + 'amount rather than a token balance, hence misrepresentedTokens. thBILL held in ' + 'the reserve is also tracked by the Theo Network thBILL adapter, which is flagged doublecounted under the Theo ' + 'Network parent.', hallmarks: [ @@ -46,8 +48,10 @@ module.exports = { // 3. Off-chain metal reserves = the remainder of supply not covered by on-chain reserves. // Added unconditionally, as in projects/ethena, so the total is always exactly thUSD supply: // were on-chain reserves ever to exceed supply, this residual goes negative and nets it back down. + // Booked as USDC (also 6 decimals): the residual is a dollar quantity, and thUSD's own mark is a + // CoinGecko feed off two stale Uniswap V4 pools that goes unpriced whenever it stops updating. const onchainUsd = await api.getBalancesV2().getUSDValue() - api.add(thUSD, supply - onchainUsd * 1e6) + api.add(ADDRESSES.ethereum.USDC, supply - onchainUsd * 1e6) }, }, } From 24fea9b979b2ff08059b317e1715c722a9bdb7fb Mon Sep 17 00:00:00 2001 From: Jasper <104004836+j-vp@users.noreply.github.com> Date: Wed, 21 Oct 2026 20:37:29 +0200 Subject: [PATCH 388/988] feat(arcadia-finance-v2): count Aero MetadexCL positions (#7) (#21744) --- projects/arcadia-finance-v2/index.js | 71 ++++++++++++++++++++++++---- projects/helper/unwrapLPs.js | 57 ++++++++++++++++++---- 2 files changed, 108 insertions(+), 20 deletions(-) diff --git a/projects/arcadia-finance-v2/index.js b/projects/arcadia-finance-v2/index.js index 9a3f566c50d..e0c121b29c5 100644 --- a/projects/arcadia-finance-v2/index.js +++ b/projects/arcadia-finance-v2/index.js @@ -19,6 +19,13 @@ const config = { wsSlipNFT: "0xD74339e0F10fcE96894916B93E5Cc7dE89C98272".toLowerCase(), wsSlipV2NFT: "0x147a2ccbaf4521ad209a2875ae0b3c496f4b25a4".toLowerCase(), wsSlipV3NFT: "0x9189BC25f8faC157B4D87b0b3c14F56bA1477d53".toLowerCase(), + metadexCLNFT: "0x4857DB576eE0e45F10525eC59527BfD10beeC60b", + sMetadexCLNFT: "0x0f34F7F7B558F43a821AF4181f0F8e5bC4B74892".toLowerCase(), + wsMetadexCLNFT: "0x323808A037628F2BaF4F42784E011FCf9C49A88b".toLowerCase(), + wMetadexNFT: "0x7cb5383BBa39b1634DA39f104364203846c240d9".toLowerCase(), // WrappedMetadex03AM + sMetadexNFT: "0x3964135f8E8A356231459c86e65f51a599F2Bbb2".toLowerCase(), // StakedMetadex03AM + wMetadexSpotNFT: "0xd3C5c8a4dDeB05d22646D04DA65220218FbE7919".toLowerCase(), // WrappedMetadex + wsMetadexNFT: "0x401875CD07c804aC887DC9eCE3D631b80dF24fAd".toLowerCase(), // WrappedStakedMetadex pools: [ "0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2", // wethPool "0x3ec4a293Fb906DD2Cd440c20dECB250DeF141dF1", // usdcPool @@ -40,6 +47,13 @@ const config = { sSlipV3NFT: "0xF6a87d944204bb5Fdb9CF5534c03c46895f78eCd".toLowerCase(), wsSlipNFT: "0xD74339e0F10fcE96894916B93E5Cc7dE89C98272".toLowerCase(), wsSlipV3NFT: "0xC4D3d804ed64C1f78097799208D46b1db4252749".toLowerCase(), + metadexCLNFT: "0x4857DB576eE0e45F10525eC59527BfD10beeC60b", + sMetadexCLNFT: "0x0f34F7F7B558F43a821AF4181f0F8e5bC4B74892".toLowerCase(), + wsMetadexCLNFT: "0x323808A037628F2BaF4F42784E011FCf9C49A88b".toLowerCase(), + wMetadexNFT: "0x7cb5383BBa39b1634DA39f104364203846c240d9".toLowerCase(), // WrappedMetadex03AM + sMetadexNFT: "0x3964135f8E8A356231459c86e65f51a599F2Bbb2".toLowerCase(), // StakedMetadex03AM + wMetadexSpotNFT: "0xd3C5c8a4dDeB05d22646D04DA65220218FbE7919".toLowerCase(), // WrappedMetadex + wsMetadexNFT: "0x401875CD07c804aC887DC9eCE3D631b80dF24fAd".toLowerCase(), // WrappedStakedMetadex pools: [ "0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2", // wethPool "0x3ec4a293Fb906DD2Cd440c20dECB250DeF141dF1", // usdcPool @@ -52,8 +66,14 @@ const config = { factory: "0xDa14Fdd72345c4d2511357214c5B89A919768e59", uniNFT: "0x73991a25C818Bf1f1128dEAaB1492D45638DE0D3", uniV4NFT: "0x58daec3116aae6D93017bAAea7749052E8a04fA7", - // Neither Slipstream nor Aerodrome is deployed on Robinhood, so Arcadia - // registers only the Uniswap V3 and V4 asset modules there. + // Robinhood has Aero's Metadex (CL and vanilla pools) but no Slipstream V1-V3 or Aerodrome V1 deployment. + metadexCLNFT: "0x4857DB576eE0e45F10525eC59527BfD10beeC60b", + sMetadexCLNFT: "0x0f34F7F7B558F43a821AF4181f0F8e5bC4B74892".toLowerCase(), + wsMetadexCLNFT: "0x323808A037628F2BaF4F42784E011FCf9C49A88b".toLowerCase(), + wMetadexNFT: "0x7cb5383BBa39b1634DA39f104364203846c240d9".toLowerCase(), // WrappedMetadex03AM + sMetadexNFT: "0x3964135f8E8A356231459c86e65f51a599F2Bbb2".toLowerCase(), // StakedMetadex03AM + wMetadexSpotNFT: "0xd3C5c8a4dDeB05d22646D04DA65220218FbE7919".toLowerCase(), // WrappedMetadex + wsMetadexNFT: "0x401875CD07c804aC887DC9eCE3D631b80dF24fAd".toLowerCase(), // WrappedStakedMetadex pools: [ "0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2", // wethPool "0xf37c0C5996503Fdd2b5CCCE36E659cD30393AE59", // usdgPool @@ -77,12 +97,17 @@ const config = { }; async function unwrapArcadiaAeroLP({ api, ownerIds, chainConfig }) { - const { wAeroNFT, sAeroNFT, sSlipNFT, sSlipV2NFT, sSlipV3NFT, wsSlipNFT, wsSlipV2NFT, wsSlipV3NFT, slipNFT, slipV2NFT, slipV3NFT } = chainConfig + const { wAeroNFT, sAeroNFT, sSlipNFT, sSlipV2NFT, sSlipV3NFT, wsSlipNFT, wsSlipV2NFT, wsSlipV3NFT, slipNFT, slipV2NFT, slipV3NFT, metadexCLNFT, sMetadexCLNFT, wsMetadexCLNFT, wMetadexNFT, sMetadexNFT, wMetadexSpotNFT, wsMetadexNFT } = chainConfig const wAERONFTIds = [] const sAERONFTIds = [] + const wMetadexNftIds = [] + const sMetadexNftIds = [] + const wMetadexSpotNftIds = [] + const wsMetadexNftIds = [] const sSlipNftIds = [] const sSlipV2NftIds = [] const sSlipV3NftIds = [] + const sMetadexCLNftIds = [] // for each asset address owned by an account // check if the asset is the wrapped or staked aero asset module @@ -99,6 +124,18 @@ async function unwrapArcadiaAeroLP({ api, ownerIds, chainConfig }) { case sAeroNFT: sAERONFTIds.push(ids[i]); break; + case wMetadexNFT: + wMetadexNftIds.push(ids[i]); + break; + case sMetadexNFT: + sMetadexNftIds.push(ids[i]); + break; + case wMetadexSpotNFT: + wMetadexSpotNftIds.push(ids[i]); + break; + case wsMetadexNFT: + wsMetadexNftIds.push(ids[i]); + break; case sSlipNFT: sSlipNftIds.push(ids[i]); break; @@ -117,16 +154,27 @@ async function unwrapArcadiaAeroLP({ api, ownerIds, chainConfig }) { case wsSlipV3NFT: sSlipV3NftIds.push(ids[i]); break; + case sMetadexCLNFT: + sMetadexCLNftIds.push(ids[i]); + break; + case wsMetadexCLNFT: + sMetadexCLNftIds.push(ids[i]); + break; } } } - if (wAeroNFT && wAERONFTIds.length) { - const wrappedData = await api.multiCall({ abi: abi.positionState, calls: wAERONFTIds, target: wAeroNFT }); + // Aerodrome V1 and Metadex vanilla wrappers share one positionState layout, as do their staking modules + const wrappedModules = [[wAeroNFT, wAERONFTIds], [wMetadexNFT, wMetadexNftIds], [wMetadexSpotNFT, wMetadexSpotNftIds]] + const stakedModules = [[sAeroNFT, sAERONFTIds], [sMetadexNFT, sMetadexNftIds], [wsMetadexNFT, wsMetadexNftIds]] + for (const [target, calls] of wrappedModules) { + if (!target || !calls.length) continue; + const wrappedData = await api.multiCall({ abi: abi.positionState, calls, target }); wrappedData.forEach((data) => api.add(data.pool, data.amountWrapped)); } - if (sAeroNFT && sAERONFTIds.length) { - const stakedData = await api.multiCall({ abi: abi.stakedAeroPositionState, calls: sAERONFTIds, target: sAeroNFT }); + for (const [target, calls] of stakedModules) { + if (!target || !calls.length) continue; + const stakedData = await api.multiCall({ abi: abi.stakedAeroPositionState, calls, target }); stakedData.forEach((data) => api.add(data.pool, data.amountStaked)); } @@ -139,6 +187,9 @@ async function unwrapArcadiaAeroLP({ api, ownerIds, chainConfig }) { if (slipV3NFT) { await uwrapStakedSlipstreamLP({ api, sSlipNftIds: sSlipV3NftIds, nft: slipV3NFT }); } + if (metadexCLNFT) { + await uwrapStakedSlipstreamLP({ api, sSlipNftIds: sMetadexCLNftIds, nft: metadexCLNFT }); + } } async function uwrapStakedSlipstreamLP({ api, sSlipNftIds, nft, }) { @@ -150,8 +201,8 @@ async function uwrapStakedSlipstreamLP({ api, sSlipNftIds, nft, }) { async function tvl (api) { const chainConfig = config[api.chain]; - const { factory, pools, uniNFT, uniV4NFT, slipNFT, slipV2NFT, slipV3NFT, wAeroNFT, sAeroNFT, sSlipNFT, sSlipV2NFT, sSlipV3NFT, alienBaseNFT, wsSlipNFT, wsSlipV2NFT, wsSlipV3NFT, resolveSlipstreamV2, resolveSlipstreamV3, chainId } = chainConfig; - const allNfts = [uniNFT, uniV4NFT, slipNFT, slipV2NFT, slipV3NFT, wAeroNFT, sAeroNFT, sSlipNFT, sSlipV2NFT, sSlipV3NFT, alienBaseNFT, wsSlipNFT, wsSlipV2NFT, wsSlipV3NFT].filter(Boolean); + const { factory, pools, uniNFT, uniV4NFT, slipNFT, slipV2NFT, slipV3NFT, wAeroNFT, sAeroNFT, sSlipNFT, sSlipV2NFT, sSlipV3NFT, alienBaseNFT, wsSlipNFT, wsSlipV2NFT, wsSlipV3NFT, metadexCLNFT, sMetadexCLNFT, wsMetadexCLNFT, wMetadexNFT, sMetadexNFT, wMetadexSpotNFT, wsMetadexNFT, resolveSlipstreamV2, resolveSlipstreamV3, chainId } = chainConfig; + const allNfts = [uniNFT, uniV4NFT, slipNFT, slipV2NFT, slipV3NFT, wAeroNFT, sAeroNFT, sSlipNFT, sSlipV2NFT, sSlipV3NFT, alienBaseNFT, wsSlipNFT, wsSlipV2NFT, wsSlipV3NFT, metadexCLNFT, sMetadexCLNFT, wsMetadexCLNFT, wMetadexNFT, sMetadexNFT, wMetadexSpotNFT, wsMetadexNFT].filter(Boolean); const ownerTokens = [] const ownerIds = [] const accs = [] @@ -251,7 +302,7 @@ async function tvl (api) { if (uniV4Ids.length > 0) { await sumTokens2({ api, resolveUniV4: true, uniV4ExtraConfig: {"positionIds":uniV4Ids}}) } - return sumTokens2({ api, owners: accs, resolveUniV3: true, resolveSlipstream: !!slipNFT, resolveSlipstreamV2: !!resolveSlipstreamV2, resolveSlipstreamV3: !!resolveSlipstreamV3 }) + return sumTokens2({ api, owners: accs, resolveUniV3: true, resolveSlipstream: !!slipNFT, resolveSlipstreamV2: !!resolveSlipstreamV2, resolveSlipstreamV3: !!resolveSlipstreamV3, resolveMetadexCL: !!metadexCLNFT }) } module.exports = { diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 5382ae9d135..61b4e0f4699 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -563,7 +563,36 @@ async function unwrapSlipstreamV3NFTs({ balances, nftsAndOwners = [], api, owner return balances } -async function getPositionIdsByNftAddress({ api, nftsAndOwners, }) { +// Aero (MetaDEX) CL NonfungiblePositionManager ("AERO-CL"), same address on every chain it is deployed on. +// Its positions(), the CLFactory's getPool(token0, token1, int24 tickSpacing) and the pool's slot0() share the +// Slipstream layout, so unwrapSlipstreamNFT resolves its positions. +const metadexCLNFTs = { + base: '0x4857DB576eE0e45F10525eC59527BfD10beeC60b', + optimism: '0x4857DB576eE0e45F10525eC59527BfD10beeC60b', + robinhood: '0x4857DB576eE0e45F10525eC59527BfD10beeC60b', +} + +async function unwrapMetadexCLNFTs({ balances, nftsAndOwners = [], api, owner, nftAddress, owners, blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {} }) { + const chain = api.chain + if (!nftsAndOwners.length) { + if (!nftAddress) nftAddress = metadexCLNFTs[chain] + // no MetadexCL deployment on this chain, so there is nothing to resolve + if (!nftAddress) return balances + + if ((!owners || !owners.length) && owner) + owners = [owner] + owners = getUniqueAddresses(owners, chain) + nftsAndOwners = owners.map(o => [nftAddress, o]) + } + // before the position manager is deployed (historical runs) balanceOf has no code to call; count that as no positions + const positionIdsByNftAddress = await getPositionIdsByNftAddress({ api, nftsAndOwners, permitFailure: true, }) + for (const [nftAddress, positionIds] of Object.entries(positionIdsByNftAddress)) { + await unwrapSlipstreamNFT({ balances, positionIds, nftAddress, api, blacklistedTokens, whitelistedTokens, uniV3ExtraConfig, }) + } + return balances +} + +async function getPositionIdsByNftAddress({ api, nftsAndOwners, permitFailure = false, }) { const ownersByNFT = {} nftsAndOwners.forEach(([nftAddress, owner]) => { nftAddress = normalizeAddress(nftAddress, api.chain) @@ -574,7 +603,7 @@ async function getPositionIdsByNftAddress({ api, nftsAndOwners, }) { const positionIdsByNftAddress = {} for (let [nftAddress, owners] of Object.entries(ownersByNFT)) { owners = Array.from(owners) - const positionIdBalances = await api.multiCall({ abi: 'erc20:balanceOf', target: nftAddress, calls: owners }) + const positionIdBalances = await api.multiCall({ abi: 'erc20:balanceOf', target: nftAddress, calls: owners, permitFailure }) const positionIdCalls = [] positionIdBalances.forEach((idCount, i) => { const count = +idCount @@ -604,6 +633,17 @@ async function unwrapSlipstreamNFT({ api, balances, owner, positionIds = [], nft whitelistedTokens = getUniqueAddresses(whitelistedTokens, chain) let nftIdFetcher = uniV3ExtraConfig.nftIdFetcher ?? nftAddress + if ((!positionIds || positionIds.length === 0) && owner) { // if positionIds are not provided and owner address is passed + const nftPositions = await api.call({ target: nftIdFetcher, params: owner, abi: 'erc20:balanceOf' }) + positionIds = (await api.multiCall({ + abi: uniV3ABI.tokenOfOwnerByIndex, target: nftIdFetcher, + calls: Array(Number(nftPositions)).fill(0).map((_, index) => ({ params: [owner, index] })), + })) + } + + // nothing to value, so the position manager and its factory are never called + if (!positionIds?.length) return balances + let factory if (isShadow) { const deployer = await api.call({ target: nftAddress, abi: 'address:deployer' }) @@ -614,14 +654,6 @@ async function unwrapSlipstreamNFT({ api, balances, owner, positionIds = [], nft factory = (await factories[factoryKey]) } - if ((!positionIds || positionIds.length === 0) && owner) { // if positionIds are not provided and owner address is passed - const nftPositions = await api.call({ target: nftIdFetcher, params: owner, abi: 'erc20:balanceOf' }) - positionIds = (await api.multiCall({ - abi: uniV3ABI.tokenOfOwnerByIndex, target: nftIdFetcher, - calls: Array(Number(nftPositions)).fill(0).map((_, index) => ({ params: [owner, index] })), - })) - } - const positionsAbi = isShadow ? shadowV3PositionsABI : slipstreamNftABI.positions const positions = (await api.multiCall({ abi: positionsAbi, target: nftAddress, calls: positionIds, })) @@ -973,6 +1005,7 @@ async function sumTokens2({ resolveSlipstream = false, resolveSlipstreamV2 = false, resolveSlipstreamV3 = false, + resolveMetadexCL = false, resolveStakewiseDeposits = false, uniV3WhitelistedTokens = [], uniV3nftsAndOwners = [], @@ -1129,6 +1162,9 @@ group by if (resolveSlipstreamV3) await unwrapSlipstreamV3NFTs({ balances, api, owner, owners, blacklistedTokens, whitelistedTokens: uniV3WhitelistedTokens, nftsAndOwners: uniV3nftsAndOwners, uniV3ExtraConfig, }) + if (resolveMetadexCL) + await unwrapMetadexCLNFTs({ balances, api, owner, owners, blacklistedTokens, whitelistedTokens: uniV3WhitelistedTokens, nftsAndOwners: uniV3nftsAndOwners, uniV3ExtraConfig, }) + blacklistedTokens = blacklistedTokens.map(t => normalizeAddress(t, chain)) tokensAndOwners = tokensAndOwners.map(([t, o]) => [normalizeAddress(t, chain), o]).filter(([token]) => !blacklistedTokens.includes(token)) tokensAndOwners = getUniqueToA(tokensAndOwners) @@ -1406,6 +1442,7 @@ module.exports = { unwrapDolomiteDeposits, unwrapUniswapLPs, unwrapSlipstreamNFT, + unwrapMetadexCLNFTs, unwrapUniswapV3NFT, sumTokens, genericUnwrapCvx, From fc3c955cb6ed6c37ae21d170740dd6fe06f9b90f Mon Sep 17 00:00:00 2001 From: routebuilder Date: Wed, 21 Oct 2026 20:54:58 +0200 Subject: [PATCH 389/988] Add rotated Valr Bitcoin custody wallets (#21789) --- cex/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cex/index.js b/cex/index.js index a29c7d9ccdf..9fd0fbb2a13 100644 --- a/cex/index.js +++ b/cex/index.js @@ -2169,7 +2169,9 @@ const configs = { bitcoin: { owners: [ "3PUAxZ26mF8Ub1oQrc7TK7NvTe93KaNQZP", - "bc1q068k89wp2dt3v7wrp8uyscd3llvz6tytz3ve8pd4e2f6z9a5kdjqtqe505" + "bc1q068k89wp2dt3v7wrp8uyscd3llvz6tytz3ve8pd4e2f6z9a5kdjqtqe505", + "37d9BCaP6kDqZEuRrF2Cp4etu62M4R5b9o", + "37xfkbus1PjR621UF1zQLodcFKfVnNLUaU" ] }, ethereum: { From 3bb9f511ad630d1e0e40c450f6549c5073e22ad6 Mon Sep 17 00:00:00 2001 From: Alejandro Corona <163881358+a-k-l-sdao@users.noreply.github.com> Date: Wed, 21 Oct 2026 13:18:50 -0600 Subject: [PATCH 390/988] singularityFinance: add Ethereum and BSC vault registries and Arbitrum support (#21758) Co-authored-by: a-k-l-sdao --- projects/singularityFinance/index.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/projects/singularityFinance/index.js b/projects/singularityFinance/index.js index e71207fcd5e..1bb0958248d 100644 --- a/projects/singularityFinance/index.js +++ b/projects/singularityFinance/index.js @@ -19,19 +19,20 @@ const ownTokens = { const vaultRegistry = { - // 1: "", - // 56: "", + 1: "0x97C46cE66Ec71559DbF43fF9E5D110C3657C1ca4", + 56: "0xBCCa741996196462480108BCEf7561C0aB3Fdb04", 8453: "0xe260c97949bB01E49c0af64a3525458197851657", + 42161: "0x44921e42017316F89C1DEdd70a3A017d4c5162c3", }; // calculates the tvl of the SFI dynavaults by calling totalAsset which is a representation of the vault tvl in in a reference asset async function calculateDynaVaultTVL(api, chainId) { if (vaultRegistry[chainId] == undefined) return; - const dynaVaults = await api.call({ + const dynaVaults = (await api.call({ abi: 'function allVaults() view returns (tuple(address vault, uint8 VaultType, bool active)[] memory)', target: vaultRegistry[chainId] - }); + })).filter(vault => vault.active === true); const assets = await api.multiCall({ abi: "function asset() view returns (address)", @@ -54,7 +55,7 @@ async function calculateDynaVaultTVL(api, chainId) { // calculates the tvl of the SFI staking pools. Each pool takes a deposit token and has a rewardToken. async function calculateStaking(api, chainId) { - const tokens = ownTokens[chainId].map(t => t.toLowerCase()); + const tokens = (ownTokens[chainId] || []).map(t => t.toLowerCase()); const stakingPools = poolconfig.filter(pool => pool.chainId === chainId && !tokens.includes(pool.depositTokenAddress.toLowerCase())); const stakingBalances = await api.multiCall({ @@ -133,5 +134,8 @@ module.exports = { base: { tvl, staking + }, + arbitrum: { + tvl } -}; \ No newline at end of file +}; From 65c65cc7bcc59a732cfaefc8a79b0eb2b97547b2 Mon Sep 17 00:00:00 2001 From: livingrockrises <90545960+livingrockrises@users.noreply.github.com> Date: Wed, 21 Oct 2026 23:19:29 +0400 Subject: [PATCH 391/988] Add Startale USD (USDSC M0 extension on Soneium) (#21742) Co-authored-by: FelixBruguera --- registries/sumTokens/data3.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 12eb58fab41..07d1c99d3bf 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -878,9 +878,17 @@ module.exports = { "tvl": { "owners": ["0x62b7f5A5Be488ea58f660C5aff465647213Bc6e9"], "tokens": ["0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b"] }, } }, + "startale-usd": { + "methodology": "TVL is the $M balance held by the USDSC (Startale USD) M0 extension contract on Soneium, which is the collateral backing every minted USDSC.", + "start": "2025-11-19", + "soneium": { + "tvl": { "owners": ["0x3f99231dD03a9F0E7e3421c92B7b90fbe012985a"], "tokens": ["0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b"] }, + } + }, "startale-earn": { "methodology": "TVL is the USDSC held by the Startale Earn vault on Soneium.", "start": "2025-11-25", + "doublecounted": true, "soneium": { "tvl": { "owners": ["0xfdeb7e9f59cad080d9158ff850ce79bcf6cdd5f0"], "tokens": ["0x3f99231dD03a9F0E7e3421c92B7b90fbe012985a"] }, } From eb70ca8bfc372a1f3380d2b7b67573576ff30ccb Mon Sep 17 00:00:00 2001 From: routebuilder Date: Wed, 21 Oct 2026 21:20:11 +0200 Subject: [PATCH 392/988] Apply default 30s timeout to direct axios calls in helpers (#21746) Co-authored-by: FelixBruguera --- projects/helper/allium.js | 17 ++++++++--------- projects/helper/bitcoin-book/fetchers.js | 24 +++++++++++------------- projects/helper/cache.js | 6 +++--- projects/helper/cache/getLogs.js | 4 ++-- projects/helper/chain/aeternity.js | 7 ++++--- projects/helper/chain/alephium.js | 21 +++++++-------------- projects/helper/chain/elrond.js | 4 ++-- projects/helper/chain/ergo.js | 9 +++------ projects/helper/chain/massa.js | 3 ++- projects/helper/chain/secret.js | 12 +++++++----- projects/helper/chain/theta.js | 3 ++- projects/helper/debank.js | 6 +++++- projects/helper/dune.js | 10 +++++----- projects/helper/http.js | 4 +++- projects/helper/utils.js | 4 ++-- projects/helper/utils/graphql.js | 4 ++-- 16 files changed, 68 insertions(+), 70 deletions(-) diff --git a/projects/helper/allium.js b/projects/helper/allium.js index f9f89ae79e2..d2f1388a51f 100644 --- a/projects/helper/allium.js +++ b/projects/helper/allium.js @@ -1,7 +1,7 @@ require('dotenv').config() -const axios = require("axios"); const pLimit = require("p-limit"); const { getEnv } = require('./env'); +const { get, post } = require('./http'); // Lightweight retry function to replace async-retry const retry = async (fn, options = {}) => { @@ -39,7 +39,7 @@ const HEADERS = () => ({ }) async function startAlliumQuery(sqlQuery) { - const query = await axios.post(`https://api.allium.so/api/v1/explorer/queries/phBjLzIZ8uUIDlp0dD3N/run-async`, { + const query = await post(`https://api.allium.so/api/v1/explorer/queries/phBjLzIZ8uUIDlp0dD3N/run-async`, { parameters: { fullQuery: sqlQuery } @@ -47,14 +47,14 @@ async function startAlliumQuery(sqlQuery) { headers: HEADERS() }) - return query.data["run_id"] + return query["run_id"] } async function retrieveAlliumResults(queryId) { - const results = await axios.get(`https://api.allium.so/api/v1/explorer/query-runs/${queryId}/results?f=json`, { + const results = await get(`https://api.allium.so/api/v1/explorer/query-runs/${queryId}/results?f=json`, { headers: HEADERS() }) - return results.data.data + return results.data } async function _queryAllium(sqlQuery) { @@ -73,16 +73,15 @@ async function _queryAllium(sqlQuery) { throw new Error("Couldn't get a token from allium") } - const statusReq = await axios.get(`https://api.allium.so/api/v1/explorer/query-runs/${token[sqlQuery]}/status`, { + const status = await get(`https://api.allium.so/api/v1/explorer/query-runs/${token[sqlQuery]}/status`, { headers: HEADERS() }) - const status = statusReq.data if (status === "success") { return retrieveAlliumResults(token[sqlQuery]) } else if (status === "failed") { - console.log(`Query ${sqlQuery} failed`, statusReq.data) - bail(new Error(`Query ${sqlQuery} failed, error ${JSON.stringify(statusReq.data)}`)) + console.log(`Query ${sqlQuery} failed`, status) + bail(new Error(`Query ${sqlQuery} failed, error ${JSON.stringify(status)}`)) return; } throw new Error("Still running") diff --git a/projects/helper/bitcoin-book/fetchers.js b/projects/helper/bitcoin-book/fetchers.js index 1fce0f751c8..38e8bf14e40 100644 --- a/projects/helper/bitcoin-book/fetchers.js +++ b/projects/helper/bitcoin-book/fetchers.js @@ -1,7 +1,6 @@ const { getConfig, getCache, setCache, } = require('../cache') -const axios = require('axios'); const { getEnv } = require('../env') -const { get } = require('../http') +const { get, post } = require('../http') const sdk = require('@defillama/sdk') const abi = { getQualifiedUserInfo: 'function getQualifiedUserInfo(address _user) view returns ((bool locked, string depositAddress, string withdrawalAddress) info)' } @@ -40,7 +39,7 @@ module.exports = { return btc }, exsatCreditStaking: async () => { - const { data: response } = await axios.post('https://rpc-us.exsat.network/v1/chain/get_table_rows', { + const response = await post('https://rpc-us.exsat.network/v1/chain/get_table_rows', { json: true, code: "custody.xsat", scope: "custody.xsat", @@ -193,8 +192,8 @@ module.exports = { const API_URL = 'https://dashboard.pumpbtc.xyz/api/dashboard/asset/tokenowners' return getConfig('pumpbtc/v2', undefined, { fetcher: async () => { - const { data } = await axios.get(API_URL) - return data.data.bitcoin.owners + const { data } = await get(API_URL) + return data.bitcoin.owners } }) }, @@ -229,7 +228,7 @@ module.exports = { let hasMore = true; while (hasMore) { - const { data: response } = await axios.post(API2_URL, { + const response = await post(API2_URL, { "json": true, "code": "brdgmng.xsat", "scope": custody_id, @@ -269,8 +268,7 @@ module.exports = { btnx: async () => { const staticAddresses = await getConfig('btnx', undefined, { fetcher: async () => { - const { data } = await axios.get('https://sidecar.botanixlabs.com/api/addressList', { - }) + const data = await get('https://sidecar.botanixlabs.com/api/addressList') return data.map(address => address) } }) @@ -292,8 +290,8 @@ module.exports = { binanceFetcher: async () => { const staticAddresses = await getConfig('binance-cex/btc', undefined, { fetcher: async () => { - const { data } = await axios.get('https://www.binance.com/bapi/apex/v1/public/apex/market/por/address') - return data.data.filter(i => i.network === 'BTC').map(item => item.address) + const { data } = await get('https://www.binance.com/bapi/apex/v1/public/apex/market/por/address') + return data.filter(i => i.network === 'BTC').map(item => item.address) } }) return Array.from(new Set(staticAddresses)) @@ -301,8 +299,8 @@ module.exports = { vishwa: async () => { const staticAddresses = await getConfig('vishwa', undefined, { fetcher: async () => { - const { data } = await axios.get('https://vault.vishwalab.com/vapi/btc/address') - return data.data + const { data } = await get('https://vault.vishwalab.com/vapi/btc/address') + return data } }) return Array.from(new Set(staticAddresses)) @@ -310,7 +308,7 @@ module.exports = { yala: async () => { const staticAddresses = await getConfig('yala/bitcoin', undefined, { fetcher: async () => { - const { data } = await axios.get('https://raw.githubusercontent.com/yalaorg/yala-defillama/refs/heads/main/config.json') + const data = await get('https://raw.githubusercontent.com/yalaorg/yala-defillama/refs/heads/main/config.json') return data.bitcoin } }) diff --git a/projects/helper/cache.js b/projects/helper/cache.js index 912e1a762fc..94e5b2f2f82 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -1,6 +1,6 @@ const sdk = require('@defillama/sdk') const Bucket = "tvl-adapter-cache"; -const axios = require('axios') +const http = require('./http') const graphql = require('./utils/graphql') function getKey(project, chain) { @@ -73,7 +73,7 @@ async function getConfig(project, endpoint, { fetcher } = {}) { try { let json if (endpoint) { - json = (await axios.get(endpoint)).data + json = await http.get(endpoint) } else { json = await fetcher() } @@ -122,7 +122,7 @@ async function configPost(project, endpoint, data) { async function _configPost() { try { - const { data: json } = await axios.post(endpoint, data) + const json = await http.post(endpoint, data) await _setCache(key, project, json) return json } catch (e) { diff --git a/projects/helper/cache/getLogs.js b/projects/helper/cache/getLogs.js index 24ca683aa32..c91db4cc386 100644 --- a/projects/helper/cache/getLogs.js +++ b/projects/helper/cache/getLogs.js @@ -1,7 +1,7 @@ const { getCache, setCache, } = require('../cache'); const sdk = require('@defillama/sdk'); -const { default: axios } = require('axios'); +const { get } = require('../http'); const ethers = require("ethers") const cacheFolder = 'logs' @@ -222,7 +222,7 @@ async function getLogsFromEtherscanAPI({ address, fromBlock, toBlock, api, topic if (!topic0.startsWith('0x')) topic0 = ethers.id(topic0) const apiKey = process.env.SDK_ETHERSCAN_API_KEY - const { data } = await axios.get('https://api.etherscan.io/v2/api', { + const data = await get('https://api.etherscan.io/v2/api', { params: { address, fromBlock, diff --git a/projects/helper/chain/aeternity.js b/projects/helper/chain/aeternity.js index 1ca93d824b1..76f56445fb1 100644 --- a/projects/helper/chain/aeternity.js +++ b/projects/helper/chain/aeternity.js @@ -1,16 +1,17 @@ const axios = require('axios'); const sdk = require('@defillama/sdk') +const { DEFAULT_TIMEOUT } = require('../http') const endpoint = 'https://mainnet.aeternity.io/v2/accounts'; // Replace with the appropriate endpoint async function getBalance(address) { try { - const response = await axios.get(`${endpoint}/${address}`); + const response = await axios.get(`${endpoint}/${address}`, { timeout: DEFAULT_TIMEOUT }); const balance = response.data.balance; return balance; } catch (error) { - console.error('Error fetching token balance:', error); - return 0; + if (error.response?.status === 404) return 0; + throw error; } } diff --git a/projects/helper/chain/alephium.js b/projects/helper/chain/alephium.js index 12bcd221e94..b0465d511d9 100644 --- a/projects/helper/chain/alephium.js +++ b/projects/helper/chain/alephium.js @@ -1,26 +1,21 @@ -const axios = require("axios"); const bs58 = require("bs58").default || require("bs58"); +const { get, post } = require("../http"); const EXPLORER_API_HOST = "https://backend.mainnet.alephium.org"; const NODE_API_HOST = "https://node.mainnet.alephium.org"; async function getAlphBalance(address) { - return (await axios.get(`${EXPLORER_API_HOST}/addresses/${address}/balance`)) - .data; + return get(`${EXPLORER_API_HOST}/addresses/${address}/balance`); } async function getTokensBalance(address) { - return ( - await axios.get(`${EXPLORER_API_HOST}/addresses/${address}/tokens-balance`) - ).data; + return get(`${EXPLORER_API_HOST}/addresses/${address}/tokens-balance`); } async function contractMultiCall(payload) { - const result = ( - await axios.post(`${NODE_API_HOST}/contracts/multicall-contract`, { - calls: payload, - }) - ).data; + const result = await post(`${NODE_API_HOST}/contracts/multicall-contract`, { + calls: payload, + }); return result.results.map((r) => tryGetCallResult(r)); } @@ -32,9 +27,7 @@ function tryGetCallResult(result) { } async function getTokenInfo(tokenId) { - const [metadata] = ( - await axios.post(`${EXPLORER_API_HOST}/tokens/fungible-metadata`, [tokenId]) - ).data; + const [metadata] = await post(`${EXPLORER_API_HOST}/tokens/fungible-metadata`, [tokenId]); return metadata; } diff --git a/projects/helper/chain/elrond.js b/projects/helper/chain/elrond.js index 4a791339de2..c70c8af4935 100644 --- a/projects/helper/chain/elrond.js +++ b/projects/helper/chain/elrond.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../coreAssets.json') const axios = require('axios') -const { get } = require('../http') +const { get, DEFAULT_TIMEOUT } = require('../http') const { transformBalances } = require('../portedTokens') const sdk = require('@defillama/sdk') const { getEnv } = require('../env') @@ -21,7 +21,7 @@ async function vmQuery({ scAddress, funcName, args = [] }, { retries = 5 } = {}) for (let attempt = 0; ; attempt++) { await waitForQuerySlot() try { - const { data } = await axios.post(getEnv('MULTIVERSX_RPC') + '/query', { scAddress, funcName, args }) + const { data } = await axios.post(getEnv('MULTIVERSX_RPC') + '/query', { scAddress, funcName, args }, { timeout: DEFAULT_TIMEOUT }) return data } catch (e) { const status = e.response?.status diff --git a/projects/helper/chain/ergo.js b/projects/helper/chain/ergo.js index 1ca8efd45ec..4374cc18661 100644 --- a/projects/helper/chain/ergo.js +++ b/projects/helper/chain/ergo.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../coreAssets.json') -const axios = require("axios") const sdk = require('@defillama/sdk') +const { get } = require('../http') const chain = 'ergo' const API_HOST = 'https://api.ergoplatform.com/api/v1' @@ -8,14 +8,11 @@ const API_HOST = 'https://api.ergoplatform.com/api/v1' const nullAddress = ADDRESSES.null async function queryTree({ address, params = {}}) { - const { data } = await axios.get(`${API_HOST}/boxes/unspent/byErgoTree/${address}`, { - params, - }) - return data + return get(`${API_HOST}/boxes/unspent/byErgoTree/${address}`, { params }) } async function getTokens({ address, balances = {}, tokens = [], blacklistedTokens = [] }) { - const { data: { confirmed: { nanoErgs, tokens: tokenData}}} = await axios.get(`${API_HOST}/addresses/${address}/balance/total`) + const { confirmed: { nanoErgs, tokens: tokenData}} = await get(`${API_HOST}/addresses/${address}/balance/total`) tokenData.push({ tokenId: nullAddress, amount: nanoErgs ?? 0 }) tokenData.forEach(({ tokenId, amount }) => { if (tokens.length && !tokens.includes(tokenId)) return; // sum only whitelistedTokens diff --git a/projects/helper/chain/massa.js b/projects/helper/chain/massa.js index 2341b1986e4..98f8cf3657c 100644 --- a/projects/helper/chain/massa.js +++ b/projects/helper/chain/massa.js @@ -1,8 +1,9 @@ const axios = require("axios"); +const { DEFAULT_TIMEOUT } = require("../http"); // https://github.com/massalabs/massa-web3/blob/main/packages/massa-web3/src/web3/PublicApiClient.ts const RPC_ENDPOINT = "https://mainnet.massa.net/api/v2"; -const client = axios.create({ baseURL: RPC_ENDPOINT }); +const client = axios.create({ baseURL: RPC_ENDPOINT, timeout: DEFAULT_TIMEOUT }); async function request(method, params) { params.forEach((param) => { diff --git a/projects/helper/chain/secret.js b/projects/helper/chain/secret.js index 4f97db6353a..fb8b5ea4493 100644 --- a/projects/helper/chain/secret.js +++ b/projects/helper/chain/secret.js @@ -2,7 +2,7 @@ const { endPoints } = require('./cosmos'); const EnigmaUtils = require('../utils/enigma') const host = endPoints.secret const { toBase64, fromBase64, fromUtf8, } = EnigmaUtils -const axios = require('axios') +const http = require('../http') let client function getClient() { @@ -52,13 +52,15 @@ class SecretClient { } async get(api, queryParams = {}) { - const { data } = await axios.get(this.nodeURL + api, { params: queryParams }) - return data + return http.get(this.nodeURL + api, { params: queryParams }) } async getCodeHashByContractAddr(contract) { - if (!this.codeHashes[contract]) - this.codeHashes[contract] = fetchCodeHash(this) + if (!this.codeHashes[contract]) { + const promise = fetchCodeHash(this) + this.codeHashes[contract] = promise + promise.catch(() => { if (this.codeHashes[contract] === promise) delete this.codeHashes[contract] }) + } return this.codeHashes[contract] diff --git a/projects/helper/chain/theta.js b/projects/helper/chain/theta.js index a75badfcbea..127b60dd25e 100644 --- a/projects/helper/chain/theta.js +++ b/projects/helper/chain/theta.js @@ -1,4 +1,5 @@ const axios = require('axios') +const { DEFAULT_TIMEOUT } = require('../http') // Theta mainnet keeps native THETA in the account ledger next to TFUEL; the EVM rpc // (eth_getBalance) only exposes TFUEL, so THETA has to be read from the explorer api @@ -7,7 +8,7 @@ const EXPLORER_API = 'https://explorer-api.thetatoken.org/api' // liquid native THETA (whole coins) held by an address; the explorer 404s for addresses // that never had a ledger account, which means a zero balance async function getThetaBalance(owner) { - const { status, data } = await axios.get(`${EXPLORER_API}/account/${owner.toLowerCase()}`, { validateStatus: s => s === 200 || s === 404 }) + const { status, data } = await axios.get(`${EXPLORER_API}/account/${owner.toLowerCase()}`, { validateStatus: s => s === 200 || s === 404, timeout: DEFAULT_TIMEOUT }) if (status === 404) return 0 return Number(data?.body?.balance?.thetawei ?? 0) / 1e18 } diff --git a/projects/helper/debank.js b/projects/helper/debank.js index 40c329606b9..c970efab2aa 100644 --- a/projects/helper/debank.js +++ b/projects/helper/debank.js @@ -1,4 +1,5 @@ const axios = require('axios') +const { DEFAULT_TIMEOUT } = require('./http') const { getEnv } = require('./env') const { nullAddress } = require('./sumTokens') @@ -36,11 +37,12 @@ async function _fetchDebank(endpoint, owners, { isAll = true } = {}) { const apiKey = getEnv('DEBANK_API_KEY') if (!apiKey) throw new Error('Missing DEBANK_API_KEY') const headers = { accept: 'application/json', AccessKey: apiKey } - _cache[key] = Promise.all( + const promise = Promise.all( owners.map(id => axios.get(`${DEBANK_API_BASE}/${endpoint}`, { params: { id, is_all: isAll }, headers, + timeout: DEFAULT_TIMEOUT, }).then(r => r.data).catch(e => { const status = e.response?.status const detail = e.response?.data?.message || e.message @@ -48,6 +50,8 @@ async function _fetchDebank(endpoint, owners, { isAll = true } = {}) { }) ) ) + _cache[key] = promise + promise.catch(() => { if (_cache[key] === promise) delete _cache[key] }) } return _cache[key] } diff --git a/projects/helper/dune.js b/projects/helper/dune.js index e08c62160b8..c0891cbeac6 100644 --- a/projects/helper/dune.js +++ b/projects/helper/dune.js @@ -1,6 +1,6 @@ require('dotenv').config() -const axios = require('axios') const { getEnv } = require('./env') +const { get, post } = require('./http') function getApiKey() { const raw = getEnv('DUNE_API_KEYS') || '' @@ -18,7 +18,7 @@ async function getLatestDuneResults(queryId, { pageSize = 1000 } = {}) { // eslint-disable-next-line no-constant-condition while (true) { const url = `https://api.dune.com/api/v1/query/${queryId}/results?limit=${pageSize}&offset=${offset}` - const { data } = await axios.get(url, { headers }) + const data = await get(url, { headers }) const batch = (data && data.result && data.result.rows) || [] rows = rows.concat(batch) if (!batch.length || data.next_offset == null) break @@ -39,7 +39,7 @@ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) async function queryDuneSql(sql, { maxWaitMs = 240000 } = {}) { const headers = { 'X-Dune-Api-Key': getApiKey() } - const { data: submitted } = await axios.post( + const submitted = await post( `${DUNE_API}/query/${PASSTHROUGH_QUERY_ID}/execute`, { query_parameters: { fullQuery: sql } }, { headers }) @@ -50,13 +50,13 @@ async function queryDuneSql(sql, { maxWaitMs = 240000 } = {}) { let state do { await sleep(2000 + Math.floor(Math.random() * 3000)) - const { data } = await axios.get(`${DUNE_API}/execution/${executionId}/status`, { headers }) + const data = await get(`${DUNE_API}/execution/${executionId}/status`, { headers }) state = data.state } while ((state === 'QUERY_STATE_PENDING' || state === 'QUERY_STATE_EXECUTING') && Date.now() < deadline) if (state !== 'QUERY_STATE_COMPLETED') throw new Error(`Dune query did not complete (state: ${state})`) - const { data } = await axios.get(`${DUNE_API}/execution/${executionId}/results?limit=100000`, { headers }) + const data = await get(`${DUNE_API}/execution/${executionId}/results?limit=100000`, { headers }) return (data && data.result && data.result.rows) || [] } diff --git a/projects/helper/http.js b/projects/helper/http.js index 38739977bb1..3dc48b7a7e4 100644 --- a/projects/helper/http.js +++ b/projects/helper/http.js @@ -44,7 +44,7 @@ async function get(endpoint, options = {}) { } async function getWithMetadata(endpoint) { - return axios.get(endpoint) + return axios.get(endpoint, { timeout: DEFAULT_TIMEOUT }) } async function post(endpoint, body, options) { @@ -122,6 +122,7 @@ async function proxiedFetch(url) { }); const { data } = await client .get(url.toString(), { + timeout: DEFAULT_TIMEOUT, proxy: { protocol: "https", host, @@ -133,6 +134,7 @@ async function proxiedFetch(url) { } module.exports = { + DEFAULT_TIMEOUT, get, getCache, post, diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 8766eda8090..f29606627d9 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -7,11 +7,11 @@ const erc20 = require('./abis/erc20.json'); const { beacon } = require('./chain/rpcProxy'); async function fetchURL(url) { - return axios.get(url) + return axios.get(url, { timeout: http.DEFAULT_TIMEOUT }) } async function postURL(url, data) { - return axios.post(url, data) + return axios.post(url, data, { timeout: http.DEFAULT_TIMEOUT }) } function createIncrementArray(length) { diff --git a/projects/helper/utils/graphql.js b/projects/helper/utils/graphql.js index 8860b580cd2..aba3214b595 100644 --- a/projects/helper/utils/graphql.js +++ b/projects/helper/utils/graphql.js @@ -1,7 +1,7 @@ -const axios = require("axios"); +const { post } = require("../http"); async function request(endpoint, query, { variables, withMetadata = false, headers } = {}) { - const { data: result } = await axios.post(endpoint, { query, variables }, { headers }) + const result = await post(endpoint, { query, variables }, { headers }) if (result.errors) throw new Error(result.errors[0].message) return withMetadata ? result : result.data } From e114621924ed461e1e0a82d2fcc3acc9f12f8bd1 Mon Sep 17 00:00:00 2001 From: coolsheet69 Date: Wed, 21 Oct 2026 14:29:06 -0500 Subject: [PATCH 393/988] Add URM TVL adapter (#21712) Co-authored-by: FelixBruguera --- registries/sumTokens/data3.js | 6 ++++++ registries/treasury.js | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 07d1c99d3bf..a799353e3ce 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -899,6 +899,12 @@ module.exports = { "tvl": { "owners": ["0x8Ae2D8A767c3d59219556b83d4e8385514b6d72B", "0xa4B90fb94B2bBdf1D66A8191E883D0F57BbC6D0b"], "tokens": [ADDRESSES.robinhood.USDG, ADDRESSES.robinhood.WETH] }, } }, + "urm": { + "methodology": "TVL is the collateral users have deposited into URM CDP positions (RAGE, HESTIA, Ultraround), held in the per-collateral adapter contracts. URM itself is excluded. Protocol-owned reserves in the Fortress are tracked as treasury.", + "base": { + "tvl": { "tokensAndOwners": [["0xc0df50143EA93AeC63e38A6ED4E92B378079eA15", "0x099072418d0100ff2ced5598f97d42b96f8ea7fe"], ["0xBC7755a153E852CF76cCCDdb4C2e7c368f6259D8", "0xce76cb3239fcb25fd4814c8a4abc563b4ac74c1e"], ["0x5baBfc2F240bc5De90Eb7e19D789412dB1dEc402", "0x0db24c8674cda319e18a5e81fc960b0a2a30a3b1"]] }, + } + }, "termix": { "methodology": "TVL is USDC and USDT held across the escrow (funded jobs not yet settled), staking (provider stakes) and campaign-vault contracts on BSC and Base.", "start": "2026-07-02", diff --git a/registries/treasury.js b/registries/treasury.js index bf671c3513f..59f26f1e9e4 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -6197,6 +6197,20 @@ const configs = { ownTokens: ["0x474021845c4643113458ea4414bdb7fb74a01a77"], }, }, + 'treasury/urm': { + base: { + tokens: [ + ADDRESSES.base.USDC, + '0xBC7755a153E852CF76cCCDdb4C2e7c368f6259D8', // HESTIA + '0x5baBfc2F240bc5De90Eb7e19D789412dB1dEc402', // CIRCLE + ], + owners: ['0xd3e9637Cfc255AD3FffA1e88Bd9BA7fa5a76b4Fe'], // Fortress + resolveUniV3: true, + ownTokens: ['0xf0e3349f00972475a5d16721796091aa3b997837'], // URM + blacklistedTokens: ['0x95fa3FA511Ef8DD9e48453eaE76b241D1c1AC651'], // fURM + fetchCoValentTokens: false, + }, + }, 'treasury/uwulend': { ethereum: { tokens: [ From 9f1202e8041ed067f4a8fe92e78eaea5e3adc880 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 21 Oct 2026 23:02:02 +0200 Subject: [PATCH 394/988] cex: support more chains (#21793) --- projects/binance/index.js | 39 ++++++-- projects/bitget/index.js | 105 +++++++++++++++++++- projects/helper/bitcoin-book/index.js | 5 + projects/helper/cex.js | 49 +++++++--- projects/helper/chain/avaxX.js | 31 ++++++ projects/helper/chain/filecoin.js | 21 ++++ projects/helper/chain/kusama.js | 4 + projects/helper/chain/massa.js | 7 ++ projects/helper/chain/neo3.js | 32 ++++++ projects/helper/chain/ontology.js | 27 ++++++ projects/helper/chain/polkadot.js | 135 ++++++++++++++------------ projects/helper/chain/proton.js | 9 ++ projects/helper/chains.json | 1 + projects/helper/env.js | 2 + projects/helper/sumTokens.js | 6 ++ projects/helper/tokenMapping.js | 8 +- 16 files changed, 398 insertions(+), 83 deletions(-) create mode 100644 projects/helper/chain/avaxX.js create mode 100644 projects/helper/chain/filecoin.js create mode 100644 projects/helper/chain/kusama.js create mode 100644 projects/helper/chain/neo3.js create mode 100644 projects/helper/chain/ontology.js diff --git a/projects/binance/index.js b/projects/binance/index.js index 6850f150dd2..9a8f75affe9 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -82,6 +82,24 @@ const withdrawalAddresses = [ '0xd27b39cb25fed854f9fce3a4e451f96e62089e48', '0x6357e4bdaff733dfe8f50d12d07c03b3bed0884b', ] +const binanceBridgedTokens = [ + '0x570a5d26f7765ecb712c0924e4de545b89fd43df', // SOL + "0x3ee2200efb3400fabb9aacf31297cbdd1d435d47", // ADA + "0xba2ae424d960c26247dd6c32edc70b295c744c43", // DOGE + "0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD", // LINK + "0x7083609fce4d1d8dc0c979aab8c869ea2c873402", // DOT + "0x2859e4544c4bb03966803b044a93563bd2d0dd4d", // SHIB + "0x4338665cbb7b2485a8855a139b75d5e34ab0db94", // LTC + "0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe", // XRP + "0xa2b726b1145a4773f68593cf171187d8ebe4d495", // INJ + "0x1fa4a73a3f0133f0025378af00236f3abdee5d63", // NEAR + "0x6FDcdfef7c496407cCb0cEC90f9C5Aaa1Cc8D888", // VET + "0xfb6115445Bff7b52FeB98650C87f44907E58f802", // AAVE + "0x62d0a8458ed7719fdaf978fe5929c6d342b0bfce", // BEAM + "0x0D8Ce2A99Bb6e3B7Db580eD848240e4a0F9aE153", // FIL + "0x43C934A845205F0b514417d757d7235B8f53f1B9", // XLM + "0x1Ba42e5193dfA8B03D15dd1B86a3113bbBEF8Eeb", // ZEC +] const chainToNetworks = {} for (const [network, chain] of Object.entries(binanceToDefillama)) { @@ -92,14 +110,19 @@ for (const [network, chain] of Object.entries(binanceToDefillama)) { } const perChainConfig = { - ethereum: { blacklistedTokens: [ - ADDRESSES.ethereum.BNB, - ADDRESSES.bsc.wBETH, // wBETH, we are already counting staked ETH via withdrawal addresses, so we don't want to double count it - ] }, - bsc: { blacklistedTokens: [ - ADDRESSES.bsc.TUSD, - ADDRESSES.bsc.wBETH, // wBETH - ] }, + ethereum: { + blacklistedTokens: [ + ADDRESSES.ethereum.BNB, + ADDRESSES.bsc.wBETH, // wBETH, we are already counting staked ETH via withdrawal addresses, so we don't want to double count it + ] + }, + bsc: { + blacklistedTokens: [ + ADDRESSES.bsc.TUSD, + ADDRESSES.bsc.wBETH, // wBETH + ...binanceBridgedTokens, + ] + }, solana: { blacklistedTokens: ['7XU84evF7TH4suTuL8pCXxA6V2jrE8jKA6qsbUpQyfCY', 'CQvadZTR8vikRqqwyhvYV8YpdfCRjUCGyQwCuY4rxBQt'] }, } diff --git a/projects/bitget/index.js b/projects/bitget/index.js index 28a6a1fa2a4..5d1f9577c85 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -2,6 +2,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { mergeExports, getStakedEthTVL } = require("../helper/utils"); const { cexExports } = require("../helper/cex"); const bitcoinAddressBook = require("../helper/bitcoin-book/index.js"); +const avaxX = require("../helper/chain/avaxX"); const evmOwners = [ "0x0639556f03714a74a5feeaf5736a4a64ff70d206", @@ -84,6 +85,8 @@ const evmOwners = [ "0xb3e8a3b17c50f077685bcdef2ca496e54d91c4bd", "0x4cad1efbfd5f0848e0c3c14fab23f92b2fa81f17", "0xa4856e07d14045014b2c3fece5460bd37b310f10", // add on 05/10/2026 + "0x46852e1ff32739ddd2623bd06b27ca39f1143cc7", // add on 21/10/2026 + "0x95047fe21071e8038810975cfc9ee6da7dee33a4", // add on 21/10/2026 ] const evmChains = ["bsc","ethereum","arbitrum","optimism","era","fantom","cronos","avax","polygon","metis","kava","klaytn","base","hyperliquid","sonic","morph","plasma","robinhood","arc","sei","monad","linea","scroll","wc","megaeth"] @@ -120,6 +123,9 @@ const config = { "TUktrKwLLGGjks6DoN1zGta8muskbd9tnk", "TFfNrnZzHVMQ7DsHLvcTyvZheqabG4KW4W", "TKCFasXqJw3ezQiF1qYWYd78Edfb2NvpBV", + "TBf14pAU2aZ2kYjnfwDgcVDF2nH6kVHhkZ", // add on 21/10/2026 + "TJxe1MWrb5ppk3beWArqU2Dwg3jvhGUGx5", // add on 21/10/2026 + "THxgDFGkDejK452u9uumRY3W1KCjj6dk2Y", // add on 21/10/2026 ], }, bitcoin: { @@ -131,6 +137,9 @@ const config = { "rGDreBvnHrX1get7na3J4oowN19ny4GzFn", "rwTTsHVUDF8Ub2nzV2oAeWxfJzUvobXLEf", "rMCVBYFYtVJy6F4gUSd7RrM8GXApM6MNDN", // add on 05/10/2026 + "rGxYmmME93guyy4HuNv1bRf6gak8vGNN4B", // add on 21/10/2026 + "rnQ3YeYzjkLS1oum4FZ9HXzAksm23CaQGS", // add on 21/10/2026 + "rUKr6eh6emrKDg12rT3XDMrAbyeu8r2BnU", // add on 21/10/2026 ], }, solana: { @@ -150,6 +159,9 @@ const config = { "8ZPaybdHeNwpoxmU1ALcbLoE3eK443Jq4emk82VCscag", "3RtJvxpkok13LGQsQ3Ye4QvCkbP3ioMpra7ccuf9XqsF", // add on 18/09/2026 "Bk57qr4wSvzCqGKHD2vAc6n88oHyDoD8b3HnvGEF5iQN", // add on 18/09/2026 + "3NCT4RE6ix2Qfdw1c5kfNYBfJmVHPcJd9cABQ6aP6Zzg", // add on 21/10/2026 + "7ScZfANFtjzDZWk94DLb2eZUs8zBgYmnotYrsDd1MfYv", // add on 21/10/2026 + "HnxVDcZamsojYy3AFZndHEtQ9y5sf1H1V1pyLYyWk3BN", // add on 21/10/2026 ], }, doge: { @@ -161,6 +173,7 @@ const config = { near: { owners: [ '241754260760e04e3a90acf27b1c54296b81e52a3b21fab8347ae88066946092', // add on 05/10/2026 + '454e9a19b4552d08132efb9db354f8cdb1ceb155d8c2c9806f6cb15d947187cf', // add on 21/10/2026 ], }, starknet: { @@ -229,6 +242,8 @@ const config = { cardano: { owners: [ "Ae2tdPwUPEZKnykUqXyYQxqJSnADNkm4ELUnyqZUBHcCrNJVDqozLYCt9Jv", + "addr1q8cxktsw8qm8zqj0ru28s9q8yxgqlznejhtku7e22ww2xe8sdvhquwpkwypy78c50q2qwgvsp798n9whdeaj55uu5djqyhdfkl", // add on 21/10/2026 + "Ae2tdPwUPEYzbrfg1PRAMswDuoY3VusBRyVEWhE4QBp2CMj8QZc6HcVEiB8", // add on 21/10/2026 ] }, sui: { @@ -238,11 +253,98 @@ const config = { "0x9529d8d9621874f60e342e3f0f049157eda68b2d5085f6526b9fced8913b97a8", "0x3a1520d6be3a16f89655f542f6e5b050d3065ff67d7287ed8005259c4a0b36b7", "0x98252cfb5f8481cc4e395deb88000ffff5ab8fdd870be91fc48abfa83ec21a10", + "0x344d78ea46fb432ec42e29dbfc29bbad017b3400d9b4d55711d62448f996c9b5", // add on 21/10/2026 ] }, + // chains below added on 21/10/2026 from the bitget address list (wallets under 10k usd left out) + xdc: { owners: ["0x68c34a122c3b632e7ecd39f553dd5ffc1433f45b"] }, // xdc68c34a122c3b632e7ecd39f553dd5ffc1433f45b + harmony: { owners: ["0xb09dd9c27da4cbbf28f92109eb13615b34257fd3"] }, // one1kzwansna5n9m728eyyy7kymptv6z2l7n92uudx + fetchhub: { owners: ["fetch1s3l4s5f2j79872qjtt9f3p86vxxyf6g854lw4v"] }, + zcash: { owners: ["t1Xd1Lx2EXi2qwE1Kpc2F95TE2VrdKuJriY"] }, + bittensor: { + owners: [ + "5ELWnR5A7DUmmqHsYPA3iZMFu1BX3gceruEqFPtsmTkCqR7J", + "5HbDZ6ULuwZegAMSPaS2kaUfBLMDaht5t48RcDrQATSgGCAR", + ], + }, + pi: { owners: ["GDFNWH6ZFJVHJDLBMNOUT35X4EEKQVJAO3ZDL4NL7VQJLC4PJOQFWJ75"] }, + aptos: { + owners: [ + "0x48d1db7cb8529f17c88300515ed068bb8bbf01e6bd60ac81071d1160562a5144", + "0xbabf76f1e6ac1af9c2666c07be12f90b188ed484fcef0bf1408961b5461373e9", + ], + }, + litecoin: { owners: ["LSm75uocx76va8UvrVqyTztkWwXDvjS416"] }, + stellar: { owners: ["GBD6CUO335LQMOIZ53CE3L6QJ3X3DAQVC7F5TWE2BKI7AQWTHDUHFNJ4"] }, + hedera: { owners: ["0.0.4735544"] }, + kaspa: { owners: ["kaspa:qqywx2wszmnrsu0mzgav85rdwvzangfpdj9j3ady9jpr7hu4u8c2wl9wqgd6j"] }, + polkadot: { + owners: [ + "1hBczpJHSWrEejKT5hevU3h2oBKNBpY26zPo7jTpVanj3JV", + "13KjpoC6rn9NsKzweB5p68oBcsp77NvMSGdp6BZTMHjHTupB", + "15u2N1pqWr56teREjQTP5M3tk1SPQjEoUAV6jFfcQCoVy3S5", + ], + }, + injective: { owners: ["inj18seg7en3tdhy4ugvfv3s93srapdlkkpv6z56r4"] }, + icp: { owners: ["bad030b417484232fd2019cb89096feea3fdd3d9eb39e1d07bcb9a13c7673464"] }, + algorand: { owners: ["5622JWBD3TDOJUTGFIB3H3TI4JE5ARW7W3WQL6JIJQ5ATFQISRSBVKOD6U"] }, + canton: { owners: ["bg::1220ea89032d4307c135ff8dadbb0b52f9326cd337a7208b0ac4a357bb254acee9de"] }, + celestia: { owners: ["celestia1jm9gwpdk0v69kva9hepgnprfjl3u2z4duh9ver"] }, + bsv: { owners: ["12ov5BL4NbCn8GsdeV6fdPa5HrHGsdAopK"] }, + qubic: { + owners: [ + "EXNRRBDPYFQPXFPXCMUHZVEEBRQCBEAUDYUBHKGTRCKHVSRAQXWHQCXDLZXL", + "JAKDBYHQOUICADHMNZMCMQIUVLZCTCCGEYNLBBGPBFNNTVZZCBCIMWICCFHN", + "YVUFYVKKSHOXACARARSIKCBJMFZAFHTGUNAALZAFOFBAXOCJEPBYKTCCDEMJ", + "VYHFEIJMNILNIBWYRRBXEQNGKFGAKFRVYQTYZTBIADXKBQASXKICMYAEZXBG", + "WZQYIRBZASLIIFBIDJZFEUMUEWACTSNKVBRPLUKJZFGCSUTKHDCYXJYERBIE", + "OQGNMLUVQCMUBETYQXBJMBPDTJIARHYVUZOAZBKSNGESLFHFQYLWNULFTZDM", + "QGBXYBWVPJBKUFWZLUSNYQBAWVQDIDBWVBXGWUHYTABALTDSNTCEKPVGKXTA", + "LVGVWADWLDEBIFIASRDFSBKKXIFALOZOSCCFSLIGNDKIYHWUKZPPQNBFPSSF", + ], + }, + arweave: { owners: ["kvxXYE6q7v6LrmQJLBEQZ2abWDdVyjQDERqM1YeMvf0"] }, + conflux: { owners: ["cfx:aam5xn1e71juzwgs4e94t3yghj1ayw1b56zxk7bv8u"] }, + terra: { + owners: [ + "terra1j95fa7sdyudcw2rf96kyxdv42l90k0x8xtc8c3", + "terra1vq3dyzwxrhlwxkl9ld8yjxzpedcs75h7w3afr2", + ], + }, + cosmos: { owners: ["cosmos134amdum68rsfv4wpkanx253vw6zkmmfa3ssrxa"] }, + stacks: { owners: ["SP28TC4FHYSX63N7FTV56A6GJE5B0W79W1WXJ9262"] }, + eos: { owners: ["bitgeteosdep"] }, + oasis: { owners: ["oasis1qpfpj0fr6tv3k54p2euddyj6lezm5tfqhv3qjtd6"] }, + thorchain: { owners: ["thor1ye3jyw5nfnjrch4wk7zxuuxvx3wjuv9nsyumpr"] }, + dydx: { owners: ["dydx1zgx5m9ly6fzt4y9tdlnxa70u96fr5ygjxjzmhg"] }, + nervos: { owners: ["ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt9xmgc7s0x0ly43qpzev2er4w4320lwdgw4anh7"] }, + mina: { owners: ["B62qkoFGnaoAzVayqjkMYaP6ZiGrSnzSUovCdnJFfosEEKBsxEcJmrs"] }, + alephium: { owners: ["1GS8Hv3Fxm2Zduxek9Kr85LL1qAC4tDzbVaUiJbcex3qV"] }, + xion: { owners: ["xion1gaym9l53jwp5na0kpv8h5r5kuxs0zpw22ugx6v"] }, + babylon: { owners: ["bbn1fge5jh75e9psm7qses6fm76sh4xyes3tfye9fj"] }, + elrond: { owners: ["erd1w547kw69kpd60vlpr9pe0pn9nnqeljrcaz73znenjpgt0h3qlqqqm3szxj"] }, + tezos: { owners: ["tz1SCKYfZFZYYnL2fXqnLxdCtxBMLuYVG79s"] }, + mantra: { owners: ["mantra16l5qsgzjueayxa2z78eee53lv3t0kfy3z68pqc"] }, + orai: { owners: ["orai1y2ex6nyqy2yktaa68qtmyctlgqu2cddy0yccpr"] }, + astar: { owners: ["ao2MGHJeJFCcnUEJbz9vrNX3UMf4MFgR6TF7vCJcP3s5vzx"] }, + osmosis: { owners: ["osmo1tulvk3qsrt9u3h28z3mt83v97n37as5r2v5w3l"] }, + band: { owners: ["band15m7nzph3v9wvlehjl2gqmhp2avfut6ha3dx3y9"] }, + allora: { owners: ["allo1m2dqn8adrjw9pennccf8v3ttw0ulytzhpuk7ax"] }, + initia: { owners: ["init150mx83aq0jsuczew768maz2dv8krr8zufk6ye0"] }, + kusama: { owners: ["HEcm1Y7gSPStrk4LZJmc9dZCuoX4XAKmoGPPymt95CBiCqr"] }, + filecoin: { owners: ["f1lxiy73hwgaketpmclhvbtmlkiwtvdif4agotcdq"] }, + neo3: { owners: ["NcrhQoW3a5FrB1mUUKAwvWXhPt9cUWU5qr"] }, + ontology: { owners: ["Adt17RqjNdMw2qwFixEwsoruQ1J18VKfDw"] }, + proton: { owners: ["bitgetxpr"] }, + massa: { owners: ["AU1sxVCyy9E7f3nr1HSwbgNQH7SUuQUnb4BXxCzwMzYdRijZi1qY"] }, + platon: { owners: ["0x685e9a095deeca5023eba2c292f7fe671f9a6da7"] }, // lat1dp0f5z2aam99qglt5tpf9al7vu0e5md8t5n5ys }; +// Avalanche X-Chain wallet, counted on the avax chain next to the C-Chain balances +const avaxXChainOwners = ["X-avax1y9gqplplrrmpqdqgp0k6ketpufny2k9vxnlfry"] + evmChains.forEach(chain => { config[chain] = { owners: [...evmOwners] } }) +config.kava.owners.push("0x602e1c0d892ab4fecb472863b05acd8b1ac4fc01") // kava1vqhpcrvf9260aj689p3mqkkd3vdvflqp0vc469, add on 21/10/2026 config.ethereum.blacklistedTokens = [ "0x19de6b897ed14a376dda0fe53a5420d2ac828a28", // old bitget token ] @@ -255,4 +357,5 @@ const withdrawalAddresses = [ module.exports = mergeExports([ cexExports(config), { ethereum: { tvl: getStakedEthTVL({ withdrawalAddresses: withdrawalAddresses, size: 200, sleepTime: 20_000, proxy: true }) } }, -]) \ No newline at end of file + { avax: { tvl: avaxX.sumTokensExport({ owners: avaxXChainOwners }) } }, +]) diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index 6663c574be0..aaa620ca888 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -437,6 +437,11 @@ module.exports = { "33orXrdG44b7uexFP7Yxdqy1m3FirNtdTE", "3PSEjhkUQDGRNDPWqAcPhy9tEY6g6AHgPN", // add on 18/09/2026 "33FyMfJMRnqNvQiPDvE13L9cRHaEAXQziE", // add on 18/09/2026 + "bc1q6mejasmfzd7hlasnlsnxuptwjk5y7dl3h0g3zj", // add on 21/10/2026 + "bc1p3dfge99g2ulp8ry7almgr64fmwqzfxqclgh5mca39rzl2lw3zvasavfyzu", // add on 21/10/2026 + "bc1ps398h24s2zwm763k0n6c7hq9y4r6jm94pf6mxntrwprtj47nyt8q8qacet", // add on 21/10/2026 + "bc1p0jm3ucw8sh7edx37lw06ce9aaem09tcx2yr2zuenqr33hqce3lps67k0ns", // add on 21/10/2026 + "bc1pk0ynqw5zt36sep3eq5qe3c70w7vcwremwv092e02e0htm9wlm7zsf4dvt6", // add on 21/10/2026 ], bitmake: [ // wallet provide by a bitmake team diff --git a/projects/helper/cex.js b/projects/helper/cex.js index e7ee32ad3e2..aa7440b69e2 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -263,6 +263,26 @@ const defaultTokens = { '0x10d4183389e99233db3cc981c43443ebd28ebd5e', // DGAI '0x3d4f0513e8a29669b960f9dbca61861548a9a760', // BANANAS '0x444045b0ee1ee319a660a5e3d604ca0ffa35acaa', // BTW + '0x570a5d26f7765ecb712c0924e4de545b89fd43df', // SOL + "0x3ee2200efb3400fabb9aacf31297cbdd1d435d47", // ADA + "0xba2ae424d960c26247dd6c32edc70b295c744c43", // DOGE + "0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD", // LINK + "0x7083609fce4d1d8dc0c979aab8c869ea2c873402", // DOT + "0x2859e4544c4bb03966803b044a93563bd2d0dd4d", // SHIB + "0x4338665cbb7b2485a8855a139b75d5e34ab0db94", // LTC + "0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe", // XRP + "0xa2b726b1145a4773f68593cf171187d8ebe4d495", // INJ + "0x1fa4a73a3f0133f0025378af00236f3abdee5d63", // NEAR + "0x6FDcdfef7c496407cCb0cEC90f9C5Aaa1Cc8D888", // VET + "0xfb6115445Bff7b52FeB98650C87f44907E58f802", // AAVE + "0x62d0a8458ed7719fdaf978fe5929c6d342b0bfce", // BEAM + "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", // CAKE + "0x0D8Ce2A99Bb6e3B7Db580eD848240e4a0F9aE153", // FIL + "0x43C934A845205F0b514417d757d7235B8f53f1B9", // XLM + "0x1Ba42e5193dfA8B03D15dd1B86a3113bbBEF8Eeb", // ZEC + "0x000Ae314E2A2172a039B26378814C252734f556A", // ASTER + "0x9d10a1ec41Fe7878429BB457e31F9b050D38c633", // BDX + ], eos: [ ["eosio.token", "EOS", "eos"], @@ -296,6 +316,8 @@ const defaultTokens = { '0x16ee7ecac70d1028e7712751e2ee6ba808a7dd92', // FUN '0xe0cd4cacddcbf4f36e845407ce53e87717b6601d', // ICNT '0xed6e000def95780fb89734c07ee2ce9f6dcaf110', // EDGE + '0xfb31f85a8367210b2e4ed2360d2da9dc2d2ccc95', // EDEL + '0xc0634090F2Fe6c6d75e61Be2b949464aBB498973', // KEETA ], avax: [ nullAddress, @@ -399,6 +421,7 @@ const defaultTokens = { ADDRESSES.aptos.USDC, ADDRESSES.aptos.USDT, ADDRESSES.aptos.USDt, + ADDRESSES.aptos.USDC_3, '0xee962a61432231c2ede6946515beb02290cb516ad087bb06a731e922b2a5f57a::us::US', // US ADDRESSES.aptos.USD1, // USD1 '0x2a8227993a4e38537a57caefe5e7e9a51327bf6cd732c1f56648f26f68304ebc', // KGEN @@ -538,19 +561,21 @@ function cexExports(config) { } if (chain === 'ton') options.onlyWhitelistedTokens = true if (chain === 'aptos' && Array.isArray(fungibleAssets)) options.fungibleAssets = fungibleAssets - exportObj[chain] = { tvl: async (api) => { - // supports dynamic owners lists passed as a function - const owners = typeof options.owners === 'function' ? await options.owners(api) : options.owners - let tokens = options.tokens - const binanceTokensOnChain = await getCEXTokensOnBinanceOnChain(chain) - if (binanceTokensOnChain.length) { - console.log(`Adding ${binanceTokensOnChain.length} Binance tokens on ${chain} to the token list.`) - tokens = [...(options.tokens ?? []), ...binanceTokensOnChain] + exportObj[chain] = { + tvl: async (api) => { + // supports dynamic owners lists passed as a function + const owners = typeof options.owners === 'function' ? await options.owners(api) : options.owners + let tokens = options.tokens + const binanceTokensOnChain = await getCEXTokensOnBinanceOnChain(chain) + if (binanceTokensOnChain.length) { + console.log(`Adding ${binanceTokensOnChain.length} Binance tokens on ${chain} to the token list.`) + tokens = [...(options.tokens ?? []), ...binanceTokensOnChain] + } + const runtimeOptions = { ...options, owners, tokens, permitFailure: true } // while filling historical data, some tokens may not exist on the chain yet, so we permit failure + if (chain === 'solana') runtimeOptions.solOwners = owners + return sumTokensExport(runtimeOptions)(api) } - const runtimeOptions = { ...options, owners, tokens, permitFailure: true } // while filling historical data, some tokens may not exist on the chain yet, so we permit failure - if (chain === 'solana') runtimeOptions.solOwners = owners - return sumTokensExport(runtimeOptions)(api) - } } + } }) if (config.bep2) { exportObj.bsc = exportObj.bsc ?? { tvl: () => ({}) } diff --git a/projects/helper/chain/avaxX.js b/projects/helper/chain/avaxX.js new file mode 100644 index 00000000000..0ee16d164e5 --- /dev/null +++ b/projects/helper/chain/avaxX.js @@ -0,0 +1,31 @@ +const { post } = require('../http') +const { sleep } = require('../utils') + +// Avalanche X-Chain (AVM) native AVAX balances; these addresses are not on the C-Chain so the evm +// path never sees them. Added to the `avax` chain by the caller. +const RPC = 'https://api.avax.network/ext/bc/X' +const AVAX_ASSET_ID = 'FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z' + +async function getBalance(address) { + const { result } = await post(RPC, { jsonrpc: '2.0', id: 1, method: 'avm.getBalance', params: { address, assetID: AVAX_ASSET_ID } }) + return result.balance // nAVAX +} + +async function sumTokens({ api, owners = [] }) { + for (const owner of owners) { + const balance = await getBalance(owner) + api.addCGToken('avalanche-2', Number(balance) / 1e9) + await sleep(200) + } + return api.getBalances() +} + +function sumTokensExport(options) { + return (api) => sumTokens({ ...options, api }) +} + +module.exports = { + getBalance, + sumTokens, + sumTokensExport, +} diff --git a/projects/helper/chain/filecoin.js b/projects/helper/chain/filecoin.js new file mode 100644 index 00000000000..e24e2e571b6 --- /dev/null +++ b/projects/helper/chain/filecoin.js @@ -0,0 +1,21 @@ +const { get } = require('../http') +const { sleep } = require('../utils') + +// FIL balance of f1/f3/f4 (or 0x) addresses from the Filfox explorer api, in attoFIL +async function getBalance(address) { + const { balance } = await get(`https://filfox.info/api/v1/address/${address}`) + return balance +} + +async function sumTokens({ api, owners = [] }) { + for (const owner of owners) { + const balance = await getBalance(owner) + api.addCGToken('filecoin', Number(balance) / 1e18) + await sleep(300) + } +} + +module.exports = { + getBalance, + sumTokens, +} diff --git a/projects/helper/chain/kusama.js b/projects/helper/chain/kusama.js new file mode 100644 index 00000000000..465cee679d7 --- /dev/null +++ b/projects/helper/chain/kusama.js @@ -0,0 +1,4 @@ +// KSM balances: relay chain + Asset Hub, same sources and fallbacks as the polkadot helper +const { makeHelper } = require('./polkadot') + +module.exports = makeHelper('kusama') diff --git a/projects/helper/chain/massa.js b/projects/helper/chain/massa.js index 98f8cf3657c..bba02d220a2 100644 --- a/projects/helper/chain/massa.js +++ b/projects/helper/chain/massa.js @@ -120,7 +120,14 @@ async function getAddresssDataStoreKeys(address, prefix, is_final) { } +// native MAS balances (final_balance is already in whole coins) +async function sumTokens({ api, owners = [] }) { + const res = await request('get_addresses', owners) + for (const { final_balance } of res) api.addCGToken('massa', parseFloat(final_balance)) +} + module.exports = { + sumTokens, queryKey, u8ArrayToString, getTokenBalances, diff --git a/projects/helper/chain/neo3.js b/projects/helper/chain/neo3.js new file mode 100644 index 00000000000..2ea95dad4d6 --- /dev/null +++ b/projects/helper/chain/neo3.js @@ -0,0 +1,32 @@ +const { post } = require('../http') +const { sleep } = require('../utils') + +const RPC = 'https://mainnet1.neo.coz.io:443' + +// NEP-17 asset hash -> pricing; anything else the wallet holds is skipped (FLM has no price feed) +const ASSETS = { + '0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5': { geckoId: 'neo', decimals: 0 }, + '0xd2a4cff31913016155e38e474a2c06d08be276cf': { geckoId: 'gas', decimals: 8 }, +} + +async function getNep17Balances(address) { + const { result } = await post(RPC, { jsonrpc: '2.0', id: 1, method: 'getnep17balances', params: [address] }) + return result?.balance ?? [] +} + +async function sumTokens({ api, owners = [] }) { + for (const owner of owners) { + const balances = await getNep17Balances(owner) + for (const { assethash, amount } of balances) { + const asset = ASSETS[assethash.toLowerCase()] + if (!asset) continue + api.addCGToken(asset.geckoId, Number(amount) / 10 ** asset.decimals) + } + await sleep(200) + } +} + +module.exports = { + getNep17Balances, + sumTokens, +} diff --git a/projects/helper/chain/ontology.js b/projects/helper/chain/ontology.js new file mode 100644 index 00000000000..f0d59bacb32 --- /dev/null +++ b/projects/helper/chain/ontology.js @@ -0,0 +1,27 @@ +const { get } = require('../http') +const { sleep } = require('../utils') + +// native ONT / ONG balances (already in whole coins) from the Ontology explorer +const ASSETS = { ont: 'ontology', ong: 'ong' } + +async function getNativeBalances(address) { + const { result } = await get(`https://explorer.ont.io/v2/addresses/${address}/native/balances`) + return result ?? [] +} + +async function sumTokens({ api, owners = [] }) { + for (const owner of owners) { + const balances = await getNativeBalances(owner) + for (const { asset_name, balance } of balances) { + const geckoId = ASSETS[asset_name] + if (!geckoId) continue + api.addCGToken(geckoId, Number(balance)) + } + await sleep(200) + } +} + +module.exports = { + getNativeBalances, + sumTokens, +} diff --git a/projects/helper/chain/polkadot.js b/projects/helper/chain/polkadot.js index 04a130b51cb..88ac37d72f8 100644 --- a/projects/helper/chain/polkadot.js +++ b/projects/helper/chain/polkadot.js @@ -7,51 +7,38 @@ const { substrate } = sdk.chains // Polkadot moved account balances off the relay chain onto Asset Hub, so the relay // chain now reports 0 for accounts that still hold DOT. Query both and take the sum -// so this keeps working either side of the migration. +// so this keeps working either side of the migration. Kusama did the same migration. // // Three independent sources, tried in this order: // 1. public JSON-RPC nodes (state_getStorage on System.Account via sdk.chains.substrate) - keyless, -// endpoints rotated on failure (POLKADOT_RELAY_RPC / POLKADOT_ASSETHUB_RPC, comma separated) +// endpoints rotated on failure (_SUBSTRATE_RPC, comma separated) // 2. Parity's public Sidecar - keyless, but the relay-chain instance 429s under ~5 concurrent calls // 3. Subscan - 2 req/s per key and the key is shared by every CEX adapter in the run, so it 429s under load // RPC and Sidecar are shuffled per call so load alternates between them; Subscan is always last. -const DOT_DECIMALS = 1e10 - -const rpcChains = ['polkadot_relay', 'polkadot_assethub'] +const configs = { + polkadot: { + decimals: 1e10, + geckoId: 'polkadot', + rpcChains: ['polkadot_relay', 'polkadot_assethub'], + sidecarHosts: ['polkadot-public-sidecar', 'polkadot-asset-hub-public-sidecar'], + subscanHosts: ['assethub-polkadot', 'polkadot'], + }, + kusama: { + decimals: 1e12, + geckoId: 'kusama', + rpcChains: ['kusama', 'kusama_assethub'], + sidecarHosts: ['kusama-public-sidecar', 'kusama-asset-hub-public-sidecar'], + subscanHosts: ['assethub-kusama', 'kusama'], + }, +} -const sidecarHosts = ['polkadot-public-sidecar', 'polkadot-asset-hub-public-sidecar'] const sidecarUrl = (host, account) => `https://${host}.parity-chains.parity.io/accounts/${account}/balance-info` - -const subscanHosts = ['assethub-polkadot', 'polkadot'] const subscanUrl = host => `https://${host}.api.subscan.io/api/v2/scan/search` const shuffle = (arr) => arr.map(v => [Math.random(), v]).sort((a, b) => a[0] - b[0]).map(([, v]) => v) -// ---- 1. raw storage read ------------------------------------------------------------------- - -// System.Account free + reserved on both chains, in DOT -async function getBalanceRpc(account) { - let total = 0 - for (const chain of rpcChains) { - const { free, reserved } = await substrate.getSystemAccount({ chain, address: account }) - total += Number(BigInt(free) + BigInt(reserved)) / DOT_DECIMALS - } - return total -} - -// ---- 2. sidecar ---------------------------------------------------------------------------- - -async function getBalanceSidecar(account) { - let total = 0 - for (const host of sidecarHosts) { - const data = await get(sidecarUrl(host, account)) - total += (+(data.free ?? 0) + +(data.reserved ?? 0)) / DOT_DECIMALS - } - return total -} - -// ---- 3. subscan ---------------------------------------------------------------------------- +// ---- 3. subscan limiter -------------------------------------------------------------------- // Subscan allows 2 requests/second. Space calls out to stay under it, // and retry with backoff if we still get throttled. @@ -91,41 +78,69 @@ async function subscanPost(host, key) { }) } -async function getBalanceSubscan(account) { - let total = 0 - for (const host of subscanHosts) { - const data = await subscanPost(host, account) - total += +(data?.data?.account?.balance ?? 0) +function makeHelper(name) { + const { decimals, geckoId, rpcChains, sidecarHosts, subscanHosts } = configs[name] + + // ---- 1. raw storage read: System.Account free + reserved on both chains, in whole coins + async function getBalanceRpc(account) { + let total = 0 + for (const chain of rpcChains) { + const { free, reserved } = await substrate.getSystemAccount({ chain, address: account }) + total += Number(BigInt(free) + BigInt(reserved)) / decimals + } + return total } - return total -} -// ---- combine ------------------------------------------------------------------------------- - -async function getBalance(account) { - const sources = [...shuffle([getBalanceRpc, getBalanceSidecar]), getBalanceSubscan] - let lastError - for (const source of sources) { - try { - return await source(account) - } catch (e) { - lastError = e - sdk.log(`polkadot: ${source.name} failed for ${account}, trying next source: ${e.message}`) + // ---- 2. sidecar + async function getBalanceSidecar(account) { + let total = 0 + for (const host of sidecarHosts) { + const data = await get(sidecarUrl(host, account)) + total += (+(data.free ?? 0) + +(data.reserved ?? 0)) / decimals } + return total } - throw lastError -} -async function sumTokens({ balances = {}, owners = [] }) { - let total = 0 - for (const owner of owners) { - const balance = await getBalance(owner) - total += balance + // ---- 3. subscan + async function getBalanceSubscan(account) { + let total = 0 + for (const host of subscanHosts) { + const data = await subscanPost(host, account) + total += +(data?.data?.account?.balance ?? 0) + } + return total } - sdk.util.sumSingleBalance(balances, 'polkadot', total) - return balances + + async function getBalance(account) { + const sources = [...shuffle([getBalanceRpc, getBalanceSidecar]), getBalanceSubscan] + let lastError + for (const source of sources) { + try { + return await source(account) + } catch (e) { + lastError = e + sdk.log(`${name}: ${source.name} failed for ${account}, trying next source: ${e.message}`) + } + } + throw lastError + } + + async function sumTokens({ balances = {}, owners = [] }) { + let total = 0 + for (const owner of owners) { + const balance = await getBalance(owner) + total += balance + } + sdk.util.sumSingleBalance(balances, geckoId, total) + return balances + } + + return { sumTokens, getBalance } } +const polkadot = makeHelper('polkadot') + module.exports = { - sumTokens + sumTokens: polkadot.sumTokens, + makeHelper, } diff --git a/projects/helper/chain/proton.js b/projects/helper/chain/proton.js index 587f1182fff..327b71fcd5f 100644 --- a/projects/helper/chain/proton.js +++ b/projects/helper/chain/proton.js @@ -120,7 +120,16 @@ async function getTokenPriceUsd(tokenSymbol, tokenContract) { return exchangeRate.price } +// native XPR balances of named accounts +async function sumTokens({ api, owners = [] }) { + for (const owner of owners) { + const [balance] = (await getCurrencyBalance('eosio.token', owner, 'XPR')) ?? [] + api.addCGToken('proton', parseFloat(balance ?? '0')) + } +} + module.exports = { + sumTokens, getTableRows, getCurrencyBalance, getAllOracleData, diff --git a/projects/helper/chains.json b/projects/helper/chains.json index cd37246f5a1..8bebea0ddb3 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -382,6 +382,7 @@ "pi", "planq", "plasma", + "platon", "plume", "plume_mainnet", "pokt", diff --git a/projects/helper/env.js b/projects/helper/env.js index 86b22c95171..34a4d6f7dca 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -88,6 +88,8 @@ const DEFAULTS = { // p2p/everstake neon proxies are gone (dns), thirdweb refuses the chain; blockscout's eth-rpc proxy still serves it NEON_EVM_RPC: 'https://neon.blockscout.com/api/eth-rpc', THORCHAIN_LCD: 'https://gateway.liquify.com/chain/thorchain_api', + INITIA_LCD: 'https://rest.initia.xyz', + KUSAMA_ASSETHUB_SUBSTRATE_RPC: 'https://kusama-asset-hub-rpc.polkadot.io,https://statemine.api.onfinality.io/public', } const ENV_KEYS = [ diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index 372df6c08f2..bb956c27f01 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -29,6 +29,12 @@ const helpers = { "arweave": require("./chain/arweave"), "pi": require("./chain/pi"), "polkadot": require("./chain/polkadot"), + "kusama": require("./chain/kusama"), + "filecoin": require("./chain/filecoin"), + "neo3": require("./chain/neo3"), + "ontology": require("./chain/ontology"), + "proton": require("./chain/proton"), + "massa": require("./chain/massa"), "acala": require("./chain/acala"), "bifrost": require("./chain/bifrost"), "aelf": require("./chain/aelf"), diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index a7394d61c76..6e0ed973ddd 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -21,11 +21,11 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'provenance', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', 'aura', 'xpla', 'bostrom', 'joltify', 'nibiru', 'kopi', 'elys', "pryzm", "mantra", 'agoric', 'band', 'axiome', 'allora', 'celestia', 'dydx', 'dungeon', 'carbon', 'milkyway', 'regen', 'sommelier', 'stride', 'prom', 'babylon', 'xion', 'zigchain', 'thorchain', - 'akash', 'fetchhub' + 'akash', 'fetchhub', 'initia', ] const caseSensitiveChains = [...ibcChains, ...svmChains, 'canton', 'mina', 'decred', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge', 'stellar', 'massa', 'aleo', 'eclipse', 'acala', 'aelf', 'aeternity', 'alephium', 'bifrost', 'bittensor', 'verus', 'dash', 'qubic', 'constellation', 'supra', - 'kaspa', 'bsv', 'arweave', 'pi', 'zcash', 'bitcoincash', 'gnoland', + 'kaspa', 'bsv', 'arweave', 'pi', 'zcash', 'bitcoincash', 'gnoland', 'kusama', 'filecoin', 'neo3', 'ontology', 'proton', ] const transformTokens = { @@ -52,6 +52,10 @@ const fixBalancesTokens = { zigchain: { azig: { coingeckoId: 'zignaly', decimals: 18 }, }, + // the coins service has no platon: entry for the gas token + platon: { + [ADDRESSES.null]: { coingeckoId: 'platon-network', decimals: 18 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From 4a4f10ad11d467d44cb52bbbbf763a8353162697 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 22 Oct 2026 00:23:57 +0200 Subject: [PATCH 395/988] gate: track flux & casper (#21794) --- projects/gate-io/index.js | 11 +++++++++++ projects/helper/cex.js | 10 ++++++++++ projects/helper/chain/casper.js | 27 +++++++++++++++++++++++++++ projects/helper/chain/flux.js | 22 ++++++++++++++++++++++ projects/helper/chains.json | 2 ++ projects/helper/sumTokens.js | 2 ++ projects/helper/tokenMapping.js | 2 +- projects/hex-bond/index.js | 17 +++++++---------- 8 files changed, 82 insertions(+), 11 deletions(-) create mode 100644 projects/helper/chain/casper.js create mode 100644 projects/helper/chain/flux.js diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index 94d77d1569b..4ca4878861b 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -385,6 +385,17 @@ const config = { "aleo18lpsmdx0hzwhw6ejaad5j8hjngwddyn0ap8ws8cr0z7gls4k4s9qz5ww07" ] }, + "casper": { + "owners": [ + "0202f89b7f0329ef356ad5315f03f5ac2ec0eb248055a806b4b4465132b96a879b86", + "0203f3f44c9e80e2cedc1a2909631a3adea8866ee32187f74d0912387359b0ff36a2", + ] + }, + "flux": { + "owners": [ + "t1YvimnGBmVA7xDiPnqwbKsvujmSJz4X5m2", + ] + }, "allora": { "owners": [ "allo155svs6sgxe55rnvs6ghprtqu0mh69kehdq4wh6", diff --git a/projects/helper/cex.js b/projects/helper/cex.js index aa7440b69e2..d00e997ff7f 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -144,6 +144,7 @@ const defaultTokens = { '0xaa7a9ca87d3694b5755f213b5d04094b8d0f0a6f', // TRAC '0xeD35af169aF46a02eE13b9d79Eb57d6D68C1749e', // OMI '0xb0076de78dc50581770bba1d211ddc0ad4f2a241', // EDGEX + '0x66761fa41377003622aee3c7675fc7b5c1c2fac5', // CPOOL ], tron: [ nullAddress, @@ -282,6 +283,8 @@ const defaultTokens = { "0x1Ba42e5193dfA8B03D15dd1B86a3113bbBEF8Eeb", // ZEC "0x000Ae314E2A2172a039B26378814C252734f556A", // ASTER "0x9d10a1ec41Fe7878429BB457e31F9b050D38c633", // BDX + "0xc69b16cf18cea1e5d0bb6a1a9db802097790ddd2", // CNPY + "0x277add739c6e0477616948357af9e79fe1ec9b80", // AEON ], eos: [ @@ -289,6 +292,10 @@ const defaultTokens = { ["tethertether", "USDT", "tether"], ["core.vaulta", "A", "vaulta"], ], + citrea: [ + nullAddress, + '0x547afd93b9c47d552059feb556909e017f8a9b25', // CTR + ], arbitrum: [ nullAddress, ADDRESSES.arbitrum.USDC, // USDC @@ -318,6 +325,9 @@ const defaultTokens = { '0xed6e000def95780fb89734c07ee2ce9f6dcaf110', // EDGE '0xfb31f85a8367210b2e4ed2360d2da9dc2d2ccc95', // EDEL '0xc0634090F2Fe6c6d75e61Be2b949464aBB498973', // KEETA + '0x11030f79109269d796fd0fb956d6244e502757f7', // CTR + '0xb095274743941e953c746f9c228da9c18bb6ec29', // LAPTOP + '0x5ab3d4c385b400f3abb49e80de2faf6a88a7b691', // FLOCK ], avax: [ nullAddress, diff --git a/projects/helper/chain/casper.js b/projects/helper/chain/casper.js new file mode 100644 index 00000000000..139a32121d5 --- /dev/null +++ b/projects/helper/chain/casper.js @@ -0,0 +1,27 @@ +const axios = require('axios') +const { DEFAULT_TIMEOUT } = require('../http') + +// Casper mainnet json-rpc; owners are account public keys (01... ed25519 / 02... secp256k1) +const RPC = 'https://node.mainnet.casper.network/rpc' +const MOTES_PER_CSPR = 1e9 + +// liquid CSPR in the account's main purse (motes); delegated/staked CSPR is not included +async function getBalance(owner) { + const { data } = await axios.post(RPC, { + jsonrpc: '2.0', id: 1, method: 'query_balance', + params: { purse_identifier: { main_purse_under_public_key: owner } }, + }, { timeout: DEFAULT_TIMEOUT }) + if (data.error) throw new Error(`casper query_balance failed for ${owner}: ${JSON.stringify(data.error)}`) + return Number(data.result.balance) / MOTES_PER_CSPR +} + +async function sumTokens({ owners = [], api }) { + for (const owner of owners) + api.addCGToken('casper-network', await getBalance(owner)) + return api.getBalances() +} + +module.exports = { + getBalance, + sumTokens, +} diff --git a/projects/helper/chain/flux.js b/projects/helper/chain/flux.js new file mode 100644 index 00000000000..4af4811e7e1 --- /dev/null +++ b/projects/helper/chain/flux.js @@ -0,0 +1,22 @@ +const axios = require('axios') +const { DEFAULT_TIMEOUT } = require('../http') + +// Flux (ex ZelCash) is a Zcash fork with its own chain; t1... transparent addresses +const EXPLORER_API = 'https://explorer.runonflux.io/api' + +// confirmed FLUX balance in satoshis (8 decimals) +async function getBalance(addr) { + const { data } = await axios.get(`${EXPLORER_API}/addr/${addr}/balance`, { timeout: DEFAULT_TIMEOUT }) + return Number(data) +} + +async function sumTokens({ api, owners = [] }) { + for (const owner of owners) + api.addCGToken('zelcash', await getBalance(owner) / 1e8) + return api.getBalances() +} + +module.exports = { + getBalance, + sumTokens, +} diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 8bebea0ddb3..7d117322a79 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -89,6 +89,7 @@ "capx", "carbon", "cardano", + "casper", "celestia", "celo", "chainflip", @@ -191,6 +192,7 @@ "flow", "fluence", "fluent", + "flux", "fogo", "formnetwork", "fraxtal", diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index bb956c27f01..0ad8486af48 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -61,6 +61,8 @@ const helpers = { "iota": require("./chain/iota"), "mina": require("./chain/mina"), "decred": require("./chain/decred"), + "casper": require("./chain/casper"), + "flux": require("./chain/flux"), } svmChains.forEach(chain => { diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 6e0ed973ddd..070f4046fb3 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -25,7 +25,7 @@ const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 's ] const caseSensitiveChains = [...ibcChains, ...svmChains, 'canton', 'mina', 'decred', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge', 'stellar', 'massa', 'aleo', 'eclipse', 'acala', 'aelf', 'aeternity', 'alephium', 'bifrost', 'bittensor', 'verus', 'dash', 'qubic', 'constellation', 'supra', - 'kaspa', 'bsv', 'arweave', 'pi', 'zcash', 'bitcoincash', 'gnoland', 'kusama', 'filecoin', 'neo3', 'ontology', 'proton', + 'kaspa', 'bsv', 'arweave', 'pi', 'zcash', 'flux', 'bitcoincash', 'gnoland', 'kusama', 'filecoin', 'neo3', 'ontology', 'proton', ] const transformTokens = { diff --git a/projects/hex-bond/index.js b/projects/hex-bond/index.js index 584019b87dd..88a76f85eaa 100644 --- a/projects/hex-bond/index.js +++ b/projects/hex-bond/index.js @@ -36,10 +36,8 @@ async function tvl(api) { }) const stakes = await api.multiCall({ abi: abi.stakeDataFetch, calls: hsiAddresses }) - const [maturityInfo, wrapped] = await Promise.all([ - api.multiCall({ target: HEX_BOND_MANAGER, abi: abi.maturityInfo, calls: MATURITIES }), - api.multiCall({ target: BOND_MIGRATOR, abi: abi.wrapped, calls: MATURITIES }), - ]) + const maturityInfo = await api.multiCall({ target: HEX_BOND_MANAGER, abi: abi.maturityInfo, calls: MATURITIES }) + const wrapped = await api.multiCall({ target: BOND_MIGRATOR, abi: abi.wrapped, calls: MATURITIES }) // HEX principal in custodied stakes, settled HEX in redemption pots, and // Actuator HTT claims held by the migrator (redeemable 1:1 for HEX at maturity). @@ -49,17 +47,16 @@ async function tvl(api) { } async function pool2(api) { - const [masterChefPools, hbrpChefPools] = await Promise.all([ - api.fetchList({ target: MASTER_CHEF, lengthAbi: abi.poolLength, itemAbi: abi.masterChefPoolInfo }), - api.fetchList({ target: HBRP_CHEF, lengthAbi: abi.poolLength, itemAbi: abi.hbrpChefPoolInfo }), - ]) + const masterChefPools = await api.fetchList({ target: MASTER_CHEF, lengthAbi: abi.poolLength, itemAbi: abi.masterChefPoolInfo }) + const hbrpChefPools = await api.fetchList({ target: HBRP_CHEF, lengthAbi: abi.poolLength, itemAbi: abi.hbrpChefPoolInfo }) masterChefPools.forEach((pool) => api.add(pool.lpToken, pool.totalStaked)) hbrpChefPools.forEach((pool) => api.add(pool.token, pool.lpBalance)) // Farm LPs pair HBR/HBRP with HEX, WPLS, PLSX or INC; each LP is valued at - // twice its priced side. HBR and HBRP themselves are not priced. + // twice its priced side. Some pools stake single tokens (HBR/HBRP) that are + // not LPs, so let the helper filter by symbol rather than assuming every entry is an LP. const lps = [...masterChefPools.map((pool) => pool.lpToken), ...hbrpChefPools.map((pool) => pool.token)] - return sumUnknownTokens({ api, lps, useDefaultCoreAssets: true, resolveLP: true, allLps: true }) + return sumUnknownTokens({ api, lps, useDefaultCoreAssets: true, resolveLP: true }) } module.exports = { From 3a83a32cae8834e1996c134761bd8f402df873b8 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 21 Oct 2026 18:32:28 -0400 Subject: [PATCH 396/988] blacklist BFBTC (#21796) --- projects/saros-dlmm/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/saros-dlmm/index.js b/projects/saros-dlmm/index.js index b837adf048e..782c10f7a50 100644 --- a/projects/saros-dlmm/index.js +++ b/projects/saros-dlmm/index.js @@ -74,6 +74,7 @@ const blacklistedTokens = new Set([ 'SarosY6Vscao718M4A778z4CGtvcwcGef5M9MEH1LGL', // projects own token, no enough liqudity on the other side of the pool 'uniBKsEV37qLRFZD7v3Z9drX6voyiCM8WcaePqeSSLc', // uniBTC wash trading 'CtzPWv73Sn1dMGVU3ZtLv9yWSyUAanBni19YWDaznnkn', // XBTC was trading + 'DR5cCdABB5sZjyVF7i3mestghxGzvHawQk35sP9QFNjf', // BFBTC ]); async function tvl() { From 752d30259c849f009f5278e7116c9f1930c2f341 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 22 Oct 2026 08:58:43 +0200 Subject: [PATCH 397/988] fix: integrate sumTokens2 for USDC.e calculation in tvl function --- projects/predictstreet/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/predictstreet/index.js b/projects/predictstreet/index.js index cb674487547..a099bc036ae 100644 --- a/projects/predictstreet/index.js +++ b/projects/predictstreet/index.js @@ -1,5 +1,6 @@ const { getLogs2 } = require('../helper/cache/getLogs') const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') const VAULT_FACTORY = '0xc16B8b190064451c2FeEb2e77c4B2aC4c7009552' const CONDITIONAL_TOKENS = '0xD28B8295Cd57F205e4d080Ff4c6d23C06a9EEe3a' // locks collateral backing open positions @@ -23,11 +24,14 @@ async function tvl(api) { const clones = wcols.filter(a => a && a !== ADDRESSES.null) const owners = [CONDITIONAL_TOKENS].concat(vaults, clones) + console.log(owners.len) // sum idle USDC.e in all vaults, ConditionalTokens, and neg-risk WrappedCollateral clones - await api.sumTokens({ owners, tokens: [ADDRESSES.adi.USDC_e] }) // USDC.e + return sumTokens2({ api, owners, token: ADDRESSES.adi.USDC_e, sumChunkSize: 5000}) + // await api.sumTokens({ owners, tokens: [ADDRESSES.adi.USDC_e] }) // USDC.e } module.exports = { + isHeavyProtocol: true, methodology: 'TVL is the USDC.e (bridged USDC) collateral held by PredictStreet: the idle balance of every ' + 'user vault (vaults enumerated via VaultCreated events), plus collateral locked in the ConditionalTokens ' + From 12ff22ad30ad76f44c3653d5110e4e51dcdac63b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 22 Oct 2026 11:51:26 +0200 Subject: [PATCH 398/988] update bitget --- projects/bitget/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/bitget/index.js b/projects/bitget/index.js index 5d1f9577c85..841388955d3 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -87,6 +87,7 @@ const evmOwners = [ "0xa4856e07d14045014b2c3fece5460bd37b310f10", // add on 05/10/2026 "0x46852e1ff32739ddd2623bd06b27ca39f1143cc7", // add on 21/10/2026 "0x95047fe21071e8038810975cfc9ee6da7dee33a4", // add on 21/10/2026 + "0x43f17ce0473709e9f5c91cf950811171a248556d", ] const evmChains = ["bsc","ethereum","arbitrum","optimism","era","fantom","cronos","avax","polygon","metis","kava","klaytn","base","hyperliquid","sonic","morph","plasma","robinhood","arc","sei","monad","linea","scroll","wc","megaeth"] From 14dd8805c869102e49c8efc423a29ca278330b99 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Thu, 22 Oct 2026 16:29:26 +0200 Subject: [PATCH 399/988] Fix Futarchy AMM TVL after IDL update (#21801) --- projects/futarchy-amm/index.js | 6 ++++++ projects/helper/custom-scripts/metadao/index.js | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/projects/futarchy-amm/index.js b/projects/futarchy-amm/index.js index 83248427373..9c102eac323 100644 --- a/projects/futarchy-amm/index.js +++ b/projects/futarchy-amm/index.js @@ -4,10 +4,16 @@ const { Program, } = require("@project-serum/anchor") const PROGRAM_ID = 'FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq' // Futarchy AMM program +/** + * Counts tokens held in Futarchy AMM DAO vaults. + * @param {object} api + */ async function tvl(api) { const provider = getProvider() const idl = await Program.fetchIdl(PROGRAM_ID, provider) + idl.instructions = [] + idl.accounts = idl.accounts.filter(i => i.name === 'Dao') const program = new Program(idl, PROGRAM_ID, provider) const data = await program.account.dao.all() const tokenAccounts = [] diff --git a/projects/helper/custom-scripts/metadao/index.js b/projects/helper/custom-scripts/metadao/index.js index 7e1b44871c7..6a264897686 100644 --- a/projects/helper/custom-scripts/metadao/index.js +++ b/projects/helper/custom-scripts/metadao/index.js @@ -225,10 +225,15 @@ async function getSplTokenAccountBalance(connection, vaultPk) { } +/** + * Fetches all DAO accounts from the Futarchy AMM program. + */ async function getAllDaos() { const PROGRAM_ID = 'FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq' // Futarchy AMM program const provider = getProvider() const idl = await Program.fetchIdl(PROGRAM_ID, provider) + idl.instructions = [] + idl.accounts = idl.accounts.filter(i => i.name === 'Dao') const program = new Program(idl, PROGRAM_ID, provider) const data = await program.account.dao.all() From c2ab74a5f41afbc76002881921da3b3a78f63379 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Thu, 22 Oct 2026 16:49:07 +0200 Subject: [PATCH 400/988] Add missing chains to OKX adapter (#21747) --- projects/okex/index.js | 166 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) diff --git a/projects/okex/index.js b/projects/okex/index.js index 87e3b2277ee..800ad30c32d 100644 --- a/projects/okex/index.js +++ b/projects/okex/index.js @@ -2,6 +2,8 @@ const ADDRESSES = require("../helper/coreAssets.json"); const { cexExports } = require("../helper/cex"); const { mergeExports, getStakedEthTVL } = require("../helper/utils"); const bitcoinAddressBook = require("../helper/bitcoin-book/index.js"); +const { post } = require("../helper/http"); +const { nullAddress } = require("../helper/tokenMapping"); const config = { bitcoin: { owners: bitcoinAddressBook.okex }, @@ -712,8 +714,142 @@ const config = { "0xcfb691fe064f1caef47eef90a3ddae45225f358c", ], }, + bitcoincash: { + // reserve wallets published in OKX proof of reserves + owners: [ + "3JQrQQzsoqGZnDk3FaYS6EPia4sv5pGS2y", + "3A99Y9QPb9ot6ZYMgvv7fDoxLXW8BBQrTa", + "35ka22WnKNFjjz6fWUV2tAdovcQGuQaQVU", + "3MT81tZMYPkCwUJkgZQtLka3MRiGnbYQrQ", + "39ZnmuSNhxSJqbQL1kGjrGvvUc5PHNKjDJ", + "3AB4wANNpdSkdkba52bHoqp1SNyjfp6nF7", + "3GxtmcatLhjoRVwLszjS3FKGVhSDDZc2vt", + "3HcYUKPzrNUYFeMj3vGwA6nWiCJ1BKzetL", + "3PhYXPnVz3Bzk6By9brz2xFuXidBB7wRJg", + "39AN24C9ZdwEpDx4Wn3rh1Y7bdoZxBDufQ", + "3HxmstpaAe3A89tZHWjTkFxPa8XeopUkqJ", + "38p2JLYJhzkHZvjXSuk8AZYoxq1dKK8Hjp", + "3JNet8tVbYPLV4uGpV2Ry1bdw2Ma6N3hdc", + "37VDL6Kw6p3UQTHn8RVSLDqGdEWhVf5wWU", + "33ngcLW8QQtYuR7HjoU4sgtEbeezNocfP8", + "3Bovhhx3TUGpGFd9ARZaM1kkF6Wny6PPFr", + "3FbhtviAPTnWxtNoE8jAeyeihAqHXvrTPv", + "3JVRoiy8ZCAY2W6VGD3cxCasLvRqbbFk7M", + "3JuyU8aetvRHg1FwusENCUt8ixCZQhJtvA", + "3AUDj2USnMActyvCRpVzFMofVFLeZtqWMx", + "33qcwPbP2WrTsz1LEV4LuLnvnp5QX4Je8p", + "37Et8jpoFHDhArrszeFWQ4JTW35dn7cYw3", + "34a5mYcdFKromE59zXX5TmfMx8YMoywAi7", + ], + }, + ethereumclassic: { + // reserve wallets published in OKX proof of reserves + owners: [ + "0x17317ff152147f4ef9d90e8c52621b248d192a9f", + "0x182a7d836729f7f220c361b38fe862a6676fd514", + "0x2343321968b02b9010d94bd3e518e33b2cb43ad3", + "0x525b59b7aa35cf5d3458b4f3aa7b1a34678bedeb", + "0xbf0111d0fc16b642067ca13a2d5f7442ff0b18c5", + "0xc4da0292461c515a834efe449cb67e70b64b246b", + "0xe4d062d3e4b62e7bf82dddacd1751d3f765f9d2a", + "0xf80b49264f07fc84af38fb8904e6f69cbc5146b9", + "0xfaa83bd8c107e727dab850f624cf00e401916ba7", + "0xd2472941ac1fcb94a16fde6511037a1a85e54b4d", + "0x9c0b93ee033620ad7185852558393e470045f47d", + "0x611f7bf868a6212f871e89f7e44684045ddfb09d", + "0xb0a27099582833c0cb8c7a0565759ff145113d64", + "0x1b3832db9c49f2868194ad76550f18ba7a8cf5f7", + "0x2dfbf909db2575d4b9cb2cd0da3e6e7b53b87ddf", + "0x846a268268e4b561763e042b0e8e237bccf734f3", + "0x667d7e1cd84ce5c928570ab5ab4d3d36739b23d9", + "0x7d33b0f89ef769e0093c3d0f7bc269ddfd0fc558", + "0xea90015d6ea0151379699b43b2240691e34ea992", + "0xc96d0e776dc286a2194e80ef2d827f9c164ad02f", + "0xc1589087f11fde923b38471f19e1c607ac9a43d9", + "0x1305520db240e6197daa3d841c055958050711c4", + "0xd170b23974c0ac399fe8cd6df5f491856f807245", + "0xe639e15b5329f2e69a19510a448d5c1d9fc59af8", + "0x90321720000c38e93d9dd287e75d4cb66212896b", + "0x17828ea782004f22365a0a3d3ece5b00301e134d", + "0x8f0ab94a72affd8d07e445c33ac4f831474186b8", + "0x2c6020fc087d4d6ad710a571d23fdd128045dbca", + "0x2958df6dba14ea522b51ac9de0ef94df8cdf8e54", + "0xc9cfa03adec1b5f3d2b9a9f9bbbf7b5d20109bec", + "0x63a8ab05ae4a3bed92580e05e7dce3b268b54a7f", + "0x0322523d4f5e52c7527ae2d15d0d6047cce74351", + "0x1712657ee2e63705a86af0cc07cc4fd6ff62da47", + "0x580413d3e204e46dc5d429e3242f283cef6d6d0b", + "0xa29f639b056a72753429bbc8deaeaa7bba13a367", + "0xc59765a37166b140bdfa990eb6450b2e378cd1dd", + "0xce97acf84e04f7d98e81d14e2151d8ce2be3c078", + "0xf817f0c4d2f3908bc65a4967517b6750af38b71c", + "0xfe92306245f89f446297503d1f3d263926045376", + "0x30907c9e513a3e57860d61baa95bfc94ff615d19", + "0xbd244f163d9da4df54c2d914a5d4a03b0d53ae2c", + ], + }, + sui: { + // reserve wallets published in OKX proof of reserves + owners: [ + "0xdf7c04c9bebf4b35bd8c66a92469f0b66cf77ce8586b6262709a897659f4e772", + "0x33fbf89217a07be0b7d5525a3bc17119a8d7bd70aa3b16eb77d836a4e6c8a026", + "0x51c7d354fa0001091433f3d1696460be5971b9929a06b10fd4cc620dc48f0c50", + "0x5cee0d361527f8286362b4f2d50c8ada16bb50d483563c0628b39171c1a30d73", + "0xfa982d9c0e8b8d6e9f532f30a6ea84a5ad1ee4bb30a8af63c6a766210673785a", + "0x68e060da8271071e81eaaef375c9df43dd29510278cf1e3b9e49ed4021fd7b87", + "0x204034556683bfd223c62edd67fec690b1fdf385ae00cad12aed50b4663614c2", + "0x9dd9f1c801bec8d8d5bf0bdb08f60bf3447330c6e4fdec40263d0ff42b3ef751", + "0x4dfc8248418969b3f0f4051e114b537ad360c8ab502cbca073ce8d39db3698ec", + "0x95476a5a19ebed27397c75fa349052d98929524f2c2638ffebef6054658324e3", + "0xcc42b111927f950c6de134845cf0c3f23e454f3055ccc150e4125ef83bcf48ff", + "0x47c879ab819dcf3e29210c718cb76e41e274adf92648b5ce29b7448c8c00d25f", + "0xc58c0318ec75d2c9ff6a9b2f6ca51f83cb9f5d7235c8c00fab40d42dc08e03d9", + "0x68837eb88cbeca32dea2e6791c45cb74eedd11042986eb3b2ff335da0c671b1e", + "0xb7c63eb66b87c6ca7bb955b890717a9b6b6ebf0351a58d96daa1119d3c89d010", + "0xfce6072fdae0539f7b67dbb167182b9508db41c28f96d223df8a6dfe003acdf9", + "0x94f73634725e799eb0de94eeb942a8d1f0a0638ed304600cf8e53b2f9ad1062c", + "0x1387737053849ae34a7b56e17a31f27f9c7b0d390e7204be465b76bede439c86", + "0xafa803ea530ca7b517f0532438fe5aec5debc94c6118a89ee4e85314202a9f62", + "0x50178da2437bfe3925cbff55a8ee977cde62321ad3a3ade286596c88a0671bf3", + "0x7dce1b53c23f36dfbac31a50f31f802f918cd1791e041c17cf249996c97aa0cc", + "0x4e875d9578e388736bba18e43e6fb9f67dd5cdf4b3b51511b8ff3e9a77f4a6dc", + "0xc83e077565bffafd625b9e4ea05f22289656ded3533f87b4f9b3e15f859193b3", + "0x777e20f29a3c51520ac9da1a46cd1b5eb687328b675debdd9ecbb5d256568e7d", + "0x0e8f66873614d84814c4011ecaeec00aa1772f3a9cf2f674e3d0c1feae33a3f1", + "0xa232ee105fbb7e568cc4ef12908a883107d70ea39751bf6baa72300b6c011f68", + "0x5e7d6fe0c2862fde8237f3f0671d649a2dd401ee5ebbe0b522ffb44fc947e531", + "0x1505ca4eb0724dfc57d07dee007725baae85f00b8558aaa6c6f9c2e84e7eb7f8", + "0xd17c1a0f914ce20358e2d37fabbbbf4fc44b6df9124033d51cabd686cd1064b5", + "0xa8e693e9bf8ac63bfa10273f3a70b71a9c56cb5ec886c83461c570b983b8e99e", + "0xf41ec57bdddbcedb45f6ab09c7e856ba6906372b07f8a0107c5d2da1ff4a5d85", + "0x51a9adc5bb60bdeb95426ac1438cbdc0fa8255504a69bab525a55e95bcfefa88", + ], + }, }; +const filecoinOwners = [ + "f1mfxobliwdamau2x25t4mcegzhfln5rwng4aemqi", + "f166i6yzjwmenfb3gmca6sihw523vrbvkyskkz2ba", + "f14oflhlzkov4zy5f6hew3l33kcifurff4nhcvu7q", + "f1rbhn7q4zynh44k4dbwxb3gp244wtttc6k4dkqfa", + "f1iesbg2vfubsunwyjjcvaeh3wuxoi4neyatprhmq", + "f1suyxmeneosyqaeuvtxja5fago5rco4myqmiqfxa", + "f1xtwe3tztwvpndqhfu5oajt2w3va7yrbbf656idq", + "f1ohs3ah3pj6s7rna2furnpvcoeztzef5eded6u2y", + "f1zyl5thcjbtjniyxpdnbwumnvv5jyhxgwj26nrpq", + "f1qojadq2cf67wrcrog3cggsznirq7ghfeoqhr5yy", + "f1lm2so6gmnh3a5fgeygmxz47trudyhjpwhwft42i", + "f1hnknmq6z23xvlb7b34d437dzvythgsp6twhm3pq", + "f1rtslpoqqa4djupboxhrijylj5btxycyrzf2m3vi", + "f1cgghcsx3hec4soxqid4rbjovbkzccg7soq6enni", + "f1i35x4aaor3xuw7kamwm4jrczfszfzknmosflyby", + "f17ym6fm57kek4jhjc5ftcq6ef3zijns5hi2tmflq", + "f12nm26c5jkplukmdwfqjcw3kmk6x7isgbtk4eh2q", + "f1alskfmg3zxgdqm5qweddm5ioov6ceicama473ka", + "f1l6jdoldu2hwgt47fdvtelsch6zepoaspgqnuney", + "f1r3rgvwbwes7nwv7ikd5fyhto3nqsgb37c7jrova", +]; + const withdrawalAddresses = [ "0x33baf43a1e7534fe46507a7d4a001881ae9cca44", "0x52a66f3402dfa160458a3cb97577610b564c4db2", @@ -722,6 +858,29 @@ const withdrawalAddresses = [ "0x32ddc4d173745a41e428ccf3756b907673301992", ]; +/** + * Reads the native FIL balance of each wallet from the Filecoin RPC. + * @param {string[]} owners Filecoin wallet addresses + * @returns {Promise} combined balance in attoFIL + */ +async function sumFilecoinBalances(owners) { + const body = owners.map((address, id) => ({ + jsonrpc: "2.0", + id, + method: "Filecoin.StateGetActor", + params: [address, null], + })); + const responses = await post("https://api.node.glif.io/rpc/v0", body); + responses.sort((a, b) => a.id - b.id); + if (responses.length !== owners.length) throw new Error(`Filecoin RPC returned ${responses.length} responses for ${owners.length} wallets`); + return responses.reduce((total, response, index) => { + if (response.id !== index) throw new Error(`Filecoin RPC response ${response.id} at position ${index}`); + if (response.error) throw new Error(`Filecoin RPC error for ${owners[index]}: ${response.error.message}`); + if (!response.result) throw new Error(`Filecoin RPC returned no actor for ${owners[index]}`); + return total + BigInt(response.result.Balance); + }, 0n); +} + module.exports = mergeExports([ cexExports(config), { @@ -734,4 +893,11 @@ module.exports = mergeExports([ }), }, }, + { + filecoin: { + tvl: async (api) => { + api.add(nullAddress, await sumFilecoinBalances(filecoinOwners)); + }, + }, + }, ]); From e8e5c8023e0f61802323f3db069959713873d48a Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 22 Oct 2026 11:36:53 -0400 Subject: [PATCH 401/988] update aero factories (#21804) --- projects/aero-lite/index.js | 15 ++++++++------- projects/aero-v2/index.js | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/projects/aero-lite/index.js b/projects/aero-lite/index.js index d595d963243..195d8cf9a6c 100644 --- a/projects/aero-lite/index.js +++ b/projects/aero-lite/index.js @@ -9,15 +9,16 @@ const abis = { const config = { arc: { factories: [ - '0xb89Df768aF2CFE637ceB352c587Fe8edAf491d03', // CL + '0xb89Df768aF2CFE637ceB352c587Fe8edAf491d03', // CL (lite launch) + '0x7F83235643181E440433400a027618Cd50879751', // CL ], }, - base: {factories: ['0xC6bdE6e9F0CD71013E5FcF2dAAE2fA1c71Bb2F25']}, - optimism: {factories: ['0xf3384180f1F99Ff4448e836b7773e7B7A2D1fa3b']}, - arbitrum: {factories: ['0x2f1ea2c2dEf80FCa460c0dcF205C281a8116834b']}, - ethereum: {factories: ['0xAbD524b6f8dAae68314Ad2fD7698cb65b4f8D398']}, - ink: {factories: ['0xAbD524b6f8dAae68314Ad2fD7698cb65b4f8D398']}, - robinhood: {factories: ['0xAbD524b6f8dAae68314Ad2fD7698cb65b4f8D398']}, + base: {factories: ['0x9CB220581b91b0C83223012FE69688b92aD07a76']}, + optimism: {factories: ['0xfeaB42D90055db3a0616249f76B6002D72266778']}, + arbitrum: {factories: ['0x88a60ee77392577c355C0acb2A8d476D5a4EC03a']}, + ethereum: {factories: ['0xF4Fd2E6c5B60c5b365cd1B96DD6245E6D60414c2']}, + ink: {factories: ['0x7660BF2aDefC687C22906112ca323d60A00358cF']}, + robinhood: {factories: ['0xc63d7338c178e805c544B8f897066bD3BBcBE136']}, } const exportsList = [] diff --git a/projects/aero-v2/index.js b/projects/aero-v2/index.js index 36a22e895f7..04c94d6be3f 100644 --- a/projects/aero-v2/index.js +++ b/projects/aero-v2/index.js @@ -5,8 +5,8 @@ const abis = { allPairsLength: 'uint256:allPoolsLength', allPairs: 'function allPools(uint256) view returns (address)', } -const stableTvl = uniTvlExport('chain', "0xaEd253F1aD84d99f2165256D701b2b481DD4CC16", { abis, hasStablePools: true, permitFailure: true, useDefaultCoreAssets: false, }).chain.tvl -const volatileTvl = uniTvlExport('chain', "0x9bc8b3F60D349d687Fb44A018967025E3741F9a5", { abis, permitFailure: true, }).chain.tvl +const stableTvl = uniTvlExport('chain', "0x78589E876edcEbdce72ee3436ab3c9AD3a7cEF2D", { abis, hasStablePools: true, permitFailure: true, useDefaultCoreAssets: false, }).chain.tvl +const volatileTvl = uniTvlExport('chain', "0x8E6a9FCd1d638CC760Ffba397605Fe3355dE76D2", { abis, permitFailure: true, }).chain.tvl const chains = ['optimism', 'base', 'arc', 'arbitrum', 'ethereum', 'ink', 'robinhood'] From ee65606241f5256559870c854019c8d0a7c2a909 Mon Sep 17 00:00:00 2001 From: iaeroProtocol Date: Thu, 22 Oct 2026 19:47:09 +0100 Subject: [PATCH 402/988] iAERO: track backing after the Aerodrome -> Aero migration (#21802) Co-authored-by: Claude Opus 5.5 (1M context) Co-authored-by: FelixBruguera --- projects/iaero/index.js | 61 +++++++++++++---------------------------- 1 file changed, 19 insertions(+), 42 deletions(-) diff --git a/projects/iaero/index.js b/projects/iaero/index.js index 300c6cd1768..5b10d584e83 100644 --- a/projects/iaero/index.js +++ b/projects/iaero/index.js @@ -1,60 +1,37 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs'); // --- CONSTANTS --- -const AERO_TOKEN = ADDRESSES.base.AERO; +// On 2026-10-22 Aerodrome migrated to Aero on Base. iAERO's backing moved from veAERO NFTs +// held by the PermalockVault (0x180DAB53968e599Dd43CF431E27CB01AA5C37909) into a permanent +// stake on the Aero VotingEscrow. +const AERO_TOKEN = '0x3f5bF3EdAc59d650D8fDf9657a71F2f904A3a4Ee'; // Aero AERO (new token) const iAERO_TOKEN = '0x81034fb34009115f215f5d5f564aac9ffa46a1dc'; -const VE_AERO_CONTRACT = '0xeBf418Fe2512e7E6bd9b87a8F0f294aCDC67e6B4'; // Aerodrome Voting Escrow +const AERO_VOTING_ESCROW = '0xBF7977E1521e9a3032bf7243Ee4712f311f13915'; -const VAULT_ADDRESS = '0x180DAB53968e599Dd43CF431E27CB01AA5C37909'; -const PEG_DEFENDER = '0x7961523a81cc89beb33f2f140255213a6433cdbd'; +// Permanent Aero stakes that back iAERO. Update this list if the stake is moved or re-issued +// (e.g. when the sAERO vault takes custody of it). +const STAKE_IDS = [1584]; -const POOL_V2 = '0x08d49da370ecffbc4c6fdd2ae82b2d6ae238affd'; +const PEG_DEFENDER = '0x7961523a81cc89beb33f2f140255213a6433cdbd'; +const POOL_V2 = '0x72Decb30DFE4F6Cf7Db3ba1D58411dDda5ed903b'; // Aero vAMMV2-AERO/iAERO -// --- ABIs --- const ABI = { - // Standard - balanceOf: "erc20:balanceOf", - token0: "function token0() view returns (address)", - token1: "function token1() view returns (address)", - totalSupply: "function totalSupply() view returns (uint256)", - tokenOfOwnerByIndex: "function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)", - - // veAERO Specific - ownerToNFTokenIdList: "function ownerToNFTokenIdList(address, uint256) view returns (uint256)", - locked: "function locked(uint256) view returns (int128 amount, uint256 end)", - - // V2 Pool Reserves - getReserves: "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", + staked: 'function staked(uint256) view returns (uint128 amount, uint48 end, bool isPermanent)', }; async function tvl(api) { + // AERO side of the protocol-owned AERO/iAERO liquidity held by the Peg Defender + await sumTokens2({ api, owner: PEG_DEFENDER, tokens: [POOL_V2], resolveLP: true }); + api.removeTokenBalance(iAERO_TOKEN); // we dont treat project's own token as TVL - await sumTokens2({ api, owner: PEG_DEFENDER, tokens: [POOL_V2], resolveLP: true }) - api.removeTokenBalance(iAERO_TOKEN) // we dont treat project's own token as TVL - - - // --- PART A: veAERO in Vault --- - const vaultBalance = await api.call({ target: VE_AERO_CONTRACT, params: [VAULT_ADDRESS], abi: ABI.balanceOf }); - const calls = []; - - - for (let i = 0; i < vaultBalance; i++) { - calls.push({ target: VE_AERO_CONTRACT, params: [VAULT_ADDRESS, i] }); - } - const vaultTokenIds = await api.multiCall({ abi: ABI.ownerToNFTokenIdList, calls }); - - const lockedCalls = vaultTokenIds.map(id => ({ target: VE_AERO_CONTRACT, params: [id] })); - const lockedData = await api.multiCall({ abi: ABI.locked, calls: lockedCalls }); - - lockedData.forEach((data) => { - api.add(AERO_TOKEN, data.amount); - }); + // AERO permanently staked on the Aero VotingEscrow + const stakes = await api.multiCall({ target: AERO_VOTING_ESCROW, abi: ABI.staked, calls: STAKE_IDS }); + stakes.forEach(({ amount }) => api.add(AERO_TOKEN, amount)); } module.exports = { - methodology: 'TVL includes veAERO locked in the protocol vault and V2 liquidity held by the Peg Defender. iAERO is priced internally via the AERO peg.', + methodology: 'TVL is the AERO permanently staked on the Aero VotingEscrow that backs iAERO, plus the AERO side of the AERO/iAERO liquidity owned by the Peg Defender. iAERO itself is excluded.', base: { tvl } -}; \ No newline at end of file +}; From b57d4451de7a60c956e376c7d0122cb67f6350a7 Mon Sep 17 00:00:00 2001 From: Ferengi69 <92767684+Ferengi69@users.noreply.github.com> Date: Thu, 22 Oct 2026 22:59:59 +0400 Subject: [PATCH 403/988] Add Goo Exchange Vaults (curated vaults on Robinhood Chain) (#21748) Co-authored-by: Claude Opus 5.5 --- projects/goo-exchange-vaults/index.js | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/goo-exchange-vaults/index.js diff --git a/projects/goo-exchange-vaults/index.js b/projects/goo-exchange-vaults/index.js new file mode 100644 index 00000000000..7ae7f650152 --- /dev/null +++ b/projects/goo-exchange-vaults/index.js @@ -0,0 +1,28 @@ +// Goo Exchange curated vaults on Robinhood Chain: each vault is the only liquidity provider of its own pool on a +// separate vault-pool factory (not the goo-exchange DEX factory), holds it as two Uniswap V3 positions and compounds +// arbitrage profit into them. +const VAULT_FACTORY = '0xB4FE65D4A7Fa5Fe40A58e78eF3B5eE34a0059643' + +const abi = { + vaultAt: 'function vaultAt(uint256) view returns (address)', + // what the vault's holders own: both positions at the pool's price, what the pool owes the vault and its idle + // tokens, less what payees are owed + totals: 'function totals() view returns (uint256 total0, uint256 total1)', +} + +async function tvl(api) { + const vaults = await api.fetchList({ lengthAbi: 'uint256:vaultCount', itemAbi: abi.vaultAt, target: VAULT_FACTORY }) + const token0s = await api.multiCall({ abi: 'address:token0', calls: vaults }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: vaults }) + const totals = await api.multiCall({ abi: abi.totals, calls: vaults }) + totals.forEach(({ total0, total1 }, i) => { + api.add(token0s[i], total0) + api.add(token1s[i], total1) + }) +} + +module.exports = { + start: '2026-10-19', + methodology: 'Counts what the holders of every Goo Exchange curated vault own: each vault\'s two Uniswap V3 positions at its pool\'s price, plus what the pool owes the vault and its idle tokens, less what payees are owed. Vaults are listed by the vault factory. Their pools sit on a separate factory from the Goo Exchange DEX, so this TVL is not part of the DEX\'s.', + robinhood: { tvl }, +} From 05ad8af6b49eed6fb15860996d275c119573d594 Mon Sep 17 00:00:00 2001 From: EfficioVitae <161679703+ElijahMoses@users.noreply.github.com> Date: Fri, 23 Oct 2026 02:50:17 +0700 Subject: [PATCH 404/988] Umbrae: add Robinhood Chain DLMM pool TVL (#21753) --- projects/umbrae/index.js | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/projects/umbrae/index.js b/projects/umbrae/index.js index df254bc0cd6..e97f43f459a 100644 --- a/projects/umbrae/index.js +++ b/projects/umbrae/index.js @@ -1,15 +1,16 @@ const { sumTokens2 } = require('../helper/unwrapLPs') /** - * Umbrae runs two AMM designs on Base, both deployed from factories that expose - * the same enumeration surface (`allPairsLength()` / `allPairs(uint256)`) and - * whose pairs expose `tokenX()` / `tokenY()`: + * Umbrae runs two AMM designs, both deployed from factories that expose the + * same enumeration surface (`allPairsLength()` / `allPairs(uint256)`) and whose + * pairs expose `tokenX()` / `tokenY()`: * * - DLMM — a Liquidity Book style discrete-bin concentrated-liquidity AMM. - * Two generations are live: the original factory, which is paused - * for trading but still open for LP withdrawals (so it still holds - * user funds and must be counted), and the current v2 factory. - * - DAMM — a dynamic-fee constant-product AMM. + * On Base two generations are live: the original factory, which is + * paused for trading but still open for LP withdrawals (so it still + * holds user funds and must be counted), and the current v2 factory. + * Robinhood Chain runs the same DLMM v2 contracts from its own factory. + * - DAMM — a dynamic-fee constant-product AMM (Base only). * * In both designs the pair contract custodies the liquidity directly, so TVL is * the pair's balance of its own two tokens. @@ -18,11 +19,16 @@ const { sumTokens2 } = require('../helper/unwrapLPs') // historical blocks where a later factory does not exist yet, and calling // `allPairsLength()` on an empty address reverts, so factories are filtered by // block before they are queried. -const factories = [ - { factory: '0x17Da44dcbdffD8c715be7A368E19F252C2940Fee', fromBlock: 43528312 }, // DLMM, original deployment (withdrawal-only) - { factory: '0x9DBB9289d0D75508b5D8EE01FfE4eb7c412F733b', fromBlock: 50392460 }, // DLMM v2 - { factory: '0xD14322b444415d78DBBF646BB369Ec325a1aCD5c', fromBlock: 45693740 }, // DAMM v4 -] +const config = { + base: [ + { factory: '0x17Da44dcbdffD8c715be7A368E19F252C2940Fee', fromBlock: 43528312 }, // DLMM, original deployment (withdrawal-only) + { factory: '0x9DBB9289d0D75508b5D8EE01FfE4eb7c412F733b', fromBlock: 50392460 }, // DLMM v2 + { factory: '0xD14322b444415d78DBBF646BB369Ec325a1aCD5c', fromBlock: 45693740 }, // DAMM v4 + ], + robinhood: [ + { factory: '0xea3a13d8734b53A322181885E8c6C3D82FFb3A02', fromBlock: 88948093 }, // DLMM v2, deployed 2026-10-15 + ], +} const abi = { allPairsLength: 'uint256:allPairsLength', @@ -33,14 +39,14 @@ const abi = { /** * Read pool token balances without calling factories before their deployment. - * @param {import('@defillama/sdk').ChainApi} api Snapshot-bound Base RPC client. + * @param {import('@defillama/sdk').ChainApi} api Snapshot-bound RPC client for one configured chain. * @returns {Promise} Underlying token balances for DefiLlama pricing. */ async function tvl(api) { const tokensAndOwners = [] const block = await api.getBlock() - for (const { factory, fromBlock } of factories) { + for (const { factory, fromBlock } of config[api.chain]) { if (block < fromBlock) continue const pairs = await api.fetchList({ @@ -62,9 +68,12 @@ async function tvl(api) { module.exports = { methodology: - 'TVL is the sum of both pair tokens held by every liquidity pool Umbrae has deployed on Base. Pools are enumerated on chain from the three pair factories (the original DLMM factory, which is paused for trading but still holds withdrawable LP funds; the current DLMM v2 factory; and the DAMM v4 factory) via allPairsLength()/allPairs(), and each pool contributes its own balance of tokenX and tokenY. DLMM is a Liquidity Book style discrete-bin concentrated-liquidity AMM and DAMM is a dynamic-fee constant-product AMM; in both, the pair contract custodies liquidity directly, so no LP unwrapping is required.', + 'TVL is the sum of both pair tokens held by every liquidity pool Umbrae has deployed on Base and Robinhood Chain. Pools are enumerated on chain from the pair factories via allPairsLength()/allPairs(): on Base, the original DLMM factory (paused for trading but still holding withdrawable LP funds), the current DLMM v2 factory and the DAMM v4 factory; on Robinhood Chain, the DLMM v2 factory. Each pool contributes its own balance of tokenX and tokenY. DLMM is a Liquidity Book style discrete-bin concentrated-liquidity AMM and DAMM is a dynamic-fee constant-product AMM; in both, the pair contract custodies liquidity directly, so no LP unwrapping is required.', start: '2026-03-18', // 2026-03-18, Base block 43528312 — first DLMM factory deployment base: { tvl, }, + robinhood: { + tvl, + }, } From a9e9a0305841d9e9eb9100325bdaca2c14f6753a Mon Sep 17 00:00:00 2001 From: Ravi Sidhu Date: Thu, 22 Oct 2026 21:06:49 +0100 Subject: [PATCH 405/988] Add Forest Road Vault (#21755) Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/forest-road-vault/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/forest-road-vault/index.js diff --git a/projects/forest-road-vault/index.js b/projects/forest-road-vault/index.js new file mode 100644 index 00000000000..cc086eb8645 --- /dev/null +++ b/projects/forest-road-vault/index.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// USDfr is minted 1:1 against USDC. ReserveManager custodies that USDC and records the +// principal it has released to credit facilities. Curator first-loss capital (CuratorModule), +// the sGROVE coverage reserve and sUSDfr all hold USDfr, so they are claims on this same +// reserve and are not counted again. +const RESERVE_MANAGER = '0x8317736611B542DDb4A820fE344b621A904BdD48' + +async function tvl(api) { + return sumTokens2({ api, owner: RESERVE_MANAGER, tokens: [ADDRESSES.ethereum.USDC] }) +} + +async function borrowed(api) { + // Both values are 18-decimal USDfr value; USDC uses 6 decimals. + const principal = await api.call({ target: RESERVE_MANAGER, abi: 'uint256:deployedPrincipal' }) + const impairment = await api.call({ target: RESERVE_MANAGER, abi: 'uint256:totalPrincipalImpairment' }) + const net = BigInt(principal) - BigInt(impairment) + if (net > 0n) api.add(ADDRESSES.ethereum.USDC, (net / 10n ** 12n).toString()) +} + +module.exports = { + methodology: 'TVL is the USDC held by the ReserveManager, the reserve that backs USDfr. Borrowed is the principal deployed to credit facilities, net of recognized impairments, as recorded on chain by the ReserveManager. USDfr held by sUSDfr, curator first-loss pools and the sGROVE coverage reserve is a claim on the same reserve and is not counted again.', + start: '2026-09-19', // ReserveManager deployed at block 26006832 (2026-09-18 20:38 UTC) + ethereum: { tvl, borrowed }, +} From 52fe37840d1db17a985f8cfa20a073fbff30c5d8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 22 Oct 2026 22:05:14 +0200 Subject: [PATCH 406/988] update telos rpc --- projects/helper/env.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/helper/env.js b/projects/helper/env.js index 34a4d6f7dca..81377f8ec2d 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -89,6 +89,9 @@ const DEFAULTS = { NEON_EVM_RPC: 'https://neon.blockscout.com/api/eth-rpc', THORCHAIN_LCD: 'https://gateway.liquify.com/chain/thorchain_api', INITIA_LCD: 'https://rest.initia.xyz', + // mainnet.telos.net/evm now serves a 404 or an HTML page with HTTP 200, which the sdk treats as a successful call with a null result; rpc1.eu.telos.net hangs + TELOS_RPC: 'https://rpc.telos.net,https://rpc1.us.telos.net/evm,https://telos.drpc.org,https://public.1rpc.io/telos/evm', + TELOS_RPC_MULTICALL_V3: '0x4E06d6ec4a3A90790edee253C8BF098bbb4F51E5', KUSAMA_ASSETHUB_SUBSTRATE_RPC: 'https://kusama-asset-hub-rpc.polkadot.io,https://statemine.api.onfinality.io/public', } From 8d80da92a7765bbed6b35112d91c08871ac4949f Mon Sep 17 00:00:00 2001 From: Code Monad Date: Fri, 23 Oct 2026 04:25:41 +0800 Subject: [PATCH 407/988] Add NewSight prediction market TVL on Pharos (#21798) --- registries/sumTokens.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index ba27320e41e..97da7f8db94 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -20431,6 +20431,13 @@ const configs = { } }, }, + "newsight": { + "methodology": "TVL is the USDC collateral held in NewSight's Vault on Pharos backing prediction-market bets and split positions. User account balances and trading fees sent to the separate fee collector are excluded.", + "pharos": { + "owner": "0x768b959191ce5876cabbbc014a08d72615bdde54", + "token": ADDRESSES.pharos.USDC + }, + }, "nexion": { "methodology": "TVL is farm deposits. Lending TVL and borrowed are tracked separately in the nexion-lending adapter. Staking is NEON locked in staking contracts (V1 + V2).", "pulse": { From 98035a98ff94dc3970bfb09a16548d33637fd04a Mon Sep 17 00:00:00 2001 From: bebooooo Date: Fri, 23 Oct 2026 03:33:37 +0700 Subject: [PATCH 408/988] Add KINETIXDAO (#21797) Co-authored-by: bebobarrrbo <231865773+bebobarrrbo@users.noreply.github.com> Co-authored-by: FelixBruguera --- registries/compound.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/registries/compound.js b/registries/compound.js index 8054405652d..45450f5bb68 100644 --- a/registries/compound.js +++ b/registries/compound.js @@ -649,6 +649,11 @@ const configs = { }, 'kyros-finance': { robinhood: [{ comptroller: '0x5f3Da5a8bCF26011e95CA2D03aFc6E0C54D4F0c9', cether: '0x73940Df7412C3c04aF3975BE26652B467BAE65A3' }], + }, + 'kinetixdao': { + methodology: 'TVL counts the underlying tokens (KKUB and USDT) held as cash by every market listed by the KINETIXDAO Comptroller on KUB Chain, i.e. supplied minus borrowed. Native KUB is wrapped to KKUB by the gateway before it is supplied, so it is counted as KKUB. Borrowed counts the totalBorrows of each market and is not included in TVL.', + start: '2026-10-08', + bitkub: [{comptroller: '0xc5DD9f1cE32f19C0a76a924F681914A8D10E8008'},] } } From b9b42608ee493afc3ae89f57ac16bf78cbb64705 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 22 Oct 2026 22:38:39 +0200 Subject: [PATCH 409/988] update gate --- projects/gate-io/index.js | 41 ++++++++++++++++++++++----- projects/helper/bitcoin-book/index.js | 4 ++- projects/helper/cex.js | 5 ++++ projects/helper/chain/filecoin.js | 2 +- 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index 4ca4878861b..9d37517eaf1 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -8,6 +8,7 @@ const { unwrapDolomiteDeposits } = require("../helper/unwrapLPs.js"); const { addHypercoreSpotBalances } = require("../helper/chain/hyperliquid.js"); const { sumTokens: cosmosSumTokens } = require("../helper/chain/cosmos.js"); const { addThetaBalances } = require("../helper/chain/theta.js"); +const avaxX = require("../helper/chain/avaxX"); const config = { "ethereum": { @@ -60,6 +61,12 @@ const config = { "0xccc5eeebe15291620be733997af60735618548d7", ] }, + // USDC is arc's gas token, so the native balance already is the USDC balance + "arc": { + "owners": [ + "0x0d0707963952f2fba59dd06f2b425ace40b492fe", + ] + }, "avax": { "owners": [ "0x0d0707963952f2fba59dd06f2b425ace40b492fe", @@ -1343,7 +1350,8 @@ const config = { }, "monad": { "owners": [ - "0x0d0707963952f2fba59dd06f2b425ace40b492fe" + "0x0d0707963952f2fba59dd06f2b425ace40b492fe", + "0xc882b111a75c0c657fc507c04fbfcd2cc984f071", ] }, "moonbeam": { @@ -1373,7 +1381,7 @@ const config = { "owners": [ "0d584a4cbbfd9a4878d816512894e65918e54fae13df39a6f520fc90caea2fb0", "f857de8a2a882488235eda61d3f41c4a60591d7f8daec1299ec0f20426a4cc3f", - "c1a3dabb95b06767db2ab85ed0be86133a15bfe3a80fa017cbb83216760a8181", + // "c1a3dabb95b06767db2ab85ed0be86133a15bfe3a80fa017cbb83216760a8181", // account was never created on near, the rpc rejects it with UNKNOWN_ACCOUNT "e10e284823bc0728f1850486fd4ccd5546249140e96823ac09f96b30363cd251", "bc02e51d5f4c03611ef28d8fdbdba01b237f5a870fad7670d0a17a1a14934b97" ] @@ -1804,7 +1812,8 @@ const config = { "0:3addd84bf73267312a477049fd9b8db761bf39c585c150f8e6f9451347af2b6c", "0:09c592c5b17a555c1ace781f38303e5a115978f57cf22773b280d14028e7dd92", "0:16ea6a34f0d704b6fac9b7592e003f6f28ae5d1a8a6ba9d1650e4dd30ab8eada", - "EQAbhMWosoxeoXTJi9Tlw09MEjPVvdJe9j0nC6K6ro0d1oL-" + "EQAbhMWosoxeoXTJi9Tlw09MEjPVvdJe9j0nC6K6ro0d1oL-", + "EQCAZ9RKpYqjaD30mg9FL0eP3TE03jmq1Mn0SlfPrkBgBPed", ] }, "umee": { @@ -1959,6 +1968,16 @@ const config = { "0xffeb0f61871acdb4838dfc6d5082f063e738e421" ] }, + "zcash": { + "owners": [ + "t1NuCztsAfdTWfuowWCKneUPDys5S4puiBW", + "t1XdMGrqFbnPACVN9GETDg3UywPFMqQbU8E", + "t1agqDRa2neEAqDZiUUHm1pKos9oywbRQLW", + "t1MdNw2pzVB9ptEuLFcnZrswCXPqr5GdoS4", + "t1e6zBQSDrZ51qygj31EFkqz3zEmWAZAZHd", + "t1YvimnGBmVA7xDiPnqwbKsvujmSJz4X5m2", + ] + }, "zigchain": { "owners": [ "zig155svs6sgxe55rnvs6ghprtqu0mh69kehze2lzt" @@ -1970,7 +1989,7 @@ const config = { }; // remove chains w/o historical tvl -const unsupportedChains = ['aeternity', 'beam', 'binance', 'bitchain', 'bitcoincash', 'bittensor', 'bone', 'callisto', 'clv', 'concordium', 'cmp', 'defichain', 'edg', 'elastos', 'elys', 'equilibrium', 'filecoin', 'findora', 'flow', 'fusion', 'heiko', 'hydra', 'icon', 'interlay', 'karura', 'kintsugi', 'kusuma', 'manta_atlantic', 'lisk', 'neo', 'neo3', 'near', 'nibiru', 'ontology', 'parallel', 'pokt', 'polkadex', 'proton', 'reef', 'rvn', 'shiden', 'sora', 'stafi', 'starcoin', 'syscoin', 'telos', 'velas', 'venom', 'vite', 'waves', 'wax', 'zilliqa', 'secret', 'etn', 'zkfair', 'acala', 'harmony', +const unsupportedChains = ['aeternity', 'beam', 'binance', 'bitchain', 'bittensor', 'bone', 'callisto', 'clv', 'concordium', 'cmp', 'defichain', 'edg', 'elastos', 'elys', 'equilibrium', 'findora', 'flow', 'fusion', 'heiko', 'hydra', 'icon', 'interlay', 'karura', 'kintsugi', 'kusuma', 'manta_atlantic', 'lisk', 'neo', 'neo3', 'nibiru', 'ontology', 'parallel', 'pokt', 'polkadex', 'proton', 'reef', 'rvn', 'shiden', 'sora', 'stafi', 'starcoin', 'syscoin', 'telos', 'velas', 'venom', 'vite', 'waves', 'wax', 'zilliqa', 'secret', 'etn', 'zkfair', 'acala', 'harmony', 'vinu', 'rollux', 'aelf', 'ailayer', 'archway', ] @@ -1994,7 +2013,8 @@ const earnStakers = { cosmos: ['cosmos10v2gu0vvdeuv8pexnl98lmyva4cq8jkaa4845c'], injective: ['inj10v2gu0vvdeuv8pexnl98lmyva4cq8jkahus3xq', 'inj18njk2lz5q7juryvzgyly2qxetuwqadxzpvmuhj'], dydx: ['dydx10v2gu0vvdeuv8pexnl98lmyva4cq8jka5vf350'], - sui: ['0x6edd3be944aeaa90f86f95008b852308e5ab48dc6d2df756e92e11c1ec73b8c0', '0xf15b7dbce9f19b0efb66d08aeb9bf840e0bb96d75021c941b9b417b5034560aa'], + // stake migrated on 2026-10-21, the previous stakers (0x6edd3b…, 0xf15b7d…) are empty since + sui: ['0xbaae485e643532b4597f5ef9018103191452cc5c49ad7a3f5c59d9272c75ba69', '0x01d36202955b7fab73aa379a663cf01c5dbde020af040876b1bf9311446673e7'], } /** @@ -2191,7 +2211,7 @@ const gateEarnTvl = { kava: { tvl: earnTvl(api => cosmosSumTokens({ api, owners: kavaCosmosOwners, chain: 'kava' })) }, // same split as kava: config.sei carries the cosmos-side sei1... owners, so the // EVM-side native SEI held by the hot wallet is summed here - sei: { tvl: earnTvl(api => api.sumTokens({ owners: ['0x0d0707963952f2fba59dd06f2b425ace40b492fe'], tokens: [ADDRESSES.null] })) }, + sei: { tvl: earnTvl(api => api.sumTokens({ owners: ['0x0d0707963952f2fba59dd06f2b425ace40b492fe', '0xc882b111a75c0c657fc507c04fbfcd2cc984f071'], tokens: [ADDRESSES.null] })) }, // config.theta counts TFUEL via the EVM rpc; native THETA lives in the account ledger, summed here theta: { tvl: earnTvl(api => addThetaBalances(api, config.theta.owners)) }, } @@ -2206,4 +2226,11 @@ Object.entries(earnReceiptTokens).forEach(([chain, args]) => { gateEarnTvl[chain] = { tvl: earnTvl(api => api.sumTokens(args)) } }) -module.exports = mergeExports([cexExports(config), gateEarnTvl]); +// Avalanche X-Chain wallet, counted on the avax chain next to the C-Chain balances +const avaxXChainOwners = ['X-avax155svs6sgxe55rnvs6ghprtqu0mh69kehk3zye7'] + +module.exports = mergeExports([ + cexExports(config), + gateEarnTvl, + { avax: { tvl: avaxX.sumTokensExport({ owners: avaxXChainOwners }) } }, +]); diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index aaa620ca888..919cbb0304b 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -662,7 +662,9 @@ module.exports = { "1FhncfokiSDagazXbuVqKQ6ew4oyDmAzhG", "1FLKsCiEsABS7LysfDA8R181TQ6eLjoxPv", "1L1SN3BxXaXEAzzGcWqjF9svxmN6F2mBoR", - "16G1xYBbiNG78LSuZdMqp6tux5xvVp9Wxh" + "16G1xYBbiNG78LSuZdMqp6tux5xvVp9Wxh", + "38PFUcFi7o7RVYYJjWCodU9t9yiQ9Qt8Gw", // add on 22/10/2026 + "1MEPB525tEHRFLdq6aR8d2t8jaaRQj2iWX", // add on 22/10/2026 ], hashkey: [ "bc1qyvppkaa74d9jvtz664a6uxmj09hf0eyg3uhx4h", diff --git a/projects/helper/cex.js b/projects/helper/cex.js index d00e997ff7f..c2194a0f962 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -329,6 +329,11 @@ const defaultTokens = { '0xb095274743941e953c746f9c228da9c18bb6ec29', // LAPTOP '0x5ab3d4c385b400f3abb49e80de2faf6a88a7b691', // FLOCK ], + arc: [ + nullAddress, + ADDRESSES.arc.USDC, + ADDRESSES.arc.cirBTC, + ], avax: [ nullAddress, ADDRESSES.avax.USDt, // USDT diff --git a/projects/helper/chain/filecoin.js b/projects/helper/chain/filecoin.js index e24e2e571b6..faa85484d96 100644 --- a/projects/helper/chain/filecoin.js +++ b/projects/helper/chain/filecoin.js @@ -4,7 +4,7 @@ const { sleep } = require('../utils') // FIL balance of f1/f3/f4 (or 0x) addresses from the Filfox explorer api, in attoFIL async function getBalance(address) { const { balance } = await get(`https://filfox.info/api/v1/address/${address}`) - return balance + return balance ?? '0' // an address never seen on chain comes back as `{ address }` only } async function sumTokens({ api, owners = [] }) { From 978a61620e1c1a1b6575b157866af07c8cbe684a Mon Sep 17 00:00:00 2001 From: Gh0stBlock <118377319+Gh0stBlock@users.noreply.github.com> Date: Thu, 22 Oct 2026 17:26:48 -0400 Subject: [PATCH 410/988] Add Nova Markets (Conviction Pool TVL on Arbitrum) (#21795) Co-authored-by: Joseph Co-authored-by: Claude Opus 5.5 --- registries/sumTokens/data3.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index a799353e3ce..3a710d3b838 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1231,4 +1231,14 @@ module.exports = { "tokens": [ADDRESSES.ethereum.USDC, "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c", ADDRESSES.null], // USDC, EURC, ETH }, }, + "nova-markets": { + "methodology": "TVL is the USDC deposited in the Conviction Pool, the nUSDC vault that takes the other side of every trade on Nova's markets, plus the USDC collateral of open trades held by Nova's trading contract on Arbitrum. Contracts: https://docs.nova.markets/contracts.md", + "start": "2026-09-20", + "arbitrum": { + "tokensAndOwners": [ + [ADDRESSES.arbitrum.USDC_CIRCLE, "0x9cA80193712F372e2ff33A00127292884F6F8598"], // Conviction Pool (nUSDC vault) + [ADDRESSES.arbitrum.USDC_CIRCLE, "0x1410FA3F87F6A6ea221E5D2aB608C23005eC34f3"], // trading contract (diamond) + ] + }, + }, } From c5ec89cfd8368140c89fe6565a2c32f40549ddba Mon Sep 17 00:00:00 2001 From: RA-Parity Date: Thu, 22 Oct 2026 16:27:12 -0500 Subject: [PATCH 411/988] Add Exceed Finance TVL adapter (#21760) Co-authored-by: RA-Parity <181358067+RA-Parity@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/exceed-finance/index.js | 73 ++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 projects/exceed-finance/index.js diff --git a/projects/exceed-finance/index.js b/projects/exceed-finance/index.js new file mode 100644 index 00000000000..f9ab65cbce8 --- /dev/null +++ b/projects/exceed-finance/index.js @@ -0,0 +1,73 @@ +const { PublicKey } = require('@solana/web3.js') +const { getConnection } = require('../helper/solana') + +// Exceed Finance yield-bearing tokens, issued by the Exceed liquid program +// par1tyqusak2f2DXg9RHv78SVHNWXkJLSbtJZQSuWjV. Each pair account stores the +// base token, the receipt token mint and the on-chain exchange rate schedule. +const PAIRS = [ + 'EwqMpnBHKEd537E37kcsNU9Qi82uukjVAXsC8K5Kswt7', // exUSDC (base: USDC) + 'HwsGQqoXwQjGg5CDojLTipmeYFSmovoHtk7ZFtgrxSop', // exSOL (base: SOL) + 'GpV9U2yY3L5u4DkWC6Unejsz42iNME4Usk5RzTaA23to', // exBTC (base: cbBTC) +] + +const PRECISION = 10n ** 12n + +function decodePair(data) { + let o = 8 // anchor discriminator + o += 2 // pair bump, lst mint bump + const baseMint = new PublicKey(data.subarray(o, o + 32)).toBase58(); o += 32 + const baseDecimals = data[o]; o += 1 + const lstMint = new PublicKey(data.subarray(o, o + 32)).toBase58(); o += 32 + const lstDecimals = data[o]; o += 1 + const symbolLength = data.readUInt32LE(o); o += 4 + symbolLength + const intervalRate = data.readBigUInt64LE(o); o += 8 + const secondsPerInterval = BigInt(data.readInt32LE(o)); o += 4 + o += 8 // initial exchange rate + const lastRate = data.readBigUInt64LE(o); o += 8 + const lastTimestamp = data.readBigInt64LE(o) + return { baseMint, baseDecimals, lstMint, lstDecimals, intervalRate, secondsPerInterval, lastRate, lastTimestamp } +} + +// Same schedule as the program: compounding per full interval, linear within the current one. +function exchangeRate({ intervalRate, secondsPerInterval, lastRate, lastTimestamp }, now) { + const elapsed = now - lastTimestamp + if (elapsed <= 0n) return lastRate + let periods = elapsed / secondsPerInterval + const remainder = elapsed % secondsPerInterval + let compounded = PRECISION + let factor = intervalRate + while (periods > 0n) { + if (periods & 1n) compounded = compounded * factor / PRECISION + factor = factor * factor / PRECISION + periods >>= 1n + } + const linear = (intervalRate - PRECISION) * remainder / secondsPerInterval + return lastRate * (compounded + linear) / PRECISION +} + +async function tvl(api) { + const connection = getConnection() + const infos = await connection.getMultipleAccountsInfo(PAIRS.map((p) => new PublicKey(p))) + const now = BigInt(api.timestamp ?? Math.floor(Date.now() / 1000)) + infos.forEach((info, i) => { + if (!info) throw new Error(`Exceed pair account ${PAIRS[i]} not found`) + }) + for (const info of infos) { + const pair = decodePair(info.data) + const { value } = await connection.getTokenSupply(new PublicKey(pair.lstMint)) + const rate = exchangeRate(pair, now) + let baseAmount = BigInt(value.amount) * rate / PRECISION + const decimalGap = pair.baseDecimals - pair.lstDecimals + if (decimalGap > 0) baseAmount *= 10n ** BigInt(decimalGap) + if (decimalGap < 0) baseAmount /= 10n ** BigInt(-decimalGap) + api.add(pair.baseMint, baseAmount.toString()) + } +} + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + doublecounted: true, + methodology: 'TVL is the value of all outstanding exUSDC, exSOL and exBTC, read from chain: the supply of each receipt token multiplied by its on-chain exchange rate, expressed in the base token (USDC, SOL, cbBTC). The deposits are deployed into lending markets such as Kamino and Jupiter Lend, so the TVL is marked as double counted.', + solana: { tvl }, +} From c3960bfd02c22a96d10bea2ab0b9d2c38445be62 Mon Sep 17 00:00:00 2001 From: Veilzk Date: Fri, 23 Oct 2026 01:41:45 +0400 Subject: [PATCH 412/988] Add Veil (Solana privacy protocol) TVL adapter (#21774) Co-authored-by: FelixBruguera --- registries/sumTokens/data3.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 3a710d3b838..22515b22e82 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1231,6 +1231,7 @@ module.exports = { "tokens": [ADDRESSES.ethereum.USDC, "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c", ADDRESSES.null], // USDC, EURC, ETH }, }, + "nova-markets": { "methodology": "TVL is the USDC deposited in the Conviction Pool, the nUSDC vault that takes the other side of every trade on Nova's markets, plus the USDC collateral of open trades held by Nova's trading contract on Arbitrum. Contracts: https://docs.nova.markets/contracts.md", "start": "2026-09-20", @@ -1241,4 +1242,11 @@ module.exports = { ] }, }, + "veil-zk": { + "methodology": "Tokens held in Veil's shielded-pool vaults: every SPL and Token-2022 vault is a token account owned by the program's vault_authority PDA. The protocol's own token, $VEIL, is excluded.", + "solana": { + "owner": "A8Qjyh2nWgEUkTQAAmghxE7u7nJ4xarQybDpTxWJdU4S", // vault_authority PDA of program FmsMbXrQXr1mARn45Cm52sdrwAWHDxqF8473t6woq9DP + "blacklistedTokens": ["HgTGdc29D5bDMrDvsCLnorxz899VyDj7ZN7FPa6vpump"], // $VEIL + }, + }, } From f6bc8bb6938261e864a055ddcbf9df8aaf33aeb6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 23 Oct 2026 09:33:15 +0200 Subject: [PATCH 413/988] minor fix --- projects/helper/cex.js | 6 +++++- projects/helper/chain/radixdlt.js | 4 +++- projects/vela-exchange/index.js | 4 ---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index c2194a0f962..6a676684e8c 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -296,13 +296,16 @@ const defaultTokens = { nullAddress, '0x547afd93b9c47d552059feb556909e017f8a9b25', // CTR ], + radixdlt: [ + ADDRESSES.radixdlt.XRD, + ], arbitrum: [ nullAddress, ADDRESSES.arbitrum.USDC, // USDC ADDRESSES.arbitrum.USDT, // USDT ADDRESSES.arbitrum.DAI, // DAI ADDRESSES.arbitrum.aidoge, //aidoge - '0x088cd8f5ef3652623c22d48b1605dcfe860cd704', //vela + // '0x088cd8f5ef3652623c22d48b1605dcfe860cd704', //vela ADDRESSES.arbitrum.LPT, //lpt '0x51fc0f6660482ea73330e414efd7808811a57fa2', //premia '0x25d887ce7a35172c62febfd67a1856f20faebb00', //pepe @@ -349,6 +352,7 @@ const defaultTokens = { ], near: [ 'usdt.tether-token.near', + '17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1', // USDC (native) ], optimism: [ nullAddress, diff --git a/projects/helper/chain/radixdlt.js b/projects/helper/chain/radixdlt.js index cb81703f106..89844ade501 100644 --- a/projects/helper/chain/radixdlt.js +++ b/projects/helper/chain/radixdlt.js @@ -12,7 +12,8 @@ const chain = 'radixdlt' const ENTITY_DETAILS_URL = `https://mainnet.radixdlt.com/state/entity/details` -async function sumTokens({ owner, owners = [], api, transformLSU = false, blacklistedTokens = [] }) { +async function sumTokens({ owner, owners = [], api, transformLSU = false, blacklistedTokens = [], tokens, }) { + const blacklistSet = new Set(blacklistedTokens.map(i => i.toLowerCase())) const fixBalances = getFixBalances(chain) @@ -24,6 +25,7 @@ async function sumTokens({ owner, owners = [], api, transformLSU = false, black let items = await queryAddresses({ addresses: owners }) items.forEach((item) => { item.fungible_resources.items.forEach(({ resource_address, amount }) => { + if (Array.isArray(tokens) && !tokens.includes(resource_address.toLowerCase())) return; if (blacklistSet.has(resource_address.toLowerCase())) return; api.add(resource_address, +amount) }); diff --git a/projects/vela-exchange/index.js b/projects/vela-exchange/index.js index 524eb5b5bbe..40252512ad9 100644 --- a/projects/vela-exchange/index.js +++ b/projects/vela-exchange/index.js @@ -1,4 +1,3 @@ -const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking") const { graphQuery } = require('../helper/http') @@ -37,8 +36,5 @@ module.exports = { }, hallmarks: [ ['2023-04-13', 'Refunded tokens to VLP holders & traders'], - ['2023-09-05', 'Launched on Base Chain'], - ['2024-07-18', 'Implemented Aave VLP supply integration'], - ['2024-09-17', 'Burned 65m Vela tokens'] ], } From 247074e095cf32b0da25ad5360f40a8d5db7830c Mon Sep 17 00:00:00 2001 From: thomas <81407403+thomas-cloud579@users.noreply.github.com> Date: Fri, 23 Oct 2026 17:22:52 +0800 Subject: [PATCH 414/988] GATE Add some missing reserve fund addresses (#21814) --- projects/gate-io/index.js | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index 9d37517eaf1..cb6324dfd9c 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -59,6 +59,9 @@ const config = { "0xcf6f5ec73942314c3ec864202b40dcbb1f9477a0", "0x76bbb8D5dbedde9cB34882c9588DFa9dEF00B8bc", "0xccc5eeebe15291620be733997af60735618548d7", + "0x6667cfe4698500cec4ed2cf22a9d6dbf15aec81d", + "0x1e2012e21086C96256CC32F5939Ad8b5e7489Afb", + "0x6b9C05B935BdAddDDFfa6C315483e02401f31307", ] }, // USDC is arc's gas token, so the native balance already is the USDC balance @@ -109,7 +112,18 @@ const config = { "0xa2df23519a6059dbc6f027f6cf8e59bdaecaf56f", "0xffeb0f61871acdb4838dfc6d5082f063e738e421", "0xf379a3d1ab6625eef34347d054cfaeafdf8f24a7", - "0xfb8072675ba65fa4157921ff1e522132a33eabb5" + "0xfb8072675ba65fa4157921ff1e522132a33eabb5", + // polymarket wallets + "0xc3576be9f63e4f44231e2aef4c6418c255ace998", + "0x8c9a40369fa7c0b89c93471220bbaa3a0f5cc0e4", + "0x22b1084664833f846a945e13464e4907537ff1b9", + "0x8262e577176a1363eaee7fbba1965d38b21180f3", + "0x9e3614d08cb75318820b4b10d9f995ada175f0b0", + "0x1389b35399a49195f55b16f7348c07a1554e25ed", + "0x4dc3bda32a72eadae470e580188b61fa36e9ccea", + "0xa561cd8e2f3ae87d109ac5adde3d39f36e4b96f1", + "0x2b0a8c481c2d125b2721b3ea0d4f2804270f0b8f", + "0x8f39b3617e99f7c429742830208d0ed1f2b66726" ] }, "fantom": { @@ -200,7 +214,10 @@ const config = { // "HMbkbJVNitT3t4EtaDJeUtwfTFGYcjU6vhE7h7dqxDzJ" "Egf5D8NKBivJavLKmCssE93J7X6fKvEPQwFTWLZUnaSN", "AGrghB4tNEJhWsPoQ73We5KAvgp6q512BkBx6fqY4i4b", - "DevD35PrcsJfg9CwpypmrD7GsYMRQpZQx6rfeSbkVtFp" + "DevD35PrcsJfg9CwpypmrD7GsYMRQpZQx6rfeSbkVtFp", + "5zzEaL86dT4cTz6reodbz6Rg9Wvet18216DTiWGEVLFG", + "J2f6waBNipqqn2k6d9uw3bwpbapGr2pLKZd9mDczCgfz", + "82KzHDyeqYckpoppcby7ZyWvWUyEwHLxDWfCTSMG6dn9" ] }, "ripple": { @@ -1127,7 +1144,12 @@ const config = { "0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c", "0xffeb0f61871acdb4838dfc6d5082f063e738e421", "0xe12532a4cea82aac737a91b80be82d33eadb4c2b", - "0xc882b111a75c0c657fc507c04fbfcd2cc984f071" + "0xc882b111a75c0c657fc507c04fbfcd2cc984f071", + "0xe698de9a0c0e592f236a063451f34f0e6c000f55", + "0x02e6f748644aeddcae70e39e70f596de33abf73f", + "0x4517b5e9651577bdd2130807f2e8741311c95bab", + "0xba0c6f04871984eb0503f83eec00f6af76603c51", + "0x7642d3730563fbbad9de74cb6c8f74b7dc9a6af0" ] }, "icon": { @@ -2087,7 +2109,14 @@ const solanaLsts = { // HyperCore spot balances sit off the EVM, so the hyperliquid entry in `config` // (a plain EVM balance lookup) never sees them -const hypercoreSpotOwners = ['0x0d0707963952f2fba59dd06f2b425ace40b492fe'] +const hypercoreSpotOwners = [ + '0x0d0707963952f2fba59dd06f2b425ace40b492fe', + '0xe698de9a0c0e592f236a063451f34f0e6c000f55', + '0x02e6f748644aeddcae70e39e70f596de33abf73f', + '0x4517b5e9651577bdd2130807f2e8741311c95bab', + '0xba0c6f04871984eb0503f83eec00f6af76603c51', + '0x7642d3730563fbbad9de74cb6c8f74b7dc9a6af0', +] // kava's cosmos-side owners, counted by the earn export rather than `config.kava` const kavaCosmosOwners = [ From 3162e08838cd00179acdf29c67d435d6103db564 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 23 Oct 2026 11:20:37 -0400 Subject: [PATCH 415/988] optimize yield ai (#21820) --- projects/yield-ai/index.js | 268 +++++++++++++++++-------------------- 1 file changed, 121 insertions(+), 147 deletions(-) diff --git a/projects/yield-ai/index.js b/projects/yield-ai/index.js index eae20de6e69..ab2076652d9 100644 --- a/projects/yield-ai/index.js +++ b/projects/yield-ai/index.js @@ -1,10 +1,8 @@ const ADDRESSES = require("../helper/coreAssets.json"); -const { aQuery, function_view, getResources } = require("../helper/chain/aptos"); -const { GraphQLClient, gql } = require("graphql-request"); +const { aQuery, function_view } = require("../helper/chain/aptos"); const { sliceIntoChunks } = require("../helper/utils"); const { PromisePool } = require("@supercharge/promise-pool"); const sdk = require('@defillama/sdk'); -const { getEnv } = require("../helper/env"); const pLimit = require("p-limit"); const VAULT = @@ -15,7 +13,6 @@ const ECHELON = const ECHELON_VAULT_RESOURCE = `${ECHELON}::lending::Vault`; const HYPERION_LP_RESOURCE = `${VAULT}::vault::VaultHyperionLp`; -const SAFE_RESOURCE = `${VAULT}::vault::VaultPosition`; const HYPERION_DEX = "0x8b4a2c4bb53857c718a04c020b98f8c2e1f99a68b0f57389a8bf5434cd22e05c"; @@ -34,15 +31,13 @@ const EXCLUDED_DIRECT_ASSETS = new Set([ "0x51964f09020498a1421a2a3bafe8e1d9fa72574b60446486c599bc6f3e9fae29::echelon_coin::ELON", ]); -const INDEXER_URL = "https://api.mainnet.aptoslabs.com/v1/graphql"; const INDEXER_PAGE_SIZE = 100; // the indexer caps responses at 100 rows const INDEXER_TIMEOUT_MS = 30_000; const PAGE_SIZE = 50; -const OWNER_BATCH_SIZE = 30; -const ECHELON_CONCURRENCY = 4; +const OWNER_BATCH_SIZE = 100; // indexer latency is per request, not per owner const HYPERION_LP_CONCURRENCY = 8; -const RESOURCE_CONCURRENCY = 4; -const FULLNODE_CONCURRENCY = 4; +const RESOURCE_CONCURRENCY = 8; +const FULLNODE_CONCURRENCY = 8; /** Known Hyperion pools used by Yield AI safes (token_a/token_b = pool canonical order). */ const YIELD_AI_HYPERION_POOLS = [ @@ -58,21 +53,38 @@ const YIELD_AI_HYPERION_POOLS = [ ]; // Native APT is included: the indexer reports coin and FA APT as one 0x1::aptos_coin::AptosCoin row. -const FA_BALANCES_QUERY = gql` +// Empty stores are kept so their storage_id can be told apart from position objects. +const FA_BALANCES_QUERY = ` query YieldAiFaBalances($addresses: [String!]!, $limit: Int!, $offset: Int!) { current_fungible_asset_balances( - where: { owner_address: { _in: $addresses }, amount: { _gt: "0" } } + where: { owner_address: { _in: $addresses } } order_by: [{ owner_address: asc }, { storage_id: asc }] limit: $limit offset: $offset ) { owner_address + storage_id amount asset_type } } `; +// Live objects owned by safes: fungible stores plus open LP positions (closed positions are deleted). +const LIVE_OBJECTS_QUERY = ` + query YieldAiObjects($addresses: [String!]!, $limit: Int!, $offset: Int!) { + current_objects( + where: { owner_address: { _in: $addresses }, is_deleted: { _eq: false } } + order_by: [{ owner_address: asc }, { object_address: asc }] + limit: $limit + offset: $offset + ) { + owner_address + object_address + } + } +`; + function unwrapVector(raw) { if (raw == null) return []; if (!Array.isArray(raw)) return []; @@ -101,30 +113,11 @@ function normalizeObjectAddress(obj) { return normalizeAptosAddress(obj?.inner); } -/** - * Exponential backoff with jitter, for indexer requests only. Fullnode reads go through the SDK, - * which already retries transient errors (429, 5xx, timeouts) and skips deterministic ones such - * as Move aborts; wrapping those again multiplies the delays and can stall the run. - */ -async function retryAsync(fn, attempts = 5) { - let lastError; - for (let i = 0; i < attempts; i += 1) { - try { - return await fn(); - } catch (e) { - lastError = e; - if (i + 1 < attempts) { - const delay = Math.min(8000, 500 * 2 ** i) * (0.5 + Math.random() / 2); - await new Promise((resolve) => setTimeout(resolve, delay)); - } - } - } - throw lastError; -} - /** * Cap all fullnode reads together. The SDK already retries transient errors (429, 5xx, timeouts); * a rate limit that outlasts those retries fails the run instead of stalling it into a timeout. + * Resources are read one type at a time: listing an account's resources needs the statekeys index, + * which some nodes in the rotation lack. */ function createFullnodeReader() { const limit = pLimit(FULLNODE_CONCURRENCY); @@ -135,12 +128,32 @@ function createFullnodeReader() { }); return { view: (options) => read(() => function_view(options)), - resources: (safe) => read(() => getResources(safe, "aptos")), + // null when the account does not hold the resource + resource: (account, type) => read(() => sdk.chains.aptos.getResource({ chain: "aptos", account, type })), query: (path) => read(() => aQuery(path, "aptos")), get reads() { return reads; }, }; } +/** Paged indexer query over safe owners; the SDK retries and sends APTOS_API_KEY. */ +async function queryIndexerByOwners(query, key, owners) { + const rows = []; + for (const batch of sliceIntoChunks(owners, OWNER_BATCH_SIZE)) { + for (let offset = 0; ; offset += INDEXER_PAGE_SIZE) { + const data = await sdk.chains.aptos.indexerQuery({ + chain: "aptos", + query, + variables: { addresses: batch, limit: INDEXER_PAGE_SIZE, offset }, + timeout: INDEXER_TIMEOUT_MS, + }); + const page = data?.[key] ?? []; + rows.push(...page); + if (page.length < INDEXER_PAGE_SIZE) break; + } + } + return rows; +} + function unwrapScalar(res) { return Array.isArray(res) ? res[0] : res; } @@ -394,15 +407,16 @@ async function fetchRegisteredSafes(reader) { for (let start = 0; start < total; start += PAGE_SIZE) { const limit = Math.min(PAGE_SIZE, total - start); const pageRaw = await reader.view({ - // Owner/policy are unused by TVL. Check existence during the resource read instead. - functionStr: `${VAULT}::vault::get_safes_range`, + // exists is object::object_exists: a registry entry can outlive its object + functionStr: `${VAULT}::vault::get_safes_range_info`, args: [String(start), String(limit)], chain: "aptos", }); - for (const address of unwrapVector(pageRaw)) { + for (const info of unwrapVector(pageRaw)) { + if (info?.exists !== true) continue; // The view returns some safes without leading zeros; the indexer matches owner_address as an // exact 64-hex string, so an unpadded safe would silently lose its fungible-asset balances. - const s = padAptosAddress(address); + const s = padAptosAddress(info.safe_address); if (s) safeOut.push(s); } } @@ -410,134 +424,89 @@ async function fetchRegisteredSafes(reader) { return { safeAddresses: [...new Set(safeOut)] }; } -/** A fully paginated resource read replaces both per-safe existence views. */ -async function fetchSafeResources(reader, safeAddresses) { - const { results } = await PromisePool.withConcurrency(RESOURCE_CONCURRENCY) +/** + * Echelon collateral is stored as market shares. Shares are summed per market across safes and + * converted with one shares_to_coins view per market, instead of one account_coins view per position. + */ +async function sumEchelonSafePositions(api, safeAddresses, addDlpAsUsdc, reader) { + const sharesByMarket = new Map(); + let adds = 0; + + await PromisePool.withConcurrency(RESOURCE_CONCURRENCY) .for(safeAddresses) - .handleError((e) => { throw e; }) + .handleError((e) => { throw e; }) // a failed read must fail the run, not drop the safe's TVL .process(async (safe) => { - let resources; - try { - resources = await reader.resources(safe); - } catch (e) { - // A registry entry can outlive its object. Other read failures remain fatal. - if ((e.status ?? e.response?.status) === 404 && e.errorCode === "account_not_found") return null; - throw e; + const vault = await reader.resource(safe, ECHELON_VAULT_RESOURCE); + if (vault == null) return; + if (typeof vault !== "object") throw new Error(`Invalid Echelon resource for safe ${safe}`); + + for (const collateral of vault.collaterals?.data || []) { + const market = padAptosAddress(normalizeObjectAddress(collateral?.key)); + const shares = toIntegerString(collateral?.value); + if (!market || !shares || shares === "0") continue; + adds += 1; + sharesByMarket.set(market, (sharesByMarket.get(market) || 0n) + BigInt(shares)); } - if (!Array.isArray(resources)) throw new Error(`Invalid resources for safe ${safe}`); - // Matches get_safes_range_info's object::object_exists check. - if (!resources.some(({ type }) => type === "0x1::object::ObjectCore") || - !resources.some(({ type }) => type === SAFE_RESOURCE)) return null; - const vault = resources.find(({ type }) => type === ECHELON_VAULT_RESOURCE); - if (vault && (!vault.data || typeof vault.data !== "object")) - throw new Error(`Invalid Echelon resource for safe ${safe}`); - return { - safe, - echelonVault: vault?.data, - hasHyperion: resources.some(({ type }) => type === HYPERION_LP_RESOURCE), - }; }); - return results.filter(Boolean); -} -async function sumEchelonSafePositions(api, safeResources, addDlpAsUsdc, reader) { - const marketMetadataCache = new Map(); - let adds = 0; const totalsByAsset = new Map(); + for (const [market, shares] of sharesByMarket) { + const coins = await reader.view({ + functionStr: `${ECHELON}::lending::shares_to_coins`, + args: [market, shares.toString()], + chain: "aptos", + }); + const amount = toIntegerString(coins); + if (!amount || amount === "0") continue; - async function getMarketMetadata(market) { - if (!marketMetadataCache.has(market)) { - const metadata = await reader.view({ - functionStr: `${ECHELON}::lending::market_asset_metadata`, - args: [market], - chain: "aptos", - }); - marketMetadataCache.set( - market, - padAptosAddress(normalizeObjectAddress(metadata)) - ); - } - return marketMetadataCache.get(market); - } - - await PromisePool.withConcurrency(ECHELON_CONCURRENCY) - .for(safeResources.filter(({ echelonVault }) => echelonVault)) - .handleError((e) => { throw e; }) // a failed read must fail the run, not drop the safe's TVL - .process(async ({ safe, echelonVault }) => { - const collaterals = echelonVault.collaterals?.data || []; - - for (const collateral of collaterals) { - const market = padAptosAddress( - normalizeObjectAddress(collateral?.key) - ); - if (!market) continue; - - const coins = await reader.view({ - functionStr: `${ECHELON}::lending::account_coins`, - args: [safe, market], - chain: "aptos", - }); - const amount = toIntegerString(coins); - if (!amount || amount === "0") continue; - - const asset = await getMarketMetadata(market); - if (!asset) continue; - - adds += 1; - const prev = totalsByAsset.get(asset) || 0n; - totalsByAsset.set(asset, prev + BigInt(amount)); - if (asset === DLP_SHARE) await addDlpAsUsdc(amount); - else api.add(asset, amount); - } + const metadata = await reader.view({ + functionStr: `${ECHELON}::lending::market_asset_metadata`, + args: [market], + chain: "aptos", }); + const asset = padAptosAddress(normalizeObjectAddress(metadata)); + if (!asset) continue; + + totalsByAsset.set(asset, (totalsByAsset.get(asset) || 0n) + BigInt(amount)); + if (asset === DLP_SHARE) await addDlpAsUsdc(amount); + else api.add(asset, amount); + } return { adds, totalsByAsset }; } async function tvl(api) { const reader = createFullnodeReader(); - const registered = await fetchRegisteredSafes(reader); - const safeResources = await fetchSafeResources(reader, registered.safeAddresses); - const safeAddresses = safeResources.map(({ safe }) => safe); + const { safeAddresses } = await fetchRegisteredSafes(reader); if (!safeAddresses.length) return; const addDlpAsUsdc = createDlpAdder(api, reader); const { adds: echelonAdds, totalsByAsset: echelonTotalsByAsset } = - await sumEchelonSafePositions(api, safeResources, addDlpAsUsdc, reader); - - // the SDK sends the same key on fullnode views - const indexerHeaders = {}; - const apiKey = getEnv("APTOS_API_KEY"); - if (apiKey) indexerHeaders.Authorization = `Bearer ${apiKey}`; - const graphQLClient = new GraphQLClient(INDEXER_URL, { headers: indexerHeaders }); + await sumEchelonSafePositions(api, safeAddresses, addDlpAsUsdc, reader); const faTotalsByAsset = new Map(); + const storeIds = new Set(); + const balances = await queryIndexerByOwners(FA_BALANCES_QUERY, "current_fungible_asset_balances", safeAddresses); - for (const batch of sliceIntoChunks(safeAddresses, OWNER_BATCH_SIZE)) { - for (let offset = 0; ; offset += INDEXER_PAGE_SIZE) { - // a fresh signal per attempt, so a hung request is aborted and retried instead of - // blocking the run forever - const { current_fungible_asset_balances: rows = [] } = await retryAsync(() => - graphQLClient.request({ - document: FA_BALANCES_QUERY, - variables: { addresses: batch, limit: INDEXER_PAGE_SIZE, offset }, - signal: AbortSignal.timeout(INDEXER_TIMEOUT_MS), - }) - ); - - for (const row of rows) { - if (EXCLUDED_DIRECT_ASSETS.has(row.asset_type)) continue; - const amtStr = toIntegerString(row.amount); - if (!amtStr || amtStr === "0" || /^-/.test(amtStr)) continue; - - const prev = faTotalsByAsset.get(row.asset_type) || 0n; - faTotalsByAsset.set(row.asset_type, prev + BigInt(amtStr)); - - if (padAptosAddress(row.asset_type) === DLP_SHARE) await addDlpAsUsdc(amtStr); - else api.add(row.asset_type, amtStr); - } + for (const row of balances) { + storeIds.add(row.storage_id); + if (EXCLUDED_DIRECT_ASSETS.has(row.asset_type)) continue; + const amtStr = toIntegerString(row.amount); + if (!amtStr || amtStr === "0" || /^-/.test(amtStr)) continue; - if (rows.length < INDEXER_PAGE_SIZE) break; - } + const prev = faTotalsByAsset.get(row.asset_type) || 0n; + faTotalsByAsset.set(row.asset_type, prev + BigInt(amtStr)); + + if (padAptosAddress(row.asset_type) === DLP_SHARE) await addDlpAsUsdc(amtStr); + else api.add(row.asset_type, amtStr); + } + + // Any live object a safe owns that is not a fungible store is an open LP position, so only those + // safes are read for Hyperion, and only their live positions (closed ones are deleted objects). + const liveObjectsBySafe = new Map(); + for (const { owner_address, object_address } of await queryIndexerByOwners(LIVE_OBJECTS_QUERY, "current_objects", safeAddresses)) { + if (storeIds.has(object_address)) continue; + if (!liveObjectsBySafe.has(owner_address)) liveObjectsBySafe.set(owner_address, new Set()); + liveObjectsBySafe.get(owner_address).add(padAptosAddress(object_address)); } let hyperionAdds = 0; @@ -545,16 +514,21 @@ async function tvl(api) { const tickCache = new Map(); await PromisePool.withConcurrency(HYPERION_LP_CONCURRENCY) - .for(safeResources.filter(({ hasHyperion }) => hasHyperion)) + .for([...liveObjectsBySafe]) .handleError((e) => { throw e; }) // required position reads must not drop Hyperion TVL - .process(async ({ safe }) => { + .process(async ([safe, liveObjects]) => { + // also excludes safes whose only live position is on Thala + const lp = await reader.resource(safe, HYPERION_LP_RESOURCE); + if (!lp || Number(lp.open_count) === 0) return; + const positionsRaw = await reader.view({ functionStr: `${VAULT}::vault::get_hyperion_positions`, args: [safe], chain: "aptos", }); - const positionAddresses = unwrapPositionAddresses(positionsRaw); + const positionAddresses = unwrapPositionAddresses(positionsRaw) + .filter((p) => liveObjects.has(padAptosAddress(p))); if (!positionAddresses.length) return; for (const positionAddr of positionAddresses) { From 0abd393725bbf4e06b747b1ac2f43bf021aeccf3 Mon Sep 17 00:00:00 2001 From: Stone <125890624+Stonepapa@users.noreply.github.com> Date: Sat, 24 Oct 2026 03:41:10 +0800 Subject: [PATCH 416/988] Update BSquared backed BTC addresses. (#21777) --- projects/helper/bitcoin-book/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index 919cbb0304b..d8bda326dbc 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -154,7 +154,6 @@ module.exports = { // Bitcoin Custodian Addresses "131fpYjELat58RVzPp2A9Bo8oNuKiP4vxg", - "15G6tKbavXQ1ynipkZTPAMjEtuosN1Pkmg", "13btmzTg63MpdozLoyeVYCeRbXe4dWN52a", "1DtXWGnqWrZEk7XQarSkDUidbFdK7bj44n", "1JABsaDFCi28sp2uAmbajNJ2NvEiEMETtM", From 3971d4039d35b3ad465d2a00912adcd684d05d4f Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 23 Oct 2026 16:09:24 -0400 Subject: [PATCH 417/988] Add avax vault to Credit Coop and fix historical runs (#21829) Co-authored-by: Neil Zumwalde Co-authored-by: Claude Fable 5.1 --- projects/credit-coop/index.js | 69 ++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/projects/credit-coop/index.js b/projects/credit-coop/index.js index 1a076160f83..d22cfb2a280 100644 --- a/projects/credit-coop/index.js +++ b/projects/credit-coop/index.js @@ -2,21 +2,27 @@ // a liquid strategy (idle cash, Morpho vaults) and a credit strategy (facilities drawn by // borrowers). totalAssets() covers both. Only the liquid side is still held by the protocol, // so it is tvl; the credit side has left the protocol and is reported as borrowed. +// Vault -> deploy block const config = { ethereum: { - vaults: [ - '0x6dACaF632017E2DFc929484606B0feb93088B623', - '0x6C99a74a62Aaf2e6Aa3fF08Ce7661D5C86E01DbC', - '0xb21eAFB126cEf15CB99fe2D23989b58e40097919', - '0xC40FBBe06D962570D1eBbe70d4A01A5f14B1C9a2', - '0x507e5DEA003299821961480A8dC42271FebC89AA' - ], + vaults: { + '0x6dACaF632017E2DFc929484606B0feb93088B623': 22734650, + '0x6C99a74a62Aaf2e6Aa3fF08Ce7661D5C86E01DbC': 22641434, + '0xb21eAFB126cEf15CB99fe2D23989b58e40097919': 24101397, + '0xC40FBBe06D962570D1eBbe70d4A01A5f14B1C9a2': 25023549, + '0x507e5DEA003299821961480A8dC42271FebC89AA': 25087816, + }, }, base: { - vaults: [ - '0x0cf11AC4ea33b6d7274CD7d6e7cEA9f3F65FCf9D', - '0x214699b0ad2e26ffef0247fd0c244bb7fedc85ce', - ], + vaults: { + '0x0cf11AC4ea33b6d7274CD7d6e7cEA9f3F65FCf9D': 33603319, + '0x214699b0ad2e26ffef0247fd0c244bb7fedc85ce': 25055422, + }, + }, + avax: { + vaults: { + '0xc6df254f147dac8e0a891558e8e5d788a8c871be': 74002497, + }, }, } @@ -27,36 +33,47 @@ const abi = { totalPendingDeposits: 'uint256:totalPendingDeposits', } +// Vaults not yet deployed at the queried block are skipped, so history can be refilled async function getVaults(api) { - const { vaults } = config[api.chain] - const [tokens, totalAssets, liquidAssets, pendingDeposits] = await Promise.all([ - abi.asset, - abi.totalAssets, - abi.totalLiquidAssets, - abi.totalPendingDeposits, - ].map(abi => api.multiCall({ abi, calls: vaults }))) - return { tokens, totalAssets, liquidAssets, pendingDeposits } + const block = await api.getBlock() + const vaults = Object.entries(config[api.chain].vaults) + .filter(([, fromBlock]) => block >= fromBlock) + .map(([vault]) => vault) + if (!vaults.length) return [] + const tokens = await api.multiCall({ abi: abi.asset, calls: vaults }) + const totalAssets = await api.multiCall({ abi: abi.totalAssets, calls: vaults }) + const liquidAssets = await api.multiCall({ abi: abi.totalLiquidAssets, calls: vaults }) + const pendingDeposits = await api.multiCall({ abi: abi.totalPendingDeposits, calls: vaults }) + return vaults.map((_, i) => ({ + token: tokens[i], + totalAssets: totalAssets[i], + liquidAssets: liquidAssets[i], + pendingDeposits: pendingDeposits[i], + })) } // Cash in the vault and its liquid strategy, plus deposits waiting to be accepted async function tvl(api) { - const { tokens, liquidAssets, pendingDeposits } = await getVaults(api) - api.add(tokens, liquidAssets) - api.add(tokens, pendingDeposits) + for (const { token, liquidAssets, pendingDeposits } of await getVaults(api)) { + api.add(token, liquidAssets) + api.add(token, pendingDeposits) + } } // Credit facilities drawn by borrowers, including accrued interest async function borrowed(api) { - const { tokens, totalAssets, liquidAssets } = await getVaults(api) - tokens.forEach((token, i) => { - const credit = BigInt(totalAssets[i]) - BigInt(liquidAssets[i]) + for (const { token, totalAssets, liquidAssets } of await getVaults(api)) { + const credit = BigInt(totalAssets) - BigInt(liquidAssets) if (credit > 0n) api.add(token, credit) - }) + } } module.exports = { doublecounted: true, methodology: 'TVL is the liquid side of each Credit Coop vault: idle cash, deposits held in Morpho vaults through the liquid strategy, and pending deposits. Credit facilities drawn by borrowers are reported separately as borrowed.', + hallmarks: [ + ['2026-09-10', 'Drawn credit facilities reported as Active Loans, not TVL'], + ], } Object.keys(config).forEach(chain => { From da3b1d001bff9f9ad92c6768a8099e0baa7727a8 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 23 Oct 2026 16:28:06 -0400 Subject: [PATCH 418/988] fix ember (#21830) --- projects/ember-protocol/index.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/projects/ember-protocol/index.js b/projects/ember-protocol/index.js index 5fc25516890..2f9e598c035 100644 --- a/projects/ember-protocol/index.js +++ b/projects/ember-protocol/index.js @@ -1,4 +1,4 @@ -const { sui } = require("../helper/chain/rpcProxy"); +const sui = require("../helper/chain/sui"); const { getConfig } = require("../helper/cache"); const {sumERC4626Vaults} = require("../helper/erc4626"); @@ -27,14 +27,20 @@ async function suiTvl(api) { if (!suiVault || blacklistedVaults.includes(suiVault.address) || !suiVault.receiptCoin?.address?.includes('::')) { continue; } - const vaultTvl = await sui.query({ - target: `${SUI_PACKAGE_ID}::vault::get_vault_tvl`, - contractId: suiVault.address, + const initialSharedVersion = await sui.getInitialSharedVersion(suiVault.address); + const txBlockBytes = sui.buildProgrammableMoveCallBytes({ + packageId: SUI_PACKAGE_ID, + module: "vault", + functionName: "get_vault_tvl", typeArguments: [suiVault.baseDepositCoin.address, suiVault.receiptCoin.address], - sender: - "0xbaef681eafe323b507b76bdaf397731c26f46a311e5f3520ebb1bde091fff295", + sharedObjects: [{ objectId: suiVault.address, initialSharedVersion, mutable: false }], }); - api.add(suiVault.baseDepositCoin.address, vaultTvl); + const result = await sui.devInspectTransactionBlock(txBlockBytes); + const vaultTvl = result?.results?.[0]?.returnValues?.[0]?.[0]; + if (!Array.isArray(vaultTvl) || vaultTvl.length !== 8) { + throw new Error(`Unexpected get_vault_tvl return for ${suiVault.address}: ${JSON.stringify(result?.error ?? result?.results)}`); + } + api.add(suiVault.baseDepositCoin.address, sui.fromU64(vaultTvl).toString()); } } From 2cfad199b35e6e1844210721c0cf14f96eb01b61 Mon Sep 17 00:00:00 2001 From: Raphael Zerbib <44400280+Sithey@users.noreply.github.com> Date: Fri, 23 Oct 2026 23:35:42 +0300 Subject: [PATCH 419/988] add 2 new vault to morpho Rockawayx (#21809) --- projects/rockawayx/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/rockawayx/index.js b/projects/rockawayx/index.js index 1b1519fb0c1..2b38fa8c327 100644 --- a/projects/rockawayx/index.js +++ b/projects/rockawayx/index.js @@ -62,7 +62,8 @@ const configs = { '0x93e0F9d502eEfce8D34924ab3478C7EA0CBC5a2E', '0x9C57E02bC31e7e463f439353D97bd8f42F5a7F9c', '0xD6d4b804014EF27836dBe9f8f6Bf6c71251548Ec', - '0xc207d3f66537D7F66456808379A0E560cF20Da36' + '0xc207d3f66537D7F66456808379A0E560cF20Da36', + '0x195B3a57dd0480534c84A5607a52a92304fA81f2' ], upshiftV2: [ '0xcd69123b3FBBfC666E1f6a501da27B564C00De54', // Upshift Tori @@ -111,7 +112,8 @@ const configs = { }, monad: { morpho: [ - '0xA2fa4CeD4E2d448D084f5a15011b3564922119d6' + '0xA2fa4CeD4E2d448D084f5a15011b3564922119d6', + '0xBD6d56b5b1b535B92D4A0A8C0a9e6Cfd9b545167' ], midasTokens: [ '0x6CF55183eA297ba200Cf88419Bba156EBA2Ed206' From 87ee7e946dc9b7be4ddc8a4f1132ecc6c07d06fd Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 23 Oct 2026 17:04:48 -0400 Subject: [PATCH 420/988] Add v2 to Hedgehood stock yield (#21831) Co-authored-by: leo Co-authored-by: Claude Opus 5.5 --- projects/hedgehood-stock-yield/index.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/projects/hedgehood-stock-yield/index.js b/projects/hedgehood-stock-yield/index.js index 2082b3ac038..ca639c9dd99 100644 --- a/projects/hedgehood-stock-yield/index.js +++ b/projects/hedgehood-stock-yield/index.js @@ -1,18 +1,22 @@ const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking') +const { sumTokens2 } = require('../helper/unwrapLPs') // Stock Yield by HedgeHood: weekly covered-call vaults on Robinhood Chain stock tokens. -// Each vault (BrokerEpochVault) holds depositors' stock, sells one weekly call against it to a quoted +// v1: BrokerEpochVault holds depositors' stock, sells one weekly call against it to a quoted // option buyer and pays the premium out in USDG. Source verified on Sourcify, e.g. // https://sourcify.dev/server/v2/contract/4663/0xe35B7D7bf1212b89478ddAba2946ADEd59BEC0a9 const VAULTS = [ '0xe35B7D7bf1212b89478ddAba2946ADEd59BEC0a9', // NVDA Printer (hNVDA), deployed at block 84792706 ] -// Deposits require staking HEDGE in this gate +// v2: EpochFund strategy funds (covered call, wheel, ...), every one listed in this registry +const V2_REGISTRY = '0x868502F926AE068B61EA9CC55042A9F962651e76' +const V2_REGISTRY_BLOCK = 88943541 // 2026-10-15, registry deployment +// HEDGE staking: gates v1 deposits; stakers are paid a share of the funds' protocol fee const HEDGE = '0x3f9108a3bECa998C14c6dda822a7e8EaEb88E20D' const HEDGE_STAKING_GATE = '0x48ae41142bb0Ddd18DC49BD659b55207FAcE64d8' -async function tvl(api) { +async function v1Tvl(api) { const stocks = await api.multiCall({ abi: 'address:stock', calls: VAULTS }) // managedBalances = depositor stock (active + queued deposits + redeemed but unclaimed) and earned, unclaimed USDG // premiums. It leaves out the option buyer's escrowed premium before settlement, the buyer's exercised stock, @@ -27,9 +31,22 @@ async function tvl(api) { }) } +async function v2Tvl(api) { + if (await api.getBlock() < V2_REGISTRY_BLOCK) return + const funds = await api.call({ abi: 'address[]:vaults', target: V2_REGISTRY }) + const stocks = await api.multiCall({ abi: 'address:stock', calls: funds }) + const usdgs = await api.multiCall({ abi: 'address:usdg', calls: funds }) + return sumTokens2({ api, tokensAndOwners: funds.flatMap((fund, i) => [[stocks[i], fund], [usdgs[i], fund]]) }) +} + +async function tvl(api) { + await v1Tvl(api) + await v2Tvl(api) +} + module.exports = { methodology: - "TVL counts what depositors own in each Stock Yield vault, read from the vault's managedBalances(): the stock token (active, queued for the next epoch, and redeemed but not yet claimed) plus earned premiums not yet claimed, in USDG. The option buyer's premium is counted once the epoch settles and it is credited to depositors; the protocol fee, the buyer's exercised stock and the separately funded exit pool are excluded. Staking counts HEDGE staked in the deposit gate.", + "TVL counts what depositors own in each Stock Yield vault. v1 vaults are read from managedBalances(): the stock token (active, queued for the next epoch, and redeemed but not yet claimed) plus earned premiums not yet claimed, in USDG. v2 funds, discovered from the v2 VaultRegistry, count the stock token and USDG each fund holds. Staking counts HEDGE staked in the HEDGE staking contract.", start: 1791614176, // 2026-10-10 06:36:16 UTC, first vault's deployment block 84792706 robinhood: { tvl, From 6ba9d6524d061c353ac402ebbd640a8dfe50acba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edson=20Guimar=C3=A3es?= Date: Fri, 23 Oct 2026 18:05:26 -0300 Subject: [PATCH 421/988] Add BitBlocks Finance V3 TVL adapter (#21770) Co-authored-by: FelixBruguera --- registries/uniswapV3.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 46f5e59cf58..de778b7f8b7 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -243,6 +243,12 @@ const uniV3Configs = { fromBlock: 3579833, }, }, + 'bitblocks-finance-v3': { + bsc: { + factory: '0xa83f730fd076574f9ad6b54af653ab9e4743d3ac', + fromBlock: 127693063, + }, + }, 'bitswap-bb-v3': { bouncebit: { factory: '0x30a326d09E01d7960a0A2639c8F13362e6cd304A', From 577dc9179cb72f297851ccf0ed9ba6bc9859891b Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 23 Oct 2026 23:50:01 -0600 Subject: [PATCH 422/988] Fix formatting of methodology string in index.js (#21834) --- projects/proyield/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/proyield/index.js b/projects/proyield/index.js index e2c6e41a7e2..01276e71658 100644 --- a/projects/proyield/index.js +++ b/projects/proyield/index.js @@ -13,7 +13,7 @@ async function tvl(api) { module.exports = { doublecounted: true, methodology: - 'TVL is the ProYield vault\'s reported accounting value on HyperEVM (chain id 999), read from the vault\'s totalAssets() and denominated in USDC: idle USDC held by the vault plus USDC the vault has allocated to its registered yield strategies, including any returned amounts still recorded on-chain as in-flight. If USDC returned from a strategy remains recorded on-chain as in-flight without being credited, the reported amount may overstate the vault\'s backing. The vault is a capped guarded beta, so TVL is deliberately small while deposit caps are low. The protocol has no token counted in TVL.', + 'TVL is the Pro Yield vault\'s reported accounting value on HyperEVM (chain id 999), read from the vault\'s totalAssets() and denominated in USDC: idle USDC held by the vault plus USDC the vault has allocated to its registered yield strategies, including any returned amounts still recorded on-chain as in-flight. If USDC returned from a strategy remains recorded on-chain as in-flight without being credited, the reported amount may overstate the vault\'s backing. The vault is a capped guarded beta, so TVL is deliberately small while deposit caps are low. The protocol has no token counted in TVL.', hyperliquid: { tvl, }, From 99c31f4f61f790a2118b5cb3a8eb970b00cb0e6d Mon Sep 17 00:00:00 2001 From: routebuilder Date: Sat, 24 Oct 2026 17:47:28 +0200 Subject: [PATCH 423/988] add aave v4 base equities hub (#21828) Co-authored-by: ccipherx --- projects/aave-v4/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/aave-v4/index.js b/projects/aave-v4/index.js index 2f3f5352ad8..8ae7e196017 100644 --- a/projects/aave-v4/index.js +++ b/projects/aave-v4/index.js @@ -7,6 +7,9 @@ module.exports = aaveV4Export({ "0x943827DCA022D0F354a8a8c332dA1e5Eb9f9F931", // Prime Hub "0x62d63197660c080236193CA60b70E49A08E90368", // Global Dollar Hub ], + base: [ + "0xa4d5947Eb727A052bae69C593FfC84247EC9864E", // Equities Hub + ], avax: [ "0xd07369fAE4A5BB13c9Ce446B052c7867B1AbDf6e", // Core Hub ], From 50dc7ad8257c720d96679da23eadfd99ab578c5d Mon Sep 17 00:00:00 2001 From: Zenze Date: Sat, 24 Oct 2026 22:48:26 +0700 Subject: [PATCH 424/988] Add Zenze (launchpad on Robinhood Chain) (#21833) Co-authored-by: Zenzefun Co-authored-by: ccipherx --- projects/zenze/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/zenze/index.js diff --git a/projects/zenze/index.js b/projects/zenze/index.js new file mode 100644 index 00000000000..9432e623516 --- /dev/null +++ b/projects/zenze/index.js @@ -0,0 +1,30 @@ +const { getLogs } = require("../helper/cache/getLogs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const FACTORY = "0xbf656702ad1bdf92082f957937175278ff48e5d9"; +const ZNZF = "0x65ee0ce656908544a1f29856ac9aee8563b5002c"; +// Canonical $ZNZF curve, deployed outside the factory +const ZNZF_CURVE = "0xda1650faaec372925c9211e6625ba5d9a4397d57"; + +const LAUNCHED = + "event TokenLaunched(address indexed token, address indexed curve, address indexed creator, address quote, string symbol)"; + +// launches quoted in $ZNZF, the protocol's own token, are reported as staking +const sumCurves = (isZnzf) => async (api) => { + const logs = await getLogs({ api, target: FACTORY, eventAbi: LAUNCHED, fromBlock: 70344713, onlyArgs: true }); + const tokensAndOwners = isZnzf ? [] : [[ADDRESSES.null, ZNZF_CURVE]]; + for (const { quote, curve } of logs) + if ((quote.toLowerCase() === ZNZF) === isZnzf) tokensAndOwners.push([quote, curve]); + // the factory accepts any quote address, so a non-ERC20 quote must not break the sum + return sumTokens2({ api, tokensAndOwners, permitFailure: true }); +}; + +module.exports = { + methodology: + "TVL is the quote asset held by each Zenze bonding curve. The token a curve is selling is not counted. Collected fees are not counted. Curves quoted in $ZNZF, the protocol's own token, are counted as staking.", + robinhood: { + tvl: sumCurves(false), + staking: sumCurves(true), + }, +}; From 6fced416e1a9d4bc2e77324a2281318742345484 Mon Sep 17 00:00:00 2001 From: wzwrz6s7d5-commits Date: Sat, 24 Oct 2026 17:50:30 +0200 Subject: [PATCH 425/988] Add TETRAVAULT (Robinhood Chain) (#21817) Co-authored-by: wzwrz6s7d5-commits Co-authored-by: ccipherx --- projects/tetravault/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/tetravault/index.js diff --git a/projects/tetravault/index.js b/projects/tetravault/index.js new file mode 100644 index 00000000000..8cad2c999f9 --- /dev/null +++ b/projects/tetravault/index.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const RESERVE = '0x6681f24a6347772D9e0F861717C35cf462f6f194' +const SPY = '0x117cc2133c37B721F49dE2A7a74833232B3B4C0C' +const GLD = '0xC9a981FEE1F9DEc688bb123ccDeCc63D0deBFC4e' +const { USO, WETH, USDG } = ADDRESSES.robinhood + +async function tvl(api) { + return api.sumTokens({ owner: RESERVE, tokens: [SPY, GLD, USO, WETH, USDG] }) +} + +// USDG principal lent against escrowed TETRA (index 4 = USDG cash) +async function borrowed(api) { + const lent = await api.call({ target: RESERVE, abi: 'function onLoan(uint256) view returns (uint256)', params: [4] }) + api.add(USDG, lent) +} + +module.exports = { + methodology: 'TVL is the SPY, GLD, USO, WETH and USDG held by the TETRAVAULT Reserve contract on Robinhood Chain, funded by bond purchases and the 4% trade tax, and redeemable pro rata by burning TETRA. Borrowed is the USDG the Reserve has lent against escrowed TETRA. Staked TETRA is not counted, since its backing is the Reserve already counted in TVL.', + start: '2026-10-22', + robinhood: { tvl, borrowed }, +} From bf9ca631d4dbc1dd953ca5a4729f75a67b632694 Mon Sep 17 00:00:00 2001 From: niccox Date: Sat, 24 Oct 2026 18:03:26 +0200 Subject: [PATCH 426/988] Add Overcall (Robinhood Chain): staking + treasury (#21819) Co-authored-by: Kamil Chmielowiec Co-authored-by: ccipherx --- projects/overcall/index.js | 29 +++++++++++++++++++++++++++++ projects/treasury/overcall.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 projects/overcall/index.js create mode 100644 projects/treasury/overcall.js diff --git a/projects/overcall/index.js b/projects/overcall/index.js new file mode 100644 index 00000000000..7678b372577 --- /dev/null +++ b/projects/overcall/index.js @@ -0,0 +1,29 @@ +const OVER = '0x6245Db7f52379bD9757c9DdcE6519768FfaB3a4F' // the protocol's own token +const USDG = '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168' +const OVER_STAKING = '0x2165E659406F6B4F122F10A540B634252249b306' +const OVER_VAULT = '0xFB4C6062c24313E2E8Cf01D1CCBa0B940e7b29f6' +const USDG_VAULT = '0x526b07940694f599aA2e9DbDE30540BE004aC80e' +const VAULTS_DEPLOYED = 1792452600 // 2026-10-19 23:30 UTC, after both vaults were deployed (block 93002929) + +// players' and creators' funds in a vault: its balance less the protocol's capital and revenue (tracked as treasury) +async function addUserFunds(api, vault, token) { + if (api.timestamp && api.timestamp < VAULTS_DEPLOYED) return + const balance = await api.call({ abi: 'erc20:balanceOf', target: token, params: [vault] }) + const capital = await api.call({ abi: 'uint256:capital', target: vault }) + const revenue = await api.call({ abi: 'uint256:revenue', target: vault }) + const userFunds = BigInt(balance) - BigInt(capital) - BigInt(revenue) + if (userFunds < 0n) throw new Error(`vault ${vault} holds less than its capital + revenue`) + api.add(token, userFunds) +} + +module.exports = { + methodology: 'TVL counts the USDG that players and channel creators hold in the USDG vault (open positions, unclaimed royalties, held wins): the vault balance less the protocol\'s own capital and fee revenue, which are tracked as treasury. Staking counts the $OVER staked in the staking contract, plus the players\' and creators\' $OVER in the $OVER vault, worked out the same way.', + start: '2026-09-18', // first full day after the first stake (block 65482061, 2026-09-17 15:41 UTC) + robinhood: { + tvl: (api) => addUserFunds(api, USDG_VAULT, USDG), + staking: async (api) => { + await api.sumTokens({ owners: [OVER_STAKING], tokens: [OVER] }) + await addUserFunds(api, OVER_VAULT, OVER) + }, + }, +} diff --git a/projects/treasury/overcall.js b/projects/treasury/overcall.js new file mode 100644 index 00000000000..78f1a52fbfc --- /dev/null +++ b/projects/treasury/overcall.js @@ -0,0 +1,28 @@ +const { nullAddress } = require('../helper/sumTokens') + +const RESERVE = '0x437bCF676D11FFE5542BfAa842b560e431285065' // the $OVER reserve wallet (100M of the 150M vault liquidity) +const OVER = '0x6245Db7f52379bD9757c9DdcE6519768FfaB3a4F' +const OVER_VAULT = '0xFB4C6062c24313E2E8Cf01D1CCBa0B940e7b29f6' +const USDG = '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168' +const USDG_VAULT = '0x526b07940694f599aA2e9DbDE30540BE004aC80e' +const VAULTS_DEPLOYED = 1792452600 // 2026-10-19 23:30 UTC, after both vaults were deployed (block 93002929) + +// the protocol's part of a vault: its capital and the fee revenue not withdrawn yet (players' funds are in projects/overcall) +async function addOwned(api, vault, token) { + if (api.timestamp && api.timestamp < VAULTS_DEPLOYED) return + api.add(token, await api.call({ abi: 'uint256:capital', target: vault })) + api.add(token, await api.call({ abi: 'uint256:revenue', target: vault })) +} + +module.exports = { + robinhood: { + tvl: async (api) => { + await api.sumTokens({ owners: [RESERVE], tokens: [nullAddress, USDG] }) + await addOwned(api, USDG_VAULT, USDG) + }, + ownTokens: async (api) => { + await api.sumTokens({ owners: [RESERVE], tokens: [OVER] }) + await addOwned(api, OVER_VAULT, OVER) + }, + }, +} From dd55356b1c85bf968541b4af827ea8da67c775af Mon Sep 17 00:00:00 2001 From: "m.aliarslan" <86300262+Kewe63@users.noreply.github.com> Date: Sat, 24 Oct 2026 19:04:06 +0300 Subject: [PATCH 427/988] Use authenticated HTTPS for GhostMarket and NUDES staking RPC (#21826) Co-authored-by: ccipherx --- projects/ghostmarket.js | 3 ++- projects/nudes.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/ghostmarket.js b/projects/ghostmarket.js index 862e22b2cac..d42c43cbef3 100644 --- a/projects/ghostmarket.js +++ b/projects/ghostmarket.js @@ -15,7 +15,8 @@ async function tvl() { const options = { method: "post", - url: "http://seed2.neo.org:10332", + url: "https://mainnet1.neo.coz.io:443", + maxRedirects: 0, // Do not follow redirects to plaintext HTTP. data: query, }; diff --git a/projects/nudes.js b/projects/nudes.js index 9949c66c0fb..fe2c55f365a 100644 --- a/projects/nudes.js +++ b/projects/nudes.js @@ -15,7 +15,8 @@ async function tvl() { const options = { method: "post", - url: "http://seed2.neo.org:10332", + url: "https://mainnet1.neo.coz.io:443", + maxRedirects: 0, // Do not follow redirects to plaintext HTTP. data: query, }; From e247157a92255c81b529f4af504adfb5a075e7d5 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Sat, 24 Oct 2026 18:04:44 +0200 Subject: [PATCH 428/988] accountable: skip borrowed calculation when liquidity read fails (#21822) Co-authored-by: ccipherx --- projects/accountable/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/accountable/index.js b/projects/accountable/index.js index 83d64c55030..d8190ffc7b4 100644 --- a/projects/accountable/index.js +++ b/projects/accountable/index.js @@ -130,6 +130,11 @@ async function getVaults(api) { return Array.from(vaults) } +/** + * Builds a TVL or borrowed handler for Accountable vaults. + * @param {boolean} isBorrowed When true, counts supplied assets minus idle vault liquidity. + * @returns {Function} DefiLlama adapter handler. + */ function tvl(isBorrowed) { return async (api) => { const vaults = await getVaults(api) @@ -149,8 +154,9 @@ function tvl(isBorrowed) { api.multiCall({ abi: 'erc20:balanceOf', calls: vaults.map((vault, i) => ({ target: underlyings[i], params: vault })), permitFailure: true }) ]) - vaults.forEach((_, i) => { + vaults.forEach((vault, i) => { if (!underlyings[i] || !totalAssets[i]) return + if (liquidity[i] == null) throw new Error(`balanceOf failed for vault ${vault}`) isBorrowed ? api.add(underlyings[i], totalAssets[i] - liquidity[i]) : api.add(underlyings[i], liquidity[i]) }) } From 46fb2f824a19298246d37055621914476bdbc8c7 Mon Sep 17 00:00:00 2001 From: "duke.sol" <77286113+cryptoduke01@users.noreply.github.com> Date: Sun, 25 Oct 2026 10:32:08 +0100 Subject: [PATCH 429/988] Add Gloam TVL adapter (#21792) Co-authored-by: ccipherx --- projects/gloam/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/gloam/index.js diff --git a/projects/gloam/index.js b/projects/gloam/index.js new file mode 100644 index 00000000000..e3db5fab386 --- /dev/null +++ b/projects/gloam/index.js @@ -0,0 +1,31 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') + +// Gloam's shielded pool (ShieldPoolPayments), the same address on both chains. +const POOL = '0x39e28cde55cab798874746ac52cb4b5cc99a0194' +const GLOAM = '0xDcD885F5c60b3aD49F6D58718696417314e8724d' +const OUSD = '0x20c0000000000000000000006a37da5c996874be' + +// pool balance minus the cash-out fees it holds for feeRecipient +async function addPoolBalances(api, tokens) { + const balances = await api.getTokenBalances({ owner: POOL, tokens }) + const fees = await api.multiCall({ abi: 'function feesOwed(address) view returns (uint256)', target: POOL, calls: tokens }) + tokens.forEach((token, i) => api.add(token, BigInt(balances[i]) - BigInt(fees[i]))) +} + +module.exports = { + methodology: 'TVL is the tokens held by the Gloam shielded pool on Robinhood Chain and Tempo, minus the cash-out fees the pool holds for the fee recipient. On Robinhood Chain the accepted assets are discovered from the pool\'s DepositLimitSet events. $GLOAM held in the pool is the protocol\'s own token and is counted under staking.', + start: '2026-10-21', + robinhood: { + tvl: async (api) => { + const logs = await getLogs2({ api, target: POOL, eventAbi: 'event DepositLimitSet(address indexed asset, uint128 perDeposit, uint128 total)', fromBlock: 94194599, extraKey: 'deposit-limit-set' }) + const tokens = [...new Set(logs.map(l => l.asset.toLowerCase()))].filter(t => t !== GLOAM.toLowerCase()) + await addPoolBalances(api, tokens) + }, + staking: (api) => addPoolBalances(api, [GLOAM]), + }, + tempo: { + // static: the SDK's Tempo RPC rejects getLogs ranges; these are all of the pool's DepositLimitSet assets + tvl: (api) => addPoolBalances(api, [ADDRESSES.tempo.pathUSD, ADDRESSES.tempo.USDC_E, ADDRESSES.tempo.USDT0, OUSD]), + }, +} From 767031eb0bd6548a372742ff62ad44490f9bc585 Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Sun, 25 Oct 2026 10:33:06 +0100 Subject: [PATCH 430/988] choice-exchange-v1: add CosmWasm CLMM pools (#21791) Co-authored-by: ccipherx --- projects/choice-exchange-clmm/index.js | 53 ++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 projects/choice-exchange-clmm/index.js diff --git a/projects/choice-exchange-clmm/index.js b/projects/choice-exchange-clmm/index.js new file mode 100644 index 00000000000..98f9cb5f849 --- /dev/null +++ b/projects/choice-exchange-clmm/index.js @@ -0,0 +1,53 @@ +const sdk = require("@defillama/sdk"); +const { queryContract, getBalance2, getBalance } = require("../helper/chain/cosmos"); + +// CosmWasm CLMM (concentrated liquidity) factory, each pool contract holds its own tokens +// https://github.com/choice-exchange/choice_exchange/blob/main/deployed_contracts.md +const factory = "inj1k58yqvsww97asl6eajx0lja6np03naddfc6cs7"; + +async function getPools(chain) { + const pools = []; + let start_after; + while (true) { + const page = await queryContract({ contract: factory, chain, data: { get_all_pools: { start_after, limit: 100 } } }); + pools.push(...page); + if (page.length < 100) return pools; + const last = page[page.length - 1]; + start_after = [last.token0, last.token1, last.fee]; + } +} + +async function tvl(api) { + const pools = await getPools(api.chain); + let cw20Queries = 0; + let cw20Failures = 0; + for (const { pool_address, token0, token1 } of pools) { + // tokens are prefixed `n:` (bank denom) or `c:` (cw20); only the pool's own pair is counted + const tokens = [token0, token1]; + const denoms = tokens.filter((t) => t.startsWith("n:")).map((t) => t.slice(2)); + const cw20s = tokens.filter((t) => t.startsWith("c:")).map((t) => t.slice(2)); + if (denoms.length) { + const balances = await getBalance2({ owner: pool_address, chain: api.chain, tokens: denoms }); + // `erc20:0x..` bank denoms are MultiVM Token Standard twins of the Injective EVM erc20 + Object.entries(balances).forEach(([denom, amount]) => api.add(denom.startsWith("erc20:") ? denom.slice(6) : denom, amount)); + } + // the factory accepts any cw20 address, so a token that fails the balance query only skips that balance + for (const token of cw20s) { + cw20Queries++; + try { + api.add(token, await getBalance({ token, owner: pool_address, chain: api.chain })); + } catch (e) { + cw20Failures++; + sdk.log(`choice clmm: cw20 balance query failed for ${token} in ${pool_address}`); + } + } + } + // every cw20 query failing points to an LCD problem, not a bad token + if (cw20Queries && cw20Failures === cw20Queries) throw new Error("choice clmm: all cw20 balance queries failed"); +} + +module.exports = { + timetravel: false, + methodology: "Liquidity on the CLMM: the token0/token1 balances held by every pool created by the Choice Exchange CosmWasm CLMM factory on Injective.", + injective: { tvl }, +}; From 295d031e94934c22bb6eaf2a4811ce51ff82ea2b Mon Sep 17 00:00:00 2001 From: stockereum <345756119+stockereum@users.noreply.github.com> Date: Sun, 25 Oct 2026 11:10:43 +0100 Subject: [PATCH 431/988] Add Stockereum (#21787) Co-authored-by: ccipherx --- projects/stockereum/index.js | 74 ++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 projects/stockereum/index.js diff --git a/projects/stockereum/index.js b/projects/stockereum/index.js new file mode 100644 index 00000000000..61859b8fae8 --- /dev/null +++ b/projects/stockereum/index.js @@ -0,0 +1,74 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { tickToPrice } = require('../helper/utils/tick') + +// Stockereum - token launchpad on Ethereum. Every launch opens a Uniswap v4 pool quoted in a +// tokenized stock, ETH (WETH) or USDC, holding a single hook-owned liquidity position that can +// never be withdrawn. TVL is the quote side of those positions at the live pool price; the +// launched token's own side is not counted. +// https://stockereum.com + +// https://docs.uniswap.org/contracts/v4/deployments +const STATE_VIEW = '0x7ffe42c4a5deea5b0fec41c94c136cf115597227' +const STOCKER = '0x75e2fc69ff2ac12af65ba7d321bbf4f878c535d2' // protocol token, itself launched on the v2 hook + +const hooks = [ + { + // v2 hook, deployed at block 25899296 + hook: '0xAFeD2c6e0d906520ca17143a8918Ce6d54b128Cc', + fromBlock: 25899296, + launchOpened: 'event LaunchOpened(bytes32 indexed poolId, address indexed token, address indexed creator, address quote, uint160 sqrtPriceX96, int24 tickLower, int24 tickUpper, uint128 liquidity)', + }, + { + // v3 hook, deployed at block 25910748 + hook: '0x322dcEc4958C14e021A9F1cD49DF11b9457968cC', + fromBlock: 25910748, + launchOpened: 'event LaunchOpened(bytes32 indexed poolId, address indexed token, address indexed feeRecipient, address quote, uint160 sqrtPriceX96, int24 tickLower, int24 tickUpper, uint128 liquidity, uint24 feePpm, bool feesToHolders)', + }, +] + +const getSlot0Abi = 'function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)' + +// quote amount held by one concentrated position [tickLower, tickUpper] with liquidity L at sqrt price sp +function quoteAmount({ sp, tickLower, tickUpper, liquidity, quoteIsCurrency0 }) { + const sa = tickToPrice(tickLower / 2) + const sb = tickToPrice(tickUpper / 2) + const p = Math.min(Math.max(sp, sa), sb) + const amount0 = liquidity * (sb - p) / (p * sb) + const amount1 = liquidity * (p - sa) + return quoteIsCurrency0 ? amount0 : amount1 +} + +// launches quoted in another Stockereum launch hold only launched tokens; STOCKER-quoted ones go to staking +const sumQuotes = (isStaking) => async (api) => { + const all = [] + for (const { hook, fromBlock, launchOpened } of hooks) + all.push(...await getLogs2({ api, target: hook, eventAbi: launchOpened, fromBlock })) + const launched = new Set(all.map(l => l.token.toLowerCase())) + const launches = all.filter(l => { + const quote = l.quote.toLowerCase() + return isStaking ? quote === STOCKER : !launched.has(quote) + }) + if (!launches.length) return + const slot0s = await api.multiCall({ abi: getSlot0Abi, target: STATE_VIEW, calls: launches.map(l => l.poolId) }) + launches.forEach((l, i) => { + const sqrtP = Number(slot0s[i].sqrtPriceX96) + if (!sqrtP) return + const quote = l.quote.toLowerCase() + // v4 sorts currencies by address; the launched token is the other side + const quoteIsCurrency0 = quote < l.token.toLowerCase() + const amount = quoteAmount({ + sp: sqrtP / 2 ** 96, + tickLower: Number(l.tickLower), + tickUpper: Number(l.tickUpper), + liquidity: Number(l.liquidity), + quoteIsCurrency0, + }) + if (amount > 0) api.add(quote, amount) + }) +} + +module.exports = { + methodology: 'TVL is the quote asset (tokenized stocks, ETH, USDC and other registered quotes) held by the locked Uniswap v4 liquidity position of every Stockereum launch, valued at the live pool price. The launched tokens themselves are not counted, nor are launches quoted in another Stockereum launch. Launches quoted in STOCKER, the protocol token, are counted as staking. Marked doublecounted because the positions already sit inside Uniswap v4 TVL on Ethereum.', + doublecounted: true, + ethereum: { tvl: sumQuotes(false), staking: sumQuotes(true) }, +} From 1ab125a1cc4921acdeb6cb776f48af92aa269978 Mon Sep 17 00:00:00 2001 From: darkpoolsol Date: Sun, 25 Oct 2026 03:24:00 -0700 Subject: [PATCH 432/988] Add DARKPOOL TVL (#21799) Co-authored-by: darkpoolsol <342649853+darkpoolsol@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- registries/sumTokens.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 97da7f8db94..8a8a64313e1 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -12733,6 +12733,22 @@ const configs = { } }, }, + "darkpool": { + "methodology": "Coins shielded into the DARKPOOL private pool: every reserve token account of the pool state on Solana, and ETH, WETH and USDG held by the pool contract on Robinhood Chain. Shielded $DARKPOOL, the protocol's own token, is counted under staking.", + "solana": { + "tvl": { + "owner": "9aM43RjPFqpzTia2mMcMEoKTm9gjpD56tDhWTirUY9yy", + "blacklistedTokens": ["fCUBpdeRn76xfRaa4UPHDauGeRG3EvMB3MjuRgdpump"] + }, + "staking": { + "tokenAccounts": ["A5rCK2MaqCrEtDKabvLZKofGRhxVMSkE2RQCa7caEaXa"] + } + }, + "robinhood": { + "owner": "0xEB66bd2d7d29f1F29a19C88cE4b2035D4571076E", + "tokens": [ADDRESSES.null, ADDRESSES.robinhood.WETH, ADDRESSES.robinhood.USDG] + }, + }, "deadbox": { "methodology": "Counts WETH, wstETH, and rETH deposited as collateral in DRP.", "ethereum": { From ad5ab504979dd343e07bd5624dee514bd5a8ee2b Mon Sep 17 00:00:00 2001 From: scriptKiddle09 Date: Sun, 25 Oct 2026 07:32:20 -0400 Subject: [PATCH 433/988] lincoln-protocol: add 6 pools (AAPL, CASHCAT, LINCOLN, PONS, SPCX, USDE) (#21844) Co-authored-by: scathymedi <342484490+scathymedi@users.noreply.github.com> Co-authored-by: Claude Code Co-authored-by: FelixBruguera --- registries/sumTokens/data3.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 22515b22e82..fc96b7d6106 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1193,7 +1193,7 @@ module.exports = { }, }, "lincoln-protocol": { - "methodology": "Each Lincoln privacy pool is an immutable contract holding a single asset (ETH, USDG or a Robinhood tokenized stock). TVL is the on-chain balance of every pool. Route adapters and relays hold no user funds between transactions, so they are not counted.", + "methodology": "Each Lincoln privacy pool is an immutable contract holding a single asset (ETH, USDG/USDe, a Robinhood tokenized stock, or the protocol tokens LINCOLN/SPCX). TVL is the on-chain balance of every pool. Route adapters and relays hold no user funds between transactions, so they are not counted.", "start": "2026-10-17", "robinhood": { "ownerTokens": [ @@ -1206,6 +1206,11 @@ module.exports = { [["0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3"], "0x31Bd720527D9875b444c0946c5795351a56d9d8B"], // GOOGL [["0xD5f3879160bc7c32ebb4dC785F8a4F505888de68"], "0xd4375275F5FA231e238c9FF1237A8e8666Be6B62"], // QQQ [["0xec262a75e413fAfD0dF80480274532C79D42da09"], "0x207Dc4DD4E40Ab280dF9eC10CD5Edf04685e9d88"], // MSTR + [["0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9"], "0xC2991be873dD0EC1D93a0911dC1068bcCcf4D3B4"], // AAPL + [["0x020bfC650A365f8BB26819deAAbF3E21291018b4"], "0xe6711cbb2E44A0Ce72d301cC27EfBC244cBD75fb"], // CASHCAT + [["0x39dBED3a2bd333467115dE45665cC57F813C4571"], "0x757335BD24807EAc290521Ee6b3Ab2CB86fd9F18"], // PONS + [["0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa"], "0xd5Fc86f3251cE49F0Bd7B94b28B0334f21F6E42b"], // SPCX + [["0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34"], "0x4AC6D3EB4379Bd82f1dcD5C8A61c6b8F15b7812C"], // USDE ] }, }, From b2835b5ee73511e2b9ee584e41527d5e722e614a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 25 Oct 2026 13:02:29 +0100 Subject: [PATCH 434/988] fix binance --- projects/gate-io/index.js | 41 +++++++++++++++++++----------------- projects/helper/sumTokens.js | 20 ++++++++++++++++++ 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index cb6324dfd9c..e2dd897f0b5 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -8,7 +8,6 @@ const { unwrapDolomiteDeposits } = require("../helper/unwrapLPs.js"); const { addHypercoreSpotBalances } = require("../helper/chain/hyperliquid.js"); const { sumTokens: cosmosSumTokens } = require("../helper/chain/cosmos.js"); const { addThetaBalances } = require("../helper/chain/theta.js"); -const avaxX = require("../helper/chain/avaxX"); const config = { "ethereum": { @@ -78,7 +77,11 @@ const config = { "0xc882b111a75c0c657fc507c04fbfcd2cc984f071", "0xba7946e3aeffe2145e68cd227f113e0038d43d9b", "0xb05ebe4b470c4fbc0a5f4a6293741c7985c6a016", - "0x20ddf011b00e6f134ae10bdb73146500a69c453e" + "0x20ddf011b00e6f134ae10bdb73146500a69c453e", + + // Avalanche X-Chain wallet, counted on the avax chain next to the C-Chain balances + 'X-avax155svs6sgxe55rnvs6ghprtqu0mh69kehk3zye7', + ] }, "arbitrum": { @@ -1473,10 +1476,10 @@ const config = { }, "okexchain": { "owners": [ - // "0x0d0707963952f2fba59dd06f2b425ace40b492fe", - // "0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c", - // "0xc882b111a75c0c657fc507c04fbfcd2cc984f071", - // "0xffeb0f61871acdb4838dfc6d5082f063e738e421" + // "0x0d0707963952f2fba59dd06f2b425ace40b492fe", + // "0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c", + // "0xc882b111a75c0c657fc507c04fbfcd2cc984f071", + // "0xffeb0f61871acdb4838dfc6d5082f063e738e421" ] }, "ontology": { @@ -2199,11 +2202,13 @@ Object.entries(earnReceiptTokens).forEach(([chain, { owners }]) => { if (!cfg.owners.length) delete config[chain] }) -const stakedEthTvl = getStakedEthTVL({ withdrawalAddresses: [ - '0x287a66c7d9cba7504e90fa638911d74c4dc6a147', '0xbcf03ce48091e6b820a7c33e166e5d0109d8e712', '0x7a3f9b7120386249528c93e5eb373b78e54d5ba9', - '0xD6A8047940a1F71df5f809919c10D9Ba0A88786e', - '0xB04B2B81f65baCc8f29F411A1344f78Bff7A36A2', -], sleepTime: 20_000, size: 200, proxy: true }) +const stakedEthTvl = getStakedEthTVL({ + withdrawalAddresses: [ + '0x287a66c7d9cba7504e90fa638911d74c4dc6a147', '0xbcf03ce48091e6b820a7c33e166e5d0109d8e712', '0x7a3f9b7120386249528c93e5eb373b78e54d5ba9', + '0xD6A8047940a1F71df5f809919c10D9Ba0A88786e', + '0xB04B2B81f65baCc8f29F411A1344f78Bff7A36A2', + ], sleepTime: 20_000, size: 200, proxy: true +}) // mergeExports sums the *returned* balances, so every tvl has to hand them back const earnTvl = fn => async (api) => { @@ -2215,10 +2220,12 @@ const gateEarnTvl = { ethereum: { tvl: earnTvl(async (api) => { await stakedEthTvl(api) - await unwrapDolomiteDeposits({ api, owners: [ - '0x37E1BF9Ab62E523f358daFacA86151519F0a2f8D', - '0xe39BA3F5BCbF0eF7ED31A07e799B8D2010c885CF', - ], }) + await unwrapDolomiteDeposits({ + api, owners: [ + '0x37E1BF9Ab62E523f358daFacA86151519F0a2f8D', + '0xe39BA3F5BCbF0eF7ED31A07e799B8D2010c885CF', + ], + }) await api.sumTokens(earnReceiptTokens.ethereum) }), }, @@ -2255,11 +2262,7 @@ Object.entries(earnReceiptTokens).forEach(([chain, args]) => { gateEarnTvl[chain] = { tvl: earnTvl(api => api.sumTokens(args)) } }) -// Avalanche X-Chain wallet, counted on the avax chain next to the C-Chain balances -const avaxXChainOwners = ['X-avax155svs6sgxe55rnvs6ghprtqu0mh69kehk3zye7'] - module.exports = mergeExports([ cexExports(config), gateEarnTvl, - { avax: { tvl: avaxX.sumTokensExport({ owners: avaxXChainOwners }) } }, ]); diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index 0ad8486af48..67e5e296b60 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -3,6 +3,7 @@ const { get, } = require('./http') const { sumTokens2: sumTokensEVM, nullAddress, } = require('./unwrapLPs') const { svmChains, svmChainsSet, } = require('./svmChainConfig') const sdk = require('@defillama/sdk') +const avaxX = require('./chain/avaxX') const { xrpl } = sdk.chains @@ -110,6 +111,7 @@ async function sumTokens(options) { if (token) tokens = [token] if (owner) owners = [owner] + if (chain === 'avax') owners = await addAvaxXChainBalances(options, owners) const evmAddressExceptions = new Set(['tron', 'xdc']) const nonEvmOwnerFound = !evmAddressExceptions.has(chain) && owners.some(o => !o.startsWith('0x')) const isAltEvm = altEVMHelper[chain] && nonEvmOwnerFound @@ -186,6 +188,24 @@ async function sumTokens(options) { } } +// Avalanche X-Chain (AVM) owners (X-avax1...) are invisible to the C-Chain evm path: count their native AVAX +// straight into api.balances and hand only the remaining 0x owners back to the evm flow +const isAvaxXChainAddress = (address) => /^(X-)?avax1[a-z0-9]{38}$/i.test(address) + +async function addAvaxXChainBalances(options, owners) { + const xOwners = owners.filter(isAvaxXChainAddress) + if (!xOwners.length) return owners + const { api } = options + if (!api) throw new Error('avax X-Chain owners require an api object') + await avaxX.sumTokens({ api, owners: xOwners.map(i => i.startsWith('X-') ? i : 'X-' + i) }) + owners = owners.filter(i => !isAvaxXChainAddress(i)) + options.owners = owners + delete options.owner + if (options.tokensAndOwners?.length) + options.tokensAndOwners = options.tokensAndOwners.filter(([, o]) => !isAvaxXChainAddress(o)) + return owners +} + // XRP balance in whole XRP (0 for unfunded accounts); the sdk rotates public XRPL nodes and retries // "tooBusy" / "slowDown" / 429 answers (XRPL_RPC overrides the node list) async function getRippleBalance(account) { From a3045fc9b5e1bb2d4a534c34caab63d62f1e5990 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Sun, 25 Oct 2026 09:21:06 -0400 Subject: [PATCH 435/988] pick up registry changes in ci comments (#21845) --- .github/workflows/getFileList.js | 39 +++++++++++++++++++++++--------- test.js | 5 ++-- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/.github/workflows/getFileList.js b/.github/workflows/getFileList.js index 8ca2cddee9f..ab38af1d283 100644 --- a/.github/workflows/getFileList.js +++ b/.github/workflows/getFileList.js @@ -1,28 +1,45 @@ const { execSync } = require('child_process') +const fs = require('fs') const MODIFIED = parse(process.env.MODIFIED) const ADDED = parse(process.env.ADDED) const fileSet = new Set(); [...MODIFIED, ...ADDED].forEach(file => { - const [root, dir] = file.split('/') - if (dir === 'treasury' || dir === 'entities') fileSet.add(file) - else if (root === 'projects' && dir !=='helper' && dir !== 'config') fileSet.add(root + '/' + dir) - else if (root === 'registries' && /^registries\/[a-zA-Z0-9_-]+\.js$/.test(file) && dir !== 'index.js' && dir !== 'utils.js') { + const [root, dir] = file.split('/') + if (dir === 'treasury' || dir === 'entities') fileSet.add(file) + else if (root === 'projects' && dir !=='helper' && dir !== 'config') fileSet.add(root + '/' + dir) + else if (root === 'registries' && /^registries\/([a-zA-Z0-9_-]+\/)?[a-zA-Z0-9_-]+\.js$/.test(file) && dir !== 'index.js' && dir !== 'utils.js') { let protocolNames = new Set() try { protocolNames = new Set(Object.keys(require('../../' + file))) } catch (e) {} const diffBase = process.env.DIFF_BASE || 'HEAD~1' - const diff = execSync(`git diff ${diffBase} -- ${file}`).toString() - const lines = diff.split('\n').filter(l => l.startsWith('+') && !l.startsWith('+++')) - for (const line of lines) { - const match = line.match(/^\+ ['"]([a-zA-Z0-9][a-zA-Z0-9_-]+)['"]\s*:/) - if (match && protocolNames.has(match[1])) fileSet.add(match[1]) + const keyLine = /^ ['"]?([a-zA-Z0-9][a-zA-Z0-9_/-]+)['"]?\s*:/ + // map each line of the new file to the protocol entry it sits in, then pick the entries the diff touches + const lines = fs.readFileSync(file, 'utf8').split('\n') + const keyAt = [] + let key + lines.forEach((line, i) => { + const match = line.match(keyLine) + if (match && protocolNames.has(match[1])) key = match[1] + keyAt[i + 1] = key + }) + const diff = execSync(`git diff -U0 ${diffBase} -- ${file}`).toString() + for (const hunk of diff.split(/^(?=@@ )/m).slice(1)) { + const [, start, count = '1'] = hunk.match(/^@@ -\S+ \+(\d+)(?:,(\d+))? @@/) + if (+count === 0) { + // pure deletion: skip a removed entry, otherwise it belongs to the entry around the line before it + const removedEntry = hunk.split('\n').some(l => l.startsWith('-') && keyLine.test(l.slice(1))) + if (!removedEntry && keyAt[+start]) fileSet.add(keyAt[+start]) + continue + } + for (let l = +start; l < +start + +count; l++) + if (keyAt[l]) fileSet.add(keyAt[l]) } - } + } }) console.log(JSON.stringify([...fileSet])) function parse(data) { - return data.replace('[', '').replace(']', '').split(',') + return data.replace('[', '').replace(']', '').split(',') } diff --git a/test.js b/test.js index e0e9cda3574..b8a088b9793 100644 --- a/test.js +++ b/test.js @@ -1,6 +1,6 @@ #!/usr/bin/env node - +require("dotenv").config(); const handleError = require('./utils/handleError') const INTERNAL_CACHE_FILE = 'tvl-adapter-repo/sdkInternalCache.json' @@ -9,7 +9,6 @@ process.on('unhandledRejection', handleError) process.on('uncaughtException', handleError) const path = require("path"); -require("dotenv").config(); const { ENV_KEYS } = require("./projects/helper/env"); const { util: { blocks: { getBlocks }, @@ -130,7 +129,7 @@ function validateHallmarks(hallmark) { const moduleArg = process.argv[2].replace('/index.js', '').split('/').pop() // registry keys can be namespaced (e.g. `treasury/gmx`); preserve the full // key so a treasury entry isn't shadowed by a same-named protocol adapter. - const registryKey = process.argv[2].replace(/\.js$/, '').replace(/\/index$/, '').replace(/^projects\//, '') + const registryKey = path.relative(__dirname, passedFile).replace(/\.js$/, '').replace(/\/index$/, '').replace(/^projects\//, '') // throw error if module doesnt start with lowercase letters if (!/^[a-z]/.test(moduleArg) && !process.env.LLAMA_RUN_LOCAL) { From d2b8fecd286989e484f43a7d665739f056c0a664 Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Mon, 26 Oct 2026 10:55:04 +0100 Subject: [PATCH 436/988] uniswap-v4: add celo (#21852) --- projects/uniswap-v4/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/uniswap-v4/index.js b/projects/uniswap-v4/index.js index dd30fc39b14..2578dcec329 100644 --- a/projects/uniswap-v4/index.js +++ b/projects/uniswap-v4/index.js @@ -30,6 +30,7 @@ const config = { zora: { factory: "0x0575338e4c17006ae181b47900a84404247ca30f", fromBlock: 25434534 }, wc: { factory: "0xb1860d529182ac3bc1f51fa2abd56662b7d13f33", fromBlock: 9111872 }, ink: { factory: "0x360e68faccca8ca495c1b759fd9eee466db9fb32", fromBlock: 4580556 }, + celo: { factory: "0x288dc841a52fca2707c6947b3a777c5e56cd87bc", fromBlock: 43985163 }, soneium: { factory: "0x360e68faccca8ca495c1b759fd9eee466db9fb32", fromBlock: 2473300, useIndexerSql: true }, avax: { factory: "0x06380c0e0912312b5150364b9dc4542ba0dbbc85", fromBlock: 56195376, useIndexerSql: true }, bsc: { factory: "0x28e2ea090877bf75740558f6bfb36a5ffee9e9df", fromBlock: 45970610, useIndexerSql: true, blacklistedTokens: ['0xb4357054c3dA8D46eD642383F03139aC7f090343', '0x8145eb83744aac883b68ae34060bebb5031d8f5c', From 33c5ff63e2357b21a051eb16132cf67488b67b29 Mon Sep 17 00:00:00 2001 From: MegaPumpETH <301645932+MegaPumpETH@users.noreply.github.com> Date: Mon, 26 Oct 2026 17:06:52 +0700 Subject: [PATCH 437/988] megapump: count the USDm and MEGA held by the factory (v3 quote currencies) (#21850) Co-authored-by: DaddyGG Co-authored-by: ccipherx --- registries/sumTokens/data1.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/registries/sumTokens/data1.js b/registries/sumTokens/data1.js index 61f874b99b1..ade1ab2b8e5 100644 --- a/registries/sumTokens/data1.js +++ b/registries/sumTokens/data1.js @@ -734,9 +734,14 @@ module.exports = { "solana": { "tokenAccounts": ["5vRGRcwN4iYaiQdso1vgWbTDFYbS8GQNUDRMMKE2ycZS"] } }, megapump: { - megaeth: { owner: '0xB6bC3988d62D2979b3ab7AABCcf3c9443f7dAbc4', // MegaPump, UUPS proxy: holds the ETH of every active bonding curve - token: ADDRESSES.null, }, - methodology: "Value of eth on the contract", + // MegaPump v3: a bonding curve is quoted in ETH, USDm or MEGA (chosen at creation). The factory + // (UUPS proxy) holds the quote of every active curve; it moves to the DEX pool at graduation, + // where megapump-dex (registries/uniswapV2.js) counts it. + methodology: "Value of the ETH, USDm and MEGA held by the MegaPump factory: the quote currency of every active bonding curve, plus fees not yet claimed or withdrawn.", + megaeth: { + owner: '0xB6bC3988d62D2979b3ab7AABCcf3c9443f7dAbc4', + tokens: [ADDRESSES.null, ADDRESSES.megaeth.USDm, ADDRESSES.megaeth.MEGA], + }, }, "n1-exchange-bridge": { "methodology": "Counts the USDC held in the N1 Exchange bridge custody wallet on Solana.", From b6b47304779db1208313fcf475fab302999e9cc2 Mon Sep 17 00:00:00 2001 From: Nullmask Date: Mon, 26 Oct 2026 14:08:01 +0400 Subject: [PATCH 438/988] Nullmask: add Solana (#21847) --- registries/sumTokens.js | 13 +++++++++++++ registries/treasury.js | 1 + 2 files changed, 14 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 8a8a64313e1..6ba65656a64 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -20769,6 +20769,19 @@ const configs = { base: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null, ADDRESSES.base.USDC] }, bsc: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT] }, robinhood: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null] }, + solana: { + solOwners: ['xVm2WXtsMh1h41HKgAS2Dymf5ex1GggWbqUeefXUsJg'], // SOL vault of the Nullmask program (Ee6we6Bnbok55FzHfa8fU8td7NDwbKa1qgLehP4iH1Uj) + tokenAccounts: [ // coin vaults (CoinAdded events) + 'J4bbJ55i4fJdJW7cFkscdZCmjUyBiuEB6S2ShtxBdAtw', // USDC + '9pVrF5ZsgGUrn9daeER9z7nuL5oKP2wc9D6yQD2LMhDh', // USDT + 'G7C4Lj4Czq1PNdDJxUMJ1tzDSyHfwSgjZmb5YVWzi6RR', // ETH (Wormhole) + 'FE8eTQNYqmBZNbphrGGmGCFeKHQywJXfGMMyhGXKvAAs', // CATE + '8rxkTsT3GUwfs4hsAff3gFXkriVi7DKyJmdQmdNrd4Xp', // STONK + 'Gu3P5k38yNuTwveBMAbAUwv3j4WgkLvAYY4VmWu3FrRb', // ANSEM + 'GX2ZF54gADs5AwvXACmqnkES5rVjUKhk3BLfAkJedvYf', // HcRLc9VDgjLeK154xDawfb1dmVJ98DoSqcwTHGqiDeJR + 'aNLM273xCFiKRY7YQRtNagLmc2MrhateUTgqYvuQHVS', // Dz9mQ9NzkBcCsuGPFJ3r1bS4wgqKMHBPiVuniW8Mbonk + ], + }, }, "numbers": { "misrepresentedTokens": true, diff --git a/registries/treasury.js b/registries/treasury.js index 59f26f1e9e4..ea9bcc004ca 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -4143,6 +4143,7 @@ const configs = { owners: [ 'GRbpmTbmDeGn8BXHXb1jfEeUT6sGAt7Da44YpWxCS8nr', // ops wallet 'FrXTvkebakR2oNctgsHz1yeijmu9wTZifL3FmffJP5xJ', // team wallet + '2Xkx9CgdeTiHNZ9Fb5nmjQsGK6TbbJkenVZnvrKC8x1w', // Solana pool treasury, receives swept protocol fees ], ownTokens: ['HuAXPyDWDaMYFKuwQHpqL1oPnj93zdzWmtvFGzCeCUa7'], // MASK }, From 8df97d14dfe5f152322f0c695b2a8bbf8f27296b Mon Sep 17 00:00:00 2001 From: Ravenhood Date: Mon, 26 Oct 2026 11:39:29 +0100 Subject: [PATCH 439/988] Flock Manager: add GigaDex vaults (Robinhood Chain) (#21848) Co-authored-by: dev256lag Co-authored-by: ccipherx --- projects/flock-manager/index.js | 54 +++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/projects/flock-manager/index.js b/projects/flock-manager/index.js index 2d106ec7604..3681e16caae 100644 --- a/projects/flock-manager/index.js +++ b/projects/flock-manager/index.js @@ -1,9 +1,11 @@ const { sumTokens2 } = require('../helper/unwrapLPs') -// Flock Manager on Robinhood Chain: auto-compounding gauge LP vaults, plus a -// Tarot-core lending layer that takes those vault shares as collateral. +// Flock Manager on Robinhood Chain: auto-compounding LP vaults, plus a +// Tarot-core lending layer that takes those vault shares as collateral. The +// vaults come from two factories: UPDEX vaults stake in the DEX gauge, and +// GigaDex vaults stake Giga Classic LP in Giga's ClassicChef. // -// Value flows LP -> vault (staked in the DEX gauge) -> vault shares -> +// Value flows LP -> vault (staked in the gauge or chef) -> vault shares -> // collateral -> borrow from the borrowables. Counting both the vault LP and // the collateral would count the same assets twice, because the collateral // contract holds nothing but the vault share wrapper. So TVL is: @@ -19,6 +21,9 @@ const { sumTokens2 } = require('../helper/unwrapLPs') // already inside the borrowable figures above. const LEND_FACTORY = '0x8F50BCb1f34D22adAe05955E1994b0153603cB16' const VAULT_FACTORY = '0x4c2302416bf50B4F11dDEE7A8feA2D1BA96d8EfE' +// Deployed 2026-10-24 at block 96985642, after the adapter's start date. +const GIGA_VAULT_FACTORY = '0x1955e758aDb00a75Bc1A471082254d13Ab8D1347' +const GIGA_VAULT_FACTORY_START = 1792868400 // 2026-10-24 19:00 UTC, just after the deploy block const RVH = '0x96765066f6a040a21EB027167D2315B707c82633' const abi = { @@ -29,6 +34,9 @@ const abi = { getLendingPool: 'function getLendingPool(address) view returns (bool initialized, uint24 lendingPoolId, address collateral, address borrowable0, address borrowable1)', underlying: 'address:underlying', gauge: 'address:gauge', + chef: 'address:chef', + pid: 'uint256:pid', + userInfo: 'function userInfo(uint256 pid, address user) view returns (uint256 amount, uint256 rewardDebt)', token0: 'address:token0', token1: 'address:token1', totalBorrows: 'function totalBorrows() view returns (uint112)', @@ -50,9 +58,11 @@ async function getBorrowables(api) { return borrowables } -// The vaults stake their LP in the DEX gauge, so the LP is not held by the -// vault address. Read each vault's gauge balance, then let resolveLP unwrap it. -async function addVaultLp(api, isPool2) { +// The vaults stake their LP, so it is not held by the vault address. UPDEX +// vaults hold it in the DEX gauge (read as the vault's gauge balance), GigaDex +// vaults in Giga's ClassicChef (read as the chef's userInfo for the vault's +// pid). resolveLP then unwraps the LP into its two tokens. +async function getUpdexStaked(api) { const vaults = await api.fetchList({ lengthAbi: abi.allVaultsLength, itemAbi: abi.allVaults, @@ -60,12 +70,37 @@ async function addVaultLp(api, isPool2) { }) const lps = await api.multiCall({ abi: abi.underlying, calls: vaults }) const gauges = await api.multiCall({ abi: abi.gauge, calls: vaults }) - const token0s = await api.multiCall({ abi: abi.token0, calls: lps }) - const token1s = await api.multiCall({ abi: abi.token1, calls: lps }) const staked = await api.multiCall({ abi: 'erc20:balanceOf', calls: vaults.map((vault, i) => ({ target: gauges[i], params: vault })), }) + return { lps, staked } +} + +async function getGigaStaked(api) { + if (api.timestamp < GIGA_VAULT_FACTORY_START) return { lps: [], staked: [] } + const vaults = await api.fetchList({ + lengthAbi: abi.allVaultsLength, + itemAbi: abi.allVaults, + target: GIGA_VAULT_FACTORY, + }) + const lps = await api.multiCall({ abi: abi.underlying, calls: vaults }) + const chefs = await api.multiCall({ abi: abi.chef, calls: vaults }) + const pids = await api.multiCall({ abi: abi.pid, calls: vaults }) + const infos = await api.multiCall({ + abi: abi.userInfo, + calls: vaults.map((vault, i) => ({ target: chefs[i], params: [pids[i], vault] })), + }) + return { lps, staked: infos.map((info) => info.amount) } +} + +async function addVaultLp(api, isPool2) { + const updex = await getUpdexStaked(api) + const giga = await getGigaStaked(api) + const lps = [...updex.lps, ...giga.lps] + const staked = [...updex.staked, ...giga.staked] + const token0s = await api.multiCall({ abi: abi.token0, calls: lps }) + const token1s = await api.multiCall({ abi: abi.token1, calls: lps }) const isRvh = (token) => token.toLowerCase() === RVH.toLowerCase() lps.forEach((lp, i) => { @@ -98,13 +133,12 @@ async function borrowed(api) { } module.exports = { - timetravel: true, doublecounted: true, // Both factories went live on 2026-10-01 (blocks 77687484 and 77687985) and // the first market followed at 77688034. Starting on the 2nd rather than // the 1st so no historical query lands on a block where the factories have // no code yet, which would revert rather than report zero. start: '2026-10-02', - methodology: 'TVL is the up-v2 LP staked by the Flock Manager auto-compounding vaults, read from each vault\'s gauge balance and unwrapped into its underlying tokens, plus the idle underlying held by each Flock Lend borrowable. Vault LP paired with RVH, the protocol\'s token, is reported as pool2. Collateral contracts are not counted because they hold only vault shares, a wrapper around LP already counted. The LP is also counted by the up-v2 listing, so the protocol is marked as double counted. Borrowed is the outstanding debt of each borrowable and is reported separately, not included in TVL.', + methodology: 'TVL is the LP staked by the Flock Manager auto-compounding vaults, unwrapped into its underlying tokens, plus the idle underlying held by each Flock Lend borrowable. UPDEX (up-v2) vaults are read from each vault\'s gauge balance and GigaDex vaults from Giga\'s ClassicChef userInfo. Vault LP paired with RVH, the protocol\'s token, is reported as pool2. Collateral contracts are not counted because they hold only vault shares, a wrapper around LP already counted. The LP is also counted by the DEX listings, so the protocol is marked as double counted. Borrowed is the outstanding debt of each borrowable and is reported separately, not included in TVL.', robinhood: { tvl, pool2, borrowed }, } From f9060cf90e0f0540fe6c7f42570ee4147b53f43c Mon Sep 17 00:00:00 2001 From: webmass <9001716+webmass@users.noreply.github.com> Date: Mon, 26 Oct 2026 14:51:18 +0400 Subject: [PATCH 440/988] monolith-market: add factory v2 (#21812) --- projects/monolith-market/index.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/projects/monolith-market/index.js b/projects/monolith-market/index.js index 2581106afda..11aac2e74dc 100644 --- a/projects/monolith-market/index.js +++ b/projects/monolith-market/index.js @@ -1,17 +1,21 @@ const { getLogs2 } = require("../helper/cache/getLogs"); const ADDRESSES = require("../helper/coreAssets.json"); -const FACTORY = { - ethereum: { factory: '0x6D961c9DCF1AD73566822BA4B087892e3839B849', fromBlock: 24949282 }, +const FACTORIES = { + ethereum: { + factoryV1: { factory: '0x6D961c9DCF1AD73566822BA4B087892e3839B849', fromBlock: 24949282 }, + factory: { factory: '0xc68F3e777f28c52FF9DB0276a14F59D96Aa2f931', fromBlock: 26077148 }, + }, } const CREATE_DEPLOYMENT_EVENT = 'event Deployed(address indexed lender, address indexed coin, address indexed vault)'; async function tvl(api) { - const { factory, fromBlock } = FACTORY[api.chain] - const logs = await getLogs2({ api, factory, fromBlock, eventAbi: CREATE_DEPLOYMENT_EVENT }) - const lenders = logs.map(l => l.lender) + const logs = await Promise.all(Object.values(FACTORIES[api.chain]).map(({ factory, fromBlock }) => + getLogs2({ api, factory, fromBlock, eventAbi: CREATE_DEPLOYMENT_EVENT }) + )) + const lenders = logs.flat().map(l => l.lender) const [collaterals, psmVaults] = await Promise.all([ api.multiCall({ abi: 'address:collateral', calls: lenders }), From 5043c101c40fd095a07cfde88a34f3f498c3c1cd Mon Sep 17 00:00:00 2001 From: Curb-Dev <343196118+Curb-Dev@users.noreply.github.com> Date: Mon, 26 Oct 2026 13:51:42 +0300 Subject: [PATCH 441/988] Add CURB TVL adapter (Base launchpad) (#21811) --- projects/curb/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/curb/index.js diff --git a/projects/curb/index.js b/projects/curb/index.js new file mode 100644 index 00000000000..85c20807ec2 --- /dev/null +++ b/projects/curb/index.js @@ -0,0 +1,30 @@ +// CURB - token launchpad on Base, live since 2026-10-16. https://curbfun.xyz , docs https://curbfun.xyz/docs.html , +// source https://github.com/Curb-Dev/curb (verified on Sourcify). +// Every launch trades on its own bonding curve against one paired asset (WETH, USDC, cbBTC, VIRTUAL, AERO, +// tokenized stocks, ...). At its threshold the curve hands its whole reserve to a Uniswap v4 pool that carries +// CURB's FeeHook, and that LP is locked forever. Pool liquidity is Uniswap v4 TVL and is not counted here. + +// Lists every launch, oldest first, append-only. +const LAUNCH_REGISTRY = '0x86e9a01F3959A96469051AE1a73D5C09b0BaC110' + +// The registry's write-once record of a launch. At registration the registry checks that the curve's own token() +// and pairToken() match this record. +const LAUNCH_OF = + 'function launchOf(address launchToken) view returns ((address curve, address quoteToken, address beneficiary, address refundTo, uint256 reservedZero, uint24 fee, int24 tickSpacing, address hooks, uint16 totalTaxBps, uint16 platformBps, address platformRecipient, uint64 launchedAt))' + +async function tvl(api) { + const launchTokens = await api.fetchList({ target: LAUNCH_REGISTRY, lengthAbi: 'launchCount', itemAbi: 'launchAt' }) + const launches = await api.multiCall({ target: LAUNCH_REGISTRY, abi: LAUNCH_OF, calls: launchTokens }) + // realQuoteReserve() is the paired asset the curve holds for trading. It leaves out the trading fees not yet swept + // to the platform and the creator, anything sent to the curve directly, and the curve's virtual reserve. + // It is 0 once the launch has graduated. + const reserves = await api.multiCall({ abi: 'uint256:realQuoteReserve', calls: launches.map((launch) => launch.curve) }) + api.add(launches.map((launch) => launch.quoteToken), reserves) +} + +module.exports = { + methodology: + "TVL is the paired asset (WETH, USDC, cbBTC, tokenized stocks and the other assets CURB supports) held by CURB's bonding curves for trading. Launches are enumerated on-chain from the LaunchRegistry (launchCount, launchAt, launchOf), and each curve's realQuoteReserve() is summed. That reserve leaves out trading fees not yet swept to the platform and creators, tokens sent to a curve directly, and the curve's virtual reserve. Unsold launch tokens held by the curves are not counted. When a launch graduates, its reserve moves into a Uniswap v4 pool whose liquidity is locked forever. That liquidity is counted by Uniswap v4, not here, and a graduated curve reports 0.", + start: '2026-10-17', // first full day: the LaunchRegistry was deployed on 2026-10-16 at 01:38 UTC (block 52662669) + base: { tvl }, +} From ea3b2249182c6f12543af8fffce74915c8d07362 Mon Sep 17 00:00:00 2001 From: JordyDutch Date: Mon, 26 Oct 2026 11:52:01 +0100 Subject: [PATCH 442/988] Clarify Stakingverse TVL methodology for Ethereum and LUKSO (#21810) --- projects/stakingverse/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stakingverse/index.js b/projects/stakingverse/index.js index 055da7e0a05..271a8e1ad29 100644 --- a/projects/stakingverse/index.js +++ b/projects/stakingverse/index.js @@ -39,7 +39,7 @@ async function ethereumTvl(api) { } module.exports = { - methodology: 'Total Value Locked (TVL) consists of LYX tokens staked in the Stakingverse liquid staking protocol.', + methodology: 'Total Value Locked (TVL) is calculated using totalAssets() for the Stakingverse staking contract on LUKSO (native LYX) and the Stakingverse StakeWise V3 vault on Ethereum (native ETH).', start: 1975213, // Deployment block of staking protocol hallmarks: [ ['2024-12-29', "Deployment of sLYX liquid staking token (block 4084835)"] From 2ec2271242b1959c1ba6d790bb17f8954a228928 Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Mon, 26 Oct 2026 11:55:20 +0100 Subject: [PATCH 443/988] silo-v3: add Injective market (#21806) Co-authored-by: ccipherx --- projects/silo-v3/index.js | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/projects/silo-v3/index.js b/projects/silo-v3/index.js index 13c977880ef..6fec434ecf8 100644 --- a/projects/silo-v3/index.js +++ b/projects/silo-v3/index.js @@ -50,10 +50,20 @@ const configV3 = { }, ], }, + injective: { + factories: [ + { + // public injective rpcs are pruned and return no logs for old blocks, so silos are read from the factory ids instead + START_BLOCK: 155660036, + SILO_FACTORY: '0x39021662ef7679845e6851e38e01912f556a861f', + useSiloIds: true, + }, + ], + }, } const methodology = [ - 'Silo V3 addresses are retrieved from SiloFactory NewSilo() events.', + 'Silo V3 addresses are retrieved from SiloFactory NewSilo() events (on Injective, from SiloFactory idToSiloConfig()).', 'TVL is calculated as the balance of underlying assets across all deployed silos.', 'It excludes borrowed assets and is equal to the sum of current liquidity and protected deposits.', 'The total borrowed amount across all deployed silos, including accrued interest, obtained via the getDebtAssets() function' @@ -63,12 +73,26 @@ const getAssetAbi = 'address:asset' const getDebtAssetsAbi = 'function getDebtAssets() external view returns (uint256 totalDebtAssets)' const newSiloEvent = 'event NewSilo(address indexed implementation, address indexed token0, address indexed token1, address silo0, address silo1, address siloConfig)' +// SiloFactory ids start at 3001, idToSiloConfig keeps every deployed market +async function getSilosFromIds(api, factory) { + const nextId = await api.call({ target: factory, abi: 'uint256:getNextSiloId' }) + const ids = Array.from({ length: Number(nextId) - 3001 }, (_, i) => 3001 + i) + const configs = await api.multiCall({ target: factory, abi: 'function idToSiloConfig(uint256) view returns (address)', calls: ids }) + const silos = await api.multiCall({ abi: 'function getSilos() view returns (address silo0, address silo1)', calls: configs }) + return silos.flatMap(i => [i.silo0, i.silo1]) +} + async function getSilos(api) { let siloAddresses = [] if (!configV3[api.chain]) return siloAddresses for (const factory of configV3[api.chain].factories) { - const { SILO_FACTORY, START_BLOCK } = factory + const { SILO_FACTORY, START_BLOCK, useSiloIds } = factory + if (useSiloIds) { + if (api.block && api.block < START_BLOCK) continue + siloAddresses.push(...await getSilosFromIds(api, SILO_FACTORY)) + continue + } const logChunk = await getLogs2({ api, @@ -122,4 +146,5 @@ module.exports = { sonic: { tvl, borrowed }, xdc: { tvl, borrowed }, megaeth: { tvl, borrowed }, + injective: { tvl, borrowed }, } From 7fef276451df844f0e75f90b62e4784f1374fe6b Mon Sep 17 00:00:00 2001 From: Dani Date: Mon, 26 Oct 2026 11:55:59 +0100 Subject: [PATCH 444/988] wstdiem: add vault to erc4626 registry (#21853) Co-authored-by: Liquid Protocol --- registries/erc4626.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/registries/erc4626.js b/registries/erc4626.js index 14041a32c47..136d4c9d0b7 100644 --- a/registries/erc4626.js +++ b/registries/erc4626.js @@ -529,6 +529,12 @@ const configs = { methodology: 'Counts LP assets reported by totalAssets() in the Ace.Pro V5 shared HYPE and USDC liquidity vaults on HyperEVM. Excludes round escrow, claimable payouts and protocol revenue held for the team and treasury, Lucky Draw prize pools and legacy vaults.', hyperliquid: ['0xd39C426bd1a40b5cdB89B8CEb8464C4f78AbB29d', '0xf725Ac947c7B3EF790a3E68e2Ca2Fb48ce4023eD'], }, + 'wstdiem': { + start: '2026-06-11', + doublecounted: true, + methodology: 'Counts DIEM in the wstDIEM vault via totalAssets(): idle DIEM plus DIEM the vault has staked on Venice or is unstaking, minus DIEM owed to queued redemptions.', + base: ['0xe49FA849cB37b0e7A42B2335e333fb99474167ba'], + }, } module.exports = buildProtocolExports(configs, erc4626ExportFn) From 029731e6fb228c90167ab9cdadb51c7536f97618 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 26 Oct 2026 09:09:45 -0400 Subject: [PATCH 445/988] blacklist spiked tokens in uniswap v4 (#21856) --- projects/uniswap-v4/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/uniswap-v4/index.js b/projects/uniswap-v4/index.js index 2578dcec329..e3b646b9cf2 100644 --- a/projects/uniswap-v4/index.js +++ b/projects/uniswap-v4/index.js @@ -39,7 +39,8 @@ const config = { '0x44f161ae29361e332dea039dfa2f404e0bc5b5cc', // H hacked 2026-06-08 '0xac531eb26ca1d21b85126de8fb87e80e09002dcf', // fake SAND mispriced on BSC (~$5.6B phantom TVL) '0xbe8d9ec5d3c9313e4af08d50b6f85af76a69a1f1', // USDB mispriced, same coingecko asset blacklisted on arc - + '0xf8f331dfa811132c43c308757cd802ca982b7211', // MCH: 4.2e22 supply, priced at $0.0000677 (~$508 quadrillion phantom TVL) + '0xef6d459fe81c3ed53d292c936b2df5a8084975de', // crUSDT: dead Cream market, 0 cash, exchangeRate inflated by interest on bad debt (~$279M phantom TVL) ] }, unichain: { factory: "0x1F98400000000000000000000000000000000004", fromBlock: 1, useIndexerSql: true }, monad: { factory: "0x188d586ddcf52439676ca21a244753fa19f9ea8e", fromBlock: 29255895, useIndexerSql: true }, From 7efa86b709622a23490287a13caf0fb5fb4c7263 Mon Sep 17 00:00:00 2001 From: Ruru_arcade <107026146+Nuel-osas@users.noreply.github.com> Date: Mon, 26 Oct 2026 14:50:00 +0100 Subject: [PATCH 446/988] Add Setsuna (Monad yield aggregator) (#21816) Co-authored-by: FelixBruguera --- registries/erc4626.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/registries/erc4626.js b/registries/erc4626.js index 136d4c9d0b7..4af89007931 100644 --- a/registries/erc4626.js +++ b/registries/erc4626.js @@ -467,6 +467,15 @@ const configs = { doublecounted: true, base: ["0x9C2dCDbDB3F0A0F628D1112bBCABD9AE75353df3"] }, + 'setsuna': { + methodology: 'TVL is the totalAssets() of the setsUSDC and setsMON vaults: assets supplied to the underlying lending markets plus idle cash held for withdrawals. Those assets are also counted by the lending markets themselves, so the protocol is marked double counted.', + doublecounted: true, + start: '2026-10-11', + monad: [ + '0x0a531817EEFB7b1FFD7c511c0817F58ac343CC67', // setsUSDC + '0x408A8C85a3e15446885ADCc954575e7a918dFd33', // setsMON (WMON) + ], + }, 'fija-finance': { start: '2023-10-02', doublecounted: true, From 1e923dc4a9b293be7739adb0062079567592a22f Mon Sep 17 00:00:00 2001 From: Hein Dauven Date: Mon, 26 Oct 2026 15:34:46 +0100 Subject: [PATCH 447/988] Add Sozu liquid staking TVL on Dusk (#21827) --- projects/helper/chains.json | 1 + projects/sozu/index.js | 40 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 projects/sozu/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 7d117322a79..163d7cf37c2 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -144,6 +144,7 @@ "dscs", "duckchain", "dungeon", + "dusk", "dydx", "dymension", "echelon", diff --git a/projects/sozu/index.js b/projects/sozu/index.js new file mode 100644 index 00000000000..d6aceb35337 --- /dev/null +++ b/projects/sozu/index.js @@ -0,0 +1,40 @@ +const { post } = require('../helper/http') + +// Sozu: liquid staking on Dusk (https://sozu.fi). Users deposit DUSK into the pool contract and receive stDUSK; the +// pool stakes the DUSK through provisioners owned by its relayer contract +// (1cc415d05b1cfbf2583bf2e8a0e39b2c768d263ef92d6a21a4787f76c6afa924). The pool values stDUSK at +// (active stake + DUSK waiting in the pool) / stDUSK supply, and TVL is that same backing. +const NODE = 'https://nodes.dusk.network' +const POOL = '6fdfdc713a18fc6ca2ad20eb2b4a3305a935ef47d6a872d9a4df8bc9fd9d169e' +const SUBSTRATE = 'bc6f50f7404d098cdd1117b15dddab6f6f3dad01c5ce3c5ce9b68a8b60bc4c1d' // the pool's stake accounting +const TRANSFER = '0100000000000000000000000000000000000000000000000000000000000000' // Dusk's genesis transfer contract +const LUX_PER_DUSK = 1e9 + +/** + * Calls a contract query on the Dusk node and reads the result as a u64. + * Queries take and return rkyv bytes; both calls here return a little-endian u64. + */ +async function queryU64(contract, fn, args = Buffer.alloc(0)) { + const data = await post(`${NODE}/on/contracts:${contract}/${fn}`, args, { + responseType: 'arraybuffer', + headers: { 'content-type': 'application/octet-stream' }, + }) + const bytes = Buffer.from(data) + if (bytes.length !== 8) throw new Error(`sozu: ${fn} returned ${bytes.length} bytes, expected a u64`) + return bytes.readBigUInt64LE() +} + +/** + * DUSK backing stDUSK: the pool's active stake plus the DUSK it holds that isn't staked yet. + */ +async function tvl(api) { + const staked = await queryU64(SUBSTRATE, 'active_stake') + const pending = await queryU64(TRANSFER, 'contract_balance', Buffer.from(POOL, 'hex')) + api.addCGToken('dusk-network', Number(staked + pending) / LUX_PER_DUSK) +} + +module.exports = { + timetravel: false, + methodology: 'DUSK backing stDUSK: the stake held by provisioners the Sozu pool controls (active_stake on its substrate contract) plus DUSK deposited in the pool contract and not yet staked.', + dusk: { tvl }, +} From 594c8957b5da383ebdb40dc00dec243d3e5ae7e8 Mon Sep 17 00:00:00 2001 From: CI-DEV <154627941+IlumCI@users.noreply.github.com> Date: Mon, 26 Oct 2026 17:29:03 +0200 Subject: [PATCH 448/988] Add DoublePlus TVL adapter (Robinhood Chain) (#21837) --- projects/doubleplus/index.js | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 projects/doubleplus/index.js diff --git a/projects/doubleplus/index.js b/projects/doubleplus/index.js new file mode 100644 index 00000000000..67bfae69743 --- /dev/null +++ b/projects/doubleplus/index.js @@ -0,0 +1,52 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { addUniV4PoolReserves, chainConfig } = require('../helper/uniswapV4') + +// DoublePlus (https://doubleplus.fun): a coin launchpad on Robinhood Chain. +// +// Before a coin graduates, its bonding-curve raise is escrowed in the factory as native ETH (together with fees +// owed to creators and the protocol). When the curve fills, the factory opens a Uniswap v4 pool for the coin +// against its pair token (WETH) with the DoublePlus hook and seeds it with the raise and the unsold supply in the +// same transaction. That liquidity is owned by the factory and has no withdrawal path. +// +// Pools are found from the factory itself, not from logs: allTokens() lists every coin, and listings(token) +// returns the pair token and the v4 pool id (zero until graduation). Every pool uses tick spacing 60, so the pool +// key needed to rebuild reserves from StateView is known without reading the PoolManager's Initialize logs. +// Only the pair-token side of each pool is counted; the launched coins themselves are not. +const FACTORY = '0x60e0DD86327F1dA36565c79aAe9f87070415963b' +const TICK_SPACING = 60 + +const listingsAbi = 'function listings(address token) view returns (address creator, address pair, uint16 taxBps, uint64 createdAt, bytes32 poolId)' + +async function tvl(api) { + // curve escrow and fees owed, held by the factory + await sumTokens2({ api, owner: FACTORY, tokens: [ADDRESSES.null, ADDRESSES.robinhood.WETH] }) + + // graduated coins: the pair-token side of their Uniswap v4 pools + const tokens = await api.fetchList({ lengthAbi: 'uint256:totalTokens', itemAbi: 'function allTokens(uint256) view returns (address)', target: FACTORY }) + const listings = await api.multiCall({ abi: listingsAbi, target: FACTORY, calls: tokens }) + const pools = [] + const pairs = new Set() + listings.forEach((l, i) => { + if (/^0x0+$/.test(l.poolId)) return + const token = tokens[i].toLowerCase() + const pair = l.pair.toLowerCase() + const [token0, token1] = token < pair ? [token, pair] : [pair, token] + pools.push({ id: l.poolId, token0, token1, spacing: TICK_SPACING }) + pairs.add(pair) + }) + if (!pools.length) return + + const pairOnly = { + multiCall: (...args) => api.multiCall(...args), + add: (token, amount) => { if (pairs.has(token.toLowerCase())) api.add(token, amount) }, + } + await addUniV4PoolReserves({ api: pairOnly, pools, stateView: chainConfig.robinhood.stateView }) +} + +module.exports = { + doublecounted: true, // graduated pools live in the Uniswap v4 PoolManager, so Uniswap v4 TVL counts them too + methodology: 'Counts the native ETH held by the DoublePlus factory, which escrows bonding-curve raises before a coin graduates (plus fees owed), and the WETH side of every Uniswap v4 pool a graduated coin was given. Pools are listed from the factory (allTokens and listings), and their reserves are rebuilt on chain from tick liquidity and the current price via StateView. Pool liquidity is owned by the factory and cannot be withdrawn. Launched coins are not counted.', + start: '2026-10-22', + robinhood: { tvl }, +} From d63f3fc3c771d21748c10fefa133e3fb64082e5a Mon Sep 17 00:00:00 2001 From: Vladyslav Korniienko Date: Mon, 26 Oct 2026 17:33:31 +0200 Subject: [PATCH 449/988] Alula: add the new main market (#21838) --- projects/alula/index.js | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/projects/alula/index.js b/projects/alula/index.js index 92622a24b72..18600cca529 100644 --- a/projects/alula/index.js +++ b/projects/alula/index.js @@ -2,44 +2,52 @@ const { callSoroban } = require('../helper/chain/stellar') const methodologies = require('../helper/methodologies') // Alula — institutional-grade RWA lending protocol on Stellar/Soroban. -// Mainnet Market contract (see the protocol's published deployments). -const MARKET = 'CBP76I2FRMUKYKIYYBKN3DH7TSWMFAJF2WTDC7Q2OHQFBIVWP7CAAI5Q' +// Mainnet Market contracts: the current main market and the deprecated one, which still +// holds positions until its users withdraw (see the protocol's published deployments). +const MARKETS = [ + 'CCA56KMCEEAK2SGMHNU7TYJUO7GP5KSDTTFB6ZS2NQY7VQ3SKWLMTEB4', + 'CBP76I2FRMUKYKIYYBKN3DH7TSWMFAJF2WTDC7Q2OHQFBIVWP7CAAI5Q', +] // [{ token, total_borrowed }] for every pool currently registered in the market. // Discovered fresh on every call so newly added pools are always included and a // transient RPC failure simply propagates and retries on the next collection. // get_all_pools() -> Vec
; get_pool(pool) -> Pool { token_address, total_borrowed, ... } -async function getPools() { +async function getPools(market) { const out = [] - for (const pool of await callSoroban(MARKET, 'get_all_pools')) { - const { token_address, total_borrowed } = await callSoroban(MARKET, 'get_pool', [pool]) + for (const pool of await callSoroban(market, 'get_all_pools')) { + const { token_address, total_borrowed } = await callSoroban(market, 'get_pool', [pool]) out.push({ token: token_address, total_borrowed }) } return out } -// tvl: underlying tokens actually held by the market contract (available liquidity + +// tvl: underlying tokens actually held by each market contract (available liquidity + // plain collateral). Borrowed tokens have left the contract, so reading the on-chain // balance avoids double-counting Earn/Multiply receipt positions. async function tvl(api) { - const seen = new Set() - for (const { token } of await getPools()) { - if (seen.has(token)) continue // one pool per token; dedupe defensively - seen.add(token) - api.add(token, (await callSoroban(token, 'balance', [MARKET])).toString()) + for (const market of MARKETS) { + const seen = new Set() + for (const { token } of await getPools(market)) { + if (seen.has(token)) continue // one pool per token; dedupe defensively + seen.add(token) + api.add(token, (await callSoroban(token, 'balance', [market])).toString()) + } } } // borrowed: outstanding debt per pool. total_borrowed is already denominated in // underlying token units (raw i128), so no share-rate conversion is needed. async function borrowed(api) { - for (const { token, total_borrowed } of await getPools()) { - api.add(token, total_borrowed.toString()) + for (const market of MARKETS) { + for (const { token, total_borrowed } of await getPools(market)) { + api.add(token, total_borrowed.toString()) + } } } module.exports = { timetravel: false, - methodology: `${methodologies.lendingMarket}. TVL is the underlying token balances held by the Alula market contract across all pools; borrowed is each pool's outstanding debt (total_borrowed).`, + methodology: `${methodologies.lendingMarket}. TVL is the underlying token balances held by the Alula market contracts across all pools; borrowed is each pool's outstanding debt (total_borrowed).`, stellar: { tvl, borrowed }, } From 9db3e68e8a2ac99f2cbc97fce45e79570bcbbe94 Mon Sep 17 00:00:00 2001 From: AvaLoveApp Date: Mon, 26 Oct 2026 21:17:00 +0300 Subject: [PATCH 450/988] el-casino, el-perps, el-predict: add V6 casino factories and the V2 markets hubs (#21839) --- projects/el-casino/index.js | 10 +++++++++- projects/el-perps/index.js | 21 ++++++++++++++------- projects/el-predict/index.js | 21 ++++++++++++++------- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/projects/el-casino/index.js b/projects/el-casino/index.js index 4f2ab6a32ca..3d87c1f26cf 100644 --- a/projects/el-casino/index.js +++ b/projects/el-casino/index.js @@ -19,6 +19,14 @@ const FACTORIES = [ '0x10e02DD0F131Cbb55a97fef5b724541B8A6b378C', '0x6751dD9ADBCE7913Fea529FDe5E561422D017725', '0x553220711d5683205a2644a77755Ba6f7E34b31b', '0x25Ac8B77B8e32B1eA9C431127679e4Ff11eC4FA4', '0x7C7ad1370a26E1a7e67A778E9C9820637f76BC1d', '0x796d695569520BE3963CB620A3a3c53b92B606a4', '0x64D84eAcEdEe214995d1b30febD8720131DAEE9f', '0x2935fDb03C2F4f4fb32D29032F46357706519268', '0x6dFF48299Ac1Ff559DcEdDDf28AF3B1e5140c6A4', + // V6 game factories (CasinoHubV6 0x66DF90B6B074f7c49906c2bB0A8E5bf3773879d0 — the launchpad's rooms and every new room) + '0x55190a1B037dD5dA29031A18D18ECf1Ea77f13E3', '0x3f9367C890e814c90d500b0e8723E8aE5dd6B99F', '0xBb175854C08cB7D18217C2F67Aaf235F421D94d3', + '0xa7Ce2300509c68F0Eca46CbdAa7ea83fA01932D3', '0xF330BFcceE1b36338dD7e9556679979Bf75FEAd7', '0xB6BBA1643290632E88eDDE60BF4b9bD6670FcEF9', + '0x08a24d597A748b9BEE85EEcD215c903af7BB231b', '0x3c397832A08Bb0AaDD9DE604B2dB1642BbfE1a7D', '0x83Ba15145eB74bF54c0bEdd1C8D3Be9509a2B600', + '0xa9e48A8774A0e2F577b8C49DF2b12aF7Bdb8B0BF', '0xEA203b5813A145f542feD223533bD97c210A67dC', '0x58fCEe7fedB9a324a3C1570d2644EC4C87Be44E3', + '0x67a98f0A0A73d697c9EcE3F310E28ffc89c491b8', '0xff6f1a93B662e6E6EB73632B3b9ce8fBFA15083e', '0x5c5Df8cc39CAb5790981a6AB4E1C016397973111', + '0x69EeAB0020EbD064AFAA8e35D0E64f6b8a2842b4', '0xa17bF3952C23c19e9B0c3F017eBACa3006216fFd', '0x542bb8E1f9Ed0E0a523910B18843f5da22711D2F', + '0x5bffd94d0AE1d2fC9C78f5909f43dF700552029c', '0xf7EdFECB155E4065C7F8684820B21503098b05B8', ] const getGames = 'function getGames(uint256 offset, uint256 limit) view returns (tuple(address gameAddress, address owner, address creator, address token, string tokenLogoUrl, string betName, uint256 createdAt)[])' const PAGE = 200 @@ -36,7 +44,7 @@ async function tvl(api) { } module.exports = { - methodology: 'Sums the tokens held by every EL-Casino room, listed from the V4 and V5 game factories: each room\'s token pool pays winnings and is funded by stakers ("become the house"). Rooms whose pool is in $ELCAS, the protocol\'s own token, are excluded.', + methodology: 'Sums the tokens held by every EL-Casino room, listed from the V4, V5 and V6 game factories: each room\'s token pool pays winnings and is funded by stakers ("become the house"). Rooms whose pool is in $ELCAS, the protocol\'s own token, are excluded.', start: '2026-09-01', robinhood: { tvl }, } diff --git a/projects/el-perps/index.js b/projects/el-perps/index.js index 65c05a94c83..6421b5673a9 100644 --- a/projects/el-perps/index.js +++ b/projects/el-perps/index.js @@ -2,19 +2,26 @@ // ElcasMarketsHub (source verified on Sourcify) gives every margin token its own book, a minimal clone created with // CREATE2. A book holds, in its margin token: each market's LP vault (the traders' counterparty), the traders' margin, // and fee shares accrued for the platform / market creators but not claimed yet (owedTotal — not user money). -const HUB = '0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45' +// ElcasMarketsHub v1, then the V2 hubs: the launchpad's (books its game reserve opens for launched tokens) and the public one +const HUBS = ['0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45', '0x9DB90Cf484614C3424a49B0cB0b6E5cA7b6a850F', '0xB7eF17054fb9541dd9Bc58E932Af116d11f2fD3f'] const ELCAS = '0xE73f12D9d81ff6b11c1d0261F440c2EA4C400E18' // the protocol's own token: excluded async function tvl(api) { - const tokens = (await api.call({ abi: 'address[]:allPerpsTokens', target: HUB })).filter((t) => t.toLowerCase() !== ELCAS.toLowerCase()) - const owners = await api.multiCall({ abi: 'function perpsBook(address) view returns (address)', target: HUB, calls: tokens }) - const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map((t, i) => ({ target: t, params: [owners[i]] })) }) - const owed = await api.multiCall({ abi: 'uint256:owedTotal', calls: owners }) - tokens.forEach((token, i) => api.add(token, BigInt(bals[i]) - BigInt(owed[i]))) + // (a hub not deployed yet at the block reads as empty) + const lists = await api.multiCall({ abi: 'address[]:allPerpsTokens', calls: HUBS, permitFailure: true }) + for (let h = 0; h < HUBS.length; h++) { + const hub = HUBS[h] + const tokens = (lists[h] ?? []).filter((t) => t.toLowerCase() !== ELCAS.toLowerCase()) + if (!tokens.length) continue + const owners = await api.multiCall({ abi: 'function perpsBook(address) view returns (address)', target: hub, calls: tokens }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map((t, i) => ({ target: t, params: [owners[i]] })) }) + const owed = await api.multiCall({ abi: 'uint256:owedTotal', calls: owners }) + tokens.forEach((token, i) => api.add(token, BigInt(bals[i]) - BigInt(owed[i]))) + } } module.exports = { - methodology: 'Lists every perps book from ElcasMarketsHub (one per margin token) and counts each book\'s balance of its margin token — LP vaults and traders\' margin — minus the fee shares accrued for the platform and market creators but not yet claimed. Books margined in $ELCAS, the protocol\'s own token, are excluded.', + methodology: 'Lists every perps book from the ElcasMarketsHub v1 and V2 hubs (one per hub and margin token) and counts each book\'s balance of its margin token — LP vaults and traders\' margin — minus the fee shares accrued for the platform and market creators but not yet claimed. Books margined in $ELCAS, the protocol\'s own token, are excluded.', start: '2026-10-06', robinhood: { tvl }, } diff --git a/projects/el-predict/index.js b/projects/el-predict/index.js index 43b6070db7f..9860a15ff61 100644 --- a/projects/el-predict/index.js +++ b/projects/el-predict/index.js @@ -2,19 +2,26 @@ // ElcasMarketsHub (source verified on Sourcify) gives every stake token its own book, a minimal clone created with // CREATE2. A book holds, in its stake token: each market's house vault (anyone can LP), players' stakes in open rounds, // unclaimed winnings, and fee shares accrued for the platform / market creators but not claimed yet (owedTotal). -const HUB = '0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45' +// ElcasMarketsHub v1, then the V2 hubs: the launchpad's (books its game reserve opens for launched tokens) and the public one +const HUBS = ['0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45', '0x9DB90Cf484614C3424a49B0cB0b6E5cA7b6a850F', '0xB7eF17054fb9541dd9Bc58E932Af116d11f2fD3f'] const ELCAS = '0xE73f12D9d81ff6b11c1d0261F440c2EA4C400E18' // the protocol's own token: excluded async function tvl(api) { - const tokens = (await api.call({ abi: 'address[]:allPredictTokens', target: HUB })).filter((t) => t.toLowerCase() !== ELCAS.toLowerCase()) - const owners = await api.multiCall({ abi: 'function predictBook(address) view returns (address)', target: HUB, calls: tokens }) - const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map((t, i) => ({ target: t, params: [owners[i]] })) }) - const owed = await api.multiCall({ abi: 'uint256:owedTotal', calls: owners }) - tokens.forEach((token, i) => api.add(token, BigInt(bals[i]) - BigInt(owed[i]))) + // (a hub not deployed yet at the block reads as empty) + const lists = await api.multiCall({ abi: 'address[]:allPredictTokens', calls: HUBS, permitFailure: true }) + for (let h = 0; h < HUBS.length; h++) { + const hub = HUBS[h] + const tokens = (lists[h] ?? []).filter((t) => t.toLowerCase() !== ELCAS.toLowerCase()) + if (!tokens.length) continue + const owners = await api.multiCall({ abi: 'function predictBook(address) view returns (address)', target: hub, calls: tokens }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map((t, i) => ({ target: t, params: [owners[i]] })) }) + const owed = await api.multiCall({ abi: 'uint256:owedTotal', calls: owners }) + tokens.forEach((token, i) => api.add(token, BigInt(bals[i]) - BigInt(owed[i]))) + } } module.exports = { - methodology: 'Lists every prediction book from ElcasMarketsHub (one per stake token) and counts each book\'s balance of its stake token — house vaults, stakes in open rounds and unclaimed winnings — minus the fee shares accrued for the platform and market creators but not yet claimed. Books staked in $ELCAS, the protocol\'s own token, are excluded.', + methodology: 'Lists every prediction book from the ElcasMarketsHub v1 and V2 hubs (one per hub and stake token) and counts each book\'s balance of its stake token — house vaults, stakes in open rounds and unclaimed winnings — minus the fee shares accrued for the platform and market creators but not yet claimed. Books staked in $ELCAS, the protocol\'s own token, are excluded.', start: '2026-10-06', robinhood: { tvl }, } From 94fd909cae363abf6cf7c421c698f271c92887c9 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 26 Oct 2026 18:26:41 +0000 Subject: [PATCH 451/988] retired chains morpho (#21858) --- projects/morpho-blue/config.js | 37 ++++------------------------------ projects/morpho-blue/index.js | 6 +++++- 2 files changed, 9 insertions(+), 34 deletions(-) diff --git a/projects/morpho-blue/config.js b/projects/morpho-blue/config.js index afe5338b032..96f9371a859 100644 --- a/projects/morpho-blue/config.js +++ b/projects/morpho-blue/config.js @@ -12,10 +12,6 @@ const config = { morphoBlue: "0x6c247b1F6182318877311737BaC0844bAa518F5e", fromBlock: 296446593, }, - fraxtal: { - morphoBlue: "0xa6030627d724bA78a59aCf43Be7550b4C5a0653b", - fromBlock: 15317931, - }, ink: { morphoBlue: "0x857f3EefE8cbda3Bc49367C996cd664A880d3042", fromBlock: 4078776, @@ -28,26 +24,10 @@ const config = { morphoBlue: "0x1bF0c2541F820E775182832f06c0B7Fc27A25f67", fromBlock: 66931042, }, - scroll: { - morphoBlue: "0x2d012EdbAdc37eDc2BC62791B666f9193FDF5a55", - fromBlock: 12842868, - }, wc: { morphoBlue: "0xE741BC7c34758b4caE05062794E8Ae24978AF432", fromBlock: 9025669, }, - mode: { - morphoBlue: "0xd85cE6BD68487E0AaFb0858FDE1Cd18c76840564", - fromBlock: 19983370, - }, - corn: { - morphoBlue: "0xc2B1E031540e3F3271C5F3819F0cC7479a8DdD90", - fromBlock: 251401, - }, - hemi: { - morphoBlue: "0xa4Ca2c2e25b97DA19879201bA49422bc6f181f42", - fromBlock: 1188872, - }, sonic: { morphoBlue: "0xd6c916eB7542D0Ad3f18AEd0FCBD50C582cfa95f", fromBlock: 9100931, @@ -91,18 +71,10 @@ const config = { morphoBlue: "0x918B9F2E4B44E20c6423105BB6cCEB71473aD35c", fromBlock: 1308542, }, - zircuit: { - morphoBlue: "0xA902A365Fe10B4a94339B5A2Dc64F60c1486a5c8", - fromBlock: 14640172, - }, abstract: { morphoBlue: "0xc85CE8ffdA27b646D269516B8d0Fa6ec2E958B55", fromBlock: 13947713, }, - btr: { - morphoBlue: "0xaea7eff1bd3c875c18ef50f0387892df181431c6", - fromBlock: 13516997, - }, bsc: { morphoBlue: "0x01b0Bd309AA75547f7a37Ad7B1219A898E67a83a", fromBlock: 54344680, @@ -120,10 +92,6 @@ const config = { fromBlock: 166036723, onlyUseExistingCache: true, }, - btnx: { - morphoBlue: "0x8183d41556Be257fc7aAa4A48396168C8eF2bEAD", - fromBlock: 450759, - }, monad: { morphoBlue: "0xD5D960E8C380B724a48AC59E2DfF1b2CB4a1eAee", fromBlock: 31907457, @@ -194,4 +162,7 @@ const config = { } } -module.exports = { config } +// chains morpho dropped - exported as zero so historical tvl is preserved +const retiredChains = ['fraxtal', 'scroll', 'mode', 'corn', 'hemi', 'zircuit', 'btr', 'btnx'] + +module.exports = { config, retiredChains } diff --git a/projects/morpho-blue/index.js b/projects/morpho-blue/index.js index 2461acf3f97..be157919f26 100644 --- a/projects/morpho-blue/index.js +++ b/projects/morpho-blue/index.js @@ -4,7 +4,7 @@ const { getLogs } = require("../helper/cache/getLogs"); const abi = require("../helper/abis/morpho.json"); const { sumTokens2 } = require("../helper/unwrapLPs"); const { getMorphoVaults } = require("../helper/curators"); -const { config } = require("./config"); +const { config, retiredChains } = require("./config"); const { getExcludedMarketIds, getExcludedAssets, getExcludedVaults } = require("./exclusions"); const eventAbis = { @@ -222,3 +222,7 @@ async function fetchPriceMap(api, addresses) { Object.keys(config).forEach((chain) => { module.exports[chain] = { tvl, borrowed } }) + +retiredChains.forEach((chain) => { + module.exports[chain] = { tvl: () => ({}), borrowed: () => ({}) } +}) From 9067ca24eec0961f8af488a1802ce64116f14c7c Mon Sep 17 00:00:00 2001 From: deepakpraka <131285971+deepakpraka@users.noreply.github.com> Date: Tue, 27 Oct 2026 00:18:22 +0530 Subject: [PATCH 452/988] add vistapex perps TVL adapter (avax) (#21849) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- registries/sumTokens.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 6ba65656a64..d72fe26e5b8 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -29175,6 +29175,16 @@ const configs = { ] }, }, + "vistapex": { + "methodology": "TVL is the USDC held in the Vistapex Perps DepositPool contract on Avalanche, where traders deposit their collateral.", + "start": "2026-10-20", + "avax": { + "owner": "0x4D1bE1E2EdB9d6053d6054Ecf343d232B16f146F", // DepositPool + "tokens": [ + ADDRESSES.avax.USDC + ] + }, + }, "volcano": { "blast": { "tokensAndOwners": [ From 570e07f428c0a0d10fc0c9b37f13efc4391947db Mon Sep 17 00:00:00 2001 From: Thomas <124535458+Thomas-Cabrit@users.noreply.github.com> Date: Tue, 27 Oct 2026 02:59:51 +0800 Subject: [PATCH 453/988] Add Xitcoin (Vault + Market) on Cronos (#21854) Co-authored-by: FelixBruguera --- registries/sumTokens.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index d72fe26e5b8..bca85d701a2 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -29634,6 +29634,28 @@ const configs = { } }, }, + "xitcoin": { + "methodology": "TVL counts the CRO held by the Xitcoin Market (payments for sold positions not yet withdrawn by their sellers). Staking counts the XTC held by the Xitcoin Vault: users' locked positions (including those listed for sale on the Market) and the Vault's XTC reward reserve.", + "start": "2026-10-08", + "cronos": { + "tvl": { + "owners": [ + "0x0ea3df26F143017d4057B69734F9a99446C636FC" + ], + "tokens": [ + ADDRESSES.null + ] + }, + "staking": { + "owners": [ + "0x7396C304bC7Ba6B169F8aC230C9e63Da8B77Fd15" + ], + "tokens": [ + "0xe45fe733bc8617fa6dac8437fc44b5fffa949991" + ] + } + }, + }, "xlsd": { "methodology": "TVL of Staked ETH & LSD tokens in the StakingPool contracts", "arbitrum": { From 3ec55f94c0c39b1a87d71851b44f29b59d321f61 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 26 Oct 2026 22:45:14 +0100 Subject: [PATCH 454/988] track hypercore balance for cexes --- projects/gate-io/index.js | 13 ------------- projects/helper/cex.js | 7 ++++++- projects/helper/chain/hyperliquid.js | 21 ++++++++++++++++++++- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index e2dd897f0b5..3fe079428c7 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -5,7 +5,6 @@ const { mergeExports, getStakedEthTVL } = require("../helper/utils"); const { cosmosStaked, suiStaked, aptosStaked, nearStaked, bittensorStaked, confluxStaked, cardanoStaked, algorandStaked, starknetStaked, aleoStaked, neo3Staked } = require("../helper/stakingHelper"); const { sumTokens2: solanaSumTokens } = require("../helper/solana"); const { unwrapDolomiteDeposits } = require("../helper/unwrapLPs.js"); -const { addHypercoreSpotBalances } = require("../helper/chain/hyperliquid.js"); const { sumTokens: cosmosSumTokens } = require("../helper/chain/cosmos.js"); const { addThetaBalances } = require("../helper/chain/theta.js"); @@ -2110,17 +2109,6 @@ const solanaLsts = { tokens: ['gateMurAxe4YFoUR6J63gXGKtkbTfdkMdLjZrCmThFP'], // gtSOL } -// HyperCore spot balances sit off the EVM, so the hyperliquid entry in `config` -// (a plain EVM balance lookup) never sees them -const hypercoreSpotOwners = [ - '0x0d0707963952f2fba59dd06f2b425ace40b492fe', - '0xe698de9a0c0e592f236a063451f34f0e6c000f55', - '0x02e6f748644aeddcae70e39e70f596de33abf73f', - '0x4517b5e9651577bdd2130807f2e8741311c95bab', - '0xba0c6f04871984eb0503f83eec00f6af76603c51', - '0x7642d3730563fbbad9de74cb6c8f74b7dc9a6af0', -] - // kava's cosmos-side owners, counted by the earn export rather than `config.kava` const kavaCosmosOwners = [ 'kava155svs6sgxe55rnvs6ghprtqu0mh69kehlxmsky', @@ -2240,7 +2228,6 @@ const gateEarnTvl = { starknet: { tvl: earnTvl(api => starknetStaked(api, earnOnlyOwners.starknet)) }, aleo: { tvl: earnTvl(api => aleoStaked(api, earnOnlyOwners.aleo)) }, neo3: { tvl: earnTvl(api => neo3Staked(api, earnOnlyOwners.neo3)) }, - hyperliquid: { tvl: earnTvl(api => addHypercoreSpotBalances({ api, owners: hypercoreSpotOwners })) }, // kava runs a cosmos chain alongside its EVM. sumTokens picks one helper per // chain, so config.kava can only carry the 0x owners - the kava1... ones are // summed here instead and mergeExports adds the two together. diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 6a676684e8c..e459c2e6bf9 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -4,6 +4,7 @@ const { sumTokensExport } = require('../helper/sumTokens') const sdk = require('@defillama/sdk') const { getCEXTokensOnBinanceOnChain } = require('./utils/cex') const { svmChainsSet } = require('./svmChainConfig') +const { addHypercoreBalances } = require('./chain/hyperliquid') const defaultTokens = { ethereum: [ @@ -592,7 +593,11 @@ function cexExports(config) { } const runtimeOptions = { ...options, owners, tokens, permitFailure: true } // while filling historical data, some tokens may not exist on the chain yet, so we permit failure if (chain === 'solana') runtimeOptions.solOwners = owners - return sumTokensExport(runtimeOptions)(api) + await sumTokensExport(runtimeOptions)(api) + // hyperliquid owners hold funds both on HyperEVM (summed above) and on HyperCore + // (spot + perp margin), which no on-chain lookup sees + if (chain === 'hyperliquid') await addHypercoreBalances({ api, owners, blacklistedTokens: options.blacklistedTokens }) + return api.getBalances() } } }) diff --git a/projects/helper/chain/hyperliquid.js b/projects/helper/chain/hyperliquid.js index dd6d606dc26..21c52601ced 100644 --- a/projects/helper/chain/hyperliquid.js +++ b/projects/helper/chain/hyperliquid.js @@ -57,4 +57,23 @@ async function addHypercoreSpotBalances({ api, owners = [], blacklistedTokens = } } -module.exports = { getUserStakingSummary, getHypercoreStakedHype, addHypercoreSpotBalances } +/** + * Add a user's HyperCore perp margin equity (accountValue, USDC-denominated) to the api. + */ +async function addHypercorePerpMargin({ api, owners = [] }) { + for (const user of owners) { + const { marginSummary } = await post(API_URL, { type: 'clearinghouseState', user }) + const accountValue = +(marginSummary?.accountValue ?? 0) + if (accountValue) api.addUSDValue(accountValue) + } +} + +/** + * Add a user's full HyperCore holdings: spot balances plus perp margin equity. + */ +async function addHypercoreBalances({ api, owners = [], blacklistedTokens = [] }) { + await addHypercoreSpotBalances({ api, owners, blacklistedTokens }) + await addHypercorePerpMargin({ api, owners }) +} + +module.exports = { getUserStakingSummary, getHypercoreStakedHype, addHypercoreSpotBalances, addHypercorePerpMargin, addHypercoreBalances } From 2bac8e4059abe7db595469fcc084b7caa9365370 Mon Sep 17 00:00:00 2001 From: kenny-august Date: Tue, 27 Oct 2026 02:40:19 -0500 Subject: [PATCH 455/988] upshift: source Stellar vaults from API (#21862) Co-authored-by: Claude Opus 5.5 --- projects/upshift/index.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/projects/upshift/index.js b/projects/upshift/index.js index 8cfc45c07c2..78062dff1b9 100644 --- a/projects/upshift/index.js +++ b/projects/upshift/index.js @@ -43,14 +43,11 @@ const suiVaultsToInclude = [ "0x30844745c8197fdaf9fe06c4ffeb73fe05c092ce0040674a3758dbfcb032a1f4", ]; -// Stellar (Soroban) vaults — August/Gami tokenized vaults (OZ FungibleVault). -// total_assets() = idle balance + strategy balances + deployed capital; and -// query_asset() returns the underlying token's Soroban contract address, which -// DefiLlama prices directly (the USDC/XLM SACs are already in coreAssets). -const stellarVaultsToInclude = [ - "CCL3WITWFFXIHV2I52ECV5DPIEOFSTU3PBPR53ILPLF2IP5KHECXRUTY", // Gami earnUSDC - "CC6TRAPQD3NK7THUKWPV5SL2JHKQGNXZVB6S6MVYFSLRWAKEFUWZKZ7J", // Gami earnXLM -]; +// Stellar (Soroban) vaults — tokenized vaults (OZ FungibleVault), listed by the +// API under chain -3. total_assets() = idle balance + strategy balances + deployed +// capital; query_asset() returns the underlying token's Soroban contract address, +// which DefiLlama prices directly (the USDC/XLM SACs are already in coreAssets). +const STELLAR_CHAIN_ID = -3; // V1 vault types (ERC4626 compatible) const v1VaultTypes = ['tokenizedVault', 'lendingPool']; @@ -136,7 +133,16 @@ const suiVaultsTvl = async (api) => { } const stellarVaultsTvl = async (api) => { - for (const vault of stellarVaultsToInclude) { + const vaults = await getConfig('upshift/vaults', vaultsApiEndpoint); + // getConfig falls back to the cache on fetch failure, and a cache miss yields {}. + // Throw instead of reporting zero Stellar TVL. + if (!Array.isArray(vaults)) throw new Error('upshift: vault list unavailable'); + const addresses = vaults + .filter(v => v.status === 'active' && v.chain === STELLAR_CHAIN_ID && !v.underlying_vault_address) + .filter(v => !/staging/i.test(v.vault_name ?? '')) + .map(v => v.address); + + for (const vault of addresses) { const asset = await callSoroban(vault, 'query_asset') const totalAssets = await callSoroban(vault, 'total_assets') api.add(asset, totalAssets.toString()) From cb930d237bc6e1620652506c400492aecec598fb Mon Sep 17 00:00:00 2001 From: Michael Tan <108757170+michaelbtan@users.noreply.github.com> Date: Tue, 27 Oct 2026 03:42:04 -0400 Subject: [PATCH 456/988] strato-bridge: add HyperEVM custody (#21861) Co-authored-by: Claude Opus 5.5 --- projects/strato-bridge/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/strato-bridge/index.js b/projects/strato-bridge/index.js index 486c29632f5..a3cbe4ae796 100644 --- a/projects/strato-bridge/index.js +++ b/projects/strato-bridge/index.js @@ -15,6 +15,7 @@ const CHAIN_IDS = { base: 8453, linea: 59144, robinhood: 4663, + hyperliquid: 999, // HyperEVM } // Outbound direction: StratoNativeBridge locks STRATO-native assets in its @@ -57,7 +58,7 @@ async function getTokens(chainId) { module.exports = { methodology: - 'Inbound: assets escrowed in the Mercata bridge custody address on each source chain (Ethereum, Base, Linea, Robinhood Chain), each backing a 1:1 wrapped *ST token minted on STRATO. Custody addresses and the asset list per chain are read from the MercataBridge assets/chains registry on STRATO mainnet (only entries flagged enabled are counted). Outbound: STRATO-native assets (STRATO, USDST, GOLDST, SILVST) locked in the StratoNativeBridge custody vault while represented on other chains; locked $STRATO is priced against the Ethereum STRATO ERC-20 because it has no price feed on the STRATO chain.', + 'Inbound: assets escrowed in the Mercata bridge custody address on each source chain (Ethereum, Base, Linea, Robinhood Chain, HyperEVM), each backing a 1:1 wrapped *ST token minted on STRATO. Custody addresses and the asset list per chain are read from the MercataBridge assets/chains registry on STRATO mainnet (only entries flagged enabled are counted). Outbound: STRATO-native assets (STRATO, USDST, GOLDST, SILVST) locked in the StratoNativeBridge custody vault while represented on other chains; locked $STRATO is priced against the Ethereum STRATO ERC-20 because it has no price feed on the STRATO chain.', start: '2026-04-02', strato: { tvl: async (api) => { From 0d41e313a3ab4413f4b3203d52dfdef396998bfc Mon Sep 17 00:00:00 2001 From: Hephaestus0x Date: Tue, 27 Oct 2026 00:51:04 -0700 Subject: [PATCH 457/988] List Overlayer and peg T+, C+, and G+ to their stablecoins (#21864) Co-authored-by: Cursor Co-authored-by: ccipherx --- registries/sumTokens.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index bca85d701a2..b22ea0c6e2f 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -21377,6 +21377,28 @@ const configs = { ] }, }, + "overlayer": { + "doublecounted": true, + "methodology": "TVL is the USDT, USDC and USDG backing T+, C+ and G+, counted as the stablecoin and Aave aToken balances of each backing contract and wrap contract on Ethereum. Collateral is supplied to Aave, so it is marked doublecounted. Bridged OFT supply and staked vault shares are claims on the same backing and are not counted again.", + "ethereum": { + "owners": [ + "0xBb32471973caD2f6317a7f366628A90e0A94a03f", // T+ backing + "0xBfaE8C8500cD35B652373a3Ad5BaA0D604A05a29", // T+ + "0xeF2a40901a9A985eb028a0B927b427dA9BAD2aCa", // C+ backing + "0xB17EE7D061e076ff1aD6bd2141888CFb39C0Ccdc", // C+ + "0x51366973e57c3fec58319812e9d148dE4F772f37", // G+ backing + "0xD4E1CAF200b29585aADc9AF39c16D57C8c82EbF1" // G+ + ], + "tokens": [ + ADDRESSES.ethereum.USDT, + "0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a", // aEthUSDT + ADDRESSES.ethereum.USDC, + "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c", // aEthUSDC + ADDRESSES.ethereum.USDG, + "0x7c0477d085ECb607CF8429f3eC91Ae5E1e460F4F" // aEthUSDG + ] + }, + }, "oxiswap": { "methodology": "TVL is calculated by summing the value of all tokens held in the pair contract.", "timetravel": false, From 4e56645c424bb094397221af05e50439222c0a2a Mon Sep 17 00:00:00 2001 From: Dani Date: Tue, 27 Oct 2026 09:08:52 +0100 Subject: [PATCH 458/988] infinite: add aero and univ3 compounders, move itp-paired lp to pool2 (#21867) Co-authored-by: etherpilled --- projects/infinite/index.js | 128 +++++++++++++++++++++++++++------- projects/treasury/infinite.js | 2 +- 2 files changed, 104 insertions(+), 26 deletions(-) diff --git a/projects/infinite/index.js b/projects/infinite/index.js index d2392deed77..e2dd4f1f25c 100644 --- a/projects/infinite/index.js +++ b/projects/infinite/index.js @@ -15,14 +15,35 @@ const ITP_STAKED_ABI = "function getVaultInfo() view returns (uint256, uint256, const STSATO_ON_ETHEREUM = '0xdeE7f7A032326148E65EC3068F1c9b29E26B75b3' const SATO_ON_ETHEREUM = '0x829f4B62EEBE12Af653b4dD4fFc480966F7d7f09' -// === Auto-compounder vault contracts and their corresponding LP tokens (Optimism) === +// === Velodrome auto-compounder vaults (Optimism); each vault reports its LP via want() === 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 + "0x569D92f0c94C04C74c2f3237983281875D9e2247", // ITP/VELO + "0xFCEa66a3333a4A3d911ce86cEf8Bdbb8bC16aCA6", // ITP/DHT + "0x2811a577cf57A2Aa34e94B0Eb56157066717563f", // ITP/wstETH + "0x8A2e22BdA1fF16bdEf27b6072e087452fa874b69", // ITP/OP + "0x3092F8dE262F363398F15DDE5E609a752938Cc11", // ITP/WBTC + "0xC4628802a42F83E5bce3caB05A4ac2F6E485F276", // ITP/USDC +]; + +// === Aero auto-compounder factories (v2). Only vaults the DAO marks official are counted. === +const AERO_FACTORIES = { + optimism: "0x337Fe450bCD603B1c637AB0F4C073d926a1aE3Dc", + base: "0xB60ce95161506EeC22A2D68A784DD21cf78adcA9", +} + +// ITP per chain; Aero vault LP paired with it goes to pool2 +const ITP = { + optimism: ITP_ON_OPTIMISM, + base: "0xBA8CD87120aCA631F59231f9fD6c5469BbEE3440", +} + +// === Uniswap V3 auto-compounder vaults (Base); each holds one position NFT plus idle tokens === +const UNIV3_VAULTS = [ + { vault: "0xf0e3305e81744e4dfa2d01c0a145814357a89018", pool: "0x16A1E7F62b702d84AAa0D1f534121DE9d17B0E18" }, // ITP/USDC + { vault: "0xD248B1e882c4444674D83eF912713113B719f7Ce", pool: "0x95cb82d517a1ce4e6ac4312bcf718cd0ee9f3884" }, // cbEGGS/WETH + { vault: "0x2fe57c7a0978d5bA39461572b87db41131b43646", pool: "0x33840ce3817ef3f79da49ec70e4653c4ae20ee3f" }, // ITP/cbXRP + { vault: "0xa1bca9f6d9618348e7c33284082e2959a3449aa8", pool: "0x750813fbFBD24310A31e9dcaE3b143C75F241344" }, // ITP/cbEGGS + { vault: "0xd75d5d3ef0880ff25fd66d4fdf5b461ffb97674d", pool: "0x3819e346E6347d75ceF0CfFd3FF41489f543a9Cc" }, // ITP/AERO ]; // === cbEGGS Contract (Base) - owned by Infinite Trading === @@ -73,21 +94,65 @@ 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 }); +// Velodrome auto-compounders: LP each vault holds (vault.balance()), in the LP vault.want() reports +const addVelodromeCompounders = async (api) => { + const [lps, balances] = await Promise.all([ + api.multiCall({ abi: "address:want", calls: AUTO_COMPOUNDERS }), + api.multiCall({ abi: "uint256:balance", calls: AUTO_COMPOUNDERS }), + ]) + lps.forEach((lp, i) => api.add(lp, balances[i])) +} + +// Aero auto-compounders: every official vault from the v2 factory; LP held idle plus staked in the gauge +const addAeroVaults = async (api, isPool2) => { + const factory = AERO_FACTORIES[api.chain] + if (!factory) return + const count = await api.call({ target: factory, abi: "uint256:vaultCount" }) + const vaults = await api.multiCall({ + target: factory, + abi: "function vaults(uint256) view returns (address)", + calls: Array.from({ length: Number(count) }, (_, i) => i), + }) + const official = await api.multiCall({ + target: factory, + abi: "function isOfficial(address) view returns (bool)", + calls: vaults, + }) + const ours = vaults.filter((_, i) => official[i]) + if (!ours.length) return + const [assets, staked] = await Promise.all([ + api.multiCall({ abi: "address:asset", calls: ours }), + api.multiCall({ abi: "uint256:stakedLp", calls: ours }), + ]) + const [idle, token0s, token1s] = await Promise.all([ + api.multiCall({ + abi: "erc20:balanceOf", + calls: ours.map((vault, i) => ({ target: assets[i], params: [vault] })), + }), + api.multiCall({ abi: "address:token0", calls: assets }), + api.multiCall({ abi: "address:token1", calls: assets }), + ]) + const itp = ITP[api.chain].toLowerCase() + assets.forEach((lp, i) => { + const pairsItp = [token0s[i], token1s[i]].some(t => t.toLowerCase() === itp) + if (pairsItp === isPool2) api.add(lp, BigInt(idle[i]) + BigInt(staked[i])) + }) +} + +// Uniswap V3 auto-compounders (Base): position NFTs held by the vaults plus their idle pool tokens; every pool pairs ITP or cbEGGS +const addUniV3Vaults = async (api) => { + const pools = UNIV3_VAULTS.map(v => v.pool) + const [token0s, token1s] = await Promise.all([ + api.multiCall({ abi: "address:token0", calls: pools }), + api.multiCall({ abi: "address:token1", calls: pools }), + ]) + return sumTokens2({ + api, + resolveLP: true, // also unwraps Aero LP added earlier for this chain + resolveUniV3: true, + owners: UNIV3_VAULTS.map(v => v.vault), + tokensAndOwners: UNIV3_VAULTS.flatMap((v, i) => [[token0s[i], v.vault], [token1s[i], v.vault]]), + }) } // dHEDGE managed vaults TVL: Infinite Trading manages dHEDGE vaults across chains (protocol TVL) @@ -143,16 +208,23 @@ const getStsatoTVL = async (api) => { } module.exports = { - 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), cbEGGS.finance protocol TVL (ETH backing on Base), and stSATO TVL on Ethereum from on-chain SATO backing via getBacking(). cbEGGS is owned by Infinite Trading.", + methodology: "TVL: Aero auto-compounder vaults on Optimism and Base whose LP does not pair ITP (every DAO-official vault from the Aero v2 factories: LP held idle plus staked in the gauge, unwrapped); dHEDGE vaults managed by the DAO across multiple chains; cbEGGS.finance protocol TVL (ETH backing on Base); and stSATO TVL on Ethereum from on-chain SATO backing via getBacking(). cbEGGS is owned by Infinite Trading. Pool2: auto-compounder vaults holding ITP- or cbEGGS-paired liquidity (Velodrome and ITP-paired Aero vaults on Optimism, ITP-paired Aero vaults and Uniswap V3 position NFTs plus idle tokens on Base). Staking: ITP staking vault.", + doublecounted: true, ethereum: { tvl: getStsatoTVL, }, optimism: { tvl: async (api) => { - await getAutoCompounderTVL(api) + await addAeroVaults(api, false) + await sumTokens2({ api, resolveLP: true }) await getDhedgeVaultsTVL(api) return api.getBalances() }, + pool2: async (api) => { + await addVelodromeCompounders(api) + await addAeroVaults(api, true) + return sumTokens2({ api, resolveLP: true }) + }, staking: getStakedTVL }, arbitrum: { @@ -164,8 +236,14 @@ module.exports = { base: { tvl: async (api) => { await getCbEggsTVL(api) + await addAeroVaults(api, false) + await sumTokens2({ api, resolveLP: true }) await getDhedgeVaultsTVL(api) return api.getBalances() - } + }, + pool2: async (api) => { + await addAeroVaults(api, true) + return addUniV3Vaults(api) + }, }, } diff --git a/projects/treasury/infinite.js b/projects/treasury/infinite.js index ec02ef9b767..cd352c682f7 100644 --- a/projects/treasury/infinite.js +++ b/projects/treasury/infinite.js @@ -19,7 +19,7 @@ const AUTO_COMPOUNDER_VAULTS = [ { vault: "0x2811a577cf57A2Aa34e94B0Eb56157066717563f", lp: "0xdAD7B4C48b5B0BE1159c674226BE19038814eBf6" }, // ITP/wstETH { vault: "0x8A2e22BdA1fF16bdEf27b6072e087452fa874b69", lp: "0x79F1af622FE2C636a2d946F03A62D1DfC8cA6de4" }, // ITP/OP { vault: "0x3092F8dE262F363398F15DDE5E609a752938Cc11", lp: "0x93e40C357C4Dc57b5d2B9198a94Da2bD1C2e89cA" }, // ITP/WBTC - { vault: "0xC4628802a42F83E5bce3caB05A4ac2F6E485F276", lp: "0x7e019a99f0dee5796db59c571ae9680c9c866a8e" }, // ITP/USDC + { vault: "0xC4628802a42F83E5bce3caB05A4ac2F6E485F276", lp: "0xB84C932059A49e82C2c1bb96E29D59Ec921998Be" }, // ITP/USDC ] const DHEDGE_FACTORY = { From 90b4bcfca2ab9971d984cfb87685273015a56af0 Mon Sep 17 00:00:00 2001 From: bluewhale-saito <126760033+bluewhale-saito@users.noreply.github.com> Date: Tue, 27 Oct 2026 17:19:23 +0900 Subject: [PATCH 459/988] aquabank: add Aave V3 positions to TVL (#21868) --- registries/sumTokens/data3.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index fc96b7d6106..cf59f73bbca 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -206,9 +206,9 @@ module.exports = { }, }, "aquabank": { - "methodology": "TVL is calculated from the total supply of bUSDT, bUSDC, and bAUSD, each fully backed 1:1 by stablecoins deposited into Benqi and Euler vaults.", + "methodology": "TVL is calculated from the yield-bearing protocol token balances held by AquaBank minting contracts, representing the stablecoins backing bUSDT, bUSDC, and bAUSD across Benqi, Euler, and Aave V3.", "avax": { - "tvl": { "owners": ["0x7D336B49879a173626E51BFF780686D88b8081ec","0xb06DE2E9a339d201661045b7D845De3d20373b4F","0xcCB7De5b7788de551E3b85b50e4834D5B7e3F27c","0x61E8f77eD693d3edeCBCc2dd9c55c1d987c47775"], "tokens": ["0xd8fcDa6ec4Bdc547C0827B8804e89aCd817d56EF","0xa446938b0204Aa4055cdFEd68Ddf0E0d1BAB3E9E","0xB715808a78F6041E46d61Cb123C9B4A27056AE9C","0x190D94613A09ad7931FcD17CD6A8F9B6B47ad414"] }, + "tvl": { "owners": ["0x7D336B49879a173626E51BFF780686D88b8081ec","0xb06DE2E9a339d201661045b7D845De3d20373b4F","0xcCB7De5b7788de551E3b85b50e4834D5B7e3F27c","0x61E8f77eD693d3edeCBCc2dd9c55c1d987c47775","0xa62BF981Ad60bF389f6935585b7861a8EF4D404f","0x01C72156E8265182A728c51A30Caa70F263E4D66","0x1958a8026389F35EaBDeBd9093D960eda15d36B0"], "tokens": ["0xd8fcDa6ec4Bdc547C0827B8804e89aCd817d56EF","0xa446938b0204Aa4055cdFEd68Ddf0E0d1BAB3E9E","0xB715808a78F6041E46d61Cb123C9B4A27056AE9C","0x190D94613A09ad7931FcD17CD6A8F9B6B47ad414","0x625E7708f30cA75bfd92586e17077590C60eb4cD","0x724dc807b04555b71ed48a6896b6F41593b8C637","0x6ab707Aca953eDAeFBc4fD23bA73294241490620"] }, }, }, "unit": { From fd62983481ad1cfeee0ec24f16ae36ab5cb070c6 Mon Sep 17 00:00:00 2001 From: sepehrvali1999 <115732841+sepehrvali1999@users.noreply.github.com> Date: Tue, 27 Oct 2026 13:26:27 +0500 Subject: [PATCH 460/988] Add Olive (olive.exchange) TVL adapter (#21866) Co-authored-by: Sepehr Vali Co-authored-by: ccipherx --- registries/sumTokens.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index b22ea0c6e2f..d3b85f799b9 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -20979,6 +20979,13 @@ const configs = { "token": ADDRESSES.null }, }, + "olive-exchange": { + "timetravel": false, + "methodology": "TVL is the sum of the tokens held in Olive's liquidity pool vaults: liquidity providers' deposits plus traders' collateral and premiums.", + "solana": { + "owner": "83Tc25SyGq87ENozzYjAVJLamYV98MgHiZXTnpY2Tfj3" + }, + }, "olivedao": { "polygon": { "tokensAndOwners": [ From 8e19016b9b69094900f024df960b9925c46369ac Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 27 Oct 2026 10:06:20 +0100 Subject: [PATCH 461/988] refactor: adjust order of operations in cexExports for Hyperliquid support --- projects/helper/cex.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index e459c2e6bf9..e5296891b91 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -593,11 +593,12 @@ function cexExports(config) { } const runtimeOptions = { ...options, owners, tokens, permitFailure: true } // while filling historical data, some tokens may not exist on the chain yet, so we permit failure if (chain === 'solana') runtimeOptions.solOwners = owners - await sumTokensExport(runtimeOptions)(api) // hyperliquid owners hold funds both on HyperEVM (summed above) and on HyperCore // (spot + perp margin), which no on-chain lookup sees - if (chain === 'hyperliquid') await addHypercoreBalances({ api, owners, blacklistedTokens: options.blacklistedTokens }) - return api.getBalances() + if (chain === 'hyperliquid') + await addHypercoreBalances({ api, owners, blacklistedTokens: options.blacklistedTokens }) + + return sumTokensExport(runtimeOptions)(api) } } }) From e884ed2614601ea01e6d27bc58a05be54c9ef677 Mon Sep 17 00:00:00 2001 From: Dani Date: Tue, 27 Oct 2026 11:58:23 +0100 Subject: [PATCH 462/988] track runup tvl (#21869) --- projects/runup/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/runup/index.js diff --git a/projects/runup/index.js b/projects/runup/index.js new file mode 100644 index 00000000000..33b28c6511c --- /dev/null +++ b/projects/runup/index.js @@ -0,0 +1,19 @@ +const FACTORY = '0x6a00c8Cb5Fb5aAac9C91A2649bd42a26Ca3dEeE1' + +const abi = { + launches: 'function launches(uint256) view returns (address token, address market, address vault, address schedule, address adapter, address creator, bytes32 marketId, bool shortThesis, uint8 leverage, uint8 profile, uint8 preset)', +} + +async function tvl(api) { + const quote = await api.call({ target: FACTORY, abi: 'address:quoteToken' }) + const launches = await api.fetchList({ lengthAbi: 'uint256:count', itemAbi: abi.launches, target: FACTORY }) + return api.sumTokens({ owners: launches.map((launch) => launch.market), tokens: [quote] }) +} + +module.exports = { + methodology: 'TVL is the USDC held by every RunUp market contract, enumerated from the RunUp factory: bonding curve reserves, and the pool a coin graduates into, including RUNNER, the platform token, which launched through its own market. Launched tokens are excluded, as are the coins\' treasury vaults, which hold trading fees used for the perp strategy and buybacks.', + start: '2026-10-02', + injective: { + tvl, + }, +} From c7f2e0e66c834b4b39a9a6d779e85e39035cd6a8 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Tue, 27 Oct 2026 12:08:18 +0100 Subject: [PATCH 463/988] update sentora (#21870) --- projects/sentora/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/sentora/index.js b/projects/sentora/index.js index 3d155506c40..15d6c4d5349 100644 --- a/projects/sentora/index.js +++ b/projects/sentora/index.js @@ -68,6 +68,7 @@ const customConfig = { { vault: '0x3cc0d33b1aeac3d23ea89214b3ac5b4607032167', deployBlock: 23682851 }, // Upshift vault BTC { vault: '0xd0271e199f886ff943859579465498b18ecf1e9d', deployBlock: 24241435 }, // Upshift vault ETH { vault: '0xd000E6BcAd5457E8F4de67eDdeFe50BCC4B3d743', deployBlock: 25279501 }, // Upshift Sentora RWA (PYUSD) + { vault: '0xe7Ea85080426e69388AC444b72B6c4c5409d29FC', deployBlock: 26041853 }, // Upshift USD Earn with Uphold (RLUSD) ], supervisedLoans: [ '0xc936e848688c9f035fa0e7a0e4dbcf26a01245f3', // Loan Manager (Position Manager 0xc1d4e31c05457f7a87f49e0ef556977e9e216250) From 8384c847a17b90fd84d2119e2fe1662119354f52 Mon Sep 17 00:00:00 2001 From: Thomas <92047278+thomas-chabert@users.noreply.github.com> Date: Tue, 27 Oct 2026 15:08:14 +0100 Subject: [PATCH 464/988] morpho-blue: subtract excluded markets' collateral when the token is shared (#21871) Co-authored-by: Claude Opus 5.5 --- projects/helper/abis/morpho.json | 3 +- projects/morpho-blue/index.js | 91 +++++++++++++++++++++++--------- 2 files changed, 67 insertions(+), 27 deletions(-) diff --git a/projects/helper/abis/morpho.json b/projects/helper/abis/morpho.json index b21a65d7e6a..3fe3cd2956d 100644 --- a/projects/helper/abis/morpho.json +++ b/projects/helper/abis/morpho.json @@ -14,7 +14,8 @@ "morphoBlueFunctions": { "underlying": "address:underlying", "idToMarketParams": "function idToMarketParams(bytes32 Id) returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv)", - "market": "function market(bytes32 input) returns (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee)" + "market": "function market(bytes32 input) returns (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee)", + "position": "function position(bytes32 id, address user) view returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral)" }, "metaMorphoFunctions": { "withdrawQueueLength": "function withdrawQueueLength() view returns (uint256)" diff --git a/projects/morpho-blue/index.js b/projects/morpho-blue/index.js index be157919f26..d6a75a0818f 100644 --- a/projects/morpho-blue/index.js +++ b/projects/morpho-blue/index.js @@ -1,5 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') +const ethers = require("ethers") const { getLogs } = require("../helper/cache/getLogs"); const abi = require("../helper/abis/morpho.json"); const { sumTokens2 } = require("../helper/unwrapLPs"); @@ -8,27 +9,31 @@ const { config, retiredChains } = require("./config"); const { getExcludedMarketIds, getExcludedAssets, getExcludedVaults } = require("./exclusions"); const eventAbis = { - createMarket: 'event CreateMarket(bytes32 indexed id, (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams)' + createMarket: 'event CreateMarket(bytes32 indexed id, (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams)', + supplyCollateral: 'event SupplyCollateral(bytes32 indexed id, address indexed caller, address indexed onBehalf, uint256 assets)', } +const supplyCollateralTopic = ethers.id('SupplyCollateral(bytes32,address,address,uint256)') const nullAddress = ADDRESSES.null -const getMarket = async (api) => { - const { morphoBlue, fromBlock, blacklistedMarketIds = [], onlyUseExistingCache, } = config[api.chain] +const chainsWithTroublePullingLogs = new Set(['tac', 'sei']) + +// on chains whose rpcs struggle with log ranges, fall back to the existing cache rather than fail +const getMorphoLogs = async (api, params) => { + const { morphoBlue, fromBlock, onlyUseExistingCache, } = config[api.chain] const useIndexer = api.chain === 'monad' ? true : false - const extraKey = 'reset-v2' - - let logs = []; - const chainsWithTroublePullingLogs = new Set(['tac', 'sei']) - if (chainsWithTroublePullingLogs.has(api.chain)) { - try { - logs = await getLogs({ api, target: morphoBlue, eventAbi: eventAbis.createMarket, fromBlock, onlyArgs: true, extraKey, onlyUseExistingCache, useIndexer }) - } catch (e) { - logs = await getLogs({ api, target: morphoBlue, eventAbi: eventAbis.createMarket, fromBlock, onlyArgs: true, extraKey, onlyUseExistingCache: true, useIndexer }) - } - } else { - logs = await getLogs({ api, target: morphoBlue, eventAbi: eventAbis.createMarket, fromBlock, onlyArgs: true, extraKey, onlyUseExistingCache, useIndexer }) + const options = { api, target: morphoBlue, fromBlock, onlyArgs: true, onlyUseExistingCache, useIndexer, ...params } + if (!chainsWithTroublePullingLogs.has(api.chain)) return getLogs(options) + try { + return await getLogs(options) + } catch (e) { + return getLogs({ ...options, onlyUseExistingCache: true }) } +} + +const getMarket = async (api) => { + const { morphoBlue, blacklistedMarketIds = [] } = config[api.chain] + const logs = await getMorphoLogs(api, { eventAbi: eventAbis.createMarket, extraKey: 'reset-v2' }) if (api.chain === 'sei') { const existingIds = new Set(logs.map(i => i.id.toLowerCase())) @@ -65,12 +70,31 @@ const getMarket = async (api) => { return { markets: all.filter((id) => !excluded.has(id)), excludedMarkets: all.filter((id) => excluded.has(id)) } } +// morpho keeps no per-market collateral total, so sum position(id, user).collateral over every account +// that ever supplied collateral to the market. position, not the logs' net: liquidations seize collateral +// without emitting WithdrawCollateral. One log query covers all the markets (topic1 = any of the ids); the +// cache key changes with the market set, so a new excluded market costs one rescan. +const getMarketsCollateral = async (api, ids) => { + const { morphoBlue } = config[api.chain] + const collateralById = new Map(ids.map((id) => [id, 0n])) + if (!ids.length) return collateralById + const sortedIds = [...ids].sort() + const extraKey = `collateral-${ethers.id(sortedIds.join(',')).slice(2, 18)}` + const logs = await getMorphoLogs(api, { eventAbi: eventAbis.supplyCollateral, topics: [supplyCollateralTopic, sortedIds], extraKey }) + const calls = [...new Set(logs.map((log) => `${log.id.toLowerCase()}:${log.onBehalf.toLowerCase()}`))].map((key) => ({ params: key.split(':') })) + const positions = await api.multiCall({ target: morphoBlue, calls, abi: abi.morphoBlueFunctions.position }) + positions.forEach((position, i) => { + const id = calls[i].params[0] + collateralById.set(id, collateralById.get(id) + BigInt(position.collateral)) + }) + return collateralById +} + // tvl sums the whole balance the shared morpho contract holds of each token, so dropping an excluded // market from the id list does nothing while a valid market uses the same token. Subtract what the -// excluded market still physically holds: supply minus borrowed, since borrowed assets have left the -// contract. Collateral is not attributable: morpho exposes no per-market total, only position(id, user), -// so an excluded market's collateral stays counted when a valid market shares that token - measured at -// ~$1k on ethereum, which is why netting the collateral logs per market is not worth the scan. +// excluded market still physically holds: supply minus borrowed (borrowed assets have left the +// contract), plus its collateral. Collateral is only scanned for markets whose collateral token is +// counted, i.e. shared with a valid market - e.g. ~$64M of BGBTC in an excluded morph market. const subtractExcludedMarkets = async (api, excludedMarkets, morphoHeld) => { if (!excludedMarkets.length) return const { morphoBlue } = config[api.chain] @@ -79,18 +103,33 @@ const subtractExcludedMarkets = async (api, excludedMarkets, morphoHeld) => { api.multiCall({ target: morphoBlue, calls: excludedMarkets, abi: abi.morphoBlueFunctions.market }), ]) - const idleByToken = new Map() + const heldByMarkets = new Map() + const addHeld = (token, amount) => { + if (amount > 0n) heldByMarkets.set(token, (heldByMarkets.get(token) ?? 0n) + amount) + } + marketDatas.forEach((data, i) => { - const loanToken = marketInfos[i].loanToken.toLowerCase() - const idle = BigInt(data.totalSupplyAssets || 0) - BigInt(data.totalBorrowAssets || 0) - if (idle > 0n) idleByToken.set(loanToken, (idleByToken.get(loanToken) ?? 0n) + idle) + addHeld(marketInfos[i].loanToken.toLowerCase(), BigInt(data.totalSupplyAssets || 0) - BigInt(data.totalBorrowAssets || 0)) }) - idleByToken.forEach((idle, token) => { + const collateralTokenById = new Map(excludedMarkets.map((id, i) => [id, marketInfos[i].collateralToken.toLowerCase()])) + const sharedCollateralMarkets = excludedMarkets.filter((id) => morphoHeld.has(collateralTokenById.get(id))) + // the scan needs a full log history; if the rpc or indexer can't serve it, keep the previous behaviour + // (collateral stays counted) rather than fail the chain's tvl + let collateralById = new Map() + try { + collateralById = await getMarketsCollateral(api, sharedCollateralMarkets) + } catch (e) { + sdk.log(`morpho-blue: excluded collateral scan failed on ${api.chain}, not subtracting it`, e.message) + } + collateralById.forEach((collateral, id) => addHeld(collateralTokenById.get(id), collateral)) + + heldByMarkets.forEach((amount, token) => { const held = morphoHeld.get(token) if (!held) return - // clamp: a market's accounting supply can exceed what the contract holds when interest is phantom - api.add(held.token, (-(idle > held.amount ? held.amount : idle)).toString()) + // clamp: a market's accounting can exceed what the contract holds, with phantom interest on the supply + // side, or collateral still booked on positions after it left the contract + api.add(held.token, (-(amount > held.amount ? held.amount : amount)).toString()) }) } From af21a8ab8779a30ba49bd943233bc73a5ed52fc7 Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Tue, 27 Oct 2026 10:27:40 -0400 Subject: [PATCH 465/988] docs: require approval for Trueo Metric TVL methodology changes (#21860) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/metric-v1/index.js | 3 +++ registries/index.js | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/metric-v1/index.js b/projects/metric-v1/index.js index eadb53f3759..751f33eb91c 100644 --- a/projects/metric-v1/index.js +++ b/projects/metric-v1/index.js @@ -1,3 +1,6 @@ +// Changes to Metric TVL methodology require further approval before merging: +// a Trueo market depends on this data. + // Metric V1 pools (the DefiLlama listing that pairs with dimension-adapters // dexs/metric-v1). Two MetricOmmPoolFactory generations, both deployed through // CreateX to the same address on every chain; pools hold their own token0/token1 diff --git a/registries/index.js b/registries/index.js index c3994e7db47..d2f7917100c 100644 --- a/registries/index.js +++ b/registries/index.js @@ -1,3 +1,7 @@ +// Metric V0 is archived under the "metric" key in deadAdapters.json. Changes to its +// TVL methodology (including restoring a live adapter) require further approval +// before merging because a Trueo market depends on this data. + const deadAdapters = require('./deadAdapters.json'); const adapterRoutes = [ @@ -56,4 +60,4 @@ module.exports = { allProtocols, deadAdapters, adapterRoutes, -}; \ No newline at end of file +}; From 625a63eab4351f8ea4d537b3c0ca4f949a61cc13 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 27 Oct 2026 15:34:51 +0100 Subject: [PATCH 466/988] update @defillama/sdk version --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 50165504eef..5f745fb53e4 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", - "@defillama/sdk": "5.0.242", + "@defillama/sdk": "5.0.244", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", "@supercharge/promise-pool": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b3bb2f58a8f..4f035df0229 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^0.30.1 version: 0.30.1(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) '@defillama/sdk': - specifier: 5.0.242 - version: 5.0.242(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) + specifier: 5.0.244 + version: 5.0.244(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) '@project-serum/anchor': specifier: ^0.26.0 version: 0.26.0(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -269,8 +269,8 @@ packages: peerDependencies: '@solana/web3.js': ^1.68.0 - '@defillama/sdk@5.0.242': - resolution: {integrity: sha512-dDODx5N6hN3zBViMd5Pr8HS2+SGC774g4xQTaQLukP8cPOkCkYVfpLPm++WpeSpPCwgFcd4S9B1sxvJhfkXkTA==} + '@defillama/sdk@5.0.244': + resolution: {integrity: sha512-c3pxyQvsFPGkUvbTWWzMD2bXbP8T331E3Zucj1DLFbGGbiEs1jMDTTN0yHQ4EI4qAAzGSk9IPMpMue8OjKPQww==} peerDependencies: '@solana/web3.js': '>=1.73.0' peerDependenciesMeta: @@ -1941,7 +1941,7 @@ snapshots: bn.js: 5.2.2 buffer-layout: 1.2.2 - '@defillama/sdk@5.0.242(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': + '@defillama/sdk@5.0.244(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': dependencies: '@aws-sdk/client-s3': 3.913.0 '@elastic/elasticsearch': 8.19.1(supports-color@7.2.0) From 456cebb9099d9356ad1c61d72ba0912ccd0c938d Mon Sep 17 00:00:00 2001 From: Andrei Yazepchyk <70756146+Yazep@users.noreply.github.com> Date: Tue, 27 Oct 2026 15:38:26 +0100 Subject: [PATCH 467/988] Akashi: track the new vault program (#21874) --- projects/akashi/index.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/projects/akashi/index.js b/projects/akashi/index.js index 1fbd80ee03e..03e932d5287 100644 --- a/projects/akashi/index.js +++ b/projects/akashi/index.js @@ -5,9 +5,12 @@ const { getConnection, sumTokens2, TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID } = r // Akashi vaults: Senior/Junior USDC vaults whose deposits the vault program allocates to // lending and credit protocols through adapter programs. Each vault keeps its cash in // two token accounts (idle, and payout for funded withdrawals not yet claimed); each leg -// holds its protocol receipt token (jlUSDC, Kamino cTokens, syrupUSDC, PRIME, AUTO, PST) -// and a USDC transit account, all owned by the leg's authority PDA. -const PROGRAM_ID = new PublicKey('11pvmug4MazGHegPLFYn7RxSwoV7AkFF1LSbbNJ1QyF') +// holds its protocol or receipt token (e.g. ONyc, Hastra AUTO, Huma PST, Kamino Earn +// shares, jlUSDC, Kamino cTokens, syrupUSDC) and a USDC transit account, all owned by +// the leg's authority PDA. +// Vault program with commissions (live since 2026-10-27). The earlier program +// 11pvmug4MazGHegPLFYn7RxSwoV7AkFF1LSbbNJ1QyF was wound down and owns no accounts. +const PROGRAM_ID = new PublicKey('12i2UkpXrG9QExaZfisyqowHVDW2kf2RK7xFxUo71bDi') // sha256("account:Vault")[0..8] const VAULT_DISCRIMINATOR = Buffer.from([211, 8, 232, 43, 2, 152, 117, 119]) @@ -20,6 +23,7 @@ const VAULT_DISCRIMINATOR = Buffer.from([211, 8, 232, 43, 2, 152, 117, 119]) // max_valuation_age_slots u64, junior_seed u64 }, // state u8, usdc_mint, senior_mint, junior_mint, idle_account, payout_account, // senior_escrow, junior_escrow (Pubkey each), accounts_initialized bool, leg_count u8, ... +// (the fee ledger is appended at the end and not read here) const PREMIUM_CURVE_LEN = 8 + 8 + 32 + 32 + 2 + 2 // offset of the curve's u32 length const MAX_CURVE_POINTS = 4 // #[max_len(4)] in state.rs const AFTER_CURVE = 4 + 4 + 8 + 8 + 2 + 2 + 8 + 8 // rest of params @@ -68,7 +72,7 @@ async function tvl(api) { module.exports = { timetravel: false, - doublecounted: true, // the legs' receipt tokens are deposits in Kamino Lend, Jupiter Lend, Maple, Hastra and Huma - methodology: 'Token balances held by every Akashi vault: USDC in each vault\'s idle and payout accounts (payout holds funded withdrawals not yet claimed), plus the protocol receipt tokens and USDC held by each leg\'s authority (jlUSDC, Kamino reserve cTokens, syrupUSDC, Hastra PRIME/AUTO, Huma PST). Those positions are also counted by Kamino Lend, Jupiter Lend, Maple, Hastra and Huma, so the TVL is marked double counted. An async exit still pending at the protocol (e.g. a Huma redemption request) holds no token and is counted once it settles.', + doublecounted: true, // the legs' tokens are deposits in OnRe, Hastra, Huma, Kamino, Jupiter Lend and Maple + methodology: 'Token balances held by every Akashi vault: USDC in each vault\'s idle and payout accounts (payout holds funded withdrawals not yet claimed), plus the protocol tokens and USDC held by each leg\'s authority (e.g. OnRe ONyc, Hastra AUTO/PRIME, Huma PST, Kamino Earn shares and reserve cTokens, jlUSDC, syrupUSDC). Those positions are also counted by OnRe, Hastra, Huma, Kamino, Jupiter Lend and Maple, so the TVL is marked double counted. An async exit still pending at the protocol (e.g. a Huma redemption request) holds no token and is counted once it settles.', solana: { tvl }, } From fe06790eae45f42b35cdee7a808120e06bd2b865 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 27 Oct 2026 15:45:48 +0100 Subject: [PATCH 468/988] feat: merge static and CSV owners for Bybit's PoR integration --- cex/bybit.js | 23 ++++++++++++++++++----- test.js | 8 ++++++-- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/cex/bybit.js b/cex/bybit.js index 4c6716d86cf..5c12490e1be 100644 --- a/cex/bybit.js +++ b/cex/bybit.js @@ -79,22 +79,35 @@ function parseOwnersByChain(csv) { const getOwners = () => getConfig('bybit-por', undefined, { fetcher: async () => parseOwnersByChain(await fetchLatestCsv()) }) -// chains Bybit doesn't list in its PoR CSV but still hold balances +// wallets missing from (or on chains absent from) Bybit's PoR CSV; merged with the CSV owners per chain const STATIC_OWNERS = { cardano: ['addr1v8mn6dmk7tf9u26kr09a05lmvc9j4k9d940a88ta3hdczqgyt7whl'], fantom: ['0xf89d7b9c864f589bbF53a82105107622B35EaA40'], starknet: ['0x076601136372fcdbbd914eea797082f7504f828e122288ad45748b0c8b0c9696'], } +// union of the CSV and static owners for a chain, deduped after the same normalization the CSV gets +// (TON bounceable/non-bounceable forms collapse, hex addresses compare case-insensitively) +function mergeOwners(slug, ...lists) { + const seen = new Set() + const out = [] + for (const a of lists.flat()) { + const normalized = normalizeAddress(a, slug) + const key = normalized.toLowerCase() + if (seen.has(key)) continue + seen.add(key) + out.push(normalized) + } + return out +} + // Chains whose PoR balance sits in a token that has no default list in helper/cex.js const EXTRA_TOKENS = { berachain: ['0x0000000000000000000000000000000000000000', '0x779Ded0c9e1022225f8E0630b35a9b54bE713736'], // BERA, USDT0 } module.exports = { bitcoin: 'bybit' } -for (const slug of new Set(Object.values(CHAIN_MAP))) - module.exports[slug] = { owners: async () => (await getOwners())[slug] || [] } -for (const [slug, owners] of Object.entries(STATIC_OWNERS)) - module.exports[slug] = { owners } +for (const slug of new Set([...Object.values(CHAIN_MAP), ...Object.keys(STATIC_OWNERS)])) + module.exports[slug] = { owners: async () => mergeOwners(slug, (await getOwners())[slug] || [], STATIC_OWNERS[slug] || []) } for (const [slug, tokens] of Object.entries(EXTRA_TOKENS)) module.exports[slug].tokens = tokens diff --git a/test.js b/test.js index b8a088b9793..b92c9c736b8 100644 --- a/test.js +++ b/test.js @@ -240,12 +240,16 @@ function validateHallmarks(hallmark) { }) }).filter(p => p !== undefined && Array.isArray(p)).flat().filter(p => p !== undefined) - await util.runInPromisePool({ + // print how many http requests (rpc per chain, coins, indexer...) the adapter made, to spot heavy adapters locally + const runTracked = sdk.callStats + ? (fn) => sdk.callStats.run({ application: 'tvl', type: 'test', name: moduleArg }, fn, { print: true, skipElastic: true }) + : (fn) => fn() + await runTracked(() => util.runInPromisePool({ items: tvlPromises, concurrency: 5, processor: async (p) => p(), permitFailure: false, - }) + })) Object.entries(chainTvlsToAdd).map(([tvlType, storedKeys]) => { if (usdTvls[tvlType] === undefined) { usdTvls[tvlType] = storedKeys.reduce( From cdaa9fca5c0809c189a89b09b405c2a2a9d58cd2 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 27 Oct 2026 15:09:19 +0000 Subject: [PATCH 469/988] cache (#21875) --- projects/morpho-blue/index.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/projects/morpho-blue/index.js b/projects/morpho-blue/index.js index d6a75a0818f..045db4b03f5 100644 --- a/projects/morpho-blue/index.js +++ b/projects/morpho-blue/index.js @@ -72,20 +72,30 @@ const getMarket = async (api) => { // morpho keeps no per-market collateral total, so sum position(id, user).collateral over every account // that ever supplied collateral to the market. position, not the logs' net: liquidations seize collateral -// without emitting WithdrawCollateral. One log query covers all the markets (topic1 = any of the ids); the -// cache key changes with the market set, so a new excluded market costs one rescan. +// without emitting WithdrawCollateral. One query per market, keyed by that id alone: a key covering the +// whole set changes whenever the set does, which rescans every market from the deployment block, and a +// scan that fails there silently stops subtracting. Scoped this way each cache stays warm and a newly +// excluded market only scans itself. Single-value topic1 also survives the indexer, which flattens arrays. const getMarketsCollateral = async (api, ids) => { const { morphoBlue } = config[api.chain] const collateralById = new Map(ids.map((id) => [id, 0n])) if (!ids.length) return collateralById - const sortedIds = [...ids].sort() - const extraKey = `collateral-${ethers.id(sortedIds.join(',')).slice(2, 18)}` - const logs = await getMorphoLogs(api, { eventAbi: eventAbis.supplyCollateral, topics: [supplyCollateralTopic, sortedIds], extraKey }) - const calls = [...new Set(logs.map((log) => `${log.id.toLowerCase()}:${log.onBehalf.toLowerCase()}`))].map((key) => ({ params: key.split(':') })) - const positions = await api.multiCall({ target: morphoBlue, calls, abi: abi.morphoBlueFunctions.position }) + const logsByMarket = await Promise.all(ids.map((id) => getMorphoLogs(api, + { eventAbi: eventAbis.supplyCollateral, topics: [supplyCollateralTopic, id], extraKey: `collateral-${id}` }))) + const calls = [] + logsByMarket.forEach((logs, i) => { + // id comes from the market we queried for, not the log: a provider that widens the topic filter then + // costs extra calls that return zero collateral, instead of attributing them to an unknown market + new Set(logs.map((log) => log.onBehalf.toLowerCase())).forEach((user) => calls.push({ params: [ids[i], user] })) + }) + const positions = await api.multiCall({ target: morphoBlue, calls, abi: abi.morphoBlueFunctions.position, permitFailure: true }) + // a partial read understates the collateral and so overstates tvl by a plausible-looking amount; + // throw instead and let the caller keep the previous behaviour, which at least is a known one + const failed = positions.filter((i) => i === null).length + if (failed) throw new Error(`${failed}/${calls.length} position calls failed`) positions.forEach((position, i) => { const id = calls[i].params[0] - collateralById.set(id, collateralById.get(id) + BigInt(position.collateral)) + collateralById.set(id, (collateralById.get(id) ?? 0n) + BigInt(position.collateral)) }) return collateralById } From f723dc442dd6a18ff36359688d56cd79ac95d9ba Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 27 Oct 2026 11:22:59 -0400 Subject: [PATCH 470/988] track topaz amm (#21876) --- registries/uniswapV2.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index 73f79c91bdf..d26cf54db98 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -3265,6 +3265,20 @@ const uniV2Configs = { methodology: 'Value of the tokens held in the Ouro DEX V2 pairs on Robinhood Chain, enumerated from the factory. LP tokens staked in the Ouro farms are not added again.', robinhood: '0xaf0660Fd4d96F4e925AE85eba7A90a74C727fA2F', }, + 'topaz-amm': { + _options: { + abis: { + allPairsLength: 'uint256:allPoolsLength', + allPairs: 'function allPools(uint256) view returns (address)', + }, + hasStablePools: true, + }, + bsc: '0x65E6cD0eF5D3467030103cf3d433034E570b5784', + robinhood: '0x1E3aC31cF96b20619c913384C9bf6010A824fB95', + base: '0x1E3aC31cF96b20619c913384C9bf6010A824fB95', + ethereum: '0x1E3aC31cF96b20619c913384C9bf6010A824fB95', + arc: '0x1E3aC31cF96b20619c913384C9bf6010A824fB95', + }, } module.exports = buildProtocolExports(uniV2Configs, uniV2ExportFn) From 1b6c5d29f09fc53cb15098a94b0d66e4dd5edf86 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 27 Oct 2026 17:49:27 +0000 Subject: [PATCH 471/988] maple (#21882) --- projects/maple/index.js | 143 ++++++++++++++++++++++++++++++---------- 1 file changed, 108 insertions(+), 35 deletions(-) diff --git a/projects/maple/index.js b/projects/maple/index.js index d21feb87fd3..48aa7cfc399 100644 --- a/projects/maple/index.js +++ b/projects/maple/index.js @@ -2,7 +2,8 @@ * Maple Finance TVL & Borrowed Amounts Adapter * * This adapter fetches data from Maple Finance's GraphQL API to calculate: - * - Total Value Locked (TVL): Sum of all pool cash, cash in DeFi strategies, and collateral + * - Total Value Locked (TVL): Pool cash and cash in DeFi strategies on Ethereum, plus loan + * collateral booked on the chain it is actually custodied on (BTC on bitcoin, XRP on ripple, ...) * - Total Borrowed: Sum of all principal out (active loans) * - Total Staking: Sum of all staked assets in stSYRUP ERC-4626 vault * @@ -13,6 +14,7 @@ */ const ADDRESSES = require('../helper/coreAssets.json'); +const sdk = require('@defillama/sdk'); const axios = require('axios'); const stSYRUP = "0xc7E8b36E0766D9B04c93De68A9D47dD11f260B45"; @@ -20,25 +22,46 @@ const stSYRUP = "0xc7E8b36E0766D9B04c93De68A9D47dD11f260B45"; const POOL_V2_START_BLOCK = 16186377; const STAKING_START_BLOCK = 20735662; +// Loans are issued from Ethereum pools but the collateral is custodied natively, so each +// collateral asset is credited to its own chain instead of the pool's chain +const COLLATERALS = { + BTC: { chain: 'bitcoin', cgId: 'bitcoin' }, + XRP: { chain: 'ripple', token: ADDRESSES.ripple.XRP }, + HYPE: { chain: 'hyperliquid', cgId: 'hyperliquid' }, + SOL: { chain: 'solana', token: ADDRESSES.solana.SOL }, + jitoSOL: { chain: 'solana', token: 'J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn' }, + ETH: { chain: 'ethereum', token: ADDRESSES.null }, + WBTC: { chain: 'ethereum', token: ADDRESSES.ethereum.WBTC }, + LBTC: { chain: 'ethereum', token: ADDRESSES.ethereum.LBTC }, + cbBTC: { chain: 'ethereum', token: ADDRESSES.ethereum.cbBTC }, + sUSDS: { chain: 'ethereum', token: ADDRESSES.ethereum.sUSDS }, + USDG: { chain: 'ethereum', token: ADDRESSES.ethereum.USDG }, + USDC: { chain: 'ethereum', token: ADDRESSES.ethereum.USDC }, + USDT: { chain: 'ethereum', token: ADDRESSES.ethereum.USDT }, + USTB: { chain: 'ethereum', token: '0x43415eB6ff9DB7E26A15b704e7A3eDCe97d31C4e' }, + USDtb: { chain: 'ethereum', token: '0xC139190F447e929f090Edeb554D95AbB8b18aC1C' }, + weETH: { chain: 'ethereum', token: '0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee' }, + tETH: { chain: 'ethereum', token: '0xD11c452fc99cF405034ee446803b6F6c1F6d5ED8' }, + USR: { chain: 'ethereum', token: '0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110' }, + ATH: { chain: 'ethereum', token: '0xbe0Ed4138121EcFC5c0E56B40517da27E6c5226B' }, +}; + const ENDPOINT = "https://api.maple.finance/v2/graphql"; const POOLS_QUERY = ` query example($block: Block_height) { poolV2S(block: $block) { - id name collateralValue principalOut strategiesDeployed - tvl assets asset { symbol } poolMeta { - state - asset poolCollaterals { - addresses + assetSymbol + assetDecimals assetAmount } } @@ -46,41 +69,83 @@ const POOLS_QUERY = ` } `; +// every chain's tvl needs the same snapshot, keyed by run timestamp so only one request is made +const poolCache = {}; + /** - * Fetches pool data from Maple Finance's GraphQL API - * @param {number} block Ethereum block number - * @returns {Promise}}>>} Array of pool objects + * Fetches pool data from Maple Finance's GraphQL API, at the Ethereum block of the current run + * @param {Object} api DefiLlama SDK api object + * @returns {Promise}}>>} Array of pool objects */ -const getPools = async (block) => { - const payload = { - query: POOLS_QUERY, - variables: { block: { number: block - 10 } }, - headers: { "Content-Type": "application/json" } - }; +const getPools = async (api) => { + const key = api.timestamp ?? 'latest'; + if (!poolCache[key]) poolCache[key] = fetchPools(api); + return poolCache[key]; +}; + +const fetchPools = async (api) => { + const ethApi = api.chain === 'ethereum' ? api : new sdk.ChainApi({ chain: 'ethereum', timestamp: api.timestamp }); + const block = await ethApi.getBlock(); + if (block < POOL_V2_START_BLOCK) { + sdk.log('Maple: impossible to backfill - the queried block is earlier than the deployment block of poolsV2'); + return []; + } + + const payload = { query: POOLS_QUERY, variables: { block: { number: block - 10 } } }; const { data } = await axios.post(ENDPOINT, payload); return data.data.poolV2S; }; /** - * Calculates total value based on specified property and returns API response format + * Adds the loan collateral that is custodied on the given chain + * @param {Object} api DefiLlama SDK api object + * @param {Array} pools Pools returned by getPools + */ +const addCollateral = (api, pools) => { + pools.forEach(({ name, collateralValue, poolMeta }) => { + const collaterals = (poolMeta?.poolCollaterals ?? []).filter(({ assetAmount }) => Number(assetAmount) > 0); + // a pool that reports collateral but lists none would silently drop out of tvl + if (!collaterals.length && Number(collateralValue) > 0) throw new Error(`Maple: pool ${name} reports collateral but lists no collateral assets`); + collaterals.forEach(({ assetSymbol, assetDecimals, assetAmount }) => { + const collateral = COLLATERALS[assetSymbol]; + if (!collateral) throw new Error(`Maple: unmapped collateral asset ${assetSymbol} in pool ${name}`); + if (collateral.chain !== api.chain) return; + if (collateral.cgId) api.addCGToken(collateral.cgId, Number(assetAmount) / 10 ** assetDecimals); + else api.add(collateral.token, assetAmount); // Maple reports the amount in the token's own decimals + }); + }); +}; + +/** + * Pool cash plus cash deployed in DeFi strategies, both denominated in the pool asset * @param {Object} api DefiLlama SDK api object - * @param {string} key Property to sum - * @returns {Promise<{usd: number}>} Total value in USD */ -const processPools = async (api, key) => { - const block = await api.getBlock(); - - if (block < POOL_V2_START_BLOCK) return console.error('Error: Impossible to backfill - The queried block is earlier than the deployment block of poolsV2'); - const pools = await getPools(block); - - pools.forEach((pool) => { - const { id, name, asset: { symbol }, assets, collateralValue, principalOut, strategiesDeployed, poolMeta } = pool - const token = ADDRESSES.ethereum[symbol] ?? null +const addPoolCash = (api, pools) => { + pools.forEach(({ asset: { symbol }, assets, strategiesDeployed }) => { + const token = ADDRESSES.ethereum[symbol] ?? null; if (!token) return; - const balance = key === "collateralValue" ? Number(collateralValue) + Number(assets) + Number(strategiesDeployed) : Number(principalOut) - api.add(token, balance) - }) + api.add(token, Number(assets) + Number(strategiesDeployed)); + }); +}; + +const ethereumTvl = async (api) => { + const pools = await getPools(api); + addPoolCash(api, pools); + addCollateral(api, pools); +}; + +const collateralTvl = async (api) => { + addCollateral(api, await getPools(api)); +}; + +const borrowed = async (api) => { + const pools = await getPools(api); + pools.forEach(({ asset: { symbol }, principalOut }) => { + const token = ADDRESSES.ethereum[symbol] ?? null; + if (!token) return; + api.add(token, Number(principalOut)); + }); }; /** @@ -96,10 +161,18 @@ const staking = async (api) => { module.exports = { hallmarks: [['2022-12-14', 'V2 Deployment']], - solana: { tvl: () => ({})}, - ethereum: { - tvl: async (api) => processPools(api, "collateralValue"), - borrowed: async (api) => processPools(api), + // poolMeta.poolCollaterals is not block scoped - the API returns the current collateral for any + // block, so backfilling would rewrite history with today's holdings + timetravel: false, + methodology: 'TVL is pool cash and cash deployed in DeFi strategies on Ethereum, plus the loan collateral reported by the Maple API, each collateral asset counted on the chain it is custodied on. Borrowed is the principal outstanding on active loans, staking is the assets held in the stSYRUP vault.', + ethereum: { + tvl: ethereumTvl, + borrowed, staking - } + }, }; + +// derived from COLLATERALS so a newly mapped chain cannot be silently dropped for want of an export +Object.values(COLLATERALS).forEach(({ chain }) => { + if (chain !== 'ethereum' && !module.exports[chain]) module.exports[chain] = { tvl: collateralTvl }; +}); From 6aab5430c4d2b24b8bd57b526dd23ec45bd5996c Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 27 Oct 2026 18:07:30 +0000 Subject: [PATCH 472/988] mezzanine (#21883) --- projects/helper/morpoho.js | 18 ++++++++- projects/mezzanine/index.js | 76 +++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 projects/mezzanine/index.js diff --git a/projects/helper/morpoho.js b/projects/helper/morpoho.js index 397610e769c..eeafa06b3fc 100644 --- a/projects/helper/morpoho.js +++ b/projects/helper/morpoho.js @@ -60,6 +60,22 @@ function getMorphoVaultTvl(governor, { } +// Morpho Blue SharesMathLib, shared so market-position adapters do not each carry their own copy. +const VIRTUAL_SHARES = 1000000n +const VIRTUAL_ASSETS = 1n + +function toAssetsDown(shares, totalAssets, totalShares) { + return BigInt(shares) * (BigInt(totalAssets) + VIRTUAL_ASSETS) / (BigInt(totalShares) + VIRTUAL_SHARES) +} + +function toAssetsUp(shares, totalAssets, totalShares) { + const numerator = BigInt(shares) * (BigInt(totalAssets) + VIRTUAL_ASSETS) + const denominator = BigInt(totalShares) + VIRTUAL_SHARES + return (numerator + denominator - 1n) / denominator +} + module.exports = { - getMorphoVaultTvl + getMorphoVaultTvl, + toAssetsDown, + toAssetsUp, } diff --git a/projects/mezzanine/index.js b/projects/mezzanine/index.js new file mode 100644 index 00000000000..930e1c2dd81 --- /dev/null +++ b/projects/mezzanine/index.js @@ -0,0 +1,76 @@ +const { ethers } = require('ethers') +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs2 } = require('../helper/cache/getLogs') +const { getUniqueAddresses } = require('../helper/tokenMapping') +const { toAssetsDown, toAssetsUp } = require('../helper/morpoho') +const morphoAbi = require('../helper/abis/morpho.json').morphoBlueFunctions + +const MORPHO = '0xBBBBBbbBbb9CC5e90e3b3Af64bdAF62C37EEFFCb' +const WYLDS = '0x6aD038cA6C04e885630851278ca0a856Ad9a66Cc' +const ISSUANCE_VAULT = '0xbb03549117e38103589774ae1d6338d1b237ffa2' +const EXECUTOR = '0x43bC5fB52A618F0F2efb0d68Cf900Bb2FbD8a501' +const STRATEGY = '0x9A1dE53C14215272ae4dCFE35a650fd7151dc403' +const FROM_BLOCK = 25999777 // STRATEGY deploy + +const eventAbis = { + supplyCollateral: 'event SupplyCollateral(bytes32 indexed id, address indexed caller, address indexed onBehalf, uint256 assets)', + supply: 'event Supply(bytes32 indexed id, address indexed caller, address indexed onBehalf, uint256 assets, uint256 shares)', +} + +const onBehalf = ethers.zeroPadValue(STRATEGY.toLowerCase(), 32) + +async function getPositions(api) { + const [collateralLogs, supplyLogs] = await Promise.all([ + getLogs2({ + api, target: MORPHO, fromBlock: FROM_BLOCK, extraKey: 'supply-collateral', + eventAbi: eventAbis.supplyCollateral, + topics: [ethers.id('SupplyCollateral(bytes32,address,address,uint256)'), null, null, onBehalf], + }), + getLogs2({ + api, target: MORPHO, fromBlock: FROM_BLOCK, extraKey: 'supply', + eventAbi: eventAbis.supply, + topics: [ethers.id('Supply(bytes32,address,address,uint256,uint256)'), null, null, onBehalf], + }), + ]) + + const ids = [...new Set([...collateralLogs, ...supplyLogs].map(i => i.id.toLowerCase()))] + if (!ids.length) return [] + + const [params, markets, positions] = await Promise.all([ + api.multiCall({ target: MORPHO, abi: morphoAbi.idToMarketParams, calls: ids }), + api.multiCall({ target: MORPHO, abi: morphoAbi.market, calls: ids }), + api.multiCall({ target: MORPHO, abi: morphoAbi.position, calls: ids.map(id => ({ params: [id, STRATEGY] })) }), + ]) + + return ids.map((_, i) => ({ params: params[i], market: markets[i], position: positions[i] })) +} + +const debtOf = ({ market, position }) => toAssetsUp(position.borrowShares, market.totalBorrowAssets, market.totalBorrowShares) + +async function tvl(api) { + const positions = await getPositions(api) + + positions.forEach(({ params, market, position }) => { + if (BigInt(position.collateral) > 0n) api.add(params.collateralToken, position.collateral) + if (BigInt(position.supplyShares) > 0n) + api.add(params.loanToken, toAssetsDown(position.supplyShares, market.totalSupplyAssets, market.totalSupplyShares).toString()) + }) + + const tokens = getUniqueAddresses(positions.flatMap(i => [i.params.loanToken, i.params.collateralToken]).concat([WYLDS, ADDRESSES.ethereum.USDC]), api.chain) + await sumTokens2({ api, owners: [ISSUANCE_VAULT, EXECUTOR, STRATEGY], tokens }) + positions.forEach(p => api.add(p.params.loanToken, (-debtOf(p)).toString())) +} + +async function borrowed(api) { + const positions = await getPositions(api) + positions.forEach(p => api.add(p.params.loanToken, debtOf(p).toString())) +} + +module.exports = { + doublecounted: true, + start: '2026-10-12', + methodology: + 'TVL is the Hastra PRIME/AUTO collateral the Hastra Optimizer strategy holds on Morpho Blue, plus any loan assets it supplies and the balances idle in the issuance vault and executor, less its outstanding Morpho debt. The strategy loops PRIME/AUTO against borrowed stablecoins, so netting the debt leaves the vault NAV that backs the tranches. Marked doublecounted: the same collateral is counted under Morpho, and PRIME/AUTO are already tracked as Hastra RWA assets.', + ethereum: { tvl, borrowed }, +} From 837136d1afaa7e7f3c9d21d7c993677bcfeebed6 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 27 Oct 2026 14:19:33 -0400 Subject: [PATCH 473/988] blacklist rpc in capyfi (#21884) --- registries/compound.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registries/compound.js b/registries/compound.js index 45450f5bb68..41ae37c5056 100644 --- a/registries/compound.js +++ b/registries/compound.js @@ -83,7 +83,7 @@ const configs = { }, 'capyfi': { lac: { comptroller: '0x123Abe3A273FDBCeC7fc0EBedc05AaeF4eE63060', cether: '0x465ebfceb3953e2922b686f2b4006173664d16ce' }, - ethereum: { comptroller: '0x0b9af1fd73885aD52680A1aeAa7A3f17AC702afA', cether: '0x37DE57183491Fa9745d8Fa5DCd950f0c3a4645c9', blacklistedTokens: ['0xbaa6bc4e24686d710b9318b49b0bb16ec7c46bfa'] }, + ethereum: { comptroller: '0x0b9af1fd73885aD52680A1aeAa7A3f17AC702afA', cether: '0x37DE57183491Fa9745d8Fa5DCd950f0c3a4645c9', blacklistedTokens: ['0xbaa6bc4e24686d710b9318b49b0bb16ec7c46bfa', '0xed025a9fe4b30bcd68460bca42583090c2266468'] }, wc: { comptroller: '0x589d63300976759a0fc74ea6fA7D951f581252D7', cether: '0xaAd91abe333c4536FFbF02b83daBaB49C9Aa23ed' }, base: { comptroller: '0x00dc4965916e03A734190fA382633657c71f867E', cether: '0x654A9003Cb09ab8050D4Fdba12F4c5d3C60A548e' }, }, From 8b8b2d8443a31c41ea0428b57b4a9cd80a874a94 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 27 Oct 2026 14:38:10 -0400 Subject: [PATCH 474/988] add support for aave v4 hubs to curators helper and add sentora hub (#21885) --- projects/helper/curators/configs.js | 6 ++++++ projects/helper/curators/index.js | 20 ++++++++++++++++++++ projects/sentora/index.js | 3 +++ 3 files changed, 29 insertions(+) diff --git a/projects/helper/curators/configs.js b/projects/helper/curators/configs.js index ffaed9612f7..6d2e1c805ba 100644 --- a/projects/helper/curators/configs.js +++ b/projects/helper/curators/configs.js @@ -50,6 +50,12 @@ const ABI = { collateral: 'address:collateral', totalStake: 'uint256:totalStake', }, + aaveV4Hub: { + getAssetCount: 'uint256:getAssetCount', + getAssetUnderlyingAndDecimals: 'function getAssetUnderlyingAndDecimals(uint256) view returns (address, uint8)', + getAddedAssets: 'function getAddedAssets(uint256) view returns (uint256)', + getAssetDeficitRay: 'function getAssetDeficitRay(uint256) view returns (uint256)', + }, } const MorphoConfigs = { diff --git a/projects/helper/curators/index.js b/projects/helper/curators/index.js index 33cbe995725..6cb4fa19d15 100644 --- a/projects/helper/curators/index.js +++ b/projects/helper/curators/index.js @@ -547,6 +547,21 @@ async function getCuratorTvlSymbioticVault(api, vaults) { api.add(assets, totalStakes.map(v => v || 0)) } +// Aave V4 hubs: getAddedAssets() is what the spokes supplied (liquidity + swept + owed, net of fees), +// but it keeps bad debt in as deficit until it is covered, so the deficit is taken out +async function getCuratorTvlAaveV4Hub(api, hubs) { + const RAY = 10n ** 27n + const assetCounts = await api.multiCall({ abi: ABI.aaveV4Hub.getAssetCount, calls: hubs }) + const calls = hubs.flatMap((hub, i) => Array.from({ length: Number(assetCounts[i]) }, (_, assetId) => ({ target: hub, params: [assetId] }))) + const assets = await api.multiCall({ abi: ABI.aaveV4Hub.getAssetUnderlyingAndDecimals, calls }) + const added = await api.multiCall({ abi: ABI.aaveV4Hub.getAddedAssets, calls }) + const deficits = await api.multiCall({ abi: ABI.aaveV4Hub.getAssetDeficitRay, calls }) + assets.forEach(([underlying], i) => { + const amount = BigInt(added[i]) - BigInt(deficits[i]) / RAY + if (amount > 0n) api.add(underlying, amount) + }) +} + async function getNested4626Vaults(api, vaults) { const vaultAsset = await api.multiCall({ abi: ABI.ERC4626.asset, calls: vaults, permitFailure: true }) const nestedVaultAsset = await api.multiCall({ abi: ABI.ERC4626.asset, calls: vaultAsset, permitFailure: true }) @@ -724,6 +739,11 @@ async function getCuratorTvl(api, vaults) { await getCuratorTvlMidasToken(api, vaults.midasTokens) } + // aave v4 hubs where the curator is the hub's risk curator + if (vaults.aaveV4Hubs) { + await getCuratorTvlAaveV4Hub(api, vaults.aaveV4Hubs) + } + const shareVaults = [...booked, ...(vaults.accountableVaults || [])] // only vaults whose reads succeeded const otherVaults = ['aera', 'turtleclub', 'boringVaults', 'symbiotic', 'upshiftV2', 'nestedVaults'].flatMap(key => vaults[key] || []) await netCrossHoldings(api, shareVaults, [...shareVaults, ...otherVaults]) diff --git a/projects/sentora/index.js b/projects/sentora/index.js index 15d6c4d5349..e2ef269778d 100644 --- a/projects/sentora/index.js +++ b/projects/sentora/index.js @@ -104,6 +104,9 @@ const curatorExport = getCuratorExport({ morpho: ethereumMorphoVaults, morphoVaultOwners: ethereumMorphoVaultOwners, boringVaults: ethereumBoringVaults, + aaveV4Hubs: [ + '0xD138FcB0E8C52fDbB2Ac4573FA4d8925cf11e9c2', // Sentora hub + ], }, ink: { boringVaults: [ From a50a0ad8b006ac105459651ff6d83c4c617c1e52 Mon Sep 17 00:00:00 2001 From: RedVeil <44397805+RedVeil@users.noreply.github.com> Date: Tue, 27 Oct 2026 20:48:06 +0100 Subject: [PATCH 475/988] Travessia Credit: include additional chains (#21881) --- projects/travessia/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/travessia/index.js b/projects/travessia/index.js index 6b9819aed42..d12fb255157 100644 --- a/projects/travessia/index.js +++ b/projects/travessia/index.js @@ -19,4 +19,7 @@ module.exports = { methodology: 'TVL is total vault shares converted to underlying via convertToAssets.', monad: { tvl }, ethereum: { tvl }, + base: { tvl }, + polygon: { tvl }, + avax: { tvl }, } From ff5d73802f23a52e80cec0db7775f28cab05f78d Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 27 Oct 2026 23:50:17 -0400 Subject: [PATCH 476/988] add ownTokens to cex helper and adapters (#21803) --- cex/bybit.js | 8 ++++++++ cex/index.js | 9 +++++++++ cex/mexc-cex.js | 1 + cex/swissborg.js | 2 ++ cex/weex-cex.js | 1 + projects/binance/index.js | 27 ++++++++++++++++++++++----- projects/bitfinex/index.js | 1 + projects/bitget/index.js | 2 ++ projects/gate-io/index.js | 2 ++ projects/helper/cex.js | 12 ++++++++++-- projects/huobi/index.js | 1 + projects/kucoin/index.js | 2 ++ projects/okex/index.js | 2 ++ 13 files changed, 63 insertions(+), 7 deletions(-) diff --git a/cex/bybit.js b/cex/bybit.js index 5c12490e1be..59fd29b0d67 100644 --- a/cex/bybit.js +++ b/cex/bybit.js @@ -106,8 +106,16 @@ const EXTRA_TOKENS = { berachain: ['0x0000000000000000000000000000000000000000', '0x779Ded0c9e1022225f8E0630b35a9b54bE713736'], // BERA, USDT0 } +// MNT, reported under ownTokens instead of tvl +const OWN_TOKENS = { + ethereum: ['0x3c3a81e81dc49A522A592e7622A7E711c06bf354'], + mantle: ['0x0000000000000000000000000000000000000000'], +} + module.exports = { bitcoin: 'bybit' } for (const slug of new Set([...Object.values(CHAIN_MAP), ...Object.keys(STATIC_OWNERS)])) module.exports[slug] = { owners: async () => mergeOwners(slug, (await getOwners())[slug] || [], STATIC_OWNERS[slug] || []) } for (const [slug, tokens] of Object.entries(EXTRA_TOKENS)) module.exports[slug].tokens = tokens +for (const [slug, tokens] of Object.entries(OWN_TOKENS)) + module.exports[slug].ownTokens = tokens diff --git a/cex/index.js b/cex/index.js index 9fd0fbb2a13..71e5ad8c334 100644 --- a/cex/index.js +++ b/cex/index.js @@ -850,6 +850,7 @@ const configs = { 'crypto-com': { bitcoin: "cryptoCom", ethereum: { + ownTokens: ['0xa0b73e1ff0b80914ab6fe0444e65848c4c34450b'], // CRO owners: [ "0x72a53cdbbcc1b9efa39c834a540550e23463aacb", "0x6262998ced04146fa42253a5c0af90ca02dfd2a3", @@ -1656,6 +1657,7 @@ const configs = { }, 'nexo-cex': { ethereum: { + ownTokens: ['0xb62132e35a6c13ee1ee0f84dc5d40bad8d815206'], // NEXO owners: [ "0x8fd589aa8bfa402156a6d1ad323fec0ecee50d9d", "0xb60c61dbb7456f024f9338c739b02be68e3f545c", @@ -2254,6 +2256,7 @@ const configs = { 'woo-cex': { bitcoin: "wooCEX", ethereum: { + ownTokens: ['0x4691937a7508860F876c9c0a2a617E7d9E945D4B'], // WOO owners: [ "0x0d83f81bc9f1e8252f87a4109bbf0d90171c81df", "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4", @@ -2262,6 +2265,7 @@ const configs = { ] }, fantom: { + ownTokens: ['0x6626c47c00F1D87902fc13EECfaC3ed06D5E8D8a'], // WOO owners: [ "0x0d83f81bc9f1e8252f87a4109bbf0d90171c81df", "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4", @@ -2270,6 +2274,7 @@ const configs = { ] }, avax: { + ownTokens: ['0xabc9547b534519ff73921b1fba6e672b5f58d083'], // WOO owners: [ "0x0d83f81bc9f1e8252f87a4109bbf0d90171c81df", "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4", @@ -2278,6 +2283,7 @@ const configs = { ] }, bsc: { + ownTokens: ['0x4691937a7508860F876c9c0a2a617E7d9E945D4B'], // WOO owners: [ "0x0d83f81bc9f1e8252f87a4109bbf0d90171c81df", "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4", @@ -2286,6 +2292,7 @@ const configs = { ] }, arbitrum: { + ownTokens: ['0xcAFcD85D8ca7Ad1e1C6F82F651fA15E33AEfD07b'], // WOO owners: [ "0x0d83f81bc9f1e8252f87a4109bbf0d90171c81df", "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4", @@ -2294,6 +2301,7 @@ const configs = { ] }, polygon: { + ownTokens: ['0x1B815d120B3eF02039Ee11dC2d33DE7aA4a8C603'], // WOO owners: [ "0x0d83f81bc9f1e8252f87a4109bbf0d90171c81df", "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4", @@ -2302,6 +2310,7 @@ const configs = { ] }, optimism: { + ownTokens: ['0x871f2F2ff935FD1eD867842FF2a7bfD051A5E527'], // WOO owners: [ "0x0d83f81bc9f1e8252f87a4109bbf0d90171c81df", "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4", diff --git a/cex/mexc-cex.js b/cex/mexc-cex.js index 4f607c41ba9..dbe4862d27f 100644 --- a/cex/mexc-cex.js +++ b/cex/mexc-cex.js @@ -1,6 +1,7 @@ module.exports = { bitcoin: 'mexcCex', ethereum: { + ownTokens: ['0x11eef04c884e24d9b7b4760e7476d06ddf797f36'], // MX owners: [ "0x3cc936b795a188f0e246cbb2d74c5bd190aecf18", "0x0162cd2ba40e23378bf0fd41f919e1be075f025f", diff --git a/cex/swissborg.js b/cex/swissborg.js index 94bb7cc90ff..3abab4afb6e 100644 --- a/cex/swissborg.js +++ b/cex/swissborg.js @@ -1,5 +1,6 @@ module.exports = { ethereum: { + ownTokens: ['0x64d0f55Cd8C7133a9D7102b13987235F486F2224'], // BORG owners: [ '0x5770815B0c2a09A43C9E5AEcb7e2f3886075B605', '0x94596096320A6B4EaB43556AD1Ed8c4c3d51C9aA', @@ -53,6 +54,7 @@ module.exports = { ], }, solana: { + ownTokens: ['3dQTr7ror2QPKQ3GbBCokJUmjErGg8kTJzdnYjNfvi3Z'], // BORG owners: [ '2E1UKoiiZPwsp4vn6tUh5k61kG2UqYpT7oBrFaJUJXXd', '2XxP4kS2vfkiMvpLpGNxry3fPUYimsuAmSbqL1KnuwZ8', diff --git a/cex/weex-cex.js b/cex/weex-cex.js index 53187cadc78..b0abbf75807 100644 --- a/cex/weex-cex.js +++ b/cex/weex-cex.js @@ -1,5 +1,6 @@ module.exports = { ethereum: { + ownTokens: ['0x1b66474c8eca3827f16202907f41f63785579716'], // WXT owners: [ "0x7bceb96a8757114d79c7dcd6b52c460202f17d13", "0xc3b77c3f5a733986558c91e0faf95f1659b1b9b6", diff --git a/projects/binance/index.js b/projects/binance/index.js index 9a8f75affe9..3f419574946 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -117,28 +117,31 @@ const perChainConfig = { ] }, bsc: { + ownTokens: [nullAddress], // BNB blacklistedTokens: [ ADDRESSES.bsc.TUSD, ADDRESSES.bsc.wBETH, // wBETH ...binanceBridgedTokens, ] }, + op_bnb: { ownTokens: [nullAddress] }, // BNB solana: { blacklistedTokens: ['7XU84evF7TH4suTuL8pCXxA6V2jrE8jKA6qsbUpQyfCY', 'CQvadZTR8vikRqqwyhvYV8YpdfCRjUCGyQwCuY4rxBQt'] }, } function buildConfig(chain, owners, binanceTokensOnChain, wrappedTokens) { const base = perChainConfig[chain] || {} - let { tokensAndOwners, tokens, blacklistedTokens, fungibleAssets } = base + let { tokensAndOwners, tokens, blacklistedTokens = [], fungibleAssets, ownTokens = [], ...rest } = base if (!tokensAndOwners && !tokens && chain !== 'solana') { tokens = defaultTokens[chain] if (!tokens) tokens = [nullAddress] } - if (!blacklistedTokens) blacklistedTokens = [] + // BNB is reported under ownTokens instead of tvl + blacklistedTokens = [...ownTokens, ...blacklistedTokens] if (wrappedTokens && wrappedTokens.length) blacklistedTokens.push(...wrappedTokens) - const options = { ...base, owners, tokens, chain, blacklistedTokens, permitFailure: true } // while filling historical data, some tokens may not exist on the chain yet, so we permit failure + const options = { ...rest, tokensAndOwners, owners, tokens, chain, blacklistedTokens, permitFailure: true } // while filling historical data, some tokens may not exist on the chain yet, so we permit failure if (binanceTokensOnChain && binanceTokensOnChain.length) { if (!options.tokens) options.tokens = [] @@ -158,7 +161,7 @@ function buildConfig(chain, owners, binanceTokensOnChain, wrappedTokens) { return options } -const tvl = async (api) => { +async function getOwners(api) { const chain = api.chain.toLowerCase() const networks = chainToNetworks[chain] @@ -193,16 +196,30 @@ const tvl = async (api) => { }) const owners = [...new Set([...contracts, ...lockInfoAddresses])] + return { owners, wrappedTokens } +} +const tvl = async (api) => { + const chain = api.chain.toLowerCase() + const { owners, wrappedTokens } = await getOwners(api) const binanceTokensOnChain = await getCEXTokensOnBinanceOnChain(chain) const options = buildConfig(chain, owners, binanceTokensOnChain, wrappedTokens) return await sumTokensExport(options)(api) } +const ownTokens = async (api) => { + const chain = api.chain.toLowerCase() + const { owners } = await getOwners(api) + return await sumTokensExport({ chain, owners, tokens: perChainConfig[chain].ownTokens, permitFailure: true })(api) +} + const chainExports = {} const chains = new Set(Object.values(binanceToDefillama)) -chains.forEach((chain) => { chainExports[chain] = { tvl } }) +chains.forEach((chain) => { + chainExports[chain] = { tvl } + if (perChainConfig[chain]?.ownTokens) chainExports[chain].ownTokens = ownTokens +}) const ethStakedExport = { ethereum: { tvl: getStakedEthTVL({ withdrawalAddresses, size: 200, sleepTime: 20_000, proxy: true }) } } diff --git a/projects/bitfinex/index.js b/projects/bitfinex/index.js index d89c5144db1..03e70e57c67 100644 --- a/projects/bitfinex/index.js +++ b/projects/bitfinex/index.js @@ -7,6 +7,7 @@ const config = { owners: bitcoinAddressBook.bitfinex, }, ethereum: { + ownTokens: ['0x2af5d2ad76741191d15dfe7bf6ac92d4bd912ca3'], // LEO owners: [ '0x77134cbc06cb00b66f4c7e623d5fdbf6777635ec', // ETH/ERC20 hot wallet '0x742d35Cc6634C0532925a3b844Bc454e4438f44e', // ETH/ERC20 cold wallet diff --git a/projects/bitget/index.js b/projects/bitget/index.js index 841388955d3..a4e900feab7 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -349,6 +349,8 @@ config.kava.owners.push("0x602e1c0d892ab4fecb472863b05acd8b1ac4fc01") // kava1vq config.ethereum.blacklistedTokens = [ "0x19de6b897ed14a376dda0fe53a5420d2ac828a28", // old bitget token ] +config.ethereum.ownTokens = ["0x54d2252757e1672eead234d27b1270728ff90581"] // BGB +config.morph.ownTokens = ["0x389C08Bc23A7317000a1FD76c7c5B0cb0b4640b5"] // BGB const withdrawalAddresses = [ '0x334cf9ceef9178c7a9bb5495ac8790e9bed316a3', diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index 3fe079428c7..d2728916307 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -10,6 +10,7 @@ const { addThetaBalances } = require("../helper/chain/theta.js"); const config = { "ethereum": { + ownTokens: ['0xE66747a101bFF2dBA3697199DCcE5b743b454759'], // GT "owners": [ "0x0d0707963952f2fba59dd06f2b425ace40b492fe", "0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c", @@ -1070,6 +1071,7 @@ const config = { ] }, "gatelayer": { + ownTokens: [ADDRESSES.null], // GT (native) "owners": [ "0x0d0707963952f2fba59dd06f2b425ace40b492fe", "0xc882b111a75c0c657fc507c04fbfcd2cc984f071" diff --git a/projects/helper/cex.js b/projects/helper/cex.js index e5296891b91..435d1f6ef07 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -562,7 +562,7 @@ function cexExports(config) { } if (btcExport) exportObj.bitcoin = { tvl: btcExport } chains.forEach(chain => { - let { tokensAndOwners, owners, tokens, blacklistedTokens, fungibleAssets } = config[chain] + let { tokensAndOwners, owners, tokens, blacklistedTokens = [], fungibleAssets, ownTokens = [], ...rest } = config[chain] if (!tokensAndOwners && !tokens && chain !== 'solana') { tokens = defaultTokens[chain] @@ -572,7 +572,7 @@ function cexExports(config) { } } - const options = { ...config[chain], owners, tokens, chain, blacklistedTokens } + const options = { ...rest, tokensAndOwners, owners, tokens, chain, blacklistedTokens: [...ownTokens, ...blacklistedTokens] } if (svmChainsSet.has(chain)) options.solOwners = owners // count native balances on all SVM chains if (chain === 'solana') { if (!options.blacklistedTokens) options.blacklistedTokens = [] @@ -601,6 +601,14 @@ function cexExports(config) { return sumTokensExport(runtimeOptions)(api) } } + + if (ownTokens.length > 0) { + exportObj[chain].ownTokens = async (api) => { + let owners = typeof options.owners === 'function' ? await options.owners(api) : options.owners + if (!owners) owners = [...new Set(tokensAndOwners.map(([, owner]) => owner))] + return sumTokensExport({ chain, owners, tokens: ownTokens, permitFailure: true })(api) + } + } }) if (config.bep2) { exportObj.bsc = exportObj.bsc ?? { tvl: () => ({}) } diff --git a/projects/huobi/index.js b/projects/huobi/index.js index e702e7d2790..42656e8ad04 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -7,6 +7,7 @@ const config = { owners: bitcoinAddressBook.huobi, }, ethereum: { + ownTokens: ['0x6f259637dcd74c767781e37bc6133cd6a68aa161'], // HT owners: [ "0xa929022c9107643515f5c777ce9a910f0d1e490c", "0x18709e89bd403f470088abdacebe86cc60dda12e", diff --git a/projects/kucoin/index.js b/projects/kucoin/index.js index c3a5bc1d9ec..bf2b77e00bf 100644 --- a/projects/kucoin/index.js +++ b/projects/kucoin/index.js @@ -4,6 +4,7 @@ const { mergeExports, getStakedEthTVL } = require("../helper/utils"); const config = { ethereum: { + ownTokens: ['0xf34960d9d60be18cC1D5Afc1A6F012A723a28811'], // KCS owners: [ "0x061f7937b7b2bc7596539959804f86538b6368dc", "0x1692e170361cefd1eb7240ec13d048fd9af6d667", @@ -132,6 +133,7 @@ const config = { ], }, kcc: { + ownTokens: ['0x0000000000000000000000000000000000000000'], // KCS (native) owners: [ "0x14ea40648fc8c1781d19363f5b9cc9a877ac2469", "0x2a8c8b09bd77c13980495a959b26c1305166a57f", diff --git a/projects/okex/index.js b/projects/okex/index.js index 800ad30c32d..b0dad52f761 100644 --- a/projects/okex/index.js +++ b/projects/okex/index.js @@ -8,6 +8,7 @@ const { nullAddress } = require("../helper/tokenMapping"); const config = { bitcoin: { owners: bitcoinAddressBook.okex }, ethereum: { + ownTokens: ['0x75231f58b43240c9718dd58b4967c5114342a86c'], // OKB owners: [ "0x03ae1a796dfe0400439211133d065bda774b9d3e", "0x5041ed759dd4afc3a72b8192c143f72f4724081a", @@ -687,6 +688,7 @@ const config = { ], }, xlayer: { + ownTokens: [ADDRESSES.null], // OKB (native) owners: [ "0x0f5a137dce05fb40d1ff1880db49e088a8bf8224", "0xdc9700dc816d8fa38d7ee201e4d3a8f35fdf6a8f", From a0941072628ef624c70ccbf6ac6d355f72c9fe03 Mon Sep 17 00:00:00 2001 From: "duke.sol" <77286113+cryptoduke01@users.noreply.github.com> Date: Wed, 28 Oct 2026 08:38:06 +0100 Subject: [PATCH 477/988] Gloam: add Base and Ethereum (#21893) --- projects/gloam/index.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/projects/gloam/index.js b/projects/gloam/index.js index e3db5fab386..93bd5682fc1 100644 --- a/projects/gloam/index.js +++ b/projects/gloam/index.js @@ -1,31 +1,38 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getLogs2 } = require('../helper/cache/getLogs') -// Gloam's shielded pool (ShieldPoolPayments), the same address on both chains. +// Gloam's shielded pool (ShieldPoolPayments), the same address on every chain. const POOL = '0x39e28cde55cab798874746ac52cb4b5cc99a0194' const GLOAM = '0xDcD885F5c60b3aD49F6D58718696417314e8724d' const OUSD = '0x20c0000000000000000000006a37da5c996874be' // pool balance minus the cash-out fees it holds for feeRecipient async function addPoolBalances(api, tokens) { + if (!tokens.length) return const balances = await api.getTokenBalances({ owner: POOL, tokens }) const fees = await api.multiCall({ abi: 'function feesOwed(address) view returns (uint256)', target: POOL, calls: tokens }) tokens.forEach((token, i) => api.add(token, BigInt(balances[i]) - BigInt(fees[i]))) } +// the assets the pool accepts, from its DepositLimitSet events +async function poolAssets(api, fromBlock) { + const logs = await getLogs2({ api, target: POOL, eventAbi: 'event DepositLimitSet(address indexed asset, uint128 perDeposit, uint128 total)', fromBlock, extraKey: 'deposit-limit-set' }) + return [...new Set(logs.map(l => l.asset.toLowerCase()))].filter(t => t !== GLOAM.toLowerCase()) +} + +const fromLogs = (fromBlock) => ({ tvl: async (api) => addPoolBalances(api, await poolAssets(api, fromBlock)) }) + module.exports = { - methodology: 'TVL is the tokens held by the Gloam shielded pool on Robinhood Chain and Tempo, minus the cash-out fees the pool holds for the fee recipient. On Robinhood Chain the accepted assets are discovered from the pool\'s DepositLimitSet events. $GLOAM held in the pool is the protocol\'s own token and is counted under staking.', + methodology: 'TVL is the tokens held by the Gloam shielded pool on Robinhood Chain, Tempo, Base and Ethereum, minus the cash-out fees the pool holds for the fee recipient. On Robinhood Chain, Base and Ethereum the accepted assets are discovered from the pool\'s DepositLimitSet events. $GLOAM held in the pool is the protocol\'s own token and is counted under staking.', start: '2026-10-21', robinhood: { - tvl: async (api) => { - const logs = await getLogs2({ api, target: POOL, eventAbi: 'event DepositLimitSet(address indexed asset, uint128 perDeposit, uint128 total)', fromBlock: 94194599, extraKey: 'deposit-limit-set' }) - const tokens = [...new Set(logs.map(l => l.asset.toLowerCase()))].filter(t => t !== GLOAM.toLowerCase()) - await addPoolBalances(api, tokens) - }, + tvl: async (api) => addPoolBalances(api, await poolAssets(api, 94194599)), staking: (api) => addPoolBalances(api, [GLOAM]), }, tempo: { // static: the SDK's Tempo RPC rejects getLogs ranges; these are all of the pool's DepositLimitSet assets tvl: (api) => addPoolBalances(api, [ADDRESSES.tempo.pathUSD, ADDRESSES.tempo.USDC_E, ADDRESSES.tempo.USDT0, OUSD]), }, + base: fromLogs(53109632), + ethereum: fromLogs(26276183), } From e46cfc7816a907a193ef79db5ee5f7f169cfecd8 Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Wed, 28 Oct 2026 08:39:13 +0100 Subject: [PATCH 478/988] uniswap-v2: add world chain (#21891) --- projects/uniswap-v2/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/uniswap-v2/index.js b/projects/uniswap-v2/index.js index 7fe0599dd6c..8ace61e87e7 100644 --- a/projects/uniswap-v2/index.js +++ b/projects/uniswap-v2/index.js @@ -27,6 +27,7 @@ const config = { robinhood: '0x8bcEaA40B9AcdfAedF85AdF4FF01F5Ad6517937f', ink: '0xfe57a6ba1951f69ae2ed4abe23e0f095df500c04', arc: '0x89e5db8b5aa49aa85ac63f691524311aeb649eba', + wc: '0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f', } Object.keys(config).forEach(chain => { From e8310e26129c042078cd8b61eefca23bc33cd2b4 Mon Sep 17 00:00:00 2001 From: Ali Baig <69807734+AliBaig-xD@users.noreply.github.com> Date: Wed, 28 Oct 2026 08:39:54 +0100 Subject: [PATCH 479/988] fix(litecoin, binance): throw when a Litecoin balance lookup fails (#21888) --- projects/binance/index.js | 2 ++ projects/helper/chain/litecoin.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/binance/index.js b/projects/binance/index.js index 3f419574946..0b4eb8e4724 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -177,6 +177,7 @@ async function getOwners(api) { const evmChains = ['ethereum', 'bsc', 'celo', 'chz', 'polygon', 'arbitrum', 'arc', 'optimism', 'avax', 'fantom', 'base', 'era', 'manta', 'ronin', 'robinhood', 'op_bnb', 'scroll', 'sonic', 'plasma', 'klaytn','sei', 'kava', 'wc'] const isEvm = evmChains.includes(chain) + const porAddresses = new Set(contracts.map(a => a.toLowerCase())) const lockInfoAddresses = [] const wrappedTokens = [] @@ -185,6 +186,7 @@ async function getOwners(api) { if (!networks.includes(li.network.toUpperCase())) return if (!li.address || /^[A-Z0-9]+-[A-Z0-9]+$/i.test(li.address)) return if (isEvm && (!/^0x[0-9a-fA-F]{40}$/.test(li.address))) return + if (porAddresses.has(li.address.toLowerCase())) return // already in PoR, sometimes lowercased (invalid on case-sensitive chains like LTC) lockInfoAddresses.push(li.address) }); (token.wrapInfo || []).forEach(wi => { diff --git a/projects/helper/chain/litecoin.js b/projects/helper/chain/litecoin.js index 531ae6c1812..6f6c2f5d108 100644 --- a/projects/helper/chain/litecoin.js +++ b/projects/helper/chain/litecoin.js @@ -13,13 +13,14 @@ async function getBalance(addr) { async function sumTokens({ balances = {}, owners = [] }) { let total = 0 - await PromisePool + const { errors } = await PromisePool .withConcurrency(5) .for(owners) .process(async owner => { const balance = await getBalance(owner) total += balance }) + if (errors && errors.length) throw errors[0] sdk.util.sumSingleBalance(balances, 'litecoin', total) return balances } From 27615d98c9c73e9d6c6c862b06f44932a673fa34 Mon Sep 17 00:00:00 2001 From: routebuilder Date: Wed, 28 Oct 2026 08:40:40 +0100 Subject: [PATCH 480/988] fix(arcadia-finance-v2): retry failed account batches instead of dropping them (#21878) --- projects/arcadia-finance-v2/index.js | 69 ++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 20 deletions(-) diff --git a/projects/arcadia-finance-v2/index.js b/projects/arcadia-finance-v2/index.js index e0c121b29c5..a9521e4504d 100644 --- a/projects/arcadia-finance-v2/index.js +++ b/projects/arcadia-finance-v2/index.js @@ -199,6 +199,41 @@ async function uwrapStakedSlipstreamLP({ api, sSlipNftIds, nft, }) { await unwrapSlipstreamNFT({ api, positionIds: sSlipNftIds, nftAddress: nft, }); } +/** + * Fetch spot asset data for one group of accounts from Arcadia's API. + * Retries network errors, 408, 429 and 5xx up to three times, then throws so a + * failed group is never dropped from the chain total. + * @param {string[]} accountGroup account addresses sent in a single request + * @param {number} chainId Arcadia chain id + * @returns {Promise} API response + */ +async function fetchAssetData(accountGroup, chainId) { + const addressParams = accountGroup.map(addr => `account_addresses=${addr}`).join('&'); + let lastError; + for (let attempt = 0; attempt < 3; attempt++) { + try { + return await utils.fetchURL(`https://api.arcadia.finance/v1/api/accounts/spot_asset_data?${addressParams}&chain_id=${chainId}`); + } catch (error) { + lastError = error; + const status = error.response?.status; + if (status && status !== 408 && status !== 429 && status < 500) throw error; + if (attempt < 2) { + const retryAfter = error.response?.headers?.['retry-after']; + const seconds = Number(retryAfter); + const headerDelay = Number.isFinite(seconds) ? seconds * 1000 : Date.parse(retryAfter) - Date.now(); + // clamp valid Retry-After to 30s max: wait the full allowed time instead of short backoff + const delay = headerDelay > 30000 ? 30000 : headerDelay > 0 ? headerDelay : 1000 * 2 ** attempt; + await new Promise(resolve => setTimeout(resolve, delay)); + } + } + } + throw lastError; +} + +/** + * Sums the value of every Arcadia account plus the protocol's own pools on one chain. + * @param {object} api DefiLlama ChainApi + */ async function tvl (api) { const chainConfig = config[api.chain]; const { factory, pools, uniNFT, uniV4NFT, slipNFT, slipV2NFT, slipV3NFT, wAeroNFT, sAeroNFT, sSlipNFT, sSlipV2NFT, sSlipV3NFT, alienBaseNFT, wsSlipNFT, wsSlipV2NFT, wsSlipV3NFT, metadexCLNFT, sMetadexCLNFT, wsMetadexCLNFT, wMetadexNFT, sMetadexNFT, wMetadexSpotNFT, wsMetadexNFT, resolveSlipstreamV2, resolveSlipstreamV3, chainId } = chainConfig; @@ -241,30 +276,24 @@ async function tvl (api) { } await Promise.all(requestBatches.map(async (accountGroup) => { - try { - const addressParams = accountGroup.map(addr => `account_addresses=${addr}`).join('&'); - const assetDataCall = await utils.fetchURL(`https://api.arcadia.finance/v1/api/accounts/spot_asset_data?${addressParams}&chain_id=${chainId}`); + const assetDataCall = await fetchAssetData(accountGroup, chainId); - // Process each account's data from the batched response - assetDataCall.data.forEach((assetData, index) => { - const account = accountGroup[index]; - if (!assetData || !assetData[0][0] || assetData[0][0].length < 1) return; + // Process each account's data from the batched response + assetDataCall.data.forEach((assetData, index) => { + const account = accountGroup[index]; + if (!assetData || !assetData[0][0] || assetData[0][0].length < 1) return; - ownerTokens.push([assetData[0][0], account]) - if (!assetData[0][0].length || !assetData[0][1].length || assetData[0][1] == "0") return; - ownerIds.push([assetData[0][0], assetData[0][1], account]) - accs.push(account) + ownerTokens.push([assetData[0][0], account]) + if (!assetData[0][0].length || !assetData[0][1].length || assetData[0][1] == "0") return; + ownerIds.push([assetData[0][0], assetData[0][1], account]) + accs.push(account) - for (let i = 0; i < assetData[0][0].length; i++) { - if (assetData[0][0][i] === uniV4NFT) { - uniV4Ids.push(assetData[0][1][i]); - } + for (let i = 0; i < assetData[0][0].length; i++) { + if (assetData[0][0][i] === uniV4NFT) { + uniV4Ids.push(assetData[0][1][i]); } - }); - } catch (error) { - console.log(`Failed to fetch/process data for accounts ${accountGroup.join(', ')}:`, error); - return; - } + } + }); })); api.log(`[arcadia] Processed batch ${Math.ceil((i + accountsPerBatch) / accountsPerBatch)} of ${Math.ceil(v2Accounts.length / accountsPerBatch)} for v2 accounts.`); From 5488f6430264ee8c021752eb4fdbb73f97951c16 Mon Sep 17 00:00:00 2001 From: Kimi <31831349+Uhan19@users.noreply.github.com> Date: Wed, 28 Oct 2026 00:41:01 -0700 Subject: [PATCH 481/988] Add NAVI Curator (Lagoon vault on Ethereum) (#21889) Co-authored-by: ccipherx --- registries/curators.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/registries/curators.js b/registries/curators.js index 848a6d5c2a2..8786750a55f 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -1787,7 +1787,19 @@ const configs = { }, } } - } + }, + "navi-curator": { + config: { + methodology: "Counts totalAssets() of the Lagoon vaults curated by NAVI Protocol. Deposits are bridged to Sui and supplied to NAVI lending markets through NAVI vaults, so they are also counted under NAVI Lending and Lagoon.", + blockchains: { + ethereum: { + erc4626: [ + '0x47491305479635357df29fe0cb6f1af10e51d4da', // Lagoon: USDC High Yield (nUSDC) + ], + }, + }, + }, + }, } const allProtocols = {} From 85c9b41bf001a3b0d9e3e5fc996232479bc8ef65 Mon Sep 17 00:00:00 2001 From: quotumorg <337712588+quotumorg@users.noreply.github.com> Date: Wed, 28 Oct 2026 14:41:20 +0700 Subject: [PATCH 482/988] Add Quotum restricted NVDA reserve to treasury tracking (#21892) Co-authored-by: ccipherx --- registries/treasury.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/registries/treasury.js b/registries/treasury.js index ea9bcc004ca..7b3fae036c8 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -4699,6 +4699,13 @@ const configs = { owners: ['0xf32e759d5f1c63ed62042497d3a50f044ee0982b'], }, }, + 'treasury/quotum': { + robinhood: { + owners: ['0x42AbC7b64eD47dB6899b4F01Aa6c765c600a53a2'], // TaxSink + tokens: [ADDRESSES.robinhood.NVDA], + fetchCoValentTokens: false, + }, + }, 'treasury/raac': { ethereum: { tokens: [ From 17cb09968f88f88200884acb19aeeb8e37fbead0 Mon Sep 17 00:00:00 2001 From: Polypup <85349906+Polypup@users.noreply.github.com> Date: Wed, 28 Oct 2026 03:43:53 -0400 Subject: [PATCH 483/988] Add TickerSpring Baskets; TickerSpring Vaults: new vaults + fix (#21890) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/tickerspring-vaults/index.js | 106 +++++++++++++++++++++----- registries/balancer.js | 8 ++ 2 files changed, 95 insertions(+), 19 deletions(-) diff --git a/projects/tickerspring-vaults/index.js b/projects/tickerspring-vaults/index.js index 2a475f29ed6..a77620931f4 100644 --- a/projects/tickerspring-vaults/index.js +++ b/projects/tickerspring-vaults/index.js @@ -1,7 +1,12 @@ +// Vaults that replaced V7 (the audited release, live 2026-10-23), one per pool on Uniswap V3, Uniswap V4, Up or Ramses. +// Each is deployed directly by the TickerSpring admin wallet (no factory), so the list comes from the TickerSpring API; +// every balance is read on-chain. +const VAULTS_API = 'https://api.tickerspring.com/v1/merged/vaults' + // V7 vault inventory: https://tickerspring.com/docs#contracts -// Same cohort as dimension-adapters fees/tickerspring-vaults/deployments.ts. Earlier vault versions -// (listed with their balances at https://api.tickerspring.com/v1/public/vaults) hold no deposits. -const vaults = [ +// Same cohort as dimension-adapters fees/tickerspring-vaults/deployments.ts. Their holders are moving to the vaults +// above; a V7 vault that everyone has left keeps no position. +const v7Vaults = [ '0xF8DE3bC8F4e577Bc59f166b1DAA391c8C69c73D5', // AMZN '0x5eaD63f22B2cF752d0F4aE4bcA2BD51cf83A641e', // AAPL '0x6bAb969D9927c8B17BC9dd42851c7b96E014532d', // AMD @@ -22,28 +27,41 @@ const vaults = [ '0x78814fdC1AfD07ae859409F44B5D57DeA6798eF6', // TSLA ] +const ADDRESSES = require('../helper/coreAssets.json') const { ethers } = require('ethers') +const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') const { sumTokens2, addUniV3LikePosition } = require('../helper/unwrapLPs') const V3_NPM = '0x73991a25C818Bf1f1128dEAaB1492D45638DE0D3' const V4_STATE_VIEW = '0xf3334192d15450cdd385c8b70e03f9a6bd9e673b' const abi = { - // Vault balances minus protocol/buyback fee reserves and quarantined tokens + // V7 vault balances minus protocol/buyback fee reserves and quarantined tokens idle: 'function idle() view returns (uint256 a, uint256 b)', - // V4 venues expose a V3-style positions() over a PoolManager position they own, salted with the tokenId + // V7 V4 venues expose a V3-style positions() over a PoolManager position they own, salted with the tokenId key: 'function key() view returns (address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)', positions: 'function positions(uint256) view returns (uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256, uint256, uint128, uint128)', getSlot0: 'function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)', getPositionInfo: 'function getPositionInfo(bytes32 poolId, address owner, int24 tickLower, int24 tickUpper, bytes32 salt) view returns (uint128 liquidity, uint256, uint256)', + // Vaults: a full signature, not the 'address:' shorthand, which the SDK caches per contract across blocks (a vault + // has no venue before its deployment) + venue: 'function venue() view returns (address)', + // Vaults: per-token protocol and buyback fee reserves, which are not depositors' assets + protocolFees: 'function protocolFees(address token) view returns (uint256)', + buybackFees: 'function buybackFees(address token) view returns (uint256)', + // Vault venues: the vault's liquidity position and its pool's current price + position: 'function position() view returns (int24 tickLower, int24 tickUpper, uint128 liquidity)', + spot: 'function spot() view returns (uint160 sqrtPriceX96, int24 tick)', } -async function tvl(api) { +// Adds the idle balances and V4 positions; returns the owners of V3 position NFTs +async function addV7Vaults(api) { const [token0s, token1s, idles, positions] = await Promise.all([ - api.multiCall({ abi: 'address:token0', calls: vaults }), - api.multiCall({ abi: 'address:token1', calls: vaults }), - api.multiCall({ abi: abi.idle, calls: vaults }), - api.multiCall({ abi: 'address:position', calls: vaults }), + api.multiCall({ abi: 'address:token0', calls: v7Vaults }), + api.multiCall({ abi: 'address:token1', calls: v7Vaults }), + api.multiCall({ abi: abi.idle, calls: v7Vaults }), + api.multiCall({ abi: 'address:position', calls: v7Vaults }), ]) idles.forEach(({ a, b }, i) => { api.add(token0s[i], a) @@ -59,34 +77,84 @@ async function tvl(api) { positions.forEach((position, i) => { if (managers[i] === V3_NPM) v3Owners.push(position) else if (managers[i] === pools[i]) v4.push({ position, venue: pools[i] }) - else throw new Error(`Unknown position manager ${managers[i]} for vault ${vaults[i]}`) + else throw new Error(`Unknown position manager ${managers[i]} for vault ${v7Vaults[i]}`) }) - const [keys, tokenIds] = await Promise.all([ - api.multiCall({ abi: abi.key, calls: v4.map(v => v.venue) }), - api.multiCall({ abi: 'uint256:tokenId', calls: v4.map(v => v.position) }), + // tokenId 0: the PoolManager position was closed (positions(0) reverts) + const tokenIds = await api.multiCall({ abi: 'uint256:tokenId', calls: v4.map(v => v.position) }) + const open = v4.map((v, i) => ({ ...v, tokenId: tokenIds[i] })).filter(v => Number(v.tokenId) !== 0) + const [keys, ranges] = await Promise.all([ + api.multiCall({ abi: abi.key, calls: open.map(v => v.venue) }), + api.multiCall({ abi: abi.positions, calls: open.map(v => ({ target: v.venue, params: [v.tokenId] })) }), ]) - const ranges = await api.multiCall({ abi: abi.positions, calls: v4.map((v, i) => ({ target: v.venue, params: [tokenIds[i]] })) }) const poolIds = keys.map(k => ethers.keccak256(ethers.AbiCoder.defaultAbiCoder().encode( ['address', 'address', 'uint24', 'int24', 'address'], [k.currency0, k.currency1, k.fee, k.tickSpacing, k.hooks]))) const [slot0s, infos] = await Promise.all([ api.multiCall({ abi: abi.getSlot0, target: V4_STATE_VIEW, calls: poolIds }), api.multiCall({ - abi: abi.getPositionInfo, target: V4_STATE_VIEW, calls: v4.map(({ venue }, i) => ({ - params: [poolIds[i], venue, ranges[i].tickLower, ranges[i].tickUpper, ethers.zeroPadValue(ethers.toBeHex(tokenIds[i]), 32)], + abi: abi.getPositionInfo, target: V4_STATE_VIEW, calls: open.map(({ venue, tokenId }, i) => ({ + params: [poolIds[i], venue, ranges[i].tickLower, ranges[i].tickUpper, ethers.zeroPadValue(ethers.toBeHex(tokenId), 32)], })), }), ]) - v4.forEach((_, i) => addUniV3LikePosition({ + open.forEach((_, i) => addUniV3LikePosition({ api, token0: keys[i].currency0, token1: keys[i].currency1, liquidity: Number(infos[i].liquidity), tickLower: Number(ranges[i].tickLower), tickUpper: Number(ranges[i].tickUpper), tick: Number(slot0s[i].tick), })) + return v3Owners +} + +async function addVaults(api) { + const listed = await getConfig('tickerspring/vaults', undefined, { + fetcher: async () => { + const vaults = (await get(VAULTS_API)).data.vaults.map(v => v.vault) + if (!vaults.length) throw new Error('tickerspring: empty vault list') // keeps the last good cache + return vaults + }, + }) + // A vault deployed after the queried block has no code yet + const venues = await api.multiCall({ abi: abi.venue, calls: listed, permitFailure: true }) + const vaults = listed.filter((_, i) => venues[i]) + const live = venues.filter(Boolean) + const [usdgs, tokens, rewardTokens, token0s, token1s, positions, spots] = await Promise.all([ + api.multiCall({ abi: 'address:usdg', calls: vaults }), + api.multiCall({ abi: 'address:token', calls: vaults }), + api.multiCall({ abi: 'address:rewardToken', calls: vaults }), + api.multiCall({ abi: 'address:token0', calls: live }), + api.multiCall({ abi: 'address:token1', calls: live }), + api.multiCall({ abi: abi.position, calls: live }), + api.multiCall({ abi: abi.spot, calls: live }), + ]) + + // USDG, the pool token and (Up and Ramses vaults) the UP or RAM reward, net of the fee reserves; + // USDG waiting for a deposit fill is included + const holdings = vaults.flatMap((vault, i) => [usdgs[i], tokens[i], rewardTokens[i]] + .filter(token => token !== ADDRESSES.null).map(token => ({ vault, token }))) + const [balances, protocolFees, buybackFees] = await Promise.all([ + api.multiCall({ abi: 'erc20:balanceOf', calls: holdings.map(({ vault, token }) => ({ target: token, params: [vault] })) }), + api.multiCall({ abi: abi.protocolFees, calls: holdings.map(({ vault, token }) => ({ target: vault, params: [token] })) }), + api.multiCall({ abi: abi.buybackFees, calls: holdings.map(({ vault, token }) => ({ target: vault, params: [token] })) }), + ]) + holdings.forEach(({ token }, i) => { + const held = BigInt(balances[i]) - BigInt(protocolFees[i]) - BigInt(buybackFees[i]) + if (held > 0n) api.add(token, held) + }) + + live.forEach((_, i) => addUniV3LikePosition({ + api, token0: token0s[i], token1: token1s[i], liquidity: Number(positions[i].liquidity), + tickLower: Number(positions[i].tickLower), tickUpper: Number(positions[i].tickUpper), tick: Number(spots[i].tick), + })) +} + +async function tvl(api) { + const v3Owners = await addV7Vaults(api) + await addVaults(api) return sumTokens2({ api, uniV3nftsAndOwners: v3Owners.map(owner => [V3_NPM, owner]) }) } module.exports = { - methodology: 'TVL is the USDG and Stock Tokens held for depositors by the TickerSpring V7 vaults on Robinhood Chain: each vault\'s idle balances net of protocol fee reserves, plus the liquidity of its Uniswap V3 NFT or Uniswap V4 PoolManager position, valued at the pool price. Uncollected LP fees are excluded. The positions sit in Uniswap pools, so this TVL is also counted by the Uniswap adapters.', + methodology: 'TVL is the tokens held for depositors by the TickerSpring vaults on Robinhood Chain: the vaults listed by https://api.tickerspring.com/v1/merged/vaults (one per pool on Uniswap V3, Uniswap V4, Up or Ramses) and the V7 vaults their holders are moving from. Each vault counts its USDG, Stock Token or other pool token, and reward token balances net of protocol fee reserves, plus the liquidity of its pool position valued at the pool\'s current tick. Uncollected LP fees are excluded. The positions sit in Uniswap, Up and Ramses pools, so this TVL is also counted by those DEX adapters.', doublecounted: true, start: '2026-09-12', // all V7 vaults were deployed 2026-09-11 19:51-20:35 UTC robinhood: { tvl }, diff --git a/registries/balancer.js b/registries/balancer.js index d6fdc680daf..cbf2d3898e5 100644 --- a/registries/balancer.js +++ b/registries/balancer.js @@ -158,6 +158,14 @@ const configs = { _options: { helperType: 'v3' }, robinhood: { vault: '0xB055000fbE3cc9bDE7742C583a86cc6283E3fF85', fromBlock: 24180135 }, }, + 'tickerspring-baskets': { + _options: { helperType: 'v3' }, + methodology: 'TVL is the tokens held by the TickerSpring Balancer V3 vault on Robinhood Chain for its baskets: weighted pools of Stock Tokens, crypto tokens and USDG or WETH. SPRING, the TickerSpring token, is excluded.', + start: '2026-10-08', // vault deployed 2026-10-08 20:09 UTC + robinhood: { vault: '0xb01B26D72EB3a5d7846C36fc21e4e3B96994DaF2', fromBlock: 83584185, blacklistedTokens: [ + '0x440e339a46eaa3bE8d723c2cBED2A30af74536D5', // SPRING, the parent protocol's token + ] }, + }, // ===== Balancer V1 (v1Tvl) ===== 'valueliquid': { From a029dc9a1e8c10cef7db343231f3ab02a5a3b4fd Mon Sep 17 00:00:00 2001 From: MWMbase Date: Wed, 28 Oct 2026 08:44:31 +0100 Subject: [PATCH 484/988] add Megawatt Markets (#21887) Co-authored-by: ccipherx --- registries/sumTokens/data3.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index cf59f73bbca..8453e178850 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1254,4 +1254,10 @@ module.exports = { "blacklistedTokens": ["HgTGdc29D5bDMrDvsCLnorxz899VyDj7ZN7FPa6vpump"], // $VEIL }, }, + "megawatt-markets": { + "methodology": "USDC trader collateral deposited in the Megawatt Markets CollateralVault on Arbitrum.", + "arbitrum": { + "tvl": { "owner": "0xAfE63c71bA1D70992C9d7B01c0F1eD5c51941a8f", "tokens": [ADDRESSES.arbitrum.USDC_CIRCLE] }, + } + }, } From 99c157dde7807b405700af64b91ab6a911aa2009 Mon Sep 17 00:00:00 2001 From: Dani Date: Wed, 28 Oct 2026 09:39:57 +0100 Subject: [PATCH 485/988] jusd-finance: count aleo deposits on aleo (#21898) Co-authored-by: Claude --- projects/jusd-finance/index.js | 70 ++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/projects/jusd-finance/index.js b/projects/jusd-finance/index.js index ac9edecaaa7..500d9a435e9 100644 --- a/projects/jusd-finance/index.js +++ b/projects/jusd-finance/index.js @@ -1,37 +1,67 @@ const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') +const { getProgramMappingValue } = require('../helper/chain/aleo') // JUSD allocates deposited USDC across yield strategies, principally delta-neutral -// funding trades plus lending. It is issued through two vaults: Accountable on -// Ethereum and Venzo on Arbitrum. TVL is each vault's share supply valued in USDC -// with convertToAssets(), which covers idle USDC and capital deployed to strategies. +// funding trades plus lending. It is issued through two vaults, Accountable on Ethereum and +// Venzo on Arbitrum, and through jusd_vault_arc_production.aleo on Aleo, which takes USDCx deposits +// on Aleo, bridges them to Ethereum (Circle xReserve) and holds Ethereum JUSD through its adapter. +// Each deposit is credited to the chain it was made on, as Makina credits a machine's spoke +// capital to its hub chain and nets nested machine shares out of the machine they were bought in. const VAULTS = { - ethereum: [ - '0x2B5895b716311A1eaC8f93fB88C56aF9eC8C1A69', // JUSD vault (Accountable) - ], - arbitrum: [ - '0x9519217E8926A2B39BAcD2d6EC3EfD02503595E2', // JUSD vault (Venzo) - ], + ethereum: '0x2B5895b716311A1eaC8f93fB88C56aF9eC8C1A69', // JUSD vault (Accountable) + arbitrum: '0x9519217E8926A2B39BAcD2d6EC3EfD02503595E2', // JUSD vault (Venzo) } - -// Native USDC on both chains (the Arbitrum vault holds native USDC, not bridged USDC.e) const USDC = { ethereum: ADDRESSES.ethereum.USDC, - arbitrum: ADDRESSES.arbitrum.USDC_CIRCLE, + arbitrum: ADDRESSES.arbitrum.USDC_CIRCLE, // native USDC, not USDC.e +} +const ALEO_ADAPTER = '0x65DD658a02FaAdD866423cc08Dde9c89fFE345aA' // Ethereum side of the Aleo vault +const ALEO_ADAPTER_BLOCK = 26096619 // adapter deployment (1 Oct 2026) +const ALEO_VAULT = 'aleo1dkf9r56swfvdd62n0wjx083jqqjkk0yrrh304gwv8ntft7lpdggqplajaa' // jusd_vault_arc_production.aleo, live since 22 Oct 2026 +const adapterStateAbi = 'function state() view returns (uint256 usdcBal, uint256 jusdBal, uint256 pending, uint256 claimable)' +const convertToAssetsAbi = 'function convertToAssets(uint256) view returns (uint256)' + +// Ethereum JUSD shares held for Aleo depositors (held, queued and claimable), plus USDC waiting in the adapter +async function aleoPosition(ethApi) { + if (await ethApi.getBlock() < ALEO_ADAPTER_BLOCK) return { shares: 0n, usdc: 0n } + const s = await ethApi.call({ target: ALEO_ADAPTER, abi: adapterStateAbi }) + return { shares: BigInt(s.jusdBal) + BigInt(s.pending) + BigInt(s.claimable), usdc: BigInt(s.usdcBal) } } async function tvl(api) { - const vaults = VAULTS[api.chain] - const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: vaults }) - const assets = await api.multiCall({ - abi: 'function convertToAssets(uint256) view returns (uint256)', - calls: vaults.map((vault, i) => ({ target: vault, params: [supplies[i]] })), - }) - assets.forEach((amount) => api.add(USDC[api.chain], amount)) + const vault = VAULTS[api.chain] + let shares = BigInt(await api.call({ target: vault, abi: 'erc20:totalSupply' })) + if (api.chain === 'ethereum') shares -= (await aleoPosition(api)).shares // counted on Aleo instead + const assets = await api.call({ target: vault, abi: convertToAssetsAbi, params: [shares.toString()] }) + api.add(USDC[api.chain], assets) +} + +async function aleoTvl(api) { + const ethApi = new sdk.ChainApi({ chain: 'ethereum', timestamp: api.timestamp }) + if (await ethApi.getBlock() < ALEO_ADAPTER_BLOCK) return + const { shares, usdc } = await aleoPosition(ethApi) + let total = usdc + if (shares > 0n) total += BigInt(await ethApi.call({ target: VAULTS.ethereum, abi: convertToAssetsAbi, params: [shares.toString()] })) + // USDCx held by the Aleo vault (deposits not yet bridged, redemptions not yet claimed); current state only + total += await aleoUsdcx() + api.addCGToken('usd-coin', Number(total) / 1e6) +} + +async function aleoUsdcx() { + try { + const v = await getProgramMappingValue('usdcx_stablecoin.aleo', 'balances', ALEO_VAULT) + return v ? BigInt(String(v).replace(/u\d+$/, '')) : 0n + } catch (e) { + if (e.response && e.response.status === 404) return 0n // no balance entry + throw e + } } module.exports = { - methodology: 'TVL is the USDC value of the two JUSD vaults, the Accountable vault on Ethereum and the Venzo vault on Arbitrum: each vault\'s share supply valued with convertToAssets(), covering idle USDC and capital allocated to strategies (principally delta-neutral funding trades, plus lending). The Ethereum vault is also part of Accountable, so this listing is marked as double counted.', + methodology: 'TVL is the USDC value of JUSD on each chain it is issued on: the Accountable vault on Ethereum and the Venzo vault on Arbitrum (share supply valued with convertToAssets(), covering idle USDC and capital allocated to strategies, principally delta-neutral funding trades plus lending), and jusd_vault_arc_production.aleo on Aleo. Aleo deposits are bridged to Ethereum and held as Ethereum JUSD by the vault\'s adapter; that position is counted on Aleo, where the deposits were made, and subtracted from Ethereum, so nothing is counted twice. The Ethereum vault is also part of Accountable, so this listing is marked as double counted.', doublecounted: true, ethereum: { tvl }, arbitrum: { tvl }, + aleo: { tvl: aleoTvl }, } From a4b2f9aa423fb675d46ba9c24f6e20157c9eb55f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 28 Oct 2026 12:19:20 +0100 Subject: [PATCH 486/988] update @defillama/sdk version --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 5f745fb53e4..2d77145f783 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", - "@defillama/sdk": "5.0.244", + "@defillama/sdk": "5.0.245", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", "@supercharge/promise-pool": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4f035df0229..d7c5900c837 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^0.30.1 version: 0.30.1(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) '@defillama/sdk': - specifier: 5.0.244 - version: 5.0.244(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) + specifier: 5.0.245 + version: 5.0.245(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) '@project-serum/anchor': specifier: ^0.26.0 version: 0.26.0(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -269,8 +269,8 @@ packages: peerDependencies: '@solana/web3.js': ^1.68.0 - '@defillama/sdk@5.0.244': - resolution: {integrity: sha512-c3pxyQvsFPGkUvbTWWzMD2bXbP8T331E3Zucj1DLFbGGbiEs1jMDTTN0yHQ4EI4qAAzGSk9IPMpMue8OjKPQww==} + '@defillama/sdk@5.0.245': + resolution: {integrity: sha512-QgvTYM+Ax9eAJLqjTpal2G+40+J61lKrBS7LG1uktblUpU5L7UOBDzSGC2fu19V3VCM5MRoLblqTNBuFTR2yFw==} peerDependencies: '@solana/web3.js': '>=1.73.0' peerDependenciesMeta: @@ -1941,7 +1941,7 @@ snapshots: bn.js: 5.2.2 buffer-layout: 1.2.2 - '@defillama/sdk@5.0.244(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': + '@defillama/sdk@5.0.245(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': dependencies: '@aws-sdk/client-s3': 3.913.0 '@elastic/elasticsearch': 8.19.1(supports-color@7.2.0) From 8c7eee3b6b8541ae0a39328a58ef43cbbb0e6b3e Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 28 Oct 2026 11:46:37 +0000 Subject: [PATCH 487/988] egas swap (#21901) --- registries/sumTokens.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index d3b85f799b9..543de6c0caf 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -13893,7 +13893,7 @@ const configs = { }, }, "egas-swap": { - "methodology": "TVL is calculated as the total on-chain assets held by the EGAS Swap proxy contract. It includes balances of all supported ERC20 swap assets held by the proxy and the chain's native gas token (EGAS) held by the proxy (tracked via nullAddress). ", + "methodology": "TVL is calculated as the balances of all supported ERC20 swap assets held by the EGAS Swap proxy contract. The chain's native gas token (EGAS) held by the proxy is excluded. ", "eni": { "owners": [ "0x37CCd90ed5FA96207B41C4fBCB90b883e30e63DC" @@ -13901,8 +13901,8 @@ const configs = { "tokens": [ ADDRESSES.eni.USDT_1, ADDRESSES.eni.USDT_2, - ADDRESSES.eni.USDT, - ADDRESSES.null + ADDRESSES.eni.USDT + // native EGAS excluded: proxy holds 84.8M, 44x the wrapped supply and 74x all ENI chain TVL, marked off one $54k/day pool ] }, }, From 3b45a16060dcb939e855fe3cc0ab7568ae2785fa Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Wed, 28 Oct 2026 15:16:39 +0100 Subject: [PATCH 488/988] uniswap-v4: add linea and hyperevm (#21897) --- projects/uniswap-v4/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/uniswap-v4/index.js b/projects/uniswap-v4/index.js index e3b646b9cf2..049cfee9886 100644 --- a/projects/uniswap-v4/index.js +++ b/projects/uniswap-v4/index.js @@ -31,6 +31,8 @@ const config = { wc: { factory: "0xb1860d529182ac3bc1f51fa2abd56662b7d13f33", fromBlock: 9111872 }, ink: { factory: "0x360e68faccca8ca495c1b759fd9eee466db9fb32", fromBlock: 4580556 }, celo: { factory: "0x288dc841a52fca2707c6947b3a777c5e56cd87bc", fromBlock: 43985163 }, + hyperliquid: { factory: "0x12d4fd9c5dedd00ab8a0bce2cf0167bbf94b6b1f", fromBlock: 45998366 }, + linea: { factory: "0x248083fb965359d82b06c1f5322480dcfc1ad857", fromBlock: 28974969 }, soneium: { factory: "0x360e68faccca8ca495c1b759fd9eee466db9fb32", fromBlock: 2473300, useIndexerSql: true }, avax: { factory: "0x06380c0e0912312b5150364b9dc4542ba0dbbc85", fromBlock: 56195376, useIndexerSql: true }, bsc: { factory: "0x28e2ea090877bf75740558f6bfb36a5ffee9e9df", fromBlock: 45970610, useIndexerSql: true, blacklistedTokens: ['0xb4357054c3dA8D46eD642383F03139aC7f090343', '0x8145eb83744aac883b68ae34060bebb5031d8f5c', From 5916f8c59000ce1013544f69182dfb0404757236 Mon Sep 17 00:00:00 2001 From: "Edouard.m.333" <115162814+Edouard-m-333@users.noreply.github.com> Date: Wed, 28 Oct 2026 20:11:08 +0530 Subject: [PATCH 489/988] Add Fynd AMM TVL adapter (#21899) Co-authored-by: Claude Opus 5.5 --- projects/fynd-amm/index.js | 117 +++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 projects/fynd-amm/index.js diff --git a/projects/fynd-amm/index.js b/projects/fynd-amm/index.js new file mode 100644 index 00000000000..1cee6886ce5 --- /dev/null +++ b/projects/fynd-amm/index.js @@ -0,0 +1,117 @@ +const sdk = require('@defillama/sdk') +const { getLogs } = require('../helper/cache/getLogs') + +// Fynd AMM pools are Ekubo v3 pools that use Fynd's SignedExclusiveSwap extension. +// Ekubo Core holds the tokens of every pool, so TVL is rebuilt per pool from the liquidity stored at its ticks. +const CORE = '0x00000000000014aA86C5d3c41765bb24e11bd701' + +const EXTENSION_V1 = '0x55b703eED01b35641963da2FB2E14885993605A3' +const EXTENSION = '0x550CFe1292d0D9c0d28f232b3F42Edb4439B1D09' + +// fromBlock is the block in which the first Fynd AMM pool was initialized on that chain. +const config = { + ethereum: { extensions: [EXTENSION_V1, EXTENSION], fromBlock: 25689059 }, + robinhood: { extensions: [EXTENSION], fromBlock: 72277109 }, + base: { extensions: [EXTENSION], fromBlock: 53151641 }, + bsc: { extensions: [EXTENSION], fromBlock: 130064169 }, +} + +// Test pools that are not listed in the Fynd app. +const excludedPools = new Set([ + '0x22c2b655277ac0d151ab5844d49f3ddf6118e555e35be89d3cf3f476647af38b', // ethereum USDC/WETH + '0x29936f43df20cce7583ff081144b26fc8984cd38d3f413f04695640928729524', // robinhood USDG/UBIK + '0xf893e7a59d7645501877e680332860a61f784332e7e722a5e9bb9a8cbad38656', // robinhood SPY/USDG +]) + +const eventAbis = { + poolInitialized: 'event PoolInitialized(bytes32 poolId, (address token0, address token1, bytes32 config) poolKey, int32 tick, uint96 sqrtRatio)', + positionUpdated: 'event PositionUpdated(address locker, bytes32 poolId, bytes32 positionId, int128 liquidityDelta, bytes32 balanceUpdate, bytes32 stateAfter)', +} + +// Core exposes raw storage through `sload()`: the slots to read follow the selector in calldata. +const SLOAD_SELECTOR = '0x380eb4e0' +// Tick info is stored at slot poolId + tick + TICKS_OFFSET (Ekubo CoreStorageLayout). +const TICKS_OFFSET = 0x435a5eb89a296820174331cf5a3902d9fca683928d56726d8e7acd6efb28c568n +const SLOAD_BATCH = 500 + +// Ekubo prices are 1.000001^tick, so the square root price is 1.000001^(tick / 2). +const sqrtPrice = (tick) => Math.pow(1.000001, tick / 2) +const toInt32 = (value) => Number(BigInt.asIntN(32, value)) +const toSlot = (value) => BigInt.asUintN(256, value).toString(16).padStart(64, '0') + +async function sload(api, slots) { + const words = [] + for (let i = 0; i < slots.length; i += SLOAD_BATCH) { + const data = SLOAD_SELECTOR + slots.slice(i, i + SLOAD_BATCH).map(toSlot).join('') + const res = await sdk.getProvider(api.chain).call({ to: CORE, data, blockTag: api.block ?? undefined }) + for (let j = 2; j < res.length; j += 64) words.push(BigInt('0x' + res.slice(j, j + 64))) + } + return words +} + +async function tvl(api) { + const { fromBlock } = config[api.chain] + const extensions = new Set(config[api.chain].extensions.map((extension) => BigInt(extension))) + + // The top 20 bytes of a pool config are its extension, so this finds every Fynd AMM pool on-chain. + const initialized = await getLogs({ api, target: CORE, eventAbi: eventAbis.poolInitialized, fromBlock, onlyArgs: true, extraKey: 'fynd-amm-pools' }) + const pools = {} + initialized.forEach(({ poolId, poolKey }) => { + if (!extensions.has(BigInt(poolKey.config) >> 96n) || excludedPools.has(poolId.toLowerCase())) return + pools[poolId.toLowerCase()] = { token0: poolKey.token0, token1: poolKey.token1, ticks: new Set() } + }) + const poolIds = Object.keys(pools) + if (!poolIds.length) return + + // A position ID packs salt (24 bytes), lower tick and upper tick. The logs only give the ticks that + // positions have used; the liquidity at each tick is then read from Core, so it is always current. + const updates = await getLogs({ api, target: CORE, eventAbi: eventAbis.positionUpdated, fromBlock, onlyArgs: true, extraKey: 'fynd-amm-positions' }) + updates.forEach(({ poolId, positionId }) => { + const pool = pools[poolId.toLowerCase()] + if (!pool) return + const id = BigInt(positionId) + pool.ticks.add(toInt32(id >> 32n)) + pool.ticks.add(toInt32(id)) + }) + + // Pool state is stored at slot `poolId`: sqrtRatio (96 bits) | tick (32 bits) | liquidity (128 bits). + // Tick info is liquidityNet (128 bits) | liquidityDelta (int128). + const slots = [] + poolIds.forEach((poolId) => { + const pool = pools[poolId] + pool.ticks = [...pool.ticks].sort((a, b) => a - b) + slots.push(BigInt(poolId)) + pool.ticks.forEach((tick) => slots.push(BigInt(poolId) + BigInt(tick) + TICKS_OFFSET)) + }) + const words = await sload(api, slots) + + let i = 0 + poolIds.forEach((poolId) => { + const { token0, token1, ticks } = pools[poolId] + const current = sqrtPrice(toInt32(words[i++] >> 128n)) + let liquidity = 0n + let amount0 = 0 + let amount1 = 0 + ticks.forEach((tick, j) => { + liquidity += BigInt.asIntN(128, words[i++]) + if (j === ticks.length - 1 || liquidity <= 0n) return + const sqrtLower = sqrtPrice(tick) + const sqrtUpper = sqrtPrice(ticks[j + 1]) + const price = Math.min(Math.max(current, sqrtLower), sqrtUpper) + amount0 += Number(liquidity) * (1 / price - 1 / sqrtUpper) + amount1 += Number(liquidity) * (price - sqrtLower) + }) + api.add(token0, Math.floor(amount0)) + api.add(token1, Math.floor(amount1)) + }) +} + +module.exports = { + methodology: 'TVL is the value of the liquidity deposited in Fynd AMM pools. Fynd AMM pools are Ekubo v3 pools that use the Fynd SignedExclusiveSwap extension. The adapter finds these pools from Ekubo Core PoolInitialized events, collects the position ticks from PositionUpdated events, reads the current liquidity at each tick from Ekubo Core storage, and converts it to token amounts at the current pool price. Three test pools that are not listed in the Fynd app are excluded. Uncollected fees are not counted.', + doublecounted: true, + start: '2026-08-05', // first Fynd AMM pool initialized on Ethereum, block 25689059 +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl } +}) From b73d6bec7f991b00796c1c250f033c981ce45fe2 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 28 Oct 2026 11:03:20 -0400 Subject: [PATCH 490/988] Add Alokumi (#21905) Co-authored-by: maoring24 --- projects/alokumi/index.js | 113 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 projects/alokumi/index.js diff --git a/projects/alokumi/index.js b/projects/alokumi/index.js new file mode 100644 index 00000000000..2918b5875d5 --- /dev/null +++ b/projects/alokumi/index.js @@ -0,0 +1,113 @@ +const { PublicKey } = require('@solana/web3.js') +const { bs58 } = require('@project-serum/anchor/dist/cjs/utils/bytes') +const { getConnection, getMultipleAccounts, decodeAccount, sumTokens2 } = require('../helper/solana') +const { POSITION_V2_DISCRIMINATOR } = require('../helper/utils/solana/layouts/meteora-dlmm-layout') + +// Alokumi Vault: one non-custodial vault PDA per Agent; it holds the idle tokens and owns the agent's Meteora DLMM positions +const VAULT_PROGRAM = new PublicKey('B2zdd56urxgCWBoUKiaot1wT68rX1uqQ5oor4CyFwMZY') +const DLMM_PROGRAM = new PublicKey('LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo') + +const VAULT_DISCRIMINATOR = bs58.encode(Buffer.from('d308e82b02987577', 'hex')) +// VaultPosition ["vpos", vault, position]: one per live DLMM position of a vault, closed together with the position +const VAULT_POSITION_DISCRIMINATOR = bs58.encode(Buffer.from('7a6dc13f45945aed', 'hex')) +const VAULT_POSITION_VAULT_OFFSET = 10 // discriminator 8 + version 1 + bump 1 +const DLMM_POSITION_OWNER_OFFSET = 40 // discriminator 8 + lb_pair 32 +const BINS_PER_ARRAY = 70 +const DLMM_POSITION_BASE_SIZE = 8120 // resized positions append 112 bytes per extra bin, liquidity share first +const DLMM_EXTRA_BIN_SIZE = 112 + +const readU128 = (data, offset) => data.readBigUInt64LE(offset) + (data.readBigUInt64LE(offset + 8) << 64n) + +async function getVaults(connection) { + const accounts = await connection.getProgramAccounts(VAULT_PROGRAM, { + filters: [{ memcmp: { offset: 0, bytes: VAULT_DISCRIMINATOR } }], + dataSlice: { offset: 0, length: 0 }, + }) + return accounts.map(({ pubkey }) => pubkey.toBase58()) +} + +async function getVaultPositions(connection) { + const accounts = await connection.getProgramAccounts(VAULT_PROGRAM, { + filters: [{ memcmp: { offset: 0, bytes: VAULT_POSITION_DISCRIMINATOR } }], + dataSlice: { offset: VAULT_POSITION_VAULT_OFFSET, length: 64 }, // vault, position + }) + return accounts.map(({ account }) => ({ + vault: new PublicKey(account.data.subarray(0, 32)).toBase58(), + position: new PublicKey(account.data.subarray(32, 64)), + })) +} + +const binArrayKey = (lbPair, binId) => { + const index = Buffer.alloc(8) + index.writeBigInt64LE(BigInt(Math.floor(binId / BINS_PER_ARRAY))) + return PublicKey.findProgramAddressSync([Buffer.from('bin_array'), lbPair.toBuffer(), index], DLMM_PROGRAM)[0].toBase58() +} + +async function addDlmmPositions(api, vaultPositions) { + const infos = await getMultipleAccounts(vaultPositions.map(i => i.position)) + const positions = [] + infos.forEach((info, i) => { + if (!info || !info.owner.equals(DLMM_PROGRAM)) return + if (!info.data.subarray(0, 8).equals(POSITION_V2_DISCRIMINATOR)) return + // the DLMM position must still be owned by the vault that registered it + if (new PublicKey(info.data.subarray(DLMM_POSITION_OWNER_OFFSET, DLMM_POSITION_OWNER_OFFSET + 32)).toBase58() !== vaultPositions[i].vault) return + const position = decodeAccount('meteoraPosition', info) + const shares = position.liquidityShares.map(share => BigInt(share.toString())) + for (let offset = DLMM_POSITION_BASE_SIZE; offset < info.data.length; offset += DLMM_EXTRA_BIN_SIZE) + shares.push(readU128(info.data, offset)) + positions.push({ + lbPair: position.lbPair, + lower: Number(position.lowerBinId), + upper: Number(position.upperBinId), + shares, + }) + }) + if (!positions.length) return + + const pairKeys = [...new Set(positions.map(p => p.lbPair.toBase58()))] + const binArrayKeys = new Set() + for (const { lbPair, lower, upper, shares } of positions) + for (let binId = lower; binId <= upper; binId++) + if (shares[binId - lower] > 0n) binArrayKeys.add(binArrayKey(lbPair, binId)) + const binArrayList = [...binArrayKeys] + + const pairs = {} + ;(await getMultipleAccounts(pairKeys)).forEach((info, i) => pairs[pairKeys[i]] = decodeAccount('meteoraLbPair', info)) + const binArrays = {} + ;(await getMultipleAccounts(binArrayList)).forEach((info, i) => { if (info) binArrays[binArrayList[i]] = decodeAccount('meteoraBinArray', info) }) + + for (const { lbPair, lower, upper, shares } of positions) { + const pair = pairs[lbPair.toBase58()] + let amountX = 0n + let amountY = 0n + for (let binId = lower; binId <= upper; binId++) { + const share = shares[binId - lower] + if (!share) continue + const binArray = binArrays[binArrayKey(lbPair, binId)] + if (!binArray) throw new Error(`Missing Meteora bin array for ${lbPair.toBase58()} bin ${binId}`) + const bin = binArray.bins[binId - Number(binArray.index) * BINS_PER_ARRAY] + const supply = BigInt(bin.liquiditySupply.toString()) + if (!supply) continue + amountX += share * BigInt(bin.amountX.toString()) / supply + amountY += share * BigInt(bin.amountY.toString()) / supply + } + api.add(pair.tokenXMint.toBase58(), amountX.toString()) + api.add(pair.tokenYMint.toBase58(), amountY.toString()) + } +} + +async function tvl(api) { + const connection = getConnection(api.chain) + const vaults = await getVaults(connection) + const vaultPositions = await getVaultPositions(connection) + await addDlmmPositions(api, vaultPositions) + // idle tokens waiting in the vaults (deposits not yet deployed, withdrawn liquidity, claimed fees), Token and Token-2022 + return sumTokens2({ api, owners: vaults }) +} + +module.exports = { + timetravel: false, + doublecounted: true, + methodology: 'Counts the assets held by Alokumi Vaults (one non-custodial vault PDA of the Alokumi Vault program per Agent): idle token balances of the vaults plus the principal of the Meteora DLMM positions they own, valued from the pools\' on-chain state. Unclaimed fees and rewards, and the owners\' SOL rent/gas reserves, are excluded. The DLMM positions are also counted by Meteora.', + solana: { tvl }, +} From ca6cd486c82a60089c34c8453e7eadf55100000d Mon Sep 17 00:00:00 2001 From: Reinis Melbardis Date: Wed, 28 Oct 2026 15:16:03 +0000 Subject: [PATCH 491/988] Add Nexus Mutual RWI Vault (#21902) --- registries/erc4626.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/registries/erc4626.js b/registries/erc4626.js index 4af89007931..a5efd1b0cd0 100644 --- a/registries/erc4626.js +++ b/registries/erc4626.js @@ -544,6 +544,12 @@ const configs = { methodology: 'Counts DIEM in the wstDIEM vault via totalAssets(): idle DIEM plus DIEM the vault has staked on Venice or is unstaking, minus DIEM owed to queued redemptions.', base: ['0xe49FA849cB37b0e7A42B2335e333fb99474167ba'], }, + 'nexus-mutual-rwi-vault': { + start: '2026-03-16', + doublecounted: true, + methodology: 'Counts the USDC value of RWI Vault shares via totalAssets(), which accrues at the on-chain fixed yield rate. Deposits are deployed by the Vault Operator into tokenised onchain and offchain insurance opportunities. Assets are held as Pendle PT-reUSDe, so the same capital is also counted in Re and Pendle TVL.', + ethereum: ['0xcAFeAA466736ac01e0AC9Ca72644beF348694731'], + }, } module.exports = buildProtocolExports(configs, erc4626ExportFn) From 972b8e2f7ec09e16ad7750f6744d6b8d291db601 Mon Sep 17 00:00:00 2001 From: daonarchy Date: Wed, 28 Oct 2026 22:29:38 +0700 Subject: [PATCH 492/988] Add Tradecraft (Canton) TVL adapter (#21903) Co-authored-by: daonarchy <219096321+daonarchy@users.noreply.github.com> Co-authored-by: FelixBruguera --- projects/tradecraft/index.js | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/tradecraft/index.js diff --git a/projects/tradecraft/index.js b/projects/tradecraft/index.js new file mode 100644 index 00000000000..272f38c96ad --- /dev/null +++ b/projects/tradecraft/index.js @@ -0,0 +1,42 @@ +const { get } = require('../helper/http') + +const POOLS_URL = 'https://api.cctools.network/api/markets/tradecraft/pools' + +// CCTools rejects axios's default User-Agent; identify ourselves explicitly. +const FETCH_OPTS = { headers: { 'User-Agent': 'DefiLlama-Adapter (tradecraft)' } } + +// Used only when CCTools returns no coingeckoId for a Canton instrument. +// Each id was matched to its Canton issuer via CoinGecko's canton-network platform entry. +const fallbackIds = { + HANDL: 'handl-pay', // admin handl-issuer + eXAU: 'ember-gold', // admin ember-gold + eXAG: 'ember-silver', // admin ember-silver +} + +async function tvl(api) { + const pools = await get(POOLS_URL, FETCH_OPTS) + if (!Array.isArray(pools) || pools.length === 0) + throw new Error('tradecraft: CCTools returned no pools') + + for (const pool of pools) { + if (pool.status !== 'live') continue + for (const side of [pool.baseReserve, pool.quoteReserve]) { + const symbol = side.symbol ?? side.id + if (symbol === 'FRXUSD.B') continue // bridged variant, 1:1 with Frax USD not verified + if (symbol === 'EDELx') continue // Canton-native token distinct from EDEL (docs.edel.finance/token/overview), CCTools maps it to EDEL's CoinGecko id + const id = side.coingeckoId || fallbackIds[symbol] + if (!id) continue // token without a CoinGecko listing is excluded + const amount = Number(side.amount) + if (!Number.isFinite(amount) || amount < 0) + throw new Error(`tradecraft: invalid reserve for ${symbol}`) + api.addCGToken(id, amount) + } + } +} + +module.exports = { + timetravel: false, + methodology: + 'Tradecraft is a liquidity layer and AMM on the Canton Network. TVL is the sum of the raw token reserves across its live pools, read from the CCTools API, an independent Canton DeFi aggregator that exposes per-pool reserves with canonical token IDs and CoinGecko slugs. Where CCTools has no CoinGecko slug for a Canton token, the slug is matched by hand to the token issuer via CoinGecko. Tokens without a CoinGecko listing, bridged variants whose 1:1 backing could not be verified (FRXUSD.B), and EDELx, which is a Canton-native token distinct from EDEL, are excluded.', + canton: { tvl }, +} From bdcd18543be1994f755d6aa1203ebc1ca45b3103 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 28 Oct 2026 11:29:55 -0400 Subject: [PATCH 493/988] exclude edelx from canton adapters (#21906) --- projects/cantex/index.js | 3 ++- projects/pool-party/index.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/cantex/index.js b/projects/cantex/index.js index 173ebe186f5..e4c1e343dde 100644 --- a/projects/cantex/index.js +++ b/projects/cantex/index.js @@ -33,6 +33,7 @@ async function tvl(api) { function addReserve(api, coingeckoIds, instrument, reserve) { if (reserve == null) return // pool with no reserves yet + if (instrument.id === 'EDELx') return // Canton-native token distinct from EDEL (docs.edel.finance/token/overview), tokens/info maps it to EDEL's CoinGecko id const coingeckoId = coingeckoIds[`${instrument.admin}:${instrument.id}`] if (!coingeckoId) return // token without a CoinGecko listing is excluded from TVL // Reserves are decimal strings in whole token units; do not scale them again. @@ -50,6 +51,6 @@ module.exports = { 'TVL is the sum of the token reserves held in all live Cantex pools, read from the Cantex public API (/v1/public/pools/state), ' + 'which serves per-pool reserve balances derived from on-chain Canton ledger events. ' + 'Each Canton instrument is mapped to the CoinGecko coin it represents via /v1/public/tokens/info; ' + - 'tokens without a CoinGecko listing are excluded from TVL. Cantex has no borrow side, so nothing is netted.', + 'tokens without a CoinGecko listing are excluded from TVL, as is EDELx, a Canton-native token distinct from EDEL. Cantex has no borrow side, so nothing is netted.', canton: { tvl }, } diff --git a/projects/pool-party/index.js b/projects/pool-party/index.js index 438b43318d9..de59cc8b329 100644 --- a/projects/pool-party/index.js +++ b/projects/pool-party/index.js @@ -10,6 +10,7 @@ async function tvl(api) { for (const pool of pools) { if (pool.status !== 'live') continue for (const side of [pool.baseReserve, pool.quoteReserve]) { + if (side.symbol === 'EDELx') continue // Canton-native token distinct from EDEL (docs.edel.finance/token/overview), CCTools maps it to EDEL's CoinGecko id if (side.coingeckoId) { api.addCGToken(side.coingeckoId, Number(side.amount)) } @@ -26,5 +27,6 @@ module.exports = { "per-pool reserves with canonical token IDs and CoinGecko slugs. The " + "CoinGecko slug per token comes from the API response " + "(reserve.coingeckoId), so new pools and tokens are picked up " + - "automatically without adapter changes.", + "automatically without adapter changes. EDELx is excluded: it is a " + + "Canton-native token distinct from EDEL, which its CoinGecko slug refers to.", } From 3b6d6cb3f7f42d38225d9ae0779a330f546077f5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 28 Oct 2026 16:36:40 +0100 Subject: [PATCH 494/988] optimize aptos --- projects/agdex/index.js | 138 +++++++---------------------- projects/aptin-finance-v2/index.js | 3 +- projects/aptin-finance/index.js | 3 +- projects/aptoslaunch/index.js | 7 +- projects/bwatch/index.js | 4 +- projects/earnium/index.js | 71 ++++----------- projects/echelon/index.js | 91 +++++++++++-------- projects/emojicoin/index.js | 4 +- projects/filet/index.js | 27 ++---- projects/goblin-aptos/index.js | 65 ++++++-------- projects/harborfi/index.js | 6 +- projects/hyperion/index.js | 38 +++++--- projects/meridian-amm/index.js | 17 +--- projects/meso-finance/index.js | 3 +- projects/moar/index.js | 66 +++++++------- projects/movefast/index.js | 3 +- projects/propbase/index.js | 50 +++-------- projects/thetis-market/index.js | 8 +- registries/uniswapV3.js | 2 + 19 files changed, 236 insertions(+), 370 deletions(-) diff --git a/projects/agdex/index.js b/projects/agdex/index.js index c97d7bd988e..bb146ebcb21 100644 --- a/projects/agdex/index.js +++ b/projects/agdex/index.js @@ -1,116 +1,38 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { function_view, getResource } = require("../helper/chain/aptos"); +const { function_view, getResources } = require("../helper/chain/aptos"); const primary_fungible_asset_balance = "0x1::primary_fungible_store::balance" -const AGDEX = - "0xfa69897532f069bc0806868eaeec3328727d90c0cec710a17dde327e0bfab44f"; -const lzUSDC = - ADDRESSES.aptos.USDC_2; -const USDT = - ADDRESSES.aptos.USDT_2; -const APT = - ADDRESSES.aptos.APT; -const BTC = - ADDRESSES.aptos.zWBTC; -const ETH = - ADDRESSES.aptos.zWETH; - -const usdc_resource_account = "0xb27c95e40594d6f5765e0183ccca5ebcd0942f9c9a66578af1c743f5bd0d90e5"; -const usdc_metadata = ADDRESSES.aptos.USDC_3; - -const layerzero_usdc_resource_account = "0x19fb80bd79fa8f7538404af85196396973e3fbbda1503495598172c8813f7ca5"; -const layerzero_usdc_metadata = "0x2b3be0a97a73c87ff62cbdd36837a9fb5bbd1d7f06a73b7ed62ec15c5326c1b8"; - -const usdt_resource_account = "0xbb3c1b88599c563062e2b08fe3a92ab048d700f9aa44617c680d59a4aa69b23f"; -const usdt_metadata = ADDRESSES.aptos.USDt; - -const eth_resource_account = "0x38bca0c288df1e13d9a30d33c4ce8ee778333c52bd4e730b49c6c9379be39b10"; -const eth_metadata = "0xae02f68520afd221a5cd6fda6f5500afedab8d0a2e19a916d6d8bc2b36e758db"; - -const btc_resource_account = "0x70d303ed5dbfbae1f5ac76d50d5073f69a7115dfdfa737e82bb7c3c9364b3d17"; -const btc_metadata = "0xa64d2d6f5e26daf6a3552f51d4110343b1a8c8046d0a9e72fa4086a337f3236c"; - -const apt_resource_account = "0x8afc7aaa4616c0defbe655f3928a72ff849ef9a6889178f1c18c7c3ad006ebf7"; -const apt_metadata = "0xa"; +const AGDEX = "0xfa69897532f069bc0806868eaeec3328727d90c0cec710a17dde327e0bfab44f"; +const LZ_ASSETS = "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset"; + +// each market: the resource account holding the fungible asset, its metadata object, the +// AGDEX vault type carrying the reserved amount, and the token the total is reported as +const markets = [ + { resourceAccount: "0x19fb80bd79fa8f7538404af85196396973e3fbbda1503495598172c8813f7ca5", metadata: "0x2b3be0a97a73c87ff62cbdd36837a9fb5bbd1d7f06a73b7ed62ec15c5326c1b8", vault: `${LZ_ASSETS}::USDC`, token: ADDRESSES.aptos.USDC_2 }, // layerzero USDC + { resourceAccount: "0xb27c95e40594d6f5765e0183ccca5ebcd0942f9c9a66578af1c743f5bd0d90e5", metadata: ADDRESSES.aptos.USDC_3, vault: `${AGDEX}::token_map::USDC`, token: ADDRESSES.aptos.USDC_2 }, // native USDC + { resourceAccount: "0xbb3c1b88599c563062e2b08fe3a92ab048d700f9aa44617c680d59a4aa69b23f", metadata: ADDRESSES.aptos.USDt, vault: `${AGDEX}::token_map::USDT`, token: ADDRESSES.aptos.USDT_2 }, + { resourceAccount: "0x38bca0c288df1e13d9a30d33c4ce8ee778333c52bd4e730b49c6c9379be39b10", metadata: "0xae02f68520afd221a5cd6fda6f5500afedab8d0a2e19a916d6d8bc2b36e758db", vault: `${LZ_ASSETS}::WETH`, token: ADDRESSES.aptos.zWETH }, + { resourceAccount: "0x70d303ed5dbfbae1f5ac76d50d5073f69a7115dfdfa737e82bb7c3c9364b3d17", metadata: "0xa64d2d6f5e26daf6a3552f51d4110343b1a8c8046d0a9e72fa4086a337f3236c", vault: `${LZ_ASSETS}::WBTC`, token: ADDRESSES.aptos.zWBTC }, + { resourceAccount: "0x8afc7aaa4616c0defbe655f3928a72ff849ef9a6889178f1c18c7c3ad006ebf7", metadata: "0xa", vault: "0x1::aptos_coin::AptosCoin", token: ADDRESSES.aptos.APT }, +] async function tvl(api) { - const layerzero_usdc_balance = - await function_view({ - "functionStr": primary_fungible_asset_balance, - "type_arguments": ["0x1::fungible_asset::Metadata"], - "args": [layerzero_usdc_resource_account, layerzero_usdc_metadata] - }); - const layerzero_usdc_r = await getResource( - AGDEX, - `${AGDEX}::pool::Vault<0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC>` - ); - const layerzero_usdc_value = parseInt(layerzero_usdc_balance) + parseInt(layerzero_usdc_r.reserved_amount); - - const usdc_balance = - await function_view({ - "functionStr": primary_fungible_asset_balance, - "type_arguments": ["0x1::fungible_asset::Metadata"], - "args": [usdc_resource_account, usdc_metadata] - }); - const usdc_r = await getResource( - AGDEX, - `${AGDEX}::pool::Vault<0xfa69897532f069bc0806868eaeec3328727d90c0cec710a17dde327e0bfab44f::token_map::USDC>` - ); - const usdc_value = parseInt(usdc_balance) + parseInt(usdc_r.reserved_amount); - - const usdt_balance = - await function_view({ - "functionStr": primary_fungible_asset_balance, - "type_arguments": ["0x1::fungible_asset::Metadata"], - "args": [usdt_resource_account, usdt_metadata] - }); - const usdt_r = await getResource( - AGDEX, - `${AGDEX}::pool::Vault<0xfa69897532f069bc0806868eaeec3328727d90c0cec710a17dde327e0bfab44f::token_map::USDT>` - ); - const usdt_value = parseInt(usdt_balance) + parseInt(usdt_r.reserved_amount); - - const eth_balance = - await function_view({ - "functionStr": primary_fungible_asset_balance, - "type_arguments": ["0x1::fungible_asset::Metadata"], - "args": [eth_resource_account, eth_metadata] - }); - const eth_r = await getResource( - AGDEX, - `${AGDEX}::pool::Vault<0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::WETH>` - ); - const eth_value = parseInt(eth_balance) + parseInt(eth_r.reserved_amount); - - const btc_balance = - await function_view({ - "functionStr": primary_fungible_asset_balance, - "type_arguments": ["0x1::fungible_asset::Metadata"], - "args": [btc_resource_account, btc_metadata] - }); - const btc_r = await getResource( - AGDEX, - `${AGDEX}::pool::Vault<0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::WBTC>` - ); - const btc_value = parseInt(btc_balance) + parseInt(btc_r.reserved_amount); - - const apt_balance = - await function_view({ - "functionStr": primary_fungible_asset_balance, - "type_arguments": ["0x1::fungible_asset::Metadata"], - "args": [apt_resource_account, apt_metadata] - }); - const apt_r = await getResource( - AGDEX, - `${AGDEX}::pool::Vault<0x1::aptos_coin::AptosCoin>` - ); - const apt_value = parseInt(apt_balance) + parseInt(apt_r.reserved_amount); - api.add(lzUSDC, usdc_value); - api.add(lzUSDC, layerzero_usdc_value); - api.add(BTC, btc_value); - api.add(ETH, eth_value); - api.add(USDT, usdt_value); - api.add(APT, apt_value); + // all vaults live on the AGDEX account, so one resources call covers every reserved amount + const resources = await getResources(AGDEX) + const reservedByVault = {} + resources.forEach(({ type, data }) => { + if (type.startsWith(`${AGDEX}::pool::Vault<`)) reservedByVault[type.slice(type.indexOf('<') + 1, -1)] = data.reserved_amount + }) + + for (const { resourceAccount, metadata, vault, token } of markets) { + const balance = await function_view({ + functionStr: primary_fungible_asset_balance, + type_arguments: ["0x1::fungible_asset::Metadata"], + args: [resourceAccount, metadata], + }) + if (reservedByVault[vault] === undefined) throw new Error(`agdex: vault resource missing for ${vault}`) + api.add(token, +balance + +reservedByVault[vault]) + } } module.exports = { diff --git a/projects/aptin-finance-v2/index.js b/projects/aptin-finance-v2/index.js index 82fa742503b..64572230705 100644 --- a/projects/aptin-finance-v2/index.js +++ b/projects/aptin-finance-v2/index.js @@ -16,7 +16,8 @@ async function getData() { key_type: '0x1::string::String', value_type: '0x3c1d4a86594d681ff7e5d5a233965daeabdc6a15fe5672ceeda5260038857183::pool::Pool', } - const coinInfos = await Promise.all(coins.map(i => getTableData({ table, data: { ...params, key: i } }))) + const coinInfos = [] + for (const coin of coins) coinInfos.push(await getTableData({ table, data: { ...params, key: coin } })) const balances = { tvl: {}, borrowed: {}, diff --git a/projects/aptin-finance/index.js b/projects/aptin-finance/index.js index a5a815bd094..d8b2b2b9d5d 100644 --- a/projects/aptin-finance/index.js +++ b/projects/aptin-finance/index.js @@ -16,7 +16,8 @@ async function getData() { key_type: '0x1::string::String', value_type: '0xb7d960e5f0a58cc0817774e611d7e3ae54c6843816521f02d7ced583d6434896::pool::Pool', } - const coinInfos = await Promise.all(coins.map(i => getTableData({ table, data: { ...params, key: i } }))) + const coinInfos = [] + for (const coin of coins) coinInfos.push(await getTableData({ table, data: { ...params, key: coin } })) const balances = { tvl: {}, borrowed: {}, diff --git a/projects/aptoslaunch/index.js b/projects/aptoslaunch/index.js index 6c4e15694da..f5aec49334c 100644 --- a/projects/aptoslaunch/index.js +++ b/projects/aptoslaunch/index.js @@ -35,9 +35,7 @@ const altLockBond = async (api) => { ]; let poolResources = []; - (await Promise.all(pools.map(async (i) => await getResources(i)))).forEach( - (e) => poolResources.push(...e) - ); + for (const pool of pools) poolResources.push(...await getResources(pool)) poolResources .filter((i) => i.type.includes("PoolInfo")) @@ -111,7 +109,8 @@ const moveIbo = async (api, tvlType) => { break; } - let bals = await Promise.all(acceptCoinArr.map(getCoinInfo)); + const bals = [] + for (const coin of acceptCoinArr) bals.push(await getCoinInfo(coin)) if (tvlType === 'staking' && iboInfo) api.add(MOVE, iboInfo.data.coin.value) api.addTokens(acceptCoinArr, bals) diff --git a/projects/bwatch/index.js b/projects/bwatch/index.js index c340d294bf4..ee98eab6ab3 100644 --- a/projects/bwatch/index.js +++ b/projects/bwatch/index.js @@ -5,8 +5,8 @@ const API = 'https://mtg-api.b.watch/api/etfs' const tvl = async (api) => { const { data } = await get(API) data.etfs.forEach(({ gems }) => { - gems.forEach(({ balance, price }) => { - api.addUSDValue(Math.round(balance * price)) + gems.forEach(({ balance, asset }) => { + api.addUSDValue(Math.round(balance * asset.price)) // price moved from the gem to its asset object }) }) diff --git a/projects/earnium/index.js b/projects/earnium/index.js index 0b6cc9fe060..a08d1dea411 100644 --- a/projects/earnium/index.js +++ b/projects/earnium/index.js @@ -1,60 +1,19 @@ const { function_view } = require("../helper/chain/aptos"); const contractAddress = "0x12169b6e1bf75ab1a2b2d987d20f8dd4c191e5dbc2066cb7e9af40b1fa7fb659" -async function _getAllPools() { - return function_view({ functionStr: `${contractAddress}::liquidity_pool::pools`, type_arguments: [], args: [] }) -} - -async function _getPoolReserves(poolAddress) { - return function_view({ functionStr: `${contractAddress}::liquidity_pool::pool_reserves`, type_arguments: [], args: [poolAddress] }) -} +const view = (fn, args = []) => function_view({ functionStr: `${contractAddress}::${fn}`, type_arguments: [], args }) -async function _getOriginal(tokenAddress) { - return function_view({ functionStr: `${contractAddress}::coin_wrapper::get_original`, type_arguments: [], args: [tokenAddress] }) +// wrapped FA -> original coin type is a fixed mapping, resolved once per asset +const originalCache = {} +function getOriginal(asset) { + if (!originalCache[asset]) originalCache[asset] = _getOriginal(asset).catch(e => { delete originalCache[asset]; throw e }) + return originalCache[asset] } -async function _getTokenOfPool(poolAddress) { - return function_view({ functionStr: `${contractAddress}::liquidity_pool::supported_inner_assets`, type_arguments: [], args: [poolAddress] }) -} - -async function _getTvl() { - const allPools = (await _getAllPools()) - const tokenTvlMap = new Map(); - const mapOriginal = new Map(); - - for (const pool of allPools) { - const poolAddress = pool.inner - const reserves = await _getPoolReserves(poolAddress); - const tokens = await _getTokenOfPool(poolAddress); - if (!reserves || !tokens || tokens.length < 2) { - console.warn(`Invalid data for pool ${poolAddress}`); - continue; - } - const reserveX = Number(reserves[0] || 0); - const reserveY = Number(reserves[1] || 0); - - let tokenX = tokens[0]; - if (mapOriginal.has(tokens[0].inner)) { - tokenX = { inner: mapOriginal.get(tokens[0].inner) }; - } else { - const originalX = await _getOriginal(tokens[0].inner); - mapOriginal.set(tokens[0].inner, originalX); - tokenX = { inner: originalX }; - } - - let tokenY = tokens[1]; - if (mapOriginal.has(tokens[1].inner)) { - tokenY = { inner: mapOriginal.get(tokens[1].inner) }; - } else { - const originalY = await _getOriginal(tokens[1].inner); - mapOriginal.set(tokens[1].inner, originalY); - tokenY = { inner: originalY }; - } - - tokenTvlMap.set(tokenX, (tokenTvlMap.get(tokenX) || 0) + reserveX); - tokenTvlMap.set(tokenY, (tokenTvlMap.get(tokenY) || 0) + reserveY); - } - return tokenTvlMap +async function _getOriginal(asset) { + const original = await view('coin_wrapper::get_original', [asset]) + // the wrapper returns zero-padded accounts (0x000...1::aptos_coin::AptosCoin), pricing keys use the short form + return original.replace(/^0x0+(?=[0-9a-f])/, '0x') } module.exports = { @@ -63,9 +22,13 @@ module.exports = { "Counts the total liquidity in all pools on Earnium.", aptos: { tvl: async (api) => { - const tokenTvlMap = await _getTvl() - for (const [key, value] of tokenTvlMap) { - api.add(key.inner, value) + const pools = await view('liquidity_pool::pools') + for (const { inner: pool } of pools) { + // pool_metadata returns (token_a, token_b, reserve_a, reserve_b, ...) in one call, + // replacing the separate pool_reserves + supported_inner_assets views + const [tokenA, tokenB, reserveA, reserveB] = await view('liquidity_pool::pool_metadata', [pool]) + api.add(await getOriginal(tokenA.inner), reserveA) + api.add(await getOriginal(tokenB.inner), reserveB) } } } diff --git a/projects/echelon/index.js b/projects/echelon/index.js index e14cce94948..996b7322be5 100644 --- a/projects/echelon/index.js +++ b/projects/echelon/index.js @@ -1,9 +1,11 @@ -const { getResource, } = require("../helper/chain/aptos"); +const { getResource, getResources, } = require("../helper/chain/aptos"); const http = require("../helper/http"); -const aptosLendingContract = "0xc6bc659f1649553c1a3fa05d9727433dc03843baac29473c817d06d39e7621ba"; -const movementLendingContract = "0x6a01d5761d43a5b5a0ccbfc42edf2d02c0611464aae99a2ea0e0d4819f0550b5"; -const echelonChainLendingContract = "0xedcdbb4c459064293924e0e96e01d5927faa11fd38d331111d99d23f14f6ed7d"; +const lendingContracts = { + aptos: "0xc6bc659f1649553c1a3fa05d9727433dc03843baac29473c817d06d39e7621ba", + move: "0x6a01d5761d43a5b5a0ccbfc42edf2d02c0611464aae99a2ea0e0d4819f0550b5", + echelon_initia: "0xedcdbb4c459064293924e0e96e01d5927faa11fd38d331111d99d23f14f6ed7d", +} const coinAssetType = '300'; const echelonRESTEndpoint = "https://rest-echelon-1.anvil.asia-southeast.initia.xyz"; @@ -23,42 +25,57 @@ async function _getResource(account, key, chain) { } async function getMarketAddresses(network) { - let lendingAddress; - switch (network) { - case 'aptos': - lendingAddress = aptosLendingContract; - break; - case 'move': - lendingAddress = movementLendingContract; - break; - default: - lendingAddress = echelonChainLendingContract; - } + const lendingAddress = lendingContracts[network]; const lending = await _getResource(lendingAddress, `${lendingAddress}::lending::Lending`, network); return lending.market_objects.map(obj => obj.inner); } -async function getMarket(network, marketAddress) { - let lendingAddress; - switch (network) { - case 'aptos': - lendingAddress = aptosLendingContract; - break; - case 'move': - lendingAddress = movementLendingContract; - break; - default: - lendingAddress = echelonChainLendingContract; - } +// every market resource we need lives on the market object, so on aptos/move one +// `resources` call per market replaces the 2-3 by-type lookups +function parseMarket(lendingAddress, resources) { + const byType = {} + resources.forEach(({ type, data }) => byType[type] = data) + const market = byType[`${lendingAddress}::lending::Market`] + if (!market) throw new Error('Market resource missing') + const coin = market.asset_type === coinAssetType + ? byType[`${lendingAddress}::lending::CoinInfo`].type_name + : byType[`${lendingAddress}::lending::FungibleAssetInfo`].metadata.inner + return { cash: market.total_cash, liability: market.total_liability, fee: market.total_reserve, coin }; +} + +async function getMarketInitia(network, marketAddress) { + const lendingAddress = lendingContracts[network]; const market = await _getResource(marketAddress, `${lendingAddress}::lending::Market`, network) - var coinInfo = null; - if (market.asset_type === coinAssetType) { - coinInfo = (await _getResource(marketAddress, `${lendingAddress}::lending::CoinInfo`, network)).type_name - } else { - coinInfo = (await _getResource(marketAddress, `${lendingAddress}::lending::FungibleAssetInfo`, network)).metadata.inner; + const coin = market.asset_type === coinAssetType + ? (await _getResource(marketAddress, `${lendingAddress}::lending::CoinInfo`, network)).type_name + : (await _getResource(marketAddress, `${lendingAddress}::lending::FungibleAssetInfo`, network)).metadata.inner + return { cash: market.total_cash, liability: market.total_liability, fee: market.total_reserve, coin }; +} + +// tvl and borrowed read the same markets, so fetch them once per chain and share +// the result between the two exports of the same run +const MARKETS_TTL_MS = 5 * 60 * 1000 +const marketsCache = {} + +function getMarkets(network) { + const cached = marketsCache[network] + if (cached && Date.now() - cached.at < MARKETS_TTL_MS) return cached.promise + const promise = _getMarkets(network).catch(e => { delete marketsCache[network]; throw e }) + marketsCache[network] = { at: Date.now(), promise } + return promise +} + +async function _getMarkets(network) { + const lendingAddress = lendingContracts[network]; + const marketAddresses = await getMarketAddresses(network); + const markets = [] + for (const marketAddress of marketAddresses) { + if (network === 'aptos' || network === 'move') + markets.push(parseMarket(lendingAddress, await getResources(marketAddress, network))) + else + markets.push(await getMarketInitia(network, marketAddress)) } - - return { cash: market.total_cash, liability: market.total_liability, fee: market.total_reserve, coin: coinInfo }; + return markets } module.exports = { @@ -71,16 +88,14 @@ module.exports = { }; async function tvl(api) { - const marketAddresses = await getMarketAddresses(api.chain); - const markets = await Promise.all(marketAddresses.map(marketAddress => getMarket(api.chain, marketAddress))); + const markets = await getMarkets(api.chain); markets.forEach(({ cash, coin }) => { api.add(coin, cash); }); } async function borrowed(api) { - const marketAddresses = await getMarketAddresses(api.chain); - const markets = await Promise.all(marketAddresses.map(marketAddress => getMarket(api.chain, marketAddress))); + const markets = await getMarkets(api.chain); markets.forEach(({ liability, coin }) => { api.add(coin, liability) }); diff --git a/projects/emojicoin/index.js b/projects/emojicoin/index.js index 6d7b0dc569c..2920760dd02 100644 --- a/projects/emojicoin/index.js +++ b/projects/emojicoin/index.js @@ -22,7 +22,9 @@ const DEPLOYED_AT_DATE = '2024-11-20'; const DEPLOYED_AT_BLOCK = 254000000; async function tvl(api) { - const version = await timestampToVersion(new Date(api.timestamp * 1000), DEPLOYED_AT_BLOCK); + // the timestamp -> ledger version search costs ~80 node calls; a current run can read the latest state directly + const isCurrent = !api.timestamp || api.timestamp > Date.now() / 1e3 - 600 + const version = isCurrent ? undefined : await timestampToVersion(new Date(api.timestamp * 1000), DEPLOYED_AT_BLOCK); const tvl_amount = await getAllMarkets(version); api.add(ADDRESSES.aptos.APT, tvl_amount); } diff --git a/projects/filet/index.js b/projects/filet/index.js index 65275c5fff9..8882e911162 100644 --- a/projects/filet/index.js +++ b/projects/filet/index.js @@ -7,7 +7,6 @@ const abi = { const { fetchURL } = require('../helper/utils') -const BigNumber = require("bignumber.js") const { nullAddress } = require("../helper/tokenMapping"); const { getConfig } = require("../helper/cache"); @@ -47,22 +46,16 @@ const getMinersList = async () => { module.exports = { timetravel: false, heco: { - tvl: async () => { - const tvlData = await fetchURL(filetAPI) - return { - ["filecoin"]: new BigNumber(tvlData.data.data.hecoTvl), - } - } + tvl: async (api) => { + const tvlData = await fetchURL(filetAPI) + api.addCGToken('filecoin', +tvlData.data.data.hecoTvl) + } }, bsc: { - tvl: async () => { - - const tvlData = await fetchURL(filetAPI) - return { - ["filecoin"]: new BigNumber(tvlData.data.data.bscTvl), - } - - } + tvl: async (api) => { + const tvlData = await fetchURL(filetAPI) + api.addCGToken('filecoin', +tvlData.data.data.bscTvl) + } }, filecoin: { tvl: async (api) => { @@ -84,9 +77,7 @@ module.exports = { mixin: { tvl: async (api) => { const tvlData = await fetchURL(filetAPI) - return { - ["filecoin"]: new BigNumber(tvlData.data.data.mixinTvl), - } + api.addCGToken('filecoin', +tvlData.data.data.mixinTvl) } } } diff --git a/projects/goblin-aptos/index.js b/projects/goblin-aptos/index.js index b07dca0ff37..e9b93978fca 100644 --- a/projects/goblin-aptos/index.js +++ b/projects/goblin-aptos/index.js @@ -17,42 +17,28 @@ const vaults = [ '0x3f6d0c2044a7e0cfd8e07a89a884c1776e67c10580cf384c5ddceb4f51ead95f', // sUSDe-USDC private '0xb77d3cf996f088b574a5ec7ddd24aa56b413ffe8e861f734558a4cfd49d68d84', // xBTC-aBTC private ]; -async function getVaultsLiquidity() { - const vaultResources = [] - const vaultsLiquidityList = [] - for (const vault of vaults) { - const resource = await getResource(vault, '0x19bcbcf8e688fd5ddf52725807bc8bf455a76d4b5a6021cfdc4b5b2652e5cd55::vaults::Vault') - try { - const liquidity = await function_view({ - functionStr: "0x8b4a2c4bb53857c718a04c020b98f8c2e1f99a68b0f57389a8bf5434cd22e05c::router_v3::get_amount_by_liquidity", - args: [resource.position_id], - type_arguments: [], - }) - vaultResources.push(resource) - vaultsLiquidityList.push(liquidity) - } catch (e) { - // closed/migrated positions abort on-chain - skip them - } - } - return {vaultResources, vaultsLiquidityList}; + +// FA -> paired coin type is a fixed on-chain mapping and most vaults share the same +// handful of assets, so resolve each FA once per process instead of once per vault +const pairedCoinCache = {} + +function getCoinType(faType) { + if (!pairedCoinCache[faType]) pairedCoinCache[faType] = _getCoinType(faType).catch(e => { delete pairedCoinCache[faType]; throw e }) + return pairedCoinCache[faType] } -async function _getCoinInfo(faType) { +async function _getCoinType(faType) { const coinInfo = await function_view({ functionStr: "0x1::coin::paired_coin", args: [faType], type_arguments: [], }); - if (coinInfo.vec.length > 0) { - const address = coinInfo.vec[0].account_address; - const module = Buffer.from(coinInfo.vec[0].module_name.replace('0x', ''), 'hex').toString('utf-8'); - const struct = Buffer.from(coinInfo.vec[0].struct_name.replace('0x', ''), 'hex').toString('utf-8'); - - return (address + "::" + module + "::" + struct); - } else { - return null; - } + if (!coinInfo.vec.length) return faType + const { account_address, module_name, struct_name } = coinInfo.vec[0] + const module = Buffer.from(module_name.replace('0x', ''), 'hex').toString('utf-8'); + const struct = Buffer.from(struct_name.replace('0x', ''), 'hex').toString('utf-8'); + return `${account_address}::${module}::${struct}` } module.exports = { @@ -60,16 +46,21 @@ module.exports = { methodology: "Counts the total vault position in the corresponding liquidity pool on Hyperion.", aptos: { tvl: async (api) => { - const {vaultResources, vaultsLiquidityList} = await getVaultsLiquidity(); - - for (const [index, vaultResource] of vaultResources.entries()) { - const coin1 = await _getCoinInfo(vaultResource.token_a.inner) || vaultResource.token_a.inner; - const coin2 = await _getCoinInfo(vaultResource.token_b.inner) || vaultResource.token_b.inner; - - api.add(coin1, vaultsLiquidityList[index][0]); - api.add(coin2, vaultsLiquidityList[index][1]); + for (const vault of vaults) { + const resource = await getResource(vault, '0x19bcbcf8e688fd5ddf52725807bc8bf455a76d4b5a6021cfdc4b5b2652e5cd55::vaults::Vault') + let liquidity + try { + liquidity = await function_view({ + functionStr: "0x8b4a2c4bb53857c718a04c020b98f8c2e1f99a68b0f57389a8bf5434cd22e05c::router_v3::get_amount_by_liquidity", + args: [resource.position_id], + type_arguments: [], + }) + } catch (e) { + continue // closed/migrated positions abort on-chain - skip them + } + api.add(await getCoinType(resource.token_a.inner), liquidity[0]); + api.add(await getCoinType(resource.token_b.inner), liquidity[1]); } }, }, }; - diff --git a/projects/harborfi/index.js b/projects/harborfi/index.js index 8b10fd4559d..95ebd4f407d 100644 --- a/projects/harborfi/index.js +++ b/projects/harborfi/index.js @@ -56,8 +56,10 @@ async function tvl(api) { const { minters, genesis } = config[api.chain]; const allContracts = [...minters, ...genesis]; - const collateralTokens = await api.multiCall({ abi: 'address:WRAPPED_COLLATERAL_TOKEN', calls: allContracts, }); - await api.sumTokens({ tokensAndOwners2: [collateralTokens, allContracts] }); + // deprecated markets revert on WRAPPED_COLLATERAL_TOKEN; skip them + const collateralTokens = await api.multiCall({ abi: 'address:WRAPPED_COLLATERAL_TOKEN', calls: allContracts, permitFailure: true, }); + const tokensAndOwners = allContracts.map((owner, i) => [collateralTokens[i], owner]).filter(([token]) => token); + await api.sumTokens({ tokensAndOwners }); } module.exports = { diff --git a/projects/hyperion/index.js b/projects/hyperion/index.js index 14ab159e918..502f0d95648 100644 --- a/projects/hyperion/index.js +++ b/projects/hyperion/index.js @@ -6,28 +6,44 @@ const HYPERION = "0x8b4a2c4bb53857c718a04c020b98f8c2e1f99a68b0f57389a8bf5434cd22 const POOL_LIST = "https://assets.hyperion.xyz/files/pool-list-new.json"; // pools below this (per hyperion's list) are skipped; ~40 of ~350 pools hold >99.9% of tvl const MIN_POOL_TVL_USD = 100; +const PAGE_SIZE = 100; module.exports = { timetravel: false, isHeavyProtocol: true, - methodology: `Counts the token reserves of Hyperion pools, read on-chain (pool_v3::pool_reserve_amount); pools Hyperion lists below $${MIN_POOL_TVL_USD} TVL are skipped.`, + methodology: `Counts the token reserves of Hyperion pools, read on-chain (pool_v3::all_pools_with_info); pools Hyperion lists below $${MIN_POOL_TVL_USD} TVL are skipped.`, aptos: { tvl: async (api) => { const { data: list } = await get(POOL_LIST); - const pools = list.filter(({ tvlUSD }) => Number(tvlUSD) >= MIN_POOL_TVL_USD).map(({ pool }) => pool); - api.log(`Hyperion pools counted: ${pools.length} of ${list.length} listed`); - // FA tokens paired with a legacy coin are priced under the coin type - const token = (info, fa) => info?.coinType ?? fa; - for (const pool of pools) { - const [reserve1, reserve2] = await function_view({ - functionStr: `${HYPERION}::pool_v3::pool_reserve_amount`, - args: [pool.poolId], + const priceKey = {} + const counted = new Set() + for (const { tvlUSD, pool } of list) { + if (Number(tvlUSD) < MIN_POOL_TVL_USD) continue + counted.add(pool.poolId) + priceKey[pool.token1] = pool.token1Info?.coinType ?? pool.token1 + priceKey[pool.token2] = pool.token2Info?.coinType ?? pool.token2 + } + api.log(`Hyperion pools counted: ${counted.size} of ${list.length} listed`); + + // all_pools_with_info pages through every pool with its reserves, so a handful of + // calls replace one pool_reserve_amount view per pool + let seen = 0 + for (let offset = 0; ; offset += PAGE_SIZE) { + const [pools, page] = await function_view({ + functionStr: `${HYPERION}::pool_v3::all_pools_with_info`, + args: [String(offset), String(PAGE_SIZE)], type_arguments: [], }); - api.add(token(pool.token1Info, pool.token1), reserve1); - api.add(token(pool.token2Info, pool.token2), reserve2); + for (const { pool, token_a, token_b, token_a_reserve, token_b_reserve } of pools) { + if (!counted.has(pool.inner)) continue + seen++ + api.add(priceKey[token_a.inner] ?? token_a.inner, token_a_reserve); + api.add(priceKey[token_b.inner] ?? token_b.inner, token_b_reserve); + } + if (offset + pools.length >= +page.total || !pools.length) break } + if (seen !== counted.size) api.log(`Hyperion: ${counted.size - seen} listed pools not found on-chain`) }, }, }; diff --git a/projects/meridian-amm/index.js b/projects/meridian-amm/index.js index 8c45878e1c4..ed955fe5a90 100644 --- a/projects/meridian-amm/index.js +++ b/projects/meridian-amm/index.js @@ -1,8 +1,6 @@ const { function_view } = require("../helper/chain/aptos"); -const { sliceIntoChunks } = require("../helper/utils"); const meridianPackage = "fbdb3da73efcfa742d542f152d65fc6da7b55dee864cd66475213e4be18c9d54"; -const POOL_BATCH_SIZE = 20; function callPoolView(functionName, args = []) { return function_view({ functionStr: `${meridianPackage}::pool::${functionName}`, args, chain: 'move' }); @@ -16,17 +14,10 @@ module.exports = { tvl: async (api) => { const pools = await callPoolView('pools'); - for (const poolBatch of sliceIntoChunks(pools, POOL_BATCH_SIZE)) { - await Promise.all(poolBatch.map(async (pool) => { - const [assets, balances] = await Promise.all([ - callPoolView('pool_assets_metadata', [pool.inner]), - callPoolView('pool_balances', [pool.inner]), - ]); - - for (let i = 0; i < assets.length; i++) { - api.add(assets[i].inner, balances[i]); - } - })); + for (const pool of pools) { + const assets = await callPoolView('pool_assets_metadata', [pool.inner]) + const balances = await callPoolView('pool_balances', [pool.inner]) + api.addTokens(assets.map(i => i.inner), balances) } }, }, diff --git a/projects/meso-finance/index.js b/projects/meso-finance/index.js index dcf145f8b0e..6eed46cc6b4 100644 --- a/projects/meso-finance/index.js +++ b/projects/meso-finance/index.js @@ -13,7 +13,8 @@ function getPoolData() { async function fetchPoolData(resolve, reject) { try { const poolAddresses = await getPoolAddresses() - const poolInfos = await Promise.all(poolAddresses.map(getPoolInfo)) + const poolInfos = [] + for (const pool of poolAddresses) poolInfos.push(await getPoolInfo(pool)) resolve(poolInfos) } catch (e) { reject(e) } } diff --git a/projects/moar/index.js b/projects/moar/index.js index 115cfd0f0a6..96be6adb3b5 100644 --- a/projects/moar/index.js +++ b/projects/moar/index.js @@ -1,5 +1,4 @@ const { aQuery, function_view } = require('../helper/chain/aptos') -const sdk = require('@defillama/sdk'); const addresses = { 'aptos': { @@ -9,20 +8,35 @@ const addresses = { }, } -async function tvl(api, chain) { - // TVL for moar means the unborrowed assets in the pools + all combined assets in the credit accounts - const poolAddresses = await getPoolAddresses(chain) +// tvl and borrowed read the same pool set, so fetch it once per chain and share it +// between the two exports of the same run +const POOLS_TTL_MS = 5 * 60 * 1000 +const poolsCache = {} - const balances = {}; - for (const poolAddress of poolAddresses) { - const poolData = await aQuery(`/v1/accounts/${poolAddress}/resource/${addresses[chain]['moar']}::pool::Pool`, chain) +function getPools(chain) { + const cached = poolsCache[chain] + if (cached && Date.now() - cached.at < POOLS_TTL_MS) return cached.promise + const promise = _getPools(chain).catch(e => { delete poolsCache[chain]; throw e }) + poolsCache[chain] = { at: Date.now(), promise } + return promise +} - if (!poolData['data']['is_paused']) { - const idleAssetAmount = poolData['data']['total_deposited'] - poolData['data']['total_borrows'] - const assetMetadata = poolData['data']['underlying_asset']['inner'] - sdk.util.sumSingleBalance(balances, assetMetadata, idleAssetAmount, chain); - } +async function _getPools(chain) { + const poolsConfig = await aQuery(`/v1/accounts/${addresses[chain]['moar_package_owner']}/resource/${addresses[chain]['moar']}::pool::PoolConfigs`, chain) + const poolAddresses = poolsConfig['data']['all_pools']['inline_vec'].map(x => x['inner']) + const pools = [] + for (const poolAddress of poolAddresses) { + const { data } = await aQuery(`/v1/accounts/${poolAddress}/resource/${addresses[chain]['moar']}::pool::Pool`, chain) + if (data['is_paused']) continue + pools.push({ asset: data['underlying_asset']['inner'], deposited: +data['total_deposited'], borrows: +data['total_borrows'] }) } + return pools +} + +async function tvl(api, chain) { + // TVL for moar means the unborrowed assets in the pools + all combined assets in the credit accounts + for (const { asset, deposited, borrows } of await getPools(chain)) + api.add(asset, deposited - borrows) const creditAccounts = await function_view({ functionStr: `${addresses[chain]['moar']}::credit_manager::get_all_credit_accounts`, @@ -35,34 +49,14 @@ async function tvl(api, chain) { args: [creditAccount], chain: chain }) - for (const asset of assetData) { - sdk.util.sumSingleBalance(balances, asset['asset']['inner'], asset['amount'], chain); - } + for (const asset of assetData) + api.add(asset['asset']['inner'], asset['amount']) } - - return balances; } async function borrowed(api, chain) { - const balances = {}; - - const poolAddresses = await getPoolAddresses(chain) - - for (const poolAddress of poolAddresses) { - const poolData = await aQuery(`/v1/accounts/${poolAddress}/resource/${addresses[chain]['moar']}::pool::Pool`, chain) - - if (!poolData['data']['is_paused']) { - const borrowedAmount = poolData['data']['total_borrows'] - const assetMetadata = poolData['data']['underlying_asset']['inner'] - sdk.util.sumSingleBalance(balances, assetMetadata, borrowedAmount, chain); - } - } - return balances; -} - -async function getPoolAddresses(chain) { - const poolsConfig = await aQuery(`/v1/accounts/${addresses[chain]['moar_package_owner']}/resource/${addresses[chain]['moar']}::pool::PoolConfigs`, chain) - return poolsConfig['data']['all_pools']['inline_vec'].map(x => x['inner']) + for (const { asset, borrows } of await getPools(chain)) + api.add(asset, borrows) } module.exports = { diff --git a/projects/movefast/index.js b/projects/movefast/index.js index 90ccd97b51c..7e976f3761a 100644 --- a/projects/movefast/index.js +++ b/projects/movefast/index.js @@ -43,7 +43,8 @@ async function launchedTokens() { const tvl = async (api) => { const tokens = await launchedTokens(); - const resources = await Promise.all(tokens.map((token) => getResources(token))); + const resources = [] + for (const token of tokens) resources.push(await getResources(token)) resources.forEach((list) => { const pool = list.find((resource) => POOL_TYPES.has(resource.type)); diff --git a/projects/propbase/index.js b/projects/propbase/index.js index fa91288b14e..9e18e5c1f51 100644 --- a/projects/propbase/index.js +++ b/projects/propbase/index.js @@ -1,14 +1,17 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { function_view } = require('../helper/chain/aptos'); +const { function_view, sumTokens } = require('../helper/chain/aptos'); const { getConfig } = require("../helper/cache"); const PROPS_FA = "0x6dba1728c73363be1bdd4d504844c40fbb893e368ccbeff1d1bd83497dbc756d"; +const PROPS_COIN = "0xe50684a338db732d8fb8a3ac71c4b8633878bd0193bca5de2ebc852a83b35099::propbase_coin::PROPS"; const USDC_FA = ADDRESSES.aptos.USDC_3; +const getData = () => getConfig('propbase/config', `https://contractaddress.propbase.app/production`) + module.exports = { timetravel: false, misrepresentedTokens: true, - methodology: `TVL includes USDC tokens deposited in Nova pools (RWA) and Rental pools. + methodology: `TVL includes USDC tokens deposited in Nova pools (RWA) and Rental pools. RWA assets are paired with USDC in on - chain liquidity pools built on Trader Joe’s CLMM contracts, which allows users to buy and sell property tokens directly against USDC. Redemption is AMM- based and depends on pool liquidity and active price bins, @@ -17,29 +20,10 @@ module.exports = { aptos: { tvl: async (api) => { const chain = "aptos"; - const data = await getConfig('propbase/config', `https://contractaddress.propbase.app/production`); + const data = await getData(); - // --- RWA Pools (USDC) --- - for (const pool of data.NOVA_POOLS) { - const fa_balance = await function_view({ - functionStr: `0x1::primary_fungible_store::balance`, - type_arguments: ["0x1::fungible_asset::Metadata"], - args: [pool, USDC_FA], - chain, - }); - api.addTokens(USDC_FA, fa_balance); - } - - // --- Rental Pools (USDC) --- - for (const pool of data.RENTAL_POOLS) { - const fa_balance = await function_view({ - functionStr: `0x1::primary_fungible_store::balance`, - type_arguments: ["0x1::fungible_asset::Metadata"], - args: [pool, USDC_FA], - chain, - }); - api.addTokens(USDC_FA, fa_balance); - } + // --- RWA (Nova) and Rental pools hold plain USDC: one indexer query covers every pool --- + api.addBalances(await sumTokens({ api, owners: [...data.NOVA_POOLS, ...data.RENTAL_POOLS], tokens: [USDC_FA] })) // ---- RWA assets current values in USDC --- for (const pool of data.RWA_POOLS) { @@ -81,19 +65,11 @@ module.exports = { }, staking: async (api) => { - const chain = "aptos"; - const data = await getConfig('propbase/config', `https://contractaddress.propbase.app/production`); - - for (const pool of data.STAKING_POOLS) { - const fa_balance = await function_view({ - functionStr: `0x1::primary_fungible_store::balance`, - type_arguments: ["0x1::fungible_asset::Metadata"], - args: [pool, PROPS_FA], - chain, - }); - - api.addTokens(PROPS_FA, fa_balance); - } + const data = await getData(); + // staking pools hold PROPS: one indexer query instead of one balance view per pool. + // PROPS is a coin-paired FA, which the indexer reports under the coin type + const balances = await sumTokens({ api, owners: data.STAKING_POOLS, tokens: [PROPS_COIN] }) + api.add(PROPS_FA, balances[`aptos:${PROPS_COIN}`] ?? 0) }, }, }; diff --git a/projects/thetis-market/index.js b/projects/thetis-market/index.js index 800362e625f..788b1691b58 100644 --- a/projects/thetis-market/index.js +++ b/projects/thetis-market/index.js @@ -30,11 +30,9 @@ const Pools = [ ]; async function tvl(api) { - const poolConfigs = await Promise.all([ - getResource(Pools[0].poolAddress, `${POOL_TRADING_ACCOUNT}::pool::Pool`), - getResource(Pools[1].poolAddress, `${POOL_TRADING_ACCOUNT}::pool::Pool`), - getResource(Pools[2].poolAddress, `${POOL_TRADING_ACCOUNT}::pool::Pool`), - ]); + const poolConfigs = [] + for (const { poolAddress } of Pools) + poolConfigs.push(await getResource(poolAddress, `${POOL_TRADING_ACCOUNT}::pool::Pool`)) const mergeArray = poolConfigs.map((p, i) => { return { ...p, ...Pools[i] }; }); diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index de778b7f8b7..1e3c508a4d3 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -676,10 +676,12 @@ const uniV3Configs = { era: { factory: '0x1153D1d27A558471eF051c5D2D075d7D07B84A07', fromBlock: 31199635, + permitFailure: true, }, berachain: { factory: '0xCaca5910586473646F294d8FA5530cA9E8E3fc38', fromBlock: 782955, + permitFailure: true, }, }, 'honeypop': { From 2d82367dd918574d1d885fec54c1d391ac40fa00 Mon Sep 17 00:00:00 2001 From: gabbergandalfderreiche <137819170+gabbergandalfderreiche@users.noreply.github.com> Date: Wed, 28 Oct 2026 16:37:46 +0100 Subject: [PATCH 495/988] Add Hamstr TVL adapter (Base) (#21904) Co-authored-by: FelixBruguera --- projects/hamstr/index.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 projects/hamstr/index.js diff --git a/projects/hamstr/index.js b/projects/hamstr/index.js new file mode 100644 index 00000000000..34efad7f401 --- /dev/null +++ b/projects/hamstr/index.js @@ -0,0 +1,34 @@ +// Hamstr (https://www.hamstr.online) – principal stays in USDC/ETH, only the yield is swapped into cbBTC. +// Source and contracts: https://github.com/gabbergandalfderreiche/hamstr + +const { sumTokens2 } = require('../helper/unwrapLPs') + +// BtcYieldVaults: principal lent on Aave V3 via a strategy; totalAssets() = principal in the vault's asset. +const VAULTS = [ + '0x3647c58c7eF2f4E871Cb3390E21ddD211242aADA', // Dollar Hamster (USDC) + '0xBF5Cd7EB5D3fC9625A1cf96C29802811f9335f2a', // ETH Hamster (WETH) +] + +// TurboVault: holds a Uniswap V3 WETH/cbBTC position NFT plus idle WETH/cbBTC. +const TURBO_VAULT = '0xd303E417Afd36f82A06f37736FBF8Db71fd952e6' + +async function tvl(api) { + const assets = await api.multiCall({ abi: 'address:asset', calls: VAULTS }) + const totals = await api.multiCall({ abi: 'uint256:totalAssets', calls: VAULTS }) + api.add(assets, totals) + + // Harvested yield waiting to be claimed sits in the vaults as cbBTC. + const cbbtc = await api.call({ abi: 'address:rewardToken', target: VAULTS[0] }) + await api.sumTokens({ owners: VAULTS, tokens: [cbbtc] }) + + const weth = await api.call({ abi: 'address:weth', target: TURBO_VAULT }) + return sumTokens2({ api, owner: TURBO_VAULT, tokens: [weth, cbbtc], resolveUniV3: true }) +} + +module.exports = { + methodology: + 'Assets deposited in the Hamstr vaults on Base: USDC and ETH principal (lent on Aave V3), unclaimed cbBTC rewards held by the vaults, and the WETH and cbBTC in the Turbo vault\'s Uniswap V3 position plus its idle balance.', + doublecounted: true, // principal is also counted in Aave V3 and Uniswap V3 + start: '2026-10-26', + base: { tvl }, +} From c09cd7aa05a8c3736c448fb137f385456c53fb7c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 28 Oct 2026 16:42:30 +0100 Subject: [PATCH 496/988] migrate adapters to registry (#21800) --- projects/1bch/index.js | 4 +- projects/ABCDEFX/index.js | 11 - projects/BlastNYAN/index.js | 35 -- projects/DegenDex/index.js | 15 - projects/GajFinance/index.js | 17 - projects/GateSwap/index.js | 15 - projects/MeowMiner/index.js | 12 - projects/OCTOplace/index.js | 13 - projects/PyreSwap/index.js | 11 - projects/aborean-CL/index.js | 16 - projects/abstraDex/index.js | 23 -- projects/ada-harvest/index.js | 20 -- projects/aerodrome-ignition/index.js | 17 - projects/aeva-bridge/index.js | 16 - projects/alyx-finance/index.js | 16 - projects/anvil/index.js | 5 - projects/aof-stake-mining/index.js | 11 - projects/applepie/index.js | 19 -- projects/array-capital/index.js | 11 - projects/arrland/index.js | 17 - projects/astaria-v2/index.js | 6 - projects/bamboodefi/index.js | 21 -- projects/bbbpump/index.js | 13 +- projects/benswap/index.js | 6 +- projects/blastname/index.js | 30 -- projects/bryanonbase/index.js | 24 -- projects/business-builders-nfts/index.js | 21 -- projects/chronoswap/index.js | 14 +- projects/citrea/index.js | 29 -- projects/coffeefi/index.js | 16 - projects/creditum/index.js | 4 +- projects/darkcrypto/index.js | 8 +- projects/darkness/index.js | 42 --- projects/deq/index.js | 7 - projects/djed-alliance/index.js | 14 - projects/drefinance/index.js | 57 ---- projects/dyorswap/index.js | 40 --- projects/dyson/index.js | 18 -- projects/electrowizy/index.js | 7 - projects/elkfinance/index.js | 46 --- projects/emberswap/index.js | 20 -- projects/everstrike/index.js | 32 -- projects/firebot/index.js | 29 -- projects/goblinscash/index.js | 4 +- projects/grave/index.js | 4 +- projects/hectagon/index.js | 19 -- projects/helper/env.js | 1 + projects/helper/staking.js | 18 -- projects/hybra-v4/index.js | 16 - projects/icecreamswap/index.js | 17 - projects/insuredefi/index.js | 16 - projects/izumi-iziswap-v2/index.js | 18 -- projects/kilolend/index.js | 9 - projects/klex/index.js | 9 - projects/megaswap/index.js | 14 - projects/mimas-finance/index.js | 32 -- projects/minerPepe/index.js | 18 -- projects/nest/index.js | 48 --- projects/o2-dao/index.js | 15 - projects/olympulsex/index.js | 12 - projects/openfi/index.js | 12 - projects/optidoge/index.js | 12 - projects/pacifica/index.js | 5 - projects/pangolin/index.js | 10 +- projects/passdex/index.js | 15 - projects/penpad/index.js | 45 --- projects/phission-finance/index.js | 16 - projects/photon-protocol/index.js | 15 - projects/plasma-saving-vaults/index.js | 14 - projects/plaxswap/index.js | 13 - projects/polaris-finance/index.js | 48 --- projects/privacy-cash/index.js | 59 ---- projects/qilin/index.js | 10 - projects/ribbon-earn/index.js | 18 -- projects/sapien-vault/index.js | 13 - projects/satoriSwap/index.js | 17 - projects/scorch/index.js | 21 -- projects/smiliee-gbera/index.js | 5 - projects/snowswap-xyz/index.js | 19 -- projects/solidex-finance-v3/index.js | 20 -- projects/sphynx/index.js | 22 -- projects/sprout/index.js | 20 -- projects/stationdex-v2/index.js | 14 - projects/swapr/index.js | 18 -- projects/swapsicle/index.js | 10 +- projects/tokeniza/index.js | 29 -- projects/tonnel/index.js | 55 ---- projects/touch-fan/index.js | 32 -- projects/trader-joe-stek/index.js | 18 -- projects/turboflow/index.js | 31 -- projects/v3s-finance/index.js | 4 +- projects/velodrome-CL/index.js | 27 -- projects/volta-dao/index.js | 6 +- projects/winr-protocol/index.js | 22 -- projects/wstgbp/index.js | 12 - projects/zenith/index.js | 24 -- projects/zk-money/index.js | 12 - registries/aaveV3.js | 4 + registries/balancer.js | 30 ++ registries/compound.js | 14 +- registries/erc4626.js | 30 +- registries/masterchef.js | 16 + registries/stakingOnly.js | 12 +- registries/sumTokens/data1.js | 386 +++++++++++++++++++++++ registries/treasury.js | 43 +++ registries/uniswapV2.js | 232 +++++++++++++- 106 files changed, 801 insertions(+), 1787 deletions(-) delete mode 100644 projects/ABCDEFX/index.js delete mode 100644 projects/BlastNYAN/index.js delete mode 100644 projects/DegenDex/index.js delete mode 100644 projects/GajFinance/index.js delete mode 100644 projects/GateSwap/index.js delete mode 100644 projects/MeowMiner/index.js delete mode 100644 projects/OCTOplace/index.js delete mode 100644 projects/PyreSwap/index.js delete mode 100644 projects/aborean-CL/index.js delete mode 100644 projects/abstraDex/index.js delete mode 100644 projects/ada-harvest/index.js delete mode 100644 projects/aerodrome-ignition/index.js delete mode 100644 projects/aeva-bridge/index.js delete mode 100644 projects/alyx-finance/index.js delete mode 100644 projects/anvil/index.js delete mode 100644 projects/aof-stake-mining/index.js delete mode 100644 projects/applepie/index.js delete mode 100644 projects/array-capital/index.js delete mode 100644 projects/arrland/index.js delete mode 100644 projects/astaria-v2/index.js delete mode 100644 projects/bamboodefi/index.js delete mode 100644 projects/blastname/index.js delete mode 100644 projects/bryanonbase/index.js delete mode 100644 projects/business-builders-nfts/index.js delete mode 100644 projects/citrea/index.js delete mode 100644 projects/coffeefi/index.js delete mode 100644 projects/darkness/index.js delete mode 100644 projects/deq/index.js delete mode 100644 projects/djed-alliance/index.js delete mode 100644 projects/drefinance/index.js delete mode 100644 projects/dyorswap/index.js delete mode 100644 projects/dyson/index.js delete mode 100644 projects/electrowizy/index.js delete mode 100644 projects/elkfinance/index.js delete mode 100644 projects/emberswap/index.js delete mode 100644 projects/everstrike/index.js delete mode 100644 projects/firebot/index.js delete mode 100644 projects/hectagon/index.js delete mode 100644 projects/hybra-v4/index.js delete mode 100644 projects/icecreamswap/index.js delete mode 100644 projects/insuredefi/index.js delete mode 100644 projects/izumi-iziswap-v2/index.js delete mode 100644 projects/kilolend/index.js delete mode 100644 projects/klex/index.js delete mode 100644 projects/megaswap/index.js delete mode 100644 projects/mimas-finance/index.js delete mode 100644 projects/minerPepe/index.js delete mode 100644 projects/nest/index.js delete mode 100644 projects/o2-dao/index.js delete mode 100644 projects/olympulsex/index.js delete mode 100644 projects/openfi/index.js delete mode 100644 projects/optidoge/index.js delete mode 100644 projects/pacifica/index.js delete mode 100644 projects/passdex/index.js delete mode 100644 projects/penpad/index.js delete mode 100644 projects/phission-finance/index.js delete mode 100644 projects/photon-protocol/index.js delete mode 100644 projects/plasma-saving-vaults/index.js delete mode 100644 projects/plaxswap/index.js delete mode 100644 projects/polaris-finance/index.js delete mode 100644 projects/privacy-cash/index.js delete mode 100644 projects/qilin/index.js delete mode 100644 projects/ribbon-earn/index.js delete mode 100644 projects/sapien-vault/index.js delete mode 100644 projects/satoriSwap/index.js delete mode 100644 projects/scorch/index.js delete mode 100644 projects/smiliee-gbera/index.js delete mode 100644 projects/snowswap-xyz/index.js delete mode 100644 projects/solidex-finance-v3/index.js delete mode 100644 projects/sphynx/index.js delete mode 100644 projects/sprout/index.js delete mode 100644 projects/stationdex-v2/index.js delete mode 100644 projects/swapr/index.js delete mode 100644 projects/tokeniza/index.js delete mode 100644 projects/tonnel/index.js delete mode 100644 projects/touch-fan/index.js delete mode 100644 projects/trader-joe-stek/index.js delete mode 100644 projects/turboflow/index.js delete mode 100644 projects/velodrome-CL/index.js delete mode 100644 projects/winr-protocol/index.js delete mode 100644 projects/wstgbp/index.js delete mode 100644 projects/zenith/index.js delete mode 100644 projects/zk-money/index.js diff --git a/projects/1bch/index.js b/projects/1bch/index.js index 05cd69e9b5b..c1a6adad183 100644 --- a/projects/1bch/index.js +++ b/projects/1bch/index.js @@ -1,7 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { getUniTVL } = require('../helper/unknownTokens') -const { stakingPriceLP } = require('../helper/staking') +const { staking } = require('../helper/staking') const WBCH = ADDRESSES.smartbch.WBCH; const rBCH = "0xb4602588E5F1F9653B6F234206c91552E457fAcB"; @@ -22,6 +22,6 @@ module.exports = { smartbch: { tvl: sdk.util.sumChainTvls([bchDexTvl, bchMasterChef]), // masterchef: bchMasterChef, - staking: stakingPriceLP(MASTERBREEDER, rBCH, rBCH_WBCH_LP), + staking: staking(MASTERBREEDER, rBCH), }, } diff --git a/projects/ABCDEFX/index.js b/projects/ABCDEFX/index.js deleted file mode 100644 index b375d7b19e1..00000000000 --- a/projects/ABCDEFX/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens') -const chains = ['fantom', 'kcc', 'echelon', 'multivac', 'kava'] - -module.exports = { - misrepresentedTokens: true, - methodology: "Using DefiLlama's SDK for making on-chain calls to ABcDeFX Factory Contract to iterate over Liquidity Pools & count token balances therein.", -}; - -chains.forEach(chain => { - module.exports[chain] = { tvl: getUniTVL({ factory: '0x01F43D2A7F4554468f77e06757e707150e39130c', useDefaultCoreAssets: true, hasStablePools: true, stablePoolSymbol: 'ABcDeFx.LP' }) } -}) \ No newline at end of file diff --git a/projects/BlastNYAN/index.js b/projects/BlastNYAN/index.js deleted file mode 100644 index f08da36369d..00000000000 --- a/projects/BlastNYAN/index.js +++ /dev/null @@ -1,35 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unknownTokens') -const WETH = ADDRESSES.blast.WETH -const BLNYAN = '0x9aAC39ca368D27bf03887CCe32f28b44F466072F' -const BLNYAN_WETH_SLP = '0x0E9309f32881899F6D4aC2711c6E21367A84CA26' - -const stakingBLNYANContract = '0xA76D6dc805d0EbEcb3787c781ce3A18feEF020cb' -const feeDistro = '0xBC8a7a845cC7A8246EB34856Afe6f1a3d62BD9C6' -const stakeLpEarnWeth = '0xF63Ef9F4320f9d16731a40ff1f58a966ee086806' -const button = '0x00066Ed6c2F7d6CC6e66c678BaEE2C8683B632e6' -const lockPoints = '0x46B3a66ef4fAC801B455884035eF2862F01e6158' -const opts = { useDefaultCoreAssets: true, lps: [BLNYAN_WETH_SLP] } - -module.exports = { - misrepresentedTokens: true, - blast: { - tvl: sumTokensExport({ - owners: [lockPoints, feeDistro, button], - tokens: [WETH], - ...opts, - }), - pool2: sumTokensExport({ - ...opts, - owners: [stakeLpEarnWeth], - tokens: [BLNYAN_WETH_SLP], - }), - staking: sumTokensExport({ - owners: [stakingBLNYANContract, lockPoints], - tokens: [BLNYAN], - ...opts, - }), - }, - methodology: - 'Counts as TVL the ETH only. blNYAN and LP assets deposited are counted as Pool2 and staking Respectively', -} diff --git a/projects/DegenDex/index.js b/projects/DegenDex/index.js deleted file mode 100644 index 03afaec1d9e..00000000000 --- a/projects/DegenDex/index.js +++ /dev/null @@ -1,15 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens') -const config = { - bsc: '0x858FdBfD94C298D511F5Fb839d1f59eb1d8840D2', - dogechain: '0xfc5F561aa36D4f85BfA9A89Dbf058932223d43dB', -} - -module.exports = { - misrepresentedTokens: true, -} - -Object.keys(config).forEach(chain => { - module.exports[chain] = { - tvl: getUniTVL({ factory: config[chain], useDefaultCoreAssets: true,}) - } -}) diff --git a/projects/GajFinance/index.js b/projects/GajFinance/index.js deleted file mode 100644 index f99b42300ed..00000000000 --- a/projects/GajFinance/index.js +++ /dev/null @@ -1,17 +0,0 @@ -const { sumTokens2 } = require('../helper/unwrapLPs'); -const { masterChefExports } = require("../helper/masterchef"); - -const GAJ_TOKEN = '0xf4b0903774532aee5ee567c02aab681a81539e92' -const GAJ_AVAX_TOKEN = '0x595c8481c48894771CE8FaDE54ac6Bf59093F9E8' -const MASTER_GAJ = '0xb03f95e649724df6ba575c2c6ef062766a7fdb51' -const NFTFARM_GAJ_AVAX = '0x65096f7dB56fC27C7646f0aBb6F9bC0CEA2d8765' - -const stakingAvax = (api) => sumTokens2({ api, tokensAndOwners: [[GAJ_AVAX_TOKEN, NFTFARM_GAJ_AVAX]] }) - -module.exports = { - methodology: "TVL comes from NFT Farming, Jungle Pools, MasterChef and Vaults", - avax:{ - staking: stakingAvax, - }, - ...masterChefExports(MASTER_GAJ, 'polygon', GAJ_TOKEN), -} diff --git a/projects/GateSwap/index.js b/projects/GateSwap/index.js deleted file mode 100644 index e2bace76351..00000000000 --- a/projects/GateSwap/index.js +++ /dev/null @@ -1,15 +0,0 @@ -const { getUniTVL } = require("../helper/unknownTokens") - -const config = { - gatelayer: '0xaD8d59f3e026c02Aed0DAdFB46Ceca127030DFa2' -} - -module.exports = { - misrepresentedTokens: true, -} - -Object.keys(config).forEach(chain => { - module.exports[chain] = { - tvl: getUniTVL({ factory: config[chain], useDefaultCoreAssets: true }), - } -}) diff --git a/projects/MeowMiner/index.js b/projects/MeowMiner/index.js deleted file mode 100644 index e4a47d80269..00000000000 --- a/projects/MeowMiner/index.js +++ /dev/null @@ -1,12 +0,0 @@ -const { sumTokensExport } = require("../helper/unknownTokens") -const MEOW_TOKEN_CONTRACT = '0x8aD25B0083C9879942A64f00F20a70D3278f6187'; -const MEOW_MINER_CONTRACT = '0xc0F9a97E46Fb0f80aE39981759eAB4a61eE36459'; -const LP_MEOW_WAVAX = "0xbbf8e4b9AD041edE1F5270CAf5b7B41F0e55f719" - -module.exports = { - methodology: 'counts the number of MEOW tokens in the Meow Miner contract.', - start: '2024-03-13', - avax: { - tvl: sumTokensExport({ owner: MEOW_MINER_CONTRACT, tokens: [MEOW_TOKEN_CONTRACT], lps: [LP_MEOW_WAVAX], useDefaultCoreAssets: true, }), - } -} \ No newline at end of file diff --git a/projects/OCTOplace/index.js b/projects/OCTOplace/index.js deleted file mode 100644 index 51796bb0066..00000000000 --- a/projects/OCTOplace/index.js +++ /dev/null @@ -1,13 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { sumTokensExport } = require("../helper/unwrapLPs"); - -const contractKAVA = "0x61F91266F6abEA61447E00EB781A3c38a3D1b925"; -const contractTHETA = "0x6e4c614da85DD861e08f84706742239dBA892Df1"; -const KAVA_TFUEL = ADDRESSES.null; // Native coin -const USDC = "0xfa9343c3897324496a05fc75abed6bac29f8a40f"; - -module.exports = { - kava: { tvl: sumTokensExport({ owner: contractKAVA, tokens: [KAVA_TFUEL, USDC] }) }, - theta: { tvl: sumTokensExport({ owner: contractTHETA, tokens: [KAVA_TFUEL] }) } -}; diff --git a/projects/PyreSwap/index.js b/projects/PyreSwap/index.js deleted file mode 100644 index 3fb46e898ba..00000000000 --- a/projects/PyreSwap/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens'); - -module.exports = { - misrepresentedTokens: true, -}; - -['fantom', 'bsc', 'avax'].forEach(chain => { - module.exports[chain] = { - tvl: getUniTVL({ factory: '0x045d720873f0260e23da812501a7c5930e510aa4', useDefaultCoreAssets: true, }) - } -}) \ No newline at end of file diff --git a/projects/aborean-CL/index.js b/projects/aborean-CL/index.js deleted file mode 100644 index 7126f1355be..00000000000 --- a/projects/aborean-CL/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens.js') -const config = { - abstract: { factory: '0x8cfE21F272FdFDdf42851f6282c0f998756eEf27', blacklistedTokens: [] }, -} - -Object.keys(config).forEach(chain => { - const { factory, blacklistedTokens, } = config[chain] - module.exports[chain] = { - tvl: getUniTVL({ - factory, blacklistedTokens, fetchBalances: true, abis: { - allPairsLength: 'uint256:allPoolsLength', - allPairs: "function allPools(uint) view returns (address)", - } - }) - } -}) \ No newline at end of file diff --git a/projects/abstraDex/index.js b/projects/abstraDex/index.js deleted file mode 100644 index 75dcb1d9baa..00000000000 --- a/projects/abstraDex/index.js +++ /dev/null @@ -1,23 +0,0 @@ - - - -const { getUniTVL } = require("../helper/unknownTokens"); - -const config = { - xlayer: '0xa7afb6163c331ddb0845843889d6f9544328846f', - zkfair: '0x174c4C03DfeA09682728A5959A253bf1F7C7766F', - zeta: '0x174c4C03DfeA09682728A5959A253bf1F7C7766F', - blast: '0xA7afB6163c331DDb0845843889D6f9544328846F', - cyeth: '0x174c4c03dfea09682728a5959a253bf1f7c7766f', - cronos_zkevm: '0x76D1fC018676f8A973474C24F40A2e14e401b770', - morph: '0x174c4C03DfeA09682728A5959A253bf1F7C7766F', -} - -module.exports = { - misrepresentedTokens: true, -} - -Object.keys(config).forEach(chain => { - module.exports[chain] = { tvl: getUniTVL({ factory: config[chain], useDefaultCoreAssets: true, }), } -}) - diff --git a/projects/ada-harvest/index.js b/projects/ada-harvest/index.js deleted file mode 100644 index de2c38b25ab..00000000000 --- a/projects/ada-harvest/index.js +++ /dev/null @@ -1,20 +0,0 @@ -const { sumTokensExport } = require('../helper/chain/cardano'); - -// ADA Harvest - Cardano PlutusV3 flash loan vault + yield aggregator -// Vault address (base address, delegates to a stake pool): -// addr1z9mhqtrnwpc76frp2xtgtfyt4lwzzdfwsye0uh335kycu4sgucktr6zta3rtuqlqam4395sry3vl5c7ss08m50qtnj6s5usxpa -// Docs: https://ada-harvest.com - -const VAULT_ADDRESS = 'addr1z9mhqtrnwpc76frp2xtgtfyt4lwzzdfwsye0uh335kycu4sgucktr6zta3rtuqlqam4395sry3vl5c7ss08m50qtnj6s5usxpa'; - -module.exports = { - // Vault funds may later be deployed into Minswap/Liqwid, which have their own - // adapters, so flag as double-counted to avoid inflating total Cardano TVL. - doublecounted: true, - methodology: - 'Counts only the ADA (lovelace) locked in the ADA Harvest PlutusV3 vault contract. ' + - 'Non-ADA assets are excluded. The vault earns flash loan fees and ADA staking rewards.', - cardano: { - tvl: sumTokensExport({ scripts: [VAULT_ADDRESS], tokens: ['lovelace'] }), - }, -}; diff --git a/projects/aerodrome-ignition/index.js b/projects/aerodrome-ignition/index.js deleted file mode 100644 index bf38d1522e2..00000000000 --- a/projects/aerodrome-ignition/index.js +++ /dev/null @@ -1,17 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens.js') - -const config = { - base: { factory: '0xade65c38cd4849adba595a4323a8c7ddfe89716a', blacklistedTokens: [] }, -} - -Object.keys(config).forEach(chain => { - const { factory, blacklistedTokens } = config[chain] - module.exports[chain] = { - tvl: getUniTVL({ - factory, blacklistedTokens, fetchBalances: true, abis: { - allPairsLength: 'uint256:allPoolsLength', - allPairs: "function allPools(uint) view returns (address)", - } - }) - } -}) \ No newline at end of file diff --git a/projects/aeva-bridge/index.js b/projects/aeva-bridge/index.js deleted file mode 100644 index e51e7ed1c39..00000000000 --- a/projects/aeva-bridge/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { staking } = require('../helper/staking') - -// Hyperlane HypERC20Collateral routers (core 12.1.0) holding the bridged collateral on Robinhood Chain -const AEVA = '0xe8729Dc9dCA85167e06b7E9c66a58b22457c5F30' -const AEVA_ROUTER = '0xA880B6e6511DAF5A0Bdde96EE8b36D8004D9D7eD' -const USDG_ROUTER = '0x856a649A84C8c6bB1e2541097bB293af5DD57857' - -module.exports = { - methodology: "TVL counts the USDG locked in the Aeva bridge's Hyperlane collateral router on Robinhood Chain, which backs aeUSD on Aeva Mainnet. $AEVA locked in the AEVA router is Aeva's own token and is counted under staking.", - start: '2026-09-28', - robinhood: { - tvl: (api) => api.sumTokens({ owner: USDG_ROUTER, tokens: [ADDRESSES.robinhood.USDG] }), - staking: staking(AEVA_ROUTER, AEVA), - }, -} diff --git a/projects/alyx-finance/index.js b/projects/alyx-finance/index.js deleted file mode 100644 index adaef80d5b2..00000000000 --- a/projects/alyx-finance/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const { sumTokensExport } = require("../helper/unknownTokens"); - -const masterchefAddress = "0x7Bd2f7641b875872c7c04ee3B426F753C7093aD5"; -const alyxToken = "0x2701C7cBf3220FFF6e6CEaabbCD9B932Eb11E3Ff"; -const alyx_bsc_lp = "0xf5Ea0B5AafC6eDACA15909a02C1e16bCaCd74C1e" -const treasury = "0x576182b7a1b0bC67701ead28a087228c50Aa0982"; - -module.exports = { - misrepresentedTokens: true, - bsc: { - tvl: sumTokensExport({ tokens: [alyx_bsc_lp], owner: treasury, useDefaultCoreAssets: true }), - pool2: sumTokensExport({ tokens: [alyx_bsc_lp], owner: masterchefAddress, useDefaultCoreAssets: true }), - staking: sumTokensExport({ tokens: [alyxToken], owner: masterchefAddress, useDefaultCoreAssets: true, lps: [alyx_bsc_lp] }), - }, - methodology: `Total amount of tokens in treasury and masterchef contract`, -}; \ No newline at end of file diff --git a/projects/anvil/index.js b/projects/anvil/index.js deleted file mode 100644 index 54d3e8850c5..00000000000 --- a/projects/anvil/index.js +++ /dev/null @@ -1,5 +0,0 @@ -const { treasuryExports } = require("../helper/treasury"); - -module.exports = treasuryExports({ - ethereum: { owners: ['0x5d2725fdE4d7Aa3388DA4519ac0449Cc031d675f'], }, -}) \ No newline at end of file diff --git a/projects/aof-stake-mining/index.js b/projects/aof-stake-mining/index.js deleted file mode 100644 index 5f58b7ccb5e..00000000000 --- a/projects/aof-stake-mining/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const { treasuryExports } = require("../helper/treasury"); -const { nullAddress } = require('../helper/tokenMapping'); - -module.exports = treasuryExports({ - metis: { - owners: ['0x946D86422775E7B32F3F8f0580504EADccF9b800'], - tokens: [ - nullAddress, - ], - }, - }) \ No newline at end of file diff --git a/projects/applepie/index.js b/projects/applepie/index.js deleted file mode 100644 index 4b5c1304d67..00000000000 --- a/projects/applepie/index.js +++ /dev/null @@ -1,19 +0,0 @@ -const { sumTokensExport } = require("../helper/unknownTokens") -const ADDRESSES = require('../helper/coreAssets.json') -const LPS = ["0xf11A3f0EdB8D7B2ef36A4acDCf50D9214eC23FD1"] -const TOKENS = ["0x574f75bc522CB42ec2365dc54485D471f2eFb4B6"] - -module.exports = { - methodology: - "First Crosschain Pool as a Service Miner. Twist to generate 10%/daily reward.", - bsc: { - tvl: sumTokensExport({ - tokensAndOwners: [ - [ADDRESSES.null, '0xBc4719D9F347EB1d9551d71862d2Cb4db99916f9'], - [ADDRESSES.bsc.CAKE, '0x4356c2d63e9376024e7E953e18cfC7125e643eE5'], - [ADDRESSES.bsc.USDT, '0x6E8e3F4C058C5e0422E971CE27B0fc91175F4018'], - ] - }), - staking: sumTokensExport({ owners: ['0x77F7285d23ca4A9FdAe238d29a20a38482d9B4B7'], tokens: TOKENS, lps: LPS, useDefaultCoreAssets: true, }), - }, -} diff --git a/projects/array-capital/index.js b/projects/array-capital/index.js deleted file mode 100644 index c878cc4a741..00000000000 --- a/projects/array-capital/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const { staking } = require('../helper/staking'); - -const token = "0x164731cd270daa4a94bc70761e53320e48367b8b"; -const masterchef = "0x1b91b24d12C934383f25aa07C2c9C9666accf39e"; - -module.exports = { - arbitrum: { - tvl: () => 0, - staking: staking(masterchef, token) - } -} \ No newline at end of file diff --git a/projects/arrland/index.js b/projects/arrland/index.js deleted file mode 100644 index 737a9c71824..00000000000 --- a/projects/arrland/index.js +++ /dev/null @@ -1,17 +0,0 @@ - -const { stakings } = require("../helper/staking"); -const { pool2s } = require("../helper/pool2"); - -const stakingAddresses = ["0x111e34bA90D1dE9a2A57f987b5711C71FA4c0Fa0"]; -const stakingToken = "0x14e5386f47466a463f85d151653e1736c0c50fc3"; -const pool2StakingAddresses = ["0xEAf6E84B4E4C2Ce70a80fd781B6A7f177E7b60F5", "0xb94380939A15C574FE22B04FC95Ec5CCaAD783b8"]; -const lpTokens = ["0x6495b61b8088a0a82de737ffb142136119b016e6", "0x464b7eb1c66d662e652dfbfced35d465498ad9ac"]; - -module.exports = { - polygon: { - tvl: () => 0, - staking: stakings(stakingAddresses, stakingToken, "polygon"), - pool2: pool2s(pool2StakingAddresses, lpTokens, "polygon") - }, - methodology: "Counts total value locked as the $RUM token staking, LP token staking", -} \ No newline at end of file diff --git a/projects/astaria-v2/index.js b/projects/astaria-v2/index.js deleted file mode 100644 index 6af422d549f..00000000000 --- a/projects/astaria-v2/index.js +++ /dev/null @@ -1,6 +0,0 @@ -const { treasuryExports } = require("../helper/treasury"); - -module.exports = treasuryExports({ - base: { owners: ["0x0000000000A6F0986c92cf1EC4d2e77aFBE1466D"], }, - ethereum: { owners: ['0x0000000000A6F0986c92cf1EC4d2e77aFBE1466D'], }, -}) \ No newline at end of file diff --git a/projects/bamboodefi/index.js b/projects/bamboodefi/index.js deleted file mode 100644 index 89c86cad0d6..00000000000 --- a/projects/bamboodefi/index.js +++ /dev/null @@ -1,21 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens') - -const config = { - ethereum: { factory: '0x3823Ac41b77e51bf0E6536CE465479cBdedcaEa9', }, - bsc: { factory: '0xFC2604a3BCB3BA6016003806A288E7aBF75c8Aa3', }, - polygon: { factory: '0x25cc30af6b2957b0ed7ceca026fc204fdbe04e59', }, - velas: { factory: '0xFC2604a3BCB3BA6016003806A288E7aBF75c8Aa3', }, -} - -module.exports = { - misrepresentedTokens: true, - methodology: - "TVL is calculated from the Bamboo DeFi factory smart contracts on each chain.", -}; - -Object.keys(config).forEach(chain => { - const { factory } = config[chain] - module.exports[chain] = { - tvl: getUniTVL({ factory, useDefaultCoreAssets: true, }) - } -}) diff --git a/projects/bbbpump/index.js b/projects/bbbpump/index.js index 0d6e5402ec3..cb2ff41a502 100644 --- a/projects/bbbpump/index.js +++ b/projects/bbbpump/index.js @@ -3,7 +3,6 @@ const { sumTokens2, sumTokensExport, } = require("../helper/unwrapLPs"); -const { stakingPriceLP } = require("../helper/staking"); const sdk = require("@defillama/sdk"); const { pool2 } = require("../helper/pool2"); @@ -32,11 +31,13 @@ module.exports = { resolveLP: true, }), ]), - staking: sdk.util.sumChainTvls([ - stakingPriceLP(MegadropBBB, BBB, XDC_BBB_LP, "wrapped-xdc"), - stakingPriceLP(lpStake, psXDC, XDC_psXDC_LP, "wrapped-xdc"), - stakingPriceLP(lpStake, bpsXDC, XDC_bpsXDC_LP, "wrapped-xdc"), - ]), + staking: sumTokensExport({ + tokensAndOwners: [ + [BBB, MegadropBBB], + [psXDC, lpStake], + [bpsXDC, lpStake], + ], + }), pool2: sdk.util.sumChainTvls([ pool2(lpStake, XDC_BBB_LP), pool2(lpStake, XDC_bpsXDC_LP), diff --git a/projects/benswap/index.js b/projects/benswap/index.js index c634f12c3d1..f7e541290e0 100644 --- a/projects/benswap/index.js +++ b/projects/benswap/index.js @@ -1,7 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { getUniTVL } = require('../helper/unknownTokens') -const { stakingPriceLP } = require('../helper/staking') +const { staking } = require('../helper/staking') const WBCH = ADDRESSES.smartbch.WBCH; const EBEN = "0x77CB87b57F54667978Eb1B199b28a0db8C8E1c0B"; @@ -23,10 +23,10 @@ module.exports = { methodology: "Factory address (0x8d973bAD782c1FFfd8FcC9d7579542BA7Dd0998D) is used to find the LP pairs on smartBCH and Factory address (0x4dC6048552e2DC6Eb1f82A783E859157d40FA193) is used to find the liquidity of the pairs on BSC. TVL is equal to the liquidity on both AMMs plus the extra staking balance and masterchef pools.", smartbch: { tvl: sdk.util.sumChainTvls([bchDexTvl, bchMasterChef]), - staking: stakingPriceLP(MASTERBREEDER, EBEN, "smartbch", EBEN_WBCH_LP, COREASSETNAME), + staking: staking(MASTERBREEDER, EBEN), }, bsc: { tvl: getUniTVL({ factory: '0x4dC6048552e2DC6Eb1f82A783E859157d40FA193', useDefaultCoreAssets: true }), - staking: stakingPriceLP("0x03245d87295cd0783e1f10a2ea54f9e80b726af8", "0x8173dda13fd405e5bca84bd7f64e58caf4810a32", "0x4558e53328cddd5877b7348702c991f521aa35c0", "binancecoin", true), + staking: staking("0x03245d87295cd0783e1f10a2ea54f9e80b726af8", "0x8173dda13fd405e5bca84bd7f64e58caf4810a32"), }, } diff --git a/projects/blastname/index.js b/projects/blastname/index.js deleted file mode 100644 index 7ffd2f20d99..00000000000 --- a/projects/blastname/index.js +++ /dev/null @@ -1,30 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unknownTokens') - -const BNSPoolAddr = '0xb5510aB65418d53961A9fd32A8E6343f942E20Aa' -const BWETHAddr = '0x9d5d8Ca81FF96b676603a69282290c0D957C7060' - -const BNDUSDBAddr = '0x389daCE33EF8a7E020196F388cF107A881799872' -const BNSUSDBAddr = '0xdD9B243A18Fb4e46AefFa26D42797f0Be9F9AfC8' -const BNDJUICEAddr = '0x44EA24695ECB6c09C3aB756224757a5D68707618' -const BNDBNSAddr = '0xb6851BF01D81be84d13e92aDFE6F64A7D02A643f' - -module.exports = { - blast: { - tvl: sumTokensExport({ - tokensAndOwners: [ - [ADDRESSES.blast.WETH, BNSPoolAddr], - [ADDRESSES.blast.USDB, BNSPoolAddr], - [ADDRESSES.blast.WETH, BWETHAddr], - ] - }), - pool2: sumTokensExport({ - tokensAndOwners: [ - [BNDUSDBAddr, BNSPoolAddr], - [BNSUSDBAddr, BNSPoolAddr], - [BNDJUICEAddr, BNSPoolAddr], - [BNDBNSAddr, BNSPoolAddr], - ], useDefaultCoreAssets: true, - }), - } -} diff --git a/projects/bryanonbase/index.js b/projects/bryanonbase/index.js deleted file mode 100644 index a5b0e5e5258..00000000000 --- a/projects/bryanonbase/index.js +++ /dev/null @@ -1,24 +0,0 @@ -const { sumTokensExport } = require('../helper/unknownTokens') -const ADDRESSES = require('../helper/coreAssets.json') - -const stakingETHContract = "0x9acDDdbEBED00107B3eF2931607F131F392f6996"; - -const stakingBRYANContract = "0x32e5594F14de658b0d577D6560fA0d9C6F1aa724"; -const BRYAN = "0xB75445A717D5A8c268f37045162837CFe72Ac337"; - -const stakingPool2Contract = "0x5DFF152F94E0EADeD36201f1D5AC37382f3Cf51D"; -const BRYAN_WETH_SLP = "0xbCA1647EA6C7eB6916a5B33E21467ff78Bf5Ec55"; - -const stakeBryanEarnWeth = "0xC0c8BCAf6c1baE2d4A35f4D89A8EAc9A9E5D4Db0" -const stakeLpEarnWeth = "0xCf4543777342D93BEde085292E46D847BC59dc07" - -module.exports = { - misrepresentedTokens: true, - base: { - tvl: sumTokensExport({ owners: [stakingETHContract, stakeLpEarnWeth, stakeBryanEarnWeth], tokens: [ADDRESSES.base.WETH], }), - pool2: sumTokensExport({ owners: [stakingPool2Contract, stakeLpEarnWeth, ], tokens: [BRYAN_WETH_SLP], useDefaultCoreAssets: true, }), - staking: sumTokensExport({ owners: [stakingBRYANContract, stakeBryanEarnWeth], tokens: [BRYAN], lps: [BRYAN_WETH_SLP], useDefaultCoreAssets: true, }), - }, - methodology: - "Counts as TVL the ETH asset deposited through StakingETH Contract, and we count Staking and Pool2 parts in the same way", -}; diff --git a/projects/business-builders-nfts/index.js b/projects/business-builders-nfts/index.js deleted file mode 100644 index 7c11f30ee6a..00000000000 --- a/projects/business-builders-nfts/index.js +++ /dev/null @@ -1,21 +0,0 @@ -const { sumTokensExport } = require("../helper/unknownTokens"); - -const METER_FTB_CONTRACT = "0x6cfe9adad5215195c1aa9755daed29360e6ab986"; -const METER_REWARDS_CONTRACT = "0x103ed6fb861a2651ff59f0852d3739c18d45cd9b"; -const METER_FTB_MTRG_CONTRACT = "0x88cdb3e764dedcc2e3a1642957ebd513765b252a"; - -const POLYGON_FTB_CONTRACT = "0xF305012EA754252184f1071C86ae99fAc5B40320"; -const POLYGON_REWARDS_CONTRACT = "0x0455e50b2822e6f3d8dc01246aca8378a8992466"; -const POLYGON_FTB_MATIC_CONTRACT = "0x1Df39b565652eACa24dfB16A07dcfe4d7f8f02c3"; - -module.exports = { - misrepresentedTokens: true, - meter: { - staking: sumTokensExport({ owner: METER_REWARDS_CONTRACT, tokens:[METER_FTB_CONTRACT,], useDefaultCoreAssets: true, lps: [METER_FTB_MTRG_CONTRACT] }), - }, - polygon: { - staking: sumTokensExport({ owner: POLYGON_REWARDS_CONTRACT, tokens:[POLYGON_FTB_CONTRACT,], useDefaultCoreAssets: true, lps: [POLYGON_FTB_MATIC_CONTRACT] }), - tvl: () => 0, - }, - methodology: `Staking: we include locked tokens on the rewards contracts as staking`, -}; diff --git a/projects/chronoswap/index.js b/projects/chronoswap/index.js index a63ab534194..82cbdb5d08a 100644 --- a/projects/chronoswap/index.js +++ b/projects/chronoswap/index.js @@ -1,16 +1,16 @@ const { getUniTVL } = require('../helper/unknownTokens') -const { stakingPriceLP } = require('../helper/staking') -const sdk = require("@defillama/sdk") +const { sumTokensExport } = require('../helper/unwrapLPs') module.exports={ misrepresentedTokens: true, methodology: "Factory address (0x6C50Ee65CFcfC59B09C570e55D76daa7c67D6da5) is used to find the LP pairs. TVL is equal to the liquidity on the AMM, while staking is the amount of CNO & CBO tokens found in the Masterchefs(0x77ea4a4cF9F77A034E4291E8f457Af7772c2B254,0xaBAD73Be9fd441731ADb007AdB6C1b03e730A8e0).", cronos: { tvl: getUniTVL({ factory: '0x6C50Ee65CFcfC59B09C570e55D76daa7c67D6da5', useDefaultCoreAssets: true }), - staking: sdk.util.sumChainTvls([ - stakingPriceLP("0xaBAD73Be9fd441731ADb007AdB6C1b03e730A8e0", "0xA46d5775c18837e380eFB3d8Bf9D315bcd028AB1", "0x9b76213969885044FeF03AFCc08d3F4039768F7e", "crypto-com-chain"), - stakingPriceLP("0x3790F3A1cf8A478042Ec112A70881Dcfa9c7fd2a", "0x322e21dcAcE43d319646756656b29976291d7C76", "0x4bbce14d69f9fea118992f1944c084753f1b0bf9", "crypto-com-chain") - - ]) + staking: sumTokensExport({ + tokensAndOwners: [ + ["0xA46d5775c18837e380eFB3d8Bf9D315bcd028AB1", "0xaBAD73Be9fd441731ADb007AdB6C1b03e730A8e0"], // CNO in masterchef + ["0x322e21dcAcE43d319646756656b29976291d7C76", "0x3790F3A1cf8A478042Ec112A70881Dcfa9c7fd2a"], // CBO in masterchef + ], + }), } } \ No newline at end of file diff --git a/projects/citrea/index.js b/projects/citrea/index.js deleted file mode 100644 index 99469e40aa8..00000000000 --- a/projects/citrea/index.js +++ /dev/null @@ -1,29 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require("../helper/unwrapLPs"); -const { sumTokens } = require("../helper/chain/bitcoin"); - -module.exports = { - ethereum: { - tvl: sumTokensExport({ - tokensAndOwners: [ - [ - ADDRESSES.ethereum.USDC, - '0xdaa289CC487Cf95Ba99Db62f791c7E2d2a4b868E' - ], - [ - ADDRESSES.ethereum.USDT, - '0x6925ccD29e3993c82a574CED4372d8737C6dbba6' - ], - [ - ADDRESSES.ethereum.WBTC, - '0x2c01390E10e44C968B73A7BcFF7E4b4F50ba76Ed' - ] - ] - }) - }, - bitcoin: { - tvl: () => sumTokens({ - owners: ['bc1pl7grnght2uhp75wm03djde5a56syp06ssdjf7ucm4wkq0tetpqas5e20e9'] - }) - } -} \ No newline at end of file diff --git a/projects/coffeefi/index.js b/projects/coffeefi/index.js deleted file mode 100644 index a8da5aeff62..00000000000 --- a/projects/coffeefi/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens.js') - -const config = { - scroll: '0x23537BCe0533e53609A49dffdd400e54A825cb81', - arbitrum: '0xdAF8b79B3C46db8bE754Fc5E98b620ee243eb279', -} - -module.exports = { - misrepresentedTokens: true, -}; - -Object.keys(config).forEach(chain => { - module.exports[chain] = { - tvl: getUniTVL({ factory: config[chain], useDefaultCoreAssets: true, hasStablePools: true, }) - } -}) \ No newline at end of file diff --git a/projects/creditum/index.js b/projects/creditum/index.js index 8b5a2ccfd11..0f54c3235ea 100644 --- a/projects/creditum/index.js +++ b/projects/creditum/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { stakingPriceLP } = require("../helper/staking"); +const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); const lending = "0x04D2C91A8BDf61b11A526ABea2e2d8d778d4A534" @@ -19,7 +19,7 @@ async function tvl(api) { module.exports = { fantom: { tvl, - staking: stakingPriceLP("0xd9e28749e80D867d5d14217416BFf0e668C10645", "0x77128dfdd0ac859b33f44050c6fa272f34872b5e", "0x06F3Cb227781A836feFAEa7E686Bdc857e80eAa7", "wrapped-fantom"), + staking: staking("0xd9e28749e80D867d5d14217416BFf0e668C10645", "0x77128dfdd0ac859b33f44050c6fa272f34872b5e"), pool2: pool2("0xe0c43105235c1f18ea15fdb60bb6d54814299938", "0x06f3cb227781a836fefaea7e686bdc857e80eaa7"), }, } \ No newline at end of file diff --git a/projects/darkcrypto/index.js b/projects/darkcrypto/index.js index f9f3173d70c..3082012b0cd 100644 --- a/projects/darkcrypto/index.js +++ b/projects/darkcrypto/index.js @@ -1,4 +1,4 @@ -const { stakingPriceLP } = require("../helper/staking"); +const { staking } = require("../helper/staking"); const { sumUnknownTokens } = require('../helper/unknownTokens') const abi = { "poolLength": "uint256:poolLength", @@ -67,10 +67,6 @@ module.exports = { cronos: { tvl:vault, pool2: (api) => pool2Balances(api, masterChef), - staking: stakingPriceLP( - boardroom, - sky, - "0xaA0845EE17e4f1D4F3A8c22cB1e8102baCf56a77" - ), + staking: staking(boardroom, sky), }, }; diff --git a/projects/darkness/index.js b/projects/darkness/index.js deleted file mode 100644 index 67df2465043..00000000000 --- a/projects/darkness/index.js +++ /dev/null @@ -1,42 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const masterChef = "0x63Df75d039f7d7A8eE4A9276d6A9fE7990D7A6C5"; -const ness = "0xe727240728c1a5f95437b8b50afdd0ea4ae5f0c8"; -const nessroom = "0xA93248C548Ac26152F3b4F201C9101f4e032074e"; - -const { sumTokensExport } = require('../helper/unknownTokens'); - -module.exports = { - cronos: { - tvl: sumTokensExport({ - owner: '0x92631e0e84ff01853ef1bb88fc9c9f7d1e1af1ca', - tokens: [ - ADDRESSES.cronos.WCRO_1, - ADDRESSES.cronos.dai, - ADDRESSES.cronos.USDC, - '0x6582c738660bf0701f05b04dce3c4e5fcfcda47a', - ADDRESSES.cronos.USDT, - '0x83b2ac8642ae46fc2823bc959ffeb3c1742c48b5', - ADDRESSES.cronos.WBTC, - '0x9d3bbb0e988d9fb2d55d07fe471be2266ad9c81c', - '0x1ecaf6a3551e5822f142c9689d8f36a9b5f68217', - '0xfa202a63234a7089eddbfeee83c378ba248f0e9a', - ], - }), - pool2: sumTokensExport({ - owner: masterChef, - tokens: [ - '0xbfaab211c3ea99a2db682fbc1d9a999861dcba2d', - '0x8c183c81a5ae3e7a46ecaac17c4bf27a6a40bbe8', - '0xa4aa24b8e855052071df60e174219e6c8fee45a3', - '0xd9debaab797cb92c257b2988aafa92c728b124e6', - ], - useDefaultCoreAssets: true, - }), - staking: sumTokensExport({ - owner: nessroom, - tokens: [ness], - lps: ['0xd9debaab797cb92c257b2988aafa92c728b124e6'], - useDefaultCoreAssets: true, - }), - } -}; diff --git a/projects/deq/index.js b/projects/deq/index.js deleted file mode 100644 index 718f0d3bcac..00000000000 --- a/projects/deq/index.js +++ /dev/null @@ -1,7 +0,0 @@ -const { sumERC4626VaultsExport } = require('../helper/erc4626') - -module.exports = { - ethereum: { - tvl: sumERC4626VaultsExport({ vaults: ['0x3742f3Fcc56B2d46c7B8CA77c23be60Cd43Ca80a'], tokenAbi: 'avail', balanceAbi: 'assets'}), - } -} \ No newline at end of file diff --git a/projects/djed-alliance/index.js b/projects/djed-alliance/index.js deleted file mode 100644 index 6a752dc7c6d..00000000000 --- a/projects/djed-alliance/index.js +++ /dev/null @@ -1,14 +0,0 @@ -const sdk = require('@defillama/sdk'); -const utils = require('../helper/utils'); -const { sumTokensExport } = require("../helper/chain/cardano"); - - - - -module.exports = { - methodology: 'The TVL of Djed is the reserve belonging to the deployment. The TVL within a given blockchain is the sum of the TVLs of all known Djed deployments within that blockchain.', - - cardano: { - tvl: sumTokensExport({ owner: 'addr1z8mcpc26j64fmhhd6sv5qj5mk9xqnfxgm6k8zmk7h2rlu4qm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0qhxg9gt', tokens: ['lovelace']}), - }, -}; diff --git a/projects/drefinance/index.js b/projects/drefinance/index.js deleted file mode 100644 index 057f2ef03b1..00000000000 --- a/projects/drefinance/index.js +++ /dev/null @@ -1,57 +0,0 @@ -const { staking } = require("../helper/staking"); -const { pool2s } = require("../helper/pool2"); -const ADDRESSES = require('../helper/coreAssets.json') - - -const tokens = { - USDC: ADDRESSES.sonic.USDC_e, - scUSD: ADDRESSES.sonic.scUSD, - - DRE: "0xd4eee4c318794bA6FFA7816A850a166FFf8310a9", - DRE_USDC_LP: "0x18b6963ebe82b87c338032649aaad4eec43d3ecb", - DRE_scUSD_LP: "0x88640D840614BB63cfb1545897D6d228B381C659", - - DRE_Old: '0xF8232259D4F92E44eF84F18A0B9877F4060B26F1', - DRE_USDC_LP_Old: "0xB781C624397C423Cb62bAe9996cEbedC6734B76b", -} - -const coreAddresses_Old = { - depositContract: "0xb692e2706b628998B4403979D9117Ed746bf8128", - stakingContract: "0x30902d05C499911142FE62B447dDcf19649452A3", - dreBondDepository: "0x2CE3618aa69ab891eeae4a18e64aaA55624a4481", - dreOracle: "0xc3bAdcf754b0833c706Eb1b12A310B4EF5C20EB0", -} - -const coreAddresses = { - depositContract: "0xc589858dA047A4789e099FA2CfD1D974D14F344B", - stakingContract: "0x21Cfa934CEa191fBD874ee8B1B6CE2B2224De653", - dreBondDepository: "0x825A2bC06A56E556138513495b3332933c371980", - dreOracle: "0xd23E9485b76E43d8808B0eCE846D0db3bCb09B93", -} - -const toa = [ - [ADDRESSES.sonic.USDC_e, coreAddresses.depositContract], - [ADDRESSES.sonic.scUSD, coreAddresses.depositContract], - [tokens.DRE, coreAddresses.depositContract], - [tokens.DRE_USDC_LP, coreAddresses.depositContract], - [tokens.DRE_scUSD_LP, coreAddresses.depositContract], - - [tokens.DRE_Old, coreAddresses_Old.depositContract], - [tokens.DRE_USDC_LP_Old, coreAddresses_Old.depositContract], -] - - -const pool2 = { - depositContracts: [coreAddresses.depositContract, coreAddresses_Old.depositContract], - assets: [tokens.DRE_USDC_LP, tokens.DRE_USDC_LP_Old, tokens.DRE_scUSD_LP] -} - -const data = { - sonic: { - tvl: (api) => api.sumTokens({ tokensAndOwners: toa }), - staking: staking(coreAddresses.stakingContract, tokens.DRE, "sonic"), - pool2: pool2s(pool2.depositContracts, pool2.assets, "sonic"), - } -}; - -module.exports = data; diff --git a/projects/dyorswap/index.js b/projects/dyorswap/index.js deleted file mode 100644 index 5e5fd9233fc..00000000000 --- a/projects/dyorswap/index.js +++ /dev/null @@ -1,40 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { getUniTVL } = require("../helper/unknownTokens") - -const config = { - mode: '0xE470699f6D0384E3eA68F1144E41d22C6c8fdEEf', - blast: '0xA1da7a7eB5A858da410dE8FBC5092c2079B58413', - merlin: '0xA1da7a7eB5A858da410dE8FBC5092c2079B58413', - zeta: '0xA1da7a7eB5A858da410dE8FBC5092c2079B58413', - degen: '0x2CcaDb1e437AA9cDc741574bDa154686B1F04C09', - xlayer: '0x2ccadb1e437aa9cdc741574bda154686b1f04c09', - bob: '0x2CcaDb1e437AA9cDc741574bDa154686B1F04C09', - ink: '0x6c86ab200661512fDBd27Da4Bb87dF15609A2806', - sonic: '0xd8863d794520285185197F97215c8B8AD04E8815', - soneium: '0x4f0c1b4c6FdF983f2d385Cf24DcbC8c68f345E40', - unichain: '0x6c86ab200661512fDBd27Da4Bb87dF15609A2806', - plasma: '0xA9F2c3E18E22F19E6c2ceF49A88c79bcE5b482Ac', - stable: '0x61a425ab7e1f6b3fa1eb6af6162cf471fa0e7c62', - arc: '0x942Bd5BFdc5317C5507e326f8EB4BB6058AB5C10', -} - -const coreAssets = { - stable: [ - ...Object.values(ADDRESSES.stable), - '0x817997Ca8394E26CCE3dE3A076a4889b27DbF9dE', - ], -} - -module.exports = { - misrepresentedTokens: true, -} - -Object.keys(config).forEach(chain => { - module.exports[chain] = { - tvl: getUniTVL({ - factory: config[chain], - coreAssets: coreAssets[chain], - useDefaultCoreAssets: true, - }), - } -}) diff --git a/projects/dyson/index.js b/projects/dyson/index.js deleted file mode 100644 index b9b85e68464..00000000000 --- a/projects/dyson/index.js +++ /dev/null @@ -1,18 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens') - -const config = { - linea: '0xecD30C099c222AbffDaf3E2A3d2455FC8e8c739E', - polygon_zkevm: '0x51a0d4b81400581d8722627dafcd0c1ff9357d1d', - blast: '0x51a0d4b81400581d8722627dafcd0c1ff9357d1d', -} - -module.exports = { - misrepresentedTokens: true, -} - -Object.keys(config).forEach(chain => { - module.exports[chain] = { - // get reserves call fails - tvl: getUniTVL({ factory: config[chain], fetchBalances: true, useDefaultCoreAssets: true }) - } -}) diff --git a/projects/electrowizy/index.js b/projects/electrowizy/index.js deleted file mode 100644 index 1bc784f1e6a..00000000000 --- a/projects/electrowizy/index.js +++ /dev/null @@ -1,7 +0,0 @@ -const { sumERC4626VaultsExport } = require('../helper/erc4626') - -module.exports = { - polygon: { - tvl: sumERC4626VaultsExport({ vaults: [ '0x663819aB31cB6204a2A732996549B702DeC38aa9'], balanceAbi: 'uint256:totalStaked', tokenAbi: 'address:stakingToken' }), - } -} diff --git a/projects/elkfinance/index.js b/projects/elkfinance/index.js deleted file mode 100644 index 223fd0df440..00000000000 --- a/projects/elkfinance/index.js +++ /dev/null @@ -1,46 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens') - -const factories = { - xdai: "0xCB018587dA9590A18f49fFE2b85314c33aF3Ad3B", - polygon: "0xE3BD06c7ac7E1CeB17BdD2E5BA83E40D1515AF2a", - fantom: "0x7Ba73c99e6f01a37f3e33854c8F544BbbadD3420", - bsc: "0x31aFfd875e9f68cd6Cd12Cee8943566c9A4bBA13", - heco: "0x997fCE9164D630CC58eE366d4D275B9D773d54A4", - avax: "0x091d35d7F63487909C863001ddCA481c6De47091", - kcc: "0x1f9aa39001ed0630dA6854859D7B3eD255648599", - harmony: "0xCdde1AbfF5Ae3Cbfbdb55c1e866Ac56380e18720", - okexchain: "0x1116f8B82028324f2065078b4ff6b47F1Cc22B97", - moonriver: "0xd45145f10fD4071dfC9fC3b1aefCd9c83A685e77", - cronos: "0xEEa0e2830D09D8786Cb9F484cA20898b61819ef1", - telos: "0x47c3163e691966f8c1b93B308A236DDB3C1C592d", - hoo: "0x9c03E724455306491BfD2CE0805fb872727313eA", - elastos: "0x440a1B8b8e968D6765D41E6b92DF3cBb0e9D2b1e", - fuse: "0x779407e40Dad9D70Ba5ADc30E45cC3494ec71ad2", - iotex: "0xF96bE66DA0b9bC9DFD849827b4acfA7e8a6F3C42", - ethereum: "0x6511eBA915fC1b94b2364289CCa2b27AE5898d80", - optimism: "0xedfad3a0F42A8920B011bb0332aDe632e552d846", - arbitrum: "0xA59B2044EAFD15ee4deF138D410d764c9023E1F0", - kava: "0xC012C4b3d253A8F22d5e4ADA67ea2236FF9778fc", - bittorrent: "0xc06348AEE3f3E92eE452816E0D3F25C919F6fB04", - bitgert: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4", - metis: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4", - wan: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4", - neon_evm: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4", - astar: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4", - base: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4", - linea: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4", - velas: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4", - q: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4", - rsk: "0x69D10bc18cd588a4B70F836A471D4e9c2Fd86092" -} - -function chainTvl(chain) { - return getUniTVL({ chain, factory: factories[chain], useDefaultCoreAssets: true, blacklistedTokens: ['0xa9536b9c75a9e0fae3b56a96ac8edf76abc91978'] }) -} - -Object.keys(factories).forEach(chain => { - module.exports[chain] = { tvl: chainTvl(chain) } -}) -module.exports.misrepresentedTokens = true; -module.exports.timetravel = true - diff --git a/projects/emberswap/index.js b/projects/emberswap/index.js deleted file mode 100644 index 94d966e95f1..00000000000 --- a/projects/emberswap/index.js +++ /dev/null @@ -1,20 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { getUniTVL } = require('../helper/unknownTokens') -const { stakingPriceLP } = require('../helper/staking') - -const EMBER = "0x6BAbf5277849265b6738e75AEC43AEfdde0Ce88D"; -const VAULT = "0xFFbE92fDA81f853bcf00d3c7686d5DAd5A6600bB"; -const WBCH = ADDRESSES.smartbch.WBCH; -const FACTORY = "0xE62983a68679834eD884B9673Fb6aF13db740fF0"; - -const EMBER_WBCH_PAIR = "0x52c656FaF57DCbDdDd47BCbA7b2ab79e4c232C28" - -module.exports = { - misrepresentedTokens: true, - methodology: - "Factory address (0xE62983a68679834eD884B9673Fb6aF13db740fF0) is used to find the LP pairs. TVL is equal to the liquidity on the AMM. Ember tokens sent to vault are counted towards staking.", - smartbch: { - tvl: getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true }), - staking: stakingPriceLP(VAULT, EMBER, EMBER_WBCH_PAIR, "bitcoin-cash", 18) - } -}; diff --git a/projects/everstrike/index.js b/projects/everstrike/index.js deleted file mode 100644 index 8eb547cd54c..00000000000 --- a/projects/everstrike/index.js +++ /dev/null @@ -1,32 +0,0 @@ -const { sumTokensExport } = require("../helper/sumTokens"); -const ADDRESSES = require("../helper/coreAssets.json"); - -const contracts = { - ethereum: "0x558FCAcE07fBf6A3D4449240685f29Ad6669fd81", - optimism: "0xB9C1EC4647301828Bb10f6B52584201D1C16bC8F", - bsc: "0x777108936Ed411b0598c1E35266FD92e76Cf834d", - polygon: "0x4f48c6a228a0bf0c03dc53765930c0cb06f1ecd0", - base: "0xe26a4561b3d213f1479196e43fc532fb89142abd", - arbitrum: "0xAC66779A566143069A8E8590bDeaBe685054927F", -}; - -const stablecoins = { - ethereum: [ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT], - optimism: [ADDRESSES.optimism.USDC, ADDRESSES.optimism.USDC_CIRCLE, ADDRESSES.optimism.USDT], - bsc: [ADDRESSES.bsc.USDC, ADDRESSES.bsc.USDT], - polygon: [ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDC_CIRCLE, ADDRESSES.polygon.USDT], - base: [ADDRESSES.base.USDC], - arbitrum: [ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.USDT], -}; - -const adapter = { - methodology: "Counts USDC and USDT balances held by Everstrike's custody contract on each supported chain. Includes native and legacy bridged USDC where both are deployed.", -}; - -for (const [chain, owner] of Object.entries(contracts)) { - adapter[chain] = { - tvl: sumTokensExport({ owner, tokens: stablecoins[chain] }), - }; -} - -module.exports = adapter; diff --git a/projects/firebot/index.js b/projects/firebot/index.js deleted file mode 100644 index 1063d28b069..00000000000 --- a/projects/firebot/index.js +++ /dev/null @@ -1,29 +0,0 @@ -const { sumTokensExport } = require('../helper/unknownTokens') -const { sumTokensExport: ogSumExport } = require('../helper/unwrapLPs') - -const FBX_TOKEN_CONTRACT = '0xD125443F38A69d776177c2B9c041f462936F8218'; -const FIRE_VAULT_CONTRACT = '0x960d43BE128585Ca45365CD74a7773B9d814dfBE'; -const EP_TOKEN_CONTRACT = '0x60Ed6aCEF3a96F8CDaF0c0D207BbAfA66e751af2'; -const FBX_LP = '0xcffbfa978ac3fb10e829ca6b763c307daafe8a77' -const EP_FBX_LP = '0x41D9DE53EBF26F766229E42Aa02904eB2495E397' - -module.exports = { - polygon: { - tvl: () => 0, - staking: sumTokensExport({ - tokensAndOwners: [ - [EP_TOKEN_CONTRACT, EP_TOKEN_CONTRACT], - [FBX_TOKEN_CONTRACT, FIRE_VAULT_CONTRACT], - ], - lps: [EP_FBX_LP], - coreAssets: [FBX_TOKEN_CONTRACT], - restrictTokenRatio: 100, - }), - pool2: ogSumExport({ - tokensAndOwners: [ - [FBX_LP, '0x92a9180af33531A5d78d81D90AFc0523dc6c62c9'], - ], - }), - }, - methodology: 'Counts the number of FBX and EP tokens in the Vault contracts.' -}; diff --git a/projects/goblinscash/index.js b/projects/goblinscash/index.js index 0b4a39ebb78..2fd0129fd47 100644 --- a/projects/goblinscash/index.js +++ b/projects/goblinscash/index.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumUnknownTokens } = require('../helper/unknownTokens') -const { stakingPriceLP } = require("../helper/staking"); +const { staking } = require("../helper/staking"); const goblinStaking = "0x48B8aCe692ad8BD2E3139C65bFf7d28c048F8f00"; const GOB = "0x56381cB87C8990971f3e9d948939e1a95eA113a3"; @@ -14,7 +14,7 @@ const chain = "smartbch" module.exports = { misrepresentedTokens: true, smartbch: { - staking: stakingPriceLP(goblinStaking, GOB, GOB_flexUSD_MLP, "flex-usd", false, 18), + staking: staking(goblinStaking, GOB), tvl: async (_, _b, { [chain]: block }) => { return sumUnknownTokens({ chain, block, owner:treasuryAddress, tokens: [GOB_flexUSD_MLP, GOB_BCH_MLP, flexUSD], useDefaultCoreAssets: true }) } diff --git a/projects/grave/index.js b/projects/grave/index.js index 9c8ac6414ad..499b1412810 100644 --- a/projects/grave/index.js +++ b/projects/grave/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { stakingPriceLP } = require("../helper/staking"); +const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); const GRAVE = "0x3700a92dd231F0CaC37D31dBcF4c0f5cCb1db6Ca" @@ -30,6 +30,6 @@ module.exports = { avax:{ tvl: atvl, pool2: pool2(GShareRewardPool,pool2LPs,"avax"), - staking: stakingPriceLP(ASYLUM, GSHARE, gShareAvaxLp, "wrapped-avax") + staking: staking(ASYLUM, GSHARE) } }; \ No newline at end of file diff --git a/projects/hectagon/index.js b/projects/hectagon/index.js deleted file mode 100644 index 5f616dac6cf..00000000000 --- a/projects/hectagon/index.js +++ /dev/null @@ -1,19 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { staking } = require('../helper/staking'); -const { sumTokens2 } = require('../helper/unwrapLPs') - -const BUSD_ADDRESS = ADDRESSES.bsc.BUSD; -const gHECTA = '0x7d31ed03c2442f9ffc4f22d90772ee1f32fa9b0d' -const chain = 'bsc' -const HECTA_ADDRESS = "0x343915085b919fbd4414F7046f903d194c6F60EE"; -const TREASURY_ADDRESS = "0x4059c4a0b8a2B528C4f2E101A3bB8fB169aBa4fB"; -const HECTA_BUSD_ADDRESS = "0xc7cee4cea7c76e11e9f5e5e5cbc5e3b798a1c4d0"; - -module.exports = { - methodology: - "Total Value Lock in Hectagon protocol is calculated by sum of: Treasury locked value", - bsc: { - tvl: (_, _b, {[chain]: block}) => sumTokens2({ chain, block, owner: TREASURY_ADDRESS, tokens: [HECTA_BUSD_ADDRESS, BUSD_ADDRESS,]}), - staking: staking(gHECTA, HECTA_ADDRESS, chain), - }, -}; diff --git a/projects/helper/env.js b/projects/helper/env.js index 81377f8ec2d..0c820bfe023 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -38,6 +38,7 @@ const DEFAULTS = { MOVE_RPC: 'https://mainnet.movementnetwork.xyz', SUPRA_RPC: 'https://rpc-mainnet.supra.com', IOTA_RPC: "https://api.mainnet.iota.cafe", + DARWINIA_RPC: "https://rpc.darwinia.network", MEGAETH_ARCHIVAL_RPC: 'https://megaeth.blockscout.com/api/eth-rpc', SHIDO_RPC: 'https://shidoscan.net/api/eth-rpc', ACE_RPC: 'https://explorer-endurance.fusionist.io/api/eth-rpc', diff --git a/projects/helper/staking.js b/projects/helper/staking.js index 0b25e37de21..f7d966f259a 100644 --- a/projects/helper/staking.js +++ b/projects/helper/staking.js @@ -1,28 +1,10 @@ -const { sumTokensExport } = require('./unknownTokens'); - function staking(stakingContract, stakingToken) { if (!Array.isArray(stakingContract)) stakingContract = [stakingContract] if (!Array.isArray(stakingToken)) stakingToken = [stakingToken] return (api) => api.sumTokens({ owners: stakingContract, tokens: stakingToken, }) } -function stakingPriceLP(stakingContract, stakingToken, options) { - let owners = Array.isArray(stakingContract) ? stakingContract : [stakingContract] - let tokens = Array.isArray(stakingToken) ? stakingToken : [stakingToken] - let lps = [] - if (typeof options === 'string') - lps = [options] - else if (Array.isArray(options)) - lps = options - else if (options && options.lpToken) - lps = Array.isArray(options.lpToken) ? options.lpToken : [options.lpToken] - - return sumTokensExport({ owners, tokens, lps, useDefaultCoreAssets: true, }) -} - - module.exports = { staking, stakings: staking, - stakingPriceLP, } diff --git a/projects/hybra-v4/index.js b/projects/hybra-v4/index.js deleted file mode 100644 index 53c03e94b07..00000000000 --- a/projects/hybra-v4/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens.js') -const config = { - hyperliquid: { factory: '0x32b9dA73215255d50D84FeB51540B75acC1324c2', fromBlock: 16715971, }, -} - -Object.keys(config).forEach(chain => { - const { factory, blacklistedTokens, } = config[chain] - module.exports[chain] = { - tvl: getUniTVL({ - factory, blacklistedTokens, fetchBalances: true, permitFailure: true, abis: { - allPairsLength: 'uint256:allPoolsLength', - allPairs: "function allPools(uint) view returns (address)", - } - }) - } -}) \ No newline at end of file diff --git a/projects/icecreamswap/index.js b/projects/icecreamswap/index.js deleted file mode 100644 index 738a9baeedc..00000000000 --- a/projects/icecreamswap/index.js +++ /dev/null @@ -1,17 +0,0 @@ -const { getUniTVL, } = require('../helper/unknownTokens') - -const config = { - shimmer_evm: '0x24cb308a4e2F3a4352F513681Bd0c31a0bd3BA31', - bob: '0x7b2a5C88AB9367147F6ac384F857CbaDF5aA70a7', - lightlink_phoenix: '0xC87De04e2EC1F4282dFF2933A2D58199f688fC3d', - taiko: '0xC87De04e2EC1F4282dFF2933A2D58199f688fC3d' -} - -const chains = [...Object.keys(config), 'base', 'telos', 'core', 'dogechain', 'fuse', 'xdc', 'bitgert', 'scroll', 'neon_evm', 'blast' ] - -chains.forEach(chain => { - const factory = config[chain] - module.exports[chain] = { - tvl: getUniTVL({ factory: factory ?? '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', useDefaultCoreAssets: true,}) - } -}) diff --git a/projects/insuredefi/index.js b/projects/insuredefi/index.js deleted file mode 100644 index 2e3c631b6af..00000000000 --- a/projects/insuredefi/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const { sumTokensExport } = require("../helper/unwrapLPs"); - -const constant = { - treasuryPool: { - address: "0xF4b2aa60Cd469717857a8A4129C3dB9108f54D74", - } -}; - -let SURE = '0xcb86c6a22cb56b6cf40cafedb06ba0df188a416e'; - - -module.exports = { - start: '2017-12-18', // 2020/10/21 6:34:47 (+UTC) - ethereum: { tvl: sumTokensExport({ owner: constant.treasuryPool.address, token: SURE}) } -}; - diff --git a/projects/izumi-iziswap-v2/index.js b/projects/izumi-iziswap-v2/index.js deleted file mode 100644 index be731d84d30..00000000000 --- a/projects/izumi-iziswap-v2/index.js +++ /dev/null @@ -1,18 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { getUniTVL } = require('../helper/unknownTokens'); - -const iziswapClassicFactory = { - 'plume_mainnet': '0x88867BF3bB3321d8c7Da71a8eAb70680037068E4', -} - -const blacklistedTokens = [ - ADDRESSES.bsc.iUSD, - '0x1382628e018010035999A1FF330447a0751aa84f', - ADDRESSES.bsc.iUSD, // mantle iUSD - '0x078f712f038A95BeEA94F036cADB49188a90604b', // manta iUSD - ADDRESSES.bsc.iUSD, // merlin iUSD -] - -Object.keys(iziswapClassicFactory).forEach(chain => { - module.exports[chain] = { tvl: getUniTVL({ factory: iziswapClassicFactory[chain], blacklistedTokens }), } -}) diff --git a/projects/kilolend/index.js b/projects/kilolend/index.js deleted file mode 100644 index 619d69bf50a..00000000000 --- a/projects/kilolend/index.js +++ /dev/null @@ -1,9 +0,0 @@ - - -const { compoundExports2 } = require('../helper/compound'); - -module.exports = { - methodology: 'This gets the total value locked in KiloLend', - bitkub: compoundExports2({ comptroller: '0x42f098E6aE5e81f357D3fD6e104BAA77A195133A', cether: '0x0cA8DaD1e517a9BB760Ba0C27051C4C3A036eA75' }), - klaytn: compoundExports2({ comptroller: '0x2591d179a0B1dB1c804210E111035a3a13c95a48', cether: '0x2029f3E3C667EBd68b1D29dbd61dc383BdbB56e5' }) -}; \ No newline at end of file diff --git a/projects/klex/index.js b/projects/klex/index.js deleted file mode 100644 index 0af9cdc6c62..00000000000 --- a/projects/klex/index.js +++ /dev/null @@ -1,9 +0,0 @@ -const { onChainTvl } = require("../helper/balancer") - -module.exports = { - klaytn: { - tvl: onChainTvl('0xb519Cf56C63F013B0320E89e1004A8DE8139dA27', 99368355, { - onlyUseExistingCache: true, - }) - }, -} \ No newline at end of file diff --git a/projects/megaswap/index.js b/projects/megaswap/index.js deleted file mode 100644 index 85eadd70ca2..00000000000 --- a/projects/megaswap/index.js +++ /dev/null @@ -1,14 +0,0 @@ -const { getUniTVL } = require("../helper/unknownTokens"); - -const config = { - megaeth: '0x72B94fA9F854Da1bCCD03F3bAB54cF60C32193F3', -} - -module.exports = { - misrepresentedTokens: true, -} - -Object.keys(config).forEach(chain => { - module.exports[chain] = { tvl: getUniTVL({ factory: config[chain], useDefaultCoreAssets: true, }), } -}) - diff --git a/projects/mimas-finance/index.js b/projects/mimas-finance/index.js deleted file mode 100644 index 75f747fe989..00000000000 --- a/projects/mimas-finance/index.js +++ /dev/null @@ -1,32 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json'); -const { compoundExports } = require('../helper/compound'); - -const { stakingPriceLP } = require("../helper/staking"); -const token = "0x10C9284E6094b71D3CE4E38B8bFfc668199da677"; -const stakingContract = "0x268E2E1e5a465034Ee5742DA578feb41B228ad7B"; - -const wCRO = ADDRESSES.cronos.WCRO_1; -const mmCRO = "0xff024211741059a2540b01f5Be2e75fC0c1b3d82"; - -const customCompoundExports = (comptroller, cToken, underlying) => { - const originalExports = compoundExports(comptroller, cToken, underlying); - return { - ...originalExports, - borrowed: async () => 0, // Hard-code borrowed to 0 - }; -}; - -module.exports = { - cronos: { - ...customCompoundExports( - "0xdD8c94211dD19155EFFbd57EAb6D4e0DE31A3b9E", - mmCRO, - wCRO - ), - staking: stakingPriceLP( - stakingContract, - token, - "0xf56FDfeeF0Ba3de23DaB13a85602bd7BF135E80f", - ), - }, -}; diff --git a/projects/minerPepe/index.js b/projects/minerPepe/index.js deleted file mode 100644 index 0e8441d6c8f..00000000000 --- a/projects/minerPepe/index.js +++ /dev/null @@ -1,18 +0,0 @@ -const { sumTokensExport } = require("../helper/unknownTokens") -const ADDRESSES = require('../helper/coreAssets.json') -const LPS = ["0xd60f323965eD3D6b90e66eA676414A31D53A0b98"] -const TOKENS = ["0x6d306C2C9CD931160763D99376a68C14D33DC954"] - -module.exports = { - methodology: - "MinerPepe the first mining PEPE Meme Coin on Binance Smart Chain. Miners enjoy 12% daily returns in BNB and MPEPE tokens", - bsc: { - tvl: sumTokensExport({ - tokensAndOwners: [ - [ADDRESSES.null, '0x93Fb89601B5C3253b50c8d650C11bDfe5FB7EE3F'], - [ADDRESSES.bsc.CAKE, '0x18951EEe359A98fFC22b7F22641Db6E7f8571A5A'], - ] - }), - staking: sumTokensExport({ owners: ['0x26e6B07013748a1C9C12ff17A51A95e40456689C'], tokens: TOKENS, lps: LPS, useDefaultCoreAssets: true, }), - }, -} \ No newline at end of file diff --git a/projects/nest/index.js b/projects/nest/index.js deleted file mode 100644 index 0d0d815c4fb..00000000000 --- a/projects/nest/index.js +++ /dev/null @@ -1,48 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require("../helper/unwrapLPs"); - -module.exports = { - methodology: "Counts NEST tokens that have been staked in the nest dapp", -}; - - -const config = { - ethereum: { - tvlContracts: ['0xE544cF993C7d477C7ef8E91D28aCA250D135aa03'], - tokens: [ - "0x0316EB71485b0Ab14103307bf65a021042c6d380" - ], - NEST: '0x04abEdA201850aC0124161F037Efd70c74ddC74C', - stakingContracts: [ - "0xaA7A74a46EFE0C58FBfDf5c43Da30216a8aa84eC", - "0x505eFcC134552e34ec67633D1254704B09584227", - "0x9a5C88aC0F209F284E35b4306710fEf83b8f9723", - "0x34B931C7e5Dc45dDc9098A1f588A0EA0dA45025D", - "0xE544cF993C7d477C7ef8E91D28aCA250D135aa03" - ] - }, - bsc: { - tvlContracts: ['0x9484f12044b9d5707AfeaC5BD02b5E0214381801'], - tokens: [ - ADDRESSES.bsc.USDT - ], - NEST: '0x98f8669F6481EbB341B522fCD3663f79A3d1A6A7', - stakingContracts: ["0x09CE0e021195BA2c1CDE62A8B187abf810951540"] - }, - polygon: { - NEST: '0x98f8669F6481EbB341B522fCD3663f79A3d1A6A7', - stakingContracts: ["0x09CE0e021195BA2c1CDE62A8B187abf810951540"] - }, - kcc: { - NEST: '0x98f8669F6481EbB341B522fCD3663f79A3d1A6A7', - stakingContracts: ["0x7DBe94A4D6530F411A1E7337c7eb84185c4396e6"] - }, -} - -Object.keys(config).forEach(chain => { - const { NEST: token, stakingContracts = [], tokens = [], tvlContracts = [] } = config[chain] - module.exports[chain] = { - tvl: sumTokensExport({ tokens, owners: tvlContracts }), - staking: token ? sumTokensExport({ token, owners: stakingContracts }) : undefined, - } -}) \ No newline at end of file diff --git a/projects/o2-dao/index.js b/projects/o2-dao/index.js deleted file mode 100644 index 199132fd1cd..00000000000 --- a/projects/o2-dao/index.js +++ /dev/null @@ -1,15 +0,0 @@ -const { stakingPriceLP } = require("../helper/staking"); - -const transform = addr=>`avax:${addr}` -const chain = "avax" - -const joeLP = "0x7bc2561d69b56fae9760df394a9fa9202c5f1f11" - -const stakingToken = "0xAA2439DBAd718c9329a5893A51a708C015F76346" - -module.exports={ - avax:{ - tvl: () => 0, - staking: stakingPriceLP("0x50971d6B5a3CCd79C516f914208C67C8104977dF", stakingToken, joeLP, transform) - } -} \ No newline at end of file diff --git a/projects/olympulsex/index.js b/projects/olympulsex/index.js deleted file mode 100644 index 2fced2012d9..00000000000 --- a/projects/olympulsex/index.js +++ /dev/null @@ -1,12 +0,0 @@ -const { sumTokensExport } = require('../helper/unknownTokens') - -const stakingToken = "0xBB366A397D7d4d2BEDABD9139D4c32a8826605Ed"; // SEX -const staking = "0xf1Bc988e7EaBA7a2dbF0121E6ad9BEA82A1AB1ff"; -const LP = '0x2d593b3472d6a5439bC1523a04C2aec314CBc44c' - -module.exports = { - pulse: { - tvl: () => 0, - staking: sumTokensExport({ owner: staking, tokens: [stakingToken], lps: [LP], useDefaultCoreAssets: true, }), - } -} \ No newline at end of file diff --git a/projects/openfi/index.js b/projects/openfi/index.js deleted file mode 100644 index 3c205ed9a92..00000000000 --- a/projects/openfi/index.js +++ /dev/null @@ -1,12 +0,0 @@ -const { aaveV3Export } = require("../helper/aave"); - -const CONFIG = { - pharos: { - poolDatas: ['0x3EF4724f0f2fabfA0ba96AfC711D64e6BE3367Fb'], - }, - bsc: { - poolDatas: ['0xeFD74781D9C468FFE6a4d8CA7720E8EF0223744E'], - }, -}; - -module.exports = aaveV3Export(CONFIG); diff --git a/projects/optidoge/index.js b/projects/optidoge/index.js deleted file mode 100644 index 1f9a9e6f70a..00000000000 --- a/projects/optidoge/index.js +++ /dev/null @@ -1,12 +0,0 @@ -const { pool2 } = require("../helper/pool2") -const { stakingPriceLP } = require("../helper/staking") -const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') - - -module.exports = { - optimism: { - tvl: sumTokensExport({ owner: '0xc911523c466b4E1dADE1bac9A2D4ceA3F9E1A2ae', tokens: [nullAddress] }), - pool2: pool2("0x7Dbe3714371bB9FF72369AFc88703AbD2694E322", ["0x91d62ac270e5bb371a25f81c9e74f16b53448efd"], "optimism"), - staking: stakingPriceLP("0x015C4b2250F7aAC41274FeB95eFf00016C0CE08c", "0x93d97dbb1bb5290c78c23885e8026047dc8998a8", "0x91d62ac270e5bb371a25f81c9e74f16b53448efd", addr => `optimism:${addr}`) - } -} diff --git a/projects/pacifica/index.js b/projects/pacifica/index.js deleted file mode 100644 index 2104d4323dc..00000000000 --- a/projects/pacifica/index.js +++ /dev/null @@ -1,5 +0,0 @@ -const { sumTokensExport } = require('../helper/solana') - -module.exports = { - solana: { tvl: sumTokensExport({ tokenAccounts: ['72R843XwZxqWhsJceARQQTTbYtWy6Zw9et2YV4FpRHTa', 'FvGqozihHY4Mmh4Nmx2rkXnMDcumiXEbjxA9oRu3mUeJ'], solOwners: ['9sSr35zwnFTuv2kZ86i55sR9dqQLTG663homexrLYgYu'] }) } -} \ No newline at end of file diff --git a/projects/pangolin/index.js b/projects/pangolin/index.js index 974fc0615b4..02bd7f61e5b 100644 --- a/projects/pangolin/index.js +++ b/projects/pangolin/index.js @@ -1,4 +1,4 @@ -const { staking, stakingPriceLP } = require("../helper/staking"); +const { staking } = require("../helper/staking"); const { getUniTVL } = require('../helper/unknownTokens') const { cachedGraphQuery } = require("../helper/cache"); const { transformDexBalances } = require("../helper/portedTokens"); @@ -31,13 +31,7 @@ module.exports = { }, songbird: { tvl: getUniTVL({ useDefaultCoreAssets: true, factory: contracts.songbird.factory, }), - staking: stakingPriceLP( - contracts.songbird.stakingContract, - contracts.songbird.png, - '0xEd87F64065fdB4e4Ee580de1F768E2F8bD240A10', - "songbird", - false - ), + staking: staking(contracts.songbird.stakingContract, contracts.songbird.png), }, flare: { tvl: getUniTVL({ useDefaultCoreAssets: true, factory: contracts.flare.factory, }), diff --git a/projects/passdex/index.js b/projects/passdex/index.js deleted file mode 100644 index b9e6368712c..00000000000 --- a/projects/passdex/index.js +++ /dev/null @@ -1,15 +0,0 @@ -const { getUniTVL } = require("../helper/unknownTokens"); - -const config = { - soneium: '0x48E07EE0E8450811AD472fFf10aB68B895EA747A', - unichain: '0x242c913Ff5FE010430A709baab977e88435b7EBF', - hemi: '0x242c913Ff5FE010430A709baab977e88435b7EBF' -} - -module.exports = { - misrepresentedTokens: true, -} - -Object.keys(config).forEach(chain => { - module.exports[chain] = { tvl: getUniTVL({ factory: config[chain], useDefaultCoreAssets: true, }), } -}) diff --git a/projects/penpad/index.js b/projects/penpad/index.js deleted file mode 100644 index e18a9f71f5b..00000000000 --- a/projects/penpad/index.js +++ /dev/null @@ -1,45 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json'); -const { sumTokensExport } = require('../helper/unknownTokens'); - -module.exports = { - methodology: 'Counts liquidty on the staking', - scroll: { - tvl: sumTokensExport({ - tokensAndOwners: [ - [ADDRESSES.null, '0x8F53fA7928305Fd4f78c12BA9d9DE6B2420A2188'], - [ADDRESSES.scroll.WETH, '0x88844c8f2b895792532AaE2a0F877208248F3585'], - [ADDRESSES.scroll.USDT, '0xC72a7a21e3E12594c75Bc6418224E812e16a027E'], - [ADDRESSES.scroll.USDC, '0xDc1FCFe40A5Cf9745cef0B75428eE28E81D7cC56'], - [ADDRESSES.scroll.STONE, '0x20DE0435e5674Ef15E78adA570159984524B9E8F'], - [ - '0xc4d46E8402F476F269c379677C99F18E22Ea030e', - '0x0C530882C0900b13FC6E8312B52c26e7a5b8e505', - ], // pufETH - [ - '0xa25b25548B4C98B0c7d3d27dcA5D5ca743d68b7F', - '0x27D2B6cEcd759D289B0227966cC6Fe69Cc2b0424', - ], // wrsETH - [ - '0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32', - '0x96cB437706111548c3D2e1Dc21E5Ab69E5dA057a', - ], // wstETH - [ - '0xcA0bFd5f735924e34Cc567146989e467fFbbCe1a', - '0x25D710AC957A54bdD6578b5DC8187a355c805edb', - ], // weETH (Scroll Bridged) - [ - ADDRESSES.scroll.WBTC, - '0x1C04CedF3Aac5fE35A7811689Ac6Da25b01BDc81', - ], // WBTC - [ - '0x01f0a31698c4d065659b9bdc21b3610292a1c506', - '0x016d036ec56eed17b5f9dfa212e27f8e260cc7d0', - ], // weETH (Stargate Bridged) - [ - '0x3ba89d490ab1c0c9cc2313385b30710e838370a4', - '0xde12ec22c5c4eeeeaf8afdc4ec735d75cf9d15a5', - ], // SolvBTC.b - ], - }), - }, -}; diff --git a/projects/phission-finance/index.js b/projects/phission-finance/index.js deleted file mode 100644 index ff14977390f..00000000000 --- a/projects/phission-finance/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unknownTokens') - -const WETH = ADDRESSES.ethereum.WETH; -const GOV_POOL = '0x18174E80335B9fCbc8ac0AB7f40F25aba878ccCC'; -const SPLIT_CONTRACT = '0x5b38A73f9dB3F5e12BB4dCb5a434FB3bd3972E53'; -const STAKING_CONTRACT = '0x569a157eac744b87a42314e8fc03a2e648ea33a2' - -module.exports = { - methodology: 'Total amount of WETH split, plus the value of Pool2', - start: '2022-08-30', - ethereum: { - tvl: sumTokensExport({ owner: SPLIT_CONTRACT, tokens: [WETH] }), - pool2: sumTokensExport({ owner: STAKING_CONTRACT, tokens: [GOV_POOL], useDefaultCoreAssets: true }), - } -}; \ No newline at end of file diff --git a/projects/photon-protocol/index.js b/projects/photon-protocol/index.js deleted file mode 100644 index ef370d3b97c..00000000000 --- a/projects/photon-protocol/index.js +++ /dev/null @@ -1,15 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { stakingPriceLP } = require("../helper/staking"); -const { sumTokensExport } = require("../helper/unwrapLPs"); - -const photon = "0x2F1305F0619ADa14688A4291953bd7d284f9C2a5"; -const stakingContract = "0x81177472Ce36A9b1AB573804CD215C72cEb76F36"; -const photonbusd = "0xEBAa17dA7D5C616441290669E9D2c982c8B1Da25"; //PHOTON-BUSD -const treasury = "0x0f90591b01DE6F832e8B8E4ec3525efD423BCaD1"; - -module.exports = { - bsc: { - tvl: sumTokensExport({ tokens: [ADDRESSES.bsc.BUSD], owner: treasury }), - staking: stakingPriceLP(stakingContract, photon, photonbusd) - } -} \ No newline at end of file diff --git a/projects/plasma-saving-vaults/index.js b/projects/plasma-saving-vaults/index.js deleted file mode 100644 index 48c0b5d9d8e..00000000000 --- a/projects/plasma-saving-vaults/index.js +++ /dev/null @@ -1,14 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { nullAddress,treasuryExports } = require("../helper/treasury"); - -const LendingVault = "0xd1074E0AE85610dDBA0147e29eBe0D8E5873a000"; - -module.exports = treasuryExports({ - plasma: { - tokens: [ - ADDRESSES.plasma.USDT0, - '0x5D72a9d9A9510Cd8cBdBA12aC62593A58930a948', - ], - owners: [LendingVault], - }, -}) \ No newline at end of file diff --git a/projects/plaxswap/index.js b/projects/plaxswap/index.js deleted file mode 100644 index e7d207cbd5e..00000000000 --- a/projects/plaxswap/index.js +++ /dev/null @@ -1,13 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens') - -const factory = '0x709e3C6b22993189327a8CFebD572b6cc459fe40' - -module.exports = { - methodology: 'Counts liquidity across all PlaxSwap LPs', -} - -module.exports.polygon = { - tvl: getUniTVL({ - factory, - }), -} \ No newline at end of file diff --git a/projects/polaris-finance/index.js b/projects/polaris-finance/index.js deleted file mode 100644 index 97df8694169..00000000000 --- a/projects/polaris-finance/index.js +++ /dev/null @@ -1,48 +0,0 @@ -const { sumTokens2 } = require("../helper/unwrapLPs"); -const { onChainTvl } = require("../helper/balancer"); - -const xpolar = "0xeAf7665969f1DaA3726CEADa7c40Ab27B3245993"; -const xpolarRewardPool = "0x140e8a21d08cbb530929b012581a7c7e696145ef"; - -const sunrises = [ - "0xA452f676F109d34665877B7a7B203f2B445D7DE0", // polarSunrise - "0x203a65b3153C55B57f911Ea73549ed0b8EC82B2D", // tripolarSunrise - "0x37223e0066969027954a5499ea4445bB9F55b36F", // uspSunrise - "0x33Fd42C929769f2C57cD68353Bff0bD7C6c51604", // ethernalSunrise - "0x494E811678f84816878A6e7e333f834Be7d4f21D", // orbitalSunrise - "0x5DB00aeFe6404A08802678480e953ACb32E14Eab", // binarisSunrise -]; - -const singleStakeTokens = [ - "0x17cbd9C274e90C537790C51b4015a65cD015497e", // ETHERNAL - "0x266437E6c7500A947012F19A3dE96a3881a0449E", // EBOND - "0x3AC55eA8D2082fAbda674270cD2367dA96092889", // ORBITAL - "0x192bdcdd7b95A97eC66dE5630a85967F6B79e695", // OBOND - "0xa69d9Ba086D41425f35988613c156Db9a88a1A96", // USP - "0xcE32b28c19C61B19823395730A0c7d91C671E54b", // USPBOND - "0xf0f3b9Eee32b1F490A4b8720cf6F005d4aE9eA86", // POLAR - "0x3a4773e600086A753862621A26a2E3274610da43", // PBOND - "0x60527a2751A827ec0Adf861EfcAcbf111587d748", // TRIPOLAR - "0x8200B4F47eDb608e36561495099a8caF3F806198", // TRIBOND -]; - -const staking = async (api) => { - const tokensAndOwners = [ - ...sunrises.map((o) => [xpolar, o]), - ...singleStakeTokens.map((t) => [t, xpolarRewardPool]), - ]; - return sumTokens2({ api, tokensAndOwners }); -}; - -module.exports = { - misrepresentedTokens: true, - methodology: - "Pool2 TVL accounts for all LPs staked in Dawn, Staking TVL accounts for all tokens staked in Sunrise.", - aurora: { - tvl: onChainTvl("0x6985436a0E5247A3E1dc29cdA9e1D89C5b59e26b", 71729132), - staking, - }, - telos: { - tvl: onChainTvl("0x9Ced3B4E4DC978265484d1F1f569010E13f911c9", 319760799), - }, -}; diff --git a/projects/privacy-cash/index.js b/projects/privacy-cash/index.js deleted file mode 100644 index e42e3fdc331..00000000000 --- a/projects/privacy-cash/index.js +++ /dev/null @@ -1,59 +0,0 @@ -const { sumTokensExport } = require('../helper/solana') -const { sumTokensExport: evmSumTokensExport } = require('../helper/unwrapLPs') -const ADDRESSES = require('../helper/coreAssets.json') - -module.exports = { - methodology: 'Total value of all coins held in the smart contracts of the protocol', - solana: { - tvl: sumTokensExport({ - owners: ['2vV7xhCMWRrcLiwGoTaTRgvx98ku98TRJKPXhsS8jvBV'], - tokens: [ - ADDRESSES.solana.USDC, - ADDRESSES.solana.USDT, - 'A7bdiYdS5GjqGFtxf17ppRHtDKPkkRqbKtR27dxvQXaS', // ZEC - 'oreoU2P8bN6jkk3jbaiVxYnG1dCXcYxwhwyK9jSybcp', // ORE - 'sTorERYB6xAZ1SSbwpK3zoK2EEwbBrc7TZAzg1uCGiH', // legacy STORE - 'storenSbvkfzircixnaosc5CbzNZVrHJ6S3EKrS1yqR', // STORE - '9BEcn9aPEmhSPbPQeFGjidRiEKki46fVQDyPpSQXPA2D', // jlUSDC - '2uQsyo1fXXQkDtcpXnLofWy88PxcvnfH2L8FPSE62FVU', // jlwSOL - ], - solOwners: ['4AV2Qzp3N4c9RfzyEbNZs2wqWfW4EwKnnxFAZCndvfGh'] - }) - }, - base: { - tvl: evmSumTokensExport({ - owners: [ - '0x7F673790C08Ddf27c0Aa6fa9526CCC8dAaB081Ec', - '0xe91dd4AB03909f5CEb87f42B4308B222995a905b', - ], - tokens: [ADDRESSES.null, ADDRESSES.base.USDC], - }) - }, - ethereum: { - tvl: evmSumTokensExport({ - owners: [ - '0x77A10AE3E513c2D73D73eb52212c6918C8830dd0', - '0xC88F4dF2B6EdDd6B6Bdf95A0177f50C90Fa7527f', - ], - tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT], - }) - }, - bsc: { - tvl: evmSumTokensExport({ - owners: [ - '0x22D8509E7AF58b1EaFB311f8F76E81dC3a391F77', - '0x9926A40B0879b36F9586c4285f0fae597bd56313', - ], - tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT], - }) - }, - robinhood: { - tvl: evmSumTokensExport({ - owners: [ - '0xEC5266c9e44631e1ba22FD6377C38130c1F3B738', - '0xBB0C7F576B7bdAa8f2a119cb295076aCD0C9013f' - ], - tokens: [ADDRESSES.null, ADDRESSES.robinhood.USDG], - }) - }, -} diff --git a/projects/qilin/index.js b/projects/qilin/index.js deleted file mode 100644 index 2135110787b..00000000000 --- a/projects/qilin/index.js +++ /dev/null @@ -1,10 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk') -const { sumTokensExport } = require('../helper/unwrapLPs') - -const contract = "0x57A0B07dcD834cAbB844BEc8E7903A3B2faE6245" -const usdcToken = ADDRESSES.ethereum.USDC - -module.exports = { - ethereum: { tvl: sumTokensExport({ owner: contract, tokens: [usdcToken]}) }, -} \ No newline at end of file diff --git a/projects/ribbon-earn/index.js b/projects/ribbon-earn/index.js deleted file mode 100644 index 7dc69a7b1a3..00000000000 --- a/projects/ribbon-earn/index.js +++ /dev/null @@ -1,18 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unwrapLPs'); - -// Ribbon Earn vaults -const rearnUSDC = "0x84c2b16FA6877a8fF4F3271db7ea837233DFd6f0"; -const rearnstETH = "0xCE5513474E077F5336cf1B33c1347FDD8D48aE8c"; - -const tokensAndOwners = [ - [ADDRESSES.ethereum.USDC, rearnUSDC], - [ADDRESSES.ethereum.STETH, rearnstETH], -] - -module.exports = { - ethereum: { - tvl: sumTokensExport({ tokensAndOwners }), - borrowed: () => ({}), - }, -} diff --git a/projects/sapien-vault/index.js b/projects/sapien-vault/index.js deleted file mode 100644 index 903b0cc5abe..00000000000 --- a/projects/sapien-vault/index.js +++ /dev/null @@ -1,13 +0,0 @@ -const { sumERC4626VaultsExport2 } = require('../helper/erc4626') - -const VAULT = '0x60Bf63729f688287a450299962b36Cef0aFfaa42' - -module.exports = { - methodology: - 'TVL is SAPIEN held by the Base ERC-4626 Sapien PoQ Vault, measured on-chain via totalAssets(). Protocol-owned SAPIEN in RewardsController is excluded.', - start: '2026-04-07', - base: { - tvl: () => ({}), - staking: sumERC4626VaultsExport2({ vaults: [VAULT] }), - }, -} diff --git a/projects/satoriSwap/index.js b/projects/satoriSwap/index.js deleted file mode 100644 index 676e715f2fe..00000000000 --- a/projects/satoriSwap/index.js +++ /dev/null @@ -1,17 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens') - -const config = { - base: '0x4858C605862A91A34d83C19a9704f837f64fa405', - linea: '0xfF5859B60BCb3F153431cA216B1b269EB66A2020', - xlayer: '0xd967A2A9B873ccD5a5Ede00869e353949F24c3dc', -} - -module.exports = { - misrepresentedTokens: true, -} - -Object.keys(config).forEach(chain => { - module.exports[chain] = { - tvl: getUniTVL({ factory: config[chain], useDefaultCoreAssets: true }), - } -}) \ No newline at end of file diff --git a/projects/scorch/index.js b/projects/scorch/index.js deleted file mode 100644 index 03244a7f55f..00000000000 --- a/projects/scorch/index.js +++ /dev/null @@ -1,21 +0,0 @@ -const { PublicKey } = require('@solana/web3.js') -const { sumTokensExport } = require('../helper/solana') - -const SCORCH_PROGRAM = new PublicKey( - 'SCoRcH8c2dpjvcJD6FiPbCSQyQgu3PcUAWj2Xxx3mqn' -) - -const [SCORCH_AUTHORITY] = PublicKey.findProgramAddressSync( - [Buffer.from('authority')], - SCORCH_PROGRAM, -) - -module.exports = { - methodology: - 'TVL is the value of SPL and Token-2022 balances controlled by the authority PDA derived from the Scorch program on Solana.', - solana: { - tvl: sumTokensExport({ - owner: SCORCH_AUTHORITY.toString(), - }), - }, -} diff --git a/projects/smiliee-gbera/index.js b/projects/smiliee-gbera/index.js deleted file mode 100644 index c7c0a0b4124..00000000000 --- a/projects/smiliee-gbera/index.js +++ /dev/null @@ -1,5 +0,0 @@ -const { sumERC4626VaultsExport } = require('../helper/erc4626') - -module.exports = { - berachain: { tvl: sumERC4626VaultsExport({ vaults: ['0x3f7755117f1fec1981aefb01887240dbf5f2ebce'], tokenAbi: 'wbera', balanceAbi: 'totalAssets' }) }, -} \ No newline at end of file diff --git a/projects/snowswap-xyz/index.js b/projects/snowswap-xyz/index.js deleted file mode 100644 index a893b9349c0..00000000000 --- a/projects/snowswap-xyz/index.js +++ /dev/null @@ -1,19 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens') - -const baseTvl = getUniTVL({ - useDefaultCoreAssets: true, - factory: '0x5669a449D892f03B4c541A321926f18e272c64A2', -}) - -const tvl = async (api) => { - const newRpcUrl = 'https://rpc.darwinia.network'; - api.provider.rpcs = [{ url: newRpcUrl }]; - return baseTvl(api) -} - -module.exports = { - misrepresentedTokens: true, - // crab: { tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x36ABF1A7851fBF9ae9D79dc3E39C1227068158B3' }), }, - crab: { tvl: () => ({}) }, - darwinia: { tvl }, -} \ No newline at end of file diff --git a/projects/solidex-finance-v3/index.js b/projects/solidex-finance-v3/index.js deleted file mode 100644 index 073cacf6064..00000000000 --- a/projects/solidex-finance-v3/index.js +++ /dev/null @@ -1,20 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens') - -const config = { - cronos: { factory: '0x3AAAB2384e40C2F405EF87Ea7B893B406C32E59C' }, -} - -Object.keys(config).forEach(chain => { - const { factory } = config[chain] - module.exports[chain] = { - tvl: getUniTVL({ - factory, - fetchBalances: true, - useDefaultCoreAssets: true, - abis: { - allPairsLength: 'uint256:allPoolsLength', - allPairs: 'function allPools(uint) view returns (address)', - }, - }), - } -}) diff --git a/projects/sphynx/index.js b/projects/sphynx/index.js deleted file mode 100644 index 539b9921c11..00000000000 --- a/projects/sphynx/index.js +++ /dev/null @@ -1,22 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens') -const config = { - bsc: '0x8BA1a4C24DE655136DEd68410e222cCA80d43444', - cronos: '0x5019EF5dd93A7528103BB759Bb2F784D065b826a', - bitgert: '0xd4688F52e9944A30A7eaD808E9A86F95a0661DF8', - // ethereum: '0x5Fc2b10Efb7C202Ab84ffF9Ea54d240280421D4b', - // polygon: '0xF902beC4aFEcd6b9d9998F582f580Be6994A56aB', - loop: '0xc0246b4f24475a11ee4383d29575394dc237fc36', - // okexchain: '0xd38Ec16cAf3464ca04929E847E4550Dcff25b27a', - // avax: '0x4faAFf0925886AcC7B6fE752F50d244E32248700', - // arbitrum: '0x945905D2E8D14fD58E156684Ad56a71cb02F2F02', - // optimism: '0xb37C9656e88927F9CAa6177ac409EF31f85f789A', -} - -module.exports = { - misrepresentedTokens: true, -}; - -Object.keys(config).forEach(chain => { - const factory = config[chain] - module.exports[chain] = { tvl: getUniTVL({ factory, useDefaultCoreAssets: true }) } -}) diff --git a/projects/sprout/index.js b/projects/sprout/index.js deleted file mode 100644 index 1c2aba48c7c..00000000000 --- a/projects/sprout/index.js +++ /dev/null @@ -1,20 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unwrapLPs') - -const WINJ = '0x0000000088827d2d103ee2d9A6b781773AE03FfB' -const USDC = '0xa00C59fF5a080D2b954d0c75e46E22a0c371235a' -const SPROUT = '0x503f2A7bAc1E2ff2800Aa92EdB82abeF0bFA631E' - -const owners = [ - '0x1333692eB905823df110762525c26f7489BB9300', - '0xd948740da926E8908A08414879490d0D8F96D463', - '0xeBF62508F322137EE0986935Ee3b4A60a3F0D227', -] - -module.exports = { - methodology: 'TVL is the wINJ, USDC and native INJ reserves held by the three Sprout LaunchpadCore bonding curve contracts (current and two previous versions). SPROUT held as quote-asset reserves is reported under staking. Launched tokens are excluded, and liquidity that graduated to Choice is not counted.', - injective: { - tvl: sumTokensExport({ owners, tokens: [WINJ, USDC, ADDRESSES.null] }), - staking: sumTokensExport({ owners, tokens: [SPROUT] }), - }, -} diff --git a/projects/stationdex-v2/index.js b/projects/stationdex-v2/index.js deleted file mode 100644 index 3acf133e5cb..00000000000 --- a/projects/stationdex-v2/index.js +++ /dev/null @@ -1,14 +0,0 @@ - -const { getUniTVL } = require("../helper/unknownTokens"); - -const config = { - xlayer: '0xF7c16c5C5AF8838A884cF409543fdBE4Abd3D81d', -} - -module.exports = { - misrepresentedTokens: true, -} - -Object.keys(config).forEach(chain => { - module.exports[chain] = { tvl: getUniTVL({ factory: config[chain], useDefaultCoreAssets: true, }) } -}) \ No newline at end of file diff --git a/projects/swapr/index.js b/projects/swapr/index.js deleted file mode 100644 index 52b3c519735..00000000000 --- a/projects/swapr/index.js +++ /dev/null @@ -1,18 +0,0 @@ -const { getUniTVL } = require("../helper/unknownTokens"); - -const FACTORY_ADDRESS = Object.freeze({ - ethereum: "0xd34971BaB6E5E356fd250715F5dE0492BB070452", - xdai: "0x5d48c95adffd4b40c1aaadc4e08fc44117e02179", - arbitrum: "0x359f20ad0f42d75a5077e65f30274cabe6f4f01a", -}); - -module.exports = { - misrepresentedTokens: true, -}; - -Object.keys(FACTORY_ADDRESS).forEach(chain => { - const factory = FACTORY_ADDRESS[chain] - module.exports[chain] = { - tvl: getUniTVL({ chain, useDefaultCoreAssets: true, factory }) - } -}) diff --git a/projects/swapsicle/index.js b/projects/swapsicle/index.js index 1a0264c6f77..ced197a9ea7 100644 --- a/projects/swapsicle/index.js +++ b/projects/swapsicle/index.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') -const { stakingPriceLP } = require("../helper/staking") +const { staking } = require("../helper/staking") const sdk = require("@defillama/sdk") const iceBoxABI = { "totalPrimaryStaked": "uint256:totalPrimaryStaked" @@ -89,13 +89,13 @@ module.exports = { tvl: getUniTVL({ useDefaultCoreAssets: true, factory: contracts.avax.factory }), staking: sdk.util.sumChainTvls([ // Ice Cream Van - stakingPriceLP(contracts.telos.stakingContract_sPOPS, contracts.avax.pops,'avax','0x7E454625e4bD0CFdC27e752B46bF35C6343D9A78',"wrapped-avax",true), + staking(contracts.telos.stakingContract_sPOPS, contracts.avax.pops), // Ice Box stakedAVAXIceBox, stakedAVAXIceBox2, // IceVault stakedUSDC, - stakingPriceLP(contracts.avax.stakingContract_IV, contracts.avax.pops,'0x7E454625e4bD0CFdC27e752B46bF35C6343D9A78',"wrapped-avax",true) + staking(contracts.avax.stakingContract_IV, contracts.avax.pops), ]) }, polygon: { @@ -120,9 +120,9 @@ module.exports = { tvl: getUniTVL({ useDefaultCoreAssets: true, factory: contracts.telos.factory }), staking: sdk.util.sumChainTvls([ // Ice Cream Van - stakingPriceLP(contracts.telos.stakingContract_sPOPS, contracts.telos.pops,'0x6dee26f527adb0c24fef704228d8e458b46f9f5f',"wrapped-telos",true), + staking(contracts.telos.stakingContract_sPOPS, contracts.telos.pops), // NFT's - stakingPriceLP(contracts.telos.stakingContract_NFT, contracts.telos.pops,'0x6dee26f527adb0c24fef704228d8e458b46f9f5f',"wrapped-telos",true), + staking(contracts.telos.stakingContract_NFT, contracts.telos.pops), // Ice Box stakedTLOSIceBox ]) diff --git a/projects/tokeniza/index.js b/projects/tokeniza/index.js deleted file mode 100644 index 6e1a51dfc65..00000000000 --- a/projects/tokeniza/index.js +++ /dev/null @@ -1,29 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { nullAddress, treasuryExports } = require("../helper/treasury"); -const treasury = "0xbaECbdde43C6c6a167c37d5b789023592B27fF93"; - -module.exports = treasuryExports({ - moonbeam: { - tokens: [ - nullAddress, - ADDRESSES.moonbeam.USDT, - ADDRESSES.moonbeam.USDC, - ADDRESSES.moonbeam.WGLMR - ], - owners: [treasury] - }, - ethereum: { - tokens: [ - nullAddress, - ADDRESSES.ethereum.USDT - ], - owners: [treasury] - }, - polygon: { - tokens: [ - nullAddress, - ADDRESSES.polygon.USDT - ], - owners: [treasury] - }, -}) \ No newline at end of file diff --git a/projects/tonnel/index.js b/projects/tonnel/index.js deleted file mode 100644 index f172bdbd961..00000000000 --- a/projects/tonnel/index.js +++ /dev/null @@ -1,55 +0,0 @@ -const { sumTokensExport } = require('../helper/chain/ton') - -const ADDRESSES = require('../helper/coreAssets.json') -const tokens = { - "GRAM": "0:b8ef4f77a17e5785bd31ba4da50abd91852f2b8febee97ad6ee16d941f939198", // EQC47093oX5Xhb0xuk2lCr2RhS8rj-vul61u4W2UH5ORmG_O - "DFC": "0:f6eb371de82aa9cfb5b22ca547f31fdc0fa0fbb41ae89ba84a73272ff0bf2157"//EQD26zcd6Cqpz7WyLKVH8x_cD6D7tBrom6hKcycv8L8hV0GP -} -const config = { - ton: [ - { - tokens: [ADDRESSES.null], - holders: [ - "EQBemaU1eAM-fJP7tSniJGEmltPjitgGnlrP6UaXI7nzmEuV", // 5 TON - "EQBZ0-2-isPEN_lIyg9eqXO_RFWrl_PWIJq5K6SVcUwne23W", // 50 TON - "EQBYpQiQMwGBMzhOlJ52e4yXmcKCB_5uTTJ7bVSGqr-8YANi", // 250 TON - "EQB-s4WzIgGP9U6DNlFH_kSn0JuxhBCBXr_rKz2ztEiozTto", // 1000 TON - ], - }, - { - tokens: [tokens.GRAM], // GRAM - holders: [ - "EQD7U_FPYRFTGgiqrpiKh8_giyrIQHZtokUKvz2EmWvlmViC", // 500k GRAM - "EQCZXyOWRih3jtyhdCA7DV7KXluNbzqeIpJPnRkF4KEE1STp", // 30k GRAM - ], - }, - { - tokens: [tokens.DFC], // DFC - holders: [ - "EQC14SC0-P0iOXzn1971HVIDsCzQ0LllY0y5O7EE2pMLe9pT" // 100 DFC - ], - }, - ], -}; -const tonnel = "0:cd0efe78bff4c4539b76eab17293296c74f42cbf99ec499687fefec94893ed32" //EQDNDv54v_TEU5t26rFykylsdPQsv5nsSZaH_v7JSJPtMitv -const tonnelHolders = [ - "EQDTs-yjPLn7XzaRRq8pjp7H8Nw4y_OJ51Bk2dcrPlIYgwtV", // 10000 TONNEL - "EQAgoyECSzCIFTFkMIvDLgdUE3D9RxGfYQQGfxy3lBBc_Ke_", // 1000 TONNEL - "EQDzAhS3Ev8cxEBJ96MIqPjxyD_k0L3enzDWnQ3Z-4tUK1h5", // 200 TONNEL - "EQASyc8d2DjZHrFevnF432NRLc4qwh6HGUPAbMvbofMkeRZl", // 50 TONNEL - "EQCNoApBzMacKKdTwcvi1iOx78e98bTSaN1Gx_nnmd3Ek5Yn", // 66 TONNEL -] - -Object.keys(config).forEach((chain) => { - const tokenSet = new Set() - const owners = config[chain].map(({ tokens, holders }) => { - tokens.forEach(i => tokenSet.add(i)) - return holders - }).flat() - - module.exports[chain] = { - tvl: sumTokensExport({ owners, tokens: [...tokenSet], onlyWhitelistedTokens: true, }) - } - if (chain === 'ton') - module.exports.ton.staking = sumTokensExport({ owners: tonnelHolders, tokens: [tonnel], onlyWhitelistedTokens: true,}) -}) \ No newline at end of file diff --git a/projects/touch-fan/index.js b/projects/touch-fan/index.js deleted file mode 100644 index 7466196482e..00000000000 --- a/projects/touch-fan/index.js +++ /dev/null @@ -1,32 +0,0 @@ -const { sumTokensExport } = require('../helper/unknownTokens') -const fan_contract = "0x9842114F1d9c5286A6b8e23cF0D8142DAb2B3E9b" -const { nullAddress } = require('../helper/unwrapLPs') - -const touch_contract = "0xC612eD7a1FC5ED084C967bD71F1e0F0a338Cf816" -const tft_address = "0x14acccd04393f26ba155e5402aa6fddbb8e2254a" -const zk_sync_swap_pool = "0xB075F49F4Bea5204d22B42E8d442e8E9e3400AF8" -const stake_tft_contract_address = "0x38a22eFB9eE73EdABdc4A15B17D28b70bA56BDA3" -const getReservesABI = "function getReserves() external view returns (uint,uint)" -const vester_address = "0x13B8C03990b7d782cB9c3ebF7E2aA5Dc28f6133B" -const lock_tft_address = "0x9b470d1d40F437cAb76ea8fC80BC3b761e96D44D" -const lock_lp_address = "0x26854C6A28864D7E84893F45EDf366eE2494B09a" - - -module.exports = { - methodology: `We count the ETH on ${fan_contract} and ${touch_contract}`, - misrepresentedTokens: true, - era: { - tvl: sumTokensExport({ owners: [fan_contract, touch_contract], tokens: [nullAddress] }), - staking: sumTokensExport({ - owners: [lock_tft_address, vester_address, stake_tft_contract_address], tokens: [tft_address], - lps: [zk_sync_swap_pool], - abis: { getReservesABI }, - useDefaultCoreAssets: true - }), - pool2: sumTokensExport({ - owners: [lock_lp_address], tokens: [zk_sync_swap_pool], resolveLP: true, - abis: { getReservesABI }, - useDefaultCoreAssets: true - }) - } -} diff --git a/projects/trader-joe-stek/index.js b/projects/trader-joe-stek/index.js deleted file mode 100644 index cc1b7f66cf0..00000000000 --- a/projects/trader-joe-stek/index.js +++ /dev/null @@ -1,18 +0,0 @@ -const { nullAddress,treasuryExports } = require("../helper/treasury"); - -const stakingContract = "0xb22c6d1c2897b950fc1040913c0d84d788f24df2"; - - -module.exports = treasuryExports({ - - avax: { - tokens: [ - nullAddress, - "0xEbB5d4959B2FbA6318FbDa7d03cd44aE771fc999", // kong - "0x5ac04b69bde6f67c0bd5d6ba6fd5d816548b066a", // tech - "0x8ad25b0083c9879942a64f00f20a70d3278f6187", // meow - ], - owners: [stakingContract], - ownTokens: [], - } -}) \ No newline at end of file diff --git a/projects/turboflow/index.js b/projects/turboflow/index.js deleted file mode 100644 index 1d7e7b82fe4..00000000000 --- a/projects/turboflow/index.js +++ /dev/null @@ -1,31 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unwrapLPs') -const { sumTokensExport: solanaSumTokensExport } = require('../helper/solana') - -// TurboFlow TVL = USDT/USDC held in (1) on-chain bridge contracts on BSC and -// Solana that receive user deposits, plus (2) Fireblocks MPC custody wallets -// that back user deposits and settlement obligations. - -const BSC_HOLDERS = [ - '0x145CD0d5C3dD0eF1405dCf1b4D2BCE7c611625dB', // Bridge contract (user deposits) - '0x8757f9E16d775759671e95e50D749CECCDA375AE', // Fireblocks MPC vault (SIG) - '0x077Ab3f5D4372cA14c6AA417215Af3d91B55bAFc', // Fireblocks MPC vault (TFUSERS) -] - -// TAs owned by the bridge program (authority PDA: 8iquHJQyXUq8ykTEKZjtS4wSHKnxiw4ghGWUNzPnA9Q4) and MPC wallets (6FaXzEC4CNAh1ECxc8FUnjpcnMYYG4M7DVJ5ZMbTmcWH and 4wHLLe6ovPqmGoBjvk6ogxgFbiGMCUUPvnMqmxyprX5C). -const SOLANA_BRIDGE_TOKEN_ACCOUNTS = [ - '9ayXbTyhkJ49WtG6DA2PCN6EAKtM8DCneMzhJPTMRWcj', // Bridge USDC SPL account - '6hVp2UaWWQwGo2c6yHj39WJWDNenR48GsLGKPzSa7EU2', // Bridge USDT SPL account - '2ZEku38cWzGqMzhKG6tnpC42godiy8hjGFMZwf7uvPTc', // Fireblocks vault (SIG) USDC SPL account - 'FYmWdMq9KT87jpZomMQR7Y2r4a2KbEiXkoDJcHMAP1vq', // Fireblocks vault (SIG) USDT SPL account - '3uCQ76uwDRur1udh4EPjzN84K2vrrcnyH2AnuUjFWNAF', // Fireblocks vault (TFUSERS) USDC SPL account - '8ckjipCeccH3RrcPyXU8xCBGHRK9qgSPuU47ZfBKWGKC', // Fireblocks vault (TFUSERS) USDT SPL account -] - -module.exports = { - methodology: - 'TVL counts USDT and USDC balances held by TurboFlow on (i) on-chain bridge contracts on BSC and Solana that receive user deposits, and (ii) protocol-operated MPC custody wallets (Fireblocks) that back user deposits and settlement obligations.', - start: '2025-10-19', - bsc: { tvl: sumTokensExport({owners: BSC_HOLDERS, tokens: [ADDRESSES.bsc.USDC, ADDRESSES.bsc.USDT]}) }, - solana: { tvl: solanaSumTokensExport({tokenAccounts: SOLANA_BRIDGE_TOKEN_ACCOUNTS}) }, -} \ No newline at end of file diff --git a/projects/v3s-finance/index.js b/projects/v3s-finance/index.js index e301171dbcc..97a9389985a 100644 --- a/projects/v3s-finance/index.js +++ b/projects/v3s-finance/index.js @@ -1,4 +1,4 @@ -const { stakingPriceLP } = require("../helper/staking"); +const { staking } = require("../helper/staking"); const { masterchefExports, } = require('../helper/unknownTokens'); const { pool2 } = require('../helper/pool2'); @@ -24,6 +24,6 @@ module.exports = mergeExports([masterchefExports({ }), { cronos: { pool2: pool2(vShareRewardsAddr, pool2LPs), - staking: stakingPriceLP(boardroom, vshare, vShareCroAddress, "wrapped-cro") + staking: staking(boardroom, vshare) }, }]) diff --git a/projects/velodrome-CL/index.js b/projects/velodrome-CL/index.js deleted file mode 100644 index 78f797eae1b..00000000000 --- a/projects/velodrome-CL/index.js +++ /dev/null @@ -1,27 +0,0 @@ - -const { getUniTVL } = require('../helper/unknownTokens.js') -const config = { - optimism: { factory: '0xCc0bDDB707055e04e497aB22a59c2aF4391cd12F' }, - lisk: { }, - fraxtal: { }, - //bob: {}, - mode: { }, - ink: { }, - soneium: { }, - unichain: { }, - swellchain: { }, - celo: { }, - sseed: { }, -} - -Object.keys(config).forEach(chain => { - const { factory = '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F' } = config[chain] - module.exports[chain] = { - tvl: getUniTVL({ - factory, fetchBalances: true, abis: { - allPairsLength: 'uint256:allPoolsLength', - allPairs: "function allPools(uint) view returns (address)", - } - }) - } -}) diff --git a/projects/volta-dao/index.js b/projects/volta-dao/index.js index d2106eb070c..b0ebcdafa94 100644 --- a/projects/volta-dao/index.js +++ b/projects/volta-dao/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { stakingPriceLP } = require("../helper/staking"); +const { staking } = require("../helper/staking"); const { sumTokens2 } = require('../helper/unwrapLPs'); const ftmToken = "0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"; @@ -30,10 +30,10 @@ module.exports = { misrepresentedTokens: true, fantom: { tvl: ftmTvl, - staking: stakingPriceLP(ftmStaking, ftmToken, "0x78b51a1fd7524186982c2cb8982df312b1e896a8") + staking: staking(ftmStaking, ftmToken) }, avax: { tvl: avaxTvl, - staking: stakingPriceLP(avaxStaking, avaxToken, "0x26e7c9b2890440866d7d3f8f84b1ccaff443b9d8") + staking: staking(avaxStaking, avaxToken) } } diff --git a/projects/winr-protocol/index.js b/projects/winr-protocol/index.js deleted file mode 100644 index 1bb6d4e8727..00000000000 --- a/projects/winr-protocol/index.js +++ /dev/null @@ -1,22 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unwrapLPs') - -const WINR = ADDRESSES.winr.WINR - -// Bankroll vault - liquidity provider funds backing gameplay -const WINR_BANKROLL = '0x5eD22F7693fea5A0B45dB31771aa94E941b6df8a' - -// Escrow - user balances, settled on-chain via merkle roots -const WINR_ESCROW = '0xD75a51364440dAF83B78B9888D2b8F28eaC0D280' - -module.exports = { - methodology: - 'TVL is the tracked Arbitrum value of WINR held in the protocol bankroll vault and escrow contract. The bankroll holds liquidity provider funds backing all JustBet gameplay; the escrow holds user balances, settled on-chain via merkle roots. Prior-generation USDC contracts and the separate staking contract are excluded from this export.', - arbitrum: { - tvl: () => ({}), - staking: sumTokensExport({ - owners: [WINR_BANKROLL, WINR_ESCROW], - tokens: [WINR], - }), - }, -} diff --git a/projects/wstgbp/index.js b/projects/wstgbp/index.js deleted file mode 100644 index 70845916050..00000000000 --- a/projects/wstgbp/index.js +++ /dev/null @@ -1,12 +0,0 @@ -const { sumTokensExport } = require('../helper/unwrapLPs') - -const wstGBP = '0x57C3571f10767E49C9d7b60feb6c67804783B7aE' -const tGBP = '0x27f6c8289550fCE67f6B50BeD1F519966aFE5287' - -module.exports = { - methodology: 'TVL is the tGBP reserve held by the Ethereum wstGBP contract. wstGBP is a non-rebasing token whose redemption value accrues through an oracle-updated NAV: minting deposits tGBP, while redeeming burns wstGBP and pays tGBP at NAV less the configured redemption fee. Canonically bridged wstGBP on L2s and sidechains is excluded because the corresponding Ethereum wstGBP is locked in bridge escrow and remains backed by the same tGBP reserve.', - start: '2026-04-10', - ethereum: { - tvl: sumTokensExport({ owner: wstGBP, tokens: [tGBP] }), - }, -} diff --git a/projects/zenith/index.js b/projects/zenith/index.js deleted file mode 100644 index 7ee8c1f8971..00000000000 --- a/projects/zenith/index.js +++ /dev/null @@ -1,24 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { stakings } = require("../helper/staking"); -const { pool2s } = require("../helper/pool2"); - -const contracts = { - "masterChef": "0xb9e7008FA856D66680BeE9E0a24da407D9d7fAD5", - "stakePools": [ - ADDRESSES.null, - ADDRESSES.ethereum.STETH, - ADDRESSES.ethereum.RETH, - ] -} - - -var pool2 = ['0xAC0155CBd306e41C1287E2c53e1306178397b823']; - -module.exports = { - methodology: - "TVL is comprised of tokens deposited to Zenith protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL.", - ethereum: { - pool2: pool2s([contracts.masterChef], pool2), - tvl: stakings([contracts.masterChef], contracts.stakePools), - }, -}; diff --git a/projects/zk-money/index.js b/projects/zk-money/index.js deleted file mode 100644 index b0f77d39898..00000000000 --- a/projects/zk-money/index.js +++ /dev/null @@ -1,12 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unwrapLPs') - -const PORTAL = '0xdf410ad448A0f7165181FBdB32f8896f4a0d9449' - -module.exports = { - start: '2026-09-25', - methodology: 'TVL is the DAI held in zk.money\'s Ethereum portal, which backs private DAI balances on Aztec. USDC and USDT deposits are swapped to DAI before entering the portal.', - ethereum: { - tvl: sumTokensExport({ owner: PORTAL, tokens: [ADDRESSES.ethereum.DAI] }), - }, -} diff --git a/registries/aaveV3.js b/registries/aaveV3.js index 9a614d74392..2c910a09ff0 100644 --- a/registries/aaveV3.js +++ b/registries/aaveV3.js @@ -120,6 +120,10 @@ const configs = { staking: ['0xBB4738D05AD1b3Da57a4881baE62Ce9bb1eEeD6C', '0xAD96C3dffCD6374294e2573A7fBBA96097CC8d7c'], // dustLock, DUST }, }, + 'openfi': { + pharos: { poolDatas: ['0x3EF4724f0f2fabfA0ba96AfC711D64e6BE3367Fb'] }, + bsc: { poolDatas: ['0xeFD74781D9C468FFE6a4d8CA7720E8EF0223744E'] }, + }, } module.exports = buildProtocolExports(configs, aaveV3ExportFn) diff --git a/registries/balancer.js b/registries/balancer.js index cbf2d3898e5..fa6f7b0b59a 100644 --- a/registries/balancer.js +++ b/registries/balancer.js @@ -182,6 +182,36 @@ const configs = { "0xdA16D6F08F20249376d01a09FEBbAd395a246b2C", "0x9be4f6a2558f88A82b46947e3703528919CE6414", ], permitFailure: true }, // several paused tokens (PieDAO pies etc.) revert balanceOf }, + 'klex': { + klaytn: { vault: '0xb519Cf56C63F013B0320E89e1004A8DE8139dA27', fromBlock: 99368355, onlyUseExistingCache: true }, + }, + 'polaris-finance': { + misrepresentedTokens: true, + methodology: 'Pool2 TVL accounts for all LPs staked in Dawn, Staking TVL accounts for all tokens staked in Sunrise.', + aurora: { + vault: '0x6985436a0E5247A3E1dc29cdA9e1D89C5b59e26b', fromBlock: 71729132, + // xpolar held by the sunrise contracts + single-stake tokens held by the xpolar reward pool + staking: { __sumTokens: { tokensAndOwners: [ + ['0xeAf7665969f1DaA3726CEADa7c40Ab27B3245993', '0xA452f676F109d34665877B7a7B203f2B445D7DE0'], // polarSunrise + ['0xeAf7665969f1DaA3726CEADa7c40Ab27B3245993', '0x203a65b3153C55B57f911Ea73549ed0b8EC82B2D'], // tripolarSunrise + ['0xeAf7665969f1DaA3726CEADa7c40Ab27B3245993', '0x37223e0066969027954a5499ea4445bB9F55b36F'], // uspSunrise + ['0xeAf7665969f1DaA3726CEADa7c40Ab27B3245993', '0x33Fd42C929769f2C57cD68353Bff0bD7C6c51604'], // ethernalSunrise + ['0xeAf7665969f1DaA3726CEADa7c40Ab27B3245993', '0x494E811678f84816878A6e7e333f834Be7d4f21D'], // orbitalSunrise + ['0xeAf7665969f1DaA3726CEADa7c40Ab27B3245993', '0x5DB00aeFe6404A08802678480e953ACb32E14Eab'], // binarisSunrise + ['0x17cbd9C274e90C537790C51b4015a65cD015497e', '0x140e8a21d08cbb530929b012581a7c7e696145ef'], // ETHERNAL + ['0x266437E6c7500A947012F19A3dE96a3881a0449E', '0x140e8a21d08cbb530929b012581a7c7e696145ef'], // EBOND + ['0x3AC55eA8D2082fAbda674270cD2367dA96092889', '0x140e8a21d08cbb530929b012581a7c7e696145ef'], // ORBITAL + ['0x192bdcdd7b95A97eC66dE5630a85967F6B79e695', '0x140e8a21d08cbb530929b012581a7c7e696145ef'], // OBOND + ['0xa69d9Ba086D41425f35988613c156Db9a88a1A96', '0x140e8a21d08cbb530929b012581a7c7e696145ef'], // USP + ['0xcE32b28c19C61B19823395730A0c7d91C671E54b', '0x140e8a21d08cbb530929b012581a7c7e696145ef'], // USPBOND + ['0xf0f3b9Eee32b1F490A4b8720cf6F005d4aE9eA86', '0x140e8a21d08cbb530929b012581a7c7e696145ef'], // POLAR + ['0x3a4773e600086A753862621A26a2E3274610da43', '0x140e8a21d08cbb530929b012581a7c7e696145ef'], // PBOND + ['0x60527a2751A827ec0Adf861EfcAcbf111587d748', '0x140e8a21d08cbb530929b012581a7c7e696145ef'], // TRIPOLAR + ['0x8200B4F47eDb608e36561495099a8caF3F806198', '0x140e8a21d08cbb530929b012581a7c7e696145ef'], // TRIBOND + ] } }, + }, + telos: { vault: '0x9Ced3B4E4DC978265484d1F1f569010E13f911c9', fromBlock: 319760799 }, + }, } module.exports = buildProtocolExports(configs, balancerExportFn) diff --git a/registries/compound.js b/registries/compound.js index 41ae37c5056..70e5ab71616 100644 --- a/registries/compound.js +++ b/registries/compound.js @@ -654,7 +654,19 @@ const configs = { methodology: 'TVL counts the underlying tokens (KKUB and USDT) held as cash by every market listed by the KINETIXDAO Comptroller on KUB Chain, i.e. supplied minus borrowed. Native KUB is wrapped to KKUB by the gateway before it is supplied, so it is counted as KKUB. Borrowed counts the totalBorrows of each market and is not included in TVL.', start: '2026-10-08', bitkub: [{comptroller: '0xc5DD9f1cE32f19C0a76a924F681914A8D10E8008'},] - } + }, + 'mimas-finance': { + // borrowed zeroed out (isInsolvent empties the borrowed bucket) + cronos: { + comptroller: '0xdD8c94211dD19155EFFbd57EAb6D4e0DE31A3b9E', cether: '0xff024211741059a2540b01f5Be2e75fC0c1b3d82', isInsolvent: true, + staking: ['0x268E2E1e5a465034Ee5742DA578feb41B228ad7B', '0x10C9284E6094b71D3CE4E38B8bFfc668199da677'], + }, + }, + 'kilolend': { + methodology: 'This gets the total value locked in KiloLend', + bitkub: { comptroller: '0x42f098E6aE5e81f357D3fD6e104BAA77A195133A', cether: '0x0cA8DaD1e517a9BB760Ba0C27051C4C3A036eA75' }, + klaytn: { comptroller: '0x2591d179a0B1dB1c804210E111035a3a13c95a48', cether: '0x2029f3E3C667EBd68b1D29dbd61dc383BdbB56e5' }, + }, } module.exports = buildProtocolExports(configs, compoundExportFn) diff --git a/registries/erc4626.js b/registries/erc4626.js index a5efd1b0cd0..06a9bc449cd 100644 --- a/registries/erc4626.js +++ b/registries/erc4626.js @@ -1,11 +1,20 @@ const { sumERC4626VaultsExport2 } = require('../projects/helper/erc4626') const { buildProtocolExports } = require('./utils') -function erc4626ExportFn(chainConfigs) { +// Chain config: an array of vault addresses, or { vaults, stakingVaults?, tokenAbi?, balanceAbi?, permitFailure? }. +// Abis default to the OG 4626 asset()/totalAssets(); set tokenAbi/balanceAbi (per chain or in _options) +// for vaults that expose them under other names. stakingVaults are summed the same way into the staking bucket. +const chainExtraKeys = new Set(['vaults', 'stakingVaults', 'tvl', 'staking', 'pool2', 'borrowed', 'vesting']) + +function erc4626ExportFn(chainConfigs, options = {}) { const result = {} Object.entries(chainConfigs).forEach(([chain, config]) => { - const vaults = Array.isArray(config) ? config : config.vaults - result[chain] = { tvl: sumERC4626VaultsExport2({ vaults }) } + const { vaults = [], stakingVaults = [] } = Array.isArray(config) ? { vaults: config } : config + const opts = { ...options } + if (!Array.isArray(config)) + for (const [k, v] of Object.entries(config)) if (!chainExtraKeys.has(k)) opts[k] = v + result[chain] = { tvl: vaults.length ? sumERC4626VaultsExport2({ vaults, ...opts }) : () => ({}) } + if (stakingVaults.length) result[chain].staking = sumERC4626VaultsExport2({ vaults: stakingVaults, ...opts }) }) return result } @@ -550,6 +559,21 @@ const configs = { methodology: 'Counts the USDC value of RWI Vault shares via totalAssets(), which accrues at the on-chain fixed yield rate. Deposits are deployed by the Vault Operator into tokenised onchain and offchain insurance opportunities. Assets are held as Pendle PT-reUSDe, so the same capital is also counted in Re and Pendle TVL.', ethereum: ['0xcAFeAA466736ac01e0AC9Ca72644beF348694731'], }, + // --- custom-abi vaults (migrated 2026-10-22) --- + 'deq': { + ethereum: { vaults: ['0x3742f3Fcc56B2d46c7B8CA77c23be60Cd43Ca80a'], tokenAbi: 'avail', balanceAbi: 'assets' }, + }, + 'electrowizy': { + polygon: { vaults: ['0x663819aB31cB6204a2A732996549B702DeC38aa9'], tokenAbi: 'address:stakingToken', balanceAbi: 'uint256:totalStaked' }, + }, + 'smiliee-gbera': { + berachain: { vaults: ['0x3f7755117f1fec1981aefb01887240dbf5f2ebce'], tokenAbi: 'wbera', balanceAbi: 'totalAssets' }, + }, + 'sapien-vault': { + methodology: 'TVL is SAPIEN held by the Base ERC-4626 Sapien PoQ Vault, measured on-chain via totalAssets(). Protocol-owned SAPIEN in RewardsController is excluded.', + start: '2026-04-07', + base: { vaults: [], stakingVaults: ['0x60Bf63729f688287a450299962b36Cef0aFfaa42'] }, + }, } module.exports = buildProtocolExports(configs, erc4626ExportFn) diff --git a/registries/masterchef.js b/registries/masterchef.js index 2502678a37d..e8c3b2dbe6b 100644 --- a/registries/masterchef.js +++ b/registries/masterchef.js @@ -41,6 +41,13 @@ function masterchefExportFn(chainConfigs, options = {}) { const helperConfig = { ...config } for (const key of chainExportKeys) delete helperConfig[key] + // A chain may carry only staking/pool2 (no masterchef): emit an empty tvl so + // buildProtocolExports can still attach its buckets. + if (!helperConfig.masterchef) { + result[chain] = { tvl: () => ({}) } + return + } + if (helperType === 'old') { const { masterchef, @@ -821,6 +828,15 @@ const configs = { { masterchef: '0x3e91B21ddE13008Aa73f07BdE26970322Fe5D533', nativeTokens: ['0x2A17Dc11a1828725cdB318E0036ACF12727d27a2', '0xedeCfB4801C04F3EB394b89397c6Aafa4ADDa15B'] }, ], }, + 'GajFinance': { + // original spread masterChefExports after its own methodology, so the helper default won + _options: { helperType: 'old' }, + polygon: { masterchef: '0xb03f95e649724df6ba575c2c6ef062766a7fdb51', stakingToken: '0xf4b0903774532aee5ee567c02aab681a81539e92' }, + avax: { + // GAJ-AVAX token locked in the NFT farm + staking: { __sumTokens: { tokensAndOwners: [['0x595c8481c48894771CE8FaDE54ac6Bf59093F9E8', '0x65096f7dB56fC27C7646f0aBb6F9bC0CEA2d8765']] } }, + }, + }, } module.exports = buildProtocolExports(configs, masterchefExportFn) diff --git a/registries/stakingOnly.js b/registries/stakingOnly.js index 1a1e6d15ab3..51eb7363f59 100644 --- a/registries/stakingOnly.js +++ b/registries/stakingOnly.js @@ -1429,7 +1429,17 @@ const configs = { "robinhood": { staking: ["0x7F1d2b117aBac121f99cEED7f80e5925fFF37A53", "0xFE936755185353b63a81dD72b47533Eb6021018E"] } - } + }, + 'array-capital': { + arbitrum: { + staking: ['0x1b91b24d12C934383f25aa07C2c9C9666accf39e', '0x164731cd270daa4a94bc70761e53320e48367b8b'], // masterchef, token + }, + }, + 'o2-dao': { + avax: { + staking: ['0x50971d6B5a3CCd79C516f914208C67C8104977dF', '0xAA2439DBAd718c9329a5893A51a708C015F76346'], + }, + }, } module.exports = buildProtocolExports(configs, stakingOnlyExportFn) diff --git a/registries/sumTokens/data1.js b/registries/sumTokens/data1.js index ade1ab2b8e5..bf65a144d2a 100644 --- a/registries/sumTokens/data1.js +++ b/registries/sumTokens/data1.js @@ -3,6 +3,392 @@ const ADDRESSES = require('../../projects/helper/coreAssets.json') // Additional sumTokens registry configs, split out of registries/sumTokens.js to keep that file manageable. // Same config shape as the `configs` object in sumTokens.js. module.exports = { + // ----- migrated 2026-10-22 ----- + "BlastNYAN": { + "misrepresentedTokens": true, + "methodology": "Counts as TVL the ETH only. blNYAN and LP assets deposited are counted as Pool2 and staking Respectively", + "blast": { + "tvl": { "__resolveUnknownTokenLP": true, "owners": ["0x46B3a66ef4fAC801B455884035eF2862F01e6158", "0xBC8a7a845cC7A8246EB34856Afe6f1a3d62BD9C6", "0x00066Ed6c2F7d6CC6e66c678BaEE2C8683B632e6"], "tokens": [ADDRESSES.blast.WETH], "useDefaultCoreAssets": true, "lps": ["0x0E9309f32881899F6D4aC2711c6E21367A84CA26"] }, + "pool2": { "__resolveUnknownTokenLP": true, "owners": ["0xF63Ef9F4320f9d16731a40ff1f58a966ee086806"], "tokens": ["0x0E9309f32881899F6D4aC2711c6E21367A84CA26"], "useDefaultCoreAssets": true, "lps": ["0x0E9309f32881899F6D4aC2711c6E21367A84CA26"] }, + "staking": { "__resolveUnknownTokenLP": true, "owners": ["0xA76D6dc805d0EbEcb3787c781ce3A18feEF020cb", "0x46B3a66ef4fAC801B455884035eF2862F01e6158"], "tokens": ["0x9aAC39ca368D27bf03887CCe32f28b44F466072F"], "useDefaultCoreAssets": true, "lps": ["0x0E9309f32881899F6D4aC2711c6E21367A84CA26"] }, + }, + }, + "MeowMiner": { + "methodology": "counts the number of MEOW tokens in the Meow Miner contract.", + "start": "2024-03-13", + "avax": { "__resolveUnknownTokenLP": true, "owner": "0xc0F9a97E46Fb0f80aE39981759eAB4a61eE36459", "tokens": ["0x8aD25B0083C9879942A64f00F20a70D3278f6187"], "lps": ["0xbbf8e4b9AD041edE1F5270CAf5b7B41F0e55f719"], "useDefaultCoreAssets": true }, + }, + "OCTOplace": { + "kava": { "owner": "0x61F91266F6abEA61447E00EB781A3c38a3D1b925", "tokens": [ADDRESSES.null, "0xfa9343c3897324496a05fc75abed6bac29f8a40f"] }, + "theta": { "owner": "0x6e4c614da85DD861e08f84706742239dBA892Df1", "tokens": [ADDRESSES.null] }, + }, + "ada-harvest": { + // Vault funds may later be deployed into Minswap/Liqwid, which have their own adapters + "doublecounted": true, + "methodology": "Counts only the ADA (lovelace) locked in the ADA Harvest PlutusV3 vault contract. Non-ADA assets are excluded. The vault earns flash loan fees and ADA staking rewards.", + "cardano": { "scripts": ["addr1z9mhqtrnwpc76frp2xtgtfyt4lwzzdfwsye0uh335kycu4sgucktr6zta3rtuqlqam4395sry3vl5c7ss08m50qtnj6s5usxpa"], "tokens": ["lovelace"] }, + }, + "alyx-finance": { + "misrepresentedTokens": true, + "methodology": "Total amount of tokens in treasury and masterchef contract", + "bsc": { + "tvl": { "__resolveUnknownTokenLP": true, "tokens": ["0xf5Ea0B5AafC6eDACA15909a02C1e16bCaCd74C1e"], "owner": "0x576182b7a1b0bC67701ead28a087228c50Aa0982", "useDefaultCoreAssets": true }, + "pool2": { "__resolveUnknownTokenLP": true, "tokens": ["0xf5Ea0B5AafC6eDACA15909a02C1e16bCaCd74C1e"], "owner": "0x7Bd2f7641b875872c7c04ee3B426F753C7093aD5", "useDefaultCoreAssets": true }, + "staking": { "__resolveUnknownTokenLP": true, "tokens": ["0x2701C7cBf3220FFF6e6CEaabbCD9B932Eb11E3Ff"], "owner": "0x7Bd2f7641b875872c7c04ee3B426F753C7093aD5", "useDefaultCoreAssets": true, "lps": ["0xf5Ea0B5AafC6eDACA15909a02C1e16bCaCd74C1e"] }, + }, + }, + "applepie": { + "methodology": "First Crosschain Pool as a Service Miner. Twist to generate 10%/daily reward.", + "bsc": { + "tvl": { "tokensAndOwners": [ + [ADDRESSES.null, "0xBc4719D9F347EB1d9551d71862d2Cb4db99916f9"], + [ADDRESSES.bsc.CAKE, "0x4356c2d63e9376024e7E953e18cfC7125e643eE5"], + [ADDRESSES.bsc.USDT, "0x6E8e3F4C058C5e0422E971CE27B0fc91175F4018"], + ] }, + "staking": { "__resolveUnknownTokenLP": true, "owners": ["0x77F7285d23ca4A9FdAe238d29a20a38482d9B4B7"], "tokens": ["0x574f75bc522CB42ec2365dc54485D471f2eFb4B6"], "lps": ["0xf11A3f0EdB8D7B2ef36A4acDCf50D9214eC23FD1"], "useDefaultCoreAssets": true }, + }, + }, + "blastname": { + "blast": { + "tvl": { "tokensAndOwners": [ + [ADDRESSES.blast.WETH, "0xb5510aB65418d53961A9fd32A8E6343f942E20Aa"], + [ADDRESSES.blast.USDB, "0xb5510aB65418d53961A9fd32A8E6343f942E20Aa"], + [ADDRESSES.blast.WETH, "0x9d5d8Ca81FF96b676603a69282290c0D957C7060"], + ] }, + "pool2": { "__resolveUnknownTokenLP": true, "useDefaultCoreAssets": true, "tokensAndOwners": [ + ["0x389daCE33EF8a7E020196F388cF107A881799872", "0xb5510aB65418d53961A9fd32A8E6343f942E20Aa"], // BND-USDB + ["0xdD9B243A18Fb4e46AefFa26D42797f0Be9F9AfC8", "0xb5510aB65418d53961A9fd32A8E6343f942E20Aa"], // BNS-USDB + ["0x44EA24695ECB6c09C3aB756224757a5D68707618", "0xb5510aB65418d53961A9fd32A8E6343f942E20Aa"], // BND-JUICE + ["0xb6851BF01D81be84d13e92aDFE6F64A7D02A643f", "0xb5510aB65418d53961A9fd32A8E6343f942E20Aa"], // BND-BNS + ] }, + }, + }, + "bryanonbase": { + "misrepresentedTokens": true, + "methodology": "Counts as TVL the ETH asset deposited through StakingETH Contract, and we count Staking and Pool2 parts in the same way", + "base": { + "tvl": { "__resolveUnknownTokenLP": true, "owners": ["0x9acDDdbEBED00107B3eF2931607F131F392f6996", "0xCf4543777342D93BEde085292E46D847BC59dc07", "0xC0c8BCAf6c1baE2d4A35f4D89A8EAc9A9E5D4Db0"], "tokens": [ADDRESSES.base.WETH] }, + "pool2": { "__resolveUnknownTokenLP": true, "owners": ["0x5DFF152F94E0EADeD36201f1D5AC37382f3Cf51D", "0xCf4543777342D93BEde085292E46D847BC59dc07"], "tokens": ["0xbCA1647EA6C7eB6916a5B33E21467ff78Bf5Ec55"], "useDefaultCoreAssets": true }, + "staking": { "__resolveUnknownTokenLP": true, "owners": ["0x32e5594F14de658b0d577D6560fA0d9C6F1aa724", "0xC0c8BCAf6c1baE2d4A35f4D89A8EAc9A9E5D4Db0"], "tokens": ["0xB75445A717D5A8c268f37045162837CFe72Ac337"], "lps": ["0xbCA1647EA6C7eB6916a5B33E21467ff78Bf5Ec55"], "useDefaultCoreAssets": true }, + }, + }, + "business-builders-nfts": { + "misrepresentedTokens": true, + "methodology": "Staking: we include locked tokens on the rewards contracts as staking", + "meter": { + "staking": { "__resolveUnknownTokenLP": true, "owner": "0x103ed6fb861a2651ff59f0852d3739c18d45cd9b", "tokens": ["0x6cfe9adad5215195c1aa9755daed29360e6ab986"], "useDefaultCoreAssets": true, "lps": ["0x88cdb3e764dedcc2e3a1642957ebd513765b252a"] }, + }, + "polygon": { + "tvl": { "__empty": true }, + "staking": { "__resolveUnknownTokenLP": true, "owner": "0x0455e50b2822e6f3d8dc01246aca8378a8992466", "tokens": ["0xF305012EA754252184f1071C86ae99fAc5B40320"], "useDefaultCoreAssets": true, "lps": ["0x1Df39b565652eACa24dfB16A07dcfe4d7f8f02c3"] }, + }, + }, + "citrea": { + "ethereum": { "tokensAndOwners": [ + [ADDRESSES.ethereum.USDC, "0xdaa289CC487Cf95Ba99Db62f791c7E2d2a4b868E"], + [ADDRESSES.ethereum.USDT, "0x6925ccD29e3993c82a574CED4372d8737C6dbba6"], + [ADDRESSES.ethereum.WBTC, "0x2c01390E10e44C968B73A7BcFF7E4b4F50ba76Ed"], + ] }, + "bitcoin": { "owners": ["bc1pl7grnght2uhp75wm03djde5a56syp06ssdjf7ucm4wkq0tetpqas5e20e9"] }, + }, + "darkness": { + "cronos": { + "tvl": { "__resolveUnknownTokenLP": true, "owner": "0x92631e0e84ff01853ef1bb88fc9c9f7d1e1af1ca", "tokens": [ + ADDRESSES.cronos.WCRO_1, + ADDRESSES.cronos.dai, + ADDRESSES.cronos.USDC, + "0x6582c738660bf0701f05b04dce3c4e5fcfcda47a", + ADDRESSES.cronos.USDT, + "0x83b2ac8642ae46fc2823bc959ffeb3c1742c48b5", + ADDRESSES.cronos.WBTC, + "0x9d3bbb0e988d9fb2d55d07fe471be2266ad9c81c", + "0x1ecaf6a3551e5822f142c9689d8f36a9b5f68217", + "0xfa202a63234a7089eddbfeee83c378ba248f0e9a", + ] }, + "pool2": { "__resolveUnknownTokenLP": true, "owner": "0x63Df75d039f7d7A8eE4A9276d6A9fE7990D7A6C5", "tokens": [ + "0xbfaab211c3ea99a2db682fbc1d9a999861dcba2d", + "0x8c183c81a5ae3e7a46ecaac17c4bf27a6a40bbe8", + "0xa4aa24b8e855052071df60e174219e6c8fee45a3", + "0xd9debaab797cb92c257b2988aafa92c728b124e6", + ], "useDefaultCoreAssets": true }, + "staking": { "__resolveUnknownTokenLP": true, "owner": "0xA93248C548Ac26152F3b4F201C9101f4e032074e", "tokens": ["0xe727240728c1a5f95437b8b50afdd0ea4ae5f0c8"], "lps": ["0xd9debaab797cb92c257b2988aafa92c728b124e6"], "useDefaultCoreAssets": true }, + }, + }, + "djed-alliance": { + "methodology": "The TVL of Djed is the reserve belonging to the deployment. The TVL within a given blockchain is the sum of the TVLs of all known Djed deployments within that blockchain.", + "cardano": { "owner": "addr1z8mcpc26j64fmhhd6sv5qj5mk9xqnfxgm6k8zmk7h2rlu4qm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0qhxg9gt", "tokens": ["lovelace"] }, + }, + "everstrike": { + "methodology": "Counts USDC and USDT balances held by Everstrike's custody contract on each supported chain. Includes native and legacy bridged USDC where both are deployed.", + "ethereum": { "owner": "0x558FCAcE07fBf6A3D4449240685f29Ad6669fd81", "tokens": [ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT] }, + "optimism": { "owner": "0xB9C1EC4647301828Bb10f6B52584201D1C16bC8F", "tokens": [ADDRESSES.optimism.USDC, ADDRESSES.optimism.USDC_CIRCLE, ADDRESSES.optimism.USDT] }, + "bsc": { "owner": "0x777108936Ed411b0598c1E35266FD92e76Cf834d", "tokens": [ADDRESSES.bsc.USDC, ADDRESSES.bsc.USDT] }, + "polygon": { "owner": "0x4f48c6a228a0bf0c03dc53765930c0cb06f1ecd0", "tokens": [ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDC_CIRCLE, ADDRESSES.polygon.USDT] }, + "base": { "owner": "0xe26a4561b3d213f1479196e43fc532fb89142abd", "tokens": [ADDRESSES.base.USDC] }, + "arbitrum": { "owner": "0xAC66779A566143069A8E8590bDeaBe685054927F", "tokens": [ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.USDT] }, + }, + "firebot": { + "methodology": "Counts the number of FBX and EP tokens in the Vault contracts.", + "polygon": { + "tvl": { "__empty": true }, + "staking": { "__resolveUnknownTokenLP": true, "tokensAndOwners": [ + ["0x60Ed6aCEF3a96F8CDaF0c0D207BbAfA66e751af2", "0x60Ed6aCEF3a96F8CDaF0c0D207BbAfA66e751af2"], // EP held by itself + ["0xD125443F38A69d776177c2B9c041f462936F8218", "0x960d43BE128585Ca45365CD74a7773B9d814dfBE"], // FBX in fire vault + ], "lps": ["0x41D9DE53EBF26F766229E42Aa02904eB2495E397"], "coreAssets": ["0xD125443F38A69d776177c2B9c041f462936F8218"], "restrictTokenRatio": 100 }, + "pool2": { "tokensAndOwners": [["0xcffbfa978ac3fb10e829ca6b763c307daafe8a77", "0x92a9180af33531A5d78d81D90AFc0523dc6c62c9"]] }, + }, + }, + "insuredefi": { + "start": "2017-12-18", + "ethereum": { "owner": "0xF4b2aa60Cd469717857a8A4129C3dB9108f54D74", "token": "0xcb86c6a22cb56b6cf40cafedb06ba0df188a416e" }, + }, + "minerPepe": { + "methodology": "MinerPepe the first mining PEPE Meme Coin on Binance Smart Chain. Miners enjoy 12% daily returns in BNB and MPEPE tokens", + "bsc": { + "tvl": { "tokensAndOwners": [ + [ADDRESSES.null, "0x93Fb89601B5C3253b50c8d650C11bDfe5FB7EE3F"], + [ADDRESSES.bsc.CAKE, "0x18951EEe359A98fFC22b7F22641Db6E7f8571A5A"], + ] }, + "staking": { "__resolveUnknownTokenLP": true, "owners": ["0x26e6B07013748a1C9C12ff17A51A95e40456689C"], "tokens": ["0x6d306C2C9CD931160763D99376a68C14D33DC954"], "lps": ["0xd60f323965eD3D6b90e66eA676414A31D53A0b98"], "useDefaultCoreAssets": true }, + }, + }, + "nest": { + "methodology": "Counts NEST tokens that have been staked in the nest dapp", + "ethereum": { + "tvl": { "owners": ["0xE544cF993C7d477C7ef8E91D28aCA250D135aa03"], "tokens": ["0x0316EB71485b0Ab14103307bf65a021042c6d380"] }, + "staking": { "token": "0x04abEdA201850aC0124161F037Efd70c74ddC74C", "owners": [ + "0xaA7A74a46EFE0C58FBfDf5c43Da30216a8aa84eC", + "0x505eFcC134552e34ec67633D1254704B09584227", + "0x9a5C88aC0F209F284E35b4306710fEf83b8f9723", + "0x34B931C7e5Dc45dDc9098A1f588A0EA0dA45025D", + "0xE544cF993C7d477C7ef8E91D28aCA250D135aa03", + ] }, + }, + "bsc": { + "tvl": { "owners": ["0x9484f12044b9d5707AfeaC5BD02b5E0214381801"], "tokens": [ADDRESSES.bsc.USDT] }, + "staking": { "token": "0x98f8669F6481EbB341B522fCD3663f79A3d1A6A7", "owners": ["0x09CE0e021195BA2c1CDE62A8B187abf810951540"] }, + }, + "polygon": { + "tvl": { "__empty": true }, + "staking": { "token": "0x98f8669F6481EbB341B522fCD3663f79A3d1A6A7", "owners": ["0x09CE0e021195BA2c1CDE62A8B187abf810951540"] }, + }, + "kcc": { + "tvl": { "__empty": true }, + "staking": { "token": "0x98f8669F6481EbB341B522fCD3663f79A3d1A6A7", "owners": ["0x7DBe94A4D6530F411A1E7337c7eb84185c4396e6"] }, + }, + }, + "olympulsex": { + "pulse": { + "tvl": { "__empty": true }, + "staking": { "__resolveUnknownTokenLP": true, "owner": "0xf1Bc988e7EaBA7a2dbF0121E6ad9BEA82A1AB1ff", "tokens": ["0xBB366A397D7d4d2BEDABD9139D4c32a8826605Ed"], "lps": ["0x2d593b3472d6a5439bC1523a04C2aec314CBc44c"], "useDefaultCoreAssets": true }, + }, + }, + "pacifica": { + "solana": { "tokenAccounts": ["72R843XwZxqWhsJceARQQTTbYtWy6Zw9et2YV4FpRHTa", "FvGqozihHY4Mmh4Nmx2rkXnMDcumiXEbjxA9oRu3mUeJ"], "solOwners": ["9sSr35zwnFTuv2kZ86i55sR9dqQLTG663homexrLYgYu"] }, + }, + "penpad": { + "methodology": "Counts liquidty on the staking", + "scroll": { "__resolveUnknownTokenLP": true, "tokensAndOwners": [ + [ADDRESSES.null, "0x8F53fA7928305Fd4f78c12BA9d9DE6B2420A2188"], + [ADDRESSES.scroll.WETH, "0x88844c8f2b895792532AaE2a0F877208248F3585"], + [ADDRESSES.scroll.USDT, "0xC72a7a21e3E12594c75Bc6418224E812e16a027E"], + [ADDRESSES.scroll.USDC, "0xDc1FCFe40A5Cf9745cef0B75428eE28E81D7cC56"], + [ADDRESSES.scroll.STONE, "0x20DE0435e5674Ef15E78adA570159984524B9E8F"], + ["0xc4d46E8402F476F269c379677C99F18E22Ea030e", "0x0C530882C0900b13FC6E8312B52c26e7a5b8e505"], // pufETH + ["0xa25b25548B4C98B0c7d3d27dcA5D5ca743d68b7F", "0x27D2B6cEcd759D289B0227966cC6Fe69Cc2b0424"], // wrsETH + ["0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32", "0x96cB437706111548c3D2e1Dc21E5Ab69E5dA057a"], // wstETH + ["0xcA0bFd5f735924e34Cc567146989e467fFbbCe1a", "0x25D710AC957A54bdD6578b5DC8187a355c805edb"], // weETH (Scroll Bridged) + [ADDRESSES.scroll.WBTC, "0x1C04CedF3Aac5fE35A7811689Ac6Da25b01BDc81"], // WBTC + ["0x01f0a31698c4d065659b9bdc21b3610292a1c506", "0x016d036ec56eed17b5f9dfa212e27f8e260cc7d0"], // weETH (Stargate Bridged) + ["0x3ba89d490ab1c0c9cc2313385b30710e838370a4", "0xde12ec22c5c4eeeeaf8afdc4ec735d75cf9d15a5"], // SolvBTC.b + ] }, + }, + "phission-finance": { + "methodology": "Total amount of WETH split, plus the value of Pool2", + "start": "2022-08-30", + "ethereum": { + "tvl": { "owner": "0x5b38A73f9dB3F5e12BB4dCb5a434FB3bd3972E53", "tokens": [ADDRESSES.ethereum.WETH] }, + "pool2": { "__resolveUnknownTokenLP": true, "owner": "0x569a157eac744b87a42314e8fc03a2e648ea33a2", "tokens": ["0x18174E80335B9fCbc8ac0AB7f40F25aba878ccCC"], "useDefaultCoreAssets": true }, + }, + }, + "privacy-cash": { + "methodology": "Total value of all coins held in the smart contracts of the protocol", + "solana": { + "owners": ["2vV7xhCMWRrcLiwGoTaTRgvx98ku98TRJKPXhsS8jvBV"], + "tokens": [ + ADDRESSES.solana.USDC, + ADDRESSES.solana.USDT, + "A7bdiYdS5GjqGFtxf17ppRHtDKPkkRqbKtR27dxvQXaS", // ZEC + "oreoU2P8bN6jkk3jbaiVxYnG1dCXcYxwhwyK9jSybcp", // ORE + "sTorERYB6xAZ1SSbwpK3zoK2EEwbBrc7TZAzg1uCGiH", // legacy STORE + "storenSbvkfzircixnaosc5CbzNZVrHJ6S3EKrS1yqR", // STORE + "9BEcn9aPEmhSPbPQeFGjidRiEKki46fVQDyPpSQXPA2D", // jlUSDC + "2uQsyo1fXXQkDtcpXnLofWy88PxcvnfH2L8FPSE62FVU", // jlwSOL + ], + "solOwners": ["4AV2Qzp3N4c9RfzyEbNZs2wqWfW4EwKnnxFAZCndvfGh"], + }, + "base": { "owners": ["0x7F673790C08Ddf27c0Aa6fa9526CCC8dAaB081Ec", "0xe91dd4AB03909f5CEb87f42B4308B222995a905b"], "tokens": [ADDRESSES.null, ADDRESSES.base.USDC] }, + "ethereum": { "owners": ["0x77A10AE3E513c2D73D73eb52212c6918C8830dd0", "0xC88F4dF2B6EdDd6B6Bdf95A0177f50C90Fa7527f"], "tokens": [ADDRESSES.null, ADDRESSES.ethereum.USDT] }, + "bsc": { "owners": ["0x22D8509E7AF58b1EaFB311f8F76E81dC3a391F77", "0x9926A40B0879b36F9586c4285f0fae597bd56313"], "tokens": [ADDRESSES.null, ADDRESSES.bsc.USDT] }, + "robinhood": { "owners": ["0xEC5266c9e44631e1ba22FD6377C38130c1F3B738", "0xBB0C7F576B7bdAa8f2a119cb295076aCD0C9013f"], "tokens": [ADDRESSES.null, ADDRESSES.robinhood.USDG] }, + }, + "qilin": { + "ethereum": { "owner": "0x57A0B07dcD834cAbB844BEc8E7903A3B2faE6245", "tokens": [ADDRESSES.ethereum.USDC] }, + }, + "ribbon-earn": { + "ethereum": { + "tvl": { "tokensAndOwners": [ + [ADDRESSES.ethereum.USDC, "0x84c2b16FA6877a8fF4F3271db7ea837233DFd6f0"], // rearnUSDC + [ADDRESSES.ethereum.STETH, "0xCE5513474E077F5336cf1B33c1347FDD8D48aE8c"], // rearnstETH + ] }, + "borrowed": { "__empty": true }, + }, + }, + "scorch": { + "methodology": "TVL is the value of SPL and Token-2022 balances controlled by the authority PDA derived from the Scorch program on Solana.", + // PDA: findProgramAddress(['authority'], SCoRcH8c2dpjvcJD6FiPbCSQyQgu3PcUAWj2Xxx3mqn) + "solana": { "owner": "EHcege7dok1iYs7SxL2XzDPvhg6XzMVcx2V5SkMUurJP" }, + }, + "sprout": { + "methodology": "TVL is the wINJ, USDC and native INJ reserves held by the three Sprout LaunchpadCore bonding curve contracts (current and two previous versions). SPROUT held as quote-asset reserves is reported under staking. Launched tokens are excluded, and liquidity that graduated to Choice is not counted.", + "injective": { + "tvl": { "owners": ["0x1333692eB905823df110762525c26f7489BB9300", "0xd948740da926E8908A08414879490d0D8F96D463", "0xeBF62508F322137EE0986935Ee3b4A60a3F0D227"], "tokens": ["0x0000000088827d2d103ee2d9A6b781773AE03FfB", "0xa00C59fF5a080D2b954d0c75e46E22a0c371235a", ADDRESSES.null] }, + "staking": { "owners": ["0x1333692eB905823df110762525c26f7489BB9300", "0xd948740da926E8908A08414879490d0D8F96D463", "0xeBF62508F322137EE0986935Ee3b4A60a3F0D227"], "tokens": ["0x503f2A7bAc1E2ff2800Aa92EdB82abeF0bFA631E"] }, + }, + }, + "tonnel": { + "ton": { + "tvl": { + "owners": [ + "EQBemaU1eAM-fJP7tSniJGEmltPjitgGnlrP6UaXI7nzmEuV", // 5 TON + "EQBZ0-2-isPEN_lIyg9eqXO_RFWrl_PWIJq5K6SVcUwne23W", // 50 TON + "EQBYpQiQMwGBMzhOlJ52e4yXmcKCB_5uTTJ7bVSGqr-8YANi", // 250 TON + "EQB-s4WzIgGP9U6DNlFH_kSn0JuxhBCBXr_rKz2ztEiozTto", // 1000 TON + "EQD7U_FPYRFTGgiqrpiKh8_giyrIQHZtokUKvz2EmWvlmViC", // 500k GRAM + "EQCZXyOWRih3jtyhdCA7DV7KXluNbzqeIpJPnRkF4KEE1STp", // 30k GRAM + "EQC14SC0-P0iOXzn1971HVIDsCzQ0LllY0y5O7EE2pMLe9pT", // 100 DFC + ], + "tokens": [ + ADDRESSES.null, + "0:b8ef4f77a17e5785bd31ba4da50abd91852f2b8febee97ad6ee16d941f939198", // GRAM + "0:f6eb371de82aa9cfb5b22ca547f31fdc0fa0fbb41ae89ba84a73272ff0bf2157", // DFC + ], + "onlyWhitelistedTokens": true, + }, + "staking": { + "owners": [ + "EQDTs-yjPLn7XzaRRq8pjp7H8Nw4y_OJ51Bk2dcrPlIYgwtV", // 10000 TONNEL + "EQAgoyECSzCIFTFkMIvDLgdUE3D9RxGfYQQGfxy3lBBc_Ke_", // 1000 TONNEL + "EQDzAhS3Ev8cxEBJ96MIqPjxyD_k0L3enzDWnQ3Z-4tUK1h5", // 200 TONNEL + "EQASyc8d2DjZHrFevnF432NRLc4qwh6HGUPAbMvbofMkeRZl", // 50 TONNEL + "EQCNoApBzMacKKdTwcvi1iOx78e98bTSaN1Gx_nnmd3Ek5Yn", // 66 TONNEL + ], + "tokens": ["0:cd0efe78bff4c4539b76eab17293296c74f42cbf99ec499687fefec94893ed32"], // TONNEL + "onlyWhitelistedTokens": true, + }, + }, + }, + "touch-fan": { + "methodology": "We count the ETH on 0x9842114F1d9c5286A6b8e23cF0D8142DAb2B3E9b and 0xC612eD7a1FC5ED084C967bD71F1e0F0a338Cf816", + "misrepresentedTokens": true, + "era": { + "tvl": { "owners": ["0x9842114F1d9c5286A6b8e23cF0D8142DAb2B3E9b", "0xC612eD7a1FC5ED084C967bD71F1e0F0a338Cf816"], "tokens": [ADDRESSES.null] }, + "staking": { "__resolveUnknownTokenLP": true, "owners": ["0x9b470d1d40F437cAb76ea8fC80BC3b761e96D44D", "0x13B8C03990b7d782cB9c3ebF7E2aA5Dc28f6133B", "0x38a22eFB9eE73EdABdc4A15B17D28b70bA56BDA3"], "tokens": ["0x14acccd04393f26ba155e5402aa6fddbb8e2254a"], "lps": ["0xB075F49F4Bea5204d22B42E8d442e8E9e3400AF8"], "abis": { "getReservesABI": "function getReserves() external view returns (uint,uint)" }, "useDefaultCoreAssets": true }, + "pool2": { "__resolveUnknownTokenLP": true, "owners": ["0x26854C6A28864D7E84893F45EDf366eE2494B09a"], "tokens": ["0xB075F49F4Bea5204d22B42E8d442e8E9e3400AF8"], "resolveLP": true, "abis": { "getReservesABI": "function getReserves() external view returns (uint,uint)" }, "useDefaultCoreAssets": true }, + }, + }, + "turboflow": { + "methodology": "TVL counts USDT and USDC balances held by TurboFlow on (i) on-chain bridge contracts on BSC and Solana that receive user deposits, and (ii) protocol-operated MPC custody wallets (Fireblocks) that back user deposits and settlement obligations.", + "start": "2025-10-19", + "bsc": { "owners": [ + "0x145CD0d5C3dD0eF1405dCf1b4D2BCE7c611625dB", // Bridge contract (user deposits) + "0x8757f9E16d775759671e95e50D749CECCDA375AE", // Fireblocks MPC vault (SIG) + "0x077Ab3f5D4372cA14c6AA417215Af3d91B55bAFc", // Fireblocks MPC vault (TFUSERS) + ], "tokens": [ADDRESSES.bsc.USDC, ADDRESSES.bsc.USDT] }, + "solana": { "tokenAccounts": [ + "9ayXbTyhkJ49WtG6DA2PCN6EAKtM8DCneMzhJPTMRWcj", // Bridge USDC SPL account + "6hVp2UaWWQwGo2c6yHj39WJWDNenR48GsLGKPzSa7EU2", // Bridge USDT SPL account + "2ZEku38cWzGqMzhKG6tnpC42godiy8hjGFMZwf7uvPTc", // Fireblocks vault (SIG) USDC SPL account + "FYmWdMq9KT87jpZomMQR7Y2r4a2KbEiXkoDJcHMAP1vq", // Fireblocks vault (SIG) USDT SPL account + "3uCQ76uwDRur1udh4EPjzN84K2vrrcnyH2AnuUjFWNAF", // Fireblocks vault (TFUSERS) USDC SPL account + "8ckjipCeccH3RrcPyXU8xCBGHRK9qgSPuU47ZfBKWGKC", // Fireblocks vault (TFUSERS) USDT SPL account + ] }, + }, + "winr-protocol": { + "methodology": "TVL is the tracked Arbitrum value of WINR held in the protocol bankroll vault and escrow contract. The bankroll holds liquidity provider funds backing all JustBet gameplay; the escrow holds user balances, settled on-chain via merkle roots. Prior-generation USDC contracts and the separate staking contract are excluded from this export.", + "arbitrum": { + "tvl": { "__empty": true }, + "staking": { "owners": ["0x5eD22F7693fea5A0B45dB31771aa94E941b6df8a", "0xD75a51364440dAF83B78B9888D2b8F28eaC0D280"], "tokens": [ADDRESSES.winr.WINR] }, // bankroll, escrow + }, + }, + "wstgbp": { + "methodology": "TVL is the tGBP reserve held by the Ethereum wstGBP contract. wstGBP is a non-rebasing token whose redemption value accrues through an oracle-updated NAV: minting deposits tGBP, while redeeming burns wstGBP and pays tGBP at NAV less the configured redemption fee. Canonically bridged wstGBP on L2s and sidechains is excluded because the corresponding Ethereum wstGBP is locked in bridge escrow and remains backed by the same tGBP reserve.", + "start": "2026-04-10", + "ethereum": { "owner": "0x57C3571f10767E49C9d7b60feb6c67804783B7aE", "tokens": ["0x27f6c8289550fCE67f6B50BeD1F519966aFE5287"] }, + }, + "zk-money": { + "start": "2026-09-25", + "methodology": "TVL is the DAI held in zk.money's Ethereum portal, which backs private DAI balances on Aztec. USDC and USDT deposits are swapped to DAI before entering the portal.", + "ethereum": { "owner": "0xdf410ad448A0f7165181FBdB32f8896f4a0d9449", "tokens": [ADDRESSES.ethereum.DAI] }, + }, + "aeva-bridge": { + "methodology": "TVL counts the USDG locked in the Aeva bridge's Hyperlane collateral router on Robinhood Chain, which backs aeUSD on Aeva Mainnet. $AEVA locked in the AEVA router is Aeva's own token and is counted under staking.", + "start": "2026-09-28", + "robinhood": { + "tvl": { "owner": "0x856a649A84C8c6bB1e2541097bB293af5DD57857", "tokens": [ADDRESSES.robinhood.USDG] }, // USDG router + "staking": { "__staking": ["0xA880B6e6511DAF5A0Bdde96EE8b36D8004D9D7eD", "0xe8729Dc9dCA85167e06b7E9c66a58b22457c5F30"] }, // AEVA router, AEVA + }, + }, + "hectagon": { + "methodology": "Total Value Lock in Hectagon protocol is calculated by sum of: Treasury locked value", + "bsc": { + "tvl": { "owner": "0x4059c4a0b8a2B528C4f2E101A3bB8fB169aBa4fB", "tokens": ["0xc7cee4cea7c76e11e9f5e5e5cbc5e3b798a1c4d0", ADDRESSES.bsc.BUSD] }, + "staking": { "__staking": ["0x7d31ed03c2442f9ffc4f22d90772ee1f32fa9b0d", "0x343915085b919fbd4414F7046f903d194c6F60EE"] }, // gHECTA, HECTA + }, + }, + "drefinance": { + "sonic": { + "tvl": { "tokensAndOwners": [ + [ADDRESSES.sonic.USDC_e, "0xc589858dA047A4789e099FA2CfD1D974D14F344B"], + [ADDRESSES.sonic.scUSD, "0xc589858dA047A4789e099FA2CfD1D974D14F344B"], + ["0xd4eee4c318794bA6FFA7816A850a166FFf8310a9", "0xc589858dA047A4789e099FA2CfD1D974D14F344B"], // DRE + ["0x18b6963ebe82b87c338032649aaad4eec43d3ecb", "0xc589858dA047A4789e099FA2CfD1D974D14F344B"], // DRE-USDC LP + ["0x88640D840614BB63cfb1545897D6d228B381C659", "0xc589858dA047A4789e099FA2CfD1D974D14F344B"], // DRE-scUSD LP + ["0xF8232259D4F92E44eF84F18A0B9877F4060B26F1", "0xb692e2706b628998B4403979D9117Ed746bf8128"], // old DRE in old deposit contract + ["0xB781C624397C423Cb62bAe9996cEbedC6734B76b", "0xb692e2706b628998B4403979D9117Ed746bf8128"], // old DRE-USDC LP in old deposit contract + ] }, + "staking": { "__staking": ["0x21Cfa934CEa191fBD874ee8B1B6CE2B2224De653", "0xd4eee4c318794bA6FFA7816A850a166FFf8310a9"] }, + "pool2": { "owners": ["0xc589858dA047A4789e099FA2CfD1D974D14F344B", "0xb692e2706b628998B4403979D9117Ed746bf8128"], "tokens": ["0x18b6963ebe82b87c338032649aaad4eec43d3ecb", "0xB781C624397C423Cb62bAe9996cEbedC6734B76b", "0x88640D840614BB63cfb1545897D6d228B381C659"], "resolveLP": true }, + }, + }, + "zenith": { + "methodology": "TVL is comprised of tokens deposited to Zenith protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL.", + "ethereum": { + "tvl": { "owners": ["0xb9e7008FA856D66680BeE9E0a24da407D9d7fAD5"], "tokens": [ADDRESSES.null, ADDRESSES.ethereum.STETH, ADDRESSES.ethereum.RETH] }, + "pool2": { "owners": ["0xb9e7008FA856D66680BeE9E0a24da407D9d7fAD5"], "tokens": ["0xAC0155CBd306e41C1287E2c53e1306178397b823"], "resolveLP": true }, + }, + }, + "optidoge": { + "optimism": { + "tvl": { "owner": "0xc911523c466b4E1dADE1bac9A2D4ceA3F9E1A2ae", "tokens": [ADDRESSES.null] }, + "pool2": { "owners": ["0x7Dbe3714371bB9FF72369AFc88703AbD2694E322"], "tokens": ["0x91d62ac270e5bb371a25f81c9e74f16b53448efd"], "resolveLP": true }, + "staking": { "__staking": ["0x015C4b2250F7aAC41274FeB95eFf00016C0CE08c", "0x93d97dbb1bb5290c78c23885e8026047dc8998a8"] }, + }, + }, + "photon-protocol": { + "bsc": { + "tvl": { "tokens": [ADDRESSES.bsc.BUSD], "owner": "0x0f90591b01DE6F832e8B8E4ec3525efD423BCaD1" }, // treasury + "staking": { "__staking": ["0x81177472Ce36A9b1AB573804CD215C72cEb76F36", "0x2F1305F0619ADa14688A4291953bd7d284f9C2a5"] }, // staking contract, PHOTON + }, + }, + "arrland": { + "methodology": "Counts total value locked as the $RUM token staking, LP token staking", + "polygon": { + "tvl": { "__empty": true }, + "staking": { "owners": ["0x111e34bA90D1dE9a2A57f987b5711C71FA4c0Fa0"], "tokens": ["0x14e5386f47466a463f85d151653e1736c0c50fc3"] }, + "pool2": { "owners": ["0xEAf6E84B4E4C2Ce70a80fd781B6A7f177E7b60F5", "0xb94380939A15C574FE22B04FC95Ec5CCaAD783b8"], "tokens": ["0x6495b61b8088a0a82de737ffb142136119b016e6", "0x464b7eb1c66d662e652dfbfced35d465498ad9ac"], "resolveLP": true }, + }, + }, "parcl-v3": { "timetravel": false, "solana": { "tokenAccounts": ["Ai9AuTfGncuFxEknjZT4HU21Rkv98M1QyXpbW9Xct6LK"] } diff --git a/registries/treasury.js b/registries/treasury.js index 7b3fae036c8..cacc562aac1 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -29,6 +29,49 @@ const gmxOwners = [ ] const configs = { + // ----- plain treasuryExports adapters living under projects// (migrated 2026-10-22) ----- + 'anvil': { + ethereum: { owners: ['0x5d2725fdE4d7Aa3388DA4519ac0449Cc031d675f'] }, + }, + 'aof-stake-mining': { + metis: { owners: ['0x946D86422775E7B32F3F8f0580504EADccF9b800'], tokens: [nullAddress] }, + }, + 'astaria-v2': { + base: { owners: ['0x0000000000A6F0986c92cf1EC4d2e77aFBE1466D'] }, + ethereum: { owners: ['0x0000000000A6F0986c92cf1EC4d2e77aFBE1466D'] }, + }, + 'plasma-saving-vaults': { + plasma: { + tokens: [ADDRESSES.plasma.USDT0, '0x5D72a9d9A9510Cd8cBdBA12aC62593A58930a948'], + owners: ['0xd1074E0AE85610dDBA0147e29eBe0D8E5873a000'], // LendingVault + }, + }, + 'tokeniza': { + moonbeam: { + tokens: [nullAddress, ADDRESSES.moonbeam.USDT, ADDRESSES.moonbeam.USDC, ADDRESSES.moonbeam.WGLMR], + owners: ['0xbaECbdde43C6c6a167c37d5b789023592B27fF93'], + }, + ethereum: { + tokens: [nullAddress, ADDRESSES.ethereum.USDT], + owners: ['0xbaECbdde43C6c6a167c37d5b789023592B27fF93'], + }, + polygon: { + tokens: [nullAddress, ADDRESSES.polygon.USDT], + owners: ['0xbaECbdde43C6c6a167c37d5b789023592B27fF93'], + }, + }, + 'trader-joe-stek': { + avax: { + tokens: [ + nullAddress, + '0xEbB5d4959B2FbA6318FbDa7d03cd44aE771fc999', // kong + '0x5ac04b69bde6f67c0bd5d6ba6fd5d816548b066a', // tech + '0x8ad25b0083c9879942a64f00f20a70d3278f6187', // meow + ], + owners: ['0xb22c6d1c2897b950fc1040913c0d84d788f24df2'], // staking contract + ownTokens: [], + }, + }, // ----- from batch00.js ----- 'treasury/nexus-mutual': { ethereum: { diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index d26cf54db98..a9bcab671e3 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -10,7 +10,9 @@ function uniV2ExportFn(chainConfigs, options = {}) { methodology: 'Value of the tokens locked in the liquidity pools.', } Object.entries(chainConfigs).forEach(([chain, config]) => { - if (typeof config === 'string') { + if (config === null) { + result[chain] = { tvl: () => ({}) } // chain kept for history, no factory to read + } else if (typeof config === 'string') { result[chain] = { tvl: getUniTVL({ factory: config, useDefaultCoreAssets: true, ...options }) } } else { const chainOpts = {} @@ -3279,6 +3281,234 @@ const uniV2Configs = { ethereum: '0x1E3aC31cF96b20619c913384C9bf6010A824fB95', arc: '0x1E3aC31cF96b20619c913384C9bf6010A824fB95', }, + // --- migrated 2026-10-22 --- + 'ABCDEFX': { + misrepresentedTokens: true, + methodology: "Using DefiLlama's SDK for making on-chain calls to ABcDeFX Factory Contract to iterate over Liquidity Pools & count token balances therein.", + _options: { hasStablePools: true, stablePoolSymbol: 'ABcDeFx.LP' }, + fantom: '0x01F43D2A7F4554468f77e06757e707150e39130c', + kcc: '0x01F43D2A7F4554468f77e06757e707150e39130c', + echelon: '0x01F43D2A7F4554468f77e06757e707150e39130c', + multivac: '0x01F43D2A7F4554468f77e06757e707150e39130c', + kava: '0x01F43D2A7F4554468f77e06757e707150e39130c', + }, + 'DegenDex': { + misrepresentedTokens: true, + bsc: '0x858FdBfD94C298D511F5Fb839d1f59eb1d8840D2', + dogechain: '0xfc5F561aa36D4f85BfA9A89Dbf058932223d43dB', + }, + 'GateSwap': { + misrepresentedTokens: true, + gatelayer: '0xaD8d59f3e026c02Aed0DAdFB46Ceca127030DFa2', + }, + 'PyreSwap': { + misrepresentedTokens: true, + fantom: '0x045d720873f0260e23da812501a7c5930e510aa4', + bsc: '0x045d720873f0260e23da812501a7c5930e510aa4', + avax: '0x045d720873f0260e23da812501a7c5930e510aa4', + }, + 'aborean-CL': { + // original passed no useDefaultCoreAssets, so keep the core-asset set empty + abstract: { + factory: '0x8cfE21F272FdFDdf42851f6282c0f998756eEf27', blacklistedTokens: [], fetchBalances: true, useDefaultCoreAssets: false, + abis: { allPairsLength: 'uint256:allPoolsLength', allPairs: 'function allPools(uint) view returns (address)' }, + }, + }, + 'abstraDex': { + misrepresentedTokens: true, + xlayer: '0xa7afb6163c331ddb0845843889d6f9544328846f', + zkfair: '0x174c4C03DfeA09682728A5959A253bf1F7C7766F', + zeta: '0x174c4C03DfeA09682728A5959A253bf1F7C7766F', + blast: '0xA7afB6163c331DDb0845843889D6f9544328846F', + cyeth: '0x174c4c03dfea09682728a5959a253bf1f7c7766f', + cronos_zkevm: '0x76D1fC018676f8A973474C24F40A2e14e401b770', + morph: '0x174c4C03DfeA09682728A5959A253bf1F7C7766F', + }, + 'aerodrome-ignition': { + base: { + factory: '0xade65c38cd4849adba595a4323a8c7ddfe89716a', blacklistedTokens: [], fetchBalances: true, useDefaultCoreAssets: false, + abis: { allPairsLength: 'uint256:allPoolsLength', allPairs: 'function allPools(uint) view returns (address)' }, + }, + }, + 'bamboodefi': { + misrepresentedTokens: true, + methodology: 'TVL is calculated from the Bamboo DeFi factory smart contracts on each chain.', + ethereum: '0x3823Ac41b77e51bf0E6536CE465479cBdedcaEa9', + bsc: '0xFC2604a3BCB3BA6016003806A288E7aBF75c8Aa3', + polygon: '0x25cc30af6b2957b0ed7ceca026fc204fdbe04e59', + velas: '0xFC2604a3BCB3BA6016003806A288E7aBF75c8Aa3', + }, + 'coffeefi': { + misrepresentedTokens: true, + _options: { hasStablePools: true }, + scroll: '0x23537BCe0533e53609A49dffdd400e54A825cb81', + arbitrum: '0xdAF8b79B3C46db8bE754Fc5E98b620ee243eb279', + }, + 'dyorswap': { + misrepresentedTokens: true, + mode: '0xE470699f6D0384E3eA68F1144E41d22C6c8fdEEf', + blast: '0xA1da7a7eB5A858da410dE8FBC5092c2079B58413', + merlin: '0xA1da7a7eB5A858da410dE8FBC5092c2079B58413', + zeta: '0xA1da7a7eB5A858da410dE8FBC5092c2079B58413', + degen: '0x2CcaDb1e437AA9cDc741574bDa154686B1F04C09', + xlayer: '0x2ccadb1e437aa9cdc741574bda154686b1f04c09', + bob: '0x2CcaDb1e437AA9cDc741574bDa154686B1F04C09', + ink: '0x6c86ab200661512fDBd27Da4Bb87dF15609A2806', + sonic: '0xd8863d794520285185197F97215c8B8AD04E8815', + soneium: '0x4f0c1b4c6FdF983f2d385Cf24DcbC8c68f345E40', + unichain: '0x6c86ab200661512fDBd27Da4Bb87dF15609A2806', + plasma: '0xA9F2c3E18E22F19E6c2ceF49A88c79bcE5b482Ac', + stable: { factory: '0x61a425ab7e1f6b3fa1eb6af6162cf471fa0e7c62', coreAssets: [...Object.values(ADDRESSES.stable), '0x817997Ca8394E26CCE3dE3A076a4889b27DbF9dE'] }, + arc: '0x942Bd5BFdc5317C5507e326f8EB4BB6058AB5C10', + }, + 'dyson': { + misrepresentedTokens: true, + _options: { fetchBalances: true }, // get reserves call fails + linea: '0xecD30C099c222AbffDaf3E2A3d2455FC8e8c739E', + polygon_zkevm: '0x51a0d4b81400581d8722627dafcd0c1ff9357d1d', + blast: '0x51a0d4b81400581d8722627dafcd0c1ff9357d1d', + }, + 'elkfinance': { + misrepresentedTokens: true, + timetravel: true, + _options: { blacklistedTokens: ['0xa9536b9c75a9e0fae3b56a96ac8edf76abc91978'] }, + xdai: '0xCB018587dA9590A18f49fFE2b85314c33aF3Ad3B', + polygon: '0xE3BD06c7ac7E1CeB17BdD2E5BA83E40D1515AF2a', + fantom: '0x7Ba73c99e6f01a37f3e33854c8F544BbbadD3420', + bsc: '0x31aFfd875e9f68cd6Cd12Cee8943566c9A4bBA13', + heco: '0x997fCE9164D630CC58eE366d4D275B9D773d54A4', + avax: '0x091d35d7F63487909C863001ddCA481c6De47091', + kcc: '0x1f9aa39001ed0630dA6854859D7B3eD255648599', + harmony: '0xCdde1AbfF5Ae3Cbfbdb55c1e866Ac56380e18720', + okexchain: '0x1116f8B82028324f2065078b4ff6b47F1Cc22B97', + moonriver: '0xd45145f10fD4071dfC9fC3b1aefCd9c83A685e77', + cronos: '0xEEa0e2830D09D8786Cb9F484cA20898b61819ef1', + telos: '0x47c3163e691966f8c1b93B308A236DDB3C1C592d', + hoo: '0x9c03E724455306491BfD2CE0805fb872727313eA', + elastos: '0x440a1B8b8e968D6765D41E6b92DF3cBb0e9D2b1e', + fuse: '0x779407e40Dad9D70Ba5ADc30E45cC3494ec71ad2', + iotex: '0xF96bE66DA0b9bC9DFD849827b4acfA7e8a6F3C42', + ethereum: '0x6511eBA915fC1b94b2364289CCa2b27AE5898d80', + optimism: '0xedfad3a0F42A8920B011bb0332aDe632e552d846', + arbitrum: '0xA59B2044EAFD15ee4deF138D410d764c9023E1F0', + kava: '0xC012C4b3d253A8F22d5e4ADA67ea2236FF9778fc', + bittorrent: '0xc06348AEE3f3E92eE452816E0D3F25C919F6fB04', + bitgert: '0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4', + metis: '0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4', + wan: '0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4', + neon_evm: '0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4', + astar: '0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4', + base: '0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4', + linea: '0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4', + velas: '0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4', + q: '0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4', + rsk: '0x69D10bc18cd588a4B70F836A471D4e9c2Fd86092', + }, + 'hybra-v4': { + hyperliquid: { + factory: '0x32b9dA73215255d50D84FeB51540B75acC1324c2', fetchBalances: true, permitFailure: true, useDefaultCoreAssets: false, + abis: { allPairsLength: 'uint256:allPoolsLength', allPairs: 'function allPools(uint) view returns (address)' }, + }, + }, + 'icecreamswap': { + shimmer_evm: '0x24cb308a4e2F3a4352F513681Bd0c31a0bd3BA31', + bob: '0x7b2a5C88AB9367147F6ac384F857CbaDF5aA70a7', + lightlink_phoenix: '0xC87De04e2EC1F4282dFF2933A2D58199f688fC3d', + taiko: '0xC87De04e2EC1F4282dFF2933A2D58199f688fC3d', + base: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + telos: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + core: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + dogechain: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + fuse: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + xdc: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + bitgert: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + scroll: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + neon_evm: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + blast: '0x9E6d21E759A7A288b80eef94E4737D313D31c13f', + }, + 'izumi-iziswap-v2': { + _options: { + useDefaultCoreAssets: false, + blacklistedTokens: [ + ADDRESSES.bsc.iUSD, + '0x1382628e018010035999A1FF330447a0751aa84f', + '0x078f712f038A95BeEA94F036cADB49188a90604b', // manta iUSD + ], + }, + plume_mainnet: '0x88867BF3bB3321d8c7Da71a8eAb70680037068E4', + }, + 'megaswap': { + misrepresentedTokens: true, + megaeth: '0x72B94fA9F854Da1bCCD03F3bAB54cF60C32193F3', + }, + 'passdex': { + misrepresentedTokens: true, + soneium: '0x48E07EE0E8450811AD472fFf10aB68B895EA747A', + unichain: '0x242c913Ff5FE010430A709baab977e88435b7EBF', + hemi: '0x242c913Ff5FE010430A709baab977e88435b7EBF', + }, + 'plaxswap': { + methodology: 'Counts liquidity across all PlaxSwap LPs', + polygon: { factory: '0x709e3C6b22993189327a8CFebD572b6cc459fe40', useDefaultCoreAssets: false }, + }, + 'satoriSwap': { + misrepresentedTokens: true, + base: '0x4858C605862A91A34d83C19a9704f837f64fa405', + linea: '0xfF5859B60BCb3F153431cA216B1b269EB66A2020', + xlayer: '0xd967A2A9B873ccD5a5Ede00869e353949F24c3dc', + }, + 'solidex-finance-v3': { + cronos: { + factory: '0x3AAAB2384e40C2F405EF87Ea7B893B406C32E59C', fetchBalances: true, + abis: { allPairsLength: 'uint256:allPoolsLength', allPairs: 'function allPools(uint) view returns (address)' }, + }, + }, + 'sphynx': { + misrepresentedTokens: true, + bsc: '0x8BA1a4C24DE655136DEd68410e222cCA80d43444', + cronos: '0x5019EF5dd93A7528103BB759Bb2F784D065b826a', + bitgert: '0xd4688F52e9944A30A7eaD808E9A86F95a0661DF8', + loop: '0xc0246b4f24475a11ee4383d29575394dc237fc36', + }, + 'stationdex-v2': { + misrepresentedTokens: true, + xlayer: '0xF7c16c5C5AF8838A884cF409543fdBE4Abd3D81d', + }, + 'swapr': { + misrepresentedTokens: true, + ethereum: '0xd34971BaB6E5E356fd250715F5dE0492BB070452', + xdai: '0x5d48c95adffd4b40c1aaadc4e08fc44117e02179', + arbitrum: '0x359f20ad0f42d75a5077e65f30274cabe6f4f01a', + }, + 'snowswap-xyz': { + misrepresentedTokens: true, + crab: null, // factory 0x36ABF1A7851fBF9ae9D79dc3E39C1227068158B3, no longer read + darwinia: '0x5669a449D892f03B4c541A321926f18e272c64A2', + }, + 'emberswap': { + misrepresentedTokens: true, + methodology: 'Factory address (0xE62983a68679834eD884B9673Fb6aF13db740fF0) is used to find the LP pairs. TVL is equal to the liquidity on the AMM. Ember tokens sent to vault are counted towards staking.', + smartbch: { + factory: '0xE62983a68679834eD884B9673Fb6aF13db740fF0', + staking: ['0xFFbE92fDA81f853bcf00d3c7686d5DAd5A6600bB', '0x6BAbf5277849265b6738e75AEC43AEfdde0Ce88D'], // vault, EMBER + }, + }, + 'velodrome-CL': { + _options: { + fetchBalances: true, useDefaultCoreAssets: false, + abis: { allPairsLength: 'uint256:allPoolsLength', allPairs: 'function allPools(uint) view returns (address)' }, + }, + optimism: '0xCc0bDDB707055e04e497aB22a59c2aF4391cd12F', + lisk: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', + fraxtal: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', + mode: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', + ink: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', + soneium: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', + unichain: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', + swellchain: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', + celo: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', + sseed: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', + }, } module.exports = buildProtocolExports(uniV2Configs, uniV2ExportFn) From 3d3a141a7b9d4e027b6f624c85d291b64188b4f2 Mon Sep 17 00:00:00 2001 From: RA-Parity Date: Wed, 28 Oct 2026 11:06:10 -0500 Subject: [PATCH 497/988] exceed-finance: drop the doublecounted flag and the methodology note (#21832) --- projects/exceed-finance/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/projects/exceed-finance/index.js b/projects/exceed-finance/index.js index f9ab65cbce8..0db4ac3314d 100644 --- a/projects/exceed-finance/index.js +++ b/projects/exceed-finance/index.js @@ -67,7 +67,5 @@ async function tvl(api) { module.exports = { misrepresentedTokens: true, timetravel: false, - doublecounted: true, - methodology: 'TVL is the value of all outstanding exUSDC, exSOL and exBTC, read from chain: the supply of each receipt token multiplied by its on-chain exchange rate, expressed in the base token (USDC, SOL, cbBTC). The deposits are deployed into lending markets such as Kamino and Jupiter Lend, so the TVL is marked as double counted.', solana: { tvl }, } From 865b9568d3584962d0766ddf8917d2d4ed705753 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 28 Oct 2026 14:12:44 -0400 Subject: [PATCH 498/988] move parasset to dead adapters (#21908) --- registries/deadAdapters.json | 9 +++++++++ registries/sumTokens.js | 18 ------------------ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/registries/deadAdapters.json b/registries/deadAdapters.json index 36dd10a7a84..6ed41b02d89 100644 --- a/registries/deadAdapters.json +++ b/registries/deadAdapters.json @@ -4765,6 +4765,15 @@ "borrowed": "_f" } }, + "parasset": { + "misrepresentedTokens": true, + "methodology": "Counts liquidty on the Insurance", + "ethereum": { + "tvl": "_f", + "staking": "_f" + }, + "deadFrom": "2023-08-30" + }, "partialfinance": { "deadFrom": "2024-04-01", "methodology": "Pool2 deposits consist of PARTIAL/FTM and PSHARE/FTM LP tokens deposits while the staking TVL consists of the PSHARES tokens locked within the Boardroom contract(0x5FcE757a1aa5C489B008a4Df6CA2ef9088B5bCA4).", diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 543de6c0caf..7f7686d629d 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -21560,24 +21560,6 @@ const configs = { } }, }, - "parasset": { - "misrepresentedTokens": true, - "methodology": "Counts liquidty on the Insurance", - "ethereum": { - "tvl": { - "__empty": true - }, - "staking": { - "owners": [ - "0x505eFcC134552e34ec67633D1254704B09584227", - "0x9a5C88aC0F209F284E35b4306710fEf83b8f9723" - ], - "tokens": [ - "0x04abeda201850ac0124161f037efd70c74ddc74c" - ] - } - }, - }, "particle-trade": { "blast": { "owner": "0x121B5ac4De4a3E6F4171956BC26ceda40Cb61a56", From 4cbfeb8da1f92d2571f44d0331dcde02cee74e98 Mon Sep 17 00:00:00 2001 From: AvaLoveApp Date: Wed, 28 Oct 2026 22:01:54 +0300 Subject: [PATCH 499/988] [update] el-casino / el-perps / el-predict: V7 casino factories + V3 markets hub (#21909) Co-authored-by: huseyinaztekintr-ctrl --- projects/el-casino/index.js | 15 ++++++++++++--- projects/el-perps/index.js | 5 +++-- projects/el-predict/index.js | 5 +++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/projects/el-casino/index.js b/projects/el-casino/index.js index 3d87c1f26cf..c7854efe156 100644 --- a/projects/el-casino/index.js +++ b/projects/el-casino/index.js @@ -27,14 +27,23 @@ const FACTORIES = [ '0x67a98f0A0A73d697c9EcE3F310E28ffc89c491b8', '0xff6f1a93B662e6E6EB73632B3b9ce8fBFA15083e', '0x5c5Df8cc39CAb5790981a6AB4E1C016397973111', '0x69EeAB0020EbD064AFAA8e35D0E64f6b8a2842b4', '0xa17bF3952C23c19e9B0c3F017eBACa3006216fFd', '0x542bb8E1f9Ed0E0a523910B18843f5da22711D2F', '0x5bffd94d0AE1d2fC9C78f5909f43dF700552029c', '0xf7EdFECB155E4065C7F8684820B21503098b05B8', + // V7 game factories (CasinoHubV7 0x3F033CeAE85B9Db2eBD3f5BaBcEb90518DEf496c, 2026-10-28 — every new room and the launchpad V3 tokens' rooms) + '0x91284A7de6b9431eDE067ee25685593d27ea9c59', '0x42097766d7e434B37b16F5304a58658eF5EA4605', '0x7bFc80D91477497226e2526dF83eBd725779F37D', + '0xA1cB1A627326976bF42176127050530616efc50a', '0x65A3e41138a49878a5E78969878A61793987129C', '0x911A405AFDA70702156f9D6C15D101CeceDD5EC4', + '0x07EF0b8F45058DC3804511BBB1111080Cb299DAA', '0x541B988aC567bBEa96901B79e50b3B9d2168E81E', '0x0e92c1744C89913920f3974833fBB3DDa637c7EA', + '0xb21928bec8725670C662f05f0DdD37f7d6033110', '0x3f62789A03965d571D354283fe4Fbe878E3f9d5e', '0xD71Cd3C0Ffc9B1eA83A5fF5e1c0F2d4d5435f04f', + '0x5007345F3b1D5485D04Daf1f95Efc0025352F37D', '0xF1ac23255Ee8d7728dF0A1b548E26f8e13dDC429', '0x150638483b7935CAC6800e47BBD7281678150408', + '0x279484859326FBC6696cAA8304f5BDCAc310eC44', '0xfcC8bCc00fc811F7e8a06a40571FEF5D3341Bd3C', '0xEeebcb164D09B93Eea0C3138D14A0F39b0B01b05', + '0x6d640E0CA7b84550c5881CB8D2c847d18125342D', '0xd87D01FDd92e90E27d101D419896F84d975569CD', ] const getGames = 'function getGames(uint256 offset, uint256 limit) view returns (tuple(address gameAddress, address owner, address creator, address token, string tokenLogoUrl, string betName, uint256 createdAt)[])' const PAGE = 200 async function rooms(api) { - const totals = await api.multiCall({ abi: 'uint256:getTotalGames', calls: FACTORIES }) + // a factory not deployed yet at the block reads as empty + const totals = await api.multiCall({ abi: 'uint256:getTotalGames', calls: FACTORIES, permitFailure: true }) const calls = [] - FACTORIES.forEach((f, i) => { for (let o = 0; o < Number(totals[i]); o += PAGE) calls.push({ target: f, params: [o, PAGE] }) }) + FACTORIES.forEach((f, i) => { for (let o = 0; o < Number(totals[i] ?? 0); o += PAGE) calls.push({ target: f, params: [o, PAGE] }) }) return (await api.multiCall({ abi: getGames, calls })).flat() } @@ -44,7 +53,7 @@ async function tvl(api) { } module.exports = { - methodology: 'Sums the tokens held by every EL-Casino room, listed from the V4, V5 and V6 game factories: each room\'s token pool pays winnings and is funded by stakers ("become the house"). Rooms whose pool is in $ELCAS, the protocol\'s own token, are excluded.', + methodology: 'Sums the tokens held by every EL-Casino room, listed from the V4, V5, V6 and V7 game factories: each room\'s token pool pays winnings and is funded by stakers ("become the house"). Rooms whose pool is in $ELCAS, the protocol\'s own token, are excluded.', start: '2026-09-01', robinhood: { tvl }, } diff --git a/projects/el-perps/index.js b/projects/el-perps/index.js index 6421b5673a9..8d31cc5f834 100644 --- a/projects/el-perps/index.js +++ b/projects/el-perps/index.js @@ -3,7 +3,8 @@ // CREATE2. A book holds, in its margin token: each market's LP vault (the traders' counterparty), the traders' margin, // and fee shares accrued for the platform / market creators but not claimed yet (owedTotal — not user money). // ElcasMarketsHub v1, then the V2 hubs: the launchpad's (books its game reserve opens for launched tokens) and the public one -const HUBS = ['0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45', '0x9DB90Cf484614C3424a49B0cB0b6E5cA7b6a850F', '0xB7eF17054fb9541dd9Bc58E932Af116d11f2fD3f'] +// + the V3 hub (2026-10-28): the launchpad V3 tokens' books, opened by its game reserve +const HUBS = ['0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45', '0x9DB90Cf484614C3424a49B0cB0b6E5cA7b6a850F', '0xB7eF17054fb9541dd9Bc58E932Af116d11f2fD3f', '0xf31da25f3F4E2f041c63Aa0751ceB69f50fdFd5c'] const ELCAS = '0xE73f12D9d81ff6b11c1d0261F440c2EA4C400E18' // the protocol's own token: excluded async function tvl(api) { @@ -21,7 +22,7 @@ async function tvl(api) { } module.exports = { - methodology: 'Lists every perps book from the ElcasMarketsHub v1 and V2 hubs (one per hub and margin token) and counts each book\'s balance of its margin token — LP vaults and traders\' margin — minus the fee shares accrued for the platform and market creators but not yet claimed. Books margined in $ELCAS, the protocol\'s own token, are excluded.', + methodology: 'Lists every perps book from the ElcasMarketsHub v1, V2 and V3 hubs (one per hub and margin token) and counts each book\'s balance of its margin token — LP vaults and traders\' margin — minus the fee shares accrued for the platform and market creators but not yet claimed. Books margined in $ELCAS, the protocol\'s own token, are excluded.', start: '2026-10-06', robinhood: { tvl }, } diff --git a/projects/el-predict/index.js b/projects/el-predict/index.js index 9860a15ff61..6933b1f40aa 100644 --- a/projects/el-predict/index.js +++ b/projects/el-predict/index.js @@ -3,7 +3,8 @@ // CREATE2. A book holds, in its stake token: each market's house vault (anyone can LP), players' stakes in open rounds, // unclaimed winnings, and fee shares accrued for the platform / market creators but not claimed yet (owedTotal). // ElcasMarketsHub v1, then the V2 hubs: the launchpad's (books its game reserve opens for launched tokens) and the public one -const HUBS = ['0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45', '0x9DB90Cf484614C3424a49B0cB0b6E5cA7b6a850F', '0xB7eF17054fb9541dd9Bc58E932Af116d11f2fD3f'] +// + the V3 hub (2026-10-28): the launchpad V3 tokens' books, opened by its game reserve +const HUBS = ['0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45', '0x9DB90Cf484614C3424a49B0cB0b6E5cA7b6a850F', '0xB7eF17054fb9541dd9Bc58E932Af116d11f2fD3f', '0xf31da25f3F4E2f041c63Aa0751ceB69f50fdFd5c'] const ELCAS = '0xE73f12D9d81ff6b11c1d0261F440c2EA4C400E18' // the protocol's own token: excluded async function tvl(api) { @@ -21,7 +22,7 @@ async function tvl(api) { } module.exports = { - methodology: 'Lists every prediction book from the ElcasMarketsHub v1 and V2 hubs (one per hub and stake token) and counts each book\'s balance of its stake token — house vaults, stakes in open rounds and unclaimed winnings — minus the fee shares accrued for the platform and market creators but not yet claimed. Books staked in $ELCAS, the protocol\'s own token, are excluded.', + methodology: 'Lists every prediction book from the ElcasMarketsHub v1, V2 and V3 hubs (one per hub and stake token) and counts each book\'s balance of its stake token — house vaults, stakes in open rounds and unclaimed winnings — minus the fee shares accrued for the platform and market creators but not yet claimed. Books staked in $ELCAS, the protocol\'s own token, are excluded.', start: '2026-10-06', robinhood: { tvl }, } From b50ec9e081e9ac1bc9a793d96cd03515259ca522 Mon Sep 17 00:00:00 2001 From: AvaLoveApp Date: Thu, 29 Oct 2026 12:49:15 +0300 Subject: [PATCH 500/988] [update] el-perps / el-predict: add the public V3 markets hub (#21912) --- projects/el-perps/index.js | 2 +- projects/el-predict/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/el-perps/index.js b/projects/el-perps/index.js index 8d31cc5f834..da17333f800 100644 --- a/projects/el-perps/index.js +++ b/projects/el-perps/index.js @@ -4,7 +4,7 @@ // and fee shares accrued for the platform / market creators but not claimed yet (owedTotal — not user money). // ElcasMarketsHub v1, then the V2 hubs: the launchpad's (books its game reserve opens for launched tokens) and the public one // + the V3 hub (2026-10-28): the launchpad V3 tokens' books, opened by its game reserve -const HUBS = ['0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45', '0x9DB90Cf484614C3424a49B0cB0b6E5cA7b6a850F', '0xB7eF17054fb9541dd9Bc58E932Af116d11f2fD3f', '0xf31da25f3F4E2f041c63Aa0751ceB69f50fdFd5c'] +const HUBS = ['0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45', '0x9DB90Cf484614C3424a49B0cB0b6E5cA7b6a850F', '0xB7eF17054fb9541dd9Bc58E932Af116d11f2fD3f', '0xf31da25f3F4E2f041c63Aa0751ceB69f50fdFd5c', '0x2AC7854F4DBd6e18933dc6c87598532641898Ad1'] const ELCAS = '0xE73f12D9d81ff6b11c1d0261F440c2EA4C400E18' // the protocol's own token: excluded async function tvl(api) { diff --git a/projects/el-predict/index.js b/projects/el-predict/index.js index 6933b1f40aa..4bd0a1ad800 100644 --- a/projects/el-predict/index.js +++ b/projects/el-predict/index.js @@ -4,7 +4,7 @@ // unclaimed winnings, and fee shares accrued for the platform / market creators but not claimed yet (owedTotal). // ElcasMarketsHub v1, then the V2 hubs: the launchpad's (books its game reserve opens for launched tokens) and the public one // + the V3 hub (2026-10-28): the launchpad V3 tokens' books, opened by its game reserve -const HUBS = ['0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45', '0x9DB90Cf484614C3424a49B0cB0b6E5cA7b6a850F', '0xB7eF17054fb9541dd9Bc58E932Af116d11f2fD3f', '0xf31da25f3F4E2f041c63Aa0751ceB69f50fdFd5c'] +const HUBS = ['0xBd65EE837e57D5060013cbE8bAc8a6d0F8037f45', '0x9DB90Cf484614C3424a49B0cB0b6E5cA7b6a850F', '0xB7eF17054fb9541dd9Bc58E932Af116d11f2fD3f', '0xf31da25f3F4E2f041c63Aa0751ceB69f50fdFd5c', '0x2AC7854F4DBd6e18933dc6c87598532641898Ad1'] const ELCAS = '0xE73f12D9d81ff6b11c1d0261F440c2EA4C400E18' // the protocol's own token: excluded async function tvl(api) { From aec22a9b3c329e2560580227cac7c90f2ddc73a8 Mon Sep 17 00:00:00 2001 From: Code Monad Date: Thu, 29 Oct 2026 17:49:35 +0800 Subject: [PATCH 501/988] Add Faroo liquid staking TVL on Pharos (#21914) --- projects/faroo/index.js | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 projects/faroo/index.js diff --git a/projects/faroo/index.js b/projects/faroo/index.js new file mode 100644 index 00000000000..eb9586a9fb0 --- /dev/null +++ b/projects/faroo/index.js @@ -0,0 +1,54 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') + +const WPROS = ADDRESSES.pharos.WPROS +const STPROS = '0x6b0a44c64190279f7034b77c13a566e914fe5ec4' +const STAKING = '0x4100000000000000000000000000000000000000' +const V4_BLOCK = 20813316 +const slps = [ + { address: '0xec1d6163e05b3f5d0fb8f354881f6c8b793ad612', fromBlock: 20737836 }, + { address: '0xc53d2c9dd1e488e23ff77e219ca68d8138f90c2c', fromBlock: 20737878 }, +] +const owners = [...new Set([ + STPROS, + '0xf772b375f93650f798bf724ce7a9a45c9e7a579f', // SlpDistributor + '0xf1df1cb080256f48e8702c24149136e4a6dec25e', // BridgeVault + '0xd0c44d3079e97ff285dd7a3e4e0246320a9487e5', // RewardsVault + ...slps.map(slp => slp.address), +])] +const poolRegistered = 'event PoolIdRegistered(address indexed sender, bytes32 indexed poolId)' +const delegatorAbi = 'function getDelegator(bytes32 poolId, address delegator) view returns (tuple(uint256 principalStake, uint256 stake, uint256 accumulatedRewardPerShare, uint256 rewards, uint256 pendingStake, uint256 pendingWithdrawStake, uint256 pendingWithdrawWindow, uint256 totalRewardsClaimed, bool isPendingUndelegate))' +const undelegationsAbi = 'function getUserPendingUndelegations(address delegator) view returns (tuple(address delegator, bytes32 poolId, uint256 amount, uint256 unlockEpoch, uint256 pendingWithdrawWindow, bool processed, uint256 principalAmount, uint256 rewardAmount)[])' + +async function tvl(api) { + const block = await api.getBlock() + if (block < V4_BLOCK) return api.sumTokens({ owner: STPROS, tokens: [WPROS] }) + + await api.sumTokens({ owners, tokens: [WPROS] }) + const nativeBalances = await api.getEthBalances({ owners }) + nativeBalances.forEach(balance => api.add(WPROS, balance)) + + for (const { address, fromBlock } of slps) { + const [logs, registeredPools, undelegations] = await Promise.all([ + getLogs2({ api, target: address, eventAbi: poolRegistered, fromBlock, toBlock: block }), + api.call({ target: address, abi: 'function registeredPools() view returns (bytes32[])' }), + api.call({ target: STAKING, abi: undelegationsAbi, params: [address] }), + ]) + // An unregistered pool can still hold principal, so retain every historically registered pool. + const pools = [...new Set([...registeredPools, ...logs.map(log => log.poolId)].map(pool => pool.toLowerCase()))] + const delegations = pools.length ? await api.multiCall({ + target: STAKING, + abi: delegatorAbi, + calls: pools.map(pool => ({ params: [pool, address] })), + }) : [] + // principalStake already includes pendingStake; virtual rewards are excluded. + delegations.forEach(position => api.add(WPROS, position.principalStake)) + undelegations.filter(position => !position.processed).forEach(position => api.add(WPROS, position.principalAmount)) + } +} + +module.exports = { + methodology: 'Counts WPROS and native PROS held in Faroo custody contracts on Pharos, plus network staking principal and unprocessed unbonding principal. Queued redemptions remain counted until paid. Excludes unminted virtual staking rewards; Oracle NAV and Hybrid Vault stPROS are not added again. Before the V4 upgrade, counts WPROS held by stPROS.', + start: '2026-06-29', + pharos: { tvl }, +} From 4825b5a46ebd08435b869fe13d5ebc3ab52d21d2 Mon Sep 17 00:00:00 2001 From: Ravenhood Date: Thu, 29 Oct 2026 10:54:17 +0100 Subject: [PATCH 502/988] Flock Credit: add veFABLES market (Robinhood Chain) (#21911) Co-authored-by: dev256lag Co-authored-by: ccipherx --- projects/flock-credit/index.js | 48 +++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/projects/flock-credit/index.js b/projects/flock-credit/index.js index 5bef7d9f232..d84a8fe4ae3 100644 --- a/projects/flock-credit/index.js +++ b/projects/flock-credit/index.js @@ -1,5 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { unwrapSolidlyVeNft } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') const USDG = ADDRESSES.robinhood.USDG const UP = '0x57C0E45cB534413D1C20A4240955d6bB250BB4F1' @@ -25,14 +26,53 @@ const MARKETS = [ }, ] +const FABLES = '0xb63d07CEf74bE747231d601bb2FAa6B252c68106' +// veFABLES has no owner enumeration, so escrowed token ids come from the escrow's Deposited logs +const VE_FABLES = '0xc1d5aDc963a57d24ADaf63aaE1bFbeCaB95f6EDD' +const FABLES_MARKET = { + vault: '0x459d111C968d64d5cD7A948ea2D8F1857E0B8DE0', + escrow: '0x9E634A624F689Be41e3036F0B066B11326Ffc703', + fromBlock: 94551020, // escrow deploy; the vault is 52 blocks older +} + +async function getVaults(api) { + const vaults = MARKETS.map(({ vault }) => vault) + if (await api.getBlock() >= FABLES_MARKET.fromBlock) vaults.push(FABLES_MARKET.vault) + return vaults +} + async function addVaultCash(api) { + const vaults = await getVaults(api) const balances = await api.multiCall({ abi: 'erc20:balanceOf', - calls: MARKETS.map(({ vault }) => ({ target: USDG, params: vault })), + calls: vaults.map(vault => ({ target: USDG, params: vault })), }) balances.forEach(balance => api.add(USDG, balance)) } +// cache only the deposited token ids, not every raw log +function cacheTokenIds({ cache, logs }) { + cache.logs = [...new Set([...cache.logs, ...logs.map(({ tokenId }) => tokenId.toString())])] +} + +async function addFablesCollateral(api) { + if (await api.getBlock() < FABLES_MARKET.fromBlock) return + const tokenIds = await getLogs({ + api, + target: FABLES_MARKET.escrow, + eventAbi: 'event Deposited(address indexed owner, uint256 indexed tokenId, uint256 votingPower)', + fromBlock: FABLES_MARKET.fromBlock, + onlyArgs: true, + extraKey: 'tokenIds', + customCacheFunction: cacheTokenIds, + }) + // ownerOf reverts once a lock is withdrawn or merged away + const holders = await api.multiCall({ target: VE_FABLES, abi: 'function ownerOf(uint256) view returns (address)', calls: tokenIds, permitFailure: true }) + const held = tokenIds.filter((_, i) => holders[i]?.toLowerCase() === FABLES_MARKET.escrow.toLowerCase()) + const locks = await api.multiCall({ target: VE_FABLES, abi: 'function locks(uint256) view returns (uint128 amount, uint64 unlock)', calls: held }) + locks.forEach(({ amount }) => api.add(FABLES, amount)) +} + async function addCollateral(api) { await Promise.all(MARKETS.map(market => unwrapSolidlyVeNft({ api, @@ -47,19 +87,19 @@ async function addCollateral(api) { async function tvl(api) { await addVaultCash(api) await addCollateral(api) + await addFablesCollateral(api) } async function borrowed(api) { const debts = await api.multiCall({ abi: 'uint256:totalManagedDebt', - calls: MARKETS.map(({ vault }) => vault), + calls: await getVaults(api), }) debts.forEach(debt => api.add(USDG, debt)) } module.exports = { - timetravel: true, start: '2026-09-02', - methodology: 'TVL is comprised of USDG deposited to the lending vaults and UP/LUTE locked in veNFT collateral escrows. Borrowed USDG is reported separately and not counted towards TVL.', + methodology: 'TVL is comprised of USDG deposited to the lending vaults and UP/LUTE/FABLES locked in veNFT collateral escrows. Borrowed USDG is reported separately and not counted towards TVL.', robinhood: { tvl, borrowed }, } From 8c80fd335e04ce2d8fe22c540ba91f1101733a34 Mon Sep 17 00:00:00 2001 From: Yanis <33152568+yanisepfl@users.noreply.github.com> Date: Thu, 29 Oct 2026 22:50:12 +0800 Subject: [PATCH 503/988] fables: add staking (FABLES locked as veFABLES) (#21917) Co-authored-by: FelixBruguera --- projects/fables/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/fables/index.js b/projects/fables/index.js index 91014496f88..1feabfe72fb 100644 --- a/projects/fables/index.js +++ b/projects/fables/index.js @@ -1,8 +1,11 @@ const { addUniV3LikePosition } = require('../helper/unwrapLPs') +const { staking } = require('../helper/staking') const REGISTRY = '0x159a113e012593d9b3cc63ad45e30f0467e13ef3' // FablesPoolRegistry const STATE_VIEW = '0xF3334192D15450CdD385c8B70e03f9A6bD9E673b' // Uniswap v4 StateView on Robinhood Chain const MAX_TICK = 887272 +const FABLES = '0xb63d07CEf74bE747231d601bb2FAa6B252c68106' // FABLES token +const VE_FABLES = '0xc1d5adc963a57d24adaf63aae1bfbecab95f6edd' // VotingEscrowFF: FABLES locked as veFABLES const POOLS_ABI = 'function activePools() view returns (tuple(tuple(address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) key, bytes32 id, bool active)[])' const SLOT0_ABI = 'function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)' @@ -60,7 +63,10 @@ async function tvl(api) { module.exports = { methodology: - 'Enumerates every Fables pool from the on-chain FablesPoolRegistry (activePools) and sums each v4 pool\'s token reserves, reconstructed from its tick liquidity via Uniswap v4 StateView.', + 'TVL enumerates every Fables pool from the on-chain FablesPoolRegistry (activePools) and sums each v4 pool\'s token reserves, reconstructed from its tick liquidity via Uniswap v4 StateView. Staking counts the FABLES locked in the VotingEscrowFF contract as veFABLES.', doublecounted: true, - robinhood: { tvl }, + robinhood: { + tvl, + staking: staking(VE_FABLES, FABLES), + }, } From a95120a691f42139d847a764caa6c33044319a4b Mon Sep 17 00:00:00 2001 From: AshDown1 Date: Fri, 30 Oct 2026 00:50:36 +1000 Subject: [PATCH 504/988] truss-lp: track TVL on Base, OP Mainnet, Robinhood Chain and HyperEVM (new vault contracts) (#21915) Co-authored-by: AshDown1 Co-authored-by: FelixBruguera --- projects/truss-lp/index.js | 168 ++++++++++++++++++++++++++----------- 1 file changed, 121 insertions(+), 47 deletions(-) diff --git a/projects/truss-lp/index.js b/projects/truss-lp/index.js index d4f35ca4429..8fe6f9c65d5 100644 --- a/projects/truss-lp/index.js +++ b/projects/truss-lp/index.js @@ -1,57 +1,131 @@ -const ADDRESSES = require('../helper/coreAssets.json') -// TRUSS LP - automated concentrated-liquidity vaults on Aerodrome Slipstream (Base) -// TVL = idle token0/token1 held by every vault + every Slipstream position the -// AerodromeAtomicV3 contract has staked in a gauge on the vaults' behalf. -const { sumTokens2, unwrapSlipstreamNFT } = require('../helper/unwrapLPs') +// TRUSS LP - automated concentrated-liquidity vaults (one vault contract per customer). +// TVL = what the customer vaults hold: idle tokens in each vault + the underlying of every LP position +// the vault owns (read from the vault's own positionIds()), across Base, OP Mainnet, Robinhood Chain and HyperEVM. +// Nothing outside the vaults (routers, libraries, fee or operator wallets) is counted. +const { addUniV3LikePosition } = require('../helper/unwrapLPs') +const { nullAddress } = require('../helper/tokenMapping') -const FACTORY = '0x65Ab206bc394a2DA6bd687Ba99ABad1Bd6f2dB2f' // LPVaultFactoryV3 -const ATOMIC = '0x57Ab7cADE09605149d5a00Cd6Fa71588C164122b' // AerodromeAtomicV3 (stakes positions for vaults) -const VOTER = '0x16613524e02ad97eDfeF371bC883F2F5d6C480A5' // Aerodrome Voter +// position layouts the vaults' position managers return +const POS = { + // Slipstream / Uniswap-v3 / PancakeSwap-v3 shape: (nonce, operator, token0, token1, fee|tickSpacing, tickLower, tickUpper, liquidity, ...) + slip: 'function positions(uint256) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 fg0, uint256 fg1, uint128 owed0, uint128 owed1)', + // Ramses V3 shape: (token0, token1, tickSpacing, tickLower, tickUpper, liquidity, ...) + ramses: 'function positions(uint256) view returns (address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 fg0, uint256 fg1, uint128 owed0, uint128 owed1)', +} + +// every TRUSS vault factory: name, factory, how its positions are read +const CONFIG = { + base: [ + { name: 'Aero (Base)', factory: '0xd505a36bD8e51E468e24e27bCE63d1a5BF775205', layout: 'slip' }, + ], + optimism: [ + { name: 'Aero (OP Mainnet)', factory: '0xd6A23EAaC6FF894e327519AD91B2Fad638266f7B', layout: 'slip' }, + ], + robinhood: [ + { name: 'UP33', factory: '0x7158B5D77cD54f78a536e3Ace28299fd5a7609a6', layout: 'slip' }, + { name: 'Raphael', factory: '0xdfB916FF892a2e9BC43f36e9a584f36c2E28eeb0', layout: 'slip' }, + { name: 'Aero (Robinhood)', factory: '0xc4bd16C4E762e1289fc468EeaEe4e7eA47775B98', layout: 'slip' }, + { name: 'Ramses (Robinhood)', factory: '0xFa179DE68D711360EcF9EAE2E4f9b1b78F5f34Aa', layout: 'ramses' }, + { name: 'GIGA', factory: '0x2Ff790D1d1A0cEAeCd340F60d601B0cA22757D35', layout: 'slip' }, + { name: 'Fables', factory: '0xa8afBD03602dc044C4Fd7b2231216AB3104A0f38', layout: 'fables' }, + ], + hyperliquid: [ + { name: 'Ramses (HyperEVM)', factory: '0x6940112e98ca5D3CeB5a369e4b6744AD2554a84E', layout: 'ramses' }, + { name: 'Hybra', factory: '0x7B2a713082CeddB4ac7F05A33e13C1D38e1F2C6B', layout: 'slip' }, + ], +} const abi = { vaultCount: 'uint256:vaultCount', allVaults: 'function allVaults(uint256) view returns (address)', - gauges: 'function gauges(address) view returns (address)', - stakedValues: 'function stakedValues(address depositor) view returns (uint256[])', -} - -async function tvl(api) { - const n = await api.call({ target: FACTORY, abi: abi.vaultCount }) - const vaults = await api.multiCall({ target: FACTORY, abi: abi.allVaults, calls: [...Array(Number(n)).keys()] }) - if (!vaults.length) return - - const pools = await api.multiCall({ abi: 'address:pool', calls: vaults }) - const token0s = await api.multiCall({ abi: 'address:token0', calls: vaults }) - const token1s = await api.multiCall({ abi: 'address:token1', calls: vaults }) - - // 1) idle tokens sitting in each vault - const tokensAndOwners = [] - vaults.forEach((v, i) => { tokensAndOwners.push([token0s[i], v], [token1s[i], v]) }) - await sumTokens2({ api, tokensAndOwners }) - - // 2) staked Slipstream positions (held by the atomic in each pool's gauge) - const uniqPools = [...new Set(pools.map(p => p.toLowerCase()))] - const gauges = await api.multiCall({ target: VOTER, abi: abi.gauges, calls: uniqPools }) - const live = uniqPools.map((p, i) => ({ pool: p, gauge: gauges[i] })) - .filter(x => x.gauge && x.gauge !== ADDRESSES.null) - if (!live.length) return - - const nfpms = await api.multiCall({ abi: 'address:nft', calls: live.map(x => x.gauge) }) - const staked = await api.multiCall({ abi: abi.stakedValues, calls: live.map(x => ({ target: x.gauge, params: [ATOMIC] })) }) - - // gauges of different pools can share a position manager, so group the staked ids by manager - const idsByNfpm = {} - nfpms.forEach((nfpm, i) => { - const key = nfpm.toLowerCase() - idsByNfpm[key] = (idsByNfpm[key] || []).concat(staked[i].map(String)) - }) - for (const [nftAddress, positionIds] of Object.entries(idsByNfpm)) { - if (positionIds.length) await unwrapSlipstreamNFT({ api, nftAddress, positionIds }) + lp: 'address:lp', + rewardTokens: 'function rewardTokens() view returns (address[])', + positionIds: 'function positionIds() view returns (uint256[])', + slot0: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick)', +} + +// Fables (Uniswap v4 hook): the vault's liquidity is an ERC-6909 balance on the pool's hook, one id per range; +// the vault maps its own position id to the hook's range id (rangeOf, 0 = closed) +const FABLES = { + rangeOf: 'function rangeOf(uint256 id) view returns (uint256)', + rangeKey: 'function rangeKey(uint256 id) view returns ((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, int24 tickLower, int24 tickUpper, bool set)', + balanceOf: 'function balanceOf(address owner, uint256 id) view returns (uint256)', +} + +async function vaultsOf(api, factory) { + const n = await api.call({ target: factory, abi: abi.vaultCount }) + if (!Number(n)) return [] + return api.multiCall({ target: factory, abi: abi.allVaults, calls: [...Array(Number(n)).keys()] }) +} + +function tvlFor(entries) { + return async (api) => { + for (const { factory, layout } of entries) { + const vaults = await vaultsOf(api, factory) + if (!vaults.length) continue + + const token0s = await api.multiCall({ abi: 'address:token0', calls: vaults }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: vaults }) + const pools = await api.multiCall({ abi: 'address:pool', calls: vaults }) // Fables: the pool's FablesPoolView + const nfpms = await api.multiCall({ abi: 'address:nfpm', calls: vaults }) + const hooks = await api.multiCall({ abi: 'address:gauge', calls: vaults }) // Fables: the pool's hook + const idsList = await api.multiCall({ abi: abi.positionIds, calls: vaults }) + + // reward tokens a vault may keep for its customer (claimed, not yet sold) + const atomic = await api.call({ target: factory, abi: abi.lp }) + const rewards = await api.call({ target: atomic, abi: abi.rewardTokens }) + + // 1) idle balances held by each vault + const tokensAndOwners = [] + vaults.forEach((v, i) => { + tokensAndOwners.push([token0s[i], v], [token1s[i], v], [nullAddress, v]) // + the vault's own ETH/HYPE + rewards.forEach(r => tokensAndOwners.push([r, v])) + }) + await api.sumTokens({ tokensAndOwners }) + + // 2) LP positions owned by each vault + const calls = [] + vaults.forEach((v, i) => (idsList[i] || []).forEach(id => calls.push({ i, id }))) + if (!calls.length) continue + + const ticks = await api.multiCall({ abi: abi.slot0, calls: pools }) + const positions = await readPositions(api, layout, calls, { vaults, hooks, nfpms }) + positions.forEach((p, k) => { + if (!p) return + const { i } = calls[k] + const liquidity = Number(p.liquidity) + if (!liquidity || !ticks[i]) return + addUniV3LikePosition({ + api, token0: token0s[i], token1: token1s[i], liquidity, + tickLower: Number(p.tickLower), tickUpper: Number(p.tickUpper), tick: Number(ticks[i].tick), + }) + }) + } } } +async function readPositions(api, layout, calls, { vaults, hooks, nfpms }) { + if (layout === 'fables') { + const rids = await api.multiCall({ abi: FABLES.rangeOf, calls: calls.map(({ i, id }) => ({ target: vaults[i], params: [id] })) }) + const open = calls.map((c, k) => ({ ...c, k, rid: rids[k] })).filter(c => String(c.rid) !== '0') + const ranges = await api.multiCall({ abi: FABLES.rangeKey, calls: open.map(({ i, rid }) => ({ target: hooks[i], params: [rid] })) }) + const bals = await api.multiCall({ abi: FABLES.balanceOf, calls: open.map(({ i, rid }) => ({ target: hooks[i], params: [vaults[i], rid] })) }) + const positions = calls.map(() => null) + open.forEach(({ k }, j) => { + const r = ranges[j] + if (r.set) positions[k] = { tickLower: r.tickLower, tickUpper: r.tickUpper, liquidity: bals[j] } + }) + return positions + } + return api.multiCall({ abi: POS[layout], calls: calls.map(({ i, id }) => ({ target: nfpms[i], params: [id] })) }) +} + module.exports = { - methodology: 'TVL is the value of all tokens held by TRUSS LP vaults: idle token balances in each vault plus the underlying tokens of every Aerodrome Slipstream position staked in a gauge on the vaults\' behalf.', - start: '2026-09-25', - base: { tvl }, + methodology: 'TVL is the value of everything held by TRUSS LP customer vaults: idle tokens in each vault plus the underlying tokens of every concentrated-liquidity position the vault owns (Aerodrome, UP33, Raphael, Ramses, GIGA, Fables and Hybra pools).', + doublecounted: true, + start: '2026-10-22', } + +Object.keys(CONFIG).forEach(chain => { + module.exports[chain] = { tvl: tvlFor(CONFIG[chain]) } +}) From 8f66804db43325352c63edf8ecbc8e8957845b43 Mon Sep 17 00:00:00 2001 From: GongFu Date: Thu, 29 Oct 2026 18:04:45 +0300 Subject: [PATCH 505/988] Add GongFu locking protocol implementation (#21855) --- projects/gongfu/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/gongfu/index.js diff --git a/projects/gongfu/index.js b/projects/gongfu/index.js new file mode 100644 index 00000000000..e089c29847b --- /dev/null +++ b/projects/gongfu/index.js @@ -0,0 +1,26 @@ +// GongFu: on-chain locking protocol on Robinhood Chain. +// Users lock GF for 1/7/30/90/180 days and earn rewards paid from a fixed, +// non-withdrawable reward reserve held by the same contract. +// +// staking = GF principal currently locked by users (principalLiability). +// The free reward reserve (bought once at launch, no withdrawal function) +// is protocol-owned and intentionally NOT counted. + +const GF = '0xFEd6b187F6Da04E2EAe5D3ea89B57129Da62b28A' +const GONGFU_POOL = '0x0557b1f2003aac5ae3bf791eea469259786773d2' + +const protocolStateAbi = 'function protocolState() view returns (uint8 status, uint64 createdAt, uint64 activatedAt, uint64 windDownAt, uint256 permanentSupportReceived, uint256 uncreditedSupportReceived, uint256 principalLiability, uint256 settledEpochLiability, uint256 claimableReferralLiability, uint256 unsettledMaximumBonus, uint256 openPositionCount, uint256 registeredUserCount, uint64 epochQueueHead, uint256 unsettledEpochCount, address referralQueueHead, address referralQueueCursor, uint256 referralQueueEligibleCount)' + +async function staking(api) { + const state = await api.call({ target: GONGFU_POOL, abi: protocolStateAbi }) + api.add(GF, state.principalLiability) +} + +module.exports = { + methodology: 'Staking counts the GF principal currently locked by users in the GongFuPool contract (principalLiability). The protocol-owned reward reserve held by the same contract is excluded.', + start: '2026-10-22', + robinhood: { + tvl: () => ({}), + staking, + }, +} From 1b9f14c441013921b3056227f45aef60a18c03fc Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:05:39 +0100 Subject: [PATCH 506/988] uni v2 registry - support factories - fixes #21918 --- projects/helper/cache/uniswap.js | 19 ++++++++++++++++--- projects/nomiswap/index.js | 25 ------------------------- projects/skydrome/index.js | 12 ------------ projects/spiritswap/index.js | 18 ------------------ projects/udonswap/index.js | 23 ----------------------- registries/uniswapV2.js | 32 +++++++++++++++++++++++++++++++- 6 files changed, 47 insertions(+), 82 deletions(-) delete mode 100644 projects/nomiswap/index.js delete mode 100644 projects/skydrome/index.js delete mode 100644 projects/spiritswap/index.js delete mode 100644 projects/udonswap/index.js diff --git a/projects/helper/cache/uniswap.js b/projects/helper/cache/uniswap.js index eb4bf8e5357..df8bda07be5 100644 --- a/projects/helper/cache/uniswap.js +++ b/projects/helper/cache/uniswap.js @@ -29,7 +29,7 @@ function getUniTVL({ coreAssets, blacklist = [], factory, blacklistedTokens, const abi = { ...uniswapAbi, ...abis } - return async (api) => { + const factoryTvlFunction = (factory) => async (api) => { let chain = api?.chain if (!chain) chain = _chain @@ -55,7 +55,7 @@ function getUniTVL({ coreAssets, blacklist = [], factory, blacklistedTokens, coreAssets = getCoreAssets(chain) const coreAssetsSet = new Set(coreAssets?.map(i => normalizeAddress(i, chain))) - let cache = await _getCache(cacheFolder, key, api) + let cache = await _getCache(cacheFolder, key, api, factory) const _oldPairInfoLength = cache.pairs.length const length = await api.call({ abi: abi.allPairsLength, target: factory, }) @@ -210,7 +210,20 @@ function getUniTVL({ coreAssets, blacklist = [], factory, blacklistedTokens, return transformBalances(chain, balances) } - async function _getCache(cacheFolder, key, api) { + if (Array.isArray(factory)) { + return async (api) => { + for (const f of factory) { + const balances = await factoryTvlFunction(f)(api) + // memoryOptimization writes straight into api and returns api.getBalances(), so adding it again would double count + if (!memoryOptimization) api.addBalances(balances) + } + return api.getBalances() + } + } + + return factoryTvlFunction(factory) + + async function _getCache(cacheFolder, key, api, factory) { let cache = await getCache(cacheFolder, key) if (cache.pairs) { for (let i = 0; i < cache.pairs.length; i++) { diff --git a/projects/nomiswap/index.js b/projects/nomiswap/index.js deleted file mode 100644 index 01839db1af4..00000000000 --- a/projects/nomiswap/index.js +++ /dev/null @@ -1,25 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { getUniTVL } = require("../helper/unknownTokens"); -const { stakings } = require("../helper/staking"); -const sdk = require('@defillama/sdk') - -const constantProductFactory = "0xd6715A8be3944ec72738F0BFDC739d48C3c29349"; -const stableSwapFactory = "0xC6B7ee49D386bAe4FD501F2d2f8d18828F1f6285"; -const factories = [constantProductFactory, stableSwapFactory].map(factory => getUniTVL({ - factory, - useDefaultCoreAssets: true -})) - -const NMX = ADDRESSES.bsc.NMX - -const stakingPools = [ - // Staking pool - "0xdbf1b10fe3e05397cd454163f6f1ed0c1181c3b3", -] - -module.exports = { - bsc: { - staking: stakings(stakingPools, NMX), - tvl: sdk.util.sumChainTvls(factories), - }, -}; \ No newline at end of file diff --git a/projects/skydrome/index.js b/projects/skydrome/index.js deleted file mode 100644 index 066c3d3c1e1..00000000000 --- a/projects/skydrome/index.js +++ /dev/null @@ -1,12 +0,0 @@ -const { getUniTVL } = require('../helper/unknownTokens') -const sdk = require('@defillama/sdk') - -const V1_FACTORY = '0x2516212168034b18a0155FfbE59f2f0063fFfBD9' -const V2_FACTORY = '0x74B8738862E4814C6E6D6e0202F8386685ca7B9D' - -const tvl = sdk.util.sumChainTvls([V1_FACTORY, V2_FACTORY].map((factory) => getUniTVL({ factory, useDefaultCoreAssets: true, hasStablePools: true, }))) - -module.exports = { - misrepresentedTokens: true, - scroll: { tvl }, -} diff --git a/projects/spiritswap/index.js b/projects/spiritswap/index.js deleted file mode 100644 index e92d2bde542..00000000000 --- a/projects/spiritswap/index.js +++ /dev/null @@ -1,18 +0,0 @@ -const {staking} = require('../helper/staking') -const { getUniTVL } = require('../helper/unknownTokens') -const sdk = require('@defillama/sdk'); - - -const factory = '0xEF45d134b73241eDa7703fa787148D9C9F4950b0' -const factory2 = '0x9d3591719038752db0c8bEEe2040FfcC3B2c6B9c' -const chain = 'fantom' -const ammTvl = getUniTVL({ chain, factory, useDefaultCoreAssets: false, }) -const ammTvl2 = getUniTVL({ chain, factory: factory2, useDefaultCoreAssets: false, blacklist: ["0x5b2af7fd27e2ea14945c82dd254c79d3ed34685e"] }) - - -module.exports = { - fantom:{ - tvl: sdk.util.sumChainTvls([ammTvl,ammTvl2]), - staking: staking("0x2fbff41a9efaeae77538bd63f1ea489494acdc08", "0x5cc61a78f164885776aa610fb0fe1257df78e59b") - }, -} diff --git a/projects/udonswap/index.js b/projects/udonswap/index.js deleted file mode 100644 index 61cd8bcc26c..00000000000 --- a/projects/udonswap/index.js +++ /dev/null @@ -1,23 +0,0 @@ -const sdk = require('@defillama/sdk'); -const { getUniTVL } = require("../helper/unknownTokens"); - -module.exports = { - misrepresentedTokens: false, - methodology: "TVL is calculated by summing the reserves of all DEX pairs on KUB.", - bitkub: { - tvl: sdk.util.sumChainTvls([ - getUniTVL({ - factory: '0xe8150dCfe6De2c7EFc2e9f96C09d6b83106Af1dE', - useDefaultCoreAssets: true, - fetchBalances: true, - permitFailure: true, - }), - getUniTVL({ - factory: '0x18c7a4CA020A0c648976208dF2e3AE1BAA32e8d1', - useDefaultCoreAssets: true, - fetchBalances: true, - permitFailure: true, - }), - ]) - }, -}; diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index a9bcab671e3..788b197dd19 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -3498,7 +3498,12 @@ const uniV2Configs = { fetchBalances: true, useDefaultCoreAssets: false, abis: { allPairsLength: 'uint256:allPoolsLength', allPairs: 'function allPools(uint) view returns (address)' }, }, - optimism: '0xCc0bDDB707055e04e497aB22a59c2aF4391cd12F', + optimism: { + factory: [ + '0xCc0bDDB707055e04e497aB22a59c2aF4391cd12F', + '0xe13Dd1fbA721Aa81a1826D9523AC9BC7d260c879', // Gauges V2 CL factory + ] + }, lisk: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', fraxtal: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', mode: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', @@ -3509,6 +3514,31 @@ const uniV2Configs = { celo: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', sseed: '0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F', }, + 'skydrome': { + misrepresentedTokens: true, + _options: { hasStablePools: true }, + scroll: { factory: ['0x2516212168034b18a0155FfbE59f2f0063fFfBD9', '0x74B8738862E4814C6E6D6e0202F8386685ca7B9D'] }, // v1, v2 + }, + 'nomiswap': { + bsc: { + factory: ['0xd6715A8be3944ec72738F0BFDC739d48C3c29349', '0xC6B7ee49D386bAe4FD501F2d2f8d18828F1f6285'], // constant product, stable swap + staking: [['0xdbf1b10fe3e05397cd454163f6f1ed0c1181c3b3'], ADDRESSES.bsc.NMX], + }, + }, + 'udonswap': { + misrepresentedTokens: false, + methodology: 'TVL is calculated by summing the reserves of all DEX pairs on KUB.', + _options: { fetchBalances: true, permitFailure: true }, + bitkub: { factory: ['0xe8150dCfe6De2c7EFc2e9f96C09d6b83106Af1dE', '0x18c7a4CA020A0c648976208dF2e3AE1BAA32e8d1'] }, + }, + 'spiritswap': { + // no core assets: every pool token is priced directly. the blacklisted token only ever appears in pools of the second factory + _options: { useDefaultCoreAssets: false, blacklistedTokens: ['0x5b2af7fd27e2ea14945c82dd254c79d3ed34685e'] }, + fantom: { + factory: ['0xEF45d134b73241eDa7703fa787148D9C9F4950b0', '0x9d3591719038752db0c8bEEe2040FfcC3B2c6B9c'], + staking: ['0x2fbff41a9efaeae77538bd63f1ea489494acdc08', '0x5cc61a78f164885776aa610fb0fe1257df78e59b'], + }, + }, } module.exports = buildProtocolExports(uniV2Configs, uniV2ExportFn) From a875be65cfd5e679a4919ec75898d8236a3e9cf6 Mon Sep 17 00:00:00 2001 From: canddao1-dotcom Date: Thu, 29 Oct 2026 09:19:52 -0600 Subject: [PATCH 507/988] flrbank: add BANK lending market (Morpho Blue) to TVL (#21916) Co-authored-by: James Woods Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/flarebank-lending/index.js | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/flarebank-lending/index.js diff --git a/projects/flarebank-lending/index.js b/projects/flarebank-lending/index.js new file mode 100644 index 00000000000..41cea7a88d4 --- /dev/null +++ b/projects/flarebank-lending/index.js @@ -0,0 +1,30 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// BANK lending: a Morpho Blue market lending WFLR against wBANK (fee-free 1:1 wrapper of BANK) +const MORPHO = '0xF4346F5132e810f80a28487a79c7559d9797E8B0' +const MARKET_ID = '0xcbe6d249967c061d6ecb586ec7efeedd66c4a4a7b45c5aa2156452234e0b6677' + +const marketAbi = 'function market(bytes32) view returns (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee)' + +const getMarket = (api) => api.call({ target: MORPHO, abi: marketAbi, params: [MARKET_ID] }) + +async function tvl(api) { + // wBANK collateral is not added: it is a claim on the WFLR backing BANK, counted under FlareBank + const market = await getMarket(api) + api.add(ADDRESSES.flare.WFLR, BigInt(market.totalSupplyAssets) - BigInt(market.totalBorrowAssets)) +} + +async function borrowed(api) { + const market = await getMarket(api) + api.add(ADDRESSES.flare.WFLR, market.totalBorrowAssets) +} + +module.exports = { + methodology: 'TVL is the WFLR supplied and not borrowed in the BANK lending market on Morpho Blue. wBANK collateral is not counted, as it is a claim on the WFLR backing BANK, which is counted under FlareBank. Borrowed WFLR is reported separately.', + doublecounted: true, + start: '2026-10-23', + flare: { + tvl, + borrowed, + }, +} From eaffc006d5eaea116c19c50446d62c91ebb106da Mon Sep 17 00:00:00 2001 From: Jonathan Snow <29241487+jonathansnow@users.noreply.github.com> Date: Thu, 29 Oct 2026 12:23:38 -0300 Subject: [PATCH 508/988] Origin Ether: fix double-counted Base strategy backing (#21922) --- projects/originether/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/originether/index.js b/projects/originether/index.js index b40cb0f89bd..832d3d09df1 100644 --- a/projects/originether/index.js +++ b/projects/originether/index.js @@ -49,7 +49,10 @@ const ethTvl = async (api) => { async function baseTvl(api) { const vault = '0x98a0CbeF61bD2D21435f433bE4CD42B56B38CC93' - const woethStrategy = '0x80c864704dd06c3693ed5179190786ee38acf835' + const woethStrategies = [ + '0x80c864704dd06c3693ed5179190786ee38acf835', // Legacy + '0xa03360b3f6d902f1b3334c0adbd5c6995d3513fe', +] const curveAMO = '0x9cfcAF81600155e01c63e4D2993A8A81A8205829' const aeroAMO = '0xF611cC500eEE7E4e4763A05FE623E2363c86d2Af' const curveGauge = '0x9da8420dbeebdfc4902b356017610259ef7eedd8' @@ -62,7 +65,7 @@ async function baseTvl(api) { api.add(ADDRESSES.base.WETH, vaultBalance) for (const strategy of strategies) { - if (strategy.toLowerCase() === woethStrategy.toLowerCase()) continue + if (woethStrategies.includes(strategy.toLowerCase())) continue if (strategy.toLowerCase() === curveAMO.toLowerCase()) { // only count WETH side: our share of gauge, gauge's share of pool, pool WETH balance const ourGaugeBal = await api.call({ abi: 'erc20:balanceOf', target: curveGauge, params: curveAMO }) From e9d67f957b47437bab01a7f536e7fa321fca0541 Mon Sep 17 00:00:00 2001 From: canddao1-dotcom Date: Thu, 29 Oct 2026 09:31:17 -0600 Subject: [PATCH 509/988] flrbank treasury: add P-chain staked FLR and protocol positions (#21919) Co-authored-by: James Woods Co-authored-by: Claude Opus 5.5 --- projects/treasury/flrbank.js | 89 +++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 2 deletions(-) diff --git a/projects/treasury/flrbank.js b/projects/treasury/flrbank.js index 970b7d7785a..835252b9504 100644 --- a/projects/treasury/flrbank.js +++ b/projects/treasury/flrbank.js @@ -1,12 +1,74 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs'); +const { post } = require('../helper/http') +const { toAssetsUp } = require('../helper/morpoho') const bank = '0x194726f6c2ae988f1ab5e1c943c17e591a6f6059' const treasury = '0xaA68BC4BAb9a63958466f49f5a58c54A412D4906' +// same key as the treasury's C-chain address, bech32-encoded for the P-chain +const treasuryPChain = 'P-flare1y39epmwrfdtemgxpvkqephea38t80ccwswv30y' const SPARKDEX_LP = '0x0F574Fc895c1abF82AefF334fA9d8bA43F866111' // BANK/WFLR SPARKDEX V2 LP const ENOSYS_LP = '0x5F29C8d049e47DD180c2B83E3560E8e271110335' // BANK/WFLR ENOSYS V2 LP +const RFLR = '0x26d460c3Cf931Fb2014FA436a49e3Af08619810e' // reward FLR, claimable 1:1 for FLR +const MYSTIC_USDT0_VAULT = '0xE8dd6A1e13244A27bDaa19CcBf33013647C675d1' // Mystic Morpho vault (COREUSDT0) + +const MORPHO = '0xF4346F5132e810f80a28487a79c7559d9797E8B0' +const MORPHO_MARKETS = [ + '0x2f31ab3fc12d6d10d1de9e5c74053126f03ac1f80a2e6d69d36a411fef7d942f', // FXRP collateral / USDT0 loan + '0xcbe6d249967c061d6ecb586ec7efeedd66c4a4a7b45c5aa2156452234e0b6677', // wBANK collateral / WFLR loan +] +const WBANK = '0x9f1a66a34a8b2768dddeb49da99e6161d0d2dd87' // fee-free 1:1 wrapper of BANK + +// Enosys governance stake managers, holding the staked token on the treasury's behalf +const ENOSYS_STAKES = [ + ['0x7eB8CeB0F64D934a31835b98eB4cbAb3cA56dF28', '0xfF56Eb5b1a7FAa972291117E5E9565dA29bc808d'], // APS + ['0x988E94a0AEFB1fCdC0C4d44dDBa103C5d4c6c6b0', '0x140D8d3649Ec605CF69018C627fB44cCC76eC89f'], // HLN +] + +// Enosys Loans (Liquity V2 fork) stability pools: [pool, branch collateral] +const STABILITY_POOLS = [ + ['0x2c817F7159c08d94f09764086330c96Bb3265A2f', ADDRESSES.flare.FXRP], + ['0x0Dd6daab4cB9A0ba6707Cf59DBfbc28cc33CA24A', ADDRESSES.flare.WFLR], + ['0x3FAEC256DCFDB9eBa882b5F71e020FA128081f56', '0x4C18Ff3C89632c3Dd62E796c0aFA5c07c4c1B2b3'], // stXRP + ['0xE6B23B97A9058B88e6d068d57d8a69Fb07ab2A61', ADDRESSES.flare.sFLR], +] +const CDP = '0x6Cd3a5Ba46FA254D4d2E3C2B37350ae337E94a0F' + +const morphoAbi = { + idToMarketParams: 'function idToMarketParams(bytes32) view returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv)', + market: 'function market(bytes32) view returns (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee)', + position: 'function position(bytes32, address) view returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral)', +} + +// collateral the treasury has posted, less what it owes; wBANK collateral is BANK, so it goes to ownTokens, +// while every market's debt comes off tvl +async function morphoPositions(api, isOwnTokens) { + const [params, markets, positions] = await Promise.all([ + api.multiCall({ target: MORPHO, abi: morphoAbi.idToMarketParams, calls: MORPHO_MARKETS }), + api.multiCall({ target: MORPHO, abi: morphoAbi.market, calls: MORPHO_MARKETS }), + api.multiCall({ target: MORPHO, abi: morphoAbi.position, calls: MORPHO_MARKETS.map((id) => ({ params: [id, treasury] })) }), + ]) + positions.forEach((position, i) => { + const isBank = params[i].collateralToken.toLowerCase() === WBANK + if (isOwnTokens === isBank) api.add(isBank ? bank : params[i].collateralToken, position.collateral) + if (isOwnTokens) return + const debt = toAssetsUp(position.borrowShares, markets[i].totalBorrowAssets, markets[i].totalBorrowShares) + api.add(params[i].loanToken, -debt) + }) +} + +async function pChainStake(api) { + const call = (method) => post('https://flare-api.flare.network/ext/bc/P', { jsonrpc: '2.0', id: 1, method, params: { addresses: [treasuryPChain] } }) + const [stake, balance] = await Promise.all([call('platform.getStake'), call('platform.getBalance')]) + // P-chain amounts have 9 decimals + const nanoFlr = BigInt(stake.result.staked) + BigInt(balance.result.unlocked) + api.add(ADDRESSES.flare.WFLR, nanoFlr * 10n ** 9n) +} + module.exports = { + // the P-chain stake is only readable at the current state, so historical runs would misstate it + timetravel: false, flare: { tvl: async (api) => { await sumTokens2({ @@ -18,17 +80,40 @@ module.exports = { ADDRESSES.flare.FXRP, // FXRP '0x4C18Ff3C89632c3Dd62E796c0aFA5c07c4c1B2b3', // stXRP ADDRESSES.flare.sFLR, // sFLR - '0x6Cd3a5Ba46FA254D4d2E3C2B37350ae337E94a0F', // CDP + CDP, // CDP + '0x1502FA4be69d526124D453619276FacCab275d3D', // WETH ], resolveLP: true, resolveUniV3: true, api, }) + + const [rflr, vaultShares, stakes, deposits, yieldGains, collGains] = await Promise.all([ + api.call({ target: RFLR, abi: 'erc20:balanceOf', params: [treasury] }), + api.call({ target: MYSTIC_USDT0_VAULT, abi: 'erc20:balanceOf', params: [treasury] }), + api.multiCall({ abi: 'erc20:balanceOf', calls: ENOSYS_STAKES.map(([manager]) => ({ target: manager, params: [treasury] })) }), + api.multiCall({ abi: 'function getCompoundedBoldDeposit(address) view returns (uint256)', calls: STABILITY_POOLS.map(([pool]) => ({ target: pool, params: [treasury] })) }), + api.multiCall({ abi: 'function getDepositorYieldGain(address) view returns (uint256)', calls: STABILITY_POOLS.map(([pool]) => ({ target: pool, params: [treasury] })) }), + api.multiCall({ abi: 'function getDepositorCollGain(address) view returns (uint256)', calls: STABILITY_POOLS.map(([pool]) => ({ target: pool, params: [treasury] })) }), + ]) + api.add(ADDRESSES.flare.WFLR, rflr) + const usdt0 = await api.call({ target: MYSTIC_USDT0_VAULT, abi: 'function convertToAssets(uint256) view returns (uint256)', params: [vaultShares] }) + api.add(ADDRESSES.flare.USDT0, usdt0) + stakes.forEach((amount, i) => api.add(ENOSYS_STAKES[i][1], amount)) + STABILITY_POOLS.forEach(([, coll], i) => { + api.add(CDP, deposits[i]) + api.add(CDP, yieldGains[i]) + api.add(coll, collGains[i]) + }) + + await morphoPositions(api, false) + await pChainStake(api) api.removeTokenBalance(bank) }, ownTokens: async (api) => { await sumTokens2({ owner: treasury, tokens: [SPARKDEX_LP, ENOSYS_LP], resolveLP: true, api, }) api.removeTokenBalance(ADDRESSES.flare.WFLR) + await morphoPositions(api, true) } }, -} \ No newline at end of file +} From c2941081de02c03d47f89f4eae39449972477412 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 29 Oct 2026 15:09:02 -0400 Subject: [PATCH 510/988] add kgear vault to kamui (#21924) --- registries/curators.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/registries/curators.js b/registries/curators.js index 8786750a55f..662f0242e79 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -6,7 +6,7 @@ const { getCuratorExport } = require('../projects/helper/curators') const configs = { "kamui": { config: { - methodology: 'Counts the assets (totalAssets) held by the Kamui Stable, Balanced and Boosted vaults, ERC-4626 (ERC-7540) vaults on Lagoon infrastructure curated by Kamui. Also counted under Lagoon.', + methodology: 'Counts the assets (totalAssets) held by the Kamui Stable, Balanced, Boosted and kGear vaults, ERC-4626 (ERC-7540) vaults on Lagoon infrastructure curated by Kamui. kGear is counted net of its Gearbox debt. Also counted under Lagoon.', start: '2026-08-27', // vaults redeployed through the Lagoon OptinProxyFactory blockchains: { ethereum: { @@ -14,6 +14,7 @@ const configs = { '0xcDA323c2DF692d989B24BA51D0aCCa924cf9a344', // Lagoon: Kamui Stable Vault (USDst) '0xA5AE405242f42C47996a0C6857ff10a77F9bdeE6', // Lagoon: Kamui Balanced Vault (USDbl) '0x9E0DB8F43bb91e2148B0Db920E21370525CF3Aab', // Lagoon: Kamui Boosted Vault (USDbt) + '0xe9Fc51dF9168361c9cF00383C644Ae9dcF2aD6b0', // Lagoon: Kamui kGear (leveraged, Gearbox) ], }, } From 285d85ce4904338c5c08f292f3deb699bd2157d1 Mon Sep 17 00:00:00 2001 From: mikeminer <4n0nym0u5.cyber@gmail.com> Date: Thu, 29 Oct 2026 20:38:51 +0100 Subject: [PATCH 511/988] devfridge: read vault balances (#21923) Co-authored-by: Claude Sonnet 5.5 Co-authored-by: FelixBruguera --- projects/devfridge/index.js | 84 +++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/projects/devfridge/index.js b/projects/devfridge/index.js index 0c313a3ae26..008eeabbd68 100644 --- a/projects/devfridge/index.js +++ b/projects/devfridge/index.js @@ -1,4 +1,4 @@ -const { getConnection } = require("../helper/solana"); +const { getConnection, decodeAccount } = require("../helper/solana"); const { PublicKey } = require("@solana/web3.js"); const PROGRAM_ID = new PublicKey( @@ -8,6 +8,13 @@ const PROGRAM_ID = new PublicKey( const PASTA_MINT = "39kMeX4HVRW9qbbiHSPbRQ9xeXUF18GrNP6gL61Ppump"; +const TOKEN_2022_PROGRAM_ID = new PublicKey( + "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" +); +const ASSOCIATED_TOKEN_PROGRAM_ID = new PublicKey( + "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" +); + const LOCK_DATA_SIZE = 105; const LOCK_DISCRIMINATOR = Buffer.from([ @@ -24,51 +31,64 @@ function decodeLock(data) { }; } -let _locks; -async function getActiveLocks() { - if (!_locks) _locks = _getActiveLocks(); - return _locks; +// Vault = Token-2022 ATA owned by the lock PDA (see CreateLock in the program). +function vaultAddress(lockPubkey, mint) { + return PublicKey.findProgramAddressSync( + [lockPubkey.toBuffer(), TOKEN_2022_PROGRAM_ID.toBuffer(), new PublicKey(mint).toBuffer()], + ASSOCIATED_TOKEN_PROGRAM_ID + )[0]; } -async function _getActiveLocks() { - const connection = getConnection(); - - const accounts = await connection.getProgramAccounts(PROGRAM_ID, { - // discriminator is checked in decodeLock — the base64 memcmp filter is - // silently ignored/mismatched by some RPCs and returns zero accounts - filters: [{ dataSize: LOCK_DATA_SIZE }], - }); - - const now = Math.floor(Date.now() / 1000); - - return accounts - .map(({ account }) => decodeLock(account.data)) - .filter(Boolean) - .filter((lock) => lock.unlockAt > now); +// Returns { [mint]: bigint } using real vault balances of active locks. +let cache; +async function getVaultBalances() { + if (cache) return cache; + cache = (async () => { + const connection = getConnection(); + const accounts = await connection.getProgramAccounts(PROGRAM_ID, { + filters: [{ dataSize: LOCK_DATA_SIZE }], + }); + + const now = Math.floor(Date.now() / 1000); + const locks = accounts + .map(({ pubkey, account }) => ({ pubkey, lock: decodeLock(account.data) })) + .filter(({ lock }) => lock && lock.unlockAt > now); + + const vaults = locks.map(({ pubkey, lock }) => vaultAddress(pubkey, lock.mint)); + const balances = {}; + for (let i = 0; i < vaults.length; i += 99) { + const infos = await connection.getMultipleAccountsInfo(vaults.slice(i, i + 99)); + infos.forEach((info, k) => { + if (!info) return; // vault closed/missing: nothing to count + const decoded = decodeAccount("tokenAccount", info); + const mint = decoded.mint.toString(); + // the lock's mint must match the vault mint, each vault is unique per lock + if (mint !== locks[i + k].lock.mint) return; + balances[mint] = (balances[mint] || 0n) + BigInt(decoded.amount.toString()); + }); + } + return balances; + })(); + return cache; } async function vesting(api) { - const locks = await getActiveLocks(); - - for (const lock of locks) { - if (lock.mint === PASTA_MINT) continue; - api.add(lock.mint, lock.amount.toString()); + const balances = await getVaultBalances(); + for (const [mint, amount] of Object.entries(balances)) { + if (mint === PASTA_MINT) continue; + api.add(mint, amount.toString()); } } async function staking(api) { - const locks = await getActiveLocks(); - - for (const lock of locks) { - if (lock.mint !== PASTA_MINT) continue; - api.add(lock.mint, lock.amount.toString()); - } + const balances = await getVaultBalances(); + if (balances[PASTA_MINT]) api.add(PASTA_MINT, balances[PASTA_MINT].toString()); } module.exports = { timetravel: false, methodology: - "DevFridge is a token locker: user-locked Token-2022 assets in active program-controlled timelock vaults on Solana are counted as vesting. DevFridge's own PASTA token is reported separately under staking. TVL is zero by design.", + "DevFridge is a token locker: user-locked Token-2022 assets in active program-controlled timelock vaults on Solana are counted as vesting, using real vault balances. Only locks whose unlock_at timestamp is still in the future are counted. DevFridge's own PASTA token is reported separately under staking. TVL is zero by design.", solana: { tvl: () => ({}), vesting, From 03bbcd094ab0ea4facde961d5f1b282ba78e556d Mon Sep 17 00:00:00 2001 From: Lodestar Date: Fri, 30 Oct 2026 07:59:24 +0100 Subject: [PATCH 512/988] Add The Cellar (Flare) (#21925) Co-authored-by: lodestarprotocol <305971687+lodestarprotocol@users.noreply.github.com> --- projects/the-cellar/index.js | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 projects/the-cellar/index.js diff --git a/projects/the-cellar/index.js b/projects/the-cellar/index.js new file mode 100644 index 00000000000..6dffaf03d59 --- /dev/null +++ b/projects/the-cellar/index.js @@ -0,0 +1,44 @@ +const ADDRESSES = require('../helper/coreAssets.json') +// DefiLlama TVL adapter for The Cellar by FlareCat (Flare), https://flarecellar.xyz +// +// Not related to Sommelier, whose vaults are also called "cellars". This is a separate protocol on +// Flare with its own team and contracts. +// +// One FXRP reserve, held by a single contract (the Jar), with claims on it: +// - fcUSD : dollar-sized game token minted against the reserve +// - Boost : leveraged XRP exposure on the same reserve (owns what is left after fcUSD) +// - Den : holds fcUSD and turns it into FXRP when backing gets thin +// - KOBAN : points token +// fcUSD, Boost, Den shares and KOBAN are claims or points on the same FXRP, so none of them is +// counted. Only FXRP the Jar actually holds for users is counted. +// +// The Jar keeps its FXRP in three internal ledgers (verified source, Jar.sol): +// reserve FXRP backing fcUSD + Boost -> counted +// denFxrp FXRP owned by Den depositors (after a conversion) -> counted +// protocolFxrp fees owed to the treasury, paid out by collect() -> NOT counted +// FXRP sent to the Jar outside these ledgers is ignored by its accounting and is not counted either. +// fcUSD held by the Jar (Den fcUSD, swap-back escrow) is a claim, not collateral, and is not counted. + +const JAR = '0xF85d0daCC7e911b1a2800DCF0e6027e0f7481294' + +async function tvl(api) { + const [reserve, denFxrp] = await Promise.all([ + api.call({ target: JAR, abi: 'uint256:reserve' }), + api.call({ target: JAR, abi: 'uint256:denFxrp' }), + ]) + api.add(ADDRESSES.flare.FXRP, reserve) + api.add(ADDRESSES.flare.FXRP, denFxrp) +} + +module.exports = { + methodology: + 'TVL is the FXRP held in the Jar contract for users: the reserve that backs fcUSD and Boost plus the FXRP ' + + 'owned by Den depositors. fcUSD, Boost, Den shares and KOBAN are claims or points on that same FXRP and are ' + + 'not counted. Fees owed to the treasury (protocolFxrp) are excluded.', + // Jar deploy: 2026-10-26 21:59:28 UTC, block 73048463. A timestamp, not '2026-10-26': at midnight that day the + // Jar did not exist yet and the first backfill day would fail. + start: 1793051968, + flare: { + tvl, + }, +} From bb710bd16fecc19eaaf8f20f76cabcf8699ee87d Mon Sep 17 00:00:00 2001 From: Khoa Date: Fri, 30 Oct 2026 02:01:21 -0500 Subject: [PATCH 513/988] Update Valantis STEX TVL and add stHYPE restaking (#21863) Co-authored-by: ccipherx --- projects/staked-hype/index.js | 2 +- projects/valantis-sthype-restaking/index.js | 27 +++++++++++ projects/valantis/index.js | 54 +++++++++------------ 3 files changed, 52 insertions(+), 31 deletions(-) create mode 100644 projects/valantis-sthype-restaking/index.js diff --git a/projects/staked-hype/index.js b/projects/staked-hype/index.js index 43ac36ef2a0..e468e93931f 100644 --- a/projects/staked-hype/index.js +++ b/projects/staked-hype/index.js @@ -4,8 +4,8 @@ const ADDRESSES = require('../helper/coreAssets.json') const STHYPE_TOKEN = '0xfFaa4a3D97fE9107Cef8a3F48c069F577Ff76cC1' const WHYPE = ADDRESSES.hyperliquid.WHYPE +/** Report circulating stHYPE supply in redeemable HYPE units. */ async function tvl(api) { - // Get total staked HYPE using totalAssets() method const totalStakedHYPE = await api.call({ target: STHYPE_TOKEN, abi: 'uint256:totalSupply' diff --git a/projects/valantis-sthype-restaking/index.js b/projects/valantis-sthype-restaking/index.js new file mode 100644 index 00000000000..5eeff208bfe --- /dev/null +++ b/projects/valantis-sthype-restaking/index.js @@ -0,0 +1,27 @@ +const STHYPE = '0xfFaa4a3D97fE9107Cef8a3F48c069F577Ff76cC1' +const ESCROW = '0x0447d0339c82a8EFe01994b7D1981bf5c517da0e' +const SEED_OWNER = '0x0000000000000000000000000000000000000001' +const ESCROW_DEPLOY_BLOCK = 47206861 + +async function tvl(api) { + if (await api.getBlock() < ESCROW_DEPLOY_BLOCK) return + const [accounting, seed, custody] = await api.batchCall([ + { target: ESCROW, abi: 'function totalAccounting() view returns (uint256 activeRawShares,uint256 totalOwnershipUnits,uint256 requestedRawShares,uint256 rewardRawShares)' }, + { target: ESCROW, abi: 'function account(address) view returns (uint256 ownershipUnits,uint256 activeRawShares,uint256 activeWstHype)', params: [SEED_OWNER] }, + { target: STHYPE, abi: 'function sharesOf(address) view returns (uint256)', params: [ESCROW] }, + ]) + const [active, units, requested, rewards] = Array.from(accounting, BigInt) + const seedUnits = BigInt(seed[0]) + if (seedUnits > units || (units === 0n && active !== 0n)) throw new Error('Invalid Valantis escrow ownership accounting') + // only a shortfall is invalid; shares sent to the escrow outside the accounting are not user claims + if (BigInt(custody) < active + requested + rewards) throw new Error('Valantis escrow custody does not reconcile') + const seedShares = units === 0n ? 0n : active * seedUnits / units + const userShares = active - seedShares + requested + api.add(STHYPE, await api.call({ target: STHYPE, abi: 'function sharesToBalance(uint256) view returns (uint256)', params: [userShares.toString()] })) +} + +module.exports = { + start: '2026-09-29', + methodology: 'Counts active user stHYPE plus pending withdrawals in the restaking escrow. Excludes unreleased reward reserves and the permanent seed. stHYPE and wstHYPE represent the same shares and are counted once.', + hyperliquid: { tvl }, +} diff --git a/projects/valantis/index.js b/projects/valantis/index.js index d8031990df5..e50bd428142 100644 --- a/projects/valantis/index.js +++ b/projects/valantis/index.js @@ -1,38 +1,32 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { BigNumber } = require('bignumber.js') -const STEX_STHYPE_CONTRACT = '0x39694eFF3b02248929120c73F90347013Aec834d' -const STEX_KHYPE_CONTRACT = '0xbf747D2959F03332dbd25249dB6f00F62c6Cb526' -const STEX_LENS_CONTRACT = '0x95e88072c3fe908101a13584d7A0ff87DaDd88f3' -const STEX_LENS_RESERVES_ABI = 'function getTotalValueToken1(address stex) external view returns (uint256 totalValueToken1)'; -const WHYPE = ADDRESSES.hyperliquid.WHYPE; +const STHYPE = '0xfFaa4a3D97fE9107Cef8a3F48c069F577Ff76cC1' +const WHYPE = ADDRESSES.hyperliquid.WHYPE -async function tvl(api) { - const sthypeStexTvlInTermsOfHype = await api.call({ - abi: STEX_LENS_RESERVES_ABI, - target: STEX_LENS_CONTRACT, - params: [STEX_STHYPE_CONTRACT] - }); - - const sthypeStexTvlInTermsOfHypeBigNumber = new BigNumber(sthypeStexTvlInTermsOfHype); - - api.add(WHYPE, sthypeStexTvlInTermsOfHypeBigNumber.toString()); +const STEX_STHYPE = '0x39694eFF3b02248929120c73F90347013Aec834d' +const STEX_KHYPE = '0xbf747D2959F03332dbd25249dB6f00F62c6Cb526' +const STEX_LENS = '0x95e88072c3fe908101a13584d7A0ff87DaDd88f3' +const NAV_ABI = 'function getTotalValueToken1(address) view returns (uint256)' - const khypeStexTvlInTermsOfHype = await api.call({ - abi: STEX_LENS_RESERVES_ABI, - target: STEX_LENS_CONTRACT, - params: [STEX_KHYPE_CONTRACT] - }); - - const khypeStexTvlInTermsOfHypeBigNumber = new BigNumber(khypeStexTvlInTermsOfHype); - - api.add(WHYPE, khypeStexTvlInTermsOfHypeBigNumber.toString()); +async function tvl(api) { + const [sthypeValue, khypeValue, pool] = await api.batchCall([ + { target: STEX_LENS, abi: NAV_ABI, params: [STEX_STHYPE] }, + { target: STEX_LENS, abi: NAV_ABI, params: [STEX_KHYPE] }, + { target: STEX_STHYPE, abi: 'address:pool' }, + ]) + const reserves = await api.call({ target: pool, abi: 'function getReserves() view returns (uint256,uint256)' }) + const sthypeNav = BigInt(sthypeValue) + const reserve0 = BigInt(reserves[0]) + // Keep live stHYPE visible for parent exclusions. Allocate liabilities to + // native exposure first, capping stHYPE at NAV to avoid negative balances. + const liveStHype = reserve0 < sthypeNav ? reserve0 : sthypeNav + api.add(STHYPE, liveStHype.toString()) + api.add(WHYPE, (sthypeNav - liveStHype + BigInt(khypeValue)).toString()) } module.exports = { - methodology: 'Counts the total amount of HYPE in Valantis pools', - start: 1743611, - hyperliquid: { - tvl - } + start: '2025-04-02', + doublecounted: true, // Lent WHYPE is also counted by HyperLend. + methodology: 'Counts combined stHYPE and kHYPE STEX net LP assets using the existing lens, including lending and pending unstaking less withdrawal liabilities. Preserves live stHYPE separately for parent exclusions; lending overlaps HyperLend TVL.', + hyperliquid: { tvl }, } From 9ce63ce9c99e27b4f759832c810e8e955e91a7b3 Mon Sep 17 00:00:00 2001 From: thomas <81407403+thomas-cloud579@users.noreply.github.com> Date: Fri, 30 Oct 2026 17:53:08 +0800 Subject: [PATCH 514/988] updateGateUSReserveAddresses (#21913) Co-authored-by: ccipherx --- cex/gate-us.js | 331 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 304 insertions(+), 27 deletions(-) diff --git a/cex/gate-us.js b/cex/gate-us.js index 9ebd0e34a86..b297571b4f5 100644 --- a/cex/gate-us.js +++ b/cex/gate-us.js @@ -1,37 +1,97 @@ module.exports = { + '0g': { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + akash: { + owners: [ + "akash1ny7sr4sehuhu3uyv53ln5qh4s6wd7dn5pmzd0n", + "akash1xm7q4xv75udvq6y62jmhhjwjchnsrjadankf4v" + ] + }, algorand: { owners: [ - "M6LWANJOQD6KK3KBN7N6RSPAMDWZNJNCY62LWWW5KH4ZUCH5RL7P27TS24" + "M6LWANJOQD6KK3KBN7N6RSPAMDWZNJNCY62LWWW5KH4ZUCH5RL7P27TS24", + "YJLGXEPALHVZPYVMVJL74FSH3NSZOD7EH5IKOJSEQPLRO437ENEFY2XTS4" ] }, apechain: { owners: [ - "0xfc89c020774524c9d03bd5de48fec149b10bdec3" + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] }, aptos: { owners: [ - "0x0d9be20998cbf45d6eb64653df6ae8a4ecbe8162f6047a85ef20c1ffa02c1c16" + "0x0d9be20998cbf45d6eb64653df6ae8a4ecbe8162f6047a85ef20c1ffa02c1c16", + "0x35278e4b7929f911a0744e1902022a6dca1abe7b2a95cfa7e8d0eb374717cc37" ] }, arbitrum: { owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + arweave: { + owners: [ + "CdBGzHvdY6nVNTjJ-_nR7vBu3d3On8bzK_s7kfG2rc8", + "navjpCpunT6JQu-l985v_f4NtqLsSPZ-jtSo4JcpaGE" + ] + }, + astar: { + owners: [ + "aL7FkBLkpKeg9aZb6CjLRkYTHTmxZBhLLRKBMc2r2hp5Yce" + ] + }, + avax: { + owners: [ + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41", "0xfc89c020774524c9d03bd5de48fec149b10bdec3" ] }, + babylon: { + owners: [ + "bbn1ny7sr4sehuhu3uyv53ln5qh4s6wd7dn5m77mfs", + "bbn1xm7q4xv75udvq6y62jmhhjwjchnsrjad8k2ln0" + ] + }, base: { owners: [ - "0xfc89c020774524c9d03bd5de48fec149b10bdec3" + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + berachain: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] }, bitcoin: { owners: [ + "161jRWAM66JQCemfe2aBxfxhmfam61ZytE", + "1EyFUCm5V5sSYqigMNHSPaJ2FmYE98k7b5" + ] + }, + bitcoincash: { + owners: [ + "1EyFUCm5V5sSYqigMNHSPaJ2FmYE98k7b5", "161jRWAM66JQCemfe2aBxfxhmfam61ZytE" ] }, + bittensor: { + owners: [ + "5GTWpTDFyagYTKYj6nkcJmbGNEkezLUxK8vAweQAyfhrVZSQ", + "5EQXksnm8MggjH2XsVzeXQPzMTXaASTpzGnN4RFNpQ6EMjbd" + ] + }, bsc: { owners: [ - "0xfc89c020774524c9d03bd5de48fec149b10bdec3" + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] }, btr: { @@ -41,92 +101,248 @@ module.exports = { }, cardano: { owners: [ - "addr1q99z92nxflfj0qz28ux8ctl85xcylhyaglfun9s57qfwr9jet4kdnjhzk34nxce5dnxx3jqmsjejtkkwkwn4s8tele9slecdqc" + "addr1q99z92nxflfj0qz28ux8ctl85xcylhyaglfun9s57qfwr9jet4kdnjhzk34nxce5dnxx3jqmsjejtkkwkwn4s8tele9slecdqc", + "addr1qxuw5n26eyewtuaf3mc7dj6akltr5ay3val9acuayj8thw05uvuw3anug2dzjs9m97dnqv2ff6q0dxxyd2qq9l5vdcas6nayyu" + ] + }, + celestia: { + owners: [ + "celestia1ny7sr4sehuhu3uyv53ln5qh4s6wd7dn5a276vy", + "celestia1xm7q4xv75udvq6y62jmhhjwjchnsrjadpz27km" ] }, celo: { owners: [ - "0xfc89c020774524c9d03bd5de48fec149b10bdec3" + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + chz: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] }, core: { owners: [ - "0xfc89c020774524c9d03bd5de48fec149b10bdec3" + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + cosmos: { + owners: [ + "cosmos1ny7sr4sehuhu3uyv53ln5qh4s6wd7dn5vq02kf", + "cosmos1xm7q4xv75udvq6y62jmhhjwjchnsrjadsgmwvk" ] }, cronos: { owners: [ - "0xfc89c020774524c9d03bd5de48fec149b10bdec3" + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] }, doge: { owners: [ - "DA9pxm6zPWCgjexGNcZkWS8JeoK4KMPE6d" + "DA9pxm6zPWCgjexGNcZkWS8JeoK4KMPE6d", + "DK7M1ThinVmj5quH5xGzwLTd8uGXXsZc8a" + ] + }, + era: { + owners: [ + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41", + "0xfc89c020774524c9d03bd5de48fec149b10bdec3" ] }, ethereum: { owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + ethereumclassic: { + owners: [ + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41", "0xfc89c020774524c9d03bd5de48fec149b10bdec3" ] }, + etlk: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + etn: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + filecoin: { + owners: [ + "f1rxaod45ofpdqy7aocoht4yvdj6d2knzb35x3xzi", + "f1n4cbfou3nn4tcbo62xuyumy5rec64lyvj2cajfy" + ] + }, + flare: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + hedera: { + owners: [ + "0.0.10892631", + "0.0.9763208" + ] + }, hyperliquid: { owners: [ - "0xfc89c020774524c9d03bd5de48fec149b10bdec3" + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + icp: { + owners: [ + "7915fb3bfd63b43776ca604e4a5c3bfff58711bddfe8136c0b2caae96302a859", + "48fbfaf3cbbcb8e5bb19f6e274ba649bc4bbecc95dc49e5cf1d6c997ac0e4017" ] }, injective: { owners: [ - "inj1xm7q4xv75udvq6y62jmhhjwjchnsrjad6pv27w" + "inj1xm7q4xv75udvq6y62jmhhjwjchnsrjad6pv27w", + "inj1ny7sr4sehuhu3uyv53ln5qh4s6wd7dn5xfcwy3" + ] + }, + iotex: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + kaspa: { + owners: [ + "kaspa:qq94l2yc6evkwt4mq08rrqctsdkptugmhpgkxhudm3xrc3lnvmg0v06wcmcpd", + "kaspa:qrhu6yvcvarqju46s0av348fz7yay2hrxf6jx27um20u3dvnqtedc6emtfx0n" ] }, klaytn: { owners: [ - "0xfc89c020774524c9d03bd5de48fec149b10bdec3" + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] }, linea: { owners: [ - "0xfc89c020774524c9d03bd5de48fec149b10bdec3" + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] }, litecoin: { owners: [ - "LQEggiUBAkYTTTTppAZVEh2Tysx381b3QV" + "LQEggiUBAkYTTTTppAZVEh2Tysx381b3QV", + "LZCCjR4uZk7VoeQqXWGjfbMnTyuWJF3JSE" + ] + }, + m: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] }, manta: { owners: [ - "0xfc89c020774524c9d03bd5de48fec149b10bdec3" + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] }, mantle: { owners: [ - "0xfc89c020774524c9d03bd5de48fec149b10bdec3" + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] }, metis: { owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + mina: { + owners: [ + "B62qkBzuZCqg1vUofQoSr37Lp3BqLJEhs7inreHrr54un2A8y8Eahia", + "B62qoAkzkZisjCJTgffevwGks3iiYG5nBjdFGbaHXAbmRcar7rXJuX2" + ] + }, + monad: { + owners: [ + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41", "0xfc89c020774524c9d03bd5de48fec149b10bdec3" ] }, near: { owners: [ - "679760352e80fca56d416fdbe8c9e060ed96a5a2c7b4bb5add51f99a08fd8afe" + "679760352e80fca56d416fdbe8c9e060ed96a5a2c7b4bb5add51f99a08fd8afe", + "c2566b91e059eb97e2acaa57fe1647db65970fe43f50a7264483d717737f2348" ] }, optimism: { owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + osmosis: { + owners: [ + "osmo1ny7sr4sehuhu3uyv53ln5qh4s6wd7dn5ymu6qm", + "osmo1xm7q4xv75udvq6y62jmhhjwjchnsrjadcng76y" + ] + }, + peaq: { + owners: [ + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41", "0xfc89c020774524c9d03bd5de48fec149b10bdec3" ] }, plasma: { owners: [ - "0xfc89c020774524c9d03bd5de48fec149b10bdec3" + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + plume_mainnet: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + polygon: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + proton: { + owners: [ + "guscold", + "gusdeposit" + ] + }, + qubic: { + owners: [ + "FXRFYJNWKTQBIBNKDVPCAQYUTWRACSMOIYLLITDTAAQAUDKBWGOCJYOGSHTD", + "WIITJAIUBLXZEABQDAZOZAZLSLDBCXVATXOMZSMYEHEVSDJBNNEWBXXEIUIB" ] }, ripple: { owners: [ - "rJY7ynx6h4wmC1H3HVHZ81vcToJ1j9enBz" + "rJY7ynx6h4wmC1H3HVHZ81vcToJ1j9enBz", + "r9bX9vyL3kANP859Y2NSs1ZFcifGmMp2Fv" + ] + }, + ronin: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] }, scroll: { @@ -141,37 +357,98 @@ module.exports = { }, solana: { owners: [ - "7yNsV3MhcvmqTfDsZ914JDPdepJCJYNm3JdEY92xEzQm" + "7yNsV3MhcvmqTfDsZ914JDPdepJCJYNm3JdEY92xEzQm", + "E5cXP9LM8phv6LKcw9zWqnZLWBsDepwWP4ATEN1wC6Mu" + ] + }, + somnia: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + sonic: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + stable: { + owners: [ + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41", + "0xfc89c020774524c9d03bd5de48fec149b10bdec3" ] }, stacks: { owners: [ - "SP3YDD4T7YJ07EREM250VHR9JGG5TW4HQGHC101N3" + "SP3YDD4T7YJ07EREM250VHR9JGG5TW4HQGHC101N3", + "SPNZMGDS12VK0AGRCFJK5FJ8ZWPHA46DDWS5GNZS" ] }, starknet: { owners: [ - "0x06960213b84246e9089da74b2445e10b7a82b9212bc2ff8b9a90517c62ab5178" + "0x06960213b84246e9089da74b2445e10b7a82b9212bc2ff8b9a90517c62ab5178", + "0x02f601712586bc40a6bedccc0b2224935aafb67eb813638fcabce24e260a2f21" ] }, stellar: { owners: [ - "GCOVMLCAKVDQEUNU56KP6XJGGLNLJVI5QSCHWL6WCRNHCZI3DPSK2JZY" + "GCOVMLCAKVDQEUNU56KP6XJGGLNLJVI5QSCHWL6WCRNHCZI3DPSK2JZY", + "GAZ6RKYG2S7PBFTEDKJFSQYDMGQVIMUMMHFIFG7VQXHQD6OM3ZGXLDEN" + ] + }, + stratis: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] }, sui: { owners: [ - "0x6dbd500f3960dc9c1bb2cfce193d052bae0ff38ac50e97351a557ee2f666d9a8" + "0x6dbd500f3960dc9c1bb2cfce193d052bae0ff38ac50e97351a557ee2f666d9a8", + "0x0b02c5294b3f65fedf35c3b30308247a5a34bcd033ded11c19915e8abe977c20" + ] + }, + tezos: { + owners: [ + "tz1extHNrsHrAgV54HnTdEuE1hQjWc4yZSSu", + "tz1cMdWDPgGWBb2xa23dY1XUYwN41EEtncTT" + ] + }, + thorchain: { + owners: [ + "thor1ny7sr4sehuhu3uyv53ln5qh4s6wd7dn528k3rk", + "thor1xm7q4xv75udvq6y62jmhhjwjchnsrjadk0z4ef" + ] + }, + ton: { + owners: [ + "EQDDJ4vPuZ-NTiKt7vaiUaTlzVxrLvhJUz8_NfJNHdjBrTCr", + "EQBwsKL2B_FzMrSLcDlKU0T1sXn9gZuGP_gdMkuMAvKnHjeO" ] }, tron: { owners: [ - "TYzWJUMfbiGKFdnmhS6sdJihvBDBwT1XdH" + "TYzWJUMfbiGKFdnmhS6sdJihvBDBwT1XdH", + "TWN5KTFojf1Gz6aBWqwyU5BCEZQvpLRNW5" + ] + }, + vana: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" + ] + }, + vechain: { + owners: [ + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] }, zeta: { owners: [ - "0xfc89c020774524c9d03bd5de48fec149b10bdec3" + "0xfc89c020774524c9d03bd5de48fec149b10bdec3", + "0xdfb5ab629e29afdd1cd2604fb6926d0ce5013f41" ] } } From 46a7957707b6ec65c28ecec16b5bab095e244b5e Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 30 Oct 2026 11:10:38 +0000 Subject: [PATCH 515/988] USDXR (#21933) --- projects/alpend/index.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/projects/alpend/index.js b/projects/alpend/index.js index 4a3593d458f..3f50e12cad4 100644 --- a/projects/alpend/index.js +++ b/projects/alpend/index.js @@ -8,6 +8,13 @@ const FETCH_OPTS = { headers: { 'User-Agent': 'DefiLlama-Adapter (alpend)' } } // genuinely dead feed (CCTools stopped polling), not a normal quiet period. const MAX_SOURCE_AGE_SECONDS = 24 * 60 * 60 +// CCTools aliases USDXLR's coingeckoId to usd-coin, which reports it as a USDC balance. coins +// prices it as canton:USDXLR off the Excellar reserve gate, so key these on the Canton instrument +// instead. Canton amounts are Daml Decimal (Numeric 10), so every instrument is scale 10 whatever +// its origin chain used; this must match coins/src/adapters/other/excellarUsdxlr.ts. +const CANTON_SCALE = 10 +const CANTON_PRICED = new Set(['USDXLR']) + function validateFeed(feed, caller) { if (!feed || !Array.isArray(feed.pools) || feed.pools.length === 0) throw new Error(`alpend: CCTools feed returned no pools (${caller})`) @@ -24,8 +31,16 @@ function validateFeed(feed, caller) { async function getPools(caller) { const feed = await get(TVL_URL, FETCH_OPTS) validateFeed(feed, caller) - // Newly listed assets (e.g. USDXLR) can appear before CCTools maps a coingecko id; skip them. - return feed.pools.filter(pool => pool.coingeckoId) + // Newly listed assets can appear before CCTools maps a coingecko id and before coins prices the + // instrument; skip them until one of the two can value them. + return feed.pools.filter(pool => pool.coingeckoId || CANTON_PRICED.has(pool.tokenId)) +} + +// addCGToken keys on the coingecko id and takes a scaled amount; a Canton instrument is keyed on +// this chain and so wants base units. +function addPool(api, pool, amount) { + if (CANTON_PRICED.has(pool.tokenId)) api.add(pool.tokenId, amount * 10 ** CANTON_SCALE) + else api.addCGToken(pool.coingeckoId, amount) } // Amounts are already decimal-adjusted; do not scale them again. @@ -46,13 +61,13 @@ async function tvl(api) { const available = getAmount(pool, 'totalSupplied') - getAmount(pool, 'totalBorrowed') if (available < 0) throw new Error(`alpend: borrowed exceeds supplied for ${pool.asset}`) - api.addCGToken(pool.coingeckoId, available) + addPool(api, pool, available) } } async function borrowed(api) { for (const pool of await getPools('borrowed')) - api.addCGToken(pool.coingeckoId, getAmount(pool, 'totalBorrowed')) + addPool(api, pool, getAmount(pool, 'totalBorrowed')) } module.exports = { From 449caf0b242ab4c02c05bcd44d0c3d867928db5c Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Fri, 30 Oct 2026 12:14:28 +0100 Subject: [PATCH 516/988] pancakeswap-infinity: add robinhood and arc (#21929) Co-authored-by: FelixBruguera --- projects/pancakeswap-infinity/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/pancakeswap-infinity/index.js b/projects/pancakeswap-infinity/index.js index 9f110cdad25..ff4c8c82ee9 100644 --- a/projects/pancakeswap-infinity/index.js +++ b/projects/pancakeswap-infinity/index.js @@ -6,6 +6,8 @@ const { sliceIntoChunks } = require('../helper/utils'); const config = { bsc: { vault: '0x238a358808379702088667322f80ac48bad5e6c4', clPoolManager: '0xa0ffb9c1ce1fe56963b0321b32e7a0302114058b', fromBlock: 47214308 }, base: { vault: '0x238a358808379702088667322f80ac48bad5e6c4', clPoolManager: '0xa0ffb9c1ce1fe56963b0321b32e7a0302114058b', fromBlock: 30544106 }, + robinhood: { vault: '0x4f922d5b15e6691e0469663e4f5c4177f23c5faf', clPoolManager: '0xee04c68742e6bf434be8039580d2e89bbe55bc6f', fromBlock: 56743018 }, + arc: { vault: '0x238a358808379702088667322f80aC48bAd5e6c4', clPoolManager: '0xa0FfB9c1CE1Fe56963B0321B32E7A0302114058b', fromBlock: 21197799 }, } const blacklistTokens = [ From e10c7798deab30f6fb8d450dfee58b25e0569023 Mon Sep 17 00:00:00 2001 From: packedcc Date: Fri, 30 Oct 2026 13:18:26 +0200 Subject: [PATCH 517/988] [update] packed - treasury: add the fee Safe on Ethereum (#21928) --- projects/treasury/packed.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/projects/treasury/packed.js b/projects/treasury/packed.js index 1ed0adc50e6..d5f0e95d6d4 100644 --- a/projects/treasury/packed.js +++ b/projects/treasury/packed.js @@ -1,12 +1,17 @@ const { nullAddress, treasuryExports } = require('../helper/treasury') -// Packed (packd.cc) keeps its fee income in one wallet, the same address on both chains. Every -// Packed factory pays its launch fee and protocol share there: protocolFeeRecipient() on the -// Robinhood Chain factories, and the fee recipient of the Ethereum factories. +// Packed (packd.cc) keeps its fee income in a fee wallet, the same address on both chains. Every +// Robinhood Chain factory and the older Ethereum factories pay their launch fee and protocol share +// there (protocolFeeRecipient()). // https://robinhoodchain.blockscout.com/address/0x71BB2cc5Be1599AaCD36080321f1b781a46fD1d9 // https://etherscan.io/address/0x71BB2cc5Be1599AaCD36080321f1b781a46fD1d9 const FEE_WALLET = '0x71BB2cc5Be1599AaCD36080321f1b781a46fD1d9' +// The newest Ethereum factory (0xA5fB8E98aedb2ab59a61971a6956399dF8059511) pays them to a 2-of-3 +// Safe instead; its protocolFeeRecipient() answers this address. Ethereum only. +// https://etherscan.io/address/0xbCa2BE8461f1681C73b44E499611c2F6fA9fAF29 +const FEE_SAFE_ETHEREUM = '0xbCa2BE8461f1681C73b44E499611c2F6fA9fAF29' + // $PACKD, Packed's own token on Robinhood Chain. The fee wallet buys it back and burns it, so it // is reported as own tokens, never as treasury. // https://robinhoodchain.blockscout.com/token/0x853E1A36876Cc4538BE636B78E7b2BD0aABC0dEd @@ -18,10 +23,11 @@ module.exports = treasuryExports({ tokens: [nullAddress], ownTokens: [PACKD], }, - // Only ETH is read on Ethereum: the wallet's other tokens there are the launched coins' side of - // pool fees, which have no price, and token discovery on this chain needs a paid API key. + // Only ETH is read on Ethereum: the wallets' other tokens there are the launched coins' side of + // pool fees, which have no price, and token discovery on this chain needs a paid API key. The + // two owners are different addresses, so no balance is read twice. ethereum: { - owners: [FEE_WALLET], + owners: [FEE_WALLET, FEE_SAFE_ETHEREUM], tokens: [nullAddress], fetchCoValentTokens: false, }, From f3c66f9b2b09f943fc4c7449fa1f20cea9be0b34 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 30 Oct 2026 09:55:53 -0400 Subject: [PATCH 518/988] Add missing addresses to Hotcoin (#21934) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- cex/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cex/index.js b/cex/index.js index 71e5ad8c334..a4fd060f7ff 100644 --- a/cex/index.js +++ b/cex/index.js @@ -1390,6 +1390,7 @@ const configs = { owners: [ "0x10b620f9720C0c6460484A81C59a6297Fa48F817", "0xbB916e1E722f69d9fdFE6805f3dEDD51353f8E55", + "0xce648A7c1Dd3DaBC9CD2f87C93986A98608F1eEF", "0x5B5627C9686c5744534C8aa7d9C312DA88794b8E" ] }, @@ -1397,7 +1398,8 @@ const configs = { owners: [ "TDZu7rwKeMrcXQRfmzA2fQUb1bCYUoJfPw", "TDVBTADNXp7PuLLXdHyLn1v96Q2Kx1GKYE", - "TXNUMHHvazAEPyjECzAqVrnCwJV559ijYv" + "TXNUMHHvazAEPyjECzAqVrnCwJV559ijYv", + "TQ462aQGdVTQ4YYME9AK9QD4osYsnrSX53", ] }, bitcoin: "hotcoin", @@ -1431,10 +1433,21 @@ const configs = { "0x72a73dC55a7038cb4707F2a23aC2AE705A8Fa888" ] }, + aptos: { + owners: [ + "0xf88e0088e6d25533b81e792fe35ddfab29b6b8d736e06f4f839963fbaab13d9b" + ] + }, + sui: { + owners: [ + "0x4e6b8fc3f0f9729488cc2ded8ab2783402d90ca3820f951ab612a5ec3d568025" + ] + }, bsc: { owners: [ "0xa1ab382330d6b7a99ee3441e6594e49790294e4e", "0xDCd7eFd91A6afD14168352023fCC8939601ea0bc", + "0xce648A7c1Dd3DaBC9CD2f87C93986A98608F1eEF", "0x6EDA9105761B840F9D24d34Ab1dC28629EcC35fd" ] } From fc69978d46d59064f5e310797bc7b2aff42c24a3 Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 10:18:03 -0400 Subject: [PATCH 519/988] fix: preserve ParaSpace V1 historical balance blocks (#21930) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/paraspace/helper/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/paraspace/helper/index.js b/projects/paraspace/helper/index.js index 83b8c975bda..c64d8ab379e 100644 --- a/projects/paraspace/helper/index.js +++ b/projects/paraspace/helper/index.js @@ -25,7 +25,7 @@ async function tvl(api) { if (api.chain === "ethereum") { toa.push(...[[Bayc, P2PPairStaking], [Mayc, P2PPairStaking], [Bakc, P2PPairStaking]]) } - return sumTokens2({ chain: api.chain, balances, tokensAndOwners: toa, blacklistedTokens: [ADDRESSES.linea.WETH_1, address.ethereum.cAPE] }) + return sumTokens2({ chain: api.chain, api, balances, tokensAndOwners: toa, blacklistedTokens: [ADDRESSES.linea.WETH_1, address.ethereum.cAPE] }) } async function borrowed(api) { From 7a8d3953035f199386c75ee36b31087dda9057f4 Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 14:08:19 -0400 Subject: [PATCH 520/988] fix(datamine): normalize hallmark to a date string (#21937) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- registries/sumTokens/data2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registries/sumTokens/data2.js b/registries/sumTokens/data2.js index 37bded799f6..cc992b51e51 100644 --- a/registries/sumTokens/data2.js +++ b/registries/sumTokens/data2.js @@ -596,7 +596,7 @@ module.exports = { }, "datamine": { "methodology": "Pool2 counts all the permanent liquidity in LOCK/WETH Uniswap v2 pool. Staking counts all the tokens locked-in to mint FLUX/ArbiFLUX/LOCK", - "hallmarks": [[1727644318, "Lockquidity Launch"]], + "hallmarks": [["2024-09-29", "Lockquidity Launch"]], "ethereum": { "tvl": { "__empty": true }, "staking": { From 0cf25a6a6c690ba4effe583cd39521a1d6d06272 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 30 Oct 2026 14:45:42 -0400 Subject: [PATCH 521/988] Add Deuro v3 positions and bridge collateral (#21938) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/dEURO/index.js | 42 +++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/projects/dEURO/index.js b/projects/dEURO/index.js index d525a59aa4e..c5d1d80535a 100644 --- a/projects/dEURO/index.js +++ b/projects/dEURO/index.js @@ -9,16 +9,38 @@ const MAINNET = { nDEPS: "0xc71104001A3CCDA1BEf1177d765831Bd1bfE8eE6", }; -async function tvl(api) { - const logs = await getLogs2({ - api, - target: '0x8B3c41c649B9c7085C171CbB82337889b3604618', - fromBlock: 22088283, - eventAbi: 'event PositionOpened (address indexed owner, address indexed position, address original, address collateral)', - onlyArgs: true, - }); +const MINTING_HUBS = [ + ['0x8B3c41c649B9c7085C171CbB82337889b3604618', 22088283], + ['0x66AcC54a0C64255137b8993CB4972B0901684f7B', 24721297], +]; + +const BRIDGES = [ + ['0xC581b735A1688071A1746c968e0798D642EDE491', '0x2353D16869F717BFCD22DaBc0ADbf4Dca62C609f', 22088283], + ['0xdb25f211ab05b1c97d595516f45794528a807ad8', '0x73f38ca06b27eaefb1612d062d885f58924f5897', 23836394], + ['0x6ba75d640bebfe5da1197bb5a2aff3327789b5d3', '0x76d8f514554a4a8e5d6103875f2dd7a67543692b', 23836578], + ['0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c', '0xB4fF7412f08C22d7381885e8BdA9EE9825092fd1', 23404702], + ['0x50753CfAf86c094925Bf976f218D043f8791e408', '0x20B0a153fF16c7B1e962FD3D3352A00cf019f1a7', 22327569], + ['0x888883b5F5D21fb10Dfeb70e8f9722B9FB0E5E51', '0x3EF3d03EFCc1338d6210946f8cF5Fb1a8b630341', 22327501], + ['0x9d1A7A3191102e9F900Faa10540837ba84dCBAE7', '0xb66A40934a996373fA7602de9820C6bf3e8c9afE', 22327631], + ['0x3231Cb76718CDeF2155FC47b5286d82e6eDA273f', '0x4dfd460d54854087af195906a2f260aa483a13b1', 23836465], + ['0x1a7e4e63778b4f12a199c062f3efdd288afcbce8', '0x05620F4bB92246b4e067EBC0B6f5c7FF6B771702', 22939705], +]; - const tokensAndOwners = logs.map(log => [log.collateral.toLowerCase(), log.position]); +async function tvl(api) { + const block = await api.getBlock(); + const tokensAndOwners = []; + for (const [target, fromBlock] of MINTING_HUBS) { + if (block < fromBlock) continue; + const logs = await getLogs2({ + api, + target, + fromBlock, + eventAbi: 'event PositionOpened (address indexed owner, address indexed position, address original, address collateral)', + onlyArgs: true, + }); + tokensAndOwners.push(...logs.map(log => [log.collateral.toLowerCase(), log.position])); + } + tokensAndOwners.push(...BRIDGES.filter(([, , fromBlock]) => block >= fromBlock).map(([token, owner]) => [token, owner])); await sumTokens2({ api, tokensAndOwners }); @@ -38,4 +60,4 @@ module.exports = { methodology: "TVL consists of collateral tokens in the positions and source stablecoins in the bridge contracts", ethereum: { tvl }, start: '2025-03-20' -}; \ No newline at end of file +}; From 1c65ac584661afa81a327ebdce54963e7d88ff58 Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 15:42:21 -0400 Subject: [PATCH 522/988] fix: count Midas Capital Polygon pool only once (#21939) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- registries/compound.js | 1 - 1 file changed, 1 deletion(-) diff --git a/registries/compound.js b/registries/compound.js index 70e5ab71616..74fb9f85633 100644 --- a/registries/compound.js +++ b/registries/compound.js @@ -627,7 +627,6 @@ const configs = { { comptroller: '0xB08A309eFBFFa41f36A06b2D0C9a4629749b17a2' }, { comptroller: '0xBd82D36B9CDfB9747aA12025CeCE3782EDe767FE' }, { comptroller: '0xF1ABd146B4620D2AE67F34EA39532367F73bbbd2' }, - { comptroller: '0xBd82D36B9CDfB9747aA12025CeCE3782EDe767FE' }, { comptroller: '0x59013D8a77D656777329D74ea1C88DA796005F1B' }, ], arbitrum: [ From 9efaefc9ce4e466cb2e7aba170d9f0b8419506aa Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 30 Oct 2026 21:23:06 +0100 Subject: [PATCH 523/988] fix broken --- projects/factor-leverage-vault/index.js | 4 +++- projects/helper/env.js | 1 + projects/helper/rujira/balances.js | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/factor-leverage-vault/index.js b/projects/factor-leverage-vault/index.js index 0096ec67d15..bab629f4b60 100644 --- a/projects/factor-leverage-vault/index.js +++ b/projects/factor-leverage-vault/index.js @@ -42,6 +42,7 @@ async function tvl(api) { fromBlock: 112324705, eventAbi: 'event PositionCreated(uint256 indexed id, address indexed vault)', onlyArgs: true, + onlyUseExistingCache: true, })))).flat() const positions = logs.map(log => log.vault) @@ -51,10 +52,11 @@ async function tvl(api) { api.multiCall({ abi: 'address:asset', calls: positions }), api.multiCall({ abi: 'uint256:assetBalance', calls: positions }), api.multiCall({ abi: 'address:debtToken', calls: positions }), - api.multiCall({ abi: 'uint256:debtBalance', calls: positions }), + api.multiCall({ abi: 'uint256:debtBalance', calls: positions, permitFailure: true }), ]) positions.forEach((_, index) => { + if (debtBalances[index] === undefined) return; api.add(assetTokens[index], assetBalances[index]) api.add(debtTokens[index], negate(debtBalances[index])) }) diff --git a/projects/helper/env.js b/projects/helper/env.js index 0c820bfe023..7b44b3b5e28 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -88,6 +88,7 @@ const DEFAULTS = { BCYPHER_RPC: 'https://mainapi.bchscan.io', // BC Hyper Chain, chainId 3030 // p2p/everstake neon proxies are gone (dns), thirdweb refuses the chain; blockscout's eth-rpc proxy still serves it NEON_EVM_RPC: 'https://neon.blockscout.com/api/eth-rpc', + ETN_RPC: 'https://blockexplorer.electroneum.com/api/eth-rpc', THORCHAIN_LCD: 'https://gateway.liquify.com/chain/thorchain_api', INITIA_LCD: 'https://rest.initia.xyz', // mainnet.telos.net/evm now serves a 404 or an HTML page with HTTP 200, which the sdk treats as a successful call with a null result; rpc1.eu.telos.net hangs diff --git a/projects/helper/rujira/balances.js b/projects/helper/rujira/balances.js index 79c4cbf85bf..59bee7ffd7b 100644 --- a/projects/helper/rujira/balances.js +++ b/projects/helper/rujira/balances.js @@ -20,6 +20,7 @@ const DENOM_TO_COINGECKO = { 'avax-avax': 'avalanche-2', 'bsc-bnb': 'binancecoin', 'tron-trx': 'tron', + 'zec-zec': 'zcash', } function parseDecimal(value) { From 5fe086b80055d681f4f6be09490fe079673c782a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 30 Oct 2026 21:51:22 +0100 Subject: [PATCH 524/988] use token label --- cex/bybit.js | 5 +++-- projects/agdex/index.js | 2 +- projects/colorpool/index.js | 3 ++- projects/helper/cex.js | 2 +- projects/koo/index.js | 3 ++- projects/kucoin/index.js | 3 ++- projects/lucid-labs/index.js | 24 ++++++++++----------- projects/maple/index.js | 4 ++-- projects/overcall/index.js | 3 ++- projects/seeryx/index.js | 3 ++- projects/treasury/overcall.js | 3 ++- projects/valantis-sthype-restaking/index.js | 3 ++- registries/sumTokens/data1.js | 16 +++++++------- registries/sumTokens/data3.js | 22 +++++++++---------- 14 files changed, 52 insertions(+), 44 deletions(-) diff --git a/cex/bybit.js b/cex/bybit.js index 59fd29b0d67..8ec6d3f917c 100644 --- a/cex/bybit.js +++ b/cex/bybit.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../projects/helper/coreAssets.json') const axios = require('axios') const sdk = require('@defillama/sdk') const { getConfig } = require('../projects/helper/cache') @@ -103,13 +104,13 @@ function mergeOwners(slug, ...lists) { // Chains whose PoR balance sits in a token that has no default list in helper/cex.js const EXTRA_TOKENS = { - berachain: ['0x0000000000000000000000000000000000000000', '0x779Ded0c9e1022225f8E0630b35a9b54bE713736'], // BERA, USDT0 + berachain: [ADDRESSES.null, ADDRESSES.xlayer.USDT0], // BERA, USDT0 } // MNT, reported under ownTokens instead of tvl const OWN_TOKENS = { ethereum: ['0x3c3a81e81dc49A522A592e7622A7E711c06bf354'], - mantle: ['0x0000000000000000000000000000000000000000'], + mantle: [ADDRESSES.null], } module.exports = { bitcoin: 'bybit' } diff --git a/projects/agdex/index.js b/projects/agdex/index.js index bb146ebcb21..eed9b74fc24 100644 --- a/projects/agdex/index.js +++ b/projects/agdex/index.js @@ -13,7 +13,7 @@ const markets = [ { resourceAccount: "0xbb3c1b88599c563062e2b08fe3a92ab048d700f9aa44617c680d59a4aa69b23f", metadata: ADDRESSES.aptos.USDt, vault: `${AGDEX}::token_map::USDT`, token: ADDRESSES.aptos.USDT_2 }, { resourceAccount: "0x38bca0c288df1e13d9a30d33c4ce8ee778333c52bd4e730b49c6c9379be39b10", metadata: "0xae02f68520afd221a5cd6fda6f5500afedab8d0a2e19a916d6d8bc2b36e758db", vault: `${LZ_ASSETS}::WETH`, token: ADDRESSES.aptos.zWETH }, { resourceAccount: "0x70d303ed5dbfbae1f5ac76d50d5073f69a7115dfdfa737e82bb7c3c9364b3d17", metadata: "0xa64d2d6f5e26daf6a3552f51d4110343b1a8c8046d0a9e72fa4086a337f3236c", vault: `${LZ_ASSETS}::WBTC`, token: ADDRESSES.aptos.zWBTC }, - { resourceAccount: "0x8afc7aaa4616c0defbe655f3928a72ff849ef9a6889178f1c18c7c3ad006ebf7", metadata: "0xa", vault: "0x1::aptos_coin::AptosCoin", token: ADDRESSES.aptos.APT }, + { resourceAccount: "0x8afc7aaa4616c0defbe655f3928a72ff849ef9a6889178f1c18c7c3ad006ebf7", metadata: "0xa", vault: ADDRESSES.aptos.APT, token: ADDRESSES.aptos.APT }, ] async function tvl(api) { diff --git a/projects/colorpool/index.js b/projects/colorpool/index.js index 97fce276b67..622724e82de 100644 --- a/projects/colorpool/index.js +++ b/projects/colorpool/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { get } = require("../helper/http") // Colorpool dex chain on Chromia; node list and RID from the dex.colorpool.xyz app config @@ -12,7 +13,7 @@ const NODES = [ // tokens the coins server prices as chromia: const PRICED = new Set([ '5f16d1545a0881f971b164f1601cbbf51c29efd0633b2730da18c403c3b428b5', // CHR - '9bacd576f40b6674aa76b8bfa1330077a3b94f581bfdb2ef806122c384dcdf25', // USDC + ADDRESSES.chromia.USDC, // USDC '9084de203ef2afc7c6bfd647660aa3265d3b9ef1105139077ed3c81b26e2976e', // ALICE 'd85153c53bc78c6bf177113c5da873669f97bd46db1ab7411e2f8932c7cdd0a8', // D ]) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 435d1f6ef07..9f0b1cc9482 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -278,7 +278,7 @@ const defaultTokens = { "0x6FDcdfef7c496407cCb0cEC90f9C5Aaa1Cc8D888", // VET "0xfb6115445Bff7b52FeB98650C87f44907E58f802", // AAVE "0x62d0a8458ed7719fdaf978fe5929c6d342b0bfce", // BEAM - "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", // CAKE + ADDRESSES.bsc.CAKE, // CAKE "0x0D8Ce2A99Bb6e3B7Db580eD848240e4a0F9aE153", // FIL "0x43C934A845205F0b514417d757d7235B8f53f1B9", // XLM "0x1Ba42e5193dfA8B03D15dd1B86a3113bbBEF8Eeb", // ZEC diff --git a/projects/koo/index.js b/projects/koo/index.js index 11a58dd62b8..ce51ff43a96 100644 --- a/projects/koo/index.js +++ b/projects/koo/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') // Production protocol: https://app.koo.xyz/ and https://docs.koo.xyz/earn/yield-bearing-usdc const { sumTokens2 } = require('../helper/unwrapLPs') const CORE = '0xA18b67e194d4f4bADe61d4e68cd135C63C438D1d' -const USDC = '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' +const USDC = ADDRESSES.arbitrum.USDC_CIRCLE // Both receipt balances are denominated in six-decimal underlying USDC units. const aArbUSDCn = '0x724dc807b04555b71ed48a6896b6f41593b8c637' const compoundUSDC = '0x9c4ec768c28520b50860ea7a15bd7213a9ff58bf' diff --git a/projects/kucoin/index.js b/projects/kucoin/index.js index bf2b77e00bf..98aadc0b61c 100644 --- a/projects/kucoin/index.js +++ b/projects/kucoin/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { cexExports } = require("../helper/cex"); const bitcoinAddressBook = require("../helper/bitcoin-book/index.js"); const { mergeExports, getStakedEthTVL } = require("../helper/utils"); @@ -133,7 +134,7 @@ const config = { ], }, kcc: { - ownTokens: ['0x0000000000000000000000000000000000000000'], // KCS (native) + ownTokens: [ADDRESSES.null], // KCS (native) owners: [ "0x14ea40648fc8c1781d19363f5b9cc9a877ac2469", "0x2a8c8b09bd77c13980495a959b26c1305166a57f", diff --git a/projects/lucid-labs/index.js b/projects/lucid-labs/index.js index 13cc09e77f2..7da7753feaa 100644 --- a/projects/lucid-labs/index.js +++ b/projects/lucid-labs/index.js @@ -6,34 +6,34 @@ const ADDRESSES = require('../helper/coreAssets.json') const config = { arbitrum: [ // L-USDC controller - ['0xaf88d065e77c8cC2239327C5EDb3A432268e5831', '0x3c3DC44fABc3a516E6A329734aEE36dA49F3BA21'], + [ADDRESSES.arbitrum.USDC_CIRCLE, '0x3c3DC44fABc3a516E6A329734aEE36dA49F3BA21'], ], optimism: [ // L-USDT controller - ['0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', '0x35Be3fa7e22B7FD7051248974cC44Bf88b8c5cc2'], + [ADDRESSES.optimism.USDT, '0x35Be3fa7e22B7FD7051248974cC44Bf88b8c5cc2'], // MANTRA USDT controller - ['0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', '0x0569725992ee675f862bf0d25CA40fCfB2B69d6E'], + [ADDRESSES.optimism.USDT, '0x0569725992ee675f862bf0d25CA40fCfB2B69d6E'], ], avax: [ // KiteAI USDC and WETH controllers - ['0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', '0x7144ADe61f4BEcD513658db3441a0CE286aE90fd'], - ['0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB', '0x1324Be9339e1618387d2405C6f4CE660447cB582'], + [ADDRESSES.avax.USDC, '0x7144ADe61f4BEcD513658db3441a0CE286aE90fd'], + [ADDRESSES.avax.WETH_e, '0x1324Be9339e1618387d2405C6f4CE660447cB582'], ], celo: [ // KiteAI USDT controller - ['0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e', '0xc620C68Cb63EA35e9930e240051A6A7C02D568A1'], + [ADDRESSES.celo.USDT_1, '0xc620C68Cb63EA35e9930e240051A6A7C02D568A1'], ], base: [ // MANTRA USDC and WETH controllers - ['0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', '0xFf54162d7061290A966119784a0F34663d00E190'], - ['0x4200000000000000000000000000000000000006', '0x47263861BD8E964425910FAA0870e9d0fb630876'], + [ADDRESSES.base.USDC, '0xFf54162d7061290A966119784a0F34663d00E190'], + [ADDRESSES.optimism.WETH_1, '0x47263861BD8E964425910FAA0870e9d0fb630876'], ], ethereum: [ // RedBelly USDC.e, USDT, WETH, WBTC controllers - ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0x3b55a4C0691d4D62719D0BFaA435010fBF2F135f'], - ['0xdAC17F958D2ee523a2206206994597C13D831ec7', '0x4f65f6e8B436289513b5F3ce96B2D2f032fc207C'], - ['0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0xc0FCe0c5cdbbA2D7f7212F3C726b05d5d1b6cf0E'], - ['0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', '0x530d8C1fC48fa4b61Ac755be3bB3CbdCAcd20be9'], + [ADDRESSES.ethereum.USDC, '0x3b55a4C0691d4D62719D0BFaA435010fBF2F135f'], + [ADDRESSES.ethereum.USDT, '0x4f65f6e8B436289513b5F3ce96B2D2f032fc207C'], + [ADDRESSES.ethereum.WETH, '0xc0FCe0c5cdbbA2D7f7212F3C726b05d5d1b6cf0E'], + [ADDRESSES.ethereum.WBTC, '0x530d8C1fC48fa4b61Ac755be3bB3CbdCAcd20be9'], ], } diff --git a/projects/maple/index.js b/projects/maple/index.js index 48aa7cfc399..68986d25e46 100644 --- a/projects/maple/index.js +++ b/projects/maple/index.js @@ -29,7 +29,7 @@ const COLLATERALS = { XRP: { chain: 'ripple', token: ADDRESSES.ripple.XRP }, HYPE: { chain: 'hyperliquid', cgId: 'hyperliquid' }, SOL: { chain: 'solana', token: ADDRESSES.solana.SOL }, - jitoSOL: { chain: 'solana', token: 'J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn' }, + jitoSOL: { chain: 'solana', token: ADDRESSES.solana.JitoSOL }, ETH: { chain: 'ethereum', token: ADDRESSES.null }, WBTC: { chain: 'ethereum', token: ADDRESSES.ethereum.WBTC }, LBTC: { chain: 'ethereum', token: ADDRESSES.ethereum.LBTC }, @@ -40,7 +40,7 @@ const COLLATERALS = { USDT: { chain: 'ethereum', token: ADDRESSES.ethereum.USDT }, USTB: { chain: 'ethereum', token: '0x43415eB6ff9DB7E26A15b704e7A3eDCe97d31C4e' }, USDtb: { chain: 'ethereum', token: '0xC139190F447e929f090Edeb554D95AbB8b18aC1C' }, - weETH: { chain: 'ethereum', token: '0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee' }, + weETH: { chain: 'ethereum', token: ADDRESSES.ethereum.WEETH }, tETH: { chain: 'ethereum', token: '0xD11c452fc99cF405034ee446803b6F6c1F6d5ED8' }, USR: { chain: 'ethereum', token: '0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110' }, ATH: { chain: 'ethereum', token: '0xbe0Ed4138121EcFC5c0E56B40517da27E6c5226B' }, diff --git a/projects/overcall/index.js b/projects/overcall/index.js index 7678b372577..5f6dfdbaeb5 100644 --- a/projects/overcall/index.js +++ b/projects/overcall/index.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') const OVER = '0x6245Db7f52379bD9757c9DdcE6519768FfaB3a4F' // the protocol's own token -const USDG = '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168' +const USDG = ADDRESSES.robinhood.USDG const OVER_STAKING = '0x2165E659406F6B4F122F10A540B634252249b306' const OVER_VAULT = '0xFB4C6062c24313E2E8Cf01D1CCBa0B940e7b29f6' const USDG_VAULT = '0x526b07940694f599aA2e9DbDE30540BE004aC80e' diff --git a/projects/seeryx/index.js b/projects/seeryx/index.js index 498158282f6..ece636c2dbb 100644 --- a/projects/seeryx/index.js +++ b/projects/seeryx/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') // Seeryx TVL adapter for DefiLlama (projects/seeryx/index.js). // // Seeryx is a prediction market on Solana: Up/Down crypto rounds and event markets resolved by UMA. Users' USDC @@ -9,7 +10,7 @@ const { PublicKey } = require("@solana/web3.js"); const { getConnection, sumTokens2, getAssociatedTokenAddress } = require("../helper/solana"); const PROGRAM_ID = "2uUbvYHqBH1HDVzABGPcqrjHodoBVcNkq6Nrv6MABaiv"; -const USDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; +const USDC = ADDRESSES.solana.USDC; // Anchor account discriminators, sha256("account:")[0..8] const DISCRIMINATORS = [ diff --git a/projects/treasury/overcall.js b/projects/treasury/overcall.js index 78f1a52fbfc..3868ed718d1 100644 --- a/projects/treasury/overcall.js +++ b/projects/treasury/overcall.js @@ -1,9 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress } = require('../helper/sumTokens') const RESERVE = '0x437bCF676D11FFE5542BfAa842b560e431285065' // the $OVER reserve wallet (100M of the 150M vault liquidity) const OVER = '0x6245Db7f52379bD9757c9DdcE6519768FfaB3a4F' const OVER_VAULT = '0xFB4C6062c24313E2E8Cf01D1CCBa0B940e7b29f6' -const USDG = '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168' +const USDG = ADDRESSES.robinhood.USDG const USDG_VAULT = '0x526b07940694f599aA2e9DbDE30540BE004aC80e' const VAULTS_DEPLOYED = 1792452600 // 2026-10-19 23:30 UTC, after both vaults were deployed (block 93002929) diff --git a/projects/valantis-sthype-restaking/index.js b/projects/valantis-sthype-restaking/index.js index 5eeff208bfe..3c6f4cdaa4c 100644 --- a/projects/valantis-sthype-restaking/index.js +++ b/projects/valantis-sthype-restaking/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const STHYPE = '0xfFaa4a3D97fE9107Cef8a3F48c069F577Ff76cC1' const ESCROW = '0x0447d0339c82a8EFe01994b7D1981bf5c517da0e' -const SEED_OWNER = '0x0000000000000000000000000000000000000001' +const SEED_OWNER = ADDRESSES.linea.WETH_1 const ESCROW_DEPLOY_BLOCK = 47206861 async function tvl(api) { diff --git a/registries/sumTokens/data1.js b/registries/sumTokens/data1.js index bf65a144d2a..8bae3ab0e4d 100644 --- a/registries/sumTokens/data1.js +++ b/registries/sumTokens/data1.js @@ -1187,19 +1187,19 @@ module.exports = { "sapphire": { "ownerTokens": [ [["0x3cabbe76ea8b4e7a2c0a69812cbe671800379ec8", "0xed57966f1566de1a90042d07403021ea52ad4724"], "0x09eebb65a41cc45543e596ce1dc10d071265ad04"], - [["0x6665a6cae3f52959f0f653e3d04270d54e6f13d8", "0x8bc2b030b299964eefb5e1e0b36991352e56d2d3"], "0x2c47941cfdf58d2f9a9490d84fadecc284d63b0a"], - [["0x8bc2b030b299964eefb5e1e0b36991352e56d2d3", "0x97eec1c29f745dc7c267f90292aa663d997a601d"], "0x3a2976b76b9af12639878b87b4ccef2e951ca5aa"], - [["0x8bc2b030b299964eefb5e1e0b36991352e56d2d3", "0xa14167756d9f86aed12b472c29b257bbdd9974c2"], "0x419fe2b60f0ea02051b073b71f2326550d371f94"], - [["0x8bc2b030b299964eefb5e1e0b36991352e56d2d3", "0x932dd32885eee8dccdb8e0475cf2e9bfc8527f9d"], "0x6cdcf811073b358031239e3792aefcdd875498b0"], + [["0x6665a6cae3f52959f0f653e3d04270d54e6f13d8", ADDRESSES.sapphire.ROSE], "0x2c47941cfdf58d2f9a9490d84fadecc284d63b0a"], + [[ADDRESSES.sapphire.ROSE, "0x97eec1c29f745dc7c267f90292aa663d997a601d"], "0x3a2976b76b9af12639878b87b4ccef2e951ca5aa"], + [[ADDRESSES.sapphire.ROSE, "0xa14167756d9f86aed12b472c29b257bbdd9974c2"], "0x419fe2b60f0ea02051b073b71f2326550d371f94"], + [[ADDRESSES.sapphire.ROSE, "0x932dd32885eee8dccdb8e0475cf2e9bfc8527f9d"], "0x6cdcf811073b358031239e3792aefcdd875498b0"], [["0xa14167756d9f86aed12b472c29b257bbdd9974c2", "0xdd629e5241cbc5919847783e6c96b2de4754e438"], "0x85955d332de1ce53393f4dc6e3f0bb9d95436e56"], [["0x2f301d3b045544a9d7ec3fa090cd78986f11f2e7", "0x3cabbe76ea8b4e7a2c0a69812cbe671800379ec8"], "0x9b62a385c488b5c088cb9ade548f18e3953d5581"], - [["0x8bc2b030b299964eefb5e1e0b36991352e56d2d3", "0xe4ea254e07c3403fc67ece108fb5eb039a246231"], "0xa0f83725a5a86e81992134ebdf6e7e4f2ff47886"], + [[ADDRESSES.sapphire.ROSE, "0xe4ea254e07c3403fc67ece108fb5eb039a246231"], "0xa0f83725a5a86e81992134ebdf6e7e4f2ff47886"], [["0x932dd32885eee8dccdb8e0475cf2e9bfc8527f9d", "0x97eec1c29f745dc7c267f90292aa663d997a601d"], "0xb4f45dd65046aeeee0ec56df60074b5d1c89f067"], [["0x8c4acd74ff4385f3b7911432fa6787aa14406f8b", "0x97eec1c29f745dc7c267f90292aa663d997a601d"], "0xbeb97bcda42c8de9e24fe7dfb0397dd4b069ddc3"], - [["0x3cabbe76ea8b4e7a2c0a69812cbe671800379ec8", "0x8bc2b030b299964eefb5e1e0b36991352e56d2d3"], "0xda6b7b88f5c659b08df37e6daf043d52b985e8ff"], - [["0x8bc2b030b299964eefb5e1e0b36991352e56d2d3", "0xb6dc6c8b71e88642cead3be1025565a9ee74d1c6"], "0xeafb04b5d4fb753c32dbb2ec32b3bf7cdc7f5144"], + [["0x3cabbe76ea8b4e7a2c0a69812cbe671800379ec8", ADDRESSES.sapphire.ROSE], "0xda6b7b88f5c659b08df37e6daf043d52b985e8ff"], + [[ADDRESSES.sapphire.ROSE, ADDRESSES.matchain.USDT], "0xeafb04b5d4fb753c32dbb2ec32b3bf7cdc7f5144"], [["0x3cabbe76ea8b4e7a2c0a69812cbe671800379ec8", "0xa14167756d9f86aed12b472c29b257bbdd9974c2"], "0xeb941037f8aa4ce8680666b8af62dd88b2227da2"], - [["0x8bc2b030b299964eefb5e1e0b36991352e56d2d3", "0x8c4acd74ff4385f3b7911432fa6787aa14406f8b"], "0xee91352a9aba9ae2ce677545ef138a9759e50629"], + [[ADDRESSES.sapphire.ROSE, "0x8c4acd74ff4385f3b7911432fa6787aa14406f8b"], "0xee91352a9aba9ae2ce677545ef138a9759e50629"], [["0x3cabbe76ea8b4e7a2c0a69812cbe671800379ec8", "0xed57966f1566de1a90042d07403021ea52ad4724"], "0xf867baf89c435cea8d2938289924604bc95be3a2"], ] } diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 8453e178850..90cf4139c36 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1198,19 +1198,19 @@ module.exports = { "robinhood": { "ownerTokens": [ [[ADDRESSES.null], "0xF9c767CAb9B9A7dE8Dd959967269787880267ab2"], // ETH - [["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"], "0x5Cd4c081eb747406DAb66e22004324600f1928C9"], // USDG - [["0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC"], "0x4C8BAEb78b032EA3610E0F5D4C8B5Bb4fF5995f7"], // NVDA + [[ADDRESSES.robinhood.USDG], "0x5Cd4c081eb747406DAb66e22004324600f1928C9"], // USDG + [[ADDRESSES.robinhood.NVDA], "0x4C8BAEb78b032EA3610E0F5D4C8B5Bb4fF5995f7"], // NVDA [["0x117cc2133c37B721F49dE2A7a74833232B3B4C0C"], "0x8a29Db84A20B0A3CA528FAE0F69F50FfD39c6C39"], // SPY - [["0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35"], "0xA2078e02A631ae9218DBAa84987a24741bD24d10"], // META - [["0x322F0929c4625eD5bAd873c95208D54E1c003b2d"], "0xE8c619705B7452c2281cA8fA675a355846D34BFE"], // TSLA - [["0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3"], "0x31Bd720527D9875b444c0946c5795351a56d9d8B"], // GOOGL + [[ADDRESSES.robinhood.META], "0xA2078e02A631ae9218DBAa84987a24741bD24d10"], // META + [[ADDRESSES.robinhood.TSLA], "0xE8c619705B7452c2281cA8fA675a355846D34BFE"], // TSLA + [[ADDRESSES.robinhood.GOOGL], "0x31Bd720527D9875b444c0946c5795351a56d9d8B"], // GOOGL [["0xD5f3879160bc7c32ebb4dC785F8a4F505888de68"], "0xd4375275F5FA231e238c9FF1237A8e8666Be6B62"], // QQQ - [["0xec262a75e413fAfD0dF80480274532C79D42da09"], "0x207Dc4DD4E40Ab280dF9eC10CD5Edf04685e9d88"], // MSTR - [["0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9"], "0xC2991be873dD0EC1D93a0911dC1068bcCcf4D3B4"], // AAPL - [["0x020bfC650A365f8BB26819deAAbF3E21291018b4"], "0xe6711cbb2E44A0Ce72d301cC27EfBC244cBD75fb"], // CASHCAT - [["0x39dBED3a2bd333467115dE45665cC57F813C4571"], "0x757335BD24807EAc290521Ee6b3Ab2CB86fd9F18"], // PONS - [["0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa"], "0xd5Fc86f3251cE49F0Bd7B94b28B0334f21F6E42b"], // SPCX - [["0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34"], "0x4AC6D3EB4379Bd82f1dcD5C8A61c6b8F15b7812C"], // USDE + [[ADDRESSES.robinhood.MSTR], "0x207Dc4DD4E40Ab280dF9eC10CD5Edf04685e9d88"], // MSTR + [[ADDRESSES.robinhood.AAPL], "0xC2991be873dD0EC1D93a0911dC1068bcCcf4D3B4"], // AAPL + [[ADDRESSES.robinhood.CASHCAT], "0xe6711cbb2E44A0Ce72d301cC27EfBC244cBD75fb"], // CASHCAT + [[ADDRESSES.robinhood.PONS], "0x757335BD24807EAc290521Ee6b3Ab2CB86fd9F18"], // PONS + [[ADDRESSES.robinhood.SPCX], "0xd5Fc86f3251cE49F0Bd7B94b28B0334f21F6E42b"], // SPCX + [[ADDRESSES.avax.USDe], "0x4AC6D3EB4379Bd82f1dcD5C8A61c6b8F15b7812C"], // USDE ] }, }, From 18a90322462fcacfb08dc8f944e91a932f436311 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 30 Oct 2026 21:56:33 +0100 Subject: [PATCH 525/988] clean-up dead adapters --- projects/cometa/index.js | 22 -- projects/compx/index.js | 11 - projects/demex/index.js | 66 ---- projects/floe-labs/index.js | 83 ----- projects/izumi/abi.json | 11 - projects/izumi/api.js | 48 --- projects/izumi/index.js | 51 --- projects/izumi/utils.js | 198 ------------ projects/nitron/index.js | 44 --- projects/rocket-vault/index.js | 26 -- projects/stability/index.js | 44 --- registries/deadAdapters.json | 550 +++++++++++++++++++-------------- 12 files changed, 321 insertions(+), 833 deletions(-) delete mode 100644 projects/cometa/index.js delete mode 100644 projects/compx/index.js delete mode 100644 projects/demex/index.js delete mode 100644 projects/floe-labs/index.js delete mode 100644 projects/izumi/abi.json delete mode 100644 projects/izumi/api.js delete mode 100644 projects/izumi/index.js delete mode 100644 projects/izumi/utils.js delete mode 100644 projects/nitron/index.js delete mode 100644 projects/rocket-vault/index.js delete mode 100644 projects/stability/index.js diff --git a/projects/cometa/index.js b/projects/cometa/index.js deleted file mode 100644 index 7a2286b1f98..00000000000 --- a/projects/cometa/index.js +++ /dev/null @@ -1,22 +0,0 @@ -const { toUSDTBalances } = require('../helper/balances'); -const { get } = require('../helper/http') - -async function tvl() { - const response = ( - await get( - 'https://api.cometa.farm/stats/tvl' - ) - ) - - return toUSDTBalances(response.total); -} - -module.exports = { - deadFrom: "2026-10-01", // abandoned? - timetravel: false, - misrepresentedTokens: true, - algorand: { - tvl - } -} - diff --git a/projects/compx/index.js b/projects/compx/index.js deleted file mode 100644 index fa616b4f0be..00000000000 --- a/projects/compx/index.js +++ /dev/null @@ -1,11 +0,0 @@ -async function tvl() { - return { tether: 0 }; // dead? -} - -module.exports = { - deadFrom: "2025-01-01", - misrepresentedTokens: true, - algorand: { - tvl, - }, -}; \ No newline at end of file diff --git a/projects/demex/index.js b/projects/demex/index.js deleted file mode 100644 index 17f8925c46a..00000000000 --- a/projects/demex/index.js +++ /dev/null @@ -1,66 +0,0 @@ -const sdk = require('@defillama/sdk') -const axios = require('axios') -const { getCarbonTokenInfo } = require('../helper/chain/carbon') - -const getPerpPools = async () => { - const pools = []; - const size = 100; - - for (let skip = 0; ; skip += size) { - const api = `https://api.carbon.network/carbon/perpspool/v1/pools/pool_info?pagination.limit=${size}&pagination.offset=${skip}` - const { data } = await axios(api) - const currentPools = data.vaults || [] - pools.push(...currentPools) - if (currentPools.length < size) break - } - - return pools -} - -const getPools = async () => { - const pools = []; - const size = 100; - - for (let skip = 0; ; skip += size) { - const api = `https://api.carbon.network/carbon/liquiditypool/v1/pools?pagination.limit=${size}&pagination.offset=${skip}` - const { data } = await axios(api) - const currentPools = data.pools || [] - pools.push(...currentPools) - if (currentPools.length < size) break - } - - return pools -} - -const getTokenInfo = getCarbonTokenInfo - -async function tvl() { - const balances = {} - const [tokenData, pools, perpPools] = await Promise.all([getTokenInfo(), getPools(), getPerpPools()]) - for (const { pool: { denom_a, amount_a, denom_b, amount_b } } of pools) { - if (tokenData[denom_a]) { - addBalance(denom_a, amount_a) - } - if (tokenData[denom_b]) { - addBalance(denom_b, amount_b) - } - } - - const perpPoolDenom = 'cgt/1' // Carbon USD - for (const { total_nav_amount } of perpPools) { - if (tokenData[perpPoolDenom]) { - addBalance(perpPoolDenom, total_nav_amount) - } - } - - return balances - - function addBalance(id, amount) { - sdk.util.sumSingleBalance(balances, tokenData[id].geckoId, amount / (10 ** +tokenData[id].decimals)) - } -} - -module.exports = { - timetravel: false, - carbon: { tvl } -} \ No newline at end of file diff --git a/projects/floe-labs/index.js b/projects/floe-labs/index.js deleted file mode 100644 index 29b61b3da82..00000000000 --- a/projects/floe-labs/index.js +++ /dev/null @@ -1,83 +0,0 @@ -const { post } = require('../helper/http'); - -const ENVIO_ENDPOINT = 'https://indexer.hyperindex.xyz/4a53586/v1/graphql'; -const PAGE_SIZE = 1000; - -const LOANS_QUERY = ` - query GetActiveLoans($limit: Int!, $offset: Int!) { - Loan( - where: { - _or: [ - { status: { _eq: "active" } }, - { status: { _eq: "overdue" } } - ] - } - limit: $limit - offset: $offset - ) { - id - loanId - collateralToken - collateralAmount - loanToken - currentPrincipal - status - } - } -`; - -async function fetchAllActiveLoans() { - const allLoans = []; - let offset = 0; - - while (true) { - const response = await post(ENVIO_ENDPOINT, { - query: LOANS_QUERY, - variables: { limit: PAGE_SIZE, offset }, - }); - - if (response?.errors) { - throw new Error(`Error fetching Floe loans: ${response.errors.map(e => e.message).join('; ')}`); - } - - const loans = response?.data?.Loan ?? []; - allLoans.push(...loans); - - if (loans.length < PAGE_SIZE) break; - offset += PAGE_SIZE; - } - - return allLoans; -} - -function aggregateByToken(loans, tokenKey, amountKey) { - const totals = {}; - for (const loan of loans) { - if (!loan[tokenKey] || !loan[amountKey]) continue; - const token = loan[tokenKey].toLowerCase(); - totals[token] = (totals[token] ?? BigInt(0)) + BigInt(loan[amountKey]); - } - return totals; -} - -async function tvl(api) { - const loans = await fetchAllActiveLoans(); - const collateralByToken = aggregateByToken(loans, 'collateralToken', 'collateralAmount'); - for (const [token, amount] of Object.entries(collateralByToken)) { - api.add(token, amount.toString()); - } -} - -async function borrowed(api) { - const loans = await fetchAllActiveLoans(); - const principalByToken = aggregateByToken(loans, 'loanToken', 'currentPrincipal'); - for (const [token, amount] of Object.entries(principalByToken)) { - api.add(token, amount.toString()); - } -} - -module.exports = { - methodology: 'TVL is calculated as the total collateral locked in active loans. Borrowed represents the total outstanding loan principal.', - base: { tvl, borrowed }, - deadFrom: "2026-10-11", // project pivoted? -}; diff --git a/projects/izumi/abi.json b/projects/izumi/abi.json deleted file mode 100644 index b5586ef4e35..00000000000 --- a/projects/izumi/abi.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "factory": "address:factory", - "tokenOfOwnerByIndex": "function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)", - "liquidities": "function liquidities(uint256) view returns (int24 leftPt, int24 rightPt, uint128 liquidity, uint256 lastFeeScaleX_128, uint256 lastFeeScaleY_128, uint256 remainTokenX, uint256 remainTokenY, uint128 poolId)", - "pool": "function pool(address, address, uint24) view returns (address)", - "state": "function state() view returns (uint160 sqrtPrice_96, int24 currentPoint, uint16 observationCurrentIndex, uint16 observationQueueLen, uint16 observationNextQueueLen, bool locked, uint128 liquidity, uint128 liquidityX)", - "poolMetas": "function poolMetas(uint128) view returns (address tokenX, address tokenY, uint24 fee)", - "fixRangeMiningInfo": "function getMiningContractInfo() view returns (address tokenX_, address tokenY_, uint24 fee_, tuple(address rewardToken, address provider, uint256 accRewardPerShare, uint256 rewardPerBlock)[] rewardInfos_, address iziTokenAddr_, int24 rewardUpperTick_, int24 rewardLowerTick_, uint256 lastTouchBlock_, uint256 totalVLiquidity_, uint256 startBlock_, uint256 endBlock_)", - "totalNIZI": "uint256:totalNIZI", - "DynamicRangeMiningInfo": "function getMiningContractInfo() view returns (address tokenX_, address tokenY_, uint24 fee_, address iziTokenAddr_, uint256 lastTouchBlock_, uint256 totalVLiquidity_, uint256 totalTokenX_, uint256 totalTokenY_, uint256 totalNIZI_, uint256 startBlock_, uint256 endBlock_)" -} \ No newline at end of file diff --git a/projects/izumi/api.js b/projects/izumi/api.js deleted file mode 100644 index f1a3d27a15b..00000000000 --- a/projects/izumi/api.js +++ /dev/null @@ -1,48 +0,0 @@ -const { unwrapNFTs } = require('./utils') -const { getConfig: getConfigCache } = require('../helper/cache') -const { get } = require('../helper/http') - -// the api answers failures with HTTP 200 + { is_success: false, data: {} }; throwing on those keeps getConfig -// from caching the error over the last good farm list (it fell back to the cache instead) -async function getConfig(chainId) { - const data = await getConfigCache('izumi-liquidbox/' + chainId, undefined, { - fetcher: async () => { - const res = await get(`https://api.izumi.finance/api/v1/farm/compute?chainId=${chainId}`) - if (!res?.is_success || !res.data?.contracts) throw new Error(`izumi farm api error for ${chainId}: ${res?.error_code}`) - return res - } - }); - if (!data?.data?.contracts) throw new Error(`izumi farm config unavailable for chain ${chainId} (api failing, no good cached copy)`) - return data.data; -} - -const chains = { - 'ethereum': 1, - 'bsc': 56, - 'polygon': 137, - 'arbitrum': 42161, - 'aurora': 1313161554, - 'cronos': 25, -}; - -module.exports = { - deadFrom: "2026-09-30", // farms sunset? - // ownTokens: ['IZI', 'IUSD'], -} - -Object.keys(chains).forEach(chain => { - module.exports[chain] = { - tvl: getTvl(chain, false), - pool2: getTvl(chain, true), - } -}) - -function getTvl(chain, isPool2) { - return async (_, _b, { [chain]: block }) => { - const config = await getConfig(chains[chain]); - var contracts - if (isPool2){contracts = config.contracts[chain].pool2} - else {contracts = config.contracts[chain].pools} - return unwrapNFTs({ chain, block, nftAddress: config.liquidityManagers[chain], config: contracts, fixTokens: config.fixTokens[chain] }) - } -} \ No newline at end of file diff --git a/projects/izumi/index.js b/projects/izumi/index.js deleted file mode 100644 index 4cce17b2854..00000000000 --- a/projects/izumi/index.js +++ /dev/null @@ -1,51 +0,0 @@ -const { staking } = require('../helper/staking') -const { getExports } = require('../helper/heroku-api') -const { unwrapNFTs } = require('./utils') -const { getConfig: getConfigCache } = require('../helper/cache') - -async function getConfig(chainId) { - const data = await getConfigCache('izumi-liquidbox/'+chainId, `https://izumi.finance/api/v1/farm/compute?chainId=${chainId}`); - return data.data; -} - -const chains = { - 'ethereum': 1, - 'bsc': 56, - 'polygon': 137, - 'arbitrum': 42161, - 'aurora': 1313161554, - 'cronos': 25, -}; - -const indexExports = { - // ownTokens: ['IZI', 'IUSD'], -} - -Object.keys(chains).forEach(chain => { - indexExports[chain] = { - tvl: getTvl(chain, false), - pool2: getTvl(chain, true), - } -}) - -function getTvl(chain, isPool2) { - return async (_, _b, { [chain]: block }) => { - const config = await getConfig(chains[chain]); - var contracts - if (isPool2){contracts = config.contracts[chain].pool2} - else {contracts = config.contracts[chain].pools} - return unwrapNFTs({ chain, block, nftAddress: config.liquidityManagers[chain], config: contracts, fixTokens: config.fixTokens[chain] }) - } -} - -const chainKeys = Object.keys(indexExports).filter(chain => typeof indexExports[chain] === 'object' && indexExports[chain].tvl) - -module.exports = { - deadFrom: "2026-09-30", // farms sunset? - timetravel: false, - misrepresentedTokens: true, - ...getExports("izumi", chainKeys, ['pool2']), -} - -module.exports.ethereum.staking = staking('0xb56a454d8dac2ad4cb82337887717a2a427fcd00', '0x9ad37205d608b8b219e6a2573f922094cec5c200') - diff --git a/projects/izumi/utils.js b/projects/izumi/utils.js deleted file mode 100644 index ad89bccb428..00000000000 --- a/projects/izumi/utils.js +++ /dev/null @@ -1,198 +0,0 @@ -const { sumTokens2 } = require('../helper/unwrapLPs') -const sdk = require("@defillama/sdk"); -const abi = require('./abi.json'); -const BigNumber = require('bignumber.js'); -const { get } = require('../helper/http'); -const { nullAddress } = require('../helper/tokenMapping'); - -function point2PoolPriceUndecimalSqrt(point) { - return (1.0001 ** point) ** 0.5; -} - -function _getAmountX(liquidity, leftPt, rightPt, sqrtPriceR, sqrtRate, upper) { - const sqrtPricePrPc = Math.pow(sqrtRate, rightPt - leftPt + 1); - const sqrtPricePrPd = Math.pow(sqrtRate, rightPt + 1); - - const numerator = sqrtPricePrPc - sqrtRate; - const denominator = sqrtPricePrPd - sqrtPriceR; - - if (!upper) { - const amount = new BigNumber(liquidity.times(numerator).div(denominator).toFixed(0, 3)); - return amount; - } else { - const amount = new BigNumber(liquidity.times(numerator).div(denominator).toFixed(0, 2)); - return amount; - } -} - -function _getAmountY(liquidity, sqrtPriceL, sqrtPriceR, sqrtRate, upper) { - const numerator = sqrtPriceR - sqrtPriceL; - const denominator = sqrtRate - 1; - if (!upper) { - const amount = new BigNumber(liquidity.times(numerator).div(denominator).toFixed(0, 3)); - return amount; - } else { - const amount = new BigNumber(liquidity.times(numerator).div(denominator).toFixed(0, 2)); - return amount; - } -} - -function _liquidity2AmountXAtPoint(liquidity, sqrtPrice, upper) { - const amountX = liquidity.div(sqrtPrice); - if (!upper) { - return new BigNumber(amountX.toFixed(0, 3)); - } else { - return new BigNumber(amountX.toFixed(0, 2)); - } -} - -function _liquidity2AmountYAtPoint(liquidity, sqrtPrice, upper) { - const amountY = liquidity.times(sqrtPrice); - if (!upper) { - return new BigNumber(amountY.toFixed(0, 3)); - } else { - return new BigNumber(amountY.toFixed(0, 2)); - } -} - -async function addiZiPositionBalances(params, balances, chain, ) { - const transformAddress = token => `${chain}:${token}` - const tokenX = params.miningInfo.tokenX_ - const tokenY = params.miningInfo.tokenY_ - const rangeLen = Number(params.miningInfo.rewardUpperTick_) - Number(params.miningInfo.rewardLowerTick_) - - const liquidity = new BigNumber(params.miningInfo.totalVLiquidity_).div(rangeLen).div(rangeLen).times(1e6) - - const currentPoint = Number(params.state.currentPoint) - const currentLiqudity = Number(params.state.curliquidity) - const currentLiqudityX = Number(params.state.curliquidityX) - - let amountX = new BigNumber(0) - let amountY = new BigNumber(0) - - const sqrtRate = Math.sqrt(1.0001); - const leftPtNum = Number(params.miningInfo.rewardLowerTick_); - const rightPtNum = Number(params.miningInfo.rewardUpperTick_); - // compute amountY without currentPt - if (leftPtNum < currentPoint) { - const rightPt = Math.min(currentPoint, rightPtNum); - const sqrtPriceR = point2PoolPriceUndecimalSqrt(rightPt); - const sqrtPriceL = point2PoolPriceUndecimalSqrt(leftPtNum); - amountY = _getAmountY(new BigNumber(liquidity), sqrtPriceL, sqrtPriceR, sqrtRate, false); - } - - // compute amountX without currentPt - if (rightPtNum > currentPoint + 1) { - const leftPt = Math.max(currentPoint + 1, leftPtNum); - const sqrtPriceR = point2PoolPriceUndecimalSqrt(rightPtNum); - amountX = _getAmountX(new BigNumber(liquidity), leftPt, rightPtNum, sqrtPriceR, sqrtRate, false); - } - - // compute amountX and amountY on currentPt - if (leftPtNum <= currentPoint && rightPtNum > currentPoint) { - const liquidityValue = new BigNumber(liquidity); - const maxLiquidityYAtCurrentPt = new BigNumber(currentLiqudity).minus(currentLiqudityX); - const liquidityYAtCurrentPt = liquidityValue.gt(maxLiquidityYAtCurrentPt) ? maxLiquidityYAtCurrentPt : liquidityValue; - const liquidityXAtCurrentPt = liquidityValue.minus(liquidityYAtCurrentPt); - const currentSqrtPrice = point2PoolPriceUndecimalSqrt(currentPoint); - amountX = amountX.plus(_liquidity2AmountXAtPoint(liquidityXAtCurrentPt, currentSqrtPrice, false)); - amountY = amountY.plus(_liquidity2AmountYAtPoint(liquidityYAtCurrentPt, currentSqrtPrice, false)); - } - const tokenIZI = params.miningInfo.iziTokenAddr_.toLowerCase() - sdk.util.sumSingleBalance(balances, transformAddress(tokenIZI), new BigNumber(params.totalNIZI).toFixed(0)) - sdk.util.sumSingleBalance(balances, transformAddress(tokenX), new BigNumber(amountX).toFixed(0)) - sdk.util.sumSingleBalance(balances, transformAddress(tokenY), new BigNumber(amountY).toFixed(0)) -} - -async function unwrapiZiswapV3NFTs({ balances = {}, nftsAndOwners = [], block, chain = 'bsc', owner, nftAddress, owners }) { - if (!nftsAndOwners.length) { - if (!nftAddress) - switch (chain) { - case 'bsc': nftAddress = '0x93C22Fbeff4448F2fb6e432579b0638838Ff9581'; break; - default: throw new Error('missing default uniswap nft address') - } - - if (!owners && owner) - owners = [owner] - - if (!owners) { - return balances - } - - - for (let i = 0; i < Object.keys(owners).length; i++) { - let type = Object.keys(owners)[i] - if (!owners[type] || owners[type].length == 0) { - continue - } - else if (type == 'fixRange') { - let ownersUni = getUniqueAddresses(owners[type]) - let nftsAndOwners = ownersUni.map(o => [nftAddress, o]) - await Promise.all(nftsAndOwners.map(([nftAddress, owner]) => unwrapiZiswapFixNFT({ balances, owner, nftAddress, block, chain, }))) - } - else if (type == 'dynamicRange') { - let ownersUni = getUniqueAddresses(owners[type]) - let nftsAndOwners = ownersUni.map(o => [nftAddress, o]) - await Promise.all(nftsAndOwners.map(([nftAddress, owner]) => unwrapiZiswapDynamicNFT({ balances, owner, nftAddress, block, chain, }))) - } - } - } - return balances - - function getUniqueAddresses(addresses) { - const set = new Set() - addresses.forEach(i => set.add(i.toLowerCase())) - return [...set] - } -} - -async function unwrapiZiswapFixNFT({ balances, owner, nftAddress, block, chain = 'bsc', }) { - const miningInfo = (await sdk.api.abi.call({ target: owner, abi: abi.fixRangeMiningInfo, block, chain })).output - const totalNIZI = (await sdk.api.abi.call({ target: owner, abi: abi.totalNIZI, block, chain })).output - const factory = (await sdk.api.abi.call({ target: nftAddress, abi: abi.factory, block, chain })).output - const poolInfo = (await sdk.api.abi.call({ - target: factory, abi: abi.pool, block, chain, params: [miningInfo.tokenX_, miningInfo.tokenY_, miningInfo.fee_] - })).output - if (poolInfo == nullAddress) return balances - const state = (await sdk.api.abi.call({ target: poolInfo, abi: abi.state, block, chain })).output - - let params = { - miningInfo: miningInfo, - state: state, - totalNIZI: totalNIZI, - } - await addiZiPositionBalances(params, balances, chain) - - return balances -} - -async function unwrapiZiswapDynamicNFT({ balances, owner, nftAddress, block, chain = 'bsc', }) { - const transformAddress = token => `${chain}:${token}` - const miningContractInfo = (await sdk.api.abi.call({ target: owner, abi: abi.DynamicRangeMiningInfo, block, chain })).output - const tokenA = miningContractInfo.tokenX_ - const tokenB = miningContractInfo.tokenY_ - const tokenIZI = miningContractInfo.iziTokenAddr_.toLowerCase() - const tokenAAmount = new BigNumber(miningContractInfo.totalTokenX_); - const tokenBAmount = new BigNumber(miningContractInfo.totalTokenY_); - const totalNIZI = Number(miningContractInfo.totalNIZI_ ?? 0); - sdk.util.sumSingleBalance(balances, transformAddress(tokenIZI), new BigNumber(totalNIZI).toFixed(0)) - sdk.util.sumSingleBalance(balances, transformAddress(tokenA), new BigNumber(tokenAAmount).toFixed(0)) - sdk.util.sumSingleBalance(balances, transformAddress(tokenB), new BigNumber(tokenBAmount).toFixed(0)) - - return balances -} - -async function unwrapNFTs({ balances = {}, block, chain = 'bsc', nftAddress, config, }) { - const uniContracts = config.uniContracts - const iZiContracts = config.iZiContracts - if (iZiContracts) await unwrapiZiswapV3NFTs({ balances, chain, block, nftAddress, owners: iZiContracts, }) - if (uniContracts) await sumTokens2({ balances, chain, block, owners: uniContracts, resolveUniV3: true, }) - // to fix balances of token addresses which are not on CoinGecko - // await checkAndFixToken(balances, chain, fixTokens) - return balances -} - -module.exports = { - unwrapiZiswapV3NFTs, - unwrapNFTs -} diff --git a/projects/nitron/index.js b/projects/nitron/index.js deleted file mode 100644 index 613cb5777dd..00000000000 --- a/projects/nitron/index.js +++ /dev/null @@ -1,44 +0,0 @@ -const { get } = require("../helper/http") -const sdk = require('@defillama/sdk') -const BigNumber = require('bignumber.js') -const { getCarbonTokenInfo } = require('../helper/chain/carbon') - -async function getTotalSupplied() { - const modAddress = 'swth1wq9ts6l7atfn45ryxrtg4a2gwegsh3xh7w83xl' - const debtInfos = (await get('https://api.carbon.network/carbon/cdp/v1/token_debt')).debt_infos_all - const modBalances = (await get(`https://api.carbon.network/carbon/coin/v1/balances/${modAddress}`)).token_balances - const allAssets = [] - for (const debt of debtInfos){ - const {denom,total_principal} = debt - const modBalance = new BigNumber((modBalances.find((o) => o.denom === denom))?.available ?? 0) - const totalPrincipal = new BigNumber(total_principal ?? 0) - allAssets.push({ denom, amount: modBalance.plus(totalPrincipal).toNumber()}) - } - return allAssets -} - -async function tvl() { - const balances = {} - const [tokenData, assets] = await Promise.all([ - getCarbonTokenInfo(), - getTotalSupplied() - ]) - - for(const {denom, amount} of assets) { - if (tokenData[denom]) { - addBalance(denom, amount) - } - } - return balances - - function addBalance(id, amount) { - sdk.util.sumSingleBalance(balances, tokenData[id].geckoId, amount / (10 ** +tokenData[id].decimals)) - } -} - -module.exports = { - timetravel: false, - carbon: { - tvl - } -} diff --git a/projects/rocket-vault/index.js b/projects/rocket-vault/index.js deleted file mode 100644 index e8e322d355a..00000000000 --- a/projects/rocket-vault/index.js +++ /dev/null @@ -1,26 +0,0 @@ -const axios = require('axios') - -const ROCKET_API = "https://beta.rocket-cluster-1.com"; -const VAULT_ADDRESS = "0x6BC2179a284CB2A2857C379391E0158524de7cA0"; - -const tvl = async (api) => { - const { data } = await axios.get(`${ROCKET_API}/vaults`, { timeout: 30000 }) - let vaults = data.vaults.map(({ address }) => address) - if (!vaults.length) vaults = [VAULT_ADDRESS] - - let total = 0 - for (const vault of vaults) { - const { data } = await axios.get(`${ROCKET_API}/collateral?account=${encodeURIComponent(vault)}`, { timeout: 30000 }) - total += Object.values(data.collaterals).reduce((sum, v) => sum + Number(v), 0) - } - api.addUSDValue(total) -} - -module.exports = { - timetravel: false, - misrepresentedTokens: false, - doublecounted: true, - deadFrom: "2026-09-05", // paused after a hack - methodology: "TVL is calculated by summing all USDC collateral deposited in Rocket Liquidity Provider vaults", - arbitrum: { tvl }, -}; \ No newline at end of file diff --git a/projects/stability/index.js b/projects/stability/index.js deleted file mode 100644 index 6cf0ac9e2c9..00000000000 --- a/projects/stability/index.js +++ /dev/null @@ -1,44 +0,0 @@ -const abi = { - "vaultAddresses": "function vaultAddresses() view returns (address[] memory vaultAddress)", - "strategy": "address:strategy", - "assetsAmounts": "function assetsAmounts() view returns (address[] memory assets, uint[] memory amounts)" -} - -const config = { - polygon: { - vaultManager: '0x6008b366058B42792A2497972A3312274DC5e1A8', - }, - base: { - vaultManager: '0x2ba8C6A519CEDB6d1C35cEb14E8642625E91F77C', - }, - real: { - vaultManager: '0x7146efaab12A083b9826c66162062c21eC70fe3c', - }, - sonic: { - vaultManager: '0x589a504f2ee9d054b483c700fa814863d639381e', - // vaults lending USDC into insolvent Silo markets (0 liquidity, unwithdrawable); their claim compounds as phantom interest - blacklistedVaults: [ - '0x8913582701B7c80E883F9E352c1653a16769B173', // C-USDC-S1 -> Silo xUSD/USDC (Stream-impacted) - '0xd248c4b6Ec709FEeD32851A9F883AfeaC294aD30', // C-USDC.e-S3 -> Silo PT-wstkscUSD-29MAY2025/USDC - ], - }, -} - -Object.keys(config).forEach(chain => { - module.exports[chain] = { - tvl: async function (api) { - // Stability Platform Vaults - // Get all vaults - const blacklist = new Set((config[chain].blacklistedVaults ?? []).map(v => v.toLowerCase())) - const vaults = (await api.call({ abi: abi.vaultAddresses, target: config[chain].vaultManager })).filter(v => !blacklist.has(v.toLowerCase())); - - // Get strategy addresses - const strategies = await api.multiCall({ abi: abi.strategy, calls: vaults, }) - - // Get all assets amounts managed by strategies - const assetsAmountsAll = await api.multiCall({ abi: abi.assetsAmounts, calls: strategies, }) - assetsAmountsAll.forEach(([assets, amounts]) => api.add(assets, amounts)) - }, - } -}) -module.exports.deadFrom = '2026-04-01' diff --git a/registries/deadAdapters.json b/registries/deadAdapters.json index 6ed41b02d89..d10b711546e 100644 --- a/registries/deadAdapters.json +++ b/registries/deadAdapters.json @@ -257,6 +257,14 @@ }, "deadFrom": "2025-06-09" }, + "LiquidOps": { + "deadFrom": "2026-10-07", + "methodology": "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.", + "ao": { + "tvl": "_f", + "borrowed": "_f" + } + }, "LuckyFuture": { "methodology": "Calculate sum of spot positions in vaults with unrealized profit and loss", "doublecounted": true, @@ -368,6 +376,13 @@ "tvl": "_f" } }, + "accumulator": { + "misrepresentedTokens": true, + "shimmer_evm": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, "acumen": { "timetravel": false, "solana": { @@ -433,6 +448,14 @@ }, "deadFrom": "2026-01-25" }, + "akiba": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f", + "staking": "_f", + "pool2": "_f" + } + }, "allbridge-core": { "methodology": "All tokens locked in Allbridge Core pool contracts.", "deadFrom": "2026-08-31", @@ -982,6 +1005,14 @@ "tvl": "_f" } }, + "beekava": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f", + "pool2": "_f", + "staking": "_f" + } + }, "beluga-protocol": { "timetravel": false, "solana": { @@ -1583,6 +1614,14 @@ ], "deadFrom": "2022-09-11" }, + "cotiTreasury": { + "deadFrom": "2026-10-11", + "timetravel": false, + "coti": { + "tvl": "_f", + "staking": "_f" + } + }, "credbull": { "methodology": "TVL consist of the sum of every deposit of all vaults for a given asset.", "hallmarks": [ @@ -1658,6 +1697,13 @@ "tvl": "_f" } }, + "crunchynetwork-wtz": { + "deadFrom": "2026-01-01", + "timetravel": false, + "tezos": { + "tvl": "_f" + } + }, "crypto-lottery": { "methodology": "We count of smart contract balance in coins", "deadFrom": "2024-09-11", @@ -2248,6 +2294,13 @@ }, "deadFrom": "2026-09-15" }, + "embr-bridge": { + "timetravel": false, + "embr": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, "emeraldswap": { "deadFrom": "2022-03-31", "methodology": "TVL includes all farms in MasterChef contract", @@ -2608,6 +2661,14 @@ }, "deadFrom": "2023-09-30" }, + "funbear": { + "deadFrom": "2026-09-30", + "methodology": "TVL counts staked FUNB coins on the platform itself.", + "kava": { + "tvl": "_f", + "staking": "_f" + } + }, "fundex": { "hallmarks": [ [ @@ -2679,6 +2740,12 @@ "deadFrom": "2022-01-11", "methodology": "Counts tokens on the treasury for tvl and staked GG for staking" }, + "gamutexchange": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f" + } + }, "geist": { "deadFrom": "2023-10-18", "methodology": "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.", @@ -2984,6 +3051,14 @@ "tvl": "_f" } }, + "ifpool": { + "methodology": "Counts staked CET tokens.", + "timetravel": false, + "csc": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, "ignite-finance": { "misrepresentedTokens": true, "klaytn": { @@ -3143,6 +3218,12 @@ }, "deadFrom": "2025-02-05" }, + "iotabee": { + "shimmer_evm": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, "ironclad": { "mode": { "tvl": "_f", @@ -3222,6 +3303,13 @@ }, "deadFrom": "2026-07-17" }, + "kaDefi": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f", + "staking": "_f" + } + }, "kaddex": { "timetravel": false, "misrepresentedTokens": true, @@ -3293,6 +3381,13 @@ "tvl": "_f" } }, + "kavastarter": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f", + "staking": "_f" + } + }, "kdlaunch": { "misrepresentedTokens": true, "timetravel": false, @@ -3352,6 +3447,13 @@ "methodology": "Counts as TVL all the Assets deposited on EVMOS through different Pool Contracts", "deadFrom": "2026-06-10" }, + "kinetix": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f", + "staking": "_f" + } + }, "kinto": { "ethereum": { "tvl": "_f" @@ -3414,6 +3516,13 @@ }, "doublecounted": true }, + "kmex-io": { + "deadFrom": "2026-09-30", + "kava": { + "staking": "_f", + "tvl": "_f" + } + }, "knitfinance": { "timetravel": false, "deadFrom": "2023-02-01", @@ -3807,6 +3916,18 @@ }, "deadFrom": "2022-10-19" }, + "mangrove": { + "misrepresentedTokens": false, + "methodology": "TVL is calculated by getting the total promised liquidity on the orderbook on a specific block.", + "start": "2024-02-27", + "deadFrom": "2025-02-27", + "blast": { + "tvl": "_f" + }, + "arbitrum": { + "tvl": "_f" + } + }, "manifesto": { "hallmarks": [ [ @@ -3987,6 +4108,40 @@ }, "deadFrom": "2026-01-25" }, + "metric": { + "ethereum": { + "tvl": "_f" + }, + "base": { + "tvl": "_f" + }, + "arbitrum": { + "tvl": "_f" + }, + "bsc": { + "tvl": "_f" + }, + "avax": { + "tvl": "_f" + }, + "polygon": { + "tvl": "_f" + }, + "megaeth": { + "tvl": "_f" + }, + "hyperliquid": { + "tvl": "_f" + }, + "monad": { + "tvl": "_f" + }, + "robinhood": { + "tvl": "_f" + }, + "methodology": "TVL is the sum of token0 and token1 balances held by every pool created by the Metric pool factory. Pools are discovered on-chain from the factory PoolCreated events.", + "deadFrom": "2026-10-08" + }, "metropolis": { "hallmarks": [ [ @@ -5282,6 +5437,12 @@ "pool2": "_f" } }, + "pxswap": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f" + } + }, "pylon": { "timetravel": false, "methodology": "TVL counts the UST that has been deposted to the Protocol. Data is pulled from the Pylon API:\"https://api.pylon.money/api/launchpad/v1/projects/mine\".", @@ -5317,6 +5478,14 @@ "staking": "_f" } }, + "quicksilver": { + "timetravel": false, + "methodology": "Sum of all the tokens that are liquid staked on Quicksilver", + "quicksilver": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, "quickswap-lending": { "methodology": "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", "polygon": { @@ -5552,6 +5721,21 @@ "tvl": "_f" } }, + "rubyfinance": { + "deadFrom": "2026-09-30", + "hallmarks": [ + [ + "2022-08-15", + "incentives not given" + ] + ], + "methodology": "Pool2 deposits consist of RUBY/USDC, RUBY/KAVA, RSHARE/KAVA and RUBY/RSHARE LP deposits while the staking TVL consists of the RSHARE tokens locked within the Boardroom contract.", + "kava": { + "tvl": "_f", + "pool2": "_f", + "staking": "_f" + } + }, "ruler": { "deadFrom": "2022-03-31", "ethereum": { @@ -5578,6 +5762,13 @@ }, "deadFrom": "2022-06-01" }, + "sailing-portfolios": { + "deadFrom": "2026-09-30", + "kava": { + "tvl": "_f" + }, + "methodology": "The assets in the balancer are detected and counted." + }, "sailingprotocol": { "methodology": "The total supply of their circulating stocks is extracted from their stock token contracts.", "misrepresentedTokens": true, @@ -5623,6 +5814,13 @@ }, "deadFrom": "2022-05-15" }, + "scrt": { + "misrepresentedTokens": true, + "secret": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, "sdex": { "deadFrom": "2025-08-01", "misrepresentedTokens": true, @@ -5630,6 +5828,13 @@ "tvl": "_f" } }, + "secretswap": { + "misrepresentedTokens": true, + "secret": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, "securedao": { "misrepresentedTokens": true, "fantom": { @@ -5638,6 +5843,13 @@ }, "deadFrom": "2022-02-01" }, + "selfex": { + "deadFrom": "2026-09-30", + "misrepresentedTokens": true, + "kava": { + "tvl": "_f" + } + }, "senpai": { "boba": { "tvl": "_f", @@ -5654,6 +5866,14 @@ }, "deadFrom": "2025-11-22" }, + "shadeprotocol-derivatives": { + "timetravel": false, + "methodology": "TVL counts SCRT backing stkd-SCRT using the staking contract accounting plus active unbonding SCRT.", + "secret": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, "shadeprotocol-lend": { "deadFrom": "2026-08-08", "misrepresentedTokens": true, @@ -5730,6 +5950,21 @@ "borrowed": "_f" } }, + "sienna": { + "timetravel": false, + "secret": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, + "sienna-lend": { + "secret": { + "tvl": "_f", + "borrowed": "_f", + "staking": "_f" + }, + "deadFrom": "2026-10-18" + }, "sierra": { "hallmarks": [ [ @@ -6002,6 +6237,14 @@ }, "deadFrom": "2026-01-25" }, + "stakedicp": { + "deadFrom": "2026-10-07", + "timetravel": false, + "methodology": "TVL counts ICP deposited as collateral to mint stICP", + "icp": { + "tvl": "_f" + } + }, "stakedotlink-index": { "ethereum": { "tvl": "_f" @@ -6449,6 +6692,17 @@ "tvl": "_f" } }, + "tangleswap": { + "shimmer_evm": { + "tvl": "_f", + "staking": "_f" + }, + "milkomeda": { + "tvl": "_f", + "staking": "_f" + }, + "deadFrom": "2026-10-18" + }, "tapp-exchange": { "methodology": "Measures the total liquidity across all pools on TAPP Exchange.", "deadFrom": "2026-05-31", @@ -6547,8 +6801,15 @@ "staking": "_f" } }, - "toreus": { - "methodology": "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.", + "tonswap": { + "misrepresentedTokens": true, + "everscale": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, + "toreus": { + "methodology": "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.", "deadFrom": "2023-07-18", "kava": { "tvl": "_f", @@ -6888,6 +7149,12 @@ }, "deadFrom": "2026-09-15" }, + "vibrswap": { + "neon_evm": { + "tvl": "_f" + }, + "deadFrom": "2026-10-18" + }, "vikings": { "avax": { "tvl": "_f", @@ -6963,6 +7230,13 @@ }, "deadFrom": "2022-08-19" }, + "weave": { + "deadFrom": "2026-09-30", + "methodology": "gets the balance of the strategy contract", + "kava": { + "tvl": "_f" + } + }, "weldfinance": { "misrepresentedTokens": true, "kava": { @@ -7355,278 +7629,96 @@ "tvl": "_f" } }, - "LiquidOps": { - "deadFrom": "2026-10-07", - "methodology": "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.", - "ao": { - "tvl": "_f", - "borrowed": "_f" - } - }, - "accumulator": { + "cometa": { + "deadFrom": "2026-10-01", + "timetravel": false, "misrepresentedTokens": true, - "shimmer_evm": { + "algorand": { "tvl": "_f" - }, - "deadFrom": "2026-10-18" - }, - "akiba": { - "deadFrom": "2026-09-30", - "kava": { - "tvl": "_f", - "staking": "_f", - "pool2": "_f" - } - }, - "beekava": { - "deadFrom": "2026-09-30", - "kava": { - "tvl": "_f", - "pool2": "_f", - "staking": "_f" } }, - "cotiTreasury": { - "deadFrom": "2026-10-11", - "timetravel": false, - "coti": { - "tvl": "_f", - "staking": "_f" - } - }, - "crunchynetwork-wtz": { - "deadFrom": "2026-01-01", - "timetravel": false, - "tezos": { + "compx": { + "deadFrom": "2025-01-01", + "misrepresentedTokens": true, + "algorand": { "tvl": "_f" } }, - "embr-bridge": { + "demex": { "timetravel": false, - "embr": { + "carbon": { "tvl": "_f" }, - "deadFrom": "2026-10-18" + "deadFrom": "2026-10-30" }, - "funbear": { - "deadFrom": "2026-09-30", - "methodology": "TVL counts staked FUNB coins on the platform itself.", - "kava": { + "floe-labs": { + "methodology": "TVL is calculated as the total collateral locked in active loans. Borrowed represents the total outstanding loan principal.", + "base": { "tvl": "_f", - "staking": "_f" - } - }, - "gamutexchange": { - "deadFrom": "2026-09-30", - "kava": { - "tvl": "_f" - } - }, - "ifpool": { - "methodology": "Counts staked CET tokens.", - "timetravel": false, - "csc": { - "tvl": "_f" - }, - "deadFrom": "2026-10-18" - }, - "iotabee": { - "shimmer_evm": { - "tvl": "_f" + "borrowed": "_f" }, - "deadFrom": "2026-10-18" + "deadFrom": "2026-10-11" }, - "kaDefi": { - "deadFrom": "2026-09-30", - "kava": { - "tvl": "_f", - "staking": "_f" - } - }, - "kavastarter": { + "izumi": { "deadFrom": "2026-09-30", - "kava": { - "tvl": "_f", - "staking": "_f" - } - }, - "kinetix": { - "deadFrom": "2026-09-30", - "kava": { + "timetravel": false, + "misrepresentedTokens": true, + "ethereum": { + "pool2": "_f", "tvl": "_f", "staking": "_f" - } - }, - "kmex-io": { - "deadFrom": "2026-09-30", - "kava": { - "staking": "_f", - "tvl": "_f" - } - }, - "mangrove": { - "misrepresentedTokens": false, - "methodology": "TVL is calculated by getting the total promised liquidity on the orderbook on a specific block.", - "start": "2024-02-27", - "deadFrom": "2025-02-27", - "blast": { - "tvl": "_f" - }, - "arbitrum": { - "tvl": "_f" - } - }, - "metric": { - "ethereum": { - "tvl": "_f" - }, - "base": { - "tvl": "_f" - }, - "arbitrum": { - "tvl": "_f" }, "bsc": { - "tvl": "_f" - }, - "avax": { + "pool2": "_f", "tvl": "_f" }, "polygon": { - "tvl": "_f" - }, - "megaeth": { - "tvl": "_f" - }, - "hyperliquid": { - "tvl": "_f" - }, - "monad": { - "tvl": "_f" - }, - "robinhood": { - "tvl": "_f" - }, - "methodology": "TVL is the sum of token0 and token1 balances held by every pool created by the Metric pool factory. Pools are discovered on-chain from the factory PoolCreated events.", - "deadFrom": "2026-10-08" - }, - "pxswap": { - "deadFrom": "2026-09-30", - "kava": { - "tvl": "_f" - } - }, - "quicksilver": { - "timetravel": false, - "methodology": "Sum of all the tokens that are liquid staked on Quicksilver", - "quicksilver": { - "tvl": "_f" - }, - "deadFrom": "2026-10-18" - }, - "rubyfinance": { - "deadFrom": "2026-09-30", - "hallmarks": [ - [ - "2022-08-15", - "incentives not given" - ] - ], - "methodology": "Pool2 deposits consist of RUBY/USDC, RUBY/KAVA, RSHARE/KAVA and RUBY/RSHARE LP deposits while the staking TVL consists of the RSHARE tokens locked within the Boardroom contract.", - "kava": { - "tvl": "_f", "pool2": "_f", - "staking": "_f" - } - }, - "sailing-portfolios": { - "deadFrom": "2026-09-30", - "kava": { "tvl": "_f" }, - "methodology": "The assets in the balancer are detected and counted." - }, - "scrt": { - "misrepresentedTokens": true, - "secret": { + "arbitrum": { + "pool2": "_f", "tvl": "_f" }, - "deadFrom": "2026-10-18" - }, - "secretswap": { - "misrepresentedTokens": true, - "secret": { + "aurora": { + "pool2": "_f", "tvl": "_f" }, - "deadFrom": "2026-10-18" - }, - "selfex": { - "deadFrom": "2026-09-30", - "misrepresentedTokens": true, - "kava": { + "cronos": { + "pool2": "_f", "tvl": "_f" } }, - "shadeprotocol-derivatives": { + "nitron": { "timetravel": false, - "methodology": "TVL counts SCRT backing stkd-SCRT using the staking contract accounting plus active unbonding SCRT.", - "secret": { - "tvl": "_f" - }, - "deadFrom": "2026-10-18" - }, - "sienna": { - "timetravel": false, - "secret": { + "carbon": { "tvl": "_f" }, - "deadFrom": "2026-10-18" + "deadFrom": "2026-10-30" }, - "sienna-lend": { - "secret": { - "tvl": "_f", - "borrowed": "_f", - "staking": "_f" - }, - "deadFrom": "2026-10-18" - }, - "stakedicp": { - "deadFrom": "2026-10-07", + "rocket-vault": { "timetravel": false, - "methodology": "TVL counts ICP deposited as collateral to mint stICP", - "icp": { + "misrepresentedTokens": false, + "doublecounted": true, + "deadFrom": "2026-09-05", + "methodology": "TVL is calculated by summing all USDC collateral deposited in Rocket Liquidity Provider vaults", + "arbitrum": { "tvl": "_f" } }, - "tangleswap": { - "shimmer_evm": { - "tvl": "_f", - "staking": "_f" - }, - "milkomeda": { - "tvl": "_f", - "staking": "_f" + "stability": { + "polygon": { + "tvl": "_f" }, - "deadFrom": "2026-10-18" - }, - "tonswap": { - "misrepresentedTokens": true, - "everscale": { + "base": { "tvl": "_f" }, - "deadFrom": "2026-10-18" - }, - "vibrswap": { - "neon_evm": { + "real": { "tvl": "_f" }, - "deadFrom": "2026-10-18" - }, - "weave": { - "deadFrom": "2026-09-30", - "methodology": "gets the balance of the strategy contract", - "kava": { + "sonic": { "tvl": "_f" - } + }, + "deadFrom": "2026-04-01" } } \ No newline at end of file From 4a2454cf82b3d4213cdc94f366c67cc51b134421 Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 31 Oct 2026 10:46:49 +0100 Subject: [PATCH 526/988] zyfai: count Steakhouse Prime ETH, Aave WBTC, and Superform METAc (#21950) Co-authored-by: Cursor --- projects/zyfai/base.js | 2 ++ projects/zyfai/ethereum.js | 1 + 2 files changed, 3 insertions(+) diff --git a/projects/zyfai/base.js b/projects/zyfai/base.js index e2c19e955f1..4f9399c97e8 100644 --- a/projects/zyfai/base.js +++ b/projects/zyfai/base.js @@ -42,6 +42,7 @@ const MORPHO_POOL_ADDRESSES = { 'Steakhouse High Yield USDC V2': '0xbeeff7aE5E00Aae3Db302e4B0d8C883810a58100', 'Noon Ecosystem Vault': '0x8B12106a70FE2F8bB255F691f1CF9a9ccfB278AF', 'Yearn OG USDC V2': '0xe7D0DBE3493830e2Ab62619211A2BfF0Fc60dB42', + 'Steakhouse Prime ETH': '0xbeef00f0A818894a2Cf111644A5098421611100E', }; const SPARK_POOL_ADDRESSES = { 'USDC': '0x3128a0F7f0ea68E7B7c9B00AFa7E41045828e858' @@ -106,6 +107,7 @@ const UNPRICED_VAULTS = [ '0xd46a3c2d958d0a2cb098d48c48dc19fe3a710f37', // IPOR Fusion USDC '0x363600ac7173e8d91bcfee68d711bb93e992c110', // Superform GOOGLc '0x301a1ceb684d62833101b373ab6c395349b24033', // Superform AAPLc + '0xc63374bf46d7a9654a96b14a3dc363c92b26d5a3', // Superform METAc ]; const AUTOFINANCE_POOLS = { diff --git a/projects/zyfai/ethereum.js b/projects/zyfai/ethereum.js index 10b2562882c..a0f8c2f760d 100644 --- a/projects/zyfai/ethereum.js +++ b/projects/zyfai/ethereum.js @@ -4,6 +4,7 @@ const AAVE_POOLS = { WETH: '0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8', // aEthWETH wstETH: '0x0B925eD163218f6662a35e0f0371Ac234f9E9371', // aEthWSTETH cbBTC: '0x5c647cE0Ae10658ec44FA4E11A51c96e94efd1Dd', // aEthcbBTC + WBTC: '0x5Ee5bf7ae06D1Be5997A1A72006FE6C607eC6DE8', // aEthWBTC PYUSD: '0x0C0d01AbF3e6aDfcA0989eBbA9d6e85dD58EaB1E', // aEthPYUSD }; const COMPOUND_POOLS = { From dcf9525bbf9c782b8128a3f9c9eb5a1aa01c1022 Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Sat, 31 Oct 2026 06:56:12 -0400 Subject: [PATCH 527/988] fix(nbx): include disclosed Ethereum cold wallet (#21943) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- cex/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cex/index.js b/cex/index.js index a4fd060f7ff..b936388f80b 100644 --- a/cex/index.js +++ b/cex/index.js @@ -1657,7 +1657,8 @@ const configs = { owners: [ "0x29af949c3D218C1133bD16257ed029E92deFb168", "0x8Cad96fB23924Ebc37b8CdAFa8400AD856fE4a2C", - "0xAeB81c391Ac427B6443310fF1cB73a21E071e5ad" + "0xAeB81c391Ac427B6443310fF1cB73a21E071e5ad", + "0x052Ed0aD68Ffc470386FDAb82F7046E0b55FD663" ] }, cardano: { From 4efd66eec8807d0456d96647f02f61ae70521afb Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Sat, 31 Oct 2026 06:56:26 -0400 Subject: [PATCH 528/988] fix: normalize FinNexus hallmark date (#21945) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- registries/sumTokens.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 7f7686d629d..c5102f3a7c6 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -14639,7 +14639,7 @@ const configs = { "finnexus": { "hallmarks": [ [ - "2021-5-17", + "2021-05-17", "FinNexus erc20 contract is hacked" ] ], From a48f85243fca5a78aaa99126f3e3fa83448a11e3 Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Sat, 31 Oct 2026 06:59:37 -0400 Subject: [PATCH 529/988] fix(nexo-cex): separate Polygon NEXO from base TVL (#21942) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- cex/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/cex/index.js b/cex/index.js index b936388f80b..341630d9a63 100644 --- a/cex/index.js +++ b/cex/index.js @@ -1692,6 +1692,7 @@ const configs = { ] }, polygon: { + ownTokens: ['0x41b3966b4ff7b427969ddf5da3627d6aeae9a48e'], owners: [ "0xb60c61dbb7456f024f9338c739b02be68e3f545c", "0x9bdb521a97e95177bf252c253e256a60c3e14447", From 0dae07fb6847fd8f0f064a125f591abd1f9b229c Mon Sep 17 00:00:00 2001 From: routebuilder Date: Sun, 1 Nov 2026 12:15:59 +0100 Subject: [PATCH 530/988] fix(valdora, eris-protocol): remove silent .catch() handlers that swallow vault/arb query failures (#21958) --- projects/eris-protocol/index.js | 2 +- projects/valdora/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/eris-protocol/index.js b/projects/eris-protocol/index.js index b4c4a7e3268..f0bac1996b4 100644 --- a/projects/eris-protocol/index.js +++ b/projects/eris-protocol/index.js @@ -387,7 +387,7 @@ async function productsTvl(chain) { return await mergePromises([ tvlHub(chain, state), tvlAmpGovernance(chain, state), - tvlArbVault(chain).catch((a) => ({})), + tvlArbVault(chain), ...(chainConfig.tassets ?? []).map((tasset) => tasset2Tvl(chain, tasset)), ...(chainConfig.daos ?? []).map((dao) => dao2Tvl(chain, dao)), ...(chainConfig.farms ?? []).map((farm) => farm2Tvl(chain, farm)), diff --git a/projects/valdora/index.js b/projects/valdora/index.js index 5ef3edc0361..669c904a8aa 100644 --- a/projects/valdora/index.js +++ b/projects/valdora/index.js @@ -46,7 +46,7 @@ async function tvl(api) { const payload = await getConfig('valdora/vaults', VAULTS_API); const vaults = Array.isArray(payload) && payload.length ? payload : FALLBACK_VAULTS.map(address => ({ address })); const results = await Promise.all( - vaults.map(v => fetchVaultBalance(v.address).catch(() => null)) + vaults.map(v => fetchVaultBalance(v.address)) ); for (const r of results) { if (!r || !r.aum || !r.assetDenom) continue; From cc6e0cc311a32794df819bc760fb897af127c82f Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Sun, 1 Nov 2026 07:17:17 -0400 Subject: [PATCH 531/988] fix(townsquare): preserve integer precision in TVL subtraction (#21954) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/townsquare/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/townsquare/index.js b/projects/townsquare/index.js index 6778cd77442..d8f89e7757a 100644 --- a/projects/townsquare/index.js +++ b/projects/townsquare/index.js @@ -43,8 +43,8 @@ const tvl = async ({ api }) => { })) }) ]) - Object.values(pools).forEach((pool, i) => { - api.add(pool, totalDeposit[i].totalAmount - totalBorrowed[i].totalAmount) + Object.values(pools).forEach((pool, index) => { + api.add(pool, (BigInt(totalDeposit[index].totalAmount) - BigInt(totalBorrowed[index].totalAmount)).toString()) }) } From 10e886d1d187a472e86242365062bfb0f4751dcb Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Sun, 1 Nov 2026 07:23:01 -0400 Subject: [PATCH 532/988] fix: avoid double-counting legacy Balancer pool reserves (#21947) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/helper/unwrapLPs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 61b4e0f4699..5f4dc34d6a9 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -1298,7 +1298,7 @@ async function unwrapBalancerToken({ api, chain, block, balancerToken, owner, ba const underlyingTokens = await api.call({ target: underlyingPool, abi: getCurrentTokens, }) - const tempBalances = await sumTokens2({ owner: underlyingPool, tokens: underlyingTokens, api, }) + const tempBalances = await sumTokens2({ owner: underlyingPool, tokens: underlyingTokens, api, balances: {}, }) for (const [token, value] of Object.entries(tempBalances)) { const newValue = BigNumber(value * ratio).toFixed(0) sdk.util.sumSingleBalance(balances, token, newValue) From b9d3675d2bb8eff0b1dddcb1f42580df9523c619 Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Sun, 1 Nov 2026 07:37:12 -0400 Subject: [PATCH 533/988] fix: handle closed Alpha Arcade escrow accounts (#21959) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/alpha-arcade/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/alpha-arcade/index.js b/projects/alpha-arcade/index.js index 1445f0f994b..2852db78b8e 100644 --- a/projects/alpha-arcade/index.js +++ b/projects/alpha-arcade/index.js @@ -58,9 +58,10 @@ async function tvl(api) { }) await PromisePool.withConcurrency(5).for(escrows).handleError(rethrow).process(async (e) => { - const { account } = await get(`/v2/accounts/${getApplicationAddress(e.id)}`) + const { account } = await get(`/v2/accounts/${getApplicationAddress(e.id)}`, { 'include-all': true }) + if (account.deleted) return for (const asset of account.assets ?? []) { - if (!asset.amount) continue + if (asset.deleted || !asset.amount) continue if (String(asset['asset-id']) === USDC) api.add(USDC, asset.amount) else api.add(USDC, Math.floor(asset.amount * (e.price ?? 0) / 1e6)) // YES/NO tokens valued at the order's limit price } From 47f6208b7653ae80c611b2504a248c6160fc5607 Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Sun, 1 Nov 2026 07:42:36 -0400 Subject: [PATCH 534/988] fix: use vault decimals for Stake DAO Yearn claims (#21957) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/stakedao/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/stakedao/index.js b/projects/stakedao/index.js index f80c6283202..1219d79dc9a 100644 --- a/projects/stakedao/index.js +++ b/projects/stakedao/index.js @@ -179,10 +179,11 @@ async function handleStrategies(api, holder, underlying, strats, onlyboost, blac if (yearn.length > 0) { const yearnBalance = await api.multiCall({ abi: "erc20:balanceOf", calls: yearn.map((el) => el.balance) }); const yearnPricePerShare = await api.multiCall({ abi: ABI.pricePerShare, calls: yearn.map((el) => el.vault) }); + const yearnDecimals = await api.multiCall({ abi: "erc20:decimals", calls: yearn.map((el) => el.vault) }); for (let i = 0; i < yearn.length; ++i) { - const tokenBalance = (yearnBalance[i] * yearnPricePerShare[i]) / 1e18; - api.add(yearn[i].token, tokenBalance); + const tokenBalance = BigInt(yearnBalance[i]) * BigInt(yearnPricePerShare[i]) / (10n ** BigInt(yearnDecimals[i])); + api.add(yearn[i].token, tokenBalance.toString()); } } From 00916fbc13fbe00e2b610caee4cdec14373bc108 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 1 Nov 2026 11:45:21 +0000 Subject: [PATCH 535/988] add missing address --- projects/helper/bitcoin-book/fetchers.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/helper/bitcoin-book/fetchers.js b/projects/helper/bitcoin-book/fetchers.js index 38e8bf14e40..ab3f9f10e6f 100644 --- a/projects/helper/bitcoin-book/fetchers.js +++ b/projects/helper/bitcoin-book/fetchers.js @@ -294,7 +294,9 @@ module.exports = { return data.filter(i => i.network === 'BTC').map(item => item.address) } }) - return Array.from(new Set(staticAddresses)) + // listed in Binance PoR snapshot (2026-10-31, Ceffu custody) but missing from the PoR api + const extraAddresses = ['bc1qcpkpym5d3k4pjgz9dwk3xnasefgshd3nq5js0s'] + return Array.from(new Set([...staticAddresses, ...extraAddresses])) }, vishwa: async () => { const staticAddresses = await getConfig('vishwa', undefined, { From 8e2bb97368967853dfe36f1485780677e68008aa Mon Sep 17 00:00:00 2001 From: bheluga Date: Sun, 1 Nov 2026 17:37:10 +0000 Subject: [PATCH 536/988] kpk treasury : add missing positions (#21963) --- utils/scripts/kpkTreasuryIR.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/scripts/kpkTreasuryIR.js b/utils/scripts/kpkTreasuryIR.js index dddb8710301..fb7c8bbd8f5 100644 --- a/utils/scripts/kpkTreasuryIR.js +++ b/utils/scripts/kpkTreasuryIR.js @@ -343,6 +343,7 @@ const CURATED_VAULTS = { "0xb5ce3CA2C774b72955C25875022FdD91f7a7B938": "Morpho", // v2 wARS Yield "0x6251482812cE95d11b3E447FE6888b1a1bE66C25": "Morpho", // v2 EURe Yield "0x7a72bcD2c3F7F7e4D6679170a0625bAB15D7DDa1": "Morpho", // v2 USDC Yield RWA + "0x355A1c6A3f1946d4DbD7cE932492925AB9F261a7": "Morpho", // v2 YO Ecosystem "0x2B47c128b35DDDcB66Ce2FA5B33c95314a7de245": "Euler", // kpk USDC Prime RWA (Euler Earn) "0xB6D6D89ad4b4D61C15a293e28b74f77F6817fF48": "Euler", // kpk ETH Yield Term (Euler Earn) "0x8BcD746976885b5832bAD07B4921E3f2dD1D3703": "Symbiotic", // kpk USDC RWA Liquidity (Symbiotic v2 Liquid Lane) @@ -356,6 +357,7 @@ const CURATED_VAULTS = { arbitrum: { "0x2C609d9CfC9dda2dB5C128B2a665D921ec53579d": "Morpho", // USDC Yield "0x5837e4189819637853a357aF36650902347F5e73": "Morpho", // USDC Yield v2 + "0x7bfdE3A7bd346Da92521D384563F89BB45dE1f60": "Morpho", // v2 EURe Yield }, base: { "0x392B3CCf36C8adB8094F45573346B457414cD752": "Morpho", // v2 USDC Yield @@ -487,6 +489,7 @@ const PROTOCOL_TOKENS = { '0xdA89af5bF2eb0B225d787aBfA9095610f2E79e7D', // Upshift Resolv USR Maxi '0xBC6736d346a5eBC0dEbc997397912CD9b8FAe10a', // Pendle PT-USDe-25SEP2025 '0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b', // syrupUSDC (Maple) + '0x356B8d89c1e1239Cbbb9dE4815c39A1474d5BA7D', // syrupUSDT (Maple) '0xcafeaa466736aC01E0aC9ca72644BeF348694731', // Nexus RWI vault (unpriced, see RECEIPT_VAULTS) '0x9Fb7b4477576Fe5B32be4C1843aFB1e55F251B33', // Fluid fUSDC '0x5C20B550819128074FD538Edf79791733ccEdd18', // Fluid fUSDT @@ -528,6 +531,7 @@ const PROTOCOL_TOKENS = { ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.DAI, ADDRESSES.ethereum.WBTC, + '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c', // EURC (coreAssets has no ethereum EURC) '0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB', // COW '0x6810e776880C02933D47DB1b9fc05908e5386b96', // GNO '0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72', // ENS @@ -605,6 +609,7 @@ const TOKEN_PROTOCOLS = { '0xdA89af5bF2eb0B225d787aBfA9095610f2E79e7D': 'Upshift', // Upshift Resolv USR Maxi '0xBC6736d346a5eBC0dEbc997397912CD9b8FAe10a': 'Pendle', // PT-USDe-25SEP2025 '0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b': 'Maple', // syrupUSDC + '0x356B8d89c1e1239Cbbb9dE4815c39A1474d5BA7D': 'Maple', // syrupUSDT '0x9Fb7b4477576Fe5B32be4C1843aFB1e55F251B33': 'Fluid', // fUSDC '0x5C20B550819128074FD538Edf79791733ccEdd18': 'Fluid', // fUSDT '0x6A29A46E21C730DcA1d8b23d637c101cec605C5B': 'Fluid', // fGHO From 57e83745bd546c4fa8e9e672feebd7eb2fdd1ba4 Mon Sep 17 00:00:00 2001 From: Shan <59776784+shan501@users.noreply.github.com> Date: Mon, 2 Nov 2026 20:36:18 +0800 Subject: [PATCH 537/988] strike-finance: track enzoBTC and aEthUSDC in Ethereum vault (#21977) --- registries/sumTokens.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index c5102f3a7c6..9726dbc5f96 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -26966,7 +26966,9 @@ const configs = { "0xbF4cFccd11257e568A936a7867D138f54A43cffa" ], "tokens": [ - ADDRESSES.ethereum.USDC + ADDRESSES.ethereum.USDC, + "0x6A9A65B84843F5fD4aC9a0471C4fc11AFfFBce4a", // enzoBTC + "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c" // aEthUSDC ] } } From f22e36b27ce00a14ccb9972539c2bf86129de831 Mon Sep 17 00:00:00 2001 From: Kimi <31831349+Uhan19@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:57:14 -0800 Subject: [PATCH 538/988] NAVI Curator: add NAVI vaults on Sui (#21940) --- projects/helper/curators/index.js | 12 ++++++++++++ registries/curators.js | 10 +++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/projects/helper/curators/index.js b/projects/helper/curators/index.js index 6cb4fa19d15..082bc72fe2e 100644 --- a/projects/helper/curators/index.js +++ b/projects/helper/curators/index.js @@ -9,6 +9,7 @@ const kvaultIdl = require('../../gauntlet/kvault-idl.json') const { Program, BN } = require("@project-serum/anchor") const { PublicKey } = require("@solana/web3.js") const { callSoroban } = require('../chain/stellar') +const sui = require('../chain/sui') async function kaminoLendVaultTvl(api, { adminAddress, vaults, blacklistedVaults = [] }) { @@ -646,6 +647,17 @@ async function getCuratorTvl(api, vaults) { return api.getBalances() } + if (api.chain === 'sui') { + // NAVI vaults (navi_vault::Vault), every vault of each package found on-chain by type. + // total_assets is the idle balance plus what the vault supplied to NAVI lending markets. + for (const pkg of vaults.naviVaultPackages ?? []) { + const naviVaults = await sui.getObjectsByType(`${pkg}::navi_vault::Vault`) + naviVaults.forEach(vault => api.add(vault.type.split('<')[1].slice(0, -1), vault.fields.total_assets)) + } + + return api.getBalances() + } + const allVaults = { morpho: vaults.morpho ? vaults.morpho : [], euler: vaults.euler ? vaults.euler : [], diff --git a/registries/curators.js b/registries/curators.js index 662f0242e79..97bb327bf82 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -1791,15 +1791,23 @@ const configs = { }, "navi-curator": { config: { - methodology: "Counts totalAssets() of the Lagoon vaults curated by NAVI Protocol. Deposits are bridged to Sui and supplied to NAVI lending markets through NAVI vaults, so they are also counted under NAVI Lending and Lagoon.", + methodology: "Counts total_assets of the NAVI vaults on Sui (USDC and SUI, Prime and High Yield), found on-chain by their navi_vault::Vault type, and totalAssets() of the Lagoon vaults curated by NAVI Protocol on Ethereum. The NAVI vaults supply into NAVI lending markets, and Lagoon deposits are bridged to Sui and supplied through NAVI vaults, so they are also counted under NAVI Lending and Lagoon.", blockchains: { ethereum: { erc4626: [ '0x47491305479635357df29fe0cb6f1af10e51d4da', // Lagoon: USDC High Yield (nUSDC) ], }, + sui: { + naviVaultPackages: [ + '0x51cecaacaed0bd436f04ebbd8ba0ca1627c9c4d0e54ad28eff095ca78591518c', // navi_vault original package + ], + }, }, }, + _meta: { + timetravel: false, // sui vaults are read at their latest state + }, }, } From a1733379bd9e7a2a40b77f442648ab136ff8901e Mon Sep 17 00:00:00 2001 From: umbra-team-dev Date: Mon, 2 Nov 2026 18:48:08 +0530 Subject: [PATCH 539/988] Umbra Privacy V2: add Robinhood Chain TVL (#21941) Co-authored-by: Pranay Bagde <70632216+PranayBagde@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- projects/umbra-privacy-v2/index.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/projects/umbra-privacy-v2/index.js b/projects/umbra-privacy-v2/index.js index 9fb28c94759..69d600c191f 100644 --- a/projects/umbra-privacy-v2/index.js +++ b/projects/umbra-privacy-v2/index.js @@ -1,10 +1,18 @@ const { sumTokens2 } = require('../helper/solana') +const { sumTokens2: sumEvmTokens, nullAddress } = require('../helper/unwrapLPs') +const { getLogs2 } = require('../helper/cache/getLogs') const TOKEN_VAULT = '2sjnjABJHPEZS8oVdp8nztPBUVUAT7uJawc8eQTMHTfa' const SOL_VAULT = 'BxDCkvgZYRcCAnpywVw5j14AhkXehYvsXoCRiaodUs8s' const UMBRA_MINT = 'PRVT6TB7uss3FrUd2D9xs2zqDBsa3GbMJMwCQsgmeta' +// Robinhood Chain: one contract (an ERC1967 proxy) holds every asset. ETH is held natively, +// since WETH deposits are unwrapped. Which tokens it holds is governance state, replayed from +// AssetAllowanceSet since deployment. +const ROBINHOOD_POOL = '0x1224BE8AE49a1795158AcEC97698E8B122a19740' +const ROBINHOOD_POOL_DEPLOY_BLOCK = 95118358 + async function tvl(api) { return sumTokens2({ api, owner: TOKEN_VAULT, solOwners: [SOL_VAULT], blacklistedTokens: [UMBRA_MINT] }) } @@ -13,9 +21,23 @@ async function staking(api) { return sumTokens2({ api, tokensAndOwners: [[UMBRA_MINT, TOKEN_VAULT]] }) } +async function robinhoodTvl(api) { + const logs = await getLogs2({ + api, + target: ROBINHOOD_POOL, + eventAbi: 'event AssetAllowanceSet(address indexed asset, bool allowed)', + fromBlock: ROBINHOOD_POOL_DEPLOY_BLOCK, + }) + const allowed = new Map() + for (const { asset, allowed: isAllowed } of logs) allowed.set(asset.toLowerCase(), isAllowed) + const tokens = [...allowed].filter(([, isAllowed]) => isAllowed).map(([asset]) => asset) + return sumEvmTokens({ api, owner: ROBINHOOD_POOL, tokens: [nullAddress, ...tokens] }) +} + module.exports = { timetravel: false, methodology: - 'TVL is the sum of the token balances held by the Umbra V2 shielded pool on Solana, read directly from chain state. V2 custodies every SPL token deposit in token accounts owned by a single vault authority, and native SOL deposits as the lamport balance of a single program-owned vault. Nothing is borrowed, lent or rehypothecated by Umbra itself, and Umbra\'s own token is counted under staking where users have deposited it into the pool.', + 'TVL is the sum of the token balances held by the Umbra V2 shielded pools, read directly from chain state. On Solana, V2 custodies every SPL token deposit in token accounts owned by a single vault authority, and native SOL deposits as the lamport balance of a single program-owned vault. On Robinhood Chain, a single pool contract holds every allowed asset, with ETH held natively. Nothing is borrowed, lent or rehypothecated by Umbra itself, and Umbra\'s own token is counted under staking where users have deposited it into the pool.', solana: { tvl, staking }, + robinhood: { tvl: robinhoodTvl }, } From 858a23514d4b2b529ac1a313195e34e0fbf4edf6 Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:44:58 -0400 Subject: [PATCH 540/988] fix: include current Oswap pool base in TVL discovery (#21948) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/oswap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/oswap/index.js b/projects/oswap/index.js index 53959603c52..30eb2a81990 100644 --- a/projects/oswap/index.js +++ b/projects/oswap/index.js @@ -20,7 +20,8 @@ async function tvl(api) { const usdValue = await Promise.all([ fetchBaseAABalances(timestamp, "GS23D3GQNNMNJ5TL4Z5PINZ5626WASMA"), // Oswap v1 fetchBaseAABalances(timestamp, "2JYYNOSRFGLI3TBI4FVSE6GFBUAZTTI3"), // Oswap v2 - fetchBaseAABalances(timestamp, "DYZOJKX4MJOQRAUPX7K6WCEV5STMKOHI") // Oswap v2.1 + fetchBaseAABalances(timestamp, "DYZOJKX4MJOQRAUPX7K6WCEV5STMKOHI"), // Oswap v2.1 + fetchBaseAABalances(timestamp, "MJUMBS56GS7J57O6RGYM6HH7XALHU3DC") ]).then(baseAABalances => { return baseAABalances.reduce(summingBaseAABalancesToTvl(assetMetadata, exchangeRates), 0) }) From fda7fbce50e7db7e559ac556f871e9170eeb66a8 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 2 Nov 2026 10:03:38 -0400 Subject: [PATCH 541/988] Paginate pool discovery for Kumbaya (#21980) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/kumbaya/index.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/projects/kumbaya/index.js b/projects/kumbaya/index.js index d494cc65f9e..19c2cc283ad 100644 --- a/projects/kumbaya/index.js +++ b/projects/kumbaya/index.js @@ -1,18 +1,31 @@ const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') const config = { - megaeth: 'https://exchange.kumbaya.xyz/api/v1/pools/metrics?chainId=4326&limit=500&sortBy=tvl&sortOrder=desc&minTvlETH=0.1' + megaeth: 'https://exchange.kumbaya.xyz/api/v1/pools/metrics?chainId=4326&limit=100&sortBy=tvl&sortOrder=desc&minTvlETH=0.1' } Object.keys(config).forEach(chain => { const poolsEndpoint = config[chain] module.exports[chain] = { tvl: async (api) => { - const { pools } = await getConfig('kumbaya/'+chain, poolsEndpoint) + const { pools } = await getConfig('kumbaya/'+chain+'/paginated', undefined, { + fetcher: async () => { + // pages are sorted by tvl, so a pool can shift across pages between requests: dedup by address + const pools = {} + let offset = 0, page + do { + page = await get(`${poolsEndpoint}&offset=${offset}`) + page.pools.forEach(pool => pools[pool.address.toLowerCase()] = pool) + offset += page.pools.length + } while (page.hasMore && page.pools.length) + return { pools: Object.values(pools) } + } + }) return api.sumTokens({ - ownerTokens: pools.map(i => [[i.token0.address, i.token1.address], i.address]) + ownerTokens: pools.map(pool => [[pool.token0.address, pool.token1.address], pool.address]) }) } } -}) \ No newline at end of file +}) From ca7b2169c76bcfa4d1d10db94c420bc9870c7e7f Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 10:07:33 -0400 Subject: [PATCH 542/988] fix(nado): include deposited spot collateral (#21944) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- registries/sumTokens.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 9726dbc5f96..f9ef390df6f 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -19291,7 +19291,17 @@ const configs = { ADDRESSES.ink.USDT0, ADDRESSES.optimism.WETH_1, ADDRESSES.ink.KBTC, - ADDRESSES.ink.USDC + ADDRESSES.ink.USDC, + "0x4C1AE29c159838fC1b224636E28E086EB69101f7", + "0xE7E553Cd128F0011777323A0b44a7b96EA1CB540", + "0x943BF64D566c32A2Bcd41AC92FB63C111cC9De8f", + "0x910cabdE3EBa7Fc1Ce64fD14bD680b9f60fA0F90", + "0xf8c5308F80E459bb53d9EbE689854d9cBb2Caa6f", + "0xe840946FfEBCd66B7C4E95095effaFaDfa0D0e56", + "0x166Fbe68274b6a47e025F4ba17388c539f1fa1d0", + "0xa8ddb5Cd96b5222AFe198316E9A57CAA642850D5", + "0xc3FdBe3A68EE5dE461D30415a8165cf9Aefe1171", + "0xF50258D3c1dd88946C567920B986A12e65b50dAc" ] }, }, From aa7aa7732738f26a3775bd30f658f26100415e2d Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 10:10:10 -0400 Subject: [PATCH 543/988] fix(k613): use V3 debt balances for borrowed TVL (#21951) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- registries/aave.js | 1 + 1 file changed, 1 insertion(+) diff --git a/registries/aave.js b/registries/aave.js index 3ce61647302..847b59877e9 100644 --- a/registries/aave.js +++ b/registries/aave.js @@ -535,6 +535,7 @@ const aaveConfigs = { }, 'k613': { monad: { + v3: true, dataHelpers: ['0xfc87bE7f3657AAD69baDb6247A88E924D1F8bc53'], }, }, From ae138910c66bf78f3585fbbcb330e3de3a25b65c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:23:22 +0100 Subject: [PATCH 544/988] fix maple --- projects/maple/index.js | 1 + projects/premia-v3/index.js | 1 + projects/premia/index.js | 1 + 3 files changed, 3 insertions(+) diff --git a/projects/maple/index.js b/projects/maple/index.js index 68986d25e46..d112f0b3c90 100644 --- a/projects/maple/index.js +++ b/projects/maple/index.js @@ -164,6 +164,7 @@ module.exports = { // poolMeta.poolCollaterals is not block scoped - the API returns the current collateral for any // block, so backfilling would rewrite history with today's holdings timetravel: false, + doublecounted: true, // we are counting collateral on other chains like bitcoin, these are not smart contracts, so should not be treated as defi tvl. methodology: 'TVL is pool cash and cash deployed in DeFi strategies on Ethereum, plus the loan collateral reported by the Maple API, each collateral asset counted on the chain it is custodied on. Borrowed is the principal outstanding on active loans, staking is the assets held in the stSYRUP vault.', ethereum: { tvl: ethereumTvl, diff --git a/projects/premia-v3/index.js b/projects/premia-v3/index.js index fdc47993139..d9e2a4896e1 100644 --- a/projects/premia-v3/index.js +++ b/projects/premia-v3/index.js @@ -26,6 +26,7 @@ Object.keys(config).forEach(chain => { eventAbi: "event PoolDeployed(address indexed base, address indexed quote, address oracleAdapter, uint256 strike, uint256 maturity, bool isCallPool, address poolAddress)", onlyArgs: true, fromBlock: poolFromBlock, + onlyUseExistingCache: true, }) const ownerTokens = logs.map(log => [[log.base, log.quote], log.poolAddress]) if (vaultGraph) { diff --git a/projects/premia/index.js b/projects/premia/index.js index 182f5f0a23d..71a9b45a3c2 100644 --- a/projects/premia/index.js +++ b/projects/premia/index.js @@ -22,6 +22,7 @@ Object.keys(config).forEach(chain => { eventAbi: 'event DeployPool (address indexed base, address indexed underlying, int128 indexed initialCLevel64x64, address baseOracle, address underlyingOracle, address pool)', onlyArgs: true, fromBlock, + onlyUseExistingCache: true, }) logs.forEach((v) => ownerTokens.push([[v.underlying, v.base], v.pool])) } From 114fd94965f791ba4f7f76b462ddc02d72f69ed4 Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:50:40 +0100 Subject: [PATCH 545/988] stargate-v2: add EURC pool on ethereum and ETH pool on doma (#21952) Co-authored-by: FelixBruguera --- projects/stargatefinance-v2/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/stargatefinance-v2/index.js b/projects/stargatefinance-v2/index.js index 1c7b7298283..33efa1097dc 100644 --- a/projects/stargatefinance-v2/index.js +++ b/projects/stargatefinance-v2/index.js @@ -9,6 +9,7 @@ const CONFIG = { '0x933597a323Eb81cAe705C5bC29985172fd5A3973', '0xcDafB1b2dB43f366E48e6F614b8DCCBFeeFEEcD3', '0x268Ca24DAefF1FaC2ed883c598200CcbB79E931D', + '0x783129E4d7bA0Af0C896c239E57C06DF379aAE8c', // eurc pool ], }, bsc: { @@ -144,6 +145,11 @@ const CONFIG = { '0x0829f361a05d993d5ceb035ca6df3446b060970b' // weth pool ], }, + doma: { + pools: [ + '0x5d46805BBFAcA875a96Ebbd22Aaa3DE4A81180f5', // eth pool + ], + }, } const createTvlFunction = (pools) => { From a5743ec63e944c64e8fab52918d8efe70dd31abc Mon Sep 17 00:00:00 2001 From: Qiu Haoze <168494883+haoze-grvt@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:13:10 +0800 Subject: [PATCH 546/988] grvt-io: count GRVT L1 compartment holdings (#21961) Co-authored-by: Claude Opus 5.5 --- registries/txBridge.js | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/registries/txBridge.js b/registries/txBridge.js index 571537c27ef..c9c15185798 100644 --- a/registries/txBridge.js +++ b/registries/txBridge.js @@ -56,6 +56,34 @@ async function grvtVaultTvl(api) { api.add(tokens, bals) } +// GRVT L1 compartments: one contract per GRVT vault, created by the compartment registry. Each holds funds bridged +// out of GRVT and the receipt tokens of the venues it lends to. Every token is reported at its raw balanceOf and +// priced by DefiLlama; nothing is converted with GRVT's own rates. The holdings reader lists, per compartment, each +// listed venue's receipt token and underlying (delisted venues stay listed until empty). USDC and USDT are added so +// idle funds in a compartment with no venues are counted too. +const GRVT_COMPARTMENT_REGISTRY = '0x55e271ae274BE015Fc46cdf43a2C7C96eF1dFB89' +const GRVT_COMPARTMENT_READER = '0x9D673635b63ca5A550eBb1cA3e0F7765CB434162' +const GRVT_COMPARTMENT_REGISTRY_BLOCK = 26306312 // registry deployment; the first compartment came later +async function grvtCompartmentTvl(api) { + if (await api.getBlock() < GRVT_COMPARTMENT_REGISTRY_BLOCK) return + const count = await api.call({ abi: 'uint256:compartmentCount', target: GRVT_COMPARTMENT_REGISTRY }) + const infos = await api.multiCall({ + abi: 'function compartmentAt(uint256) view returns (address compartment, uint8 entityType, uint256 entityId)', + calls: Array.from({ length: Number(count) }, (_, i) => i), + target: GRVT_COMPARTMENT_REGISTRY, + }) + const compartments = infos.map(i => i.compartment) + const tracked = await api.multiCall({ abi: 'function trackedTokens(address) view returns (address[])', calls: compartments, target: GRVT_COMPARTMENT_READER }) + const tokensAndOwners = compartments.flatMap((owner, i) => + [...new Set([...tracked[i], ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT].map(t => t.toLowerCase()))].map(token => [token, owner])) + await sumTokens2({ api, tokensAndOwners }) +} + +async function grvtL1Tvl(api) { + await grvtVaultTvl(api) + await grvtCompartmentTvl(api) +} + // zkSync-stack (Elastic Chain) forks whose L1 TVL is custodied in the txBridge shared bridge. function txBridgeExportFn(chainConfigs) { const result = {} @@ -79,7 +107,7 @@ const configs = { 'abstract': { ethereum: { chainId: 2741 } }, 'cronos-zk': { ethereum: { chainId: 388 } }, 'zkcandy': { ethereum: { chainId: 320 } }, - 'grvt-io': { ethereum: { chainId: 325, blacklistedTokens: ['0xAD29F2723fcdBcF665F210F25E06f97477e417cF'], extraTvl: grvtVaultTvl } }, + 'grvt-io': { ethereum: { chainId: 325, blacklistedTokens: ['0xAD29F2723fcdBcF665F210F25E06f97477e417cF'], extraTvl: grvtL1Tvl } }, 'lens': { ethereum: { chainId: 232 } }, 'openzk': { ethereum: { chainId: 1345 } }, 'treasure': { ethereum: { chainId: 61166 } }, From a5dcb2bcf6bdb3db05f298aada68a3ff267d809b Mon Sep 17 00:00:00 2001 From: BondAgent002 Date: Mon, 2 Nov 2026 13:03:39 -0300 Subject: [PATCH 547/988] add BOND Capital (#21960) Co-authored-by: BondAgent002 <350922589+BondAgent002@users.noreply.github.com> Co-authored-by: FelixBruguera --- registries/stakingOnly.js | 8 ++++++++ registries/treasury.js | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/registries/stakingOnly.js b/registries/stakingOnly.js index 51eb7363f59..b9e09f0de50 100644 --- a/registries/stakingOnly.js +++ b/registries/stakingOnly.js @@ -1411,6 +1411,14 @@ const configs = { staking: ['0xB078cc304A0B264C5F3680DC0488954ACcd02E87', '0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf'], }, }, + "bond-ceo": { + "methodology": "BOND staked in the BOND staking contract. Pool2 is BOND/USDG liquidity staked in LP staking.", + "start": "2026-10-07", + "robinhood": { + staking: ['0x8b22e1e453ccc7fbb109d3509c48ba81965d838b', '0xeb288e3ca1607e7b921bcb47d5831e88331d65ef'], + pool2: ['0x68349d68660134ec1b2bcaab68423a5792cfd2a7', '0xbe5296539b19da2ce4771f9725e9de1073281015'], + }, + }, "nukes-fun": { "methodology": "NUKE staked in the NUKES.FUN staking contract", "robinhood": { diff --git a/registries/treasury.js b/registries/treasury.js index cacc562aac1..922e327066d 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -4142,6 +4142,20 @@ const configs = { resolveLP: true, }, }, + 'treasury/bond-ceo': { + robinhood: { + owners: [ + '0xa91e7bc98ddc6cfed37e9bf47e627b33adef5b1b', // Treasury + ], + tokens: [ + ADDRESSES.robinhood.USDG, + '0xbe5296539b19da2ce4771f9725e9de1073281015', // BOND/USDG POL + '0xBeEff033F34C046626B8D0A041844C5d1A5409dd', // Steakhouse USDG (ERC-4626) + ], + ownTokens: ['0xeb288e3ca1607e7b921bcb47d5831e88331d65ef'], // BOND + resolveLP: true, + }, + }, 'treasury/nukes-fun': { robinhood: { owners: [ From b961083f8611525f398bd8afa8b0367440eb9367 Mon Sep 17 00:00:00 2001 From: Nullmask Date: Mon, 2 Nov 2026 22:09:07 +0400 Subject: [PATCH 548/988] Nullmask: add Avalanche (#21981) --- registries/sumTokens.js | 1 + registries/treasury.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index f9ef390df6f..f3e16eb7558 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -20779,6 +20779,7 @@ const configs = { base: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null, ADDRESSES.base.USDC] }, bsc: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT] }, robinhood: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null] }, + avax: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null, ADDRESSES.avax.USDC, ADDRESSES.avax.USDt] }, solana: { solOwners: ['xVm2WXtsMh1h41HKgAS2Dymf5ex1GggWbqUeefXUsJg'], // SOL vault of the Nullmask program (Ee6we6Bnbok55FzHfa8fU8td7NDwbKa1qgLehP4iH1Uj) tokenAccounts: [ // coin vaults (CoinAdded events) diff --git a/registries/treasury.js b/registries/treasury.js index 922e327066d..d105a728996 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -4196,6 +4196,10 @@ const configs = { owners: ['0xDD85F4AfDE114dc7c480b012Feaa83152a0C0D09'], // pool treasury(), receives swept protocol fees tokens: [nullAddress], }, + avax: { + owners: ['0xDD85F4AfDE114dc7c480b012Feaa83152a0C0D09'], // pool treasury(), receives swept protocol fees + tokens: [nullAddress, ADDRESSES.avax.USDC, ADDRESSES.avax.USDt], + }, solana: { owners: [ 'GRbpmTbmDeGn8BXHXb1jfEeUT6sGAt7Da44YpWxCS8nr', // ops wallet From 1374a94c38eb82a37a8458397af72fe435996f20 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 2 Nov 2026 14:15:06 -0400 Subject: [PATCH 549/988] move extended spot to arc (#21986) --- projects/extended-spot-orderbook/index.js | 30 +++++++++-------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/projects/extended-spot-orderbook/index.js b/projects/extended-spot-orderbook/index.js index a5551e93014..825c1e6216a 100644 --- a/projects/extended-spot-orderbook/index.js +++ b/projects/extended-spot-orderbook/index.js @@ -1,27 +1,20 @@ const ADDRESSES = require('../helper/coreAssets.json') const { get } = require('../helper/http') const { getConfig } = require('../helper/cache') -const { multiCall } = require('../helper/chain/starknet') const API_URL = 'https://api.starknet.extended.exchange/api/v1' -const USDC = ADDRESSES.starknet.USDC_CIRCLE - -const decimalsAbi = { - name: 'decimals', - type: 'function', - inputs: [], - outputs: [{ name: 'decimals', type: 'felt' }], - stateMutability: 'view', -} +const USDC = ADDRESSES.arc.USDC async function tvl(api) { const { data: markets } = await getConfig('extended-spot-orderbook', `${API_URL}/info/markets`) - const spotMarkets = markets.filter(m => m.type === 'SPOT' && m.active && m.status === 'ACTIVE') + const { data: assets } = await getConfig('extended-spot-orderbook/assets', `${API_URL}/info/assets`) + const arcAddress = Object.fromEntries(assets.filter(a => a.arcAddress).map(a => [a.name, a.arcAddress])) + const spotMarkets = markets.filter(m => m.type === 'SPOT' && m.active && m.status === 'ACTIVE' && arcAddress[m.assetName]) - const tokens = spotMarkets.map(m => m.l2Config.syntheticId) - const decimals = await multiCall({ abi: decimalsAbi, calls: tokens }) + const tokens = spotMarkets.map(m => arcAddress[m.assetName]) + const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) - await Promise.all(spotMarkets.map(async (mkt, i) => { + for (const [i, mkt] of spotMarkets.entries()) { const { data: ob } = await get(`${API_URL}/info/markets/${mkt.name}/orderbook`) const tokenDecimals = Number(decimals[i]) const collateralResolution = Number(mkt.l2Config.collateralResolution) @@ -30,12 +23,13 @@ async function tvl(api) { api.add(USDC, Math.round(bidsUSDC * collateralResolution)) const asksTokens = (ob.ask || []).reduce((s, a) => s + Number(a.qty), 0) - api.add(mkt.l2Config.syntheticId, Math.round(asksTokens * 10 ** tokenDecimals)) - })) + api.add(tokens[i], Math.round(asksTokens * 10 ** tokenDecimals)) + } } module.exports = { timetravel: false, - methodology: 'TVL represents assets locked in limit orders on the Extended spot order book.', - starknet: { tvl }, + methodology: 'TVL represents assets locked in limit orders on the Extended spot order book. Extended settles on Arc since 22 October 2026.', + starknet: { tvl: () => ({}) }, + arc: { tvl }, } From 3f765ab004a907b409f8d5fa8b6149a32e393217 Mon Sep 17 00:00:00 2001 From: INJ_AUTISMO Date: Mon, 2 Nov 2026 20:22:52 +0100 Subject: [PATCH 550/988] fix(injective-orderbook): query native x/exchange module balances and fix protocol attribution (#21964) Co-authored-by: FelixBruguera --- projects/injective-orderbook/index.js | 1 + projects/injective-orderbook/util.js | 66 +++++++++++++++++---------- 2 files changed, 42 insertions(+), 25 deletions(-) diff --git a/projects/injective-orderbook/index.js b/projects/injective-orderbook/index.js index 7a7a4304fd2..5b0cc828e18 100644 --- a/projects/injective-orderbook/index.js +++ b/projects/injective-orderbook/index.js @@ -2,6 +2,7 @@ const { getOrderBookTvl, TYPES } = require('./util') module.exports = { timetravel: false, + methodology: 'TVL is the balance of the Injective exchange module account, which holds all trader deposits and margin for spot and derivatives markets.', injective: { tvl: getOrderBookTvl(TYPES.DERIVATIVES), } diff --git a/projects/injective-orderbook/util.js b/projects/injective-orderbook/util.js index 8a0d89ff562..7cbe05e4b98 100644 --- a/projects/injective-orderbook/util.js +++ b/projects/injective-orderbook/util.js @@ -1,39 +1,55 @@ -const { injective: { getMarkets, getOrders } } = require('../helper/chain/rpcProxy') +const { get } = require('../helper/http'); + +const EXCHANGE_MODULE_ADDRESS = 'inj14vnmw2wee3xtrsqfvpcqg35jg9v7j2vdpzx0kk'; +const LCD_ENDPOINT = 'https://sentry.lcd.injective.network'; const TYPES = { BANK: 'BANK', SPOT: 'SPOT', DERIVATIVES: 'DERIVATIVES', -} +}; function getOrderBookTvl(typeStr) { return async (api) => { - const markets = await getMarkets({ type: typeStr }) - const orders = await getOrders({ type: typeStr, marketIds: markets.map(i => i.marketId) }) - const marketObj = {} - for (const market of markets) - marketObj[market.marketId] = market - - for (const order of orders) marketObj[order.marketId].orderbook = order.orderbook - for (const { quoteDenom, baseDenom, orderbook: { buys, sells, } } of markets) { - for (const { price, quantity } of buys) - api.add(quoteDenom, Math.floor(quantity * price)) - - for (const { quantity } of sells) { - - if (typeStr === TYPES.SPOT) { - api.add(baseDenom, Math.floor(quantity)) - } else if (typeStr === TYPES.DERIVATIVES) { - const price = buys.length ? buys[0].price : 0 - api.add(quoteDenom, Math.floor(quantity * price)) + // Injective's x/exchange module holds a unified balance pool for both spot and derivatives. + // To prevent double-counting, report the full module TVL under the main adapter and return empty for the legacy spot split. + if (typeStr === TYPES.SPOT) { + return api.getBalances(); + } + + let nextKey = ''; + + do { + const url = `${LCD_ENDPOINT}/cosmos/bank/v1beta1/balances/${EXCHANGE_MODULE_ADDRESS}?pagination.limit=200${ + nextKey ? `&pagination.key=${encodeURIComponent(nextKey)}` : '' + }`; + + const res = await get(url); + const balances = res?.balances || []; + + for (const { denom, amount } of balances) { + if (!amount || amount === '0') continue; + + if (denom === 'inj') { + api.addCGToken('injective-protocol', Number(amount) / 1e18); + } else if (denom.startsWith('peggy0x')) { + const ethAddress = denom.replace('peggy', '').toLowerCase(); + api.add(`ethereum:${ethAddress}`, amount, { skipChain: true }); + } else if (denom.startsWith('erc20:0x')) { + api.add(denom.replace('erc20:', ''), amount); + } else { + api.add(denom, amount); } } - } - return api.getBalances() - } + + nextKey = res?.pagination?.next_key; + } while (nextKey); + + return api.getBalances(); + }; } module.exports = { TYPES, - getOrderBookTvl -} \ No newline at end of file + getOrderBookTvl, +}; From 913e367d298c60cbfc63c9e5ec88116e823dd9b1 Mon Sep 17 00:00:00 2001 From: RA-Parity Date: Mon, 2 Nov 2026 14:51:31 -0500 Subject: [PATCH 551/988] exceed-finance: split into exUSDC, exSOL and exBTC listings (#21965) Co-authored-by: Claude Opus 5.5 --- projects/exceed-finance-exbtc/index.js | 8 +++ projects/exceed-finance-exsol/index.js | 8 +++ projects/exceed-finance/helper.js | 67 ++++++++++++++++++++++++ projects/exceed-finance/index.js | 70 ++------------------------ 4 files changed, 87 insertions(+), 66 deletions(-) create mode 100644 projects/exceed-finance-exbtc/index.js create mode 100644 projects/exceed-finance-exsol/index.js create mode 100644 projects/exceed-finance/helper.js diff --git a/projects/exceed-finance-exbtc/index.js b/projects/exceed-finance-exbtc/index.js new file mode 100644 index 00000000000..a882c104ce1 --- /dev/null +++ b/projects/exceed-finance-exbtc/index.js @@ -0,0 +1,8 @@ +const { noteTvl } = require('../exceed-finance/helper') + +// exBTC, Exceed's bitcoin note (base: cbBTC). +module.exports = { + misrepresentedTokens: true, + timetravel: false, + solana: { tvl: noteTvl('exBTC') }, +} diff --git a/projects/exceed-finance-exsol/index.js b/projects/exceed-finance-exsol/index.js new file mode 100644 index 00000000000..989ed750f95 --- /dev/null +++ b/projects/exceed-finance-exsol/index.js @@ -0,0 +1,8 @@ +const { noteTvl } = require('../exceed-finance/helper') + +// exSOL, Exceed's SOL note. +module.exports = { + misrepresentedTokens: true, + timetravel: false, + solana: { tvl: noteTvl('exSOL') }, +} diff --git a/projects/exceed-finance/helper.js b/projects/exceed-finance/helper.js new file mode 100644 index 00000000000..0bff9f05bbc --- /dev/null +++ b/projects/exceed-finance/helper.js @@ -0,0 +1,67 @@ +const { PublicKey } = require('@solana/web3.js') +const { getConnection } = require('../helper/solana') + +// Exceed Finance notes are issued by the Exceed liquid program +// par1tyqusak2f2DXg9RHv78SVHNWXkJLSbtJZQSuWjV. Each pair account stores the +// base token, the receipt token mint and the on-chain exchange rate schedule. +const PAIRS = { + exUSDC: 'EwqMpnBHKEd537E37kcsNU9Qi82uukjVAXsC8K5Kswt7', // base: USDC + exSOL: 'HwsGQqoXwQjGg5CDojLTipmeYFSmovoHtk7ZFtgrxSop', // base: SOL + exBTC: 'GpV9U2yY3L5u4DkWC6Unejsz42iNME4Usk5RzTaA23to', // base: cbBTC +} + +const PRECISION = 10n ** 12n + +function decodePair(data) { + let o = 8 // anchor discriminator + o += 2 // pair bump, lst mint bump + const baseMint = new PublicKey(data.subarray(o, o + 32)).toBase58(); o += 32 + const baseDecimals = data[o]; o += 1 + const lstMint = new PublicKey(data.subarray(o, o + 32)).toBase58(); o += 32 + const lstDecimals = data[o]; o += 1 + const symbolLength = data.readUInt32LE(o); o += 4 + symbolLength + const intervalRate = data.readBigUInt64LE(o); o += 8 + const secondsPerInterval = BigInt(data.readInt32LE(o)); o += 4 + o += 8 // initial exchange rate + const lastRate = data.readBigUInt64LE(o); o += 8 + const lastTimestamp = data.readBigInt64LE(o) + return { baseMint, baseDecimals, lstMint, lstDecimals, intervalRate, secondsPerInterval, lastRate, lastTimestamp } +} + +// Same schedule as the program: compounding per full interval, linear within the current one. +function exchangeRate({ intervalRate, secondsPerInterval, lastRate, lastTimestamp }, now) { + const elapsed = now - lastTimestamp + if (elapsed <= 0n) return lastRate + let periods = elapsed / secondsPerInterval + const remainder = elapsed % secondsPerInterval + let compounded = PRECISION + let factor = intervalRate + while (periods > 0n) { + if (periods & 1n) compounded = compounded * factor / PRECISION + factor = factor * factor / PRECISION + periods >>= 1n + } + const linear = (intervalRate - PRECISION) * remainder / secondsPerInterval + return lastRate * (compounded + linear) / PRECISION +} + +// TVL of one note: receipt token supply times the current exchange rate, in the base token. +function noteTvl(product) { + const address = PAIRS[product] + return async function tvl(api) { + const connection = getConnection() + const info = await connection.getAccountInfo(new PublicKey(address)) + if (!info) throw new Error(`Exceed pair account ${address} not found`) + const now = BigInt(api.timestamp ?? Math.floor(Date.now() / 1000)) + const pair = decodePair(info.data) + const { value } = await connection.getTokenSupply(new PublicKey(pair.lstMint)) + const rate = exchangeRate(pair, now) + let baseAmount = BigInt(value.amount) * rate / PRECISION + const decimalGap = pair.baseDecimals - pair.lstDecimals + if (decimalGap > 0) baseAmount *= 10n ** BigInt(decimalGap) + if (decimalGap < 0) baseAmount /= 10n ** BigInt(-decimalGap) + api.add(pair.baseMint, baseAmount.toString()) + } +} + +module.exports = { noteTvl } diff --git a/projects/exceed-finance/index.js b/projects/exceed-finance/index.js index 0db4ac3314d..470681a551b 100644 --- a/projects/exceed-finance/index.js +++ b/projects/exceed-finance/index.js @@ -1,71 +1,9 @@ -const { PublicKey } = require('@solana/web3.js') -const { getConnection } = require('../helper/solana') - -// Exceed Finance yield-bearing tokens, issued by the Exceed liquid program -// par1tyqusak2f2DXg9RHv78SVHNWXkJLSbtJZQSuWjV. Each pair account stores the -// base token, the receipt token mint and the on-chain exchange rate schedule. -const PAIRS = [ - 'EwqMpnBHKEd537E37kcsNU9Qi82uukjVAXsC8K5Kswt7', // exUSDC (base: USDC) - 'HwsGQqoXwQjGg5CDojLTipmeYFSmovoHtk7ZFtgrxSop', // exSOL (base: SOL) - 'GpV9U2yY3L5u4DkWC6Unejsz42iNME4Usk5RzTaA23to', // exBTC (base: cbBTC) -] - -const PRECISION = 10n ** 12n - -function decodePair(data) { - let o = 8 // anchor discriminator - o += 2 // pair bump, lst mint bump - const baseMint = new PublicKey(data.subarray(o, o + 32)).toBase58(); o += 32 - const baseDecimals = data[o]; o += 1 - const lstMint = new PublicKey(data.subarray(o, o + 32)).toBase58(); o += 32 - const lstDecimals = data[o]; o += 1 - const symbolLength = data.readUInt32LE(o); o += 4 + symbolLength - const intervalRate = data.readBigUInt64LE(o); o += 8 - const secondsPerInterval = BigInt(data.readInt32LE(o)); o += 4 - o += 8 // initial exchange rate - const lastRate = data.readBigUInt64LE(o); o += 8 - const lastTimestamp = data.readBigInt64LE(o) - return { baseMint, baseDecimals, lstMint, lstDecimals, intervalRate, secondsPerInterval, lastRate, lastTimestamp } -} - -// Same schedule as the program: compounding per full interval, linear within the current one. -function exchangeRate({ intervalRate, secondsPerInterval, lastRate, lastTimestamp }, now) { - const elapsed = now - lastTimestamp - if (elapsed <= 0n) return lastRate - let periods = elapsed / secondsPerInterval - const remainder = elapsed % secondsPerInterval - let compounded = PRECISION - let factor = intervalRate - while (periods > 0n) { - if (periods & 1n) compounded = compounded * factor / PRECISION - factor = factor * factor / PRECISION - periods >>= 1n - } - const linear = (intervalRate - PRECISION) * remainder / secondsPerInterval - return lastRate * (compounded + linear) / PRECISION -} - -async function tvl(api) { - const connection = getConnection() - const infos = await connection.getMultipleAccountsInfo(PAIRS.map((p) => new PublicKey(p))) - const now = BigInt(api.timestamp ?? Math.floor(Date.now() / 1000)) - infos.forEach((info, i) => { - if (!info) throw new Error(`Exceed pair account ${PAIRS[i]} not found`) - }) - for (const info of infos) { - const pair = decodePair(info.data) - const { value } = await connection.getTokenSupply(new PublicKey(pair.lstMint)) - const rate = exchangeRate(pair, now) - let baseAmount = BigInt(value.amount) * rate / PRECISION - const decimalGap = pair.baseDecimals - pair.lstDecimals - if (decimalGap > 0) baseAmount *= 10n ** BigInt(decimalGap) - if (decimalGap < 0) baseAmount /= 10n ** BigInt(-decimalGap) - api.add(pair.baseMint, baseAmount.toString()) - } -} +const { noteTvl } = require('./helper') +// exUSDC, Exceed's dollar note. exSOL and exBTC are listed separately +// (exceed-finance-exsol, exceed-finance-exbtc). module.exports = { misrepresentedTokens: true, timetravel: false, - solana: { tvl }, + solana: { tvl: noteTvl('exUSDC') }, } From 851ba2148f8e95b3d54ca06bc4e6e8cc703aa97d Mon Sep 17 00:00:00 2001 From: Shahzaib Sheikh Date: Tue, 3 Nov 2026 03:54:39 +0800 Subject: [PATCH 552/988] add arbitrum support in ember (#21982) --- projects/ember-protocol/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/ember-protocol/index.js b/projects/ember-protocol/index.js index 2f9e598c035..5e59ab2289b 100644 --- a/projects/ember-protocol/index.js +++ b/projects/ember-protocol/index.js @@ -10,6 +10,7 @@ const ETHEREUM_CHAIN_IDENTIFIER = "ethereum"; const PHAROS_CHAIN_IDENTIFIER = "pharos"; const BASE_CHAIN_IDENTIFIER = "base"; const MONAD_CHAIN_IDENTIFIER = "monad"; +const ARBITRUM_CHAIN_IDENTIFIER = "arbitrum"; // there are only one deposit address const blacklistedVaults = [ @@ -74,5 +75,8 @@ module.exports = { }, monad: { tvl: (api) => evmTvl(api, MONAD_CHAIN_IDENTIFIER), + }, + arbitrum: { + tvl: (api) => evmTvl(api, ARBITRUM_CHAIN_IDENTIFIER), } }; From 855f9f785d64d8e37898efb4c557115a61534173 Mon Sep 17 00:00:00 2001 From: Tim Mustafin Date: Mon, 2 Nov 2026 21:06:12 +0100 Subject: [PATCH 553/988] fix(shield-swap): include ZEC in TVL (#21978) --- projects/shield-swap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/shield-swap/index.js b/projects/shield-swap/index.js index 079cb64d107..e507c7c0401 100644 --- a/projects/shield-swap/index.js +++ b/projects/shield-swap/index.js @@ -7,6 +7,7 @@ const TOKENS = [ { program: 'arc20_eth.aleo', coingeckoId: 'ethereum', decimals: 18 }, { program: 'arc20_sol.aleo', coingeckoId: 'solana', decimals: 9 }, { program: 'arc20_wbtc.aleo', coingeckoId: 'bitcoin', decimals: 8 }, + { program: 'shield_swap_arc20_wrapped_zec.aleo', coingeckoId: 'zcash', decimals: 8 }, { program: 'shield_swap_arc20_wrapped_usdcx.aleo', coingeckoId: 'usd-coin', decimals: 6 }, ] @@ -34,6 +35,6 @@ module.exports = { timetravel: false, misrepresentedTokens: true, methodology: - 'TVL is the aggregate balance held by shield_swap.aleo in Shield Swap\'s verified ALEO, ETH, SOL, WBTC, and USDCx token programs, read directly from Aleo chain state. It includes pool capital, accrued fees, and funds awaiting claims.', + 'TVL is the aggregate balance held by shield_swap.aleo in Shield Swap\'s verified ALEO, ETH, SOL, WBTC, ZEC, and USDCx token programs, read directly from Aleo chain state. It includes pool capital, accrued fees, and funds awaiting claims.', aleo: { tvl }, } From bfdc8d20ee6c4130e7aadde2fe6a2563af3981ce Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:11:42 +0100 Subject: [PATCH 554/988] camelot-v4: add Algebra Integral pools on arbitrum (#21985) --- registries/uniswapV3.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 1e3c508a4d3..c8ba21d4335 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1942,6 +1942,11 @@ const uniV3Configs = { start: '2026-10-11', vechain: { factory: '0xc2faf0f48fb7763b28e6f7e415c50b360cc1a096', fromBlock: 26117867 }, }, + 'camelot-v4': { + start: '2025-10-21', // factory deployed at block 391829824 (2025-10-21 10:16 UTC) + methodology: 'Value of the tokens held in the Camelot V4 (Algebra Integral) pools on Arbitrum, discovered from the factory Pool events.', + arbitrum: { factory: '0xBefC4b405041c5833f53412fF997ed2f697a2f37', fromBlock: 391829824, isAlgebra: true }, + }, } module.exports = buildProtocolExports(uniV3Configs, uniV3Export) From 81a57526ad227ee26c90fed22aa2e1dc41fd6810 Mon Sep 17 00:00:00 2001 From: Marinus Protocol Date: Mon, 2 Nov 2026 15:16:31 -0500 Subject: [PATCH 555/988] Marinus: add Sei EVM TVL (lending + smSEI/srSEI) (#21966) Co-authored-by: Cursor Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/marinus/index.js | 34 ++++++++++++++++++++++++++++++++++ registries/deadAdapters.json | 8 -------- 2 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 projects/marinus/index.js diff --git a/projects/marinus/index.js b/projects/marinus/index.js new file mode 100644 index 00000000000..0cf7ef6361e --- /dev/null +++ b/projects/marinus/index.js @@ -0,0 +1,34 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const WSEI = ADDRESSES.sei.WSEI + +// MPool -> underlying +const mPools = { + '0xC9B14f5164E6fE89D71E21D0B7c40Ee7db8367d4': WSEI, // mSEI + '0x9a50eDE5c7db417ebe65107d68Bda6c36c807859': ADDRESSES.sei.USDC_Circle, // mUSDC + '0x14914cA91A6C1d82F03c3fE51B4AAf7d031a37bF': ADDRESSES.sei.USDT0, // mUSDT0 +} + +const stakingPools = [ + '0xcfE179E0A6ca284Ec02E0c8656992c870371Ba03', // smSEI + '0xAa1331C59B8FA07bf17DA828328f11Ae43061513', // srSEI +] + +async function tvl(api) { + await api.sumTokens({ tokensAndOwners: Object.entries(mPools).map(([pool, token]) => [token, pool]) }) + await api.sumTokens({ owners: stakingPools, tokens: [WSEI, ADDRESSES.null] }) + api.addGasToken(await api.multiCall({ abi: 'uint256:totalDelegated', calls: stakingPools })) +} + +async function borrowed(api) { + api.add(Object.values(mPools), await api.multiCall({ abi: 'uint256:totalBorrows', calls: Object.keys(mPools) })) +} + +module.exports = { + methodology: 'TVL counts the underlying tokens held by the Marinus MPools and the SEI in the smSEI and srSEI staking pools (delegated plus liquid). Borrowed is the MPools totalBorrows.', + hallmarks: [ + ['2026-10-20', 'Marinus moves to Sei; Harmony markets retired'], + ], + harmony: { tvl: () => ({}), borrowed: () => ({}) }, + sei: { tvl, borrowed }, +} diff --git a/registries/deadAdapters.json b/registries/deadAdapters.json index d10b711546e..e6686d98785 100644 --- a/registries/deadAdapters.json +++ b/registries/deadAdapters.json @@ -3999,14 +3999,6 @@ }, "deadFrom": "2026-07-17" }, - "marinus": { - "methodology": "TVL is tracked as the underlying liquidity supplied to Marinus mToken markets (mWONE/mUSDC/mUSDT) on Harmony — pool cash plus each pool's lend strategy — and ONE in the Validator and Stablecoin-Reward pools (delegated + WONE + native ONE). Borrowed (totalBorrows) is reported separately.", - "harmony": { - "tvl": "_f", - "borrowed": "_f" - }, - "deadFrom": "2026-09-15" - }, "market.xyz": { "deadFrom": "2023-10-22", "misrepresentedTokens": true, From 700a051c4d0dc7ac83b319dac198dacde95a3336 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 2 Nov 2026 17:11:49 -0400 Subject: [PATCH 556/988] Add accountable monad vault to RockawayX (#21987) Co-authored-by: Raphael Zerbib --- projects/rockawayx/index.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/projects/rockawayx/index.js b/projects/rockawayx/index.js index 2b38fa8c327..07abceeea60 100644 --- a/projects/rockawayx/index.js +++ b/projects/rockawayx/index.js @@ -40,9 +40,13 @@ const LISTA_VAULTS = { ], }; +// fromBlock: strategy deployment block const ACCOUNTABLE_VAULTS = { ethereum: [ - '0x0F0a9d3F0bc6006143c96E6995572b51413CB3c4', // Accountable USDC yield strategy + { strategy: '0x0F0a9d3F0bc6006143c96E6995572b51413CB3c4', fromBlock: 25143624 }, // Accountable USDC yield strategy + ], + monad: [ + { strategy: '0x945dc31B38C811A0188b5b30cF1EA7721666cF7c', fromBlock: 89634915 }, // Tori Ecosystem Monad (metrUSD) ], }; @@ -144,14 +148,18 @@ for (const [chain, vaults] of Object.entries(LISTA_VAULTS)) { }; } -async function accountableTvl(api, strategies) { - // Accountable yield strategies report their NAV (deployed + idle assets) via lastTotalAssets - const assets = await api.multiCall({ abi: 'address:asset', calls: strategies, permitFailure: true }); - const totalAssets = await api.multiCall({ abi: 'uint256:lastTotalAssets', calls: strategies, permitFailure: true }); - for (let i = 0; i < strategies.length; i++) { - if (!assets[i] || totalAssets[i] === null || totalAssets[i] === undefined) continue; - api.add(assets[i], totalAssets[i]); - } +async function accountableTvl(api, entries) { + // the calls below revert before deployment, which would fail the chain's other TVL sources on historical runs + const strategies = entries.filter(({ fromBlock }) => !api.block || api.block >= fromBlock).map(({ strategy }) => strategy); + if (!strategies.length) return; + + // NAV = assets deployed by the strategy + idle assets held by its vault, which matches the vault share price. + // lastTotalAssets is not the NAV: it lags and reads 0 on some strategies. + const assets = await api.multiCall({ abi: 'address:asset', calls: strategies }); + const vaults = await api.multiCall({ abi: 'address:vault', calls: strategies }); + const deployed = await api.multiCall({ abi: 'uint256:deployedAssets', calls: strategies }); + api.add(assets, deployed); + await api.sumTokens({ tokensAndOwners: assets.map((asset, i) => [asset, vaults[i]]) }); } for (const [chain, vaults] of Object.entries(ACCOUNTABLE_VAULTS)) { From 169038f12b2bfe524e6795f37bba0b89dcd065e9 Mon Sep 17 00:00:00 2001 From: 0xfff <125829532+keyuyuan@users.noreply.github.com> Date: Tue, 3 Nov 2026 05:02:53 -0500 Subject: [PATCH 557/988] HedgeHood Stock Yield: add v2.1 funds (Robinhood Chain) and BNB Chain (#21968) Co-authored-by: Claude Opus 5.5 --- projects/hedgehood-stock-yield/index.js | 28 ++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/projects/hedgehood-stock-yield/index.js b/projects/hedgehood-stock-yield/index.js index ca639c9dd99..395cd5c69f4 100644 --- a/projects/hedgehood-stock-yield/index.js +++ b/projects/hedgehood-stock-yield/index.js @@ -2,16 +2,25 @@ const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking') const { sumTokens2 } = require('../helper/unwrapLPs') -// Stock Yield by HedgeHood: weekly covered-call vaults on Robinhood Chain stock tokens. +// Stock Yield by HedgeHood: covered-call vaults on tokenized stocks, on Robinhood Chain and BNB Chain (bStocks). // v1: BrokerEpochVault holds depositors' stock, sells one weekly call against it to a quoted // option buyer and pays the premium out in USDG. Source verified on Sourcify, e.g. // https://sourcify.dev/server/v2/contract/4663/0xe35B7D7bf1212b89478ddAba2946ADEd59BEC0a9 const VAULTS = [ '0xe35B7D7bf1212b89478ddAba2946ADEd59BEC0a9', // NVDA Printer (hNVDA), deployed at block 84792706 ] -// v2: EpochFund strategy funds (covered call, wheel, ...), every one listed in this registry -const V2_REGISTRY = '0x868502F926AE068B61EA9CC55042A9F962651e76' -const V2_REGISTRY_BLOCK = 88943541 // 2026-10-15, registry deployment +// v2: EpochFund strategy funds (covered call, wheel, ...), every one listed in a VaultRegistry, with its deployment block. +// v2.0 (Robinhood Chain, 2026-10-15) is closing (exits only); v2.1 runs on Robinhood Chain (weekly, USDG) and on +// BNB Chain (monthly covered calls on bStocks, USDT) +const V2_REGISTRIES = { + robinhood: [ + ['0x868502F926AE068B61EA9CC55042A9F962651e76', 88943541], // v2.0, 2026-10-15 + ['0xbc2cf782d3530c867157E6b7A7bBe2E0b636cDAf', 103790627], // v2.1, 2026-11-01 + ], + bsc: [ + ['0xC78b6A83d75C5612a1A7323702B56038254a6459', 131164584], // v2.1, 2026-11-02 + ], +} // HEDGE staking: gates v1 deposits; stakers are paid a share of the funds' protocol fee const HEDGE = '0x3f9108a3bECa998C14c6dda822a7e8EaEb88E20D' const HEDGE_STAKING_GATE = '0x48ae41142bb0Ddd18DC49BD659b55207FAcE64d8' @@ -32,8 +41,10 @@ async function v1Tvl(api) { } async function v2Tvl(api) { - if (await api.getBlock() < V2_REGISTRY_BLOCK) return - const funds = await api.call({ abi: 'address[]:vaults', target: V2_REGISTRY }) + const block = await api.getBlock() + const registries = V2_REGISTRIES[api.chain].filter(([, deployed]) => block >= deployed).map(([registry]) => registry) + if (!registries.length) return + const funds = (await api.multiCall({ abi: 'address[]:vaults', calls: registries })).flat() const stocks = await api.multiCall({ abi: 'address:stock', calls: funds }) const usdgs = await api.multiCall({ abi: 'address:usdg', calls: funds }) return sumTokens2({ api, tokensAndOwners: funds.flatMap((fund, i) => [[stocks[i], fund], [usdgs[i], fund]]) }) @@ -46,10 +57,13 @@ async function tvl(api) { module.exports = { methodology: - "TVL counts what depositors own in each Stock Yield vault. v1 vaults are read from managedBalances(): the stock token (active, queued for the next epoch, and redeemed but not yet claimed) plus earned premiums not yet claimed, in USDG. v2 funds, discovered from the v2 VaultRegistry, count the stock token and USDG each fund holds. Staking counts HEDGE staked in the HEDGE staking contract.", + "TVL counts what depositors own in each Stock Yield vault. v1 vaults are read from managedBalances(): the stock token (active, queued for the next epoch, and redeemed but not yet claimed) plus earned premiums not yet claimed, in USDG. v2 funds, discovered from the v2.0 and v2.1 VaultRegistries on Robinhood Chain and the v2.1 VaultRegistry on BNB Chain, count the stock token and the stablecoin (USDG on Robinhood Chain, USDT on BNB Chain) each fund holds. Staking counts HEDGE staked in the HEDGE staking contract.", start: 1791614176, // 2026-10-10 06:36:16 UTC, first vault's deployment block 84792706 robinhood: { tvl, staking: staking(HEDGE_STAKING_GATE, HEDGE), }, + bsc: { + tvl: v2Tvl, + }, } From 7d68cdb1a81500dc5c3d4aca3c6e4487eacbacbc Mon Sep 17 00:00:00 2001 From: Lodestar Date: Tue, 3 Nov 2026 11:14:33 +0100 Subject: [PATCH 558/988] The Cellar: add cKOBAN staking and pool2 (#21976) Co-authored-by: lodestarprotocol <305971687+lodestarprotocol@users.noreply.github.com> --- projects/the-cellar/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/projects/the-cellar/index.js b/projects/the-cellar/index.js index 6dffaf03d59..64d00680172 100644 --- a/projects/the-cellar/index.js +++ b/projects/the-cellar/index.js @@ -1,4 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking') +const { pool2 } = require('../helper/pool2') // DefiLlama TVL adapter for The Cellar by FlareCat (Flare), https://flarecellar.xyz // // Not related to Sommelier, whose vaults are also called "cellars". This is a separate protocol on @@ -21,6 +23,14 @@ const ADDRESSES = require('../helper/coreAssets.json') const JAR = '0xF85d0daCC7e911b1a2800DCF0e6027e0f7481294' +// cKOBAN (since 2026-11-01): KOBAN, the protocol's own points token, wrapped into cKOBAN (verified source, Cask.sol), and +// a farm that stakes the SparkDEX V2 cKOBAN/FXRP LP (CaskFarm.sol). Both are the protocol's own token, so they are +// reported apart from TVL: the KOBAN held by cKOBAN as staking, the staked cKOBAN/FXRP LP as pool2. +const KOBAN = '0xC66E0d44BaC9C58C19083d57c6431BDB405aC027' +const CKOBAN = '0x02B203690B0D9D0A03F28bdf7794D95da01cB68c' +const CKOBAN_FARM = '0x31BF74580AD232220C09829Ec29168a00a877f42' +const CKOBAN_FXRP_LP = '0x9396Bd1b043c1e37adF0d6c32492B44Fc5707928' + async function tvl(api) { const [reserve, denFxrp] = await Promise.all([ api.call({ target: JAR, abi: 'uint256:reserve' }), @@ -34,11 +44,14 @@ module.exports = { methodology: 'TVL is the FXRP held in the Jar contract for users: the reserve that backs fcUSD and Boost plus the FXRP ' + 'owned by Den depositors. fcUSD, Boost, Den shares and KOBAN are claims or points on that same FXRP and are ' + - 'not counted. Fees owed to the treasury (protocolFxrp) are excluded.', + 'not counted. Fees owed to the treasury (protocolFxrp) are excluded. Staking: the KOBAN held by cKOBAN (KOBAN ' + + 'wrapped by its holders). Pool2: the SparkDEX V2 cKOBAN/FXRP LP staked in the cKOBAN farm.', // Jar deploy: 2026-10-26 21:59:28 UTC, block 73048463. A timestamp, not '2026-10-26': at midnight that day the // Jar did not exist yet and the first backfill day would fail. start: 1793051968, flare: { tvl, + staking: staking(CKOBAN, KOBAN), + pool2: pool2(CKOBAN_FARM, CKOBAN_FXRP_LP), }, } From 84ec5f288732f6d92d28d35c7dd1777c48fb1ee7 Mon Sep 17 00:00:00 2001 From: tree Date: Tue, 3 Nov 2026 15:44:35 +0530 Subject: [PATCH 559/988] bitcoin: use Allium daily snapshots for historical refills (#21992) --- projects/helper/chain/bitcoin.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/projects/helper/chain/bitcoin.js b/projects/helper/chain/bitcoin.js index 339a799a25b..7514d090b14 100644 --- a/projects/helper/chain/bitcoin.js +++ b/projects/helper/chain/bitcoin.js @@ -3,6 +3,7 @@ // and are converted to BTC here so `sumTokens` keeps returning whole coins. const sdk = require('@defillama/sdk') const { getUniqueAddresses } = require('../tokenMapping') +const { getEnv } = require('../env') const { utxo } = sdk.chains const CHAIN = 'bitcoin' @@ -30,12 +31,34 @@ async function sumTokens({ balances = {}, owners = [], timestamp, forceCacheUse, } } if (forceCacheUse) throw new Error('timestamp is too old, cant pull with forceCacheUse flag set') + if (!owners.length) return balances + + if (getEnv('ALLIUM_API_KEY')) { + try { + sdk.util.sumSingleBalance(balances, 'bitcoin', await getAlliumBalance(owners, timestamp)) + return balances + } catch (e) { + sdk.log('bitcoin allium error', e.toString()) + } + } for (const addr of owners) sdk.util.sumSingleBalance(balances, 'bitcoin', await getBalance(addr, timestamp)) return balances } +// refills: one Allium end-of-day snapshot query instead of an archive walk per address +async function getAlliumBalance(owners, timestamp) { + const { queryAllium } = require('../allium') + const date = new Date((timestamp - 86400) * 1e3).toISOString().slice(0, 10) + const [{ sats }] = await queryAllium(` + SELECT SUM(raw_balance) AS sats FROM ( + SELECT raw_balance FROM bitcoin.assets.balances_daily + WHERE address IN (${owners.map((a) => `'${a}'`).join(',')}) AND date <= '${date}' + QUALIFY ROW_NUMBER() OVER (PARTITION BY address ORDER BY date DESC) = 1)`) + return utxo.fromBaseUnits(sats ?? 0, DECIMALS) +} + // archive BTC balance (whole coins) at `timestamp` async function getBalance(addr, timestamp) { const sats = await utxo.getBitcoinBalanceAt({ chain: CHAIN, address: addr, timestamp }) From 884590da4092ac341cc656fc467a7aeb29d6f0c4 Mon Sep 17 00:00:00 2001 From: H081 Capital <347924692+uylesss2@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:15:29 +0400 Subject: [PATCH 560/988] feat: add H081 Capital (Solana) (#21984) --- projects/h081/index.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/h081/index.js diff --git a/projects/h081/index.js b/projects/h081/index.js new file mode 100644 index 00000000000..d017c151378 --- /dev/null +++ b/projects/h081/index.js @@ -0,0 +1,42 @@ +// H081 Capital: a private bank for AI agents on Solana (https://h081.xyz). +// Every address is derived at runtime from the program ids and mints; nothing is read from an API. +const { PublicKey } = require("@solana/web3.js"); +const { sumTokensExport } = require("../helper/solana"); + +// Programs (live on Solana mainnet, not audited yet) +const STIPEND_POOL = "E16DKmtrYtYGp7guSso25Pvq8gzKunnUULU28RmRmDGM"; // the bank: shielded deposits +const CAPACITY_STAKE = "CH1rrfFyJMVn158UHL2fLpKTtoLJojrz5f68toMQdQKU"; // H081 staking for relay capacity +const SAFETY_POOL = "HmzKNPn8LaRyjmggt2uT95B7KvphtoVXQkeVc2HHARTt"; // H081 safety pool (loan cover) +const H081 = "EgqxxR7zowzaLEm24oep5qqBieLVAWYX78LhgeqAJAo"; // protocol token + +// Deposit assets the bank accepts (the per-mint vault ["vault", mint] is created by the program's +// initialize / add-asset path). Only these mints are counted: a token account someone else creates +// for the vault authority in another mint is never touched by the program and is not TVL. +const USDG = "2u1tszSeqZ3qBWF3uNGPFc8TzMk2tdiwknnRMWGWjGWH"; // Token-2022, 6 decimals +const DEPOSIT_MINTS = [USDG]; + +const pda = (seeds, programId) => + PublicKey.findProgramAddressSync(seeds, new PublicKey(programId))[0].toBase58(); + +// stipend_pool: PDA ["vault_auth"] owns every per-mint vault (["vault", mint], e.g. the USDG vault +// FaRG7DV8e7XF3RyoZrBb3h1oLiFFWFFCuYDSXsDoyyzG) and every "owed" lender escrow. The helper lists the +// owner's token accounts per accepted mint (getTokenAccountsByOwner with a mint filter), so the PDA +// vault and the escrows of that mint are all counted. +const vaultAuthority = pda([Buffer.from("vault_auth")], STIPEND_POOL); + +// capacity_stake / safety_pool: PDA ["vault", mint] holds the staked / deposited H081. +const capacityVault = pda([Buffer.from("vault"), new PublicKey(H081).toBuffer()], CAPACITY_STAKE); +const safetyVault = pda([Buffer.from("vault"), new PublicKey(H081).toBuffer()], SAFETY_POOL); + +module.exports = { + timetravel: true, + start: "2026-10-31", + methodology: + "TVL is the balance of the accepted deposit assets (USDG today) in the token accounts owned by the stipend_pool vault authority PDA (the bank's deposit vault and lender escrows). " + + "Staking is the H081 held by the capacity_stake and safety_pool vault PDAs (the protocol's own token, reported separately). " + + "Loan principal is paid by the lender directly to the borrower's named account and never passes through the bank vault; only the borrower's pledged deposit (already in the vault) is in TVL, so no borrowed bucket is reported.", + solana: { + tvl: sumTokensExport({ owners: [vaultAuthority], tokens: DEPOSIT_MINTS }), + staking: sumTokensExport({ tokenAccounts: [capacityVault, safetyVault] }), + }, +}; From 942063d5e5a1e2936981aa53a72ab48fa21cbe9f Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 3 Nov 2026 07:27:38 -0400 Subject: [PATCH 561/988] fix zksync txbridge (#21994) --- registries/txBridge.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/registries/txBridge.js b/registries/txBridge.js index c9c15185798..ea90025ff30 100644 --- a/registries/txBridge.js +++ b/registries/txBridge.js @@ -34,15 +34,20 @@ async function txBridgeTvlV2(api, { chainId, target = _targetV2, additionalBridg const tokensWithIds = tokens.filter((_token, i) => assetIds[i]) const assetIdsLegit = assetIds.filter((id) => id) - const balances = (await api.multiCall({ - target, - calls: assetIdsLegit.map(token => ({ params: [chainId, token] })), - abi: 'function chainBalance(uint256 chainId, bytes32 assetId) view returns (uint256 balance)', - permitFailure: true, - })).map(i => i ?? 0) + const chainBalanceAbi = 'function chainBalance(uint256 chainId, bytes32 assetId) view returns (uint256 balance)' + const calls = assetIdsLegit.map(token => ({ params: [chainId, token] })) + const balances = (await api.multiCall({ target, calls, abi: chainBalanceAbi, permitFailure: true })).map(i => i ?? 0) tokensWithIds[0] = gasAddress api.add(tokensWithIds, balances) + // since the Nov 2026 vault upgrade, per-chain balances migrate from the vault to the L1AssetTracker; the migration + // moves the balance, so summing both covers chains before, during and after it + const assetTracker = await api.call({ abi: 'address:l1AssetTracker', target, permitFailure: true }) + if (assetTracker && assetTracker !== gasAddress) { + const trackerBalances = (await api.multiCall({ target: assetTracker, calls, abi: chainBalanceAbi, permitFailure: true })).map(i => i ?? 0) + api.add(tokensWithIds, trackerBalances) + } + for (const bridge of additionalBridges) await txBridgeTvl(api, { chainId, target: bridge }) return api.getBalances() From 66626b3f0bc0e903fd34a39a01c0ccf50872c556 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 3 Nov 2026 09:46:43 -0400 Subject: [PATCH 562/988] add shorthand and chain filter to test.js (#21997) --- README.md | 5 +++++ test.js | 27 ++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0163b44efee..6f6a0b7e39c 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,11 @@ node test.js projects/pangolin/index.js node test.js projects/aave/v3.js 1729080692 # or using YYYY-MM-DD node test.js projects/aave/v3.js 2024-10-16 +# The projects/ prefix is optional +node test.js pangolin +# Add a chain name to only run that chain, it can be combined with a timestamp +node test.js uniswap base +node test.js uniswap base 2024-10-16 ``` ## Changing RPC providers diff --git a/test.js b/test.js index b92c9c736b8..bda606fc732 100644 --- a/test.js +++ b/test.js @@ -9,6 +9,7 @@ process.on('unhandledRejection', handleError) process.on('uncaughtException', handleError) const path = require("path"); +const fs = require("fs"); const { ENV_KEYS } = require("./projects/helper/env"); const { util: { blocks: { getBlocks }, @@ -90,10 +91,14 @@ function mergeBalances(key, storedKeys, balancesObject) { if (process.argv.length < 3) { console.error(`Missing argument, you need to provide the filename of the adapter to test. - Eg: node test.js projects/myadapter.js`); + Eg: node test.js projects/myadapter.js [chain] [timestamp]`); process.exit(1); } let passedFile = path.resolve(process.cwd(), process.argv[2]); +// allow `npm test uniswap-v4` as shorthand for `npm test projects/uniswap-v4` +const projectsFile = path.resolve(__dirname, 'projects', process.argv[2]); +if (!fs.existsSync(passedFile) && (fs.existsSync(projectsFile) || fs.existsSync(projectsFile + '.js'))) + passedFile = projectsFile; const originalCall = sdk.api.abi.call sdk.api.abi.call = async (...args) => { @@ -165,9 +170,25 @@ function validateHallmarks(hallmark) { module.hallmarks.forEach(validateHallmarks) } // await initCache() - const chains = Object.keys(module).filter(item => typeof module[item] === 'object' && !Array.isArray(module[item])); + let chains = Object.keys(module).filter(item => typeof module[item] === 'object' && !Array.isArray(module[item])); checkExportKeys(module, passedFile, chains) + // optional chain filter, in either position: `npm test uniswap-v4 base [timestamp]` + const extraArgs = process.argv.slice(3) + const chainArg = extraArgs.find(arg => chainList.includes(arg)) + const timestampArg = extraArgs.find(arg => arg !== chainArg) + const invalidArgs = extraArgs.filter(arg => arg !== chainArg && parseTimestampArg(arg) === undefined) + if (invalidArgs.length) + throw new Error(`Unrecognized argument: ${invalidArgs.join(', ')}, expected a chain name or a timestamp (unix or YYYY-MM-DD)`) + if (chainArg) { + // registry modules also carry a `meta` object, only drop keys exporting tvl functions + const exportedChains = chains.filter(chain => Object.values(module[chain]).some(v => typeof v === 'function')) + if (!exportedChains.includes(chainArg)) + throw new Error(`Chain ${chainArg} is not exported by this adapter, available chains: ${exportedChains.join(', ')}`) + exportedChains.filter(chain => chain !== chainArg).forEach(chain => delete module[chain]) + chains = chains.filter(chain => !exportedChains.includes(chain) || chain === chainArg) + } + let unixTimestamp = Math.round(Date.now() / 1000) - 60; let chainBlocks = {} @@ -187,7 +208,7 @@ function validateHallmarks(hallmark) { return Math.floor(ms / 1000); } - const passedTimestamp = parseTimestampArg(process.argv[3]); + const passedTimestamp = parseTimestampArg(timestampArg); if (passedTimestamp !== undefined) { unixTimestamp = passedTimestamp From 8b544cf58bb8962d09c6d70769e7ce23e7080f5f Mon Sep 17 00:00:00 2001 From: 0xmariodigital Date: Tue, 3 Nov 2026 09:26:16 -0500 Subject: [PATCH 563/988] Add Stryke RFQ custody TVL and Robinhood SYK staking (#21967) Co-authored-by: FelixBruguera --- projects/stryke-rfq/index.js | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 projects/stryke-rfq/index.js diff --git a/projects/stryke-rfq/index.js b/projects/stryke-rfq/index.js new file mode 100644 index 00000000000..e25b33c41ca --- /dev/null +++ b/projects/stryke-rfq/index.js @@ -0,0 +1,39 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking') + +// Settlement history and position tokens: app.stryke.xyz's public ABI/config and +// api.rfq.stryke.xyz/indexer/portfolio. Only the new RFQ product is included. +const sharedOwners = [ + '0x6f1285fd060259e535c8e7526009d5c6ae247024', + '0x04fab9f0d0f18a8b88bc69b94fdd3d9132318bb9', + '0x2913ba15456e0fc2007e565b33096ca083ed92e3', +] +const robinhoodOwners = [ + ...sharedOwners, + '0x1fa225166e84cade8fb74384622dbdf6cfe55929', + '0x98d43a79815e034e480537c23ea6cef7dfcb9d29', + '0xc53a4248c8d7eab225a921f7d70249375e2132cf', // Original position token from requests(maker,nonce). + '0x9387490e2572bd4ab10aeba7ad45e148803f5d75', + '0xa84548bb2e28ae9279574973171b4f9d47b0669b', + '0x334d303aa7da47289df4111ffd6cef7512631347', + '0xf42e8db59f916749cd323fdf84adb34bf571634d', + '0xe79b0aceb21aa1362d2f5f6f5bbfe8882cf2937a', + '0x3f088bf19f6d04b1fa84ce3bbcf95365f839e110', +] +const stakedSyk = '0x20b2431557bB90954744a6D404f45aD1aD8719f4' +const SYK = '0x97c065eed0309f182777bffa41a9c0027c190df1' +const sykStaking = staking(stakedSyk, SYK) + +module.exports = { + methodology: 'Cash balances in the identified RFQ settlement escrow, option-position and funded-payout contracts. Excludes trader wallets, bridge balances, market-maker external hedges, fee treasury and notional option exposure. Staking counts SYK held by the StakedSYK contract.', + robinhood: { + start: '2026-10-04', + tvl: api => api.sumTokens({ owners: robinhoodOwners, tokens: [ADDRESSES.robinhood.USDG] }), + // StakedSYK was deployed October 8; earlier history has no stake. + staking: api => api.timestamp < 1791469511 ? {} : sykStaking(api), + }, + arbitrum: { + start: '2026-10-30', + tvl: api => api.sumTokens({ owners: sharedOwners, tokens: [ADDRESSES.arbitrum.USDC] }), + }, +} From f0f7f7834dd9ae2602ab4c7374c048aa9e4b48be Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 3 Nov 2026 10:38:42 -0400 Subject: [PATCH 564/988] Add Jitter (#21999) Co-authored-by: 100x-badev <297748082+100x-badev@users.noreply.github.com> --- projects/jitter/index.js | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 projects/jitter/index.js diff --git a/projects/jitter/index.js b/projects/jitter/index.js new file mode 100644 index 00000000000..cc23d9849d8 --- /dev/null +++ b/projects/jitter/index.js @@ -0,0 +1,51 @@ +const sui = require('../helper/chain/sui') +const { normalizeCoinType } = require('@defillama/sdk').chains.sui + +// Original type IDs survive package upgrades; discover all live market vaults. +const SCALLOP_VAULT = '0xe77999674332f5bd078c8d7182002f7bbf7844591f4d36dbfd1182b25ae071c0::scallop_market_vault::ScallopMarketVault' +const HAEDAL_VAULT = '0x4e4f6a5ee9504840a1bd5a9db589782fa44d6d1ce6f4fe45e93c6b664e161ca3::haedal_market_vault::HaedalMarketVault' +const EMBER_VAULT = '0xc56a55893f4791d03726f9c109725765b584c06eb5625704ce782112d763ef99::ember_market_vault::EmberMarketVault' +const HASUI = '0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI' + +async function tvl(api) { + const scallopVaults = await sui.getObjectsByType(SCALLOP_VAULT) + const haedalVaults = await sui.getObjectsByType(HAEDAL_VAULT) + const emberVaults = await sui.getObjectsByType(EMBER_VAULT) + const markets = new Map() + const sheets = new Map() + + for (const { type, fields } of scallopVaults) { + const balance = BigInt(fields.market_coin_balance) + if (balance === 0n) continue + const [underlying] = sui.parseStructTag(type).typeParams + const marketId = fields.scallop_market_id + if (!markets.has(marketId)) markets.set(marketId, await sui.getObject(marketId)) + const tableId = markets.get(marketId).fields.vault.fields.balance_sheets.fields.table.fields.id.id + const coinName = normalizeCoinType(underlying).slice(2) + const key = `${tableId}:${coinName}` + if (!sheets.has(key)) { + const sheet = await sui.getDynamicFieldObject(tableId, coinName, { idType: '0x1::type_name::TypeName' }) + if (!sheet) throw new Error(`Missing Scallop balance sheet: ${underlying}`) + sheets.set(key, sheet.fields.value.fields) + } + const sheet = sheets.get(key) + const netAssets = BigInt(sheet.cash) + BigInt(sheet.debt) - BigInt(sheet.revenue) + const supply = BigInt(sheet.market_coin_supply) + if (netAssets < 0n || supply <= 0n) throw new Error(`Invalid Scallop balance sheet: ${underlying}`) + api.add(underlying, (balance * netAssets / supply).toString()) + } + + // Queued withdrawals remain in these balances until paid; do not add the queue again. + for (const { fields } of haedalVaults) api.add(HASUI, fields.receipt_balance) + for (const { type, fields } of emberVaults) { + const [, receipt] = sui.parseStructTag(type).typeParams + api.add(receipt, fields.receipt_balance) + } +} + +module.exports = { + timetravel: false, + doublecounted: true, + methodology: 'Counts the receipt assets held in Jitter market vaults, including pending withdrawals until paid. Scallop MarketCoin shares are converted using on-chain (cash + debt - revenue) / market_coin_supply. Haedal and Ember receipts are priced as their own tokens. SY, PT, YT, LP and treasury assets are not added separately. The backing assets overlap with Scallop, Haedal and Ember Protocol TVL.', + sui: { tvl }, +} From 8cbdc12c5cad43711f777e5dd592680775b978ff Mon Sep 17 00:00:00 2001 From: AoS Date: Wed, 4 Nov 2026 01:46:30 +1100 Subject: [PATCH 565/988] Add WARs DEX (Supra) (#21971) Co-authored-by: Claude --- projects/wars-dex/index.js | 47 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 projects/wars-dex/index.js diff --git a/projects/wars-dex/index.js b/projects/wars-dex/index.js new file mode 100644 index 00000000000..2954b4a021e --- /dev/null +++ b/projects/wars-dex/index.js @@ -0,0 +1,47 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') +const { invokeViewFunction } = require('../helper/chain/supra') +const { transformBalances } = require('../helper/portedTokens') + +// WARs DEX: constant-product (x*y=k) pools of two fungible assets on Supra. https://dex.supwars.fun +const WARS_DEX = '0xe30a26a598182ea2e7d8b984d261ecca63c595e1c0c8a9b5f8b51b7387ed4c48' +const SUPRA_FA = '0xa' // the SUPRA coin's paired fungible asset, what the pools hold +const PAGE = 100 // pool_list returns at most 100 pools a call +// the dexUSDC fungible asset is the paired FA of the dexUSDC coin, which DefiLlama prices by its coin type +const FA_TO_COIN = { + '0xbb3c1ca1ef67b1a994f2463978695c7bf890710182f75edef05ad08490be3658': ADDRESSES.supra.dexUSDC, +} + +async function getPools() { + const [count] = await invokeViewFunction(`${WARS_DEX}::wars_pool::pool_count`, [], []) + const pools = [] + for (let start = 0; start < Number(count); start += PAGE) { + const [page] = await invokeViewFunction(`${WARS_DEX}::wars_pool::pool_list`, [], [String(start), String(PAGE)]) + pools.push(...page) + } + return pools +} + +// Pools with SUPRA count their SUPRA side twice (the two sides of a constant-product pool are worth the same). +// Pools without SUPRA add both sides as they are, so only tokens DefiLlama can price on its own are counted. +async function tvl(api) { + const balances = {} + const pools = await getPools() + for (const p of pools) { + if (p.asset_a === SUPRA_FA || p.asset_b === SUPRA_FA) { + const supra = BigInt(p.asset_a === SUPRA_FA ? p.reserve_a : p.reserve_b) + if (supra > 0n) sdk.util.sumSingleBalance(balances, ADDRESSES.supra.SUPRA, (supra * 2n).toString()) + } else { + sdk.util.sumSingleBalance(balances, FA_TO_COIN[p.asset_a] || p.asset_a, p.reserve_a) + sdk.util.sumSingleBalance(balances, FA_TO_COIN[p.asset_b] || p.asset_b, p.reserve_b) + } + } + return transformBalances(api.chain, balances) +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: 'TVL is the reserves of every WARs DEX pool, read from the wars_pool::pool_list view. A pool with SUPRA counts its SUPRA reserve twice; a pool without SUPRA counts the tokens DefiLlama prices.', + supra: { tvl }, +} From 1d8e1341979354e1557efc293a6cb782e1c10b19 Mon Sep 17 00:00:00 2001 From: kuzo998 Date: Tue, 3 Nov 2026 17:52:19 +0200 Subject: [PATCH 566/988] fix: disable duplicate shido-dex entry (#21988) Co-authored-by: FelixBruguera --- registries/uniswapV3Graph.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registries/uniswapV3Graph.js b/registries/uniswapV3Graph.js index a6aa2745d46..73c377b9bea 100644 --- a/registries/uniswapV3Graph.js +++ b/registries/uniswapV3Graph.js @@ -42,7 +42,7 @@ const configs = { hyperliquid: { graphURL: 'https://api.goldsky.com/api/public/project_cmb20ryy424yb01wy7zwd7xd1/subgraphs/analytics/v1.0.0/gn', name: 'gliquid-hyperliquid' }, }, 'shido-dex': { - shido: { graphURL: 'https://ljd1t705przomdjt11587.cleavr.xyz/subgraphs/name/shido/mainnet', name: 'shido-dex' }, + shido: null, }, 'physica-finance': { planq: { graphURL: 'https://subgraph.planq.finance/subgraphs/name/ianlapham/uniswap-v3', name: 'physica-v3' }, From fded1d26a175c09907ff1e2a0c4e49b86b0d5867 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 3 Nov 2026 14:19:18 -0400 Subject: [PATCH 567/988] fix uniswap v2 (#22003) --- projects/uniswap-v2/index.js | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/projects/uniswap-v2/index.js b/projects/uniswap-v2/index.js index 8ace61e87e7..f1cc433362f 100644 --- a/projects/uniswap-v2/index.js +++ b/projects/uniswap-v2/index.js @@ -1,13 +1,14 @@ const { getChainTvl } = require('../helper/getUniSubgraphTvl'); -const { get } = require('../helper/http'); const { getUniTVL } = require('../helper/unknownTokens'); -const v2graph = getChainTvl({ ethereum: 'A3Np3RQbaBA6oKJgiwDJeo5T3zrYfGHPWFYayMwtNDum' }) +const v2graph = getChainTvl({ + ethereum: 'GmSczqdCDZ3hJeYY9JphwsADn5rePUzUKm8EZcVuhRAm', + base: 'DbcUmZwXBYbNZvLuDEvcmFa4uAWwwjrdX8dVFg1AUVKa', +}) module.exports = { misrepresentedTokens: true, - methodology: `Counts the tokens locked on AMM pools, pulling the data from the 'ianlapham/uniswapv2' subgraph`, - ethereum: { tvl: v2graph('ethereum') }, + methodology: `Counts the tokens locked on AMM pools. Ethereum and Base use the Uniswap V2 subgraphs, other chains read pool reserves on-chain`, } const config = { @@ -39,24 +40,8 @@ Object.keys(config).forEach(chain => { module.exports.isHeavyProtocol = true -// const graphChains = ['unichain', 'ethereum', 'base'] const graphChains = ['ethereum', 'base'] graphChains.forEach(chain => { - module.exports[chain] = { tvl: tvlViaGraph } + module.exports[chain] = { tvl: v2graph(chain) } }) - -async function tvlViaGraph(api) { - const endpoint = `https://interface.gateway.uniswap.org/v2/uniswap.explore.v1.ExploreStatsService/ProtocolStats?connect=v1&encoding=json&message=%7B%22chainId%22%3A%22${api.chainId}%22%7D` - const res = await get(endpoint, { headers: { 'origin': 'https://app.uniswap.org' }, timeout: 30000 }) - const v2 = res.dailyProtocolTvl.v2 - const oneDayBefore = api.timestamp - 86400 * 5 - const oneDayAfter = api.timestamp + 86400 / 3 - const dayData = v2.find(d => d.timestamp >= oneDayBefore && d.timestamp <= oneDayAfter) - - if (!dayData) { - throw new Error(`No TVL data found for ${api.chain} at timestamp ${api.timestamp}`) - } - const tvl = dayData.value - api.addUSDValue(tvl) -} From 8ef8e34e238cd9df29e245785147bcdf45637bbd Mon Sep 17 00:00:00 2001 From: Perscent <52640714+Perscent@users.noreply.github.com> Date: Wed, 4 Nov 2026 04:10:41 +0900 Subject: [PATCH 568/988] Add SASEUL chain and Lubics bridge TVL adapter (#21975) Co-authored-by: Claude Fable 5.1 Co-authored-by: FelixBruguera --- projects/helper/chain/saseul.js | 48 +++++++++++++++++++++++++++++++++ projects/helper/chains.json | 1 + projects/helper/sumTokens.js | 1 + registries/sumTokens.js | 9 +++++++ 4 files changed, 59 insertions(+) create mode 100644 projects/helper/chain/saseul.js diff --git a/projects/helper/chain/saseul.js b/projects/helper/chain/saseul.js new file mode 100644 index 00000000000..cb52bcdc69f --- /dev/null +++ b/projects/helper/chain/saseul.js @@ -0,0 +1,48 @@ +const sdk = require('@defillama/sdk') +const { get } = require('../http') + +// SASEUL mainnet public nodes (defaults published by the official saseul-js SDK). +// Balance queries do not need a signature: GET /request?request= +const NODES = [ + 'https://main.saseul.net', + 'https://sub.saseul.net', + 'https://aroma.saseul.net', + 'https://blanc.saseul.net', +] +const DECIMALS = 18 +const SL = 'coingecko:saseul' + +async function request(type, params = {}) { + const query = encodeURIComponent(JSON.stringify({ type, ...params })) + let lastError + for (const node of NODES) { + try { + const res = await get(`${node}/request?request=${query}`) + if (res?.code !== 200) throw new Error(`SASEUL node ${node}: ${res?.msg ?? 'bad response'}`) + return res.data + } catch (e) { + lastError = e + } + } + throw lastError +} + +// Native SL balance of an address, in whole coins +async function getBalance(address) { + const data = await request('GetBalance', { address }) + const raw = data?.balance ?? '0' // 18-decimal integer string, null for an unused address + return Number(BigInt(raw) * 1000000n / (10n ** BigInt(DECIMALS))) / 1e6 +} + +async function sumTokens({ balances = {}, owners = [] }) { + for (const owner of owners) { + const amount = await getBalance(owner) + sdk.util.sumSingleBalance(balances, SL, amount) + } + return balances +} + +module.exports = { + sumTokens, + getBalance, +} diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 163d7cf37c2..e6e14b9bc7b 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -436,6 +436,7 @@ "saga", "sanko", "sapphire", + "saseul", "scroll", "secret", "sei", diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index 67e5e296b60..95b9c001131 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -53,6 +53,7 @@ const helpers = { "stellar": require("./chain/stellar"), "aleo": require("./chain/aleo"), "qubic": require("./chain/qubic"), + "saseul": require("./chain/saseul"), "constellation": require("./chain/constellation"), "supra": require("./chain/supra"), "icp": require("./chain/icp"), diff --git a/registries/sumTokens.js b/registries/sumTokens.js index f3e16eb7558..0e81d92e573 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -17628,6 +17628,15 @@ const configs = { } } }, + "lubics": { + "timetravel": false, + "methodology": "TVL is the native SL balance held in the Lubics bridge custody address on the SASEUL main chain, read directly from SASEUL public nodes.", + "saseul": { + "owners": [ + "06e880ad8d3a9a062a9b31e39fd691bbe8cbd92a2b74" + ] + }, + }, "lucky38": { "methodology": "TVL equals the USDC balance held in SharedTreasury — the single liquidity pool backing all six Lucky38 games.", "base": { From f89f5feab59c02f269f0debfccc10156e4df3bc3 Mon Sep 17 00:00:00 2001 From: kuzo998 Date: Tue, 3 Nov 2026 21:31:28 +0200 Subject: [PATCH 569/988] =?UTF-8?q?feat:=20add=20aetherzone=20protocol=20a?= =?UTF-8?q?dapter=20with=20dynamic=20pool=20discovery=20and=E2=80=A6=20(#2?= =?UTF-8?q?1989)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: FelixBruguera --- projects/aetherzone/index.js | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 projects/aetherzone/index.js diff --git a/projects/aetherzone/index.js b/projects/aetherzone/index.js new file mode 100644 index 00000000000..fd66039cf5c --- /dev/null +++ b/projects/aetherzone/index.js @@ -0,0 +1,45 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const TOKENS = [ + "0x8cbaffd9b658997e7bf87e98febf6ea6917166f7", // WSHIDO + "0xeE1Fc22381e6B6bb5ee3bf6B5ec58DF6F5480dF8", // USDC + "0xdB798cF512Af4F7E41AE4Bf4b7f20CDF74Bc21f9", // CWK + "0xa907bE8aEFF41D593dC33A29C0CBAbEbD8beC03B", // CHINA +]; + +const FACTORIES = [ + "0x386bfd9d4f2BC9BCBA56194E776510917570C01C", // AetherStakeFactory V7 + "0x59eE0da93DE70A6bE9C597089Cc01A2a2f499085", // StakePoolFactory V6 +]; + +const PROTOCOL_CONTRACTS = [ + "0xDc812945b24E27BA5DBe17C71329a355Cd575239", // AetherOTC Escrow + "0xECbd5f2dfe7033f2c62E2FfB668b600d96946E20", // AetherLPGauge + "0x4AE8907e183DEfD989adF86529491627DE714B0e", // AetherReserveEscrow + "0xfdF721b2b44dA4e112c8daE16B320D47E63955a8", // AetherFund Pool +]; + +async function tvl(api) { + const pools = []; + for (const target of FACTORIES) { + pools.push(...await api.fetchList({ + lengthAbi: "uint256:poolsCount", + itemAbi: "function allPools(uint256) view returns (address)", + target, + })); + } + const stakedTokens = await api.multiCall({ abi: "address:stakedToken", calls: pools }); + const counterTokens = await api.multiCall({ abi: "address:counterToken", calls: pools }); + + const tokensAndOwners = pools.flatMap((pool, i) => [[stakedTokens[i], pool], [counterTokens[i], pool]]); + PROTOCOL_CONTRACTS.forEach((owner) => TOKENS.forEach((token) => tokensAndOwners.push([token, owner]))); + return sumTokens2({ api, tokensAndOwners }); +} + +module.exports = { + methodology: + "TVL counts the reserves creators bond into AetherZone staking pools (staked and counter tokens of every pool from the V6 and V7 factories), plus tokens held by the AetherOTC escrow, the LP gauge, the reserve escrow and the fund pool. Stakers' Uniswap V3 positions are excluded, as they are Shido Dex V3 liquidity.", + shido: { + tvl, + }, +}; From 16f1fe4adf85fe6e5ec9d6703b60edd604bca6b5 Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:44:53 -0400 Subject: [PATCH 570/988] fix: discover Reserve treasury veAERO positions (#21990) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> Co-authored-by: FelixBruguera --- projects/treasury/reserve.js | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/projects/treasury/reserve.js b/projects/treasury/reserve.js index 6068af45e0a..9adf896fdfe 100644 --- a/projects/treasury/reserve.js +++ b/projects/treasury/reserve.js @@ -1,12 +1,12 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); const { mergeExports } = require('../helper/utils'); +const { unwrapSolidlyVeNft } = require('../helper/unwrapLPs'); const reserveTreasury = "0xC6625129C9df3314a4dd604845488f4bA62F9dB8"; // base const reserveBaseTreasury = "0x6f1D6b86d4ad705385e751e6e88b0FdFDBAdf298"; const AERO = ADDRESSES.base.AERO; const aeroVotingEscrow = "0xebf418fe2512e7e6bd9b87a8f0f294acdc67e6b4"; -const veAEROIds = ["11380", "15026", "19853"]; module.exports = mergeExports([treasuryExports({ ethereum: { @@ -16,22 +16,6 @@ module.exports = mergeExports([treasuryExports({ }, }), { base: { - tvl: async (api) => { - const veAEROHolders = await api.multiCall({ - abi: "function ownerOf(uint256) external view returns (address)", - calls: veAEROIds.map(veAEROId => ({ target: aeroVotingEscrow, params: veAEROId})), - permitFailure: true, - }); - const ownsOfNFT = (address) => address === reserveBaseTreasury; - const baseTreasuryIsOwner = veAEROHolders.some(ownsOfNFT); - if(!baseTreasuryIsOwner) throw new Error("Not a valid treasury for veAERO"); - const lockedAmounts = await api.multiCall({ - abi: "function balanceOfNFT(uint256) external view returns (uint256)", - calls: veAEROIds.map(veAEROId => ({ target: aeroVotingEscrow, params: veAEROId})), - permitFailure: true, - }); - api.add(AERO, lockedAmounts); - return api.getBalances(); - }, + tvl: (api) => unwrapSolidlyVeNft({ api, baseToken: AERO, veNft: aeroVotingEscrow, owner: reserveBaseTreasury }), }, -}]) \ No newline at end of file +}]) From e8541697e3fe8fd7c913b5bd017755c2d994cf93 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 3 Nov 2026 17:00:09 -0400 Subject: [PATCH 571/988] optimize morpho blue (#22007) --- projects/morpho-blue/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/morpho-blue/index.js b/projects/morpho-blue/index.js index 045db4b03f5..54307416ce1 100644 --- a/projects/morpho-blue/index.js +++ b/projects/morpho-blue/index.js @@ -80,8 +80,11 @@ const getMarketsCollateral = async (api, ids) => { const { morphoBlue } = config[api.chain] const collateralById = new Map(ids.map((id) => [id, 0n])) if (!ids.length) return collateralById - const logsByMarket = await Promise.all(ids.map((id) => getMorphoLogs(api, - { eventAbi: eventAbis.supplyCollateral, topics: [supplyCollateralTopic, id], extraKey: `collateral-${id}` }))) + // full-history scans: the indexer serves them in seconds (rpc fallback on chains it lacks) + const logsByMarket = [] + for (const id of ids) + logsByMarket.push(await getMorphoLogs(api, + { eventAbi: eventAbis.supplyCollateral, topics: [supplyCollateralTopic, id], extraKey: `collateral-${id}`, useIndexer: true })) const calls = [] logsByMarket.forEach((logs, i) => { // id comes from the market we queried for, not the log: a provider that widens the topic filter then From b5ffdb694c69ea21b1676ffde30581722b0a4589 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 3 Nov 2026 21:15:39 +0100 Subject: [PATCH 572/988] track pp v2 --- projects/helper/cache/getLogs.js | 24 ------------ projects/privacypools-v2/index.js | 61 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 24 deletions(-) create mode 100644 projects/privacypools-v2/index.js diff --git a/projects/helper/cache/getLogs.js b/projects/helper/cache/getLogs.js index c91db4cc386..25da326194e 100644 --- a/projects/helper/cache/getLogs.js +++ b/projects/helper/cache/getLogs.js @@ -1,7 +1,6 @@ const { getCache, setCache, } = require('../cache'); const sdk = require('@defillama/sdk'); -const { get } = require('../http'); const ethers = require("ethers") const cacheFolder = 'logs' @@ -97,7 +96,6 @@ async function getLogs({ target, } - // let logs = await getLogsFromEtherscanAPI({ address: target, fromBlock, toBlock, api, topic0: topic }) if (!customCacheFunction) cache.logs = cache.logs.concat(logs) @@ -217,25 +215,3 @@ module.exports = { getLogs2, getAddress: s => "0x" + s.slice(26, 66), } - -async function getLogsFromEtherscanAPI({ address, fromBlock, toBlock, api, topic0 }) { - if (!topic0.startsWith('0x')) topic0 = ethers.id(topic0) - const apiKey = process.env.SDK_ETHERSCAN_API_KEY - - const data = await get('https://api.etherscan.io/v2/api', { - params: { - address, - fromBlock, - toBlock, - topic0, - chainid: api.chainId, - module: 'logs', - action: 'getLogs', - page: 1, - offset: 0, - apikey: apiKey, - } - }) - console.log('Etherscan API response:', data.result.length, 'logs fetched') - return data.result -} \ No newline at end of file diff --git a/projects/privacypools-v2/index.js b/projects/privacypools-v2/index.js new file mode 100644 index 00000000000..b5f08b01193 --- /dev/null +++ b/projects/privacypools-v2/index.js @@ -0,0 +1,61 @@ +const { getConfig } = require('../helper/cache') +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs") +const ADDRESSES = require("../helper/coreAssets.json") +const sdk = require('@defillama/sdk') +const providers = require('@defillama/sdk/build/providers.json') + +// Privacy Pools v2 (0xbow): one multi-asset PoolVault per chain holding the native coin and plain ERC20s +// directly. Deployments come from the ASP feed (entrypoint, poolVault, fromBlock per chainId); assets +// enabled on the Entrypoint come from its AssetConfigurationSet logs. +const ENTRYPOINTS_API = 'https://api-v2.0xbow.io/global/public/entrypoints' +// production contracts were deployed deterministically on 2026-09-01; the feed's fromBlock is the first +// deposit, which comes after the AssetConfigurationSet logs, so it cannot be used as the log start +const DEPLOY_TIMESTAMP = Math.floor(Date.parse('2026-09-01T00:00:00Z') / 1000) +const NATIVE = ADDRESSES.GAS_TOKEN_2 + +const abis = { + assetConfigurationSet: 'event AssetConfigurationSet(address indexed _asset, (bool enabled, uint256 minAmount, uint256 vettingFeeBPS, uint256 maxRelayFee) _config)', + assets: 'function assets(address) view returns ((bool enabled, uint256 minAmount, uint256 vettingFeeBPS, uint256 maxRelayFee))', +} + +const chainByChainId = {} +Object.entries(providers).forEach(([chain, { chainId }]) => { if (chainId) chainByChainId[chainId] = chain }) + +async function getPool(chain) { + const { pools } = await getConfig('privacypools-v2', ENTRYPOINTS_API) + return pools.find(pool => chainByChainId[pool.chainId] === chain) +} + +async function tvl(api) { + const pool = await getPool(api.chain) + if (!pool) return {} + const { entrypoint, poolVault } = pool + const fromBlock = await sdk.blocks.getBlockNumber(api.chain, DEPLOY_TIMESTAMP) + + const logs = await getLogs2({ api, target: entrypoint, eventAbi: abis.assetConfigurationSet, fromBlock }) + let assets = [...new Set(logs.map(log => log._asset.toLowerCase()))] + const configs = await api.multiCall({ abi: abis.assets, calls: assets, target: entrypoint }) + assets = assets.filter((_, i) => configs[i].enabled) + + // yield assets (PPYieldToken, ERC4626 over Aave aTokens) hold the underlying aToken themselves, so count + // the wrapper's aToken balance instead of the shares sitting in the PoolVault + const erc20s = assets.filter(a => a !== NATIVE) + const underlyings = await api.multiCall({ abi: 'address:asset', calls: erc20s, permitFailure: true }) + + const tokensAndOwners = [] + if (assets.includes(NATIVE)) tokensAndOwners.push([nullAddress, poolVault]) + erc20s.forEach((token, i) => { + const underlying = underlyings[i] + if (underlying) tokensAndOwners.push([underlying, token]) + else tokensAndOwners.push([token, poolVault]) + }) + return sumTokens2({ api, tokensAndOwners }) +} + +// chains currently listed by the ASP feed +const chains = ['ethereum', 'bsc', 'citrea', 'optimism', 'base', 'arbitrum', 'robinhood'] +chains.forEach(chain => { module.exports[chain] = { tvl } }) + +module.exports.methodology = 'Balances of every asset enabled on the Privacy Pools v2 Entrypoint held by the PoolVault. Deployments are read from the 0xbow ASP entrypoints feed.' +module.exports.start = '2026-09-01' From 8af4763dd04351a015a7210430652ca5f156de6a Mon Sep 17 00:00:00 2001 From: basedshub Date: Wed, 4 Nov 2026 18:22:27 +0530 Subject: [PATCH 573/988] chore: deprecate based-alpha (#22015) Co-authored-by: Shubham Co-authored-by: Claude Opus 5.5 --- registries/sumTokens.js | 1 + 1 file changed, 1 insertion(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 0e81d92e573..8b80c9f9f60 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -1826,6 +1826,7 @@ const configs = { "based-alpha": { "methodology": "TVL is the ETH held by the Launchpad contract, which custodies every live bonding curve's reserves (plus accrued, unclaimed protocol/creator fees and any transient WETH from migrations). Liquidity that has graduated to Based DEX V3 pools is excluded and counted under the DEX.", "start": "2026-07-15", + "deadFrom": "2026-11-04", "robinhood": { "owner": "0x5640c62fe43a64f9ae0811114874e95a819db744", "tokens": [ From 808c8560e91cddd11a84effd52169025b411b9db Mon Sep 17 00:00:00 2001 From: Paveldeg <2934343+Paveldeg@users.noreply.github.com> Date: Wed, 4 Nov 2026 07:22:50 -0600 Subject: [PATCH 574/988] Add VectaSwap (Uniswap V3 fork) on Base and Arbitrum (#22011) Co-authored-by: paveldeg Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- registries/uniswapV3.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index c8ba21d4335..90dad99939d 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1947,6 +1947,10 @@ const uniV3Configs = { methodology: 'Value of the tokens held in the Camelot V4 (Algebra Integral) pools on Arbitrum, discovered from the factory Pool events.', arbitrum: { factory: '0xBefC4b405041c5833f53412fF997ed2f697a2f37', fromBlock: 391829824, isAlgebra: true }, }, + 'vectaswap': { + arbitrum: { factory: '0xe84FA17C2Ea423E0dea3C986EE3E1560D684bb2d', fromBlock: 518470299}, + base: { factory: '0xe84FA17C2Ea423E0dea3C986EE3E1560D684bb2d', fromBlock: 53245146} + } } module.exports = buildProtocolExports(uniV3Configs, uniV3Export) From 46cce01f4ac61747e2218b62f6f394b3e3f38cfb Mon Sep 17 00:00:00 2001 From: thomas <81407403+thomas-cloud579@users.noreply.github.com> Date: Wed, 4 Nov 2026 21:24:33 +0800 Subject: [PATCH 575/988] gateAddNewReserveAddresses (#22010) Co-authored-by: FelixBruguera --- projects/gate-io/index.js | 40 +++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index d2728916307..a30b034f457 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -8,9 +8,16 @@ const { unwrapDolomiteDeposits } = require("../helper/unwrapLPs.js"); const { sumTokens: cosmosSumTokens } = require("../helper/chain/cosmos.js"); const { addThetaBalances } = require("../helper/chain/theta.js"); +// GTBTC is Gate's own BTC-backed token. Gate's wallets hold nearly all of it as +// unissued inventory (99.9% of the Solana supply), and the BTC behind it is +// already counted in Gate's bitcoin wallets, so counting it would count that BTC twice. +const GTBTC_EVM = '0xc2d09cf86b9ff43cb29ef8ddca57a4eb4410d5f3' +const GTBTC_SOLANA = 'gtBTCGWvSRYYoZpU9UZj6i3eUGUpgksXzzsbHk2K9So' + const config = { "ethereum": { ownTokens: ['0xE66747a101bFF2dBA3697199DCcE5b743b454759'], // GT + blacklistedTokens: [GTBTC_EVM], "owners": [ "0x0d0707963952f2fba59dd06f2b425ace40b492fe", "0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c", @@ -142,6 +149,7 @@ const config = { ] }, "bsc": { + blacklistedTokens: [GTBTC_EVM], "owners": [ "0x0d0707963952f2fba59dd06f2b425ace40b492fe", "0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c", @@ -206,10 +214,11 @@ const config = { ] }, "solana": { + blacklistedTokens: [GTBTC_SOLANA], "owners": [ "u6PJ8DtQuPFnfmwHbGFULQ4u4EgjDiyYKjVEsynXq2w", "HiRpdAZifEsZGdzQ5Xo5wcnaH3D2Jj9SoNsUzcYNK78J", - // "CLNEVwuSAiGsvPtE74yLhda4beNfd8qfZXVKkUcAJZDL", + "CLNEVwuSAiGsvPtE74yLhda4beNfd8qfZXVKkUcAJZDL", // "CVMV7614DjSjY114GwHhG1HNFXofceziDpuGz7VjDD5K", "G9XFfWz6adb9wFDKN2v7HfmJDgAc2hirrTwBmca4w26C", // "E2tbmDk29G6jHdrgwHC6kXGFfDsyrXUyWjD3e3ZB4oNp", @@ -230,7 +239,8 @@ const config = { "rNnWmrc1EtNRe5SEQEs9pFibcjhpvAiVKF", "rNu9U5sSouNoFunHp9e9trsLV6pvsSf54z", "rhnS6iYGnrmh8NEgEKq3sBgF4FMLD9dHGf", - "rHJ2fHJvW97WY5X7BTBpXKCaJut8yUPxjd" + "rHJ2fHJvW97WY5X7BTBpXKCaJut8yUPxjd", + "rUCr6r96XPLkyPGyAMSz4Ss6BBBXT3cnKe" ] }, "starknet": { @@ -299,9 +309,9 @@ const config = { }, "polkadot": { "owners": [ - // "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath", - // "16ccyj8JqnP8d2DSaifgek6kSSBAu5cGtd4mu2uXTg4H6mSU", - // "14ooXLY2gmiUTVym9SnKxNwEgcoikXzMEav2kiLjr7pPPHPR", + "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath", + "16ccyj8JqnP8d2DSaifgek6kSSBAu5cGtd4mu2uXTg4H6mSU", + "14ooXLY2gmiUTVym9SnKxNwEgcoikXzMEav2kiLjr7pPPHPR", // "1665ypcQXKmqXtjE9yuWsZqK5MQmBQokFjPGLq5SvoKAWBjQ", // "123tA7zfH9XdqHX5v9W4mB4VfmrjE95yJvdvMbpWv5V851rX", // "15NtvAi8CGHrbaUBvXdki8GXc5YfHM9yTv6HGmaYDetLH2ob", @@ -344,7 +354,8 @@ const config = { }, "0g": { "owners": [ - "0x0d0707963952f2fba59dd06f2b425ace40b492fe" + "0x0d0707963952f2fba59dd06f2b425ace40b492fe", + "0xc882b111a75c0c657fc507c04fbfcd2cc984f071" ] }, "abstract": { @@ -522,7 +533,8 @@ const config = { }, "berachain": { "owners": [ - "0x0d0707963952f2fba59dd06f2b425ace40b492fe" + "0x0d0707963952f2fba59dd06f2b425ace40b492fe", + "0xc882b111a75c0c657fc507c04fbfcd2cc984f071" ] }, "bifrost": { @@ -1008,7 +1020,8 @@ const config = { "owners": [ "f1d7mq36vf6osdhcd32i6k3wyb223mdjlxnafnala", "f1z7izlq5yv2wkrt6ks4fnzscesnd6kntt6vovqai", - "f1pbcpx47wwpb5za2stdz3skfcplmk6zxi7hwv3sy" + "f1pbcpx47wwpb5za2stdz3skfcplmk6zxi7hwv3sy", + "f1cmzppebswhxdvb6ki7rgi6y7xcnjahgxcuy4vua" ] }, "findora": { @@ -1552,7 +1565,8 @@ const config = { }, "plume_mainnet": { "owners": [ - "0x0d0707963952f2fba59dd06f2b425ace40b492fe" + "0x0d0707963952f2fba59dd06f2b425ace40b492fe", + "0xc882b111a75c0c657fc507c04fbfcd2cc984f071" ] }, "pokt": { @@ -1621,7 +1635,7 @@ const config = { }, "ronin": { "owners": [ - // "0x0d0707963952f2fba59dd06f2b425ace40b492fe", + "0x0d0707963952f2fba59dd06f2b425ace40b492fe", // "0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c", // "0xc882b111a75c0c657fc507c04fbfcd2cc984f071", // "0xffeb0f61871acdb4838dfc6d5082f063e738e421" @@ -1682,7 +1696,8 @@ const config = { }, "sonic": { "owners": [ - "0x0d0707963952f2fba59dd06f2b425ace40b492fe" + "0x0d0707963952f2fba59dd06f2b425ace40b492fe", + "0xc882b111a75c0c657fc507c04fbfcd2cc984f071" ] }, // "songbird": { @@ -1711,7 +1726,8 @@ const config = { }, "stable": { "owners": [ - "0x0d0707963952f2fba59dd06f2b425ace40b492fe" + "0x0d0707963952f2fba59dd06f2b425ace40b492fe", + "0xc882b111a75c0c657fc507c04fbfcd2cc984f071" ] }, "starcoin": { From c8c8e983f64bf4d0f2b73d525cc275d58f2fad19 Mon Sep 17 00:00:00 2001 From: 0xfff <125829532+keyuyuan@users.noreply.github.com> Date: Wed, 4 Nov 2026 08:34:26 -0500 Subject: [PATCH 576/988] Add HedgeHood Share Lending on Robinhood (v2.1 market) (#22014) Co-authored-by: leo --- registries/curators.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/registries/curators.js b/registries/curators.js index 97bb327bf82..8c0caa0fcdd 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -1789,6 +1789,18 @@ const configs = { } } }, + "hedgehood-share-lending": { + config: { + methodology: 'Counts USDG deposited in the HedgeHood-curated Morpho Vault V2 (hhUSDG), including assets lent against Stock Yield fund shares. Uses the standard curator accounting and is marked doublecounted because the vault supplies Morpho Blue. Pledged fund shares and their underlying assets are excluded.', + start: 1793674144, // 2026-11-03 02:49:04 UTC, block 104721572: vault moved to the v2.1 market + blockchains: { + robinhood: { + // EOA-deployed and transferred to the HedgeHood Safe; owner discovery would miss it. + morpho: ['0x54Bc097643BB9fd4ab004f11859893655529E954'], // hhUSDG + }, + }, + }, + }, "navi-curator": { config: { methodology: "Counts total_assets of the NAVI vaults on Sui (USDC and SUI, Prime and High Yield), found on-chain by their navi_vault::Vault type, and totalAssets() of the Lagoon vaults curated by NAVI Protocol on Ethereum. The NAVI vaults supply into NAVI lending markets, and Lagoon deposits are bridged to Sui and supplied through NAVI vaults, so they are also counted under NAVI Lending and Lagoon.", From ba3e41475b8c31b5a3cc850e4ef07f6db9358de9 Mon Sep 17 00:00:00 2001 From: Raphael Zerbib <44400280+Sithey@users.noreply.github.com> Date: Wed, 4 Nov 2026 15:37:53 +0200 Subject: [PATCH 577/988] Add RockawayX Reservoir Ecosystem address (#22020) --- projects/rockawayx/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/rockawayx/index.js b/projects/rockawayx/index.js index 07abceeea60..bb143b01f46 100644 --- a/projects/rockawayx/index.js +++ b/projects/rockawayx/index.js @@ -99,6 +99,7 @@ const configs = { pharos: { morpho: [ '0x047cd0a91e9b92ed979189a6c8a120bf280f02e5', // RockawayX USDC (roxUSDC) + '0x1275671ccbff43d9a0676f70c22d99a9328a5842', // RockawayX Reservoir Ecosystem ], }, solana: { From d4d334240a217c5facc3204ac7beeb82d67ac0c2 Mon Sep 17 00:00:00 2001 From: dakakoe Date: Wed, 4 Nov 2026 20:39:27 +0700 Subject: [PATCH 578/988] [update] zERC20 - add v2 TVL (#22009) Co-authored-by: Claude Opus 5.5 --- registries/sumTokens.js | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 8b80c9f9f60..0008843bf6a 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -42077,38 +42077,53 @@ const configs = { }, }, "zerc20": { - "methodology": "TVL is the underlying ETH, USDC, BNB and JPYC held by the zERC20 LiquidityManager contracts, which custody the assets users deposit when wrapping into zETH, zUSDC, zBNB and zJPYC.", + // v2 (October 2026) holds each asset in its zToken contract, at the same address on + // every chain; v1's LiquidityManagers still hold what remains of the original protocol. + // Source: docs.zerc20.io/developers/contracts. Token supply is deliberately not used: + // private transfers strand tokens in burn addresses, so supply runs 2-10x above backing. + "methodology": "TVL is the underlying asset held by zERC20's contracts. In v2, each zToken (zETH, zBNB and zPOL for native coins, plus zUSDC and zJPYC) holds its own backing; the v1 LiquidityManagers still hold what remains of the original protocol. Token supply is not used, because private transfers strand tokens in burn addresses and inflate it.", "ethereum": { "tokensAndOwners": [ - [ADDRESSES.null, "0xcc10b7098fef1ab2f0ff3be91d2a7b3230b90cf0"], // zETH LM - [ADDRESSES.ethereum.USDC, "0x04be137df79be7b5f3314c4a84d1c5e0d99bd477"], // zUSDC LM + [ADDRESSES.null, "0xc544e6df95e76078ae19f11b9f7afaef8ef62d14"], // v2 zETH + [ADDRESSES.ethereum.USDC, "0x421976f8270dca7d3089020c76c672b063bed3b1"], // v2 zUSDC + [ADDRESSES.null, "0xcc10b7098fef1ab2f0ff3be91d2a7b3230b90cf0"], // v1 zETH LM + [ADDRESSES.ethereum.USDC, "0x04be137df79be7b5f3314c4a84d1c5e0d99bd477"], // v1 zUSDC LM ], }, "arbitrum": { "tokensAndOwners": [ - [ADDRESSES.null, "0xcc10b7098fef1ab2f0ff3be91d2a7b3230b90cf0"], // zETH LM - [ADDRESSES.arbitrum.USDC_CIRCLE, "0x04be137df79be7b5f3314c4a84d1c5e0d99bd477"], // zUSDC LM + [ADDRESSES.null, "0xc544e6df95e76078ae19f11b9f7afaef8ef62d14"], // v2 zETH + [ADDRESSES.arbitrum.USDC_CIRCLE, "0x421976f8270dca7d3089020c76c672b063bed3b1"], // v2 zUSDC + [ADDRESSES.null, "0xcc10b7098fef1ab2f0ff3be91d2a7b3230b90cf0"], // v1 zETH LM + [ADDRESSES.arbitrum.USDC_CIRCLE, "0x04be137df79be7b5f3314c4a84d1c5e0d99bd477"], // v1 zUSDC LM ], }, "base": { "tokensAndOwners": [ - [ADDRESSES.null, "0xcc10b7098fef1ab2f0ff3be91d2a7b3230b90cf0"], // zETH LM - [ADDRESSES.base.USDC, "0x04be137df79be7b5f3314c4a84d1c5e0d99bd477"], // zUSDC LM + [ADDRESSES.null, "0xc544e6df95e76078ae19f11b9f7afaef8ef62d14"], // v2 zETH + [ADDRESSES.base.USDC, "0x421976f8270dca7d3089020c76c672b063bed3b1"], // v2 zUSDC + [ADDRESSES.null, "0xcc10b7098fef1ab2f0ff3be91d2a7b3230b90cf0"], // v1 zETH LM + [ADDRESSES.base.USDC, "0x04be137df79be7b5f3314c4a84d1c5e0d99bd477"], // v1 zUSDC LM ], }, "bsc": { "tokensAndOwners": [ - [ADDRESSES.null, "0x39cc069df606c7bc8c79b0add0696bcaf548efd9"], // zBNB LM + [ADDRESSES.null, "0xc544e6df95e76078ae19f11b9f7afaef8ef62d14"], // v2 zBNB + [ADDRESSES.null, "0x39cc069df606c7bc8c79b0add0696bcaf548efd9"], // v1 zBNB LM ], }, "polygon": { "tokensAndOwners": [ - ["0xe7c3d8c9a439fede00d2600032d5db0be71c3c29", "0x12609c3a7a1a212953417c90472cdcf034965a1c"], // JPYC in zJPYC LM + [ADDRESSES.null, "0xc544e6df95e76078ae19f11b9f7afaef8ef62d14"], // v2 zPOL + [ADDRESSES.polygon.USDC_CIRCLE, "0x421976f8270dca7d3089020c76c672b063bed3b1"], // v2 zUSDC + ["0xe7c3d8c9a439fede00d2600032d5db0be71c3c29", "0x6c36c042e7a225898d993192f2679da3bfed1e81"], // JPYC in v2 zJPYC + ["0xe7c3d8c9a439fede00d2600032d5db0be71c3c29", "0x12609c3a7a1a212953417c90472cdcf034965a1c"], // JPYC in v1 zJPYC LM ], }, "klaytn": { + // v1 only: Kaia is not part of v2. "tokensAndOwners": [ - ["0xe7c3d8c9a439fede00d2600032d5db0be71c3c29", "0x12609c3a7a1a212953417c90472cdcf034965a1c"], // JPYC in zJPYC LM (Kaia) + ["0xe7c3d8c9a439fede00d2600032d5db0be71c3c29", "0x12609c3a7a1a212953417c90472cdcf034965a1c"], // JPYC in v1 zJPYC LM (Kaia) ], }, }, From 22f7714857f9177525fce3bae554042568cf6f19 Mon Sep 17 00:00:00 2001 From: Sameer <112821112+im-shell@users.noreply.github.com> Date: Wed, 4 Nov 2026 19:10:41 +0530 Subject: [PATCH 579/988] Add Axcess (#22005) --- projects/axcess/index.js | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 projects/axcess/index.js diff --git a/projects/axcess/index.js b/projects/axcess/index.js new file mode 100644 index 00000000000..6c2bde4b63b --- /dev/null +++ b/projects/axcess/index.js @@ -0,0 +1,43 @@ +// Axcess: dedicated lending vaults for institutional borrowers. Each LoanVault holds one stablecoin, lent to a single +// borrower who draws from the vault and repays into it. Vaults are listed by the VaultFactory. +const config = { + ethereum: { factory: '0xa778c21dcc6010ba95d453e361e0a2f26fd3d7e8', fromBlock: 26125855 }, +} + +const abi = { + vaultCount: 'uint256:vaultCount', + allVaults: 'function allVaults(uint256) view returns (address)', + asset: 'address:asset', + borrowedAmount: 'uint256:borrowedAmount', +} + +async function getVaults(api) { + const { factory, fromBlock } = config[api.chain] + if (await api.getBlock() < fromBlock) return { vaults: [], assets: [] } + const vaults = await api.fetchList({ lengthAbi: abi.vaultCount, itemAbi: abi.allVaults, target: factory }) + const assets = await api.multiCall({ abi: abi.asset, calls: vaults }) + return { vaults, assets } +} + +// Stablecoins held by the vaults: lender deposits not yet drawn, repayments, and cash set aside for funded +// withdrawal requests. +async function tvl(api) { + const { vaults, assets } = await getVaults(api) + return api.sumTokens({ tokensAndOwners2: [assets, vaults] }) +} + +// borrowedAmount() is the principal the borrower has drawn and not yet repaid. +async function borrowed(api) { + const { vaults, assets } = await getVaults(api) + const principal = await api.multiCall({ abi: abi.borrowedAmount, calls: vaults }) + api.add(assets, principal) +} + +module.exports = { + methodology: 'TVL is the stablecoin held in Axcess lending vaults. Principal drawn by borrowers and not yet repaid is reported separately as borrowed.', + start: '2026-10-05', +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl, borrowed } +}) From e29b827dd79d979fcd91233dc7f177bd4fb89ae2 Mon Sep 17 00:00:00 2001 From: freelook <7212860+freelook@users.noreply.github.com> Date: Wed, 4 Nov 2026 14:42:04 +0100 Subject: [PATCH 580/988] feat: add Yield Orders Protocol TVL adapter (#21996) --- projects/yld-cx/index.js | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 projects/yld-cx/index.js diff --git a/projects/yld-cx/index.js b/projects/yld-cx/index.js new file mode 100644 index 00000000000..1d98fd91d86 --- /dev/null +++ b/projects/yld-cx/index.js @@ -0,0 +1,48 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +const YLD = '0x0000014563b23d9ac3ac11fe68d63cdfc19a43db' +const pairCreated = 'event PairCreated(uint256 indexed pairId, address indexed token0, address indexed token1)' + +const startBlocks = { ethereum: 26167740, base: 52457955, robinhood: 85678610 } + +async function tvl(api) { + const block = await api.getBlock() + const fromBlock = startBlocks[api.chain] + if (block < fromBlock) return + + const pairs = await getLogs2({ + api, + target: YLD, + eventAbi: pairCreated, + fromBlock, + toBlock: block, + }) + const tokens = [...new Set(pairs.flatMap(({ token0, token1 }) => [token0.toLowerCase(), token1.toLowerCase()]))] + if (!tokens.length) return + + const [liabilities, fees] = await Promise.all([ + api.multiCall({ target: YLD, abi: 'function tokenLiability(address) view returns (uint256)', calls: tokens }), + api.multiCall({ target: YLD, abi: 'function accruedProtocolFees(address) view returns (uint256)', calls: tokens }), + ]) + + tokens.forEach((token, i) => { + const liability = BigInt(liabilities[i]) + const protocolFees = BigInt(fees[i]) + + if (protocolFees > liability) { + throw new Error(`yld.cx ${api.chain}: fees exceed liability for ${token}`) + } + + if (liability > 0n) { + api.add(token, (liability - protocolFees).toString()) + } + }) +} + +module.exports = { + start: '2026-10-11', + methodology: 'User-owned ERC-20 assets held by Yield Orders: on-chain tokenLiability minus accruedProtocolFees at the snapshot block.', + ethereum: { tvl }, + base: { tvl }, + robinhood: { tvl }, +} From 912a8a204743d5adc24cc3ae21f64f90b57e8706 Mon Sep 17 00:00:00 2001 From: labs-alpha Date: Wed, 4 Nov 2026 14:43:13 +0100 Subject: [PATCH 581/988] Add ALPHA launchpad TVL adapter (#22017) Co-authored-by: labs-alpha <332989026+labs-alpha@users.noreply.github.com> --- projects/alpha-launchpad/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/alpha-launchpad/index.js diff --git a/projects/alpha-launchpad/index.js b/projects/alpha-launchpad/index.js new file mode 100644 index 00000000000..0c6056a1866 --- /dev/null +++ b/projects/alpha-launchpad/index.js @@ -0,0 +1,28 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +const launched = 'event Launched(address indexed market, address indexed token, address indexed creator, address quote, bool nativeAlpha)' + +// LaunchFactory per chain, fromBlock is the factory deployment block +const config = { + robinhood: { factory: '0xD45D538AA6Ab9261A638b9Df83312f823BB368fC', fromBlock: 103445727 }, + base: { factory: '0x7cdd6aCD10144C89B630Bce8b2031d80df57628c', fromBlock: 53375932 }, + bsc: { factory: '0x71abe80C8f08ebE5dac018601170e687ED737AC3', fromBlock: 131062839 }, + ethereum: { factory: '0x2DC4f507BD30c6b5df90B288FaeCDeCE627386Ec', fromBlock: 26320476 }, + arc: { factory: '0x11A5ac5fC2A1e7D4bF61B781b0b784462C2BD9e7', fromBlock: 28998006 }, +} + +async function tvl(api) { + const { factory, fromBlock } = config[api.chain] + const logs = await getLogs2({ api, target: factory, eventAbi: launched, fromBlock }) + // A market's quote balance also holds unsettled fees, so read the curve principal instead + const principals = await api.multiCall({ abi: 'uint256:principal', calls: logs.map(l => l.market) }) + api.add(logs.map(l => l.quote), principals) +} + +module.exports = { + methodology: 'TVL is the pairing asset held as curve principal by each ALPHA bonding-curve market. Markets are read from the factory Launched events. Fees waiting to be settled are excluded. Graduated liquidity sits in Uniswap v4 and is not counted here.', +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) From 76ac1f00f8a6989191e8c3cc389056832252190d Mon Sep 17 00:00:00 2001 From: lulaxiao97-create Date: Wed, 4 Nov 2026 21:43:59 +0800 Subject: [PATCH 582/988] Add Prediction Arena (Base) (#21991) Co-authored-by: lulaxiao97-create --- projects/prediction-arena/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/prediction-arena/index.js diff --git a/projects/prediction-arena/index.js b/projects/prediction-arena/index.js new file mode 100644 index 00000000000..3d290e0a462 --- /dev/null +++ b/projects/prediction-arena/index.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// One immutable arena contract on Base. Every market is a poolId inside it +// (createPool / bet / settle), so there is no factory and nothing to enumerate. +// Live since 2026-11-04: first deposit of 1.00 USDC, so the export is non-zero. +const ARENA = '0x961872d75ea6E7A2859B9b04C6C7B1C73CF510b5' + +module.exports = { + timetravel: true, + misrepresentedTokens: false, + methodology: + 'USDC escrowed by the Prediction Arena contract. Stakes sit in the contract until their pool settles (pari-mutuel payout) or is cancelled (full refund); unclaimed payouts and unclaimed platform fees remain in the same balance.', + base: { + tvl: async (api) => { + const balance = await api.call({ + abi: 'erc20:balanceOf', + target: ADDRESSES.base.USDC, + params: [ARENA], + }) + api.add(ADDRESSES.base.USDC, balance) + }, + }, +} From 5308fab46925fe22ce3974407ba02971dcb4cd0b Mon Sep 17 00:00:00 2001 From: tyler-tsai <15355143+tyler-tsai@users.noreply.github.com> Date: Wed, 4 Nov 2026 21:46:52 +0800 Subject: [PATCH 583/988] lista-rwa: add BPN U Vault TVL (#21973) Co-authored-by: Claude Opus 5.5 --- projects/lista-rwa/index.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/projects/lista-rwa/index.js b/projects/lista-rwa/index.js index f3568cc39f1..2e0bdce2095 100644 --- a/projects/lista-rwa/index.js +++ b/projects/lista-rwa/index.js @@ -5,6 +5,8 @@ const abi = { asset: "address:asset", totalAssets: "uint256:totalAssets", getVaultInfo: "function getVaultInfo() view returns (uint256 maxCapacity, uint256 totalDeposited, uint256 stakingDays)", + totalPrincipal: "uint256:totalPrincipal", + totalPendingWithdraw: "uint256:totalPendingWithdraw", } async function tvl(api) { @@ -26,6 +28,21 @@ async function tvl(api) { } } + // BPN products (BpnEarnPool): deposits are forwarded to the partner through the pool's adapter, + // so the pool holds no cash and has no totalAssets(). Shares are 1:1 with the asset: + // totalPrincipal = shares still earning, totalPendingWithdraw = redemptions requested but not yet claimed. + const bpnProducts = products.filter(p => p.group === 'bpn') + if (bpnProducts.length > 0) { + const bpnContracts = bpnProducts.map(p => getAddress(p.contract)) + const assets = await api.multiCall({ calls: bpnContracts, abi: abi.asset }) + const principals = await api.multiCall({ calls: bpnContracts, abi: abi.totalPrincipal }) + const pendings = await api.multiCall({ calls: bpnContracts, abi: abi.totalPendingWithdraw }) + + for (let i = 0; i < bpnContracts.length; i++) { + api.add(assets[i], BigInt(principals[i]) + BigInt(pendings[i])) + } + } + // Handle Dowsure products (getVaultInfo path) const dowsureProducts = products.filter(p => p.group === 'dowsure') if (dowsureProducts.length > 0) { @@ -51,7 +68,7 @@ async function tvl(api) { } module.exports = { - methodology: "TVL is calculated by summing totalAssets of pool-like RWA products (Centrifuge on BSC, slisXAUE/XAUTStaking on Ethereum) and totalDeposited from Dowsure vault products on BSC. For Dowsure multi-asset vaults, the entire TVL is attributed to the primary asset (first in metadata) since per-asset breakdown is not available on-chain.", + methodology: "TVL is calculated by summing totalAssets of pool-like RWA products (Centrifuge on BSC, slisXAUE/XAUTStaking on Ethereum) totalDeposited from Dowsure vault products on BSC, and totalPrincipal plus pending redemptions from BPN vault products on BSC. For Dowsure multi-asset vaults, the entire TVL is attributed to the primary asset (first in metadata) since per-asset breakdown is not available on-chain.", bsc: { tvl, }, From 89a91564968efeccd6f6c0928fc7456c51dcec4e Mon Sep 17 00:00:00 2001 From: Fiba Nachos <278411537+fibanachos@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:49:44 +0000 Subject: [PATCH 584/988] momoswap: count NFT launchpad payment vaults (#22001) Co-authored-by: Fiba Nachos --- projects/momoswap/index.js | 58 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/projects/momoswap/index.js b/projects/momoswap/index.js index 3e8d28a3263..4143956e914 100644 --- a/projects/momoswap/index.js +++ b/projects/momoswap/index.js @@ -1,5 +1,5 @@ const { PublicKey } = require('@solana/web3.js') -const { getConnection, getTokenAccountBalances } = require('../helper/solana') +const { getConnection, getTokenAccountBalances, getMultipleAccounts } = require('../helper/solana') // MomoSwap launchpad on Cookie Chain. Tokens launch on a bonding curve; // the COOK raised from buyers is held in each pool's `payment_vault` @@ -14,6 +14,23 @@ const { getConnection, getTokenAccountBalances } = require('../helper/solana') // cookieswap adapter's liquidity. const LAUNCHPAD = 'momoL7wu4TrXjnXMLCLzGsbx8Pm7XGgoYo7FVqDoqcw' +// MomoSwap NFT launchpad (`momo_nft_launchpad`): fixed-supply NFT drops sold on the same +// constant-product curve, one `Collection` account per drop. Each drop's COOK sits in a +// `["payment_vault", collection]` PDA owned by the program: +// - Created/Live: the raise, which sells back to the curve walk down again. +// - Graduated: the permanent floor reserve (redeemable by burning an item, never withdrawn +// otherwise), plus escrow for pending post-graduation mint requests and the creator's held-back +// share, released per mint. Nothing migrates to an AMM, so none of it overlaps `cookieswap`. +// - Ended: the raise stays in the vault until holders redeem it through the wind-down. +// The drop's trade fees accrue in two sibling PDAs (`creator_vault`, `platform_vault`); those are +// revenue awaiting claim rather than value locked for users, so they are not counted. +const NFT_LAUNCHPAD = new PublicKey('momoDc2LHwe2Eymo4gK1jg5gAJcjjLGWW1hAaSKAGHb') +// Anchor account discriminator for `Collection` = sha256("account:Collection")[:8]. +const COLLECTION_DISCRIMINATOR_B58 = '98kxUujAHec' // hex 30a0e8cdbfcf1a8d +const TOKEN_PROGRAM = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA' +const SYSTEM_PROGRAM = '11111111111111111111111111111111' +const SPL_TOKEN_ACCOUNT_SIZE = 165 + // Anchor account discriminator for `Pool` = sha256("account:Pool")[:8]. const POOL_DISCRIMINATOR_HEX = 'f19a6d0411b16dbc' const POOL_DISCRIMINATOR_B58 = 'hQrXeCntzbV' // base58 of the 8 discriminator bytes, for the memcmp filter @@ -53,8 +70,45 @@ function parsePool(data) { return new PublicKey(data.subarray(paymentVaultOffset, paymentVaultOffset + 32)).toBase58() } +// Vault pubkeys are derived from the `Collection` pubkey alone (the PDA seeds), so this never +// depends on the `Collection` byte layout and survives the kind of struct reorder that broke +// `parsePool` above. `dataSlice` length 0: only the pubkeys are needed. +async function nftPaymentVaults(connection) { + const accounts = await connection.getProgramAccounts(NFT_LAUNCHPAD, { + filters: [{ memcmp: { offset: 0, bytes: COLLECTION_DISCRIMINATOR_B58 } }], + dataSlice: { offset: 0, length: 0 }, + }) + return accounts.map(({ pubkey }) => + PublicKey.findProgramAddressSync([Buffer.from('payment_vault'), pubkey.toBuffer()], NFT_LAUNCHPAD)[0].toBase58(), + ) +} + +async function nftTvl(api, connection) { + const vaults = await nftPaymentVaults(connection) + if (!vaults.length) return + // `init_vaults` is a separate, permissionless instruction from `create_collection` (the creation + // transaction is already at the size limit), so a `Collection` can in principle exist before its + // vaults do. A missing vault is therefore a legitimate empty drop, not an error, and is skipped — + // but a vault that exists and is not an SPL token account means layout or RPC trouble and throws, + // same fail-loud stance as the token side. The program never closes a vault (its only + // `CloseAccount` is on an ephemeral unwrap PDA), so a drained vault stays readable at 0. + const infos = await getMultipleAccounts(vaults, { api }) + infos.forEach((info, i) => { + if (!info) return + const data = info.data + // Lamports sent to the PDA before `init_vaults` make it a System-owned, zero-data account rather + // than a missing one; it holds no COOK, so it is empty for our purposes, not malformed. + if (info.owner.toBase58() === SYSTEM_PROGRAM && data.length === 0) return + if (info.owner.toBase58() !== TOKEN_PROGRAM || data.length !== SPL_TOKEN_ACCOUNT_SIZE) + throw new Error(`Unrecognised MomoSwap NFT payment_vault: ${vaults[i]}`) + const mint = new PublicKey(data.subarray(0, 32)).toBase58() + api.add(mint, data.readBigUInt64LE(64).toString()) + }) +} + async function tvl(api) { const connection = getConnection(api.chain) + await nftTvl(api, connection) const accounts = await connection.getProgramAccounts(new PublicKey(LAUNCHPAD), { filters: [{ memcmp: { offset: 0, bytes: POOL_DISCRIMINATOR_B58 } }], }) @@ -86,6 +140,6 @@ async function tvl(api) { module.exports = { timetravel: false, - methodology: 'Counts the COOK held in the payment vault of every MomoSwap bonding-curve launch: launches still raising on the curve, expired launches whose raised COOK stays in the vault until participants claim it, and the unvested creator allocation that graduation withholds from the AMM migration and releases to the creator over time.', + methodology: 'Counts the COOK held in the payment vault of every MomoSwap bonding-curve launch: launches still raising on the curve, expired launches whose raised COOK stays in the vault until participants claim it, and the unvested creator allocation that graduation withholds from the AMM migration and releases to the creator over time. Also counts the COOK in the payment vault of every MomoSwap NFT drop: the live raise, the permanent floor reserve locked at graduation, escrow for pending post-graduation mints, and the raise of ended drops awaiting wind-down redemption.', cookiechain: { tvl }, } From d449bceadc2cda41a658e44736c6ac5856f1da21 Mon Sep 17 00:00:00 2001 From: 0xmariodigital Date: Wed, 4 Nov 2026 09:15:17 -0500 Subject: [PATCH 585/988] [feat] Stryke CLAMM - add current TVL on Robinhood and Arbitrum (#22008) Co-authored-by: FelixBruguera --- projects/dopex-clamm/index.js | 58 +++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/projects/dopex-clamm/index.js b/projects/dopex-clamm/index.js index 2dd352a13ce..867283be719 100644 --- a/projects/dopex-clamm/index.js +++ b/projects/dopex-clamm/index.js @@ -1,4 +1,7 @@ const { gql, request } = require("graphql-request"); +const { getLogs } = require('../helper/cache/getLogs') +const { addUniV3LikePosition } = require('../helper/unwrapLPs') +const { solidityPackedKeccak256 } = require('ethers') const CONFIG = { arbitrum: 'https://api.0xgraph.xyz/api/public/e2146f32-5728-4755-b1d1-84d17708c119/subgraphs/clamm-arbitrum/prod/gn', @@ -8,6 +11,21 @@ const CONFIG = { mantle: 'https://api.0xgraph.xyz/api/public/e2146f32-5728-4755-b1d1-84d17708c119/subgraphs/clamm-mantle/prod/gn' } +// Current CLAMM markets (https://clamm.stryke.xyz/en/earn), read from chain: option +// markets registered on the FeeStrategy, and the pool positions their handlers mint +const CURRENT = { + robinhood: { + feeStrategy: '0x56b8221882e4707f998f3e9717fbdfde628ed1b2', fromBlock: 65228887, + handlers: [['0x67599652ec14f635837929b4c08b1adc10f83300', 65228887], ['0x02a81b0eb603d1e228c4f3e5ed756e8b6ee64f11', 68671942]], + }, + arbitrum: { + feeStrategy: '0x11d27d84e21dc88eb8c8aef3a1f9b869b5f95a87', fromBlock: 379445413, + handlers: [['0x6f73afb6598d7a3881577f884f2e01574aefc373', 379716358]], + }, +} + +const mintEvent = 'event LogMintPositionHandler((address pool,address hook,int24 tickLower,int24 tickUpper,uint128 liquidity) params,address context,uint256 amount0,uint256 amount1)' + const abi = "function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)"; const query = gql` @@ -72,6 +90,39 @@ function addV3PositionBalances(strike, sqrtPricesMap) { return { token0, amount0, token1, amount1 }; } +async function currentTvl(api) { + const { feeStrategy, fromBlock, handlers } = CURRENT[api.chain] + const block = await api.getBlock() + if (block < fromBlock) return + const markets = await getLogs({ api, target: feeStrategy, fromBlock, eventAbi: 'event OptionMarketRegistered(address optionMarket)', onlyArgs: true }).then(l => [...new Set(l.map(i => i.optionMarket))]) + const pools = new Set((await api.multiCall({ abi: 'address:primePool', calls: markets })).map(p => p.toLowerCase())) + const callAssets = await api.multiCall({ abi: 'address:callAsset', calls: markets }) + const putAssets = await api.multiCall({ abi: 'address:putAsset', calls: markets }) + + // each handler owns one pool position per tick range, shared by all hooks + const positions = {} + for (const [handler, handlerFromBlock] of handlers) { + if (block < handlerFromBlock) continue + const logs = await getLogs({ api, target: handler, fromBlock: handlerFromBlock, eventAbi: mintEvent, onlyArgs: true }) + logs.filter(({ params: p }) => pools.has(p.pool.toLowerCase())).forEach(({ params: p }) => { + const key = solidityPackedKeccak256(['address', 'int24', 'int24'], [handler, p.tickLower, p.tickUpper]) + positions[p.pool.toLowerCase() + key] = { pool: p.pool, key, tickLower: Number(p.tickLower), tickUpper: Number(p.tickUpper) } + }) + } + const rows = Object.values(positions) + const uniquePools = [...new Set(rows.map(p => p.pool))] + const liquidity = await api.multiCall({ abi: 'function positions(bytes32) view returns (uint128 liquidity)', calls: rows.map(p => ({ target: p.pool, params: [p.key] })) }) + const slot0 = await api.multiCall({ abi: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick)', calls: uniquePools }) + const token0 = await api.multiCall({ abi: 'address:token0', calls: uniquePools }) + const token1 = await api.multiCall({ abi: 'address:token1', calls: uniquePools }) + rows.forEach((p, i) => { + const j = uniquePools.indexOf(p.pool) + addUniV3LikePosition({ api, token0: token0[j], token1: token1[j], liquidity: Number(liquidity[i]), tickLower: p.tickLower, tickUpper: p.tickUpper, tick: Number(slot0[j].tick) }) + }) + // option markets hold the liquidity taken out of the pools for open options + return api.sumTokens({ ownerTokens: markets.map((m, i) => [[callAssets[i], putAssets[i]], m]) }) +} + const tvl = async (api) => { const chain = api.chain if (chain === 'base' || chain === 'mantle' || chain === 'blast' || chain === 'sonic') return @@ -91,13 +142,16 @@ const tvl = async (api) => { api.add(token0, amount0); api.add(token1, amount1); }); + if (CURRENT[chain]) await currentTvl(api) }; module.exports = { doublecounted: true, // tokens are stored in UNI-V3 pools, - methodology: 'TVL is calculated by summing the value of all tokens in Stryke liquidity positions across supported chains' + methodology: 'Value of Stryke liquidity positions across supported chains. Current Robinhood and Arbitrum markets count the AMM positions owned by their handlers, plus assets held by registered option markets. The underlying LP assets overlap with their AMM listings.' } Object.keys(CONFIG).forEach((chain) => { module.exports[chain] = { tvl } -}) \ No newline at end of file +}) + +module.exports.robinhood = { start: '2026-09-17', tvl: currentTvl } From f3d56a7c59750553079f51c427ddd3ef21ef2370 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 4 Nov 2026 14:33:34 +0000 Subject: [PATCH 586/988] Coinlotto string abi (#22023) --- projects/coinlotto/index.js | 34 ++++++++++++++++++++++++++++++++++ registries/sumTokens/data1.js | 3 ++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 projects/coinlotto/index.js diff --git a/projects/coinlotto/index.js b/projects/coinlotto/index.js new file mode 100644 index 00000000000..bf4eef00392 --- /dev/null +++ b/projects/coinlotto/index.js @@ -0,0 +1,34 @@ +const getLotteryBatchAbi = 'function getLotteryBatch(uint256[] lotteryIds) view returns (tuple(uint256 lotteryId, address manager, tuple(address creator, uint8 kind, uint8 model, tuple(uint256 ticketPrice, address asset, uint256 feeBp, uint24 maxTickets, uint64 startTime, uint64 endTime) params, uint256 payoutRateBp, uint256 cltAmountPerTicket, uint256 feederSuperLotteryId, uint256 feederAllocBp) lottery, tuple(uint8 status, uint64 drawDeadline, uint32 drawGeneration, uint256 seed, uint256 referrerFees, uint256 creatorFees, uint256 prizePool, uint256 claimedPrizePool, uint256 currentPrizePool) state, uint256 ticketsSold, uint16[] tiers)[] results)' + +const LOTTERY_HUB = '0x4958CB13Fa5881B2c67bde408708e72411Bb3bbb' +const BATCH_SIZE = 100 + +/** + * Sums the remaining prize pool (`currentPrizePool`) of every lottery registered in the LotteryHub. + * Lottery IDs are enumerated on-chain via `lotteryCount()` and fetched in batches of `BATCH_SIZE`. + * Manager balances are not used: they also hold refunds, creator fees, referral revenue share and treasury funds. + * @param {import('@defillama/sdk').ChainApi} api - DefiLlama chain API for the target chain and block + */ +async function tvl(api) { + const lotteryCount = Number(await api.call({ abi: 'uint256:lotteryCount', target: LOTTERY_HUB })) + if (!lotteryCount) return + + // lottery IDs are sequential: 1..lotteryCount + const ids = Array.from({ length: lotteryCount }, (_, i) => i + 1) + const calls = [] + for (let i = 0; i < ids.length; i += BATCH_SIZE) + calls.push({ params: [ids.slice(i, i + BATCH_SIZE)] }) + + const batches = await api.multiCall({ abi: getLotteryBatchAbi, target: LOTTERY_HUB, calls }) + for (const lottery of batches.flat()) + api.add(lottery.lottery.params.asset, lottery.state.currentPrizePool) +} + +module.exports = { + methodology: "TVL is the sum of the remaining prize pools (prize pool minus already claimed prizes) of all lotteries registered in the LotteryHub contract, read on-chain on each supported chain.", + start: '2026-10-27', +} + +;['ethereum', 'bsc', 'base'].forEach(chain => { + module.exports[chain] = { tvl } +}) diff --git a/registries/sumTokens/data1.js b/registries/sumTokens/data1.js index 8bae3ab0e4d..660457eec3a 100644 --- a/registries/sumTokens/data1.js +++ b/registries/sumTokens/data1.js @@ -89,7 +89,8 @@ module.exports = { [ADDRESSES.ethereum.USDT, "0x6925ccD29e3993c82a574CED4372d8737C6dbba6"], [ADDRESSES.ethereum.WBTC, "0x2c01390E10e44C968B73A7BcFF7E4b4F50ba76Ed"], ] }, - "bitcoin": { "owners": ["bc1pl7grnght2uhp75wm03djde5a56syp06ssdjf7ucm4wkq0tetpqas5e20e9"] }, + // 2026-10-10 the bridge moved its 110 BTC from the first address to the second, via 11 x 10 BTC hops + "bitcoin": { "owners": ["bc1pl7grnght2uhp75wm03djde5a56syp06ssdjf7ucm4wkq0tetpqas5e20e9", "bc1pclvn3v74l2u8kmw5z9dqcr3ahq54ka74cx4tv8vv2khra7n0ta0qxkrkyv"] }, }, "darkness": { "cronos": { From 033b01d60904ca9ee99b5a06373ed1265be49485 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 4 Nov 2026 14:42:35 +0000 Subject: [PATCH 587/988] saturn morpho vaults (#22024) --- projects/hyperithm/index.js | 2 ++ projects/saturn-protocol/index.js | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/projects/hyperithm/index.js b/projects/hyperithm/index.js index 767b5f76a8b..c7924fff566 100644 --- a/projects/hyperithm/index.js +++ b/projects/hyperithm/index.js @@ -16,6 +16,7 @@ const vaultConfigs = { '0xC56EA16EA06B0a6A7b3B03B2f48751e549bE40fD', '0x16fa314141C76D4a0675f5e8e3CCBE4E0fA22C7c' ], + excludedVaults: ['0xAbe418cc8c06D265E4EB009C02eA4B265eCA7240'], // Saturn USDC vault, counted under saturn-protocol euler: [ '0x3cd3718f8f047aA32F775E2cb4245A164E1C99fB', ], @@ -58,6 +59,7 @@ const vaultConfigs = { '0xC56EA16EA06B0a6A7b3B03B2f48751e549bE40fD', '0x9B97783B747c51b39c3d320050dc9C512868dAa8' ], + excludedVaults: ['0x75753e494e5e374C52E1d84fc04EB14B10F2C079'], // Saturn USDC vault, counted under saturn-protocol eulerVaultOwners: [ '0x594c5eE5a326295FF6212C31BB3311747D3bD562', ], diff --git a/projects/saturn-protocol/index.js b/projects/saturn-protocol/index.js index 0b76e033104..020b0e75fe3 100644 --- a/projects/saturn-protocol/index.js +++ b/projects/saturn-protocol/index.js @@ -8,6 +8,20 @@ const sUSDat = '0xd166337499e176bbc38a1fbd113ab144e5bd2df7'; const M = '0x866a2bf4e572cbcf37d5071a7a58503bfb36be1b'; const PYUSDx = '0xebdb0942ce16386ab90718c7bd10c91cdb66b14d'; const USDC = ADDRESSES.ethereum.USDC; +// Saturn USDC Morpho vaults (co-curated with Hyperithm; Hyperithm agreed deposits count as Saturn's). +const VAULTS = { + ethereum: ['0xAbe418cc8c06D265E4EB009C02eA4B265eCA7240'], + monad: ['0x75753e494e5e374C52E1d84fc04EB14B10F2C079'], +}; + +async function vaultTvl(api) { + const vaults = VAULTS[api.chain]; + const [assets, totals] = await Promise.all([ + api.multiCall({ abi: 'address:asset', calls: vaults }), + api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }), + ]); + api.add(assets, totals); +} // sUSDat is backed by STRC (Strategy's "Stretch" preferred stock); balances are 6 decimals. const STRC_DECIMALS = 6; // sUSDat v2 upgrade (2026-09-30): strcBalance() was removed and STRC accounting moved to @@ -34,12 +48,16 @@ async function tvl(api) { // tradfi STRC feed (coingecko:llama-stock-strc) rather than Saturn's own oracle. api.addCGToken('llama-stock-strc', Number(strcBalance) / 10 ** STRC_DECIMALS); + await vaultTvl(api); return api.getBalances(); } module.exports = { - methodology: "USDat backing (the PYUSDx reserve, legacy $M, and USDC held by the USDat contract) plus the STRC digital-credit backing of sUSDat, priced via DefiLlama's tradfi STRC feed (NASDAQ: STRC).", + methodology: "USDat backing (the PYUSDx reserve, legacy $M, and USDC held by the USDat contract) plus the STRC digital-credit backing of sUSDat, priced via DefiLlama's tradfi STRC feed (NASDAQ: STRC), plus USDC deposits in Saturn's co-curated Morpho vaults on Ethereum and Monad.", ethereum: { tvl, }, + monad: { + tvl: vaultTvl, + }, }; From 73b05047a6e7fbb699d9c256705c707a4b850005 Mon Sep 17 00:00:00 2001 From: Nullroot Protocol Date: Wed, 4 Nov 2026 09:24:10 -0600 Subject: [PATCH 588/988] Add nullroot (#22013) --- projects/nullroot/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/nullroot/index.js diff --git a/projects/nullroot/index.js b/projects/nullroot/index.js new file mode 100644 index 00000000000..dbf7255ce49 --- /dev/null +++ b/projects/nullroot/index.js @@ -0,0 +1,30 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// Nullroot Protocol: 0xbow Privacy Pools deployment on Robinhood Chain. +// TVL = assets held by every pool registered on the Entrypoint (ETH + USDG today). +const config = { + robinhood: { entrypoint: '0x2077Fb20b0d4746EB9BD70a7d52d36C258b0eF46', fromBlock: 104432645 }, +} + +const poolRegisteredEvent = 'event PoolRegistered(address pool, address asset, uint256 scope)' +const assetConfigAbi = 'function assetConfig(address) view returns (address pool, uint256 minimumDepositAmount, uint256 vettingFeeBPS, uint256 maxRelayFeeBPS)' + +async function tvl(api) { + const { entrypoint, fromBlock } = config[api.chain] + const logs = await getLogs2({ api, eventAbi: poolRegisteredEvent, fromBlock, target: entrypoint }) + const tokensAndOwners = logs.map((log) => [log.asset, log.pool]) + const assets = [...new Set(logs.map((log) => log.asset))] + const current = await api.multiCall({ abi: assetConfigAbi, calls: assets, target: entrypoint, field: 'pool' }) + current.forEach((pool, i) => tokensAndOwners.push([assets[i], pool])) + return sumTokens2({ api, tokensAndOwners }) +} + +module.exports = { + methodology: 'TVL is the ETH and ERC-20 balance held by every Nullroot privacy pool registered on the Entrypoint (PoolRegistered events plus the current assetConfig pool for each asset).', + start: 1793644581, +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl } +}) From b368b0a5a8efa2378301a4db52a0c6cf1b299695 Mon Sep 17 00:00:00 2001 From: milkbeard Date: Wed, 4 Nov 2026 11:10:38 -0500 Subject: [PATCH 589/988] Add Milk Money (Solana) (#22000) Co-authored-by: Jay Co-authored-by: Claude Fable 5.1 Co-authored-by: FelixBruguera --- projects/treasury/milk-money.js | 121 ++++++++++++++++++++++++++++++++ registries/sumTokens.js | 8 +++ 2 files changed, 129 insertions(+) create mode 100644 projects/treasury/milk-money.js diff --git a/projects/treasury/milk-money.js b/projects/treasury/milk-money.js new file mode 100644 index 00000000000..955cea057cb --- /dev/null +++ b/projects/treasury/milk-money.js @@ -0,0 +1,121 @@ +const sdk = require('@defillama/sdk') +const { PublicKey } = require('@solana/web3.js') +const { bs58 } = require('@project-serum/anchor/dist/cjs/utils/bytes') +const { getConnection, getMultipleAccounts, decodeAccount } = require('../helper/solana') +const { POSITION_V2_DISCRIMINATOR } = require('../helper/utils/solana/layouts/meteora-dlmm-layout') + +const MM = 'Ax8PSfCXxmxb8C8kYTzN5CPpTe6PyeZfFf8rrXNCjupx' + +// Milk Money trades its own capital as concentrated liquidity on Meteora DLMM, from protocol-owned wallets: +// guard vaults (program-guarded PDAs whose operator can only move funds into positions or to a pinned treasury) +// and the agent wallets that trade new pairs. MM is the quote side of the fleet's own pools. +const OWNERS = [ + // guard vaults + '2joLmenK3iX1Z2oanQLCtezwAnjhihyJN9JRDiQnJdDi', // core vault + 'EaXdaBNg4eZ1ErJKwhxn6GFrhxPqdrc3yR2DaunPoYek', // rewards vault (fees to stakers) + 'ZUyyNQfMKJSF2T7BD9SHdqV9KARshimHBQgK74kZoiY', // volume vault + 'CL5qyfZ5fhfKDrnwnnBt1uAtzcazczUSq9NYWmpEwSFa', // revenue vault + '6bq9FFtjKr1djQop7jT5gGE7KKxopUUsmbxYVxXZknwF', // centering vault + // agents + '8tdfeokyWnNo7DqVp6DxYEXb4DX5Yy8jFE4zVA4PgLCj', '5DXzW87LWFScko1TeVrD1BKyoUUNYgoQC56JeBU3nBQV', + 'GqAWG8Md3KiRy6cUNhU9YYuE2hZvXo7NZDpbGxcBWkJn', 'dDQJgFpoFeUBrx9Nd6dojFDCQ8md47TCqJWTRzmrfmL', + 'BEdFPovfLGQkCCVrEys5V28YH8QfDXnKpAXJvwpEBqU7', 'F3o6pmCYgYFYs2u6AMvpL7PScUYKaiiUjtvrUejVHc1w', +] + +const DLMM_PROGRAM = new PublicKey('LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo') +const BINS_PER_ARRAY = 70 +const DLMM_POSITION_BASE_SIZE = 8120 // resized positions append 112 bytes per extra bin, liquidity share first +const DLMM_EXTRA_BIN_SIZE = 112 +const readU128 = (data, offset) => data.readBigUInt64LE(offset) + (data.readBigUInt64LE(offset + 8) << 64n) + +// Principal of every Meteora DLMM position owned by the protocol wallets, unclaimed fees left out, +// as [mint, amount] rows. tvl and ownTokens share one scan: running it per bucket doubles the +// getProgramAccounts calls +let positionAmounts +const getPositionAmounts = () => positionAmounts ??= fetchPositionAmounts() + +async function fetchPositionAmounts() { + const connection = getConnection('solana') + // one owner-filtered PositionV2 scan per wallet, one at a time three seconds apart: the public RPC caps + // getProgramAccounts hard. Owner sits at offset 40, after the lbPair; no dataSize filter because resized + // positions are larger than the base account + const positionKeys = [] + await sdk.util.runInPromisePool({ + concurrency: 1, + items: OWNERS, + processor: async (owner) => { + await new Promise(resolve => setTimeout(resolve, 3000)) + const rows = await connection.getProgramAccounts(DLMM_PROGRAM, { + filters: [ + { memcmp: { offset: 0, bytes: bs58.encode(POSITION_V2_DISCRIMINATOR) } }, + { memcmp: { offset: 40, bytes: owner } }, + ], + dataSlice: { offset: 0, length: 0 }, + }) + rows.forEach(({ pubkey }) => positionKeys.push(pubkey)) + }, + }) + if (!positionKeys.length) return [] + + const positions = (await getMultipleAccounts(positionKeys)).filter(Boolean).map(info => { + const position = decodeAccount('meteoraPosition', info) + const shares = position.liquidityShares.map(share => BigInt(share.toString())) + for (let offset = DLMM_POSITION_BASE_SIZE; offset < info.data.length; offset += DLMM_EXTRA_BIN_SIZE) + shares.push(readU128(info.data, offset)) + return { lbPair: position.lbPair, lower: Number(position.lowerBinId), upper: Number(position.upperBinId), shares } + }) + + const binArrayKey = (lbPair, binId) => { + const index = Buffer.alloc(8) + index.writeBigInt64LE(BigInt(Math.floor(binId / BINS_PER_ARRAY))) + return PublicKey.findProgramAddressSync([Buffer.from('bin_array'), lbPair.toBuffer(), index], DLMM_PROGRAM)[0].toBase58() + } + + const pairKeys = [...new Set(positions.map(p => p.lbPair.toBase58()))] + const binArrayKeys = new Set() + for (const { lbPair, lower, upper, shares } of positions) + for (let binId = lower; binId <= upper; binId++) + if (shares[binId - lower] > 0n) binArrayKeys.add(binArrayKey(lbPair, binId)) + const binArrayList = [...binArrayKeys] + + const pairs = {} + ;(await getMultipleAccounts(pairKeys)).forEach((info, i) => pairs[pairKeys[i]] = decodeAccount('meteoraLbPair', info)) + const binArrays = {} + ;(await getMultipleAccounts(binArrayList)).forEach((info, i) => { if (info) binArrays[binArrayList[i]] = decodeAccount('meteoraBinArray', info) }) + + const amounts = [] + for (const { lbPair, lower, upper, shares } of positions) { + const pair = pairs[lbPair.toBase58()] + let amountX = 0n + let amountY = 0n + for (let binId = lower; binId <= upper; binId++) { + const share = shares[binId - lower] + if (!share) continue + const binArray = binArrays[binArrayKey(lbPair, binId)] + if (!binArray) throw new Error(`Missing Meteora bin array for ${lbPair.toBase58()} bin ${binId}`) + const bin = binArray.bins[binId - Number(binArray.index) * BINS_PER_ARRAY] + const supply = BigInt(bin.liquiditySupply.toString()) + if (!supply) continue + amountX += share * BigInt(bin.amountX.toString()) / supply + amountY += share * BigInt(bin.amountY.toString()) / supply + } + amounts.push([pair.tokenXMint.toBase58(), amountX.toString()], [pair.tokenYMint.toBase58(), amountY.toString()]) + } + return amounts +} + +// MM goes to ownTokens, everything else to tvl +const balances = (isOwnToken) => async (api) => { + for (const [mint, amount] of await getPositionAmounts()) + if ((mint === MM) === isOwnToken) api.add(mint, amount) +} + +module.exports = { + timetravel: false, + isHeavyProtocol: true, // one owner-filtered position scan per protocol wallet + methodology: 'Counts the protocol-owned liquidity Milk Money trades: the principal of the Meteora DLMM positions owned by its guard vaults and agent wallets, valued from the pools\' on-chain bin state, with unclaimed fees excluded. MM on the protocol\'s side of the pools is reported as own tokens.', + solana: { + tvl: balances(false), + ownTokens: balances(true), + }, +} diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 0008843bf6a..b44c806d164 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -18321,6 +18321,14 @@ const configs = { ] }, }, + "milk-money": { + "timetravel": false, + "methodology": "Staking is the $MM held in the staking pool's stake vault.", + "solana": { + "tvl": { "tokenAccounts": [] }, + "staking": { "tokenAccounts": ["CYTyr6G2FVffSXR5kArtXGaGAKQu9NTKLfXTMbiNBJ2t"] } // $MM stake vault + }, + }, "minepea": { "methodology": "TVL is the native ETH held by the GridMining contract (ETH deployed to active rounds plus unclaimed ETH winnings). Staking counts PEA locked in the Staking contract plus unclaimed mined PEA held by GridMining.", "robinhood": { From 6a123370b48c34dc7df9f61ecf166b2ae8319a3c Mon Sep 17 00:00:00 2001 From: Jaimi Patel Date: Wed, 4 Nov 2026 16:25:13 +0000 Subject: [PATCH 590/988] dexalot: add dexalot omnivaults tvl adapter (#22004) --- projects/dexalot-omnivaults/index.js | 77 ++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 projects/dexalot-omnivaults/index.js diff --git a/projects/dexalot-omnivaults/index.js b/projects/dexalot-omnivaults/index.js new file mode 100644 index 00000000000..d9f57499cf2 --- /dev/null +++ b/projects/dexalot-omnivaults/index.js @@ -0,0 +1,77 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') +const { ethers } = require('ethers') + +const dexalotAPI = 'https://api.dexalot.com' +const OMNIVAULT_MANAGER = '0x7AAC6aa9345a436D459316D8Dd1275b78DBbA3F3' +const PORTFOLIO_SUB = '0xa5C079C1986E2335d83fA2d7282e162958e515D5' +const VAULT_DETAILS_ABI = + 'function getVaultDetails(uint256 _vaultId) view returns (tuple(string name, address proposer, address omniTrader, uint8 status, address executor, address shareToken, address dexalotRFQ, uint32[] chainIds, uint16[] tokens))' + +// [chain]: [chain id, Dexalot env] +const supportedChains = { + arbitrum: [42161, 'production-multi-arb'], + avax: [43114, 'production-multi-avax'], + base: [8453, 'production-multi-base'], + bsc: [56, 'production-multi-bsc'], +} + +const getTokens = () => getConfig('dexalot/tokens', `${dexalotAPI}/privapi/trading/tokens`) +const getCoingeckoIds = () => getConfig('dexalot-omnivaults/coingeckoids', `${dexalotAPI}/api/stats/coingeckoids`) + +// Vaults from the OmniVaultManager on the Dexalot chain. A vault's executor and DexalotRFQ have the same address on +// every chain it runs on +async function getVaults(api) { + let dexalotApi = api + if (api.chain !== 'dexalot') { + dexalotApi = new sdk.ChainApi({ chain: 'dexalot', timestamp: api.timestamp }) + await dexalotApi.getBlock() + } + const count = await dexalotApi.call({ target: OMNIVAULT_MANAGER, abi: 'uint256:vaultIndex' }) + const vaults = await dexalotApi.multiCall({ target: OMNIVAULT_MANAGER, abi: VAULT_DETAILS_ABI, calls: [...Array(Number(count)).keys()] }) + // status 0 is an unused id, paused and deprecated vaults can still hold funds + return vaults.filter((v) => Number(v.status) !== 0) +} + +// Mainnets: each vault holds its inventory in its DexalotRFQ contract, deposits land on its executor +function mainnetTvl(chainId, env) { + return async (api) => { + const [vaults, tokens] = await Promise.all([getVaults(api), getTokens()]) + const owners = vaults.filter((v) => v.chainIds.map(Number).includes(chainId)).flatMap((v) => [v.executor, v.dexalotRFQ]) + const tokenAddresses = tokens.filter((t) => t.env === env).map((t) => t.address) + return sumTokens2({ api, owners, tokens: [ADDRESSES.null, ...tokenAddresses], permitFailure: true }) + } +} + +// Dexalot L1: the executors' PortfolioSub balances, including funds in open orders +async function dexalotTvl(api) { + const [vaults, tokens, coingeckoIds] = await Promise.all([getVaults(api), getTokens(), getCoingeckoIds()]) + const executors = vaults.map((v) => v.executor) + const balances = await api.multiCall({ + target: PORTFOLIO_SUB, + abi: 'function getBalances(address _owner, uint256 _pageNo) view returns (bytes32[] symbols, uint256[] total, uint256[] available)', + calls: executors.map((executor) => ({ params: [executor, 0] })), + }) + const decimalsBySymbol = Object.fromEntries(tokens.map((t) => [t.subnet_symbol, t.l1_decimals])) + const cgIdBySymbol = Object.fromEntries(coingeckoIds.map((c) => [c.symbol, c.coingecko_id])) + + for (const { symbols, total } of balances) { + symbols.forEach((s, i) => { + const symbol = ethers.decodeBytes32String(s) + const cgId = cgIdBySymbol[symbol] + if (!cgId || decimalsBySymbol[symbol] === undefined) return + api.addCGToken(cgId, Number(total[i]) / 10 ** decimalsBySymbol[symbol]) + }) + } +} + +module.exports = { + methodology: 'TVL is the token balances held by the Dexalot OmniVaults: the vaults\' DexalotRFQ contracts and executors on each mainnet, and the executors\' portfolio balances on the Dexalot chain. Vault funds in open orders on the Dexalot chain are also counted in Dexalot DEX TVL.', + dexalot: { tvl: dexalotTvl }, +} + +for (const [chain, [chainId, env]] of Object.entries(supportedChains)) { + module.exports[chain] = { tvl: mainnetTvl(chainId, env) } +} From e039dfe068ebe7dd8a8ce95e3e1fbcd8cf05ab7d Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 4 Nov 2026 15:51:00 -0400 Subject: [PATCH 591/988] Add gAIX desk to Borro (#22029) Co-authored-by: Borro Markets Co-authored-by: Claude Opus 5.5 --- projects/borro/index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/projects/borro/index.js b/projects/borro/index.js index 04dab3851dd..daeefd046d0 100644 --- a/projects/borro/index.js +++ b/projects/borro/index.js @@ -10,6 +10,10 @@ const { nullAddress } = require("../helper/tokenMapping") // collateral, so a lender can borrow USDG against the stock it has lent. // Thirteen Morpho Vault V2s (one per stock plus a USDG vault) supply these markets through their adapters. // +// The gAIX desk (Goldstein Group's gAIX fund token) has the same two markets and its own vault (bgAIX), +// with two differences: its USDG market takes gAIX itself as collateral, and its gAIX-loan market takes +// bgSHORT, which wraps Steakhouse USDG vault shares. +// // The deployment is shared with other curators (Longbow and others), so the singleton's token // balances cannot be attributed by a token union; the markets are enumerated instead and each is // attributed from its own state, exactly as projects/longbow does on the same deployment. @@ -47,6 +51,8 @@ const desks = { AAPL: ["0x24Fe7bCAEB75bC2202A42ECD48a177a27782c64a", "0x5242d7dcb608526f2f76b3f6914b9adf34634cdf67220c54bfce0718540c4550", "0x4cb59d58f0752990c41de36de0fe47a28179f50e69eae0cc727011162614ddcc"], GOOGL: ["0xf0731B1022ABD1e3f543Cfd837C7eBA42ED60E4f", "0x5826469e3b7df54fe18c921aafe850865552bc79b366a90ad0dc23c330ee0b75", "0x3abd7c179f694a9b3cf1008c97aa005ace5c6378e0298007154c563d3fd5b1a1"], MSFT: ["0x8032C80a7817a3C4C401b096515B27b2CedA4e71", "0x00f685fcd58b2a04c6953ac74b5d6b8f288e45e9a393077acf6711d6c51957bf", "0x098b730c59fbac64a01db3d3e0751386c2a68ced08754170a74ffdb9c6d0ed57"], + // added 2026-11-04 (bgAIX deploy block 101936242) + gAIX: ["0x0bd00e6cB94F9C06d7926A62B7EF7d816D2ea7A3", "0x198c6ba22d7a2feb3e8deb9e6372e00aae3d6ed9310dae514649acc2f67c2789", "0x761fbcc92be3ab5d682adc222817a4267c2f444cffab892456c5e3e4761af061"], } const vaults = [USDG_VAULT, ...Object.values(desks).map((d) => d[0])] @@ -77,7 +83,7 @@ function borrowerCache({ cache, logs }) { async function collateralByMarket(api) { const toBlock = (await api.getBlock()) - 200 // the log cache is append-only, stay clear of reorgs at the tip // the cache keeps only pairs for markets listed when it read the logs; the key changes when markets are added - const pairs = await getLogs2({ api, target: MORPHO, eventAbi: supplyCollateralAbi, fromBlock: FROM_BLOCK, toBlock, extraKey: "borro-borrowers-v2", customCacheFunction: borrowerCache }) + const pairs = await getLogs2({ api, target: MORPHO, eventAbi: supplyCollateralAbi, fromBlock: FROM_BLOCK, toBlock, extraKey: "borro-borrowers-v3", customCacheFunction: borrowerCache }) const calls = pairs.map((p) => ({ params: p.split(":") })) const positions = await api.multiCall({ target: MORPHO, abi: positionAbi, calls }) const net = {} @@ -116,7 +122,8 @@ async function vaultHoldings(api) { } async function tvl(api) { - const [{ params, data }, collateral] = await Promise.all([marketState(api), collateralByMarket(api)]) + const { params, data } = await marketState(api) + const collateral = await collateralByMarket(api) markets.forEach((id, i) => { const supplied = BigInt(data[i].totalSupplyAssets || 0) @@ -147,6 +154,6 @@ module.exports = { doublecounted: true, start: "2026-10-05", methodology: - "Counts the isolated Morpho Blue markets Borro creates and curates on Robinhood Chain: a stock-loan market and a USDG market per stock. For each market, TVL is the loan assets still held by Morpho for that market (supplied minus borrowed) plus the borrower collateral posted against it; outstanding debt is reported separately under borrowed. Collateral that is itself a Borro vault share (bNVDA and the rest, posted on the USDG markets) is not added, because the stock behind it is already counted in the stock-loan market. What Borro's Morpho Vault V2s hold outside these markets (idle, or parked in another Morpho vault through an adapter) is added as the vault's asset; what they supply into the markets is counted once, in the markets. Marked double counted because Morpho Blue reports the same markets.", + "Counts the isolated Morpho Blue markets Borro creates and curates on Robinhood Chain: a stock-loan market and a USDG market per stock, plus the same pair for Goldstein Group's gAIX fund token. For each market, TVL is the loan assets still held by Morpho for that market (supplied minus borrowed) plus the borrower collateral posted against it; outstanding debt is reported separately under borrowed. Collateral that is itself a Borro vault share (bNVDA and the rest, posted on the USDG markets) is not added, because the stock behind it is already counted in the stock-loan market. What Borro's Morpho Vault V2s hold outside these markets (idle, or parked in another Morpho vault through an adapter) is added as the vault's asset; what they supply into the markets is counted once, in the markets. Marked double counted because Morpho Blue reports the same markets.", robinhood: { tvl, borrowed }, } From 8962fd07742cd5a6fc5975feafc115b8b5e165d5 Mon Sep 17 00:00:00 2001 From: P Date: Wed, 4 Nov 2026 20:57:52 +0100 Subject: [PATCH 592/988] templar-precept: add Precept lending markets on Stellar (#21995) Co-authored-by: Claude Opus 5.5 --- projects/templar-precept/index.js | 62 +++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 projects/templar-precept/index.js diff --git a/projects/templar-precept/index.js b/projects/templar-precept/index.js new file mode 100644 index 00000000000..88ae9235d27 --- /dev/null +++ b/projects/templar-precept/index.js @@ -0,0 +1,62 @@ +const { callSoroban } = require("../helper/chain/stellar"); +const { getConfig } = require("../helper/cache"); +const methodologies = require("../helper/methodologies"); + +// Templar's deployment registry for Precept: every contract it deployed on +// mainnet, one JSON object per line. New pools are added by the pool-deploy +// workflow, so they are counted without changes here. +const REGISTRY_URL = "https://raw.githubusercontent.com/Templar-Protocol/precept/main/registry/mainnet.jsonl"; +const SCALAR_12 = 10n ** 12n; // d_rate fixed-point scalar, as in Blend v2 + +// Every registered pool, retired ones included: "retired" is a registry label, +// the pool still holds funds its depositors can withdraw. +async function getPools() { + const registry = await getConfig("templar-precept", REGISTRY_URL); + if (typeof registry !== "string") throw new Error("templar-precept: registry unavailable and no cached copy"); + const pools = registry.trim().split("\n").map((line) => JSON.parse(line)) + .filter((r) => r.kind === "contract" && r.network === "mainnet" && r.role === "pool") + .map((r) => r.id); + if (!pools.length) throw new Error("templar-precept: no pools in the registry"); + return pools; +} + +let _poolAssets; +// [{ pool, assets: [address] }] for every pool; a failure is not kept, so the next run reads again +async function getPoolAssets() { + if (!_poolAssets) _poolAssets = (async () => { + const out = []; + for (const pool of await getPools()) + out.push({ pool, assets: await callSoroban(pool, "get_reserve_list") }); + return out; + })().catch((e) => { + _poolAssets = undefined; + throw e; + }); + return _poolAssets; +} + +// tvl: actual token balances held by each pool contract. No read is skipped: +// a failed run is better than one that under-reports. +async function tvl(api) { + for (const { pool, assets } of await getPoolAssets()) + for (const asset of assets) + api.add(asset, (await callSoroban(asset, "balance", [pool])).toString()); +} + +// borrowed: outstanding debt from each reserve's accounting (d_supply * d_rate) +async function borrowed(api) { + for (const { pool, assets } of await getPoolAssets()) + for (const asset of assets) { + const { data } = await callSoroban(pool, "get_reserve", [asset]); + api.add(asset, ((data.d_supply * data.d_rate) / SCALAR_12).toString()); + } +} + +module.exports = { + timetravel: false, + start: "2026-10-27", + methodology: `${methodologies.lendingMarket}. TVL is the on-chain token balances held by every Precept pool in the Templar deployment registry; borrowed is each reserve's outstanding debt (d_supply * d_rate).`, + stellar: { + tvl, borrowed, + }, +}; From e7a9dfc3f25ff484ffbee774115caa37f4163218 Mon Sep 17 00:00:00 2001 From: kpk-giel Date: Wed, 4 Nov 2026 20:01:02 +0000 Subject: [PATCH 593/988] kpk: add wBRL Yield and the cbBTC Carry Fund (#22025) Co-authored-by: Claude Opus 5.5 --- projects/kpk/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/kpk/index.js b/projects/kpk/index.js index c2026dbbd47..9b2bf5e3d5c 100644 --- a/projects/kpk/index.js +++ b/projects/kpk/index.js @@ -9,6 +9,7 @@ const ETH_ALPHA_SAFE = "0x99b9F5F24205Cb88E33b1CC72008f644Fc23768b" // ETH Alpha const USD_ALPHA_SAFE = "0x38F6a1B46144fAEe6a6D9F79D8dE264C18e23848" // USD Alpha Fund Portfolio Safe const XAUT_CARRY_SAFE = "0x67269455871526A052cA89329218a41e810Ecc15" // XAUt Carry Fund Portfolio Safe const WBTC_CARRY_SAFE = "0x0295E5d0530C23E560CdbFc097C488a0A0D7752D" // WBTC Carry Fund Portfolio Safe +const CBBTC_CARRY_SAFE = "0xc7B7Fe7DFfb11869023dA5C327e725B361bdFe5D" // cbBTC Carry Fund Portfolio Safe const RH_USD_SAFE = "0x01F18eadd996e41235A9155Ec9aF5878c6ED6294" // kpk Robinhood USD Portfolio Safe (Robinhood Chain) const RH_SPY_SAFE = "0xe2548934197AbE73F97326302A0900302fCb34d1" // kpk Robinhood SPY Portfolio Safe (Robinhood Chain) const RH_ETH_USD_SAFE = "0x2EeB414D0bc548094a574E6801f5365498D28aa4" // kpk Robinhood ETH-USD Portfolio Safe (Robinhood Chain) @@ -56,6 +57,7 @@ const configs = { "0xb5ce3CA2C774b72955C25875022FdD91f7a7B938", //Morpho v2 wARS Yield "0x7a72bcD2c3F7F7e4D6679170a0625bAB15D7DDa1", //Morpho v2 USDC Yield RWA "0x355A1c6A3f1946d4DbD7cE932492925AB9F261a7", //Morpho v2 YO Ecosystem + "0x7873F890A3Eec30909Bdb2cF65C4FA70DB905aac", //Morpho v2 wBRL Yield ], // Other ERC-4626 vaults (non-Morpho) @@ -172,7 +174,7 @@ async function getAlephVaultTvl(api, vaults) { } // ---- kpk Fund (OIV) TVL via DeBank ---- -const OIV_SAFES = [ETH_ALPHA_SAFE, USD_ALPHA_SAFE, XAUT_CARRY_SAFE, WBTC_CARRY_SAFE, RH_USD_SAFE, RH_SPY_SAFE, RH_ETH_USD_SAFE] +const OIV_SAFES = [ETH_ALPHA_SAFE, USD_ALPHA_SAFE, XAUT_CARRY_SAFE, WBTC_CARRY_SAFE, CBBTC_CARRY_SAFE, RH_USD_SAFE, RH_SPY_SAFE, RH_ETH_USD_SAFE] const OIV_CHAINS = ['ethereum', 'arbitrum', 'base', 'xdai', 'robinhood'] // ---- Zodiac-managed Safes (Institutional vertical) TVL via DeBank ---- From 21febd9eb21271f6b091c66c4246c51e167a1560 Mon Sep 17 00:00:00 2001 From: Crazer <156205162+crypto-crazer@users.noreply.github.com> Date: Thu, 5 Nov 2026 04:21:05 +0800 Subject: [PATCH 594/988] Add Brighter TVL adapter (#22012) Co-authored-by: Hermes Agent Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/brighter/index.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 projects/brighter/index.js diff --git a/projects/brighter/index.js b/projects/brighter/index.js new file mode 100644 index 00000000000..3a560dd53a2 --- /dev/null +++ b/projects/brighter/index.js @@ -0,0 +1,32 @@ +const { get } = require('../helper/http') + +// Brighter's Ethereum contracts hold no USDC or LIT: deposits are bridged to Lighter, where the +// protocol's 2-of-3 Safe (owner of all Brighter contracts) holds them as LLP shares (USDb side) +// and LIT staking (sLITb side). TVL is read from those Lighter accounts directly. +const SAFE = '0xb582Aa48eb9d0BD58E16DD4E98637161310be280' +const API = 'https://mainnet.zklighter.elliot.ai/api' + +async function tvl(api) { + const timestamp = Math.floor(api.timestamp / 86400) * 86400 + const { sub_accounts } = await get(`${API}/v1/accountsByL1Address`, { params: { l1_address: SAFE } }) + if (!Array.isArray(sub_accounts) || !sub_accounts.length) throw new Error('No Lighter accounts found for the Brighter Safe') + + for (const { index } of sub_accounts) { + const { code, resolution, pnl } = await get(`${API}/v2/pnl`, { + params: { by: 'index', value: index, resolution: '1d', start_timestamp: timestamp - 86400, end_timestamp: timestamp }, + }) + const snapshot = Array.isArray(pnl) && pnl.find(point => point.timestamp === timestamp && point.is_final === true) + if (code !== 200 || resolution !== '1d' || !snapshot || !Number.isFinite(snapshot.total_equity) || snapshot.total_equity < 0) + throw new Error(`Missing or invalid Lighter daily equity for account ${index} at ${timestamp}`) + // total_equity = trade_equity (spot/margin collateral) + pool_equity (LLP shares) + staking_equity (staked LIT) + api.addUSDValue(snapshot.total_equity) + } +} + +module.exports = { + misrepresentedTokens: true, + doublecounted: true, + start: '2026-09-29', + methodology: 'Equity of the Lighter accounts held by the Brighter Safe, from Lighter’s official API at the latest completed UTC-day boundary: LLP shares backing USDb, staked LIT backing sLITb, and spot collateral, in USD. Brighter’s Ethereum contracts hold no deposits; they are bridged to Lighter, so this overlaps with Lighter LLP.', + zklighter: { tvl }, +} From 8a04f2d3ef50e19566004d44da63347ee0453c1a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 5 Nov 2026 00:07:33 +0100 Subject: [PATCH 595/988] fix o2 --- projects/o2/api.js | 1 + projects/o2/index.js | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/projects/o2/api.js b/projects/o2/api.js index 9c7f559a54b..e950db7be17 100644 --- a/projects/o2/api.js +++ b/projects/o2/api.js @@ -5,6 +5,7 @@ const tradingAccountRegistryContractId = '0x284c6802ad33bb95a37a1113106238ee9d08 const queryPageSize = 50; async function tvl(api) { + throw new Error('pulling tvl from their api now') let contractIds = []; for (let page = 0; ; page++) { diff --git a/projects/o2/index.js b/projects/o2/index.js index eccd67ef404..932b323b32b 100644 --- a/projects/o2/index.js +++ b/projects/o2/index.js @@ -1,7 +1,18 @@ -const { customScriptTvlExports } = require('../helper/utils'); +const { get } = require('../helper/http') -module.exports = customScriptTvlExports({ - fuel: 'o2', -}) +const STATS_URL = 'https://assets.o2.app/published/stats.json' +const MAX_AGE_MS = 6 * 60 * 60 * 1000 -module.exports.methodology = 'The TVL is defined as the total sum of assets across all user trading accounts' +async function tvl(api) { + const { generated_at, tvl } = await get(STATS_URL) + const ageMs = Date.now() - new Date(generated_at).getTime() + if (!(ageMs < MAX_AGE_MS)) throw new Error(`o2 stats are stale: generated_at=${generated_at}`) + api.addUSDValue(tvl.total_usd) +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: 'The TVL is defined as the total sum of assets across all user trading accounts, as reported by the O2 stats API', + fuel: { tvl }, +} From 6d311eff620fbf93fc605fc8cc671b78b7e1d9c2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 5 Nov 2026 01:04:51 +0100 Subject: [PATCH 596/988] update mexc --- cex/mexc-cex.js | 40 +++++++++++++++++++++++++++----- projects/helper/chain/near.js | 18 +++++++++++++- projects/helper/chain/stellar.js | 10 ++++++-- 3 files changed, 59 insertions(+), 9 deletions(-) diff --git a/cex/mexc-cex.js b/cex/mexc-cex.js index dbe4862d27f..b55028c4671 100644 --- a/cex/mexc-cex.js +++ b/cex/mexc-cex.js @@ -19,10 +19,10 @@ module.exports = { "0x469AfE803C54A36674C55231489Cf4b61da8c1bC", "0x9642b23ed1e01df1092b92641051881a322f5d4e", "0xb5a6fd438017dbb0a2e5fcdcca715da227582ce4", - "0x3cc936b795a188f0e246cbb2d74c5bd190aecf18", - "0x9642b23ed1e01df1092b92641051881a322f5d4e", - "0x1Ed0be7d0A9580e202F6b98c29725d5C11D10b71", - "0x6e5a3b0021949452D31A43BE17D808De54752a44", + "0x3cc936b795a188f0e246cbb2d74c5bd190aecf18", + "0x9642b23ed1e01df1092b92641051881a322f5d4e", + "0x1Ed0be7d0A9580e202F6b98c29725d5C11D10b71", + "0x6e5a3b0021949452D31A43BE17D808De54752a44", "0x2fF5fc5b63f2bfCE5d6BB9Ea4d170cf1aa40693c", "0xBCB302A64ADB7f2C8697e17C1e948f5b058F0e49", "0xc906895C8833481571118F0C59877bFF6bE38aC1", @@ -72,7 +72,34 @@ module.exports = { owners: ["0x9dd35021d77c1de5ed50b9d788a2f68903a96b96"], }, avax: { - owners: ["0xffb3118124cdaebd9095fa9a479895042018cac2"], + owners: [ + "0xffb3118124cdaebd9095fa9a479895042018cac2", + "0x4e5e1abB2C69698a69A860722c29656e67cf9FE1", + ], + }, + dash: { + owners: ["XhJg4ZyjP6SjrtfcfS8dKLgoAG65VAQdHg"], + }, + hedera: { + owners: ["0.0.10942401"], + }, + hyperliquid: { + owners: ["0xe2E2306FF98b95b3721cf4Ce2036d77fb10b8319"], + }, + near: { + owners: ["dba256d942a6fbfef9c8d42a2960f89a1f6dcc1e8490c7531d89a470d1d00405"], + }, + stellar: { + owners: ["GBR4ERNNZOPHC43QVPYVDXXGE2LJS47D55Y3LOMHYKXIYFCP2LLLBZNA"], + }, + sui: { + owners: ["0x5db37be0f015d059484a8fbee13cbf88cd84dd157c9ad0aafffda88392033092"], + }, + zcash: { + owners: ["t1RYjmG15rhqDkKMzitEcj76hpDx8rWU1jq"], + }, + cardano: { + owners: ["addr1qysl9egfy8ma2nzvxs27cglawx4a4afp8wz8v7r9uzpw3dtyd4x8d5jhnhwccw20rny0855hpvlmder9nkx4nsugyynsynffej"], }, solana: { owners: [ @@ -92,8 +119,9 @@ module.exports = { ton: { owners: [ "EQDYh9Di0cT8QSbnHJcNM6sYlpQAAOrnA7sats7Mgwd3497j", + "UQDK_IEt42humYrvU4RNqiJUCVpg01uVWhclPfektul7WMgT", ], - }, + }, ripple: { owners: [ "r3BFHL2EXZN4darZ7vH7BT7tP9tN7tyd6W", diff --git a/projects/helper/chain/near.js b/projects/helper/chain/near.js index 9c7a4e9d4ac..28285f44ea0 100644 --- a/projects/helper/chain/near.js +++ b/projects/helper/chain/near.js @@ -65,6 +65,22 @@ async function view_account(account_id) { return near.viewAccount({ account: account_id }) } +function isUnknownAccountError(e) { + const str = `${e?.cause ?? ''} ${e?.errorName ?? ''} ${e?.nodeError?.cause?.name ?? ''} ${e?.message ?? ''}` + return /UNKNOWN_ACCOUNT|does not exist/i.test(str) +} + +// like view_account, but an account that does not exist on-chain yet (never funded) yields a zero balance instead of throwing +async function view_account_or_empty(account_id) { + try { + return await view_account(account_id) + } catch (e) { + if (!isUnknownAccountError(e)) throw e + console.log(`[near] account ${account_id} not found on-chain, skipping`) + return { amount: '0', locked: '0' } + } +} + // view call, `args` are JSON serialised; the reply is JSON parsed async function call(contract, method, args = {}) { return near.call({ contract, method, args }) @@ -116,7 +132,7 @@ async function sumTokens({ balances = {}, owners = [], tokens = []}) { await sdk.util.runInPromisePool({ concurrency: 3, items: owners, - processor: async i => bals.push(await view_account(i)), + processor: async i => bals.push(await view_account_or_empty(i)), }) const nearBalance = bals.reduce((a,i) => a + (i.amount/1e24), 0) sdk.util.sumSingleBalance(balances,'coingecko:near',nearBalance) diff --git a/projects/helper/chain/stellar.js b/projects/helper/chain/stellar.js index 5fbe81ab141..86752216d94 100644 --- a/projects/helper/chain/stellar.js +++ b/projects/helper/chain/stellar.js @@ -34,9 +34,15 @@ async function sumTokens(config) { await sumTokens({ ...rest, owner, api, skiTransform: true }) return transformBalances(api.chain, api.getBalances()) } else { - const { balances } = await get(`https://api.stellar.expert/explorer/public/account/${owner}/value`) + // validateStatus lets a 404 (account not yet created/funded on-chain) through so it can be skipped instead of thrown + const res = await get(`https://api.stellar.expert/explorer/public/account/${owner}/value`, { validateStatus: (s) => s < 500, }) + if (res?.status === 404 || !Array.isArray(res?.balances)) { + console.log(`[stellar] account ${owner} not found on-chain, skipping`) + if (config.skiTransform) return api.getBalances() + return transformBalances(api.chain, api.getBalances()) + } // `balance` is the raw on-chain amount (7 decimals); `value` is a USD estimate and must not be used as a balance - balances.forEach(({ asset, balance }) => { + res.balances.forEach(({ asset, balance }) => { api.add(asset, balance) }) } From 8a5b4b4b07cb35e45818b5f2cf36f6bb71450b96 Mon Sep 17 00:00:00 2001 From: thomas <81407403+thomas-cloud579@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:02:21 +0800 Subject: [PATCH 597/988] AddBtcReserveAddresses (#22032) --- projects/gate-io/index.js | 1 + projects/helper/bitcoin-book/index.js | 4 ++++ registries/bitcoin.js | 1 + 3 files changed, 6 insertions(+) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index a30b034f457..83b8a3d6d50 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -259,6 +259,7 @@ const config = { ] }, "base": { + blacklistedTokens: [GTBTC_EVM], "owners": [ "0xc882b111a75c0c657fc507c04fbfcd2cc984f071", "0x0d0707963952f2fba59dd06f2b425ace40b492fe", diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index d8bda326dbc..25c8a626966 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -664,6 +664,10 @@ module.exports = { "16G1xYBbiNG78LSuZdMqp6tux5xvVp9Wxh", "38PFUcFi7o7RVYYJjWCodU9t9yiQ9Qt8Gw", // add on 22/10/2026 "1MEPB525tEHRFLdq6aR8d2t8jaaRQj2iWX", // add on 22/10/2026 + "bc1pjkxsx5sr9g6y2psjv680l40kewhf8xpnal96k9cncxgst7806kzqwxq9n4", + "bc1puglknm7e2hk5gdnu9rjx022g7rwc7xwegwdrgwspl07q55p6a3wq4y0rsj", + "bc1puk7pamvpvy5g4ccw8l0dl368jf5apauu384036yud9n2waq2xqysz0g6w3", + "bc1pg6t68yfcum3d2pp98h3h7sypra2yml03sa00hl7eqxe9zu6z48aqmq8t0s", ], hashkey: [ "bc1qyvppkaa74d9jvtz664a6uxmj09hf0eyg3uhx4h", diff --git a/registries/bitcoin.js b/registries/bitcoin.js index 3fc5b67db34..4938b11cbd7 100644 --- a/registries/bitcoin.js +++ b/registries/bitcoin.js @@ -75,6 +75,7 @@ const configs = { "gate-btc": { bitcoin: 'gateBtc', methodology: "BTC on btc chain", + doublecounted: true, }, "hemi-btc": { bitcoin: 'hemiBTC', From 5b096137c4401e86e391c138b7f9520a73fea1f5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 5 Nov 2026 12:29:04 +0100 Subject: [PATCH 598/988] update @defillama/sdk version --- package.json | 2 +- pnpm-lock.yaml | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 2d77145f783..a2b44d7ad55 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", - "@defillama/sdk": "5.0.245", + "@defillama/sdk": "5.0.246", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", "@supercharge/promise-pool": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d7c5900c837..8d4113bb423 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^0.30.1 version: 0.30.1(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) '@defillama/sdk': - specifier: 5.0.245 - version: 5.0.245(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) + specifier: 5.0.246 + version: 5.0.246(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) '@project-serum/anchor': specifier: ^0.26.0 version: 0.26.0(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -269,8 +269,8 @@ packages: peerDependencies: '@solana/web3.js': ^1.68.0 - '@defillama/sdk@5.0.245': - resolution: {integrity: sha512-QgvTYM+Ax9eAJLqjTpal2G+40+J61lKrBS7LG1uktblUpU5L7UOBDzSGC2fu19V3VCM5MRoLblqTNBuFTR2yFw==} + '@defillama/sdk@5.0.246': + resolution: {integrity: sha512-DuyddpunISPbnGG9N/ByMUT/kPQzCkMSLMDUkt4sGqfKCP6NrMgkj2qtDEGQa2Kc/ksd7GfWoV8PP3uvzjvoCQ==} peerDependencies: '@solana/web3.js': '>=1.73.0' peerDependenciesMeta: @@ -524,6 +524,7 @@ packages: '@smithy/smithy-client@4.9.0': resolution: {integrity: sha512-qz7RTd15GGdwJ3ZCeBKLDQuUQ88m+skh2hJwcpPm1VqLeKzgZvXf6SrNbxvx7uOqvvkjCMXqx3YB5PDJyk00ww==} engines: {node: '>=18.0.0'} + deprecated: Deprecated due to a bug in custom logger data redaction. See https://github.com/aws/aws-sdk-js-v3/issues/8393. '@smithy/types@4.8.0': resolution: {integrity: sha512-QpELEHLO8SsQVtqP+MkEgCYTFW0pleGozfs3cZ183ZBj9z3VC1CX1/wtFMK64p+5bhtZo41SeLK1rBRtd25nHQ==} @@ -1941,7 +1942,7 @@ snapshots: bn.js: 5.2.2 buffer-layout: 1.2.2 - '@defillama/sdk@5.0.245(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': + '@defillama/sdk@5.0.246(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': dependencies: '@aws-sdk/client-s3': 3.913.0 '@elastic/elasticsearch': 8.19.1(supports-color@7.2.0) From 8827eebedc816cf23f52560ba581e70aef0939aa Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 5 Nov 2026 07:37:20 -0400 Subject: [PATCH 599/988] Revert "AddBtcReserveAddresses" and the gtBTC blacklist (#22039) --- projects/gate-io/index.js | 10 ---------- projects/helper/bitcoin-book/index.js | 4 ---- registries/bitcoin.js | 1 - 3 files changed, 15 deletions(-) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index 83b8a3d6d50..eb9cc00184b 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -8,16 +8,9 @@ const { unwrapDolomiteDeposits } = require("../helper/unwrapLPs.js"); const { sumTokens: cosmosSumTokens } = require("../helper/chain/cosmos.js"); const { addThetaBalances } = require("../helper/chain/theta.js"); -// GTBTC is Gate's own BTC-backed token. Gate's wallets hold nearly all of it as -// unissued inventory (99.9% of the Solana supply), and the BTC behind it is -// already counted in Gate's bitcoin wallets, so counting it would count that BTC twice. -const GTBTC_EVM = '0xc2d09cf86b9ff43cb29ef8ddca57a4eb4410d5f3' -const GTBTC_SOLANA = 'gtBTCGWvSRYYoZpU9UZj6i3eUGUpgksXzzsbHk2K9So' - const config = { "ethereum": { ownTokens: ['0xE66747a101bFF2dBA3697199DCcE5b743b454759'], // GT - blacklistedTokens: [GTBTC_EVM], "owners": [ "0x0d0707963952f2fba59dd06f2b425ace40b492fe", "0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c", @@ -149,7 +142,6 @@ const config = { ] }, "bsc": { - blacklistedTokens: [GTBTC_EVM], "owners": [ "0x0d0707963952f2fba59dd06f2b425ace40b492fe", "0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c", @@ -214,7 +206,6 @@ const config = { ] }, "solana": { - blacklistedTokens: [GTBTC_SOLANA], "owners": [ "u6PJ8DtQuPFnfmwHbGFULQ4u4EgjDiyYKjVEsynXq2w", "HiRpdAZifEsZGdzQ5Xo5wcnaH3D2Jj9SoNsUzcYNK78J", @@ -259,7 +250,6 @@ const config = { ] }, "base": { - blacklistedTokens: [GTBTC_EVM], "owners": [ "0xc882b111a75c0c657fc507c04fbfcd2cc984f071", "0x0d0707963952f2fba59dd06f2b425ace40b492fe", diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index 25c8a626966..d8bda326dbc 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -664,10 +664,6 @@ module.exports = { "16G1xYBbiNG78LSuZdMqp6tux5xvVp9Wxh", "38PFUcFi7o7RVYYJjWCodU9t9yiQ9Qt8Gw", // add on 22/10/2026 "1MEPB525tEHRFLdq6aR8d2t8jaaRQj2iWX", // add on 22/10/2026 - "bc1pjkxsx5sr9g6y2psjv680l40kewhf8xpnal96k9cncxgst7806kzqwxq9n4", - "bc1puglknm7e2hk5gdnu9rjx022g7rwc7xwegwdrgwspl07q55p6a3wq4y0rsj", - "bc1puk7pamvpvy5g4ccw8l0dl368jf5apauu384036yud9n2waq2xqysz0g6w3", - "bc1pg6t68yfcum3d2pp98h3h7sypra2yml03sa00hl7eqxe9zu6z48aqmq8t0s", ], hashkey: [ "bc1qyvppkaa74d9jvtz664a6uxmj09hf0eyg3uhx4h", diff --git a/registries/bitcoin.js b/registries/bitcoin.js index 4938b11cbd7..3fc5b67db34 100644 --- a/registries/bitcoin.js +++ b/registries/bitcoin.js @@ -75,7 +75,6 @@ const configs = { "gate-btc": { bitcoin: 'gateBtc', methodology: "BTC on btc chain", - doublecounted: true, }, "hemi-btc": { bitcoin: 'hemiBTC', From 694d45534b8252da68ad0b7efb53201c6fea621d Mon Sep 17 00:00:00 2001 From: luxa ecosystem Date: Thu, 5 Nov 2026 13:39:16 +0000 Subject: [PATCH 600/988] feat(ldex): add TVL adapter for LDEX on luxa (#22006) Co-authored-by: FelixBruguera --- projects/helper/chains.json | 1 + projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 2 +- projects/ldex/index.js | 25 +++++++++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 projects/ldex/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index e6e14b9bc7b..20b9ed668ef 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -294,6 +294,7 @@ "loop", "lukso", "lung", + "luxa", "m", "manta", "manta_atlantic", diff --git a/projects/helper/env.js b/projects/helper/env.js index 7b44b3b5e28..e6bfad6b349 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -91,6 +91,7 @@ const DEFAULTS = { ETN_RPC: 'https://blockexplorer.electroneum.com/api/eth-rpc', THORCHAIN_LCD: 'https://gateway.liquify.com/chain/thorchain_api', INITIA_LCD: 'https://rest.initia.xyz', + LUXA_LCD: 'https://api.luxaecosystem.xyz,https://luxaecosystem.alwaysdata.net', // mainnet.telos.net/evm now serves a 404 or an HTML page with HTTP 200, which the sdk treats as a successful call with a null result; rpc1.eu.telos.net hangs TELOS_RPC: 'https://rpc.telos.net,https://rpc1.us.telos.net/evm,https://telos.drpc.org,https://public.1rpc.io/telos/evm', TELOS_RPC_MULTICALL_V3: '0x4E06d6ec4a3A90790edee253C8BF098bbb4F51E5', diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 070f4046fb3..5427e43898f 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -21,7 +21,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'provenance', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', 'aura', 'xpla', 'bostrom', 'joltify', 'nibiru', 'kopi', 'elys', "pryzm", "mantra", 'agoric', 'band', 'axiome', 'allora', 'celestia', 'dydx', 'dungeon', 'carbon', 'milkyway', 'regen', 'sommelier', 'stride', 'prom', 'babylon', 'xion', 'zigchain', 'thorchain', - 'akash', 'fetchhub', 'initia', + 'akash', 'fetchhub', 'initia', 'luxa', ] const caseSensitiveChains = [...ibcChains, ...svmChains, 'canton', 'mina', 'decred', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge', 'stellar', 'massa', 'aleo', 'eclipse', 'acala', 'aelf', 'aeternity', 'alephium', 'bifrost', 'bittensor', 'verus', 'dash', 'qubic', 'constellation', 'supra', diff --git a/projects/ldex/index.js b/projects/ldex/index.js new file mode 100644 index 00000000000..36efa94dcbf --- /dev/null +++ b/projects/ldex/index.js @@ -0,0 +1,25 @@ +const { queryContracts, queryContract, sumTokens } = require('../helper/chain/cosmos') + +// LDEX pair contracts on luxa-1. Code 1 (genesis pairs) only hold bank denoms; +// code 4 pairs can hold a CW20 side, reported by `pair_info` +const LEGACY_PAIR_CODE_ID = 1 +const PAIR_CODE_ID = 4 + +async function tvl(api) { + const legacyPairs = await queryContracts({ chain: api.chain, codeId: LEGACY_PAIR_CODE_ID }) + const pairs = await queryContracts({ chain: api.chain, codeId: PAIR_CODE_ID }) + + for (const pair of pairs) { + const { token_a, token_b, reserve_a, reserve_b } = await queryContract({ api, contract: pair, data: { pair_info: {} } }) + if (token_a.startsWith('luxa1')) api.add(token_a, reserve_a) + if (token_b.startsWith('luxa1')) api.add(token_b, reserve_b) + } + + return sumTokens({ api, owners: [...legacyPairs, ...pairs] }) +} + +module.exports = { + timetravel: false, + methodology: 'TVL counts the native bank and CW20 reserves held by LDEX AMM pair contracts on LUXA.', + luxa: { tvl }, +} From 7bdcc698eeb5d9392b6d6350308ff035108d9786 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 5 Nov 2026 10:03:20 -0400 Subject: [PATCH 601/988] Add more vaults to Zyfai (#22041) Co-authored-by: Paul Co-authored-by: Cursor --- projects/zyfai/base.js | 25 ++++++++++++++ projects/zyfai/ethereum.js | 26 +++++++++++++++ projects/zyfai/index.js | 67 ++++++++++++++++++++++++++++++++++++-- 3 files changed, 115 insertions(+), 3 deletions(-) diff --git a/projects/zyfai/base.js b/projects/zyfai/base.js index 4f9399c97e8..ea5c3f652d6 100644 --- a/projects/zyfai/base.js +++ b/projects/zyfai/base.js @@ -108,6 +108,29 @@ const UNPRICED_VAULTS = [ '0x363600ac7173e8d91bcfee68d711bb93e992c110', // Superform GOOGLc '0x301a1ceb684d62833101b373ab6c395349b24033', // Superform AAPLc '0xc63374bf46d7a9654a96b14a3dc363c92b26d5a3', // Superform METAc + '0xaf0edf09ec7f9357292f6bc6445a09aa84a31fa7', // Superform TSLAC + '0x7778192c7e2c22a27c63d63485699888148d5919', // Superform MSFTC + '0x02b12a394f0a98b80e53d85f6831041932f1b621', // Superform SPCXC +]; + +// Wallet holds the share token. convertToAssets lives on the Machine, not the share. +const MAKINA_PAIRS = [ + { share: '0xB862067aa005bE1530cB0CEDFdF33658f9Bb1E01', machine: '0x473aD980F67487C03A8cf2A50C2a501C488bF9a3' }, // yNVDAc + { share: '0x91Faa9a75aED4CcF3e96f84C50BB9C2A5f3E6d1d', machine: '0x2ad7de46614FefEE6702b626dACa480538132510' }, // yAAPLc + { share: '0x4fAce8A423fc7C99E10c0dfe92fBd9633aA863fD', machine: '0x82FC5772a6fd76D308444963359c796954Ff3651' }, // yGOOGLc + { share: '0x34Ee32b53E8F167240a16b771B54F4D96d454ACD', machine: '0xc4aD7A9146bFEC1E0ce71345199172CA8824A220' }, // yMETAc + { share: '0x2864E4da1e818aAE5982C2D9B7634e459c4e2E86', machine: '0x55f1B3CB53d2bfbC67F7cb01D3D84d240Af7c2c4' }, // yAMZNc + { share: '0xAA27E79974EFa53276A866697FFF626f1cd0C7B4', machine: '0x073d562A17815e0266be74CAF15FbBD9D0f9B9a1' }, // yMSFTc + { share: '0x0dE17a4Ec93e389A501925139E5FeEF30BE3d368', machine: '0x584BEC800e3C0AE5B12FC329C9bCb30fD424f758' }, // yTSLAc +]; + +// Morpho Blue market ids. Not ERC-20s, so they stay out of allPoolTokens. +const MORPHO_BLUE_MARKETS = [ + '0xd4a903dc6d949519060c7707f9604fdc9772c046e05c2e3a8fce0bd7196e4109', // USDC/cbXRP + '0x73527ddd796e6d4f48387adaae36f6f3d49d606d7f2a15eb0c931416a58875d8', // USDC/cbDOGE + '0xd7520ad198b497b6eb75bc690268f4597630dbc12e305e9d4105843bab36e41d', // USDC/cbADA + '0xe458a501c1103ca3b256f2bcb45d223263fb34b6349d82675494ce3a94ce1327', // USDC/cbZEC + '0x76629002c9fdb20fb2092053a4f22c5c65e04a81887218b9546f2a2d82b4c0a8', // USDC/cbHYPE ]; const AUTOFINANCE_POOLS = { @@ -145,4 +168,6 @@ const allPoolTokens = [ module.exports = { allPoolTokens, unpricedVaults: UNPRICED_VAULTS, + makinaPairs: MAKINA_PAIRS, + morphoBlueMarkets: MORPHO_BLUE_MARKETS, }; diff --git a/projects/zyfai/ethereum.js b/projects/zyfai/ethereum.js index a0f8c2f760d..25031f3f727 100644 --- a/projects/zyfai/ethereum.js +++ b/projects/zyfai/ethereum.js @@ -72,6 +72,10 @@ const COMPOUND_POOLS = { 'Keyrock USDC V2': '0x04422053aDDbc9bB2759b248B574e3FCA76Bc145', 'KPK ETH Prime': '0xBb50A5341368751024ddf33385BA8cf61fE65FF9', 'Pendle Ecosystem USDC V2': '0x55C1B6e461a6334B567bAF0FEb5D728715446f05', + 'KPK USDT Prime': '0x870F0BF29A25A40E7CC087cD5C53e70C11F2C8A8', + 'UltraYield USDT Core': '0x85F3d81a39dF458E45d5EA20f9EB937fAafd282f', + 'Kabu USDC': '0x54210d3f1A066413891AF9E17210E787d5C6e3f4', + 'Huma USDC Main': '0x8aC91877b93330f52b2979a31a4879506021475c', }; // Fluid (Ethereum mainnet) @@ -123,8 +127,16 @@ const COMPOUND_POOLS = { WETH: '0x3A43AEC53490CB9Fa922847385D82fe25d0E9De7', }; + // Aave V4 spokes that coins.llama.fi already prices. Counted like every other receipt token. + const AAVE_V4_POOLS = { + 'Core USDC': '0x531E90a2376902DE8915789Fcc1075e3B0c153E7', + 'Core USDT': '0x5eC44a70F309854fe04d495cFE1B5dA63DD1cc73', + 'Core USDG': '0xAC2435E3C25e8246870D33ce0a26988A46d5DB68', + }; + const allPoolTokens = [ ...Object.values(AAVE_POOLS), + ...Object.values(AAVE_V4_POOLS), ...Object.values(COMPOUND_POOLS), ...Object.values(SPARK_POOLS), ...Object.values(ETHEREUM_MORPHO_POOLS), @@ -137,8 +149,22 @@ const COMPOUND_POOLS = { ...Object.values(SUPERFORM_POOLS), ]; + // ERC-4626 shares coins.llama.fi does not price. Same convertToAssets path as the other unpriced vaults. + const UNPRICED_VAULTS = [ + '0x7320CF22Ac095bA2a2e0a652F77efB836c2E751b', // Aave V4 Core WETH + '0x6D9e2Cdd61CaF69af99b275704B6e272C41c6718', // Aave V4 Core EURC + '0xf72bd5a56de97840f1fdd3641b556126c10aa1c4', // Concrete WBTC + ]; + + // Morpho Blue market id. Not an ERC-20, so it stays out of allPoolTokens. + const MORPHO_BLUE_MARKETS = [ + '0x6d95bf5fad1b0427205ee2b595f80b52e22394173de0832efa79fde88abb8525', // USDC/MORPHO + ]; + module.exports = { allPoolTokens, + unpricedVaults: UNPRICED_VAULTS, + morphoBlueMarkets: MORPHO_BLUE_MARKETS, }; \ No newline at end of file diff --git a/projects/zyfai/index.js b/projects/zyfai/index.js index 0060a7eb1c8..6f3d890efd2 100644 --- a/projects/zyfai/index.js +++ b/projects/zyfai/index.js @@ -1,6 +1,10 @@ -const { allPoolTokens: baseTokens, unpricedVaults: baseUnpricedVaults } = require('./base'); +const { allPoolTokens: baseTokens, unpricedVaults: baseUnpricedVaults, makinaPairs, morphoBlueMarkets: baseBlueMarkets } = require('./base'); const { getConfig } = require('../helper/cache'); -const { allPoolTokens: ethereumPoolTokens } = require('./ethereum'); +const { toAssetsDown } = require('../helper/morpoho'); +const morphoAbi = require('../helper/abis/morpho.json').morphoBlueFunctions; +const { allPoolTokens: ethereumPoolTokens, unpricedVaults: ethereumUnpricedVaults, morphoBlueMarkets: ethereumBlueMarkets } = require('./ethereum'); + +const MORPHO = '0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb'; // --- inlined from ./helpers --- const SILO_POOL_ADDRESSES = { @@ -119,6 +123,8 @@ const ARBITRUM_MORPHO_POOLS = { 'Yearn Degen': '0x36b69949d60d06ECcC14DE0Ae63f4E00cc2cd8B9', 'Steakhouse High Yield USDT': '0xbeeff77CE5C059445714E6A3490E273fE7F2492F', 'KPK USDC Yield' : '0x5837e4189819637853a357aF36650902347F5e73', + 'Steakhouse USDG Pro': '0xbeeFf72B77e7584a450E887125F25E8D8819016a', + 'Gauntlet USDG Premium': '0x390c1bb01F3F627144a40617e287d4cE3D5aBCfa', }; const ARBITRUM_SPARK_POOLS = { USDC: '0x940098b108fB7D0a7E374f6eDED7760787464609', @@ -222,6 +228,53 @@ async function unpricedVaultsTvl(api, owners, vaults) { amounts.forEach((amount, i) => { if (amount) api.add(convertAssets[i], amount); }); } +// projects/makina-finance values a share balance with these two calls. lastTotalAum() is the whole +// machine, so it is not used here: Zyfai only holds the share token. Llama prices the accounting token. +const makinaAbi = { + accountingToken: 'address:accountingToken', + convertToAssets: 'function convertToAssets(uint256 shares) view returns (uint256)', +}; + +async function makinaSharesTvl(api, owners, pairs) { + if (!owners.length || !pairs.length) return; + const accountings = await api.multiCall({ + abi: makinaAbi.accountingToken, + calls: pairs.map((pair) => pair.machine), + }); + const calls = owners.flatMap((owner) => pairs.map((pair) => ({ target: pair.share, params: [owner] }))); + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls }); + const held = []; + balances.forEach((shares, i) => { + if (!shares || BigInt(shares) === 0n) return; + const pairIndex = i % pairs.length; + held.push({ machine: pairs[pairIndex].machine, accountingToken: accountings[pairIndex], shares }); + }); + if (!held.length) return; + const amounts = await api.multiCall({ + abi: makinaAbi.convertToAssets, + calls: held.map(({ machine, shares }) => ({ target: machine, params: [shares] })), + }); + held.forEach(({ accountingToken }, i) => { if (amounts[i] && amounts[i] !== '0') api.add(accountingToken, amounts[i]); }); +} + +// Morpho Blue supply is not an ERC-20: convert supply shares with the market totals and add the +// loan token. Market ids stay out of allPoolTokens. +async function morphoBlueSupplyTvl(api, owners, marketIds) { + if (!owners.length || !marketIds.length) return; + const params = await api.multiCall({ target: MORPHO, abi: morphoAbi.idToMarketParams, calls: marketIds }); + const markets = await api.multiCall({ target: MORPHO, abi: morphoAbi.market, calls: marketIds }); + const positions = await api.multiCall({ + target: MORPHO, + abi: morphoAbi.position, + calls: owners.flatMap((owner) => marketIds.map((id) => ({ params: [id, owner] }))), + }); + positions.forEach((position, i) => { + const m = i % marketIds.length; + const assets = toAssetsDown(position.supplyShares, markets[m].totalSupplyAssets, markets[m].totalSupplyShares); + api.add(params[m].loanToken, assets.toString()); + }); +} + async function tvl(api) { const owners = await getConfig('zyfai/'+api.chain, `https://api.zyf.ai/api/v1/data/active-wallets?chainId=${api.chainId}`); const cleanOwners = owners.filter(o => o !== ''); @@ -235,13 +288,21 @@ async function tvl(api) { if (api.chain === 'base') { await unpricedVaultsTvl(api, cleanOwners, baseUnpricedVaults); + await makinaSharesTvl(api, cleanOwners, makinaPairs); + await morphoBlueSupplyTvl(api, cleanOwners, baseBlueMarkets); + } + + if (api.chain === 'ethereum') { + await unpricedVaultsTvl(api, cleanOwners, ethereumUnpricedVaults); + await morphoBlueSupplyTvl(api, cleanOwners, ethereumBlueMarkets); } return api.sumTokens({ownerTokens: cleanOwners.map(o => [TOKENS[api.chain], o])}); } module.exports = { - methodology: 'Counts the TVL of all smart wallet accounts deployed by ZyFAI protocol across multiple DeFi protocols', + doublecounted: true, + methodology: 'Counts the TVL of all smart wallet accounts deployed by ZyFAI protocol across multiple DeFi protocols. Receipt tokens that Llama prices are summed directly, including priced Aave V4 spokes. Shares Llama does not price use the existing convertToAssets path. Makina share balances use the makina-finance valuation: convertToAssets on the Machine into the accounting token. Morpho Blue supply shares are converted with the market totals and added as the loan token.', sonic: { tvl }, base: { tvl }, arbitrum: { tvl }, From b0c2a239128709145bb9e71d9ccd687c0e288147 Mon Sep 17 00:00:00 2001 From: laukiantonson Date: Thu, 5 Nov 2026 19:35:29 +0530 Subject: [PATCH 602/988] fluid: add sui (#22021) Co-authored-by: FelixBruguera --- projects/fluid/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/projects/fluid/index.js b/projects/fluid/index.js index 802e33f6194..b048a23824c 100644 --- a/projects/fluid/index.js +++ b/projects/fluid/index.js @@ -1,5 +1,6 @@ const ADDRESSES = require("../helper/coreAssets.json"); const methodologies = require("../helper/methodologies"); +const sui = require("../helper/chain/sui"); const abi = { getOverallTokensDataLegacy: "function getOverallTokensData(address[] tokens_) view returns ((uint256 borrowRate, uint256 supplyRate, uint256 fee, uint256 lastStoredUtilization, uint256 storageUpdateThreshold, uint256 lastUpdateTimestamp, uint256 supplyExchangePrice, uint256 borrowExchangePrice, uint256 supplyRawInterest, uint256 supplyInterestFree, uint256 borrowRawInterest, uint256 borrowInterestFree, uint256 totalSupply, uint256 totalBorrow, uint256 revenue, (uint256 version, (address token, uint256 kink, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink, uint256 rateAtUtilizationMax) rateDataV1, (address token, uint256 kink1, uint256 kink2, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink1, uint256 rateAtUtilizationKink2, uint256 rateAtUtilizationMax) rateDataV2) rateData)[] overallTokensData_)", @@ -90,6 +91,32 @@ async function borrowed(api) { ); } +// Sui: every token sits in the Liquidity layer as a TokenReserve object (Balance in `vault`), +// lending fTokens and vaults supply/borrow through it, same model as the EVM Liquidity contract +const SUI_LIQUIDITY_PACKAGE = "0x03dbce0f4cbd6325ca81414cc63a82f35e32bb941610b9120fab0997bc70daa3"; +const SUI_TOKEN_RESERVE = `${SUI_LIQUIDITY_PACKAGE}::reserve::TokenReserve`; +const SUI_EXCHANGE_PRICES_PRECISION = 10n ** 12n; + +const suiAmount = (v) => BigInt(typeof v === "object" && v !== null ? (v.fields?.value ?? v.value) : v); + +async function getSuiReserves() { + const reserves = await sui.getObjectsByType(SUI_TOKEN_RESERVE); + return reserves.map(({ type, fields }) => ({ coinType: type.slice(type.indexOf("<") + 1, -1), fields })); +} + +async function suiTvl(api) { + const reserves = await getSuiReserves(); + reserves.forEach(({ coinType, fields }) => api.add(coinType, suiAmount(fields.vault).toString())); +} + +async function suiBorrowed(api) { + const reserves = await getSuiReserves(); + reserves.forEach(({ coinType, fields }) => { + const withInterest = (suiAmount(fields.total_borrow_with_interest) * suiAmount(fields.borrow_exchange_price)) / SUI_EXCHANGE_PRICES_PRECISION; + api.add(coinType, (withInterest + suiAmount(fields.total_borrow_interest_free)).toString()); + }); +} + module.exports = { methodology: methodologies.lendingMarket, ethereum: { tvl, borrowed }, @@ -97,5 +124,6 @@ module.exports = { base: { tvl, borrowed }, polygon: { tvl, borrowed }, plasma: { tvl, borrowed }, + sui: { tvl: suiTvl, borrowed: suiBorrowed }, }; // node test.js projects/fluid/index.js From fe94ede1186f56b43b0abc0f4de586e4cd9bb038 Mon Sep 17 00:00:00 2001 From: AutumnRain7 Date: Thu, 5 Nov 2026 09:17:14 -0500 Subject: [PATCH 603/988] Add Panda Financial (#22022) Co-authored-by: FelixBruguera --- projects/panda-financial/index.js | 53 +++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 projects/panda-financial/index.js diff --git a/projects/panda-financial/index.js b/projects/panda-financial/index.js new file mode 100644 index 00000000000..324518a28a8 --- /dev/null +++ b/projects/panda-financial/index.js @@ -0,0 +1,53 @@ +const { sumTokens2, addUniV3LikePosition } = require('../helper/unwrapLPs') + +const REGISTRY = '0x52643dCDdd95944b01f10A4949d2923a0ff69FCC' +const REGISTRY_DEPLOY_BLOCK = 52155564 +const OLD_VAULT = '0xf5D48b04D4529D652BFAE172E8Fb47b389Db920e' // first vault, predates the registry and is not listed in it + +const abi = { + vaults: 'address[]:vaults', + pool: 'address:pool', + gauge: 'address:gauge', + positionManager: 'address:positionManager', + stakedValues: 'function stakedValues(address depositor) view returns (uint256[])', + token0: 'address:token0', + token1: 'address:token1', + slot0: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, bool unlocked)', + positions: 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', +} + +// Each deposit is its own position NFT, staked in the pool's gauge, so the gauge lists each vault's open positions. +// NFTs the vaults hold directly are closed positions with no liquidity. +async function tvl(api) { + const block = await api.getBlock() + const registered = block >= REGISTRY_DEPLOY_BLOCK ? await api.call({ target: REGISTRY, abi: abi.vaults }) : [] + const vaults = [OLD_VAULT, ...registered] + const pools = await api.multiCall({ abi: abi.pool, calls: vaults }) + const gauges = await api.multiCall({ abi: abi.gauge, calls: vaults }) + const managers = await api.multiCall({ abi: abi.positionManager, calls: vaults }) + const token0s = await api.multiCall({ abi: abi.token0, calls: pools }) + const token1s = await api.multiCall({ abi: abi.token1, calls: pools }) + const slot0s = await api.multiCall({ abi: abi.slot0, calls: pools }) + + const tokensAndOwners = [] + for (let i = 0; i < vaults.length; i++) { + const ids = await api.call({ target: gauges[i], abi: abi.stakedValues, params: [vaults[i]] }) + const positions = await api.multiCall({ target: managers[i], abi: abi.positions, calls: ids }) + + positions.forEach(({ tickLower, tickUpper, liquidity, tokensOwed0, tokensOwed1 }) => { + addUniV3LikePosition({ api, token0: token0s[i], token1: token1s[i], liquidity: +liquidity, tickLower: +tickLower, tickUpper: +tickUpper, tick: +slot0s[i].tick }) + api.add(token0s[i], tokensOwed0) + api.add(token1s[i], tokensOwed1) + }) + tokensAndOwners.push([token0s[i], vaults[i]], [token1s[i], vaults[i]]) + } + return sumTokens2({ api, tokensAndOwners }) +} + +module.exports = { + doublecounted: true, // positions sit in Aero concentrated-liquidity pools, already counted in Aero's TVL (projects/aero-lite) + methodology: + "Counts the WETH and USDC in every open position of Panda's old vault and of each vault in its on-chain registry at the current pool price, plus tokens owed to those positions and idle WETH and USDC held by the vaults. AERO rewards waiting to be claimed are not counted.", + start: '2026-09-12', + base: { tvl }, +} From 45fb9d561fe847ae58e946ed1dedaa01e7f7ab94 Mon Sep 17 00:00:00 2001 From: ti-zzz Date: Thu, 5 Nov 2026 22:18:43 +0800 Subject: [PATCH 604/988] morpheus: add BSC Algebra factory TVL (#22035) Co-authored-by: Cursor --- registries/uniswapV3.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 90dad99939d..29b78080ced 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -979,12 +979,17 @@ const uniV3Configs = { }, 'morpheus': { start: '2026-08-13', - methodology: 'Counts tokens locked in Algebra Integral concentrated liquidity pools created by the Morpheus factory on Robinhood Chain.', + methodology: 'Counts tokens locked in Algebra Integral concentrated liquidity pools created by the Morpheus factory on Robinhood Chain and BSC.', robinhood: { factory: '0x10253594A832f967994b44f33411940533302ACb', fromBlock: 35371149, isAlgebra: true, }, + bsc: { + factory: '0x2D071bA94C32A8a9bA594771EbF628b2b48b4389', + fromBlock: 131415661, + isAlgebra: true, + }, }, 'naka-dex': { naka: { From b409bbca4c223bb840b702e1b10bcd194688491e Mon Sep 17 00:00:00 2001 From: KIdPaddle <103218088+KidPaddle591@users.noreply.github.com> Date: Thu, 5 Nov 2026 15:21:51 +0100 Subject: [PATCH 605/988] diversifi: fix TVL dropping to $0 after vault account resize (#22037) Co-authored-by: Claude Opus 5.5 --- projects/diversifi/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/projects/diversifi/index.js b/projects/diversifi/index.js index 9601291cfb1..b0bdbc48b93 100644 --- a/projects/diversifi/index.js +++ b/projects/diversifi/index.js @@ -28,7 +28,10 @@ const { } = require('../helper/solana') const PROGRAM_ID = '3vyr9DRfMZb2KvUQdnps7YG3PY38XdguLBQaJ2DFkSxk' -const VAULT_ACCOUNT_SIZE = 246 +// Vault accounts were reallocated from 246 to 348 bytes (Oct/Nov 2026 program upgrade); +// the extra bytes are appended, so the mint offsets below are unchanged. Keep both sizes +// so a vault that hasn't been migrated yet is still counted. +const VAULT_ACCOUNT_SIZES = [246, 348] const PRODUCT_MINT_OFFSET = 33 const MINT_SLOT_OFFSETS = [33, 76, 110, 144, 178, 212] const EMPTY_MINT = '11111111111111111111111111111111' // all-zero pubkey = unused slot @@ -53,9 +56,9 @@ function bs58encode(bytes) { async function getVaultTokenAccounts() { const connection = getConnection() - const accounts = await connection.getProgramAccounts(new PublicKey(PROGRAM_ID), { - filters: [{ dataSize: VAULT_ACCOUNT_SIZE }], - }) + const accounts = (await Promise.all(VAULT_ACCOUNT_SIZES.map((dataSize) => + connection.getProgramAccounts(new PublicKey(PROGRAM_ID), { filters: [{ dataSize }] }) + ))).flat() const tokenAccounts = new Set() const blacklistedTokens = new Set() for (const { pubkey, account } of accounts) { From c746eaa40b1278fb895d5fc878d1690d41f2db87 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 5 Nov 2026 10:29:35 -0400 Subject: [PATCH 606/988] fix loopscale (#22043) --- projects/loopscale/index.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/projects/loopscale/index.js b/projects/loopscale/index.js index c3eae36d890..718768fe743 100644 --- a/projects/loopscale/index.js +++ b/projects/loopscale/index.js @@ -240,31 +240,22 @@ function getCollateralValuesForLoans(loans) { return mintBalances; } -function getOutstandingBalanceForStrategy(strategy, currentTimestamp) { - // current_deployed_amount - // plus - // interest_outstanding - // plus - // interest_per_second - // times - // (current_timestamp - last_accrued_timestamp) - const lastAccruedTimestamp = bytesToBigIntLE(new Uint8Array(strategy.lastAccruedTimestamp[0])); - const interestPerSecond = bytesToBigIntLE(new Uint8Array(strategy.interestPerSecond[0])) / BigInt(1e18); +// interest accrued since last_accrued_timestamp is not extrapolated: a corrupt interest_per_second +// on one strategy (6tv6XYnX..., ~70M USDC/s) inflated borrowed to trillions +function getOutstandingBalanceForStrategy(strategy) { const currentDeployedAmount = bytesToBigIntLE(new Uint8Array(strategy.currentDeployedAmount[0])); const outstandingInterestAmount = bytesToBigIntLE(new Uint8Array(strategy.outstandingInterestAmount[0])); - const unaccruedInterest = interestPerSecond * (BigInt(currentTimestamp) - lastAccruedTimestamp); - return currentDeployedAmount + outstandingInterestAmount + unaccruedInterest; + return currentDeployedAmount + outstandingInterestAmount; } function getOutstandingDebt(strategies) { const strategyBalances = {}; - const currentTimestamp = Math.floor(Date.now() / 1000); for(let i = 0; i < strategies.length; i++) { const strategy = strategies[i].account; const mint = strategy.principalMint.toString(); - const outstandingBalance = getOutstandingBalanceForStrategy(strategy, currentTimestamp); + const outstandingBalance = getOutstandingBalanceForStrategy(strategy); strategyBalances[mint] = strategyBalances[mint] ? strategyBalances[mint] + outstandingBalance : outstandingBalance; } From be761f1bd5809f3ae73f24c62e944ca8dc02f8e8 Mon Sep 17 00:00:00 2001 From: hyperhivefinance Date: Thu, 5 Nov 2026 21:51:51 +0700 Subject: [PATCH 607/988] Add HyperHive TVL adapter (#22034) Co-authored-by: FelixBruguera --- projects/hyperhive/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/hyperhive/index.js diff --git a/projects/hyperhive/index.js b/projects/hyperhive/index.js new file mode 100644 index 00000000000..b1d21c82ef9 --- /dev/null +++ b/projects/hyperhive/index.js @@ -0,0 +1,17 @@ +const MARKET_HUB = '0xDD0CD3c660C8bcFC48B4d02f405fAa5d9D13099C' + +const GET_MARKETS_ABI = + 'function getMarkets() view returns ((uint256 marketId, address market, address asset, uint8 assetDecimals, uint8 shareDecimals, bool enabled, bool miningEnabled, uint256 totalAssets, uint256 totalSupply, uint256 totalRewardsAccrued, uint256 apyBps, uint256 exchangeRate)[] result)' + +async function tvl(api) { + const markets = await api.call({ target: MARKET_HUB, abi: GET_MARKETS_ABI }) + return api.sumTokens({ tokensAndOwners: markets.map(m => [m.asset, m.market]) }) +} + +module.exports = { + methodology: + 'Counts the tokens held by every HyperHive market listed in the HiveMarketHub contract.', + hyperliquid: { + tvl, + }, +} \ No newline at end of file From 55d6859c040603f595106786b24305a917bd66c3 Mon Sep 17 00:00:00 2001 From: labs-alpha Date: Thu, 5 Nov 2026 16:02:57 +0100 Subject: [PATCH 608/988] alpha-launchpad: add Solana TVL (#22036) Co-authored-by: labs-alpha <332989026+labs-alpha@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/alpha-launchpad/index.js | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/projects/alpha-launchpad/index.js b/projects/alpha-launchpad/index.js index 0c6056a1866..d6a237c4176 100644 --- a/projects/alpha-launchpad/index.js +++ b/projects/alpha-launchpad/index.js @@ -1,4 +1,6 @@ +const { PublicKey } = require('@solana/web3.js') const { getLogs2 } = require('../helper/cache/getLogs') +const { getConnection, sumTokens2 } = require('../helper/solana') const launched = 'event Launched(address indexed market, address indexed token, address indexed creator, address quote, bool nativeAlpha)' @@ -14,13 +16,30 @@ const config = { async function tvl(api) { const { factory, fromBlock } = config[api.chain] const logs = await getLogs2({ api, target: factory, eventAbi: launched, fromBlock }) - // A market's quote balance also holds unsettled fees, so read the curve principal instead - const principals = await api.multiCall({ abi: 'uint256:principal', calls: logs.map(l => l.market) }) - api.add(logs.map(l => l.quote), principals) + return api.sumTokens({ tokensAndOwners: logs.map(l => [l.quote, l.market]) }) +} + +// ALPHA launch program on Solana +const SOLANA_PROGRAM = new PublicKey('r4yX8Q9Z5zSLY2fjoq1DgijfoHLru49zfikq79pa1fa') +// Base58 of the Anchor `Market` account discriminator +const MARKET_DISCRIMINATOR = 'dkokXHR3DTw' +// Market account: 8 discriminator, 5 header, then ten pubkeys, of which the quote vault is the seventh +const QUOTE_VAULT_OFFSET = 13 + 32 * 6 + +// Graduation moves the vault's balance to Meteora DAMM v2, so the balance needs no stage check +async function solanaTvl(api) { + const markets = await getConnection().getProgramAccounts(SOLANA_PROGRAM, { + filters: [{ memcmp: { offset: 0, bytes: MARKET_DISCRIMINATOR } }], + dataSlice: { offset: QUOTE_VAULT_OFFSET, length: 32 }, + }) + return sumTokens2({ api, tokenAccounts: markets.map(m => new PublicKey(m.account.data).toBase58()) }) } module.exports = { - methodology: 'TVL is the pairing asset held as curve principal by each ALPHA bonding-curve market. Markets are read from the factory Launched events. Fees waiting to be settled are excluded. Graduated liquidity sits in Uniswap v4 and is not counted here.', + // Solana is read from current account state, which has no history + timetravel: false, + methodology: 'TVL is the pairing asset held by each ALPHA bonding-curve market. Markets are read from the factory Launched events on EVM chains and from the program Market accounts on Solana, and counted at the pairing asset balance they hold, which includes fees waiting to be settled. Graduated liquidity sits in Uniswap v4 or Meteora DAMM v2 and is not counted here.', + solana: { tvl: solanaTvl }, } Object.keys(config).forEach(chain => { From b6ff872b6f2993e18f808f36929aa6be6a01981f Mon Sep 17 00:00:00 2001 From: Tim Mustafin Date: Thu, 5 Nov 2026 19:10:57 +0100 Subject: [PATCH 609/988] fix(shield-swap): include USDG in TVL (#22046) Co-authored-by: Claude Opus 5.5 --- projects/shield-swap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/shield-swap/index.js b/projects/shield-swap/index.js index e507c7c0401..33dcbb4f271 100644 --- a/projects/shield-swap/index.js +++ b/projects/shield-swap/index.js @@ -9,6 +9,7 @@ const TOKENS = [ { program: 'arc20_wbtc.aleo', coingeckoId: 'bitcoin', decimals: 8 }, { program: 'shield_swap_arc20_wrapped_zec.aleo', coingeckoId: 'zcash', decimals: 8 }, { program: 'shield_swap_arc20_wrapped_usdcx.aleo', coingeckoId: 'usd-coin', decimals: 6 }, + { program: 'shield_swap_arc20_wrapped_usdg.aleo', coingeckoId: 'global-dollar', decimals: 6 }, ] const toBigInt = (v) => (v ? BigInt(String(v).replace(/u\d+$/, '')) : 0n) @@ -35,6 +36,6 @@ module.exports = { timetravel: false, misrepresentedTokens: true, methodology: - 'TVL is the aggregate balance held by shield_swap.aleo in Shield Swap\'s verified ALEO, ETH, SOL, WBTC, ZEC, and USDCx token programs, read directly from Aleo chain state. It includes pool capital, accrued fees, and funds awaiting claims.', + 'TVL is the aggregate balance held by shield_swap.aleo in Shield Swap\'s verified ALEO, ETH, SOL, WBTC, ZEC, USDCx, and USDG token programs, read directly from Aleo chain state. It includes pool capital, accrued fees, and funds awaiting claims.', aleo: { tvl }, } From 1ec006f934f5d109cfd781a2b039f97f08be2011 Mon Sep 17 00:00:00 2001 From: Glaze Corp <103470526+glazecorp@users.noreply.github.com> Date: Thu, 5 Nov 2026 20:47:48 +0200 Subject: [PATCH 610/988] Add GlazeCorp TVL adapter (#22027) Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/glazecorp/index.js | 61 +++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 projects/glazecorp/index.js diff --git a/projects/glazecorp/index.js b/projects/glazecorp/index.js new file mode 100644 index 00000000000..7bc1309611e --- /dev/null +++ b/projects/glazecorp/index.js @@ -0,0 +1,61 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +// Launchpad creates every fund: a Coin, a Fund that holds the backing, a Mine, a Resonance and strategy Auctions. +const LAUNCHPAD = '0x6ff3828435e96E343678E58F4677Da1dcEEE0C17' +const fromBlock = 100771402 + +const launchAbi = 'function getLaunch(uint256) view returns ((uint256 launchId, uint256 creatorNonce, address originalCreator, address controller, address coin, address fund, address signalCoin, address resonance, address resonanceRouter, address mine, address pool, address baseToken, uint24 swapFee, bytes32 poolId, address[] paymentTokens, address[] auctions, address[] bribes, address[] bribeRouters, uint256 baseSeedAmount, uint256 coinSeedAmount, uint256 creatorCoinAmount, uint256 depositedBaseAmount, uint256 depositedCoinAmount, uint256 burnedCoinDust, uint256 genesisShares, uint160 sqrtPriceX96, bool autoSignalCreator, bool receiveSwapFees, uint256[] creatorSignalAmounts, uint256[] initialAuctionPrices))' +const strategyAddedEvent = 'event StrategyAdded(address indexed strategy, address indexed bribe, address indexed bribeRouter, address paymentToken)' + +async function tvl(api) { + const count = await api.call({ target: LAUNCHPAD, abi: 'uint256:launchCount' }) + const ids = Array.from({ length: Number(count) }, (_, i) => i + 1) + const launches = await api.multiCall({ target: LAUNCHPAD, abi: launchAbi, calls: ids }) + // Mining payments and fund revenue are always in USDG, even for funds whose pool uses another base token + const usdg = await api.call({ target: LAUNCHPAD, abi: 'address:usdg' }) + + // Strategies added after launch, per fund + const added = [] + for (const l of launches) + added.push(await getLogs2({ api, target: l.resonance, eventAbi: strategyAddedEvent, fromBlock, extraKey: 'strategy-added' })) + + // Strategies can accept any token, so every fund's own coin and Uniswap v4 LP wrapper is excluded everywhere + const excluded = new Set(launches.flatMap(l => [l.coin, l.pool]).map(a => a.toLowerCase())) + const isCounted = token => !excluded.has(token.toLowerCase()) + + const tokensAndOwners = [] + const bribes = [] + launches.forEach((l, i) => { + const strategies = l.auctions.map((auction, j) => ({ auction, bribe: l.bribes[j], bribeRouter: l.bribeRouters[j], paymentToken: l.paymentTokens[j] })) + added[i].forEach(s => strategies.push({ auction: s.strategy, bribe: s.bribe, bribeRouter: s.bribeRouter, paymentToken: s.paymentToken })) + + // Fund backing: every asset the fund buys, plus its base token and USDG, redeemable by coin holders + const fundTokens = new Set([l.baseToken, usdg, ...strategies.map(s => s.paymentToken)].filter(isCounted)) + fundTokens.forEach(token => tokensAndOwners.push([token, l.fund])) + + // USDG on its way to buy assets: revenue router, the 7-day Resonance stream and the strategy Auctions + ;[l.resonanceRouter, l.resonance, ...strategies.map(s => s.auction)].forEach(owner => tokensAndOwners.push([usdg, owner])) + + strategies.forEach(s => { + // Bribe share of auction payments, buffered in the BribeRouter before it streams to signalers + if (isCounted(s.paymentToken)) tokensAndOwners.push([s.paymentToken, s.bribeRouter]) + bribes.push(s.bribe) + }) + + // Mine: unclaimed USDG payouts owed to outgoing miners and creators + tokensAndOwners.push([usdg, l.mine]) + }) + + // Bribes: rewards held for signalers + const rewardTokens = await api.multiCall({ abi: 'address[]:rewardTokens', calls: bribes }) + bribes.forEach((bribe, i) => rewardTokens[i].filter(isCounted).forEach(token => tokensAndOwners.push([token, bribe]))) + + // Creators choose fund assets freely, so one token that cannot report a balance must not stop TVL for every fund + await api.sumTokens({ tokensAndOwners, permitFailure: true }) +} + +module.exports = { + methodology: 'TVL counts the assets held by each GlazeCorp fund (redeemable by fund coin holders), USDG waiting to buy assets in each fund\'s revenue router, Resonance stream and strategy auctions, bribe rewards held for signalers, and unclaimed mining payouts held by each Mine. Fund coins and fund pool liquidity are excluded; pool liquidity sits in Uniswap v4 and is counted there.', + start: '2026-10-29', + robinhood: { tvl }, +} From 255d72649cbe9a196b4d1961c619825e9fd0481f Mon Sep 17 00:00:00 2001 From: totalprosolutionexpert-rgb Date: Fri, 6 Nov 2026 00:01:39 +0500 Subject: [PATCH 611/988] Add Ignite DEX TVL (#22038) Co-authored-by: FelixBruguera --- registries/sumTokens/data3.js | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 90cf4139c36..5d6d6d79ffd 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1260,4 +1260,45 @@ module.exports = { "tvl": { "owner": "0xAfE63c71bA1D70992C9d7B01c0F1eD5c51941a8f", "tokens": [ADDRESSES.arbitrum.USDC_CIRCLE] }, } }, + "ignite-dex": { + // Live vault and asset list: https://api.ignite.trade/v1/escrow/config and https://api.ignite.trade/v1/solana/status + "methodology": "TVL is the balance of the assets held in the Ignite custody vaults: the escrow vault contracts on Ethereum, Base and BNB Chain, and the Squads multisig vault on Solana. It includes trader deposits and the liquidity in Ignite pools, which is held in the same vaults.", + "ethereum": { + "owner": "0x01dDd01Ba9C32795a39cfDa71184958d47E0a08E", + "tokens": [ + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + "0xbd79b7db6f70979df7f4124e161eb3586085d140", // LAX + "0x2b591e99afe9f32eaa6214f7b7629768c40eeb39", // HEX + "0xff74317e948695297acb79cb2de06111f5cc16b3", // ONE + ] + }, + "base": { + "owner": "0x01dDd01Ba9C32795a39cfDa71184958d47E0a08E", + "tokens": [ + ADDRESSES.base.USDC, + ADDRESSES.base.USDT, + "0xe7645444eb4e8e04d886c7038dd0152d331d3680", // LAX + ] + }, + "bsc": { + "owner": "0x4368ED53e2F31F5B3540369466E5775fD0422eDE", + "tokens": [ + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.USDT, + "0x11125e44843170467a7955d29776d63760ea4b6e", // LAX + "0xb2a1ca465cc250cdc16639e49be0d948e095febc", // JOT + "0x528605856a9eb9567688b0e912ed6961522a74d4", // MUSA + "0x36b2269fd151208a4bfc3dea503e0a6f2485fa78", // TUA + "0x21d6d37411d86fafdc565260e81e7a585bc44119", // FGPT + "0xaeb63742f2c7dd1538bbe2285b6789017a06b58b", // COLLE + "0x2e156a3e09782a785345b7a33c46c71596ffd551", // IMAGE + ] + }, + "solana": { + // Squads multisig EaPDGTPXFun7oLAv7ApwBUZfAHruxrAQTBTE9L7TDmT8, vault index 0: SOL plus SPL / Token-2022 deposits + "owner": "6ShdjduDkwcBi9jEeYQFbAvsqUGgYrX2ASxjfHypEkYa", + "solOwners": ["6ShdjduDkwcBi9jEeYQFbAvsqUGgYrX2ASxjfHypEkYa"] + }, + }, } From 5aa3c104e0af705f90b7953a08bb3e35eeeccd00 Mon Sep 17 00:00:00 2001 From: 0xLaurens <32776056+0xLaurenzo@users.noreply.github.com> Date: Thu, 5 Nov 2026 20:33:59 +0100 Subject: [PATCH 612/988] feat(mezzanine): add solana holdings and kamino net positions (#22045) Co-authored-by: FelixBruguera --- projects/mezzanine/index.js | 4 +- projects/mezzanine/solana.js | 96 ++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 projects/mezzanine/solana.js diff --git a/projects/mezzanine/index.js b/projects/mezzanine/index.js index 930e1c2dd81..36efbb87508 100644 --- a/projects/mezzanine/index.js +++ b/projects/mezzanine/index.js @@ -69,8 +69,10 @@ async function borrowed(api) { module.exports = { doublecounted: true, + timetravel: false, start: '2026-10-12', methodology: - 'TVL is the Hastra PRIME/AUTO collateral the Hastra Optimizer strategy holds on Morpho Blue, plus any loan assets it supplies and the balances idle in the issuance vault and executor, less its outstanding Morpho debt. The strategy loops PRIME/AUTO against borrowed stablecoins, so netting the debt leaves the vault NAV that backs the tranches. Marked doublecounted: the same collateral is counted under Morpho, and PRIME/AUTO are already tracked as Hastra RWA assets.', + 'TVL is the Hastra PRIME/AUTO collateral the Hastra Optimizer strategy holds on Morpho Blue, plus any loan assets it supplies and the balances idle in the issuance vault and executor, less its outstanding Morpho debt. The strategy loops PRIME/AUTO against borrowed stablecoins, so netting the debt leaves the vault NAV that backs the tranches. Solana adds SPL and Token-2022 balances of the strategy wallet plus Kamino collateral redeemed at reserve exchange rates, less Kamino debt adjusted to reserve cumulative borrow rates. Native SOL reserved for gas is excluded. Marked doublecounted: the same collateral is counted under Morpho or Kamino, and PRIME/AUTO are already tracked as Hastra RWA assets.', ethereum: { tvl, borrowed }, + solana: require('./solana'), } diff --git a/projects/mezzanine/solana.js b/projects/mezzanine/solana.js new file mode 100644 index 00000000000..024168856ff --- /dev/null +++ b/projects/mezzanine/solana.js @@ -0,0 +1,96 @@ +const { PublicKey } = require('@solana/web3.js') +const { BorshAccountsCoder } = require('@project-serum/anchor') +const { svm } = require('@defillama/sdk').chains +const { getMultipleAccounts, sumTokens2 } = require('../helper/solana') +const kaminoIdl = require('../kamino-lending/kamino-lending-idl.json') + +const OWNER = '5eP1ZevYtTNxQs5yzRqvpDgeZmZdcsJEscVLQAFYVMsV' +const KLEND = 'KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD' +const OBLIGATION_SIZE = 3344 +const SF = 2n ** 60n +const coder = new BorshAccountsCoder(kaminoIdl) +const OBLIGATION_DISCRIMINATOR = BorshAccountsCoder.accountDiscriminator('Obligation') +const big = bn => BigInt(bn.toString()) +const bigFraction = ({ value }) => value.reduce((acc, word, i) => acc + (big(word) << BigInt(64 * i)), 0n) +const keyAt = (data, offset) => new PublicKey(data.subarray(offset, offset + 32)).toBase58() +const uint = (data, offset, words = 2) => { + let value = 0n + for (let i = words - 1; i >= 0; i--) value = (value << 64n) + data.readBigUInt64LE(offset + i * 8) + return value +} + +async function positions(api) { + const obligations = await svm.getProgramAccounts({ + chain: api.chain, programId: KLEND, + filters: [{ dataSize: OBLIGATION_SIZE }, { memcmp: { offset: 64, bytes: OWNER } }], + }) + const deposits = [] + const borrows = [] + // Obligation is not in the shared kamino IDL, so it is read by offset from klend's zero-copy layout: + // deposits[8] at 96 (136 bytes each), borrows[5] at 1208 (200 bytes each). SF is U68F60; BSF is a LE U256. + // https://github.com/Kamino-Finance/klend/blob/77e81854909ab7ffea3a2e898b2554d96e07daac/programs/klend/src/state/obligation.rs + for (const { account } of obligations) { + const data = Buffer.from(account.data[0], 'base64') + if (account.owner !== KLEND || data.length !== OBLIGATION_SIZE || !data.subarray(0, 8).equals(OBLIGATION_DISCRIMINATOR)) + throw new Error('mezzanine: invalid Kamino Obligation account') + if (keyAt(data, 64) !== OWNER) throw new Error('mezzanine: unexpected obligation owner') + const market = keyAt(data, 32) + for (let i = 0; i < 8; i++) { + const offset = 96 + i * 136 + const amount = data.readBigUInt64LE(offset + 32) + if (amount) deposits.push({ reserve: keyAt(data, offset), amount, market }) + } + for (let i = 0; i < 5; i++) { + const offset = 1208 + i * 200 + const amount = uint(data, offset + 88) + if (amount) borrows.push({ reserve: keyAt(data, offset), amount, rate: uint(data, offset + 32, 4), market }) + } + } + const keys = [...new Set([...deposits, ...borrows].map(p => p.reserve))] + if (!keys.length) return { deposits: [], borrows: [] } + const accounts = await getMultipleAccounts(keys, { api }) + const reserves = Object.fromEntries(keys.map((key, i) => { + const account = accounts[i] + if (!account || account.owner.toString() !== KLEND) throw new Error(`mezzanine: invalid Kamino Reserve ${key}`) + return [key, coder.decode('Reserve', account.data)] + })) + const resolve = position => { + const reserve = reserves[position.reserve] + if (reserve.lendingMarket.toString() !== position.market) throw new Error('mezzanine: reserve market mismatch') + return reserve + } + return { + deposits: deposits.map(p => { + const { liquidity, collateral } = resolve(p) + // Same ReserveLiquidity.total_supply() fee deductions as klend's collateral exchange rate. + const total = big(liquidity.availableAmount) * SF + big(liquidity.borrowedAmountSf) + - big(liquidity.accumulatedProtocolFeesSf) - big(liquidity.accumulatedReferrerFeesSf) - big(liquidity.pendingReferrerFeesSf) + const supply = big(collateral.mintTotalSupply) + if (!supply || total < 0n) throw new Error('mezzanine: invalid Kamino collateral exchange rate') + return { mint: liquidity.mintPubkey.toString(), amount: p.amount * total / (supply * SF) } + }), + borrows: borrows.map(p => { + const { liquidity } = resolve(p) + const rate = bigFraction(liquidity.cumulativeBorrowRateBsf) + if (!p.rate || rate < p.rate) throw new Error('mezzanine: invalid Kamino borrow rate') + // Refresh obligation debt to the reserve's cumulative rate; round debt up. + const denominator = p.rate * SF + return { mint: liquidity.mintPubkey.toString(), amount: (p.amount * rate + denominator - 1n) / denominator } + }), + } +} + +async function tvl(api) { + const { deposits, borrows } = await positions(api) + // All SPL and Token-2022 balances of the wallet. Native SOL is not queried: gas, not strategy capital. + await sumTokens2({ api, owners: [OWNER] }) + deposits.forEach(p => api.add(p.mint, p.amount.toString())) + borrows.forEach(p => api.add(p.mint, (-p.amount).toString())) +} + +async function borrowed(api) { + const { borrows } = await positions(api) + borrows.forEach(p => api.add(p.mint, p.amount.toString())) +} + +module.exports = { tvl, borrowed } From 2ba83ea0b65cfc5cbdc6a51c2fa5bf4ae932fb61 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 6 Nov 2026 09:14:43 +0100 Subject: [PATCH 613/988] update @defillama/sdk version --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index a2b44d7ad55..60ca5e72115 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", - "@defillama/sdk": "5.0.246", + "@defillama/sdk": "5.0.249", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", "@supercharge/promise-pool": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8d4113bb423..9e6524068f9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^0.30.1 version: 0.30.1(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) '@defillama/sdk': - specifier: 5.0.246 - version: 5.0.246(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) + specifier: 5.0.249 + version: 5.0.249(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) '@project-serum/anchor': specifier: ^0.26.0 version: 0.26.0(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -269,8 +269,8 @@ packages: peerDependencies: '@solana/web3.js': ^1.68.0 - '@defillama/sdk@5.0.246': - resolution: {integrity: sha512-DuyddpunISPbnGG9N/ByMUT/kPQzCkMSLMDUkt4sGqfKCP6NrMgkj2qtDEGQa2Kc/ksd7GfWoV8PP3uvzjvoCQ==} + '@defillama/sdk@5.0.249': + resolution: {integrity: sha512-1hCf9Nj+QDUNiGO0NlRbjr0zYzpkCvfNVbzUtLVa+AMnrPlNC2q1wcCx1hPmxrSizmCMmTKRmpct8Zdg35Pomw==} peerDependencies: '@solana/web3.js': '>=1.73.0' peerDependenciesMeta: @@ -1942,7 +1942,7 @@ snapshots: bn.js: 5.2.2 buffer-layout: 1.2.2 - '@defillama/sdk@5.0.246(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': + '@defillama/sdk@5.0.249(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': dependencies: '@aws-sdk/client-s3': 3.913.0 '@elastic/elasticsearch': 8.19.1(supports-color@7.2.0) From f94f121d8e22698827a8ccf4095a35f6770cd0f1 Mon Sep 17 00:00:00 2001 From: Milan Pop Stefanija <47749513+milanps5@users.noreply.github.com> Date: Fri, 6 Nov 2026 10:01:37 +0100 Subject: [PATCH 614/988] Add BNQ (Aave v3 fork) on Hemi (#22055) Co-authored-by: Claude Opus 5.5 --- registries/aaveV3.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/registries/aaveV3.js b/registries/aaveV3.js index 2c910a09ff0..bf036464c81 100644 --- a/registries/aaveV3.js +++ b/registries/aaveV3.js @@ -124,6 +124,9 @@ const configs = { pharos: { poolDatas: ['0x3EF4724f0f2fabfA0ba96AfC711D64e6BE3367Fb'] }, bsc: { poolDatas: ['0xeFD74781D9C468FFE6a4d8CA7720E8EF0223744E'] }, }, + 'bnq': { + hemi: '0xB3D711832d1cf0F03D34D74d8a560071d52319a3', // PoolDataProvider (PoolAddressesProvider 0x381D905bA4bc8378E09A910b4EDbC763A0F2dc92) + }, } module.exports = buildProtocolExports(configs, aaveV3ExportFn) From cc8364d1a5963829406b97336d90bfeb8484c512 Mon Sep 17 00:00:00 2001 From: sev-kach <158035542+sev-kach@users.noreply.github.com> Date: Fri, 6 Nov 2026 01:07:38 -0800 Subject: [PATCH 615/988] feat(predmart): add Base synthetic vault to TVL (#22051) --- projects/predmart/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/projects/predmart/index.js b/projects/predmart/index.js index fb5387f4259..69829510395 100644 --- a/projects/predmart/index.js +++ b/projects/predmart/index.js @@ -2,12 +2,19 @@ const ADDRESSES = require('../helper/coreAssets.json') const LENDING_POOL = "0xD90D012990F0245cAD29823bDF0B4C9AF207d9ee"; +const SYNTHETIC_VAULT = "0xadFe4055f7Bc231287bED441fD213565D1BC06D2"; const USDC = ADDRESSES.polygon.USDC; module.exports = { - methodology: "TVL represents liquid USDC currently available in the PredMart lending pool (total deposits minus outstanding borrows). Borrowed reflects total USDC actively lent out to borrowers who posted Polymarket prediction market shares as collateral. Total lender deposits = TVL + Borrowed.", + methodology: "On Base, TVL is the USDC held by the PredMart synthetic vault: LP deposits, open trader margin and accrued fees. On Polygon, TVL is the liquid USDC in the PredMart lending pool (total deposits minus outstanding borrows), and Borrowed is the USDC lent out to borrowers who posted Polymarket prediction market shares as collateral.", base: { - tvl: () => ({}), + tvl: async (api) => { + // The vault is the counterparty to every trade, so all LP capital and trader margin sit in this contract + await api.sumTokens({ + owners: [SYNTHETIC_VAULT], + tokens: [ADDRESSES.base.USDC], + }); + }, }, polygon: { tvl: async (api) => { From 1956d9e39245f2ddd35623901bebd4a36eed5a1c Mon Sep 17 00:00:00 2001 From: sonevibegrok Date: Fri, 6 Nov 2026 05:10:02 -0400 Subject: [PATCH 616/988] Add SoneVibe Arbitrum One DEX TVL (#22049) Co-authored-by: Cursor Agent Co-authored-by: sonevibegrok --- projects/sonevibe/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/sonevibe/index.js b/projects/sonevibe/index.js index e6352972d36..48f3501a4f5 100644 --- a/projects/sonevibe/index.js +++ b/projects/sonevibe/index.js @@ -8,10 +8,12 @@ const dex = { soneium: '0x06C0b58287794a0bdce20ce768b601CA974618DC', astar: '0x1b404A1e41cCe5f98DC9CBF0c1372F8b68e2588c', bsc: '0xaf905e66038EcE89e03D843B35a11D262053B630', + arbitrum: '0xA95107ebE4e54480bA755061eF3207c3421150f0', } const lending = { // V_Master has no getAllMarkets(), so markets are pinned (from networks.json) + // Arbitrum One has an empty master and no cTokens there, so it stays DEX-only. soneium: { comptroller: '0x1126859aB6911Fc3b4f86f2F65E7B6F2eEDe5185', markets: ['0x7CA06966B0c07C5e35aA180643E98bB3057EBb27', '0xDB3e66b87c42C7F3599fbdcBFe08DfF0689A6D77', '0x96ae93Df119c131469b38e3d558899F23678dCFb'] }, astar: { comptroller: '0x4B07FedD55C65373Dec9d983EA279D7d65259ec7', markets: ['0x40f4bFA1e152Ac5a9b066C0BEc5BD83227F8520A', '0xA7f41D0f41ec8aeb5d57c0E5850F0dB28Ca68E54', '0xe5cE001dD3439A198b2A19567D5F3CD6cd30e61f'] }, } @@ -20,6 +22,12 @@ const dexExports = {} Object.entries(dex).forEach(([chain, factory]) => { dexExports[chain] = { tvl: getUniTVL({ factory, useDefaultCoreAssets: true }) } }) +// Chain start only. A root start would hide Soneium, Astar, and BSC history. +// Factory creation: block 521383212, 2026-11-05T05:04:30Z, +// tx 0xd2cebb74373f703a9b8ca8e1d2cc059f33fabd40713701dfc46c374079e6635d. +// Block lookup may land up to 5 minutes early, so this start is 05:09:30Z. +// allPairsLength is still 0 then. The WETH/USDC pair is created in block 521390325 at 05:41:58Z. +dexExports.arbitrum.start = 1793855370 const lendingExports = {} Object.entries(lending).forEach(([chain, config]) => { @@ -27,4 +35,4 @@ Object.entries(lending).forEach(([chain, config]) => { }) module.exports = mergeExports([dexExports, lendingExports]) -module.exports.methodology = 'DEX TVL: reserves of all VibeSwap pairs created by the factory (core assets only). Lending TVL: underlying tokens held by SoneVibe cTokens listed by the comptroller; borrowed = total borrows.' +module.exports.methodology = 'DEX TVL: reserves of all VibeSwap pairs created by the factory (core assets only). Lending TVL: underlying tokens held by SoneVibe cTokens listed by the comptroller; borrowed = total borrows. Arbitrum counts those factory reserves only; that chain has no comptroller or cTokens.' From 672358f54f26241ab9ff6ba4a33a14a273f48408 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 6 Nov 2026 10:15:19 +0100 Subject: [PATCH 617/988] refactor --- projects/avely-finance-staking/index.js | 46 ++------- projects/avely-finance-swap/index.js | 25 +---- projects/helper/chain/icx.js | 38 +++----- projects/helper/chain/ontology.js | 11 ++- projects/helper/chain/zilliqa.js | 118 +++++------------------- projects/zilswap.js | 5 +- 6 files changed, 53 insertions(+), 190 deletions(-) diff --git a/projects/avely-finance-staking/index.js b/projects/avely-finance-staking/index.js index 611306f6b79..58c2669e6da 100644 --- a/projects/avely-finance-staking/index.js +++ b/projects/avely-finance-staking/index.js @@ -1,52 +1,21 @@ -const { - formQuery, - call -} = require('../helper/chain/zilliqa') +const { getContractSubState } = require('@defillama/sdk').chains.zilliqa const STZIL_CONTRACT_ADDRESS = 'zil1umc54ly88xjw4599gtq860le0qvsuwuj72s246' const DECIMALS = 12 -const tvlFields = { - +async function tvl(api) { //'total_supply' contract field: it's total amount of minted stzil //https://github.com/avely-finance/avely-contracts/blob/main/contracts/source/stzil.scilla#L355 - // [STZIL_CONTRACT_ADDRESS]: 'total_supply', //get 'totalstakeamount' contract field: it's total amount of zil, staked in Zilliqa native staking contract through StZIL contract //https://github.com/avely-finance/avely-contracts/blob/main/contracts/source/stzil.scilla#L353 - 'zilliqa': 'totalstakeamount', -} - -async function tvl(api) { - const query = prepareQuery(tvlFields) - - const data = await call(query) - - data.forEach((response) => { - const { id, result } = response - if (!id || !result || !tvlFields[id] || !result[tvlFields[id]]) return - api.add(id, result[tvlFields[id]] / (10 ** DECIMALS), { skipChain: true}) - }) -} - -//prepare batch GetSmartContractSubState query -//https://dev.zilliqa.com/api/contract-related-methods/api-contract-get-smartcontract-substate/ -function prepareQuery(fields) { - const query = Object.entries(fields).map(([id, field]) => { - return formQuery({ - id: id, - params: [ - STZIL_CONTRACT_ADDRESS, - field, - [] - ] - }); - }); - - return query; + //https://dev.zilliqa.com/api/contract-related-methods/api-contract-get-smartcontract-substate/ + const result = await getContractSubState({ contract: STZIL_CONTRACT_ADDRESS, variable: 'totalstakeamount' }) + const staked = result?.totalstakeamount + if (!staked) return + api.add('zilliqa', staked / (10 ** DECIMALS), { skipChain: true }) } - module.exports = { zilliqa: { tvl @@ -54,4 +23,3 @@ module.exports = { methodology: 'TVL represents the sum of stakes denominated in ZIL and staked in the native Zilliqa staking contract via the STZIL contract', timetravel: false, } - diff --git a/projects/avely-finance-swap/index.js b/projects/avely-finance-swap/index.js index d00365cfa19..fe3c2979bef 100644 --- a/projects/avely-finance-swap/index.js +++ b/projects/avely-finance-swap/index.js @@ -1,40 +1,23 @@ -const BigNumber = require('bignumber.js') -const { - formQuery, - call -} = require('../helper/chain/zilliqa') - +const { getContractSubState } = require('@defillama/sdk').chains.zilliqa const ASWAP_CONTRACT_ADDRESS = 'zil1uxfzk4n9ef2t3f4c4939ludlvp349uwqdx32xt' -const STZIL_CONTRACT_ADDRESS = 'zil1umc54ly88xjw4599gtq860le0qvsuwuj72s246' //seems Zilliqa API take address in legacy format as map key const STZIL_CONTRACT_ADDRESS_LEGACY = '0xe6f14afc8739a4ead0a542c07d3ff978190e3b92' -const DECIMALS = 12 async function tvl() { //https://dev.zilliqa.com/api/contract-related-methods/api-contract-get-smartcontract-substate/ - const query = formQuery({ - id: "1", - params: [ - ASWAP_CONTRACT_ADDRESS, - 'pools', - [STZIL_CONTRACT_ADDRESS_LEGACY] - ] - }); - - const data = await call(query) + const result = await getContractSubState({ contract: ASWAP_CONTRACT_ADDRESS, variable: 'pools', indices: [STZIL_CONTRACT_ADDRESS_LEGACY] }) //(* POOL token -> Pair{zil_reserve, token_reserve} *) //https://github.com/avely-finance/avely-contracts/blob/main/contracts/source/aswap.scilla#L301 - const zil_reserve = data?.result?.pools[STZIL_CONTRACT_ADDRESS_LEGACY]?.arguments[0] - const token_reserve = data?.result?.pools[STZIL_CONTRACT_ADDRESS_LEGACY]?.arguments[1] + const zil_reserve = result?.pools?.[STZIL_CONTRACT_ADDRESS_LEGACY]?.arguments[0] + const token_reserve = result?.pools?.[STZIL_CONTRACT_ADDRESS_LEGACY]?.arguments[1] if (zil_reserve == undefined || token_reserve == undefined) { return } const balances = { - // [STZIL_CONTRACT_ADDRESS]: BigNumber(token_reserve).shiftedBy(DECIMALS * -1), 'zilliqa': zil_reserve / 1e12, } diff --git a/projects/helper/chain/icx.js b/projects/helper/chain/icx.js index 7a4468b25bc..20caf14a231 100644 --- a/projects/helper/chain/icx.js +++ b/projects/helper/chain/icx.js @@ -1,11 +1,13 @@ +// ICON JSON-RPC transport lives in @defillama/sdk (`sdk.chains.icon`, `ICON_RPC` overrides the endpoint); +// this file keeps the TVL helpers (hex parsing into BigNumber, sumTokens). const ADDRESSES = require('../coreAssets.json') -const { post } = require("../http"); +const sdk = require('@defillama/sdk') const BigNumber = require('bignumber.js'); const { getUniqueAddresses } = require("../tokenMapping"); const { transformBalances } = require("../portedTokens"); const { sleep } = require("../utils"); -const icxApiEndpoint = 'https://ctz.solidwallet.io/api/v3'; +const icon = sdk.chains.icon const LOOP = new BigNumber('1000000000000000000'); @@ -17,33 +19,17 @@ function toHex(value) { return new BigNumber(value).div(LOOP); } +// native ICX balance as the raw `0x` hex loop amount async function getICXBalance(address) { - let response = await post(icxApiEndpoint, { - jsonrpc: '2.0', - method: 'icx_getBalance', - id: 1234, - params: { address } - }) - return response.result + return icon.rpc('icx_getBalance', { address }) } +// read-only `icx_call`; returns the raw hex / object unless `parseInt` (-> number) or `parseHex` (-> BigNumber ICX) is set async function call(address, method, params, { parseInt, parseHex } = {}) { - let response = await post(icxApiEndpoint, { - jsonrpc: '2.0', - method: 'icx_call', - id: 1234, - params: { - to: address, - dataType: 'call', - data: { - method: method, - params: params - } - } - }) - if (parseInt) response.result = toInt(response.result) - if (parseHex) response.result = toHex(response.result) - return response.result + let result = await icon.call({ to: address, method, params }) + if (parseInt) result = toInt(result) + if (parseHex) result = toHex(result) + return result } async function sumTokens({ api, owner, owners = [], tokens = [] }) { @@ -73,4 +59,4 @@ module.exports = { toHex, sumTokens, sumTokensExport, -} \ No newline at end of file +} diff --git a/projects/helper/chain/ontology.js b/projects/helper/chain/ontology.js index f0d59bacb32..6b8d7847a45 100644 --- a/projects/helper/chain/ontology.js +++ b/projects/helper/chain/ontology.js @@ -1,12 +1,15 @@ -const { get } = require('../http') +// Ontology explorer access lives in @defillama/sdk (`sdk.chains.ontology`, `ONTOLOGY_EXPLORER` overrides the url); +// this file keeps the TVL helper (native ONT / ONG sumTokens). +const sdk = require('@defillama/sdk') const { sleep } = require('../utils') -// native ONT / ONG balances (already in whole coins) from the Ontology explorer +const ontology = sdk.chains.ontology + +// native ONT / ONG balances (already in whole coins) const ASSETS = { ont: 'ontology', ong: 'ong' } async function getNativeBalances(address) { - const { result } = await get(`https://explorer.ont.io/v2/addresses/${address}/native/balances`) - return result ?? [] + return ontology.getNativeBalances({ address }) } async function sumTokens({ api, owners = [] }) { diff --git a/projects/helper/chain/zilliqa.js b/projects/helper/chain/zilliqa.js index 709b8a9050a..95c82cc2f05 100644 --- a/projects/helper/chain/zilliqa.js +++ b/projects/helper/chain/zilliqa.js @@ -1,109 +1,36 @@ -const { post } = require('../http') +// Zilliqa JSON-RPC transport lives in @defillama/sdk (`sdk.chains.zilliqa`, `ZILLIQA_NATIVE_RPC` overrides the endpoint); +// this file keeps the TVL helpers (ZRC-2 token mapping, sumTokens). +const sdk = require('@defillama/sdk') const BigNumber = require('bignumber.js') -const ZILLIQA_API = 'https://api.zilliqa.com/' // Mainnet API - -async function call(query) { - return post(ZILLIQA_API, query) -} - -function formQuery(args) { - if (Array.isArray(args)) return args.map(formQuery) - - let { - id, - jsonrpc = '2.0', - method = 'GetSmartContractSubState', - params - } = args - - if (!id) id = `${params[1]}-${params[0]}` - - return { id, jsonrpc, method, params, } -} - -async function getContractState(contract, method, args = []) { - if (contract.startsWith('0x')) contract = contract.slice(2) - return call({ - params: [contract, method, ...args] - }) -} - -async function getBalance(token, address) { - if (token.startsWith('0x')) token = token.slice(2) - const { - result: { - balances - } - } = await call(formQuery({ - params: [ - token, - 'balances', - [address] - ] - })) - return balances[address] -} - -async function getZilliqaBalance(address) { - if (address.startsWith('0x')) address = address.slice(2) - const { - result: { - balance - } - } = await call(formQuery({ method: 'GetBalance', params: [address] })) - return BigNumber(balance).shiftedBy(-1 * 12) -} +const zilliqa = sdk.chains.zilliqa +// ZRC-2 balances of every token for every address, summed into `balances`: tokens mapped below +// go under `coingecko:` in whole units, the rest under `zilliqa:` in raw units async function getBalances(tokens, addresses, balances = {}) { if (!Array.isArray(tokens)) tokens = [tokens] if (!Array.isArray(addresses)) addresses = [addresses] - const query = tokens - .map(token => - addresses.map(addr => formQuery({ - id: `${token}-${addr}`, - params: [ - token.startsWith('0x') ? token.slice(2) : token, - 'balances', - [addr] - ] - }) - )).flat() - - const data = await call(query) - - data.forEach((response) => { - const { id, result } = response - if (!result) return - let token = id.split('-')[0] - const tokenRef = TOKENS[token] - let decimals = 0 - - if (tokenRef && tokenRef.decimals) - decimals = tokenRef.decimals + const res = await zilliqa.getTokenBalances({ tokens, addresses }) - if (tokenRef && tokenRef.coingeckoId) - token = tokenRef.coingeckoId + for (const [token, holders] of Object.entries(res)) { + const raw = Object.values(holders).reduce((acc, i) => acc.plus(i), BigNumber(0)) + if (raw.isZero()) continue + const tokenRef = TOKENS_BY_HEX[token] + if (tokenRef?.coingeckoId) + sdk.util.sumSingleBalance(balances, `coingecko:${tokenRef.coingeckoId}`, raw.shiftedBy(-(tokenRef.decimals ?? 0)).toNumber()) else - token = `zilliqa:${token}` - - if (!balances[token]) - balances[token] = BigNumber(0) - - const balancesSum = Object.values(result.balances) - .reduce((sum, i) => sum.plus(BigNumber(i).shiftedBy(decimals * -1)), BigNumber(0)) - - balances[token] = balances[token].plus(balancesSum) - }) + sdk.util.sumSingleBalance(balances, `zilliqa:${token}`, raw.toFixed(0)) + } return balances } +// native ZIL of `owners`, in whole ZIL async function sumTokens({ owners, }) { - const balances = await Promise.all(owners.map(getZilliqaBalance)) + const balances = await Promise.all(owners.map((owner) => zilliqa.getBalance({ address: owner }))) return { - zilliqa: balances.reduce((a, i) => a + +i, 0), + zilliqa: balances.reduce((a, i) => a + zilliqa.qaToZil(i), 0), } } @@ -274,13 +201,10 @@ const TOKENS = { }, } +// the sdk keys its results by lowercase `0x` hex +const TOKENS_BY_HEX = Object.fromEntries(Object.entries(TOKENS).map(([k, v]) => [k.toLowerCase(), v])) module.exports = { - call, - formQuery, - getContractState, - getBalance, - getZilliqaBalance, getBalances, sumTokens, -} \ No newline at end of file +} diff --git a/projects/zilswap.js b/projects/zilswap.js index 18484571d5b..ebfa544f84d 100644 --- a/projects/zilswap.js +++ b/projects/zilswap.js @@ -1,12 +1,11 @@ const BigNumber = require('bignumber.js') -const { call, formQuery } = require('./helper/chain/zilliqa') +const { getContractSubState } = require('@defillama/sdk').chains.zilliqa // https://github.com/Switcheo/zilswap#deployed-contracts const CONTRACT = '459cb2d3baf7e61cfbd5fe362f289ae92b2babb0' async function tvl() { - const { result, error } = await call(formQuery({ params: [CONTRACT, 'pools', []] })) - if (error) throw new Error(`ZilSwap RPC error: ${error.message}`) + const result = await getContractSubState({ contract: CONTRACT, variable: 'pools' }) const pools = result?.pools if (!pools || typeof pools !== 'object' || Array.isArray(pools)) From 1a3e601dfb80beaa222160aa223281c1e99bf298 Mon Sep 17 00:00:00 2001 From: Saus <107887818+Dr-Saus@users.noreply.github.com> Date: Fri, 6 Nov 2026 09:22:48 +0000 Subject: [PATCH 618/988] Mezzanine: include Ethereum satellite strategy positions and idle balances (#22048) --- projects/mezzanine/index.js | 63 ++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/projects/mezzanine/index.js b/projects/mezzanine/index.js index 36efbb87508..eb4333fb6fd 100644 --- a/projects/mezzanine/index.js +++ b/projects/mezzanine/index.js @@ -8,9 +8,21 @@ const morphoAbi = require('../helper/abis/morpho.json').morphoBlueFunctions const MORPHO = '0xBBBBBbbBbb9CC5e90e3b3Af64bdAF62C37EEFFCb' const WYLDS = '0x6aD038cA6C04e885630851278ca0a856Ad9a66Cc' +const AUTO = '0x997E2Efbce91D170B00EA402e35a66C887EE1da9' +const PRIME = '0x19ebb35279A16207Ec4ba82799CC64715065F7F6' +const PYUSD = '0x6c3ea9036406852006290770BEdFcAbA0e23A0e8' +const AUSD = '0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a' +const IDLE_TOKENS = [WYLDS, AUTO, PRIME, PYUSD, AUSD, ADDRESSES.ethereum.USDC] const ISSUANCE_VAULT = '0xbb03549117e38103589774ae1d6338d1b237ffa2' const EXECUTOR = '0x43bC5fB52A618F0F2efb0d68Cf900Bb2FbD8a501' const STRATEGY = '0x9A1dE53C14215272ae4dCFE35a650fd7151dc403' +// Satellite wallets of the same strategy: two automated loopers with their own +// Morpho positions, and the wallet funds sit in while bridging to/from Solana. +const PRIME_LOOPER = '0xC9DDDA6591c8f639716dDc15c55589695Eac326C' +const AUTO_LOOPER = '0xdF6C675700a22fC83e01EEcfdAaAC7E9bB49FF29' +const SOLANA_BRIDGE = '0x8D6f5f37350672c329157A8B3Eee96D6148a7A24' +const MORPHO_USERS = [STRATEGY, PRIME_LOOPER, AUTO_LOOPER] +const OWNERS = [ISSUANCE_VAULT, EXECUTOR, SOLANA_BRIDGE, ...MORPHO_USERS] const FROM_BLOCK = 25999777 // STRATEGY deploy const eventAbis = { @@ -18,32 +30,39 @@ const eventAbis = { supply: 'event Supply(bytes32 indexed id, address indexed caller, address indexed onBehalf, uint256 assets, uint256 shares)', } -const onBehalf = ethers.zeroPadValue(STRATEGY.toLowerCase(), 32) - async function getPositions(api) { - const [collateralLogs, supplyLogs] = await Promise.all([ - getLogs2({ - api, target: MORPHO, fromBlock: FROM_BLOCK, extraKey: 'supply-collateral', - eventAbi: eventAbis.supplyCollateral, - topics: [ethers.id('SupplyCollateral(bytes32,address,address,uint256)'), null, null, onBehalf], - }), - getLogs2({ - api, target: MORPHO, fromBlock: FROM_BLOCK, extraKey: 'supply', - eventAbi: eventAbis.supply, - topics: [ethers.id('Supply(bytes32,address,address,uint256,uint256)'), null, null, onBehalf], - }), - ]) + const marketIdsOf = async (user) => { + const onBehalf = ethers.zeroPadValue(user.toLowerCase(), 32) + // STRATEGY keeps the original cache keys so the already-built log cache stays in use + const keySuffix = user === STRATEGY ? '' : `-${user.toLowerCase()}` + const [collateralLogs, supplyLogs] = await Promise.all([ + getLogs2({ + api, target: MORPHO, fromBlock: FROM_BLOCK, extraKey: `supply-collateral${keySuffix}`, + eventAbi: eventAbis.supplyCollateral, + topics: [ethers.id('SupplyCollateral(bytes32,address,address,uint256)'), null, null, onBehalf], + }), + getLogs2({ + api, target: MORPHO, fromBlock: FROM_BLOCK, extraKey: `supply${keySuffix}`, + eventAbi: eventAbis.supply, + topics: [ethers.id('Supply(bytes32,address,address,uint256,uint256)'), null, null, onBehalf], + }), + ]) + const ids = [...new Set([...collateralLogs, ...supplyLogs].map(i => i.id.toLowerCase()))] + return ids.map(id => ({ id, user })) + } - const ids = [...new Set([...collateralLogs, ...supplyLogs].map(i => i.id.toLowerCase()))] - if (!ids.length) return [] + const idPairs = (await Promise.all(MORPHO_USERS.map(marketIdsOf))).flat() + if (!idPairs.length) return [] + const ids = [...new Set(idPairs.map(i => i.id))] const [params, markets, positions] = await Promise.all([ api.multiCall({ target: MORPHO, abi: morphoAbi.idToMarketParams, calls: ids }), api.multiCall({ target: MORPHO, abi: morphoAbi.market, calls: ids }), - api.multiCall({ target: MORPHO, abi: morphoAbi.position, calls: ids.map(id => ({ params: [id, STRATEGY] })) }), + api.multiCall({ target: MORPHO, abi: morphoAbi.position, calls: idPairs.map(({ id, user }) => ({ params: [id, user] })) }), ]) - - return ids.map((_, i) => ({ params: params[i], market: markets[i], position: positions[i] })) + const marketById = {} + ids.forEach((id, i) => marketById[id] = { params: params[i], market: markets[i] }) + return idPairs.map(({ id }, i) => ({ ...marketById[id], position: positions[i] })) } const debtOf = ({ market, position }) => toAssetsUp(position.borrowShares, market.totalBorrowAssets, market.totalBorrowShares) @@ -57,8 +76,8 @@ async function tvl(api) { api.add(params.loanToken, toAssetsDown(position.supplyShares, market.totalSupplyAssets, market.totalSupplyShares).toString()) }) - const tokens = getUniqueAddresses(positions.flatMap(i => [i.params.loanToken, i.params.collateralToken]).concat([WYLDS, ADDRESSES.ethereum.USDC]), api.chain) - await sumTokens2({ api, owners: [ISSUANCE_VAULT, EXECUTOR, STRATEGY], tokens }) + const tokens = getUniqueAddresses(positions.flatMap(i => [i.params.loanToken, i.params.collateralToken]).concat(IDLE_TOKENS), api.chain) + await sumTokens2({ api, owners: OWNERS, tokens }) positions.forEach(p => api.add(p.params.loanToken, (-debtOf(p)).toString())) } @@ -72,7 +91,7 @@ module.exports = { timetravel: false, start: '2026-10-12', methodology: - 'TVL is the Hastra PRIME/AUTO collateral the Hastra Optimizer strategy holds on Morpho Blue, plus any loan assets it supplies and the balances idle in the issuance vault and executor, less its outstanding Morpho debt. The strategy loops PRIME/AUTO against borrowed stablecoins, so netting the debt leaves the vault NAV that backs the tranches. Solana adds SPL and Token-2022 balances of the strategy wallet plus Kamino collateral redeemed at reserve exchange rates, less Kamino debt adjusted to reserve cumulative borrow rates. Native SOL reserved for gas is excluded. Marked doublecounted: the same collateral is counted under Morpho or Kamino, and PRIME/AUTO are already tracked as Hastra RWA assets.', + 'TVL is the Hastra PRIME/AUTO collateral the Hastra Optimizer strategy holds on Morpho Blue, plus any loan assets it supplies and the balances idle in the issuance vault, executor and strategy wallets (including the satellite loopers and Ethereum bridge wallet), less its outstanding Morpho debt. The strategy loops PRIME/AUTO against borrowed stablecoins, so netting the debt leaves the vault NAV that backs the tranches. Solana adds SPL and Token-2022 balances of the strategy wallet plus Kamino collateral redeemed at reserve exchange rates, less Kamino debt adjusted to reserve cumulative borrow rates. Native SOL reserved for gas is excluded. Marked doublecounted: the same collateral is counted under Morpho or Kamino, and PRIME/AUTO are already tracked as Hastra RWA assets.', ethereum: { tvl, borrowed }, solana: require('./solana'), } From ff01bd028e5688b258a36ec59c7e7d0a47f5da7f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 6 Nov 2026 12:33:11 +0100 Subject: [PATCH 619/988] fix adapters --- projects/blast-bridge/index.js | 25 -------------- projects/helper/env.js | 1 + projects/moono/index.js | 22 ++++++++---- projects/ociswap-basic/index.js | 23 ++----------- projects/ociswap-precision/index.js | 25 +++----------- projects/ociswap/index.js | 30 +++-------------- projects/ociswap/pools.js | 52 +++++++++++++++++++++++++++++ projects/plunderswap-v3/index.js | 2 +- projects/strata-tranches/index.js | 34 ++++++++++++++----- registries/sumTokens/covalent.js | 13 ++++++++ 10 files changed, 120 insertions(+), 107 deletions(-) delete mode 100644 projects/blast-bridge/index.js create mode 100644 projects/ociswap/pools.js diff --git a/projects/blast-bridge/index.js b/projects/blast-bridge/index.js deleted file mode 100644 index 608dc94590c..00000000000 --- a/projects/blast-bridge/index.js +++ /dev/null @@ -1,25 +0,0 @@ -const { sumTokens2 } = require("../helper/unwrapLPs"); -const ADDRESSES = require('../helper/coreAssets.json'); - -module.exports = { - hallmarks: [ - ['2026-10-02', 'Blast L2 shutdown announced, bridge withdrawals until Oct 26'], - ], - ethereum: { - tvl: async (api) =>{ - const balances = { - [ADDRESSES.ethereum.DAI]: await api.call({target: "0xa230285d5683c74935ad14c446e137c8c8828438", abi:"uint:totalValue"}) - }; - return sumTokens2({ - balances, - api, - owners: [ - "0xa230285d5683C74935aD14c446e137c8c8828438", - "0x98078db053902644191f93988341E31289E1C8FE", - "0x5F6AE08B8AeB7078cf2F96AFb089D7c9f51DA47d", - ], - fetchCoValentTokens: true, - }) - }, - }, -}; diff --git a/projects/helper/env.js b/projects/helper/env.js index e6bfad6b349..0522d2a07cc 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -81,6 +81,7 @@ const DEFAULTS = { BTCWCHAIN_RPC: 'https://rpc.btcw.tech', BTCWCHAIN_RPC_CHAIN_ID: '482120', BTCWCHAIN_RPC_MULTICALL: '0xA0093EA76633A983364cb2582959870eaffDdea0', + ZILLIQA_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', RLS_ARCHIVAL_RPC: 'https://mainnet-archive.rayls.com', CRONOS_RPC: 'https://evm.cronos.org,https://rpc.vvs.finance,https://cronos.drpc.org,https://cronos.rpc.sentio.xyz,https://evm-cronos.crypto.org', // chains with no provider in the SDK providers list (chainid.network RPCs) diff --git a/projects/moono/index.js b/projects/moono/index.js index 4f28b5723ab..6a02e11831e 100644 --- a/projects/moono/index.js +++ b/projects/moono/index.js @@ -1,6 +1,7 @@ const { getMultipleAccounts, sumTokens2 } = require('../helper/solana') const ADDRESSES = require('../helper/coreAssets.json') +// program moono1nEzk6NWAHzgFjeeSYn3WVtr3N2ZVArwsxrhFX const QUOTE_VAULTS = [ { mint: ADDRESSES.solana.SOL, @@ -29,22 +30,31 @@ async function borrowed(api) { const accounts = await getMultipleAccounts(QUOTE_VAULTS.map((vault) => vault.quoteVault), { api }) accounts.forEach((account, index) => { - if (!account) throw new Error(`Missing Moono quote vault account: ${QUOTE_VAULTS[index].quoteVault}`) + const { quoteVault, mint } = QUOTE_VAULTS[index] + // the protocol swept and closed its quote vaults on 2026-11-02, a missing vault means it was wound down + if (!account) { + console.log(`Moono quote vault ${quoteVault} is closed, skipping`) + return + } const data = Buffer.from(account.data) - if (data.length < MIN_QUOTE_VAULT_SIZE) { - throw new Error(`Unexpected Moono quote vault layout: ${QUOTE_VAULTS[index].quoteVault}`) + if (data.length < MIN_QUOTE_VAULT_SIZE) { + throw new Error(`Unexpected Moono quote vault layout: ${quoteVault}`) } if (!data.subarray(0, DISCRIMINATOR_SIZE).equals(QUOTE_VAULT_DISCRIMINATOR)) { - throw new Error(`Unexpected Moono quote vault discriminator: ${QUOTE_VAULTS[index].quoteVault}`) + throw new Error(`Unexpected Moono quote vault discriminator: ${quoteVault}`) } - - api.add(QUOTE_VAULTS[index].mint, data.readBigUInt64LE(BORROWED_OFFSET).toString()) + + api.add(mint, data.readBigUInt64LE(BORROWED_OFFSET).toString()) }) } module.exports = { timetravel: false, + deadFrom: '2026-11-02', + hallmarks: [ + ['2026-11-02', 'Protocol wound down: quote vaults swept and closed, program set inert'], + ], methodology: 'TVL counts idle LP-supplied quote liquidity tracked by Moono quote vaults. Borrowed reports the outstanding principal separately.', solana: { tvl, diff --git a/projects/ociswap-basic/index.js b/projects/ociswap-basic/index.js index 9aeaa9b8ec3..4924c1ba9c4 100644 --- a/projects/ociswap-basic/index.js +++ b/projects/ociswap-basic/index.js @@ -1,24 +1,7 @@ -const { get } = require('../helper/http') - -async function tvl(api) { - - const endpoint = 'http://api.ociswap.com/statistics/pool-types'; - const options = { - headers: { - 'accept': 'application/json' - } - }; - - const statistics = await get(endpoint, options) - - const basicIndex = statistics.findIndex(pool => pool.pool_type === 'basic') - - return { - 'radix': statistics[basicIndex].total_value_locked.xrd.now - } -} +const { ociswapTvl } = require('../ociswap/pools') module.exports = { timetravel: false, - radixdlt: { tvl } + methodology: 'Sums the token reserves held on-chain by Ociswap basic pools, discovered through the Ociswap pool list.', + radixdlt: { tvl: ociswapTvl(['basic']) }, } diff --git a/projects/ociswap-precision/index.js b/projects/ociswap-precision/index.js index 5f2220d61d6..d0045d82054 100644 --- a/projects/ociswap-precision/index.js +++ b/projects/ociswap-precision/index.js @@ -1,24 +1,7 @@ -const { get } = require('../helper/http') - -async function tvl(api) { - - const endpoint = 'http://api.ociswap.com/statistics/pool-types'; - const options = { - headers: { - 'accept': 'application/json' - } - }; - - const statistics = await get(endpoint, options) - - const precisionIndex = statistics.findIndex(pool => pool.pool_type === 'precision') - - return { - 'radix': statistics[precisionIndex].total_value_locked.xrd.now - } -} +const { ociswapTvl } = require('../ociswap/pools') module.exports = { - timetravel: false, - radixdlt: { tvl } + timetravel: false, + methodology: 'Sums the token reserves held on-chain by Ociswap precision (concentrated liquidity) pools, discovered through the Ociswap pool list.', + radixdlt: { tvl: ociswapTvl(['precision']) }, } diff --git a/projects/ociswap/index.js b/projects/ociswap/index.js index 2dbd9de2347..7fdb88b15f1 100644 --- a/projects/ociswap/index.js +++ b/projects/ociswap/index.js @@ -1,29 +1,7 @@ -const { sumTokens, queryAddresses } = require('../helper/chain/radixdlt'); -const { getConfig } = require('../helper/cache') -const { get } = require('../helper/http') -const sdk = require('@defillama/sdk') +const { ociswapTvl } = require('./pools') module.exports = { - radixdlt: { - tvl: async (api) => { - const pools = await getConfig('ociswap', null, { - fetcher: async () => { - let items = [] - let cursor = 0 - do { - const { data, next_cursor } = await get(`https://api.ociswap.com/pools?cursor=${cursor}&limit=100`) - items.push(...data) - sdk.log(`Fetched ${items.length} pools`, data.length, next_cursor) - cursor = next_cursor - - } while (items.length % 100 === 0 && cursor !== 0) - return items - } - }) - const data = await queryAddresses({ addresses: pools.map(i => i.address) }) - const owners = data.map(i => i.metadata.items.find(i => i.key === 'liquidity_pool')?.value?.typed?.value).filter(i => i) - return sumTokens({ owners, api, }) - }, - }, - timetravel: false + timetravel: false, + methodology: 'Sums the token reserves held on-chain by every Ociswap pool (precision, basic and flex), discovered through the Ociswap pool list.', + radixdlt: { tvl: ociswapTvl() }, } diff --git a/projects/ociswap/pools.js b/projects/ociswap/pools.js new file mode 100644 index 00000000000..0bcf6d90ae5 --- /dev/null +++ b/projects/ociswap/pools.js @@ -0,0 +1,52 @@ +const { queryAddresses, sumTokens } = require('../helper/chain/radixdlt') +const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') +const sdk = require('@defillama/sdk') + +// full pool list from the ociswap API (cached); the API ignores a pool_type query param, so filtering is done client side +async function getPools() { + return getConfig('ociswap', null, { + fetcher: async () => { + let items = [] + let cursor = 0 + do { + const { data, next_cursor } = await get(`https://api.ociswap.com/pools?cursor=${cursor}&limit=100`) + items.push(...data) + sdk.log(`Fetched ${items.length} pools`, data.length, next_cursor) + cursor = next_cursor + } while (items.length % 100 === 0 && cursor !== 0) + return items + } + }) +} + +// on-chain owners holding the pool reserves: +// - PrecisionPool components keep the token vaults on the component itself +// - Basic / flex pools delegate to a native `liquidity_pool` component referenced in metadata +// both are summed, the parent component of a delegating pool only holds fee dust +async function getPoolOwners(pools) { + const items = await queryAddresses({ addresses: pools.map(i => i.address) }) + const owners = new Set() + for (const item of items) { + owners.add(item.address) + const lp = item.metadata?.items?.find(i => i.key === 'liquidity_pool')?.value?.typed?.value + if (lp) owners.add(lp) + } + return [...owners] +} + +// radixdlt tvl export for the given pool types (all pools when `poolTypes` is omitted) +function ociswapTvl(poolTypes) { + return async (api) => { + let pools = await getPools() + if (poolTypes) pools = pools.filter(i => poolTypes.includes(i.pool_type)) + const owners = await getPoolOwners(pools) + return sumTokens({ owners, api }) + } +} + +module.exports = { + getPools, + getPoolOwners, + ociswapTvl, +} diff --git a/projects/plunderswap-v3/index.js b/projects/plunderswap-v3/index.js index 6cedf4d7d76..9a37eec978e 100644 --- a/projects/plunderswap-v3/index.js +++ b/projects/plunderswap-v3/index.js @@ -6,7 +6,7 @@ async function tvl(api) { const v3Pairs = data.filter(pair => pair.version === 'V3').map(pair => pair.address) const token0s = await api.multiCall({ abi: 'address:token0', calls: v3Pairs }) const token1s = await api.multiCall({ abi: 'address:token1', calls: v3Pairs }) - return sumTokens2({ api, tokensAndOwners2: [token0s.concat(token1s), v3Pairs.concat(v3Pairs)] }) + return sumTokens2({ api, tokensAndOwners2: [token0s.concat(token1s), v3Pairs.concat(v3Pairs)], permitFailure: true }) } module.exports = { diff --git a/projects/strata-tranches/index.js b/projects/strata-tranches/index.js index 29eb77c529c..1f23fdbb9d8 100644 --- a/projects/strata-tranches/index.js +++ b/projects/strata-tranches/index.js @@ -1,3 +1,5 @@ +const { getUniqueAddresses } = require('../helper/utils') + const srUSDeVault = "0x3d7d6fdf07EE548B939A80edbc9B2256d0cdc003"; const jrUSDeVault = "0xC58D044404d8B14e953C115E67823784dEA53d8F"; const jrNUSDVault = "0xFC807058A352b61aEef6A38e2D0fC3990225E772"; @@ -13,13 +15,29 @@ const srtPrimeVault = "0x35bFF778d3fc53a561486BF28e761428499232Eb"; const jrNOPALVault = "0x1b2b8cFEF0b7B1Fad216b55fefeEb0c3349Da141"; const srNOPALVault = "0x8a646Edc4633ADBA5Ec87DedaF3Af958e268FE96"; +const vaults = [srUSDeVault, jrUSDeVault, srNUSDVault, jrNUSDVault, srmHYPERVault, jrmHYPERVault, srmM1USDVault, jrmM1USDVault, srUSDatVault, jrUSDatVault, jrtPrimeVault, srtPrimeVault, jrNOPALVault, srNOPALVault] + +async function tvl(api) { + const assets = await api.multiCall({ abi: 'address:asset', calls: vaults }) + // totalAssets() reverts when the underlying yield source's accountant is paused (e.g. nOPAL: AccountantWithRateProviders__Paused) + const totalAssets = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults, permitFailure: true }) + + const failed = [] + vaults.forEach((vault, i) => { + if (totalAssets[i] != null) api.add(assets[i], totalAssets[i]) + else failed.push(vault) + }) + if (!failed.length) return + + // junior + senior tranches of a pair share one CDO whose strategy holds the yield-source share token, + // value that balance directly instead of the paused rate + const cdos = getUniqueAddresses(await api.multiCall({ abi: 'address:cdo', calls: failed })) + const strategies = await api.multiCall({ abi: 'address:strategy', calls: cdos }) + const shareTokens = await api.multiCall({ abi: 'address:shareToken', calls: strategies }) + return api.sumTokens({ tokensAndOwners: strategies.map((strategy, i) => [shareTokens[i], strategy]) }) +} + module.exports = { - methodology: "Protocol TVL refers to the dollar value of all assets deposited into the protocol smart contracts.", - ethereum: { - async tvl (api) { - return await api.erc4626Sum2({ - calls: [ srUSDeVault, jrUSDeVault, srNUSDVault, jrNUSDVault, srmHYPERVault, jrmHYPERVault, srmM1USDVault, jrmM1USDVault, srUSDatVault, jrUSDatVault, jrtPrimeVault, srtPrimeVault, jrNOPALVault, srNOPALVault ], - }); - } - }, + methodology: "Protocol TVL refers to the dollar value of all assets deposited into the protocol smart contracts.", + ethereum: { tvl }, }; diff --git a/registries/sumTokens/covalent.js b/registries/sumTokens/covalent.js index 655aa3f4334..f293d482ded 100644 --- a/registries/sumTokens/covalent.js +++ b/registries/sumTokens/covalent.js @@ -84,6 +84,19 @@ module.exports = { "fetchCoValentTokens": true }, }, + "blast-bridge": { + "hallmarks": [ + ['2026-10-02', 'Blast L2 shutdown announced, bridge withdrawals until Oct 26'], + ], + "ethereum": { + "owners": [ + "0xa230285d5683C74935aD14c446e137c8c8828438", + "0x98078db053902644191f93988341E31289E1C8FE", + "0x5F6AE08B8AeB7078cf2F96AFb089D7c9f51DA47d" + ], + "fetchCoValentTokens": true + }, + }, "blackwing": { "arbitrum": { "tokens": [ From 7d4289bb5f179406de9002c405d800c991f1363e Mon Sep 17 00:00:00 2001 From: Wissam Jarjoui <1377465+bosswissam@users.noreply.github.com> Date: Fri, 6 Nov 2026 03:57:37 -0800 Subject: [PATCH 620/988] reservoir-protocol: add Rockaway USDC Reservoir Ecosystem vault (Pharos) (#22030) --- projects/reservoir-protocol/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/reservoir-protocol/index.js b/projects/reservoir-protocol/index.js index 880d5f90b04..8493b54581b 100644 --- a/projects/reservoir-protocol/index.js +++ b/projects/reservoir-protocol/index.js @@ -207,6 +207,7 @@ const config = { pharos: { tokensAndOwners: [ ['0x047cD0a91E9B92ED979189a6C8A120bf280f02E5', '0x289C204B35859bFb924B9C0759A4FE80f610671c'], // mmUSDC (Morpho Rockaway USDC) + ['0x1275671ccbff43d9a0676f70c22d99a9328a5842', '0x289C204B35859bFb924B9C0759A4FE80f610671c'], // roxRESERVOIR (Morpho Rockaway USDC Reservoir Ecosystem) ] }, hyperliquid: { From 3ae15149b1a9a197bc0325df576a5278dad162d7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 6 Nov 2026 13:43:06 +0100 Subject: [PATCH 621/988] fix fluxbeam --- projects/fluxbeam-xyz/index.js | 127 +++++++++++++++++++++++++-------- 1 file changed, 97 insertions(+), 30 deletions(-) diff --git a/projects/fluxbeam-xyz/index.js b/projects/fluxbeam-xyz/index.js index 14d2a834f3c..58ec6ec131a 100644 --- a/projects/fluxbeam-xyz/index.js +++ b/projects/fluxbeam-xyz/index.js @@ -1,50 +1,117 @@ -const { sumTokens2, } = require('../helper/solana') -const { setCache } = require('../helper/cache') -const { log } = require('../helper/utils') +const { sumTokens2 } = require('../helper/solana') +const { getCache, setCache, getConfig } = require('../helper/cache') +const { log, sliceIntoChunks, sleep } = require('../helper/utils') const { get } = require('../helper/http') +const { getEnv } = require('../helper/env') +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const { getEnv } = require('../helper/env'); +const { PublicKey } = require('@solana/web3.js') const CACHE_NAME = 'fluxbeam-xyz' const API_URL = 'https://api.fluxbeam.xyz/v1/pools' const API_PAGE_SIZE = 10000 +const SOL = ADDRESSES.solana.SOL +const CONSTANT_PRODUCT = 0 // spl token-swap curveType +const MIN_SOL_LAMPORTS = 0.5e9 // pools at or above this are read every run +const DUST_LAMPORTS = 0.01e9 // pools under this are never re-read (780k of them hold 77 sol in total), the rest only on the monthly full scan +const FULL_SCAN_INTERVAL = 30 * 24 * 3600 +const CHECKPOINT_EVERY = 20000 // vaults read between cache writes, so a run that dies midway does not start over +const CONCURRENCY = 3 -async function tvl(api) { - const isCustomJob = getEnv('IS_RUN_FROM_CUSTOM_JOB') - if (!isCustomJob) - throw new Error("Find another solution, maybe a custom script that runs slow but pulls all the data, this is making like 200k calls which is running into rate limit") - - let page = 1 - let totalScanned = 0 - const allTokenAccounts = [] +// ~800k pools, 99% of them constant product pools paired with sol. The listing is cached as a whole so an api +// outage serves the last good one, and only the vaults are kept since the full pool objects do not fit in memory +async function fetchPools() { + return getConfig(`${CACHE_NAME}/pools`, undefined, { + fetcher: async () => { + // the listing repeats some pools, sets keep each vault once + const solVaults = new Set() // constant product sol pools: only the sol vault is read and doubled + const otherTokenAccounts = new Set() // everything else: both vaults are read + for (let page = 1; ; page++) { + const pools = await get(`${API_URL}?limit=${API_PAGE_SIZE}&page=${page}`) + if (!Array.isArray(pools)) throw new Error(`bad response on page ${page}`) + for (const pool of pools) { + const solVault = pool.mintA === SOL ? pool.tokenAccountA : pool.mintB === SOL ? pool.tokenAccountB : null + if (pool.curveType === CONSTANT_PRODUCT && solVault) solVaults.add(solVault) + else otherTokenAccounts.add(pool.tokenAccountA).add(pool.tokenAccountB) + } + if (pools.length < API_PAGE_SIZE) break + } + return { solVaults: [...solVaults], otherTokenAccounts: [...otherTokenAccounts] } + } + }) +} - while (true) { - log(`Page ${page}: fetching...`) - let pools +async function withRetry(fn, retries = 5) { + for (let i = 0; ; i++) { try { - pools = await get(`${API_URL}?limit=${API_PAGE_SIZE}&page=${page}`) - const tokenAccounts = pools.flatMap(pool => [pool.tokenAccountA, pool.tokenAccountB]) - await sumTokens2({ api, tokenAccounts, allowError: true, }) - allTokenAccounts.push(...tokenAccounts) - sdk.log(`Fetched ${pools.length} pools from API`) + return await fn() } catch (e) { - log(`API fetch failed on page ${page}: ${e.message}`) - break + if (i >= retries) throw e + await sleep(1000 * 2 ** i) } - if (!pools || !pools.length) break - totalScanned += pools.length - - if (pools.length < API_PAGE_SIZE) break - page++ } +} - log(`Done: scanned ${totalScanned} pools`) - await setCache(CACHE_NAME, 'solana', allTokenAccounts) +// lamports held by each sol vault, in input order (0 for a missing account or one whose mint is not wsol) +async function readSolVaults(vaults, chain) { + const chunks = sliceIntoChunks(vaults, 99) + const lamports = new Array(vaults.length).fill(0) + let done = 0 + await sdk.util.runInPromisePool({ + items: chunks.map((chunk, i) => ({ chunk, offset: i * 99 })), + concurrency: CONCURRENCY, + processor: async ({ chunk, offset }) => { + // only the mint (0-32) and amount (64-72) of each token account are needed + const infos = await withRetry(() => sdk.chains.svm.getAccounts({ chain, accounts: chunk, dataSlice: { offset: 0, length: 72 }, chunkSize: 99, concurrency: 1 })) + infos.forEach((info, i) => { + if (!info) return + const d = Buffer.from(info.data[0], 'base64') + if (d.length < 72 || new PublicKey(d.subarray(0, 32)).toBase58() !== SOL) return // not a wsol token account + lamports[offset + i] = Number(d.readBigUInt64LE(64)) + }) + if (++done % 500 === 0) log(`fluxbeam: ${done}/${chunks.length} sol vault chunks`) + }, + }) + return lamports } +async function tvl(api) { + if (!getEnv('IS_RUN_FROM_CUSTOM_JOB')) + throw new Error("Find another solution, maybe a custom script that runs slow but pulls all the data, this is making like 200k calls which is running into rate limit") + + const { solVaults, otherTokenAccounts } = await fetchPools() + const cache = await getCache(CACHE_NAME, api.chain) + const cached = cache.vaults ?? {} // sol vault -> lamports + const now = Math.floor(Date.now() / 1000) + const fullScan = !cache.lastFullScan || now - cache.lastFullScan > FULL_SCAN_INTERVAL + + // new pools and pools above the line are read every run, the monthly full scan also re-reads what is between dust and the line + const toRead = solVaults.filter(v => cached[v] === undefined || cached[v] >= MIN_SOL_LAMPORTS || (fullScan && cached[v] >= DUST_LAMPORTS)) + log(`fluxbeam: ${solVaults.length} constant product sol pools, reading ${toRead.length} sol vaults (${fullScan ? 'full scan' : 'incremental'}), ${otherTokenAccounts.length} token accounts of other pools`) + const batches = sliceIntoChunks(toRead, CHECKPOINT_EVERY) + for (let i = 0; i < batches.length; i++) { + const lamports = await readSolVaults(batches[i], api.chain) + batches[i].forEach((v, j) => cached[v] = lamports[j]) + if (i === batches.length - 1) break // the final write below prunes unlisted vaults + log(`fluxbeam: checkpoint ${(i + 1) * CHECKPOINT_EVERY}/${toRead.length} sol vaults`) + await setCache(CACHE_NAME, api.chain, { lastFullScan: cache.lastFullScan, vaults: cached }) + } + + const vaults = {} + let totalLamports = 0 + for (const v of solVaults) { + vaults[v] = cached[v] ?? 0 + totalLamports += vaults[v] + } + api.add(SOL, 2 * totalLamports) + await setCache(CACHE_NAME, api.chain, { lastFullScan: fullScan ? now : cache.lastFullScan, vaults }) + + return sumTokens2({ api, tokenAccounts: otherTokenAccounts, allowError: true, }) +} module.exports = { timetravel: false, isHeavyProtocol: true, + misrepresentedTokens: true, solana: { tvl }, -} \ No newline at end of file +} From 4468b3895a79ef23bea52ea9a2afb995b3764064 Mon Sep 17 00:00:00 2001 From: thomas <81407403+thomas-cloud579@users.noreply.github.com> Date: Fri, 6 Nov 2026 21:29:57 +0800 Subject: [PATCH 622/988] Missing reserve fund address (#22053) --- projects/gate-io/index.js | 35 +++++++++++++++++++-------- projects/helper/bitcoin-book/index.js | 1 + 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index eb9cc00184b..5c11d763856 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -61,6 +61,7 @@ const config = { "0x6667cfe4698500cec4ed2cf22a9d6dbf15aec81d", "0x1e2012e21086C96256CC32F5939Ad8b5e7489Afb", "0x6b9C05B935BdAddDDFfa6C315483e02401f31307", + "0x009c239edda6bda23dc4afc5cca0e6e39ad8e95a", ] }, // USDC is arc's gas token, so the native balance already is the USDC balance @@ -126,7 +127,8 @@ const config = { "0x4dc3bda32a72eadae470e580188b61fa36e9ccea", "0xa561cd8e2f3ae87d109ac5adde3d39f36e4b96f1", "0x2b0a8c481c2d125b2721b3ea0d4f2804270f0b8f", - "0x8f39b3617e99f7c429742830208d0ed1f2b66726" + "0x8f39b3617e99f7c429742830208d0ed1f2b66726", + "0xcf6f5ec73942314c3ec864202b40dcbb1f9477a0", ] }, "fantom": { @@ -303,7 +305,7 @@ const config = { "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath", "16ccyj8JqnP8d2DSaifgek6kSSBAu5cGtd4mu2uXTg4H6mSU", "14ooXLY2gmiUTVym9SnKxNwEgcoikXzMEav2kiLjr7pPPHPR", - // "1665ypcQXKmqXtjE9yuWsZqK5MQmBQokFjPGLq5SvoKAWBjQ", + "1665ypcQXKmqXtjE9yuWsZqK5MQmBQokFjPGLq5SvoKAWBjQ", // Gate Earn, nominator (bonded DOT stays in the account) // "123tA7zfH9XdqHX5v9W4mB4VfmrjE95yJvdvMbpWv5V851rX", // "15NtvAi8CGHrbaUBvXdki8GXc5YfHM9yTv6HGmaYDetLH2ob", // "15dZTKqG6YZiQNiisMZP1DT4J6J9bmEEC4Bkz24nMC1ccRe2" @@ -423,6 +425,7 @@ const config = { "flux": { "owners": [ "t1YvimnGBmVA7xDiPnqwbKsvujmSJz4X5m2", + "t1NuCztsAfdTWfuowWCKneUPDys5S4puiBW", ] }, "allora": { @@ -565,7 +568,8 @@ const config = { "owners": [ "162bzZT2hJfv5Gm3ZmWfWfHJjCtMD6rHhw", "1EkkGXR7dTbZbrKFKoe6YEP4gj4GzMeKvw", - "1G47mSr3oANXMafVrR8UC4pzV7FEAzo3r9" + "1G47mSr3oANXMafVrR8UC4pzV7FEAzo3r9", + "1MEPB525tEHRFLdq6aR8d2t8jaaRQj2iWX", ] }, "bitcoincash": { @@ -792,7 +796,8 @@ const config = { }, "coti": { "owners": [ - "0x0d0707963952f2fba59dd06f2b425ace40b492fe" + "0x0d0707963952f2fba59dd06f2b425ace40b492fe", + "0xc882b111a75c0c657fc507c04fbfcd2cc984f071", ] }, "cosmos": { @@ -1028,7 +1033,8 @@ const config = { "0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c", "0xc882b111a75c0c657fc507c04fbfcd2cc984f071", "0xffeb0f61871acdb4838dfc6d5082f063e738e421", - "0xcf6f5ec73942314c3ec864202b40dcbb1f9477a0" + "0xcf6f5ec73942314c3ec864202b40dcbb1f9477a0", + "0x8ea539c58943e1ae034335dadca82014833c8282", ] }, "fogo": { @@ -1333,7 +1339,8 @@ const config = { }, "megaeth": { "owners": [ - "0x0d0707963952f2fba59dd06f2b425ace40b492fe" + "0x0d0707963952f2fba59dd06f2b425ace40b492fe", + "0xc882b111a75c0c657fc507c04fbfcd2cc984f071", ] }, "merlin": { @@ -1652,7 +1659,8 @@ const config = { }, "saga": { "owners": [ - "saga155svs6sgxe55rnvs6ghprtqu0mh69kehaqkl89" + "saga155svs6sgxe55rnvs6ghprtqu0mh69kehaqkl89", + "saga1xunyznpjmj9jv5e2zwngp2qrzmulr2ggxtcvws", ] }, "secret": { @@ -1748,7 +1756,8 @@ const config = { // story protocol, the chain behind the "IP"/DATA holdings "sty": { "owners": [ - "0x0d0707963952f2fba59dd06f2b425ace40b492fe" + "0x0d0707963952f2fba59dd06f2b425ace40b492fe", + "0xc882b111a75c0c657fc507c04fbfcd2cc984f071", ] }, "supra": { @@ -1847,6 +1856,9 @@ const config = { "0:16ea6a34f0d704b6fac9b7592e003f6f28ae5d1a8a6ba9d1650e4dd30ab8eada", "EQAbhMWosoxeoXTJi9Tlw09MEjPVvdJe9j0nC6K6ro0d1oL-", "EQCAZ9RKpYqjaD30mg9FL0eP3TE03jmq1Mn0SlfPrkBgBPed", + "UQDQSAWWKRBUm0VnUrny-9Ni_deobis0aC6XpEtalxxl_eUa", + "UQCalNyv57ob7KK1r7nsVaY4VivZu712RTlqiEYAffoM3kJ-", + "EQC0lrj3O0af8GotieYsTXChA_wijIIVN7Sd_wkgYLwoH07q", ] }, "umee": { @@ -2013,7 +2025,8 @@ const config = { }, "zigchain": { "owners": [ - "zig155svs6sgxe55rnvs6ghprtqu0mh69kehze2lzt" + "zig155svs6sgxe55rnvs6ghprtqu0mh69kehze2lzt", + "zig1xunyznpjmj9jv5e2zwngp2qrzmulr2ggejyvt7", ] }, robinhood: { @@ -2043,7 +2056,7 @@ unsupportedChains.forEach(chain => delete config[chain]); */ const earnStakers = { celestia: ['celestia10v2gu0vvdeuv8pexnl98lmyva4cq8jkavlk9w4'], - cosmos: ['cosmos10v2gu0vvdeuv8pexnl98lmyva4cq8jkaa4845c'], + cosmos: ['cosmos10v2gu0vvdeuv8pexnl98lmyva4cq8jkaa4845c', 'cosmos18njk2lz5q7juryvzgyly2qxetuwqadxzt9vc92'], injective: ['inj10v2gu0vvdeuv8pexnl98lmyva4cq8jkahus3xq', 'inj18njk2lz5q7juryvzgyly2qxetuwqadxzpvmuhj'], dydx: ['dydx10v2gu0vvdeuv8pexnl98lmyva4cq8jka5vf350'], // stake migrated on 2026-10-21, the previous stakers (0x6edd3b…, 0xf15b7d…) are empty since @@ -2140,6 +2153,7 @@ const earnReceiptTokens = { '0x8cd6437feaeb1a3a0cd65a16de2ad26bff1f5e43', '0xC453E33Ae2d465d36fEA462BfE810cD6ab408916', "0xba622437b70d86EADd6F2f5fB7A5124270c35705", + '0x7cce98e315e406a8946acce9768093d37a90372b', // Compound V3 Institutional USDC supplier ], tokens: [ '0x23878914efe38d27c4d67ab83ed1b93a74d4086a', // aEthUSDT (Aave v3) @@ -2150,6 +2164,7 @@ const earnReceiptTokens = { '0xE1753F2e00940cC31213dd92013cF019DFE4ca1d', // sGHO (Aave savings GHO) '0xC02aB1A5eaA8d1B114EF786D9bde108cD4364359', // spUSDS (Spark savings USDS) '0xe7df13b8e3d6740fe17cbe928c7334243d86c92f', // spUSDT + '0x207158a267CBD2598BB3d611D8CBdEE2709F2F8C', // ciUSDCv3 (Compound V3 Institutional USDC) ], }, arbitrum: { diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index d8bda326dbc..bca3e248755 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -664,6 +664,7 @@ module.exports = { "16G1xYBbiNG78LSuZdMqp6tux5xvVp9Wxh", "38PFUcFi7o7RVYYJjWCodU9t9yiQ9Qt8Gw", // add on 22/10/2026 "1MEPB525tEHRFLdq6aR8d2t8jaaRQj2iWX", // add on 22/10/2026 + "bc1phqnz3j2a6dh2srwmfv9mnznvv68fxvhu0u683nmhe6v52fagtcsqlmrtge", // Gate Babylon staking, add on 06/11/2026 ], hashkey: [ "bc1qyvppkaa74d9jvtz664a6uxmj09hf0eyg3uhx4h", From a5892c44fca52ef310a86a69731197e4fdde6cc4 Mon Sep 17 00:00:00 2001 From: Miles <165137400+Envision-Miles@users.noreply.github.com> Date: Fri, 6 Nov 2026 17:38:58 +0400 Subject: [PATCH 623/988] token.select: add $SELECT side of launch pools as staking (#22058) Co-authored-by: FelixBruguera --- projects/token-select/index.js | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/projects/token-select/index.js b/projects/token-select/index.js index 5149c0c66a3..0224c63192c 100644 --- a/projects/token-select/index.js +++ b/projects/token-select/index.js @@ -24,27 +24,45 @@ const NFT_MANAGER = '0x73991a25c818bf1f1128deaab1492d45638de0d3' const NEW_TOKEN = 'event NewTokenSelectToken(address indexed tokenAddress, address indexed creator, string name, string symbol, uint256 targetETHRaise, uint256 migrationFee, uint256 deploymentFee)' -async function tvl(api) { +async function getVaults(api) { const logs = await getLogs2({ api, factory: FACTORY, eventAbi: NEW_TOKEN, fromBlock: FROM_BLOCK }) const tokens = logs.map((log) => log.tokenAddress) - if (!tokens.length) return {} + if (!tokens.length) return [] const vaults = await api.multiCall({ abi: 'address:lpVault', calls: tokens }) - const owners = [...new Set(vaults.filter((vault) => vault && vault !== ADDRESSES.null))] + return [...new Set(vaults.filter((vault) => vault && vault !== ADDRESSES.null))] +} + +// Sums one side of every V3 position the vaults hold: whatever token is whitelisted. +async function vaultSide(api, token) { + const owners = await getVaults(api) if (!owners.length) return {} return sumTokens2({ api, owners, resolveUniV3: true, - uniV3WhitelistedTokens: [ADDRESSES.robinhood.WETH], + uniV3WhitelistedTokens: [token], uniV3ExtraConfig: { nftAddress: NFT_MANAGER }, }) } +async function tvl(api) { + return vaultSide(api, ADDRESSES.robinhood.WETH) +} + +// $SELECT is the second pairing asset: every launch seeds a launched-token/$SELECT pool next to its +// WETH pool, and $SELECT's own WETH pools sit in the same vault. Its side of those positions is +// the protocol's own token, so it is reported as staking. The address is read from the factory, not hardcoded. +async function staking(api) { + const select = await api.call({ abi: 'address:selectToken', target: FACTORY }) + if (!select || select === ADDRESSES.null) return {} + return vaultSide(api, select) +} + module.exports = { doublecounted: true, // the same liquidity is already counted as Uniswap V3 TVL methodology: - 'TVL is the WETH side of the Uniswap V3 positions held by token.select lpVaults. Launched tokens are enumerated from the factory\'s NewTokenSelectToken events and each token\'s lpVault is read on-chain, so vaults added later are included automatically. Only the whitelisted WETH side is counted, matching the other launchpads on this chain: the launched-token side and the token/$SELECT pools are excluded, so this understates total liquidity in the pools.', - robinhood: { tvl }, + 'TVL is the WETH side of the Uniswap V3 positions held by token.select lpVaults. Launched tokens are enumerated from the factory\'s NewTokenSelectToken events and each token\'s lpVault is read on-chain, so vaults added later are included automatically. Only the WETH side is counted in TVL; the launched-token side is excluded. Staking is the $SELECT side of the same vault positions: every launch is also paired against $SELECT (address read from the factory\'s selectToken()), and $SELECT\'s own WETH pools are held there too.', + robinhood: { tvl, staking }, } From a39a95e5ee8e805493914da7f2cc84d37125aaa0 Mon Sep 17 00:00:00 2001 From: staff002-web Date: Fri, 6 Nov 2026 22:14:00 +0800 Subject: [PATCH 624/988] Add RocketSwap Anubis V3 TVL adapter (#22056) Co-authored-by: staff002-web <286980340+staff002-web@users.noreply.github.com> Co-authored-by: FelixBruguera --- registries/uniswapV3.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 29b78080ced..dac467c6c09 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1230,6 +1230,10 @@ const uniV3Configs = { fromBlock: 43939793, }, }, + 'rocketswap-anubis-v3': { + methodology: 'TVL is the value of tokens held in RocketSwap V3 liquidity pools on Anubis.', + anubi: { factory: '0xbf1b0e9878e782c799010454c1A65ACd334f666F', fromBlock: 16113175 }, + }, 'satsuma': { citrea: { factory: '0x10253594A832f967994b44f33411940533302ACb', From f2f8059ee3428ef128d8f720bda323df036c4a83 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 6 Nov 2026 10:33:47 -0400 Subject: [PATCH 625/988] Yld update (#22063) Co-authored-by: michaeldim --- registries/erc4626.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/registries/erc4626.js b/registries/erc4626.js index 06a9bc449cd..2d2f548f1bc 100644 --- a/registries/erc4626.js +++ b/registries/erc4626.js @@ -206,7 +206,8 @@ const configs = { doublecounted: true, ethereum: [ '0xCa960E6DF1150100586c51382f619efCCcF72706', - '0x8ED5AB1BA2b2E434361858cBD3CA9f374e8b0359', + '0x8ED5AB1BA2b2E434361858cBD3CA9f374e8b0359', // yscvgCVX, retired (empty since Oct 2026) + '0x1Fd0A85084fC61c397AC619c4F0bA2350eA1cE9e', // ysCVX ], }, 'quell': { From 1eda1744d3de1f469a2d4709f6c862e35aacfe28 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 6 Nov 2026 10:56:41 -0400 Subject: [PATCH 626/988] add Institutional Private Vault TVL to shiftdefi (#22064) Co-authored-by: shift-developer-2 --- projects/shift-defi/index.js | 89 ++++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 28 deletions(-) diff --git a/projects/shift-defi/index.js b/projects/shift-defi/index.js index 9812e3f8cdf..07396a64e84 100644 --- a/projects/shift-defi/index.js +++ b/projects/shift-defi/index.js @@ -13,6 +13,11 @@ const abi = { getPreReshufflingSnapshot: "uint256:getPreReshufflingSnapshot", notion: "address:notion", decimals: "uint8:decimals", + logic: "address:logic", + getDefiisFor: "function getDefiisFor(address owner) view returns (address[])", + getOpsFor: "function getOpsFor(address owner) view returns (address[])", + getWhitelistedTokens: "function getWhitelistedTokens() view returns (address[])", + underlyingTokensBalances: "function underlyingTokensBalances(address defii) view returns (address[] tokens, uint256[] amounts)", }; @@ -23,12 +28,35 @@ const vaults = { }, }; +// Chain -> Institutional Private Vaults: the SelfManagedFactory and the account whose positions it tracks +const privateVaults = { + ethereum: [ + { factory: "0x3FaD5aFBA6e3169C9c688aaC3Ba77200c5168378", account: "0x8FcC3aAc6b16dC821B7E4A2841b2Db3a9c999B4C" }, + ], +}; + const chainNamesById = Object.fromEntries( Object.entries(sdk.providerListJSON ?? {}) .filter(([, { chainId }]) => chainId) .map(([name, { chainId }]) => [chainId, name]) ); +function getChainApi(api, chainId) { + if (chainId === Number(api.chainId)) return api; + const chain = chainNamesById[chainId]; + if (!chain) throw new Error(`Unknown chainId ${chainId}`); + return new sdk.ChainApi({ chain, timestamp: api.timestamp }); +} + +// Adds an 18-decimal value as an amount of `token` +async function addNav(api, token, nav) { + const decimals = BigInt(await api.call({ target: token, abi: abi.decimals })); + const amount = decimals < NAV_DECIMALS + ? nav / 10n ** (NAV_DECIMALS - decimals) + : nav * 10n ** (decimals - NAV_DECIMALS); + api.add(token, amount); +} + async function getVaultNav(api, vault, tvlReporter) { const [containersRes, isReshuffling] = await Promise.all([ api.call({ target: vault, abi: abi.getContainers }), @@ -57,44 +85,49 @@ async function getVaultNav(api, vault, tvlReporter) { } const navAbi = isReshuffling ? abi.getPreReshufflingSnapshot : abi.getStrategiesNav; - const navs = await Promise.all([...chainIds].map((chainId) => { - if (chainId === Number(api.chainId)) { - return api.call({ target: tvlReporter, abi: navAbi }); - } - - const chain = chainNamesById[chainId]; - if (!chain) throw new Error(`Unknown chainId ${chainId}`); - const chainApi = new sdk.ChainApi({ chain, timestamp: api.timestamp }); - return chainApi.call({ target: tvlReporter, abi: navAbi }); - })); + const navs = await Promise.all([...chainIds].map((chainId) => + getChainApi(api, chainId).call({ target: tvlReporter, abi: navAbi }) + )); return navs.reduce((total, nav) => total + BigInt(nav), 0n); } +// Strategy (defii) positions as underlying tokens, plus whitelisted token balances held by the +// account and its ops addresses +async function privateVaultsTvl(api) { + for (const { factory, account } of privateVaults[api.chain] ?? []) { + const defiis = await api.call({ target: factory, abi: abi.getDefiisFor, params: [account] }); + const logics = await api.multiCall({ abi: abi.logic, calls: defiis }); + const positions = await api.multiCall({ + abi: abi.underlyingTokensBalances, + calls: defiis.map((defii, i) => ({ target: logics[i], params: [defii] })), + }); + positions.forEach(({ tokens, amounts }) => tokens.forEach((token, i) => api.add(token, amounts[i]))); + + const ops = await api.call({ target: factory, abi: abi.getOpsFor, params: [account] }); + const tokens = await api.call({ target: factory, abi: abi.getWhitelistedTokens }); + await api.sumTokens({ owners: [account, ...ops], tokens }); + } +} + +async function liquidVaultsTvl(api) { + for (const [vault, tvlReporter] of Object.entries(vaults[api.chain] ?? {})) { + const nav = await getVaultNav(api, vault, tvlReporter); + const notion = await api.call({ target: vault, abi: abi.notion }); + await addNav(api, notion, nav); + } +} + async function tvl(api) { - await Promise.all( - Object.entries(vaults[api.chain] ?? {}).map(async ([vault, tvlReporter]) => { - const [nav, notion] = await Promise.all([ - getVaultNav(api, vault, tvlReporter), - api.call({ target: vault, abi: abi.notion }), - ]); - const notionDecimals = BigInt(await api.call({ target: notion, abi: abi.decimals })); - const tokenAmount = notionDecimals < NAV_DECIMALS - ? nav / 10n ** (NAV_DECIMALS - notionDecimals) - : nav * 10n ** (notionDecimals - NAV_DECIMALS); - api.add( - notion, - tokenAmount - ); - }) - ); + await liquidVaultsTvl(api); + await privateVaultsTvl(api); } module.exports = { doublecounted: true, methodology: - "Shift DeFi's total protocol TVL is calculated as the sum of the TVLs of all Vaults within the ecosystem. Each Vault's TVL is calculated as the sum of the NAVs of all strategies that make up the Vault's portfolio, as reported on-chain by each chain's TvlReporter. Strategies deposit into Curve and Morpho, so these assets are also counted in those protocols.", + "Shift DeFi's total protocol TVL is calculated as the sum of the TVLs of all Vaults within the ecosystem. Each Vault's TVL is calculated as the sum of the NAVs of all strategies that make up the Vault's portfolio, as reported on-chain by each chain's TvlReporter. Strategies deposit into Curve and Morpho, so these assets are also counted in those protocols. Institutional Private Vaults are counted as tokens: the underlying token balances of each strategy (defii) the vault's account holds in the SelfManagedFactory, plus the factory's whitelisted tokens held by the account and its ops addresses.", }; -Object.keys(vaults).forEach((chain) => { +new Set([...Object.keys(vaults), ...Object.keys(privateVaults)]).forEach((chain) => { module.exports[chain] = { tvl }; }); From aca6394b0b6ecc71fc0d5394adf9e2cad8acafab Mon Sep 17 00:00:00 2001 From: Lodestar Date: Fri, 6 Nov 2026 16:25:22 +0100 Subject: [PATCH 627/988] The Cellar: add the XRP Options Premium Vault to TVL (#22065) Co-authored-by: lodestarprotocol <305971687+lodestarprotocol@users.noreply.github.com> Co-authored-by: FelixBruguera --- projects/the-cellar/index.js | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/projects/the-cellar/index.js b/projects/the-cellar/index.js index 64d00680172..ffb30eb9f94 100644 --- a/projects/the-cellar/index.js +++ b/projects/the-cellar/index.js @@ -12,17 +12,15 @@ const { pool2 } = require('../helper/pool2') // - Den : holds fcUSD and turns it into FXRP when backing gets thin // - KOBAN : points token // fcUSD, Boost, Den shares and KOBAN are claims or points on the same FXRP, so none of them is -// counted. Only FXRP the Jar actually holds for users is counted. -// -// The Jar keeps its FXRP in three internal ledgers (verified source, Jar.sol): -// reserve FXRP backing fcUSD + Boost -> counted -// denFxrp FXRP owned by Den depositors (after a conversion) -> counted -// protocolFxrp fees owed to the treasury, paid out by collect() -> NOT counted -// FXRP sent to the Jar outside these ledgers is ignored by its accounting and is not counted either. +// counted. The Jar's FXRP balance is counted as held, including fees not yet collected by the treasury. // fcUSD held by the Jar (Den fcUSD, swap-back escrow) is a claim, not collateral, and is not counted. const JAR = '0xF85d0daCC7e911b1a2800DCF0e6027e0f7481294' +// XRP Options (since 2026-11-05): the Premium Vault (verified source, XrpCalls.sol) holds the USDT0 that backs every +// call and put it sells. Its USDT0 balance is counted as held. +const PREMIUM_VAULT = '0x323A173373f2653eBB23139163b8231aD2a91129' + // cKOBAN (since 2026-11-01): KOBAN, the protocol's own points token, wrapped into cKOBAN (verified source, Cask.sol), and // a farm that stakes the SparkDEX V2 cKOBAN/FXRP LP (CaskFarm.sol). Both are the protocol's own token, so they are // reported apart from TVL: the KOBAN held by cKOBAN as staking, the staked cKOBAN/FXRP LP as pool2. @@ -32,20 +30,20 @@ const CKOBAN_FARM = '0x31BF74580AD232220C09829Ec29168a00a877f42' const CKOBAN_FXRP_LP = '0x9396Bd1b043c1e37adF0d6c32492B44Fc5707928' async function tvl(api) { - const [reserve, denFxrp] = await Promise.all([ - api.call({ target: JAR, abi: 'uint256:reserve' }), - api.call({ target: JAR, abi: 'uint256:denFxrp' }), - ]) - api.add(ADDRESSES.flare.FXRP, reserve) - api.add(ADDRESSES.flare.FXRP, denFxrp) + return api.sumTokens({ + tokensAndOwners: [ + [ADDRESSES.flare.FXRP, JAR], + [ADDRESSES.flare.USDT0, PREMIUM_VAULT], + ], + }) } module.exports = { methodology: - 'TVL is the FXRP held in the Jar contract for users: the reserve that backs fcUSD and Boost plus the FXRP ' + - 'owned by Den depositors. fcUSD, Boost, Den shares and KOBAN are claims or points on that same FXRP and are ' + - 'not counted. Fees owed to the treasury (protocolFxrp) are excluded. Staking: the KOBAN held by cKOBAN (KOBAN ' + - 'wrapped by its holders). Pool2: the SparkDEX V2 cKOBAN/FXRP LP staked in the cKOBAN farm.', + 'TVL is the FXRP held by the Jar contract, which backs fcUSD and Boost and holds the FXRP owned by Den ' + + 'depositors, and the USDT0 held by the XRP Options Premium Vault, which backs the calls and puts it sells. ' + + 'fcUSD, Boost, Den shares and KOBAN are claims or points on that same FXRP and are not counted. Staking: the ' + + 'KOBAN held by cKOBAN (KOBAN wrapped by its holders). Pool2: the SparkDEX V2 cKOBAN/FXRP LP staked in the cKOBAN farm.', // Jar deploy: 2026-10-26 21:59:28 UTC, block 73048463. A timestamp, not '2026-10-26': at midnight that day the // Jar did not exist yet and the first backfill day would fail. start: 1793051968, From ad4af5a5b33209474447d99874866ec3fda2ac93 Mon Sep 17 00:00:00 2001 From: tree Date: Fri, 6 Nov 2026 21:14:53 +0530 Subject: [PATCH 628/988] vesper-v2: add adapter (#22061) --- projects/vesper-v2/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/vesper-v2/index.js diff --git a/projects/vesper-v2/index.js b/projects/vesper-v2/index.js new file mode 100644 index 00000000000..614059fb1b1 --- /dev/null +++ b/projects/vesper-v2/index.js @@ -0,0 +1,21 @@ +// Vesper 2 (backend of Odyssey Earn). Users deposit collateral to mint a pegged token (USDv / ETHv); +// the collateral is held by each instance's Treasury as shares of an ERC4626 yield vault. +const INSTANCES = { + USDv: { treasury: '0xd4765523fd844eddf9e6efe136a48012bcd5503a', yieldVault: '0x3aed4dd0b5ba616156fa352274670c18d2ec2a81' }, + ETHv: { treasury: '0x41679fa9bdcb910f392da163e8c8b9173a78f34f', yieldVault: '0x025a05f1967521806bb4c8a10ba4b8c00a794f65' }, +} + +async function tvl(api) { + const instances = Object.values(INSTANCES) + const vaults = instances.map(i => i.yieldVault) + const shares = await api.multiCall({ abi: 'erc20:balanceOf', calls: instances.map(i => ({ target: i.yieldVault, params: i.treasury })) }) + const assets = await api.multiCall({ abi: 'address:asset', calls: vaults }) + const amounts = await api.multiCall({ abi: 'function convertToAssets(uint256) view returns (uint256)', calls: vaults.map((target, i) => ({ target, params: shares[i] })) }) + api.add(assets, amounts) +} + +module.exports = { + start: '2026-06-02', + methodology: 'Counts the collateral (USDC, WETH) backing the USDv and ETHv pegged tokens: each instance Treasury holds the collateral as ERC4626 yield-vault shares, valued via convertToAssets. Staked USDv/ETHv (sUSDv/sETHv) is excluded since it is minted against that same collateral.', + ethereum: { tvl }, +} From 44767c889e971c567fc732315e2bb5320eed121c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 6 Nov 2026 16:51:30 +0100 Subject: [PATCH 629/988] clean up --- projects/helper/cache/getLogs.js | 5 +- projects/helper/chain/near.js | 67 +--------- projects/helper/chain/neo3.js | 15 +-- projects/helper/chain/provenance.js | 67 ---------- projects/helper/chain/zilliqa.js | 182 +--------------------------- projects/helper/stakingHelper.js | 13 +- 6 files changed, 21 insertions(+), 328 deletions(-) delete mode 100644 projects/helper/chain/provenance.js diff --git a/projects/helper/cache/getLogs.js b/projects/helper/cache/getLogs.js index 25da326194e..8aa85cfa43f 100644 --- a/projects/helper/cache/getLogs.js +++ b/projects/helper/cache/getLogs.js @@ -5,7 +5,10 @@ const ethers = require("ethers") const cacheFolder = 'logs' -const problematicChainSet = new Set(['rbn',]) +const problematicChainSet = new Set([ + 'rbn', + 'cronos_zkevm', // deprecated +]) async function getLogs({ target, topic, keys = [], fromBlock, toBlock, topics, diff --git a/projects/helper/chain/near.js b/projects/helper/chain/near.js index 28285f44ea0..8e9117117b7 100644 --- a/projects/helper/chain/near.js +++ b/projects/helper/chain/near.js @@ -1,64 +1,16 @@ -const ADDRESSES = require('../coreAssets.json') const { default: BigNumber } = require("bignumber.js") const sdk = require('@defillama/sdk') const near = sdk.chains.near +// balance keys: rainbow-bridged tokens map to their ethereum contract, everything else is `near:` +// (decimals/pricing come from the coins server token mapping); keys that already carry a chain prefix are left alone function transformAddress(addr) { + if (addr.includes(':')) return addr const bridgedAssetIdentifier = ".factory.bridge.near"; if (addr.endsWith(bridgedAssetIdentifier)) return `0x${addr.slice(0, addr.length - bridgedAssetIdentifier.length)}`; - if (addr.endsWith('.near')) - return `near:${addr}` - return addr -} - -const tokenMapping = { - 'wrap.near': { name: 'near', decimals: 24, }, - 'meta-pool.near': { name: 'staked-near', decimals: 24, }, - "storage.herewallet.near": { name: 'here-staking', decimals: 24, }, - 'usn': { name: 'usn', decimals: 18, }, - 'aurora': { name: 'ethereum', decimals: 18, }, - 'token.skyward.near': { name: 'skyward-finance', decimals: 18, }, - 'dbio.near': { name: 'debio-network', decimals: 18, }, - // 'hak.tkn.near': { name: '', }, // Hakuna matata - 'meta-token.near': { name: 'meta-near', decimals: 24 }, - 'v3.oin_finance.near': { name: 'oin-finance', decimals: 8, }, - 'usdt.tether-token.near': { name: 'tether', decimals: 6, }, - 'eth-0xdac17f958d2ee523a2206206994597c13d831ec7.omft.near': { name: 'tether', decimals: 6 }, - 'eth-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.omft.near': { name: 'usd-coin', decimals: 6 }, - // 'gems.l2e.near': { name: '', }, // https://www.landtoempire.com/ - // 'nd.tkn.near': { name: '', }, // nearDog - // 'gold.l2e.near': { name: '', }, // https://www.landtoempire.com/ - 'token.v2.ref-finance.near': { name: 'ref-finance', decimals: 18, }, - // 'myriadcore.near': { name: '', }, // Myria - // '6b175474e89094c44da98b954eedeac495271d0f.factory.bridge.near': { name: 'dai', decimals: 18 }, - // 'a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near': { name: 'usd-coin', decimals: 6 }, - // 'dac17f958d2ee523a2206206994597c13d831ec7.factory.bridge.near': { name: 'tether', decimals: 6 }, - // '2260fac5e5542a773aa44fbcfedf7c193bc2c599.factory.bridge.near': { name: ADDRESSES.ethereum.WBTC, decimals: 0 }, - // 'aaaaaa20d9e0e2461697782ef11675f668207961.factory.bridge.near': { name: 'aurora-near', decimals: 18 }, - [ADDRESSES.near.BURROW]: { name: 'burrow', decimals: 18 }, - [ADDRESSES.near.PARAS]: { name: 'paras', decimals: 18 }, - [ADDRESSES.near.PEMBROCK]: { name: 'pembrock', decimals: 18 }, - 'token.sweat': { name: 'sweatcoin', decimals: 18 }, - 'v2-nearx.stader-labs.near': { name: 'stader-nearx', decimals: 24 }, - '17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1': { name: 'usd-coin', decimals: 6 }, - 'edge-fast.near': { name: 'edge-video-ai', decimals: 24 }, - '802d89b6e511b335f05024a65161bce7efc3f311.factory.bridge.near': { name: 'linear-protocol-lnr', decimals: 18 }, - 'ftv2.nekotoken.near': { name: 'neko', decimals: 24 }, - 'token.lonkingnearbackto2024.near': { name: 'lonk-on-near', decimals: 8 }, - 'blackdragon.tkn.near': { name: 'black-dragon', decimals: 24 }, - 'gear.enleap.near': { name: 'near-tinker-union-gear', decimals: 18 }, - 'token.0xshitzu.near': { name: 'shitzu', decimals: 18 }, - 'purge-558.meme-cooking.near': { name: 'forgive-me-father', decimals: 18 }, - 'mpdao-token.near': { name: 'meta-pool-dao', decimals: 6 }, - 'kat.token0.near': { name: 'nearkat', decimals: 18 }, - 'btc.omft.near': { name: 'bitcoin', decimals: 8 }, - 'eth-0x2260fac5e5542a773aa44fbcfedf7c193bc2c599.omft.near': { name: 'wrapped-btc', decimals: 8 }, - 'cardano.omft.near': { name: 'cardano', decimals: 6 }, - 'doge.omft.near': { name: 'dogecoin', decimals: 8 }, - 'ltc.omft.near': { name: 'litecoin', decimals: 8 }, - 'xrp.omft.near': { name: 'ripple', decimals: 6 }, + return `near:${addr}` } async function view_account(account_id) { @@ -106,17 +58,8 @@ async function addAsset(token, account, balances = {}) { return sumSingleBalance(balances, token, balance) } +// `balance` is the raw (undivided) token amount function sumSingleBalance(balances, token, balance) { - const { name, decimals, } = tokenMapping[token] || {} - - if (name) { - if (decimals) - balance = balance / (10 ** decimals) - - balances[name] = +(balances[name] || 0) + balance - return - } - sdk.util.sumSingleBalance(balances, transformAddress(token), BigNumber(balance).toFixed(0)) return balances } diff --git a/projects/helper/chain/neo3.js b/projects/helper/chain/neo3.js index 2ea95dad4d6..11fc9a821ae 100644 --- a/projects/helper/chain/neo3.js +++ b/projects/helper/chain/neo3.js @@ -3,25 +3,18 @@ const { sleep } = require('../utils') const RPC = 'https://mainnet1.neo.coz.io:443' -// NEP-17 asset hash -> pricing; anything else the wallet holds is skipped (FLM has no price feed) -const ASSETS = { - '0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5': { geckoId: 'neo', decimals: 0 }, - '0xd2a4cff31913016155e38e474a2c06d08be276cf': { geckoId: 'gas', decimals: 8 }, -} - async function getNep17Balances(address) { const { result } = await post(RPC, { jsonrpc: '2.0', id: 1, method: 'getnep17balances', params: [address] }) return result?.balance ?? [] } +// NEP-17 balances are added raw under `neo:`: the coins server knows the chain as `neo`, not `neo3`, +// and holds the decimals/pricing for NEO, GAS, ... async function sumTokens({ api, owners = [] }) { for (const owner of owners) { const balances = await getNep17Balances(owner) - for (const { assethash, amount } of balances) { - const asset = ASSETS[assethash.toLowerCase()] - if (!asset) continue - api.addCGToken(asset.geckoId, Number(amount) / 10 ** asset.decimals) - } + for (const { assethash, amount } of balances) + api.add(`neo:${assethash.toLowerCase()}`, amount, { skipChain: true }) await sleep(200) } } diff --git a/projects/helper/chain/provenance.js b/projects/helper/chain/provenance.js deleted file mode 100644 index 734c5a7c0b7..00000000000 --- a/projects/helper/chain/provenance.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Token Mapping for Provenance. Note that - * YLDS is pending on CoinGecko, but is a stablecoin. - * Additionally, LRWA and REIT are also 1:1 with USD - */ -const tokenMapping = { - hash: "hash-2", - "eth.figure.se": "ethereum", - "usd.trading": "usd-coin", - "usdc.figure.se": "usd-coin", - // "ylds.fcc": "ylds", - "usdt.figure.se": "tether", - "xrp.figure.se": "ripple", - "sol.figure.se": "solana", - "btc.figure.se": "bitcoin", - "uni.figure.se": "uniswap", - "lrwa.figure.markets": "usd-coin", - "link.figure.se": "chainlink", - 'reit.figure.markets': "usd-coin", -}; - -/** - * Denoms are listed as their base unit. For example, HASH is returned as - * nhash, and needs to be converted to it's CoinGecko Value. - * We do this by querying the denom metadata and using the provided - * exponent and base unit to convert. - * @param tokenObject An object with key: token name (in base units) - * and value: amount of tokens - * Example: { - * nhash: 100000000 - * } - */ -const convertToCoinGeckoApiId = async (tokenObject) => - await Promise.all( - Object.keys(tokenObject).map(async (t) => { - // Get the denom exponent information - const response = await fetch( - `https://api.provenance.io/cosmos/bank/v1beta1/denoms_metadata/${t}` - ); - const denomExponent = (await response.json()).metadata?.denom_units[1] - // If a denom is present and we have mapped the token to the CoinGecko Equivalent... - if (denomExponent && tokenMapping[denomExponent.denom]) { - // Map these tokens to coingecko - const key = tokenMapping[denomExponent.denom] - if (tokenObject[key]) { - const incomingAmount = BigInt(tokenObject[t]) / BigInt(Math.pow(10, denomExponent.exponent)) - const newVal = BigInt(tokenObject[key]) + incomingAmount - tokenObject[key] = newVal.toString(); - } else { - tokenObject[key] = (BigInt(tokenObject[t]) / BigInt(Math.pow(10, denomExponent.exponent))).toString(); - } - delete tokenObject[t]; - } - }) - ); - -// Map tokens. If they exist in coingecko, add to coingecko. -// Otherwise, keep in provenance -const mapTokens = (tokens, coin, api) => - Object.values(tokenMapping).includes(coin) ? - api.addCGToken(coin, tokens[coin]) : api.add(coin, tokens[coin]) - -module.exports = { - tokenMapping, - convertToCoinGeckoApiId, - mapTokens, -} \ No newline at end of file diff --git a/projects/helper/chain/zilliqa.js b/projects/helper/chain/zilliqa.js index 95c82cc2f05..9959d2f84ea 100644 --- a/projects/helper/chain/zilliqa.js +++ b/projects/helper/chain/zilliqa.js @@ -1,12 +1,12 @@ // Zilliqa JSON-RPC transport lives in @defillama/sdk (`sdk.chains.zilliqa`, `ZILLIQA_NATIVE_RPC` overrides the endpoint); -// this file keeps the TVL helpers (ZRC-2 token mapping, sumTokens). +// this file keeps the TVL helpers (ZRC-2 balances, native ZIL). const sdk = require('@defillama/sdk') const BigNumber = require('bignumber.js') const zilliqa = sdk.chains.zilliqa -// ZRC-2 balances of every token for every address, summed into `balances`: tokens mapped below -// go under `coingecko:` in whole units, the rest under `zilliqa:` in raw units +// ZRC-2 balances of every token for every address, summed into `balances` under `zilliqa:` in raw units +// (decimals/pricing come from the coins server token mapping) async function getBalances(tokens, addresses, balances = {}) { if (!Array.isArray(tokens)) tokens = [tokens] if (!Array.isArray(addresses)) addresses = [addresses] @@ -16,11 +16,7 @@ async function getBalances(tokens, addresses, balances = {}) { for (const [token, holders] of Object.entries(res)) { const raw = Object.values(holders).reduce((acc, i) => acc.plus(i), BigNumber(0)) if (raw.isZero()) continue - const tokenRef = TOKENS_BY_HEX[token] - if (tokenRef?.coingeckoId) - sdk.util.sumSingleBalance(balances, `coingecko:${tokenRef.coingeckoId}`, raw.shiftedBy(-(tokenRef.decimals ?? 0)).toNumber()) - else - sdk.util.sumSingleBalance(balances, `zilliqa:${token}`, raw.toFixed(0)) + sdk.util.sumSingleBalance(balances, `zilliqa:${token}`, raw.toFixed(0)) } return balances @@ -34,176 +30,6 @@ async function sumTokens({ owners, }) { } } -// taken from https://swap.xcadnetwork.com/_next/data/E6YkkwWJMYjzQhGDTm38j/pool-overview.json -const TOKENS = { - '0x153feaddc48871108e286de3304b9597c817b456': { - name: 'XCAD Token', - symbol: 'XCAD', - decimals: 18, - contractAddress: '0x153feaddc48871108e286de3304b9597c817b456', - coingeckoId: 'xcad-network' - }, - '0x327082dd216ff625748b13e156b9d1a5d3dd41f2': { - name: 'dXCAD Token', - symbol: 'dXCAD', - decimals: 18, - contractAddress: '0x327082dd216ff625748b13e156b9d1a5d3dd41f2' - }, - '0x818ca2e217e060ad17b7bd0124a483a1f66930a9': { - name: 'Zilliqa-bridged USDT token', - symbol: 'zUSDT', - decimals: 6, - contractAddress: '0x818ca2e217e060ad17b7bd0124a483a1f66930a9', - coingeckoId: 'tether' - }, - '0x201C44B426D85fB2c382563483140825Fd81b9b5': { - name: 'Opulous', - symbol: 'zOPUL', - decimals: 18, - contractAddress: '0x201C44B426D85fB2c382563483140825Fd81b9b5', - coingeckoId: 'opulous' - }, - '0x31bFa2054B7199F936733f9054DBCE259a3c335a': { - name: 'Lunr Token', - symbol: 'Lunr', - decimals: 4, - contractAddress: '0x31bFa2054B7199F936733f9054DBCE259a3c335a', - coingeckoId: 'lunr-token', - }, - '0x9945a0da3dc74e364da4ea96946c99336013eeb5': { - name: 'Heroes Of Lowhelm', - symbol: 'HOL', - decimals: 5, - contractAddress: '0x9945a0da3dc74e364da4ea96946c99336013eeb5' - }, - '0xbf79e16872fad92c16810ddd2a7b9b6858c7b756': { - name: 'CARBON Token', - symbol: 'CARB', - decimals: 8, - contractAddress: '0xbf79e16872fad92c16810ddd2a7b9b6858c7b756', - coingeckoId: 'carbon-labs' - }, - '0x3a683fdc022b26d755c70e9ed7cfcc446658018b': { - name: 'PackagePortal Token', - symbol: 'PORT', - decimals: 4, - contractAddress: '0x3a683fdc022b26d755c70e9ed7cfcc446658018b', - coingeckoId: 'packageportal', - }, - '0x91228A48AEA4E4071B9C6444Eb08B021399CfF7c': { - name: 'Unifees Token', - symbol: 'FEES', - decimals: 4, - contractAddress: '0x91228A48AEA4E4071B9C6444Eb08B021399CfF7c', - coingeckoId: 'unifees' - }, - '0xa3eAFd5021F6B9c36fD02Ed58aa1d015F2238791': { - name: 'ZILStream Token', - symbol: 'STREAM', - decimals: 8, - contractAddress: '0xa3eAFd5021F6B9c36fD02Ed58aa1d015F2238791', - coingeckoId: 'zilstream' - }, - '0xa845C1034CD077bD8D32be0447239c7E4be6cb21': { - name: 'Governance ZIL', - symbol: 'gZIL', - decimals: 15, - contractAddress: '0xa845C1034CD077bD8D32be0447239c7E4be6cb21', - coingeckoId: 'governance-zil' - }, - '0xb393C898b3d261C362a4987CaE5a833232AA666E': { - name: 'Score', - symbol: 'SCO', - decimals: 4, - contractAddress: '0xb393C898b3d261C362a4987CaE5a833232AA666E', - coingeckoId: 'score-token', - }, - '0x173Ca6770Aa56EB00511Dac8e6E13B3D7f16a5a5': { - name: 'XSGD', - symbol: 'XSGD', - decimals: 6, - contractAddress: '0x173Ca6770Aa56EB00511Dac8e6E13B3D7f16a5a5', - coingeckoId: 'xsgd', - }, - '0xaCb721d989c095c64A24d16DfD23b08D738e2552': { - name: 'REDChillies Token', - symbol: 'REDC', - decimals: 9, - contractAddress: '0xaCb721d989c095c64A24d16DfD23b08D738e2552', - coingeckoId: 'redchillies', - }, - '0x75fA7D8BA6BEd4a68774c758A5e43Cfb6633D9d6': { - name: 'Wrapped Bitcoin', - symbol: 'zWBTC', - decimals: 8, - contractAddress: '0x75fA7D8BA6BEd4a68774c758A5e43Cfb6633D9d6', - coingeckoId: 'bitcoin', - }, - '0x2cA315F4329654614d1E8321f9C252921192c5f2': { - name: 'Ethereum', - symbol: 'zETH', - decimals: 18, - contractAddress: '0x2cA315F4329654614d1E8321f9C252921192c5f2', - coingeckoId: 'ethereum' - }, - '0x4268C34dA6Ad41a4cDeAa25cdEF6531Ed0c9a1A2': { - name: 'BLOX', - symbol: 'BLOX', - decimals: 2, - contractAddress: '0x4268C34dA6Ad41a4cDeAa25cdEF6531Ed0c9a1A2', - coingeckoId: 'blox-token' - }, - '0x2fc7167c3Baff89E2805Aef72636ccD98eE6Bbb2': { - name: 'DeMons', - symbol: 'DMZ', - decimals: 18, - contractAddress: '0x2fc7167c3Baff89E2805Aef72636ccD98eE6Bbb2' - }, - '0x32339fa037f7ae1DfFF25e13c6451a80289D61F4': { - name: 'Brokoli', - symbol: 'zBRKL', - decimals: 18, - contractAddress: '0x32339fa037f7ae1DfFF25e13c6451a80289D61F4', - coingeckoId: 'brokoli', - }, - '0xC6Bb661eDA683BdC792b3e456A206a92cc3cB92e': { - name: 'DUCKDUCK', - symbol: 'DUCK', - decimals: 2, - contractAddress: '0xC6Bb661eDA683BdC792b3e456A206a92cc3cB92e', - coingeckoId: 'duckduck-token', - }, - '0x9bd504b1445fdb8f4a643453ec1459bb9a2f988a': { - name: 'XIDR', - symbol: 'XIDR', - decimals: 6, - contractAddress: '0x9bd504b1445fdb8f4a643453ec1459bb9a2f988a' - }, - '0x54aE64e2092749fb8d25470ffc1d4D6A19c6f2Ab': { - name: 'Okipad', - symbol: 'Oki', - decimals: 5, - contractAddress: '0x54aE64e2092749fb8d25470ffc1d4D6A19c6f2Ab' - }, - '0x083196549637fAf95C91EcCD157E60430e69E1A7': { - name: 'Sparda Wallet', - symbol: 'SPW', - decimals: 4, - contractAddress: '0x083196549637fAf95C91EcCD157E60430e69E1A7', - coingeckoId: 'sparda-wallet', - }, - '0x4306f921c982766810cf342775fd79aa2d0d0e24': { - name: 'Wrapped ZIL', - symbol: 'wZIL', - decimals: 12, - contractAddress: '0x4306f921c982766810cf342775fd79aa2d0d0e24', - coingeckoId: 'zilliqa', - }, -} - -// the sdk keys its results by lowercase `0x` hex -const TOKENS_BY_HEX = Object.fromEntries(Object.entries(TOKENS).map(([k, v]) => [k.toLowerCase(), v])) - module.exports = { getBalances, sumTokens, diff --git a/projects/helper/stakingHelper.js b/projects/helper/stakingHelper.js index e8c7f2b43cb..90346fd596d 100644 --- a/projects/helper/stakingHelper.js +++ b/projects/helper/stakingHelper.js @@ -122,21 +122,16 @@ async function nearCall(contract, method, args) { // ------------------------------------------------------------------- neo3 // NEO is staked by holding it (voting for a council candidate does not move the -// balance), so this reports the NEP-17 NEO/GAS holdings of the account. Only the -// two native assets are counted - the rest of an account's NEP-17 list is spam. -const NEO3_NATIVE = { - '0xd2a4cff31913016155e38e474a2c06d08be276cf': { id: 'gas', decimals: 8 }, - '0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5': { id: 'neo', decimals: 0 }, -} - +// balance), so this reports the NEP-17 holdings of the account; anything the coins +// server does not price (spam tokens) counts as $0. async function neo3Staked(api, owners) { for (const owner of owners) { const { result } = await post('https://mainnet1.neo.coz.io:443', { jsonrpc: '2.0', id: 1, method: 'getnep17balances', params: [owner], }) for (const { assethash, amount } of result.balance ?? []) { - const native = NEO3_NATIVE[assethash.toLowerCase()] - if (native) api.addCGToken(native.id, Number(amount) / 10 ** native.decimals) + // the coins server knows the chain as `neo`, not `neo3`, and holds decimals/pricing for NEO, GAS, ... + api.add(`neo:${assethash.toLowerCase()}`, amount, { skipChain: true }) } } } From eff0ddbfa069bb8547760db722bca3ce72c19a0e Mon Sep 17 00:00:00 2001 From: OxForged Date: Fri, 6 Nov 2026 10:21:48 -0800 Subject: [PATCH 630/988] Add PeddleSwap (V2 + V3) on Robinhood Chain, Base, Arc and Anubis (#22067) --- registries/uniswapV2.js | 8 ++++++++ registries/uniswapV3.js | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index 788b197dd19..e1b4b377e9d 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -26,6 +26,14 @@ function uniV2ExportFn(chainConfigs, options = {}) { } const uniV2Configs = { + 'peddleswap-v2': { + start: '2026-09-12', + methodology: 'Value of reserves in PeddleSwap V2 pools on Robinhood Chain, Base, Arc and Anubis, discovered from each factory. Uses the standard core-asset reserve valuation.', + robinhood: '0x5612aEAE68a31f5dD1fb995e2d47B795fEDe8779', + base: '0x0fC7E9BB0b2F84b33a16F6b985F8e99c4E104cd9', + arc: '0x4dcBA0BD291e68D9A3A64A8900C4A67Cd1B149d3', + anubi: '0x3ca4C9F740003bCd7fEbF5d4C7c2956E5860D803', + }, 'pentaswap': { pentagonchain: '0xC75C7E9352bC1475d7c308E65C0a21969DcEdEe7' }, 'bbbfi-swap-v2': { methodology: 'Value of reserves in BBBFi-owned V2 AMM pools on XDC and BSC, discovered from each factory. Uses the standard core-asset reserve valuation helper. Staked LP receipts are not added again; reward budgets and bridge reserves are excluded.', diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index dac467c6c09..4c787971887 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -3,6 +3,14 @@ const { uniV3Export } = require('../projects/helper/uniswapV3') const { buildProtocolExports } = require('./utils') const uniV3Configs = { + 'peddleswap-v3': { + start: '2026-09-12', + methodology: 'Token balances in PeddleSwap V3 pools on Robinhood Chain, Base, Arc and Anubis, discovered from factory PoolCreated events.', + robinhood: { factory: '0xd0E25fD59A18f9728E11A04a24CaF0982231cf95', fromBlock: 61044184 }, + base: { factory: '0x8f5890e843C89a7f963ecdEFF84D0900518AE106', fromBlock: 51852483 }, + arc: { factory: '0x94C0883ec4A24BD69610bdD408Fd8263119827A2', fromBlock: 23924352 }, + anubi: { factory: '0xE645978542a389697c235763DacD2eb960295656', fromBlock: 18380937 }, + }, 'bbbfi-swap-v3': { methodology: 'Token balances in BBBFi-owned V3 pools on XDC and BSC, discovered from factory PoolCreated events. Tokens retain their original chain and address for DefiLlama pricing. Staked position NFTs are not counted a second time; reward budgets and bridge reserves are excluded.', xdc: { factory: '0x5037e5B64B677311Ed5332eee7b8C766fFe24088', fromBlock: 106991944 }, From 485fe7971ac03ebeb3c0d7218e7dd910cb38d18b Mon Sep 17 00:00:00 2001 From: Dani Date: Sat, 7 Nov 2026 11:10:07 +0100 Subject: [PATCH 631/988] dexfi: support algebra integral custom deployer positions (#22070) --- projects/dexfinance-vault-v2/index.js | 37 ++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/projects/dexfinance-vault-v2/index.js b/projects/dexfinance-vault-v2/index.js index 644cd65b997..0a587bd62c9 100644 --- a/projects/dexfinance-vault-v2/index.js +++ b/projects/dexfinance-vault-v2/index.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json'); const { abi } = require("../dexfinance-vault/abi"); -const { sumTokens2, unwrapSlipstreamNFT, unwrapUniswapV3NFT } = require('../helper/unwrapLPs'); +const { sumTokens2, unwrapSlipstreamNFT, unwrapUniswapV3NFT, addUniV3LikePosition } = require('../helper/unwrapLPs'); const CONFIG = { sonic: { @@ -41,6 +41,13 @@ const GDEX_TOKEN = "0x53Cb59D32a8d08fC6D3f81454f150946A028A44d"; const STAKING_CONTRACT = "0xd7D11E2d4E8E7b65E905aa9d16E488C37195Ca62"; const POOL_ADDRESS = "0x65B6ee9CaC744D4eed9886406EAD6bc4E5681068"; +const algebraIntegralAbi = { + positions: 'function positions(uint256) view returns (uint88 nonce, address operator, address token0, address token1, address deployer, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', + poolByPair: 'function poolByPair(address, address) view returns (address)', + customPoolByPair: 'function customPoolByPair(address, address, address) view returns (address)', + globalState: 'function globalState() view returns (uint160 price, int24 tick, uint16 lastFee, uint8 pluginConfig, uint16 communityFee, bool unlocked)', +}; + const getVaults = async (api, factory) => { const vaults = await api.fetchList({ lengthAbi: abi.factory.vaultsLength, itemAbi: abi.factory.vaults, target: factory, permitFailure: true }); const farmsAll = await api.fetchList({ lengthAbi: abi.vault.farmsLength, itemAbi: abi.vault.farms, targets: vaults, groupedByInput: true, permitFailure: true }); @@ -89,6 +96,22 @@ const getChainFarms = async (api) => { return { nftFarms, tokenFarms }; }; +const unwrapAlgebraIntegralNFT = async (api, nftAddress, factory, positionIds) => { + const positions = await api.multiCall({ abi: algebraIntegralAbi.positions, target: nftAddress, calls: positionIds }); + const [defaultPools, customPools] = await Promise.all([ + api.multiCall({ abi: algebraIntegralAbi.poolByPair, target: factory, calls: positions.map(p => ({ params: [p.token0, p.token1] })) }), + api.multiCall({ abi: algebraIntegralAbi.customPoolByPair, target: factory, calls: positions.map(p => ({ params: [p.deployer, p.token0, p.token1] })) }), + ]); + const pools = positions.map((p, i) => (p.deployer === ADDRESSES.null ? defaultPools[i] : customPools[i]).toLowerCase()); + pools.forEach((pool, i) => { if (pool === ADDRESSES.null) throw new Error(`No Algebra pool for ${nftAddress} position ${positionIds[i]}`) }); + const uniquePools = [...new Set(pools)]; + const states = await api.multiCall({ abi: algebraIntegralAbi.globalState, calls: uniquePools }); + const ticks = Object.fromEntries(uniquePools.map((pool, i) => [pool, states[i].tick])); + positions.forEach(({ token0, token1, liquidity, tickLower, tickUpper }, i) => { + addUniV3LikePosition({ api, token0, token1, liquidity: +liquidity, tickLower: +tickLower, tickUpper: +tickUpper, tick: +ticks[pools[i]] }); + }); +}; + const tvl = async (api) => { if (api.timestamp && api.timestamp < CONFIG[api.chain].start) return {}; @@ -118,14 +141,18 @@ const tvl = async (api) => { // detect Slipstream and Algebra from factory const factoriesWithIndex = factoryResults.map((f, i) => f ? { target: f, idx: i } : null).filter(Boolean); - const [poolImplResults, poolByPairResults] = factoriesWithIndex.length ? await Promise.all([ + const [poolImplResults, poolByPairResults, customPoolByPairResults] = factoriesWithIndex.length ? await Promise.all([ api.multiCall({ calls: factoriesWithIndex.map(f => f.target), abi: 'address:poolImplementation', permitFailure: true }), - api.multiCall({ calls: factoriesWithIndex.map(f => ({ target: f.target, params: [ADDRESSES.null, ADDRESSES.null] })), abi: 'function poolByPair(address, address) view returns (address)', permitFailure: true }), - ]) : [[], []]; + api.multiCall({ calls: factoriesWithIndex.map(f => ({ target: f.target, params: [ADDRESSES.null, ADDRESSES.null] })), abi: algebraIntegralAbi.poolByPair, permitFailure: true }), + api.multiCall({ calls: factoriesWithIndex.map(f => ({ target: f.target, params: [ADDRESSES.null, ADDRESSES.null, ADDRESSES.null] })), abi: algebraIntegralAbi.customPoolByPair, permitFailure: true }), + ]) : [[], [], []]; const slipstreamSet = new Set(); + const algebraIntegralSet = new Set(); const algebraSet = new Set(); factoriesWithIndex.forEach((f, j) => { if (poolImplResults[j]) slipstreamSet.add(f.idx); + // Algebra Integral >= 1.2: positions() carries a deployer field + else if (customPoolByPairResults[j] !== null && customPoolByPairResults[j] !== undefined) algebraIntegralSet.add(f.idx); else if (poolByPairResults[j] !== null && poolByPairResults[j] !== undefined) algebraSet.add(f.idx); }); @@ -135,6 +162,8 @@ const tvl = async (api) => { await unwrapSlipstreamNFT({ api, nftAddress: nftAddresses[i], positionIds, isShadow: true }); } else if (slipstreamSet.has(i)) { await unwrapSlipstreamNFT({ api, nftAddress: nftAddresses[i], positionIds }); + } else if (algebraIntegralSet.has(i)) { + await unwrapAlgebraIntegralNFT(api, nftAddresses[i], factoryResults[i], positionIds); } else if (algebraSet.has(i)) { await unwrapUniswapV3NFT({ api, nftAddress: nftAddresses[i], uniV3ExtraConfig: { positionIds }, isAlgebra: true }); } else if (poolManagerResults[i]) { From 858cba1086b0faa1e25d98036e40f31eadf25dfb Mon Sep 17 00:00:00 2001 From: Dani Date: Sat, 7 Nov 2026 11:29:04 +0100 Subject: [PATCH 632/988] hanji: static etherlink market list (#22071) --- projects/hanji/index.js | 69 ++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/projects/hanji/index.js b/projects/hanji/index.js index a00b834f2b9..09fdd999cca 100644 --- a/projects/hanji/index.js +++ b/projects/hanji/index.js @@ -1,30 +1,33 @@ const { getLogs2 } = require('../helper/cache/getLogs') const config = { + // etlk RPCs cap getLogs at 500 blocks: markets and their creation block copied from factory logs, last created 2026-01-05 etlk: { - lobsConfigs: [ - { - factory: '0xfb2Ab9f52804DB8Ed602B95Adf0996aeC55ad6Df', - fromBlock: 6610800, - }, - { - factory: '0x8f9949CF3B79bBc35842110892242737Ae11488F', - fromBlock: 21922459, - }, - { - factory: '0x6d420082D455BAb7B71EE3f00502882C27c77eB7', - fromBlock: 34814595, - }, + lobs: [ + ['0xD0BC067CF877F7b76CeB331891331d9e6ACda1a7', '0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb', '0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9', 6610834], + ['0xbB6B01D94E3f6Ebae8647cB56D544f57928aB758', '0xbFc94CD2B1E55999Cfc7347a9313e88702B83d0F', '0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9', 6610835], + ['0x65eA4dD7f789C71C0f57Ed84b3BDC3062898D3CB', '0xfc24f770F94edBca6D6f885E12d4317320BcB401', '0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9', 6610836], + ['0x5aEf9c0EFF754A81A1fC98ec14e403E7C778Fece', '0xecAc9C5F704e954931349Da37F60E39f515c11c1', '0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9', 19152118], + ['0x08978fc9dE5db58461b064F3591a3A2C67F69967', '0x01F07f4d78d47A64F4C3B2b65f513f15Be6E1854', '0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9', 23002438], + ['0x7e60F9C49E14CF51F3C7B22890726042e7986686', '0xBC75197C123716CA2DA6B78116A3B2cCc7399c74', '0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9', 27988463], + ['0x6CD22a6B64Cc6Fd1D05461ccbeE43364B8335F85', '0xBC75197C123716CA2DA6B78116A3B2cCc7399c74', '0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9', 28083242], + ['0xec15d9D316745EbcEDAf37E0137678AA20FD5234', '0x79052Ab3C166D4899a1e0DD033aC3b379AF0B1fD', '0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9', 28083789], + ['0x718a121fcEb293f4098D683Fd4Bda1025e55CE85', '0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb', '0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9', 35459006], + ['0x3B604a2f552E7f3ceB32Ba2FbC6C4079Fe1A0D1c', '0xfc24f770F94edBca6D6f885E12d4317320BcB401', '0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9', 35459013], + ['0x497da674449eBA478e499b295c6B9b4DcF2ADA4c', '0xbFc94CD2B1E55999Cfc7347a9313e88702B83d0F', '0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9', 35459016], + ['0x94d717f2f0077c13B3C2C44e890E23cC78884990', '0xbFc94CD2B1E55999Cfc7347a9313e88702B83d0F', '0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb', 35459023], + ['0x81F828742cDf142198e1c64C50d42594949e2A16', '0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb', '0xfc24f770F94edBca6D6f885E12d4317320BcB401', 35459027], + ['0xED05D08414739D28E90Ec4d6f3A5D9eeB9bB6E0C', '0xecAc9C5F704e954931349Da37F60E39f515c11c1', '0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9', 35459035], + ['0x43c234E5F9a41c63Ee5b79F95E353073AC4C55D6', '0x2C03058C8AFC06713be23e58D2febC8337dbfE6A', '0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9', 35459039], + ['0xe21035DbBf168B92C52987DCd610FAc75f5a9103', '0xecAc9C5F704e954931349Da37F60E39f515c11c1', '0xbFc94CD2B1E55999Cfc7347a9313e88702B83d0F', 35459046], ], - vaultConfigs: [ - { - factory: '0x0A3AA8f23c2125E91292b5F2b1F7b154a3FB1582', - fromBlock: 7059590, - }, - { - factory: '0x60910fc3021bf8B5EFb7dC5EFE0fa73Df907F9c5', - fromBlock: 34814649, - }, + lpManagers: [ + ['0x4C911bf7A008C497719CBEb1a376f1cEc9e2c1d6', 7059597], + ['0x4f2210992209Ad0aB0c8644547Bf0379B96Ed1F4', 13455521], + ['0xEc24EAd8022190509992275559b57e7ED3C95E66', 13515321], + ['0xB8e5e6519277BF3C961684b47313A3553cb0dD46', 13515560], + ['0xB50221737075e28f44123A5bb89eaEA285722318', 13515944], + ['0xB99334d510BC5c7B058c1f454CC1EbDB07C444f0', 35459055], ], }, base: { @@ -62,21 +65,23 @@ const createdVaultEventAbi = "event LPManagerCreated(address indexed creator, ad Object.keys(config).forEach(chain => { module.exports[chain] = { tvl: async (api) => { - const chainConfig = config[chain]; - const ownerTokens = []; - for (const { factory, fromBlock } of chainConfig.lobsConfigs) { + const { lobs = [], lpManagers: staticLpManagers = [], lobsConfigs = [], vaultConfigs = [] } = config[chain]; + const block = await api.getBlock(); + const ownerTokens = lobs.filter(([, , , createdAt]) => createdAt <= block).map(([lob, tokenX, tokenY]) => [[tokenX, tokenY], lob]); + for (const { factory, fromBlock } of lobsConfigs) { const lobCreatedLogs = await getLogs2({ api, factory, eventAbi: createdLOBEventAbi, fromBlock, }) ownerTokens.push(...lobCreatedLogs.map(log => [[log.tokenXAddress, log.tokenYAddress], log.OnchainCLOB])) } - for (const { factory, fromBlock } of chainConfig.vaultConfigs) { + const lpManagers = staticLpManagers.filter(([, createdAt]) => createdAt <= block).map(([lpManager]) => lpManager); + for (const { factory, fromBlock } of vaultConfigs) { const vaultCreatedLogs = await getLogs2({ api, factory, eventAbi: createdVaultEventAbi, fromBlock, }) - const lpManagers = vaultCreatedLogs.map(log => log.lpManager); - const tokenInfos = await api.fetchList({ lengthAbi: 'getTokensCount', itemAbi: "function tokens(uint256) view returns (address tokenAddress, bool isActive, uint16 targetWeight, uint16 lowerBoundWeight, uint16 upperBoundWeight, uint8 decimals, uint24 oracleConfRel, bytes32 oraclePriceId)", calls: lpManagers, groupedByInput: true, }) - lpManagers.forEach((lpManager, i) => { - const tokens = tokenInfos[i].map(i => i.tokenAddress) - ownerTokens.push([tokens, lpManager]) - }) + lpManagers.push(...vaultCreatedLogs.map(log => log.lpManager)); } + const tokenInfos = await api.fetchList({ lengthAbi: 'getTokensCount', itemAbi: "function tokens(uint256) view returns (address tokenAddress, bool isActive, uint16 targetWeight, uint16 lowerBoundWeight, uint16 upperBoundWeight, uint8 decimals, uint24 oracleConfRel, bytes32 oraclePriceId)", calls: lpManagers, groupedByInput: true, }) + lpManagers.forEach((lpManager, i) => { + const tokens = tokenInfos[i].map(i => i.tokenAddress) + ownerTokens.push([tokens, lpManager]) + }) return api.sumTokens({ ownerTokens }) } } }); From d7a05f815140dc6994f56a0453e956732b744625 Mon Sep 17 00:00:00 2001 From: Dani Date: Sat, 7 Nov 2026 11:30:33 +0100 Subject: [PATCH 633/988] rujira: read map-form fin market makers (#22072) --- projects/helper/rujira/fin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/helper/rujira/fin.js b/projects/helper/rujira/fin.js index c14adf33f0a..f4544e3670c 100644 --- a/projects/helper/rujira/fin.js +++ b/projects/helper/rujira/fin.js @@ -18,9 +18,11 @@ async function getFinConfig(address, height) { const stored = await queryRawContractState(address, 'config', height) if (!stored) throw new Error(`Missing FIN config state for ${address} at ${height}`) const config = JSON.parse(stored.toString()) - const marketMakers = Array.isArray(config.market_makers) + const makers = Array.isArray(config.market_makers) ? config.market_makers : config.market_makers?.contracts || [] + // FIN 2.2.2 can store contracts as an address-keyed map of maker settings. + const marketMakers = Array.isArray(makers) ? makers : Object.keys(makers) return { ...config, market_makers: marketMakers } } From 73f37a5ac3f27892badc5deb5bcf314f36597129 Mon Sep 17 00:00:00 2001 From: Dani Date: Sat, 7 Nov 2026 15:44:38 +0100 Subject: [PATCH 634/988] maple: read collateral, pool cash and principal on-chain (#22074) --- projects/maple/index.js | 270 ++++++++++++++++------------------------ 1 file changed, 108 insertions(+), 162 deletions(-) diff --git a/projects/maple/index.js b/projects/maple/index.js index d112f0b3c90..cf91b3cbdd7 100644 --- a/projects/maple/index.js +++ b/projects/maple/index.js @@ -1,179 +1,125 @@ -/** - * Maple Finance TVL & Borrowed Amounts Adapter - * - * This adapter fetches data from Maple Finance's GraphQL API to calculate: - * - Total Value Locked (TVL): Pool cash and cash in DeFi strategies on Ethereum, plus loan - * collateral booked on the chain it is actually custodied on (BTC on bitcoin, XRP on ripple, ...) - * - Total Borrowed: Sum of all principal out (active loans) - * - Total Staking: Sum of all staked assets in stSYRUP ERC-4626 vault - * - * - * References: - * - Maple Finance API Docs: https://studio.apollographql.com/public/maple-api/variant/mainnet/home - * - */ - -const ADDRESSES = require('../helper/coreAssets.json'); -const sdk = require('@defillama/sdk'); -const axios = require('axios'); - -const stSYRUP = "0xc7E8b36E0766D9B04c93De68A9D47dD11f260B45"; - -const POOL_V2_START_BLOCK = 16186377; -const STAKING_START_BLOCK = 20735662; - -// Loans are issued from Ethereum pools but the collateral is custodied natively, so each -// collateral asset is credited to its own chain instead of the pool's chain -const COLLATERALS = { - BTC: { chain: 'bitcoin', cgId: 'bitcoin' }, - XRP: { chain: 'ripple', token: ADDRESSES.ripple.XRP }, - HYPE: { chain: 'hyperliquid', cgId: 'hyperliquid' }, - SOL: { chain: 'solana', token: ADDRESSES.solana.SOL }, - jitoSOL: { chain: 'solana', token: ADDRESSES.solana.JitoSOL }, - ETH: { chain: 'ethereum', token: ADDRESSES.null }, - WBTC: { chain: 'ethereum', token: ADDRESSES.ethereum.WBTC }, - LBTC: { chain: 'ethereum', token: ADDRESSES.ethereum.LBTC }, - cbBTC: { chain: 'ethereum', token: ADDRESSES.ethereum.cbBTC }, - sUSDS: { chain: 'ethereum', token: ADDRESSES.ethereum.sUSDS }, - USDG: { chain: 'ethereum', token: ADDRESSES.ethereum.USDG }, - USDC: { chain: 'ethereum', token: ADDRESSES.ethereum.USDC }, - USDT: { chain: 'ethereum', token: ADDRESSES.ethereum.USDT }, - USTB: { chain: 'ethereum', token: '0x43415eB6ff9DB7E26A15b704e7A3eDCe97d31C4e' }, - USDtb: { chain: 'ethereum', token: '0xC139190F447e929f090Edeb554D95AbB8b18aC1C' }, - weETH: { chain: 'ethereum', token: ADDRESSES.ethereum.WEETH }, - tETH: { chain: 'ethereum', token: '0xD11c452fc99cF405034ee446803b6F6c1F6d5ED8' }, - USR: { chain: 'ethereum', token: '0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110' }, - ATH: { chain: 'ethereum', token: '0xbe0Ed4138121EcFC5c0E56B40517da27E6c5226B' }, -}; - -const ENDPOINT = "https://api.maple.finance/v2/graphql"; -const POOLS_QUERY = ` - query example($block: Block_height) { - poolV2S(block: $block) { - name - collateralValue - principalOut - strategiesDeployed - assets - asset { - symbol - } - poolMeta { - poolCollaterals { - assetSymbol - assetDecimals - assetAmount - } - } - } +const ADDRESSES = require('../helper/coreAssets.json') +const { getConfig } = require('../helper/cache') +const { post } = require('../helper/http') +const { sumTokens } = require('../helper/sumTokens') + +const stSYRUP = '0xc7E8b36E0766D9B04c93De68A9D47dD11f260B45' +const PYUSD = '0x6c3ea9036406852006290770BEdFcAbA0e23A0e8' +// fixed-term and open-term loan manager factories, every other pool strategy deploys idle cash +const LOAN_MANAGER_FACTORIES = ['0x1551717AE4FdCB65ed028F7fB7abA39908f6A7A6', '0x90b14505221a24039A2D11Ad5862339db97Cc160'].map(a => a.toLowerCase()) + +const POOLS_QUERY = `{ + poolV2S(first: 1000) { + id + name + collateralValue + asset { id } + poolManager { id } + loanManager { id } + openTermLoanManager { id } + poolMeta { poolCollaterals { addresses asset blockchain assetAmount } } } -`; - -// every chain's tvl needs the same snapshot, keyed by run timestamp so only one request is made -const poolCache = {}; +}` -/** - * Fetches pool data from Maple Finance's GraphQL API, at the Ethereum block of the current run - * @param {Object} api DefiLlama SDK api object - * @returns {Promise}}>>} Array of pool objects - */ -const getPools = async (api) => { - const key = api.timestamp ?? 'latest'; - if (!poolCache[key]) poolCache[key] = fetchPools(api); - return poolCache[key]; -}; +// keyed by poolCollaterals `blockchain:asset`, tokens are only needed on EVM chains +const COLLATERALS = { + 'Bitcoin:BTC': { chain: 'bitcoin' }, + 'XRP:XRP': { chain: 'ripple' }, + // ETH collateral is also held as wstETH at the custody addresses + 'Ethereum:ETH': { chain: 'ethereum', tokens: [ADDRESSES.null, ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.STETH, ADDRESSES.ethereum.WSTETH] }, + // USDC collateral is also held as PYUSD at the custody addresses + 'Ethereum:USDC': { chain: 'ethereum', tokens: [ADDRESSES.ethereum.USDC, PYUSD] }, + 'Ethereum:WBTC': { chain: 'ethereum', tokens: [ADDRESSES.ethereum.WBTC] }, + 'Ethereum:cbBTC': { chain: 'ethereum', tokens: [ADDRESSES.ethereum.cbBTC] }, + 'Ethereum:LBTC': { chain: 'ethereum', tokens: [ADDRESSES.ethereum.LBTC] }, + 'Ethereum:USDT': { chain: 'ethereum', tokens: [ADDRESSES.ethereum.USDT] }, + 'Ethereum:USDG': { chain: 'ethereum', tokens: [ADDRESSES.ethereum.USDG] }, + 'Ethereum:sUSDS': { chain: 'ethereum', tokens: [ADDRESSES.ethereum.sUSDS] }, + 'Ethereum:USTB': { chain: 'ethereum', tokens: ['0x43415eB6ff9DB7E26A15b704e7A3eDCe97d31C4e'] }, + 'Ethereum:USDtb': { chain: 'ethereum', tokens: ['0xC139190F447e929f090Edeb554D95AbB8b18aC1C'] }, + 'Ethereum:weETH': { chain: 'ethereum', tokens: [ADDRESSES.ethereum.WEETH] }, + 'Ethereum:tETH': { chain: 'ethereum', tokens: ['0xD11c452fc99cF405034ee446803b6F6c1F6d5ED8'] }, + 'Ethereum:USR': { chain: 'ethereum', tokens: ['0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110'] }, + 'Ethereum:ATH': { chain: 'ethereum', tokens: ['0xbe0Ed4138121EcFC5c0E56B40517da27E6c5226B'] }, +} -const fetchPools = async (api) => { - const ethApi = api.chain === 'ethereum' ? api : new sdk.ChainApi({ chain: 'ethereum', timestamp: api.timestamp }); - const block = await ethApi.getBlock(); +async function getPools() { + const { poolV2S: pools } = await getConfig('maple/pools-v2', undefined, { + fetcher: async () => { + const { data, errors } = await post('https://api.maple.finance/v2/graphql', { query: POOLS_QUERY }) + if (errors?.length || !data?.poolV2S?.length) throw new Error('Maple: invalid poolV2S response') + return data + }, + }) + if (!pools?.length) throw new Error('Maple: no pools') + return pools +} - if (block < POOL_V2_START_BLOCK) { - sdk.log('Maple: impossible to backfill - the queried block is earlier than the deployment block of poolsV2'); - return []; +// custody addresses of the collateral currently backing loans, grouped by chain +async function getCollateralOwners() { + const pools = await getPools() + const owners = {} + for (const { name, collateralValue, poolMeta } of pools) { + const lines = (poolMeta?.poolCollaterals ?? []).filter(c => Number(c.assetAmount) > 0) + if (!lines.length && Number(collateralValue) > 0) throw new Error(`Maple: pool ${name} reports collateral but lists none`) + for (const { blockchain, asset, addresses } of lines) { + const collateral = COLLATERALS[`${blockchain}:${asset}`] + if (!collateral) throw new Error(`Maple: unmapped collateral ${asset} on ${blockchain}`) + if (!addresses?.length) throw new Error(`Maple: ${asset} collateral on ${blockchain} has no custody address`) + owners[collateral.chain] ??= [] + for (const owner of addresses) for (const token of collateral.tokens ?? [null]) owners[collateral.chain].push([token, owner]) + } } + return owners +} - const payload = { query: POOLS_QUERY, variables: { block: { number: block - 10 } } }; - const { data } = await axios.post(ENDPOINT, payload); - return data.data.poolV2S; -}; - -/** - * Adds the loan collateral that is custodied on the given chain - * @param {Object} api DefiLlama SDK api object - * @param {Array} pools Pools returned by getPools - */ -const addCollateral = (api, pools) => { - pools.forEach(({ name, collateralValue, poolMeta }) => { - const collaterals = (poolMeta?.poolCollaterals ?? []).filter(({ assetAmount }) => Number(assetAmount) > 0); - // a pool that reports collateral but lists none would silently drop out of tvl - if (!collaterals.length && Number(collateralValue) > 0) throw new Error(`Maple: pool ${name} reports collateral but lists no collateral assets`); - collaterals.forEach(({ assetSymbol, assetDecimals, assetAmount }) => { - const collateral = COLLATERALS[assetSymbol]; - if (!collateral) throw new Error(`Maple: unmapped collateral asset ${assetSymbol} in pool ${name}`); - if (collateral.chain !== api.chain) return; - if (collateral.cgId) api.addCGToken(collateral.cgId, Number(assetAmount) / 10 ** assetDecimals); - else api.add(collateral.token, assetAmount); // Maple reports the amount in the token's own decimals - }); - }); -}; - -/** - * Pool cash plus cash deployed in DeFi strategies, both denominated in the pool asset - * @param {Object} api DefiLlama SDK api object - */ -const addPoolCash = (api, pools) => { - pools.forEach(({ asset: { symbol }, assets, strategiesDeployed }) => { - const token = ADDRESSES.ethereum[symbol] ?? null; - if (!token) return; - api.add(token, Number(assets) + Number(strategiesDeployed)); - }); -}; +async function addStrategyCash(api, pools) { + // pool managers that predate strategies have no strategy list + const lengths = await api.multiCall({ abi: 'uint256:strategyListLength', calls: pools.map(p => p.poolManager.id), permitFailure: true }) + const calls = pools.flatMap((p, i) => Array.from({ length: Number(lengths[i] ?? 0) }, (_, j) => ({ target: p.poolManager.id, params: [j], asset: p.asset.id }))) + const strategies = await api.multiCall({ abi: 'function strategyList(uint256) view returns (address)', calls: calls.map(({ target, params }) => ({ target, params })) }) + const factories = await api.multiCall({ abi: 'address:factory', calls: strategies }) + // a strategy holds idle cash unless it is a listed loan manager or comes from a loan manager factory + const loanManagers = new Set(pools.flatMap(p => [p.loanManager?.id, p.openTermLoanManager?.id]).filter(Boolean).map(a => a.toLowerCase())) + const cashStrategies = strategies.map((target, i) => ({ target, asset: calls[i].asset })).filter((s, i) => !loanManagers.has(s.target.toLowerCase()) && !LOAN_MANAGER_FACTORIES.includes(factories[i].toLowerCase())) + const aum = await api.multiCall({ abi: 'uint256:assetsUnderManagement', calls: cashStrategies.map(s => s.target) }) + api.addTokens(cashStrategies.map(s => s.asset), aum) +} -const ethereumTvl = async (api) => { - const pools = await getPools(api); - addPoolCash(api, pools); - addCollateral(api, pools); -}; +async function ethereumTvl(api) { + const pools = await getPools() + const { ethereum = [] } = await getCollateralOwners() + await addStrategyCash(api, pools) + return api.sumTokens({ tokensAndOwners: [...pools.map(p => [p.asset.id, p.id]), ...ethereum] }) +} -const collateralTvl = async (api) => { - addCollateral(api, await getPools(api)); -}; +const collateralTvl = (chain) => async (api) => { + const owners = (await getCollateralOwners())[chain] ?? [] + return sumTokens({ api, owners: owners.map(([, owner]) => owner), timestamp: api.timestamp }) +} -const borrowed = async (api) => { - const pools = await getPools(api); - pools.forEach(({ asset: { symbol }, principalOut }) => { - const token = ADDRESSES.ethereum[symbol] ?? null; - if (!token) return; - api.add(token, Number(principalOut)); - }); -}; +async function borrowed(api) { + const loanManagers = {} + for (const p of await getPools()) + for (const lm of [p.loanManager, p.openTermLoanManager]) if (lm) loanManagers[lm.id.toLowerCase()] = p.asset.id + const principal = await api.multiCall({ abi: 'uint256:principalOut', calls: Object.keys(loanManagers) }) + api.addTokens(Object.values(loanManagers), principal) +} -/** - * Calculates total staked value in Maple's stSYRUP ERC-4626 vault - * @param {Object} api DefiLlama SDK api object - * @returns {Promise} Total staked value in USD - */ -const staking = async (api) => { - const block = await api.getBlock() - if (block < STAKING_START_BLOCK) return; +async function staking(api) { return api.erc4626Sum({ calls: [stSYRUP], tokenAbi: 'address:asset', balanceAbi: 'uint256:totalAssets' }) } module.exports = { - hallmarks: [['2022-12-14', 'V2 Deployment']], - // poolMeta.poolCollaterals is not block scoped - the API returns the current collateral for any - // block, so backfilling would rewrite history with today's holdings + methodology: 'TVL is the cash held by Maple pools on Ethereum, including cash deployed to yield strategies, plus borrower collateral: the balances of the collateral tokens at the custody addresses Maple publishes for each pool, read on the chain where they are held (BTC on Bitcoin, XRP on the XRP Ledger, ETH, wstETH, PYUSD and other tokens on Ethereum). Collateral Maple reports that is not held at those addresses is not counted. Borrowed is the principal outstanding in the pools\' loan managers. Staking is SYRUP deposited in stSYRUP.', + // custody addresses are only published for current loans timetravel: false, doublecounted: true, // we are counting collateral on other chains like bitcoin, these are not smart contracts, so should not be treated as defi tvl. - methodology: 'TVL is pool cash and cash deployed in DeFi strategies on Ethereum, plus the loan collateral reported by the Maple API, each collateral asset counted on the chain it is custodied on. Borrowed is the principal outstanding on active loans, staking is the assets held in the stSYRUP vault.', - ethereum: { - tvl: ethereumTvl, - borrowed, - staking - }, -}; + hallmarks: [['2022-12-14', 'V2 Deployment']], + ethereum: { tvl: ethereumTvl, borrowed, staking }, + hyperliquid: { tvl: () => ({}) }, + solana: { tvl: () => ({}) }, +} -// derived from COLLATERALS so a newly mapped chain cannot be silently dropped for want of an export -Object.values(COLLATERALS).forEach(({ chain }) => { - if (chain !== 'ethereum' && !module.exports[chain]) module.exports[chain] = { tvl: collateralTvl }; -}); +// every non-EVM collateral chain gets an export, so a newly mapped chain cannot be dropped silently +for (const { chain, tokens } of Object.values(COLLATERALS)) if (!tokens) module.exports[chain] = { tvl: collateralTvl(chain) } From 716037f6338635328ed84aeed6e4a69d12009c7d Mon Sep 17 00:00:00 2001 From: Richard Crites Date: Sun, 8 Nov 2026 06:47:40 -0500 Subject: [PATCH 635/988] omnibazaar: add OmniCoin L1 (#22077) Co-authored-by: Rick Crites Co-authored-by: FelixBruguera --- projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 6 ++++++ registries/sumTokens.js | 21 ++++++++++++++++----- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 20b9ed668ef..247f30d5462 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -538,6 +538,7 @@ "xion", "xlayer", "xo", + "xom", "xone", "xp", "xpla", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 5427e43898f..dd61e10b9e0 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -42,6 +42,12 @@ const ibcMappings = { } const fixBalancesTokens = { + // OmniCoin L1 (chain 88008): USDC arrives as an ICTT ERC20TokenRemote minted + // 1:1 against collateral on Avalanche; the coins service has no price for the + // bridged address on this chain. + xom: { + '0x81f4072fcca24d373ffcb34c248995dfc6c1219c': { coingeckoId: 'usd-coin', decimals: 6 }, + }, provenance: { 'ueurc.figure.se': { coingeckoId: 'euro-coin', decimals: 6 }, 'pm.pool.asset.3hjz8rcr3pejdc3msntlvy': { coingeckoId: 'usd-coin', decimals: 0 }, diff --git a/registries/sumTokens.js b/registries/sumTokens.js index b44c806d164..b929595b2dc 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -21030,7 +21030,7 @@ const configs = { }, }, "omnibazaar": { - "methodology": "Pool2: XOM/USDC AMM LP tokens staked in the LiquidityOverflowPool contract on each chain, resolved to underlying XOM + USDC reserves.", + "methodology": "Pool2: XOM/USDC AMM LP tokens staked in the LiquidityOverflowPool contract on Ethereum, Arbitrum, Base, Polygon and OmniCoin L1, resolved to underlying XOM + USDC reserves. XOM has no market price yet, so only the USDC side is valued.", "ethereum": { "tvl": { "__empty": true @@ -21042,24 +21042,24 @@ const configs = { "resolveLP": true } }, - "base": { + "arbitrum": { "tvl": { "__empty": true }, "pool2": { "tokensAndOwners": [ - ["0x8Bf4142F6C1B3F9938390658E1a73CC49139e336", "0xdB993473060739a523c5c3fdDCf8705BaF84a1DF"] + ["0xb9b602d51e411cf9D65bD2CFF0528Fe8B8f484b2", "0x9D4C97BF6C8064D32e8Fa9DEC5364ff2dC01aB7f"] ], "resolveLP": true } }, - "arbitrum": { + "base": { "tvl": { "__empty": true }, "pool2": { "tokensAndOwners": [ - ["0xb9b602d51e411cf9D65bD2CFF0528Fe8B8f484b2", "0x9D4C97BF6C8064D32e8Fa9DEC5364ff2dC01aB7f"] + ["0x8Bf4142F6C1B3F9938390658E1a73CC49139e336", "0xdB993473060739a523c5c3fdDCf8705BaF84a1DF"] ], "resolveLP": true } @@ -21075,6 +21075,17 @@ const configs = { "resolveLP": true } }, + "xom": { + "tvl": { + "__empty": true + }, + "pool2": { + "tokensAndOwners": [ + ["0xc2aab143574099d7420A7a4cE4dc6c91a2a0fDf5", "0x3e3FB3416236fCab0dB9A45171c5532Aff665EC8"] + ], + "resolveLP": true + } + } }, "onc": { "methodology": "Gets TVL inside the ONC Treasury.", From a11bc678372e43da6abfcaa509830d44a6d638e2 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Sun, 8 Nov 2026 08:02:09 -0400 Subject: [PATCH 636/988] Add Bitty vaults (#22085) Co-authored-by: andy.chan Co-authored-by: Claude Opus 5.5 --- projects/bitty-vaults/index.js | 147 +++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 projects/bitty-vaults/index.js diff --git a/projects/bitty-vaults/index.js b/projects/bitty-vaults/index.js new file mode 100644 index 00000000000..16874148c6f --- /dev/null +++ b/projects/bitty-vaults/index.js @@ -0,0 +1,147 @@ +// Bitty: self-custody smart vaults. An owner's vault holds its own funds; an asset manager or AI agent +// can trade them and put them to work in whitelisted protocols (Aave, Lido, Sky), never withdraw them. +// The earlier Bitty lending markets are retired. +// +// TVL is what the vaults hold: every vault the factory has activated (one CREATE2 address per chain), +// its native ETH plus the guard-listed assets, plus the receipt tokens of its protocol positions +// (Aave aTokens, Lido stETH, Sky sUSDS). Those positions are also counted by the protocols +// themselves, hence doublecounted. Bitty's own fee vault is protocol revenue, not deposits, and is +// left out. +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const FACTORY = '0x3d7Ed3cD011B423dd11BE280BF926667CAf0F120' +const FEE_VAULT = '0xf0e7f6998b362bd15cf819c7ebfcace8865feca0' +const VAULT_ACTIVATED = 'event VaultActivated(address indexed owner, address vault)' + +const config = { + ethereum: { + fromBlock: 26223315, + tokens: [ + '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH + '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', // WBTC + '0x68749665ff8d2d112fa859aa293f07a622782f38', // XAUt + '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', // UNI + '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9', // AAVE + '0xdef1ca1fb7fbcdc777520aa7f396b4e015f497ab', // COW + '0x56072c95faa701256059aa122697b133aded9279', // SKY + '0x514910771af9ca656af840dff83e8264ecf986ca', // LINK + '0x9994e35db50125e0df82e4c2dde62496ce330999', // MORPHO + '0xb50721bcf8d664c30412cfbc6cf7a15145234ad1', // ARB + '0x57e114b691db790c35207b2e685d4a43181e6061', // ENA + '0x5a98fcbea516cf06857215779fd812ca3bef1b32', // LDO + '0x6982508145454ce325ddbe47a25d4ec3d2311933', // PEPE + // Tokenized stocks and ETFs + '0x3632dea96a953c11dac2f00b4a05a32cd1063fae', // CRCL + '0xf042cfa86cf1d598a75bdb55c3507a1f39f9493b', // COIN + '0xfdb46864a7c476f0914c5e82cded3364a9f56f8a', // SBET + '0x14c3abf95cb9c93a8b82c1cdcb76d72cb87b2d4c', // AAPL + '0xb812837b81a3a6b81d7cd74cfb19a7f2784555e5', // MSFT + '0xba47214edd2bb43099611b208f75e4b42fdcfedc', // GOOGL + '0xbb8774fb97436d23d74c1b882e8e9a69322cfd31', // AMZN + '0x2d1f7226bd1f780af6b9a49dcc0ae00e8df4bdee', // NVDA + '0x59644165402b611b350645555b50afb581c71eb2', // META + '0xf6b1117ec07684d3958cad8beb1b302bfd21103f', // TSLA + '0x0c666485b02f7a87d21add7aeb9f5e64975aa490', // PLTR + '0x0c1f3412a44ff99e40bf14e06e5ea321ae7b3938', // AMD + '0x3cafdbfe682aec17d5ace2f97a2f3ab3dcf6a4a9', // TSM + '0xfda09936dbd717368de0835ba441d9e62069d36f', // INTC + '0x0e397938c1aa0680954093495b70a9f5e2249aba', // QQQ + '0xc9eef266834730340a55b6cc24621b31baf55581', // SPCX + '0x032dec3372f25c41ea8054b4987a7c4832cdb338', // NFLX + '0x998f02a9e343ef6e3e6f28700d5a20f839fd74e6', // HOOD + '0xcabd955322dfbf94c084929ac5e9eca3feb5556f', // MSTR + '0x33483a58079b4225b10e57958ca28ad7b9cdbaf7', // BMNR + '0x71e2400cf1cb83204f33794ed326636a71a9aafc', // SNDK + '0x0c8276e4fec072cf7854be69c70f7773d1610857', // COST + // Stablecoins + '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC + '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT + // Position receipt tokens + '0xa3931d71877c0e7a3148cb7eb4463524fec27fbd', // sUSDS + '0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c', // aEthUSDC + '0x23878914efe38d27c4d67ab83ed1b93a74d4086a', // aEthUSDT + '0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8', // aEthWETH + '0x5ee5bf7ae06d1be5997a1a72006fe6c607ec6de8', // aEthWBTC + '0xae7ab96520de3a18e5e111b5eaab095312d7fe84', // stETH + ], + }, + base: { + fromBlock: 52767463, + tokens: [ + '0x4200000000000000000000000000000000000006', // WETH + '0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf', // cbBTC + '0xb20000000000000000000078ee7ce2fe4908108c', // NVDA + '0xb2000000000000000000008bc8786b856e61707c', // META + '0xb2000000000000000000002d0ba3164cc74f58b7', // GOOGL + '0xb2000000000000000000004884b426556b92883d', // MSTR + '0xb200000000000000000000c2e324d24d7eecd1fb', // AAPL + '0xb2000000000000000000001e800a7f5189430cd0', // TSLA + '0xb200000000000000000000d9192b6b456483c2e8', // AMZN + '0xb2000000000000000000007d16372840df4dabbe', // PLTR + '0xb2000000000000000000007b9fcbd005511acbd5', // SPCX + '0xb200000000000000000000ab99cfa739e253872b', // MSFT + '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', // USDC + '0xfde4c96c8593536e31f229ea8f37b2ada2699bb2', // USDT + '0x5875eee11cf8398102fdad704c9e96607675467a', // sUSDS + '0x4e65fe4dba92790696d040ac24aa414708f5c0ab', // aBasUSDC + '0xd4a0e0b9149bcee3c920d2e00b5de09138fd8bb7', // aBasWETH + '0xbdb9300b7cde636d9cd4aff00f6f009ffbbc8ee6', // aBascbBTC + ], + }, + arbitrum: { + fromBlock: 516133264, + tokens: [ + '0x82af49447d8a07e3bd95bd0d56f35241523fbab1', // WETH + '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f', // WBTC + '0x25d887ce7a35172c62febfd67a1856f20faebb00', // PEPE + '0xaf88d065e77c8cc2239327c5edb3a432268e5831', // USDC + '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9', // USDT + '0xddb46999f8891663a8f2828d25298f70416d7610', // sUSDS + '0x724dc807b04555b71ed48a6896b6f41593b8c637', // aArbUSDCn + '0x6ab707aca953edaefbc4fd23ba73294241490620', // aArbUSDT + '0xe50fa9b3c56ffb159cb0fca61f5c9d750e8128c8', // aArbWETH + '0x078f358208685046a11c85e8ad32895ded33a249', // aArbWBTC + ], + }, + robinhood: { + fromBlock: 92228495, + tokens: [ + '0x0bd7d308f8e1639fab988df18a8011f41eacad73', // WETH + '0xcec185eb182c47d1ba1efc84e6959e18cd620be4', // cbBTC + '0xf177d86a28b520e3e396e4f3b96cd8e72d7dabd8', // UNI + '0x117cc2133c37b721f49de2a7a74833232b3b4c0c', // SPY + '0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec', // NVDA + '0xc9a981fee1f9dec688bb123ccdecc63d0debfc4e', // GLD + '0x4a0e65a3eccec6dbe60ae065f2e7bb85fae35eea', // SPCX + '0xc0d6457c16cc70d6790dd43521c899c87ce02f35', // META + '0x2e0847e8910a9732eb3fb1bb4b70a580adad4fe3', // GOOGL + '0xaf3d76f1834a1d425780943c99ea8a608f8a93f9', // AAPL + '0xccee82fe024c36fa15e1005ede3e9e4787e23d09', // HIMS + '0xec262a75e413fafd0df80480274532c79d42da09', // MSTR + '0x322f0929c4625ed5bad873c95208d54e1c003b2d', // TSLA + '0xe93237c50d904957cf27e7b1133b510c669c2e74', // MSFT + '0x12f190a9f9d7d37a250758b26824b97ce941bf54', // AMZN + '0xdf0992e440dd0be65bd8439b609d6d4366bf1cb5', // CRCL + '0x4ea005168d7f09a7a0ba9d1def21a479950e44c2', // COST + '0xc72b96e0e48ecd4dc75e1e45396e26300bc39681', // INTC + '0x5fc5360d0400a0fd4f2af552add042d716f1d168', // USDG + ], + }, +} + +async function tvl(api) { + const { fromBlock, tokens } = config[api.chain] + const logs = await getLogs({ api, target: FACTORY, eventAbi: VAULT_ACTIVATED, onlyArgs: true, fromBlock }) + const owners = [...new Set(logs.map((l) => l.vault.toLowerCase()))].filter((v) => v !== FEE_VAULT) + return sumTokens2({ api, owners, tokens: [nullAddress, ...tokens] }) +} + +module.exports = { + methodology: 'Counts the native ETH and the tokens held by every Bitty vault the factory has activated, including the receipt tokens of positions a vault opened through Bitty (Aave aTokens, Lido stETH, Sky sUSDS). Bitty\'s own fee vault is excluded.', + doublecounted: true, +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl } +}) From 89f49651bdbe8d9828ce198afaad23e12308a7aa Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sun, 8 Nov 2026 12:04:44 -0600 Subject: [PATCH 637/988] mew-fi: track MEOW staking at new ergo contract (#22087) Co-authored-by: Claude Opus 5.5 --- registries/sumTokens.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index b929595b2dc..040c37ea7f9 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -18284,7 +18284,10 @@ const configs = { "__empty": true }, "staking": { - "owner": "2Czxg7U54ZyGMzjt35EYX9g98H9UjFqteuYWX5CSgGCYWAjg1ng2jgm4BHjA6u1Azeo7EYQsBMVLbhRreNASJu54ho" + "owner": "2Czxg7U54ZzDcguzu4zt6SEfu9oUm4t5MH7Qsdt5pmVrbqqR9U1hwxSdpnzJ2Vo9EnSNtvVyYmcTzQWFtSVa8zh4Cp", + "tokens": [ + "d4f0192622b440afc09711aa0545eacd04d78ad3f8a063523f451e10d3d0e6ef" + ] } }, }, From dcbff025ec1a4e8c7463e5a0cc2b586b24718fe5 Mon Sep 17 00:00:00 2001 From: Vet <109047316+xVet@users.noreply.github.com> Date: Mon, 9 Nov 2026 09:24:41 +0100 Subject: [PATCH 638/988] flare-asset: count XRP in FXRP agent addresses, read agents and core vault on-chain (#22092) --- projects/flare-asset/index.js | 111 +++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 49 deletions(-) diff --git a/projects/flare-asset/index.js b/projects/flare-asset/index.js index c5fa928e6b8..6b5dc2ad26f 100644 --- a/projects/flare-asset/index.js +++ b/projects/flare-asset/index.js @@ -1,63 +1,76 @@ +const sdk = require('@defillama/sdk') const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') -const { sumTokens } = require('../helper/sumTokens'); -const { post } = require('../helper/http') - -const agentVaults = [ - '0xe56f464c23760d563dd4c73dADA05159aE71FC50', // Au - '0xA69bF2eC0eF91A29B5da634BD4958AA32BaD9fe3', // Bifrost - '0x7CeC6EC27F3A0f0a37B1847E5Af3E99A7499A0bC', // Atlas - '0x0F6AB40fE44aA3AB15B8ff96Df98C6F5865F048E', // NORTSO - '0x8eA74D78A03F20597cEE115176f7f8b65271c87A', // OD - '0x09011d2A11A40DB855Cb00B3AA5a0F5F3bd485FD', // WK -] - -const agentPools = [ - '0xf45c1a5Ef4fB09F1c33f772175b2fec229D1885B', // Au - '0x3A06584A47972fF7005301b5A44c7D2214A4d3b4', // Bifrost - '0x0e647177Df92A75e16D4043EE4bbA9CcCae874A6', // Atlas - '0xd6af7ef36732A5A71121363bE380AB6C8e9F72e0', // NORTSO - '0x71eE56f6B793386cECf536CD566ff50FE558f70E', // OD - '0xa7F4335e5233C50e1022c2607dfE83c3d73d516B', // WK -] - -const coreVault = "rfkXSaCZKTg1EZzec2rLDyrWHxRVJdtVXj" -const escrowAccount = "rMLNvZR9dascY5jtCfCv3whAp8HdUSZAQ" - -async function XRPLLocked(api) { - const baseTokens = await sumTokens({ api, owner: coreVault, chain: 'ripple' }) - - // escrows - const response = await post('https://s1.ripple.com:51234', - { "method": "account_objects", "params": [{ - "account": coreVault, - "ledger_index": "validated", - "type": "escrow" - }] - } - ) - if (response.result.error === 'actNotFound') return baseTokens; - const escrowed = response.result.account_objects.filter( - (obj) => obj.LedgerEntryType === 'Escrow' && obj.Destination === escrowAccount - ).reduce((acc, escrow) => acc + (+escrow.Amount / 1e6), 0) - - return { - "ripple": baseTokens.ripple + escrowed, +const { sumTokens } = require('../helper/sumTokens') + +const { xrpl } = sdk.chains + +const abi = { + assetManager: 'address:assetManager', + getAllAgents: 'function getAllAgents(uint256 _start, uint256 _end) view returns (address[] _agents, uint256 _totalLength)', + getAgentInfo: 'function getAgentInfo(address _agentVault) view returns (tuple(uint8 status, address ownerManagementAddress, address ownerWorkAddress, address collateralPool, address collateralPoolToken, string underlyingAddressString, bool publiclyAvailable, uint256 feeBIPS, uint256 poolFeeShareBIPS, address vaultCollateralToken, uint256 mintingVaultCollateralRatioBIPS, uint256 mintingPoolCollateralRatioBIPS, uint256 freeCollateralLots, uint256 totalVaultCollateralWei, uint256 freeVaultCollateralWei, uint256 vaultCollateralRatioBIPS, address poolWNatToken, uint256 totalPoolCollateralNATWei, uint256 freePoolCollateralNATWei, uint256 poolCollateralRatioBIPS, uint256 totalAgentPoolTokensWei, uint256 announcedVaultCollateralWithdrawalWei, uint256 announcedPoolTokensWithdrawalWei, uint256 freeAgentPoolTokensWei, uint256 mintedUBA, uint256 reservedUBA, uint256 redeemingUBA, uint256 poolRedeemingUBA, uint256 dustUBA, uint256 liquidationStartTimestamp, uint256 maxLiquidationAmountUBA, uint256 liquidationPaymentFactorVaultBIPS, uint256 liquidationPaymentFactorPoolBIPS, int256 underlyingBalanceUBA, uint256 requiredUnderlyingBalanceUBA, int256 freeUnderlyingBalanceUBA, uint256 announcedUnderlyingWithdrawalId, uint256 buyFAssetByAgentFactorBIPS, uint256 poolExitCollateralRatioBIPS, uint256 redemptionPoolFeeShareBIPS))', + getCoreVaultManager: 'address:getCoreVaultManager', + coreVaultAddress: 'string:coreVaultAddress', +} + +// every FXRP agent, read from the AssetManager that the FXRP token points to +async function getAgents(api) { + const assetManager = await api.call({ target: ADDRESSES.flare.FXRP, abi: abi.assetManager }) + const vaults = [] + let total = 1 + for (let start = 0; start < total; start += 100) { + const { _agents, _totalLength } = await api.call({ target: assetManager, abi: abi.getAllAgents, params: [start, start + 100] }) + vaults.push(..._agents) + total = Number(_totalLength) } + const infos = await api.multiCall({ target: assetManager, abi: abi.getAgentInfo, calls: vaults }) + const agents = infos.map((info, i) => ({ + vault: vaults[i], + vaultCollateralToken: info.vaultCollateralToken, + pool: info.collateralPool, + poolCollateralToken: info.poolWNatToken, + underlyingAddress: info.underlyingAddressString, + })) + return { assetManager, agents } } +// vault collateral in each agent vault and WFLR in each collateral pool; FXRP fees and pool tokens held there are +// skipped, as they are claims on the XRP and WFLR already counted async function flareTvl(api) { + const { agents } = await getAgents(api) return sumTokens2({ api, - tokensAndOwners: [ - ...agentVaults.map(v => [ADDRESSES.monad.USDT, v]), // USDT0 in agent vaults - ...agentPools.map(p => [ADDRESSES.flare.WFLR, p]), // WFLR in agent pools - ], + tokensAndOwners: agents.flatMap(a => [ + [a.vaultCollateralToken, a.vault], + [a.poolCollateralToken, a.pool], + ]), }) } +// XRP backing FXRP: agents' underlying addresses, the core vault and the escrows it created +async function xrplTvl(api) { + const flareApi = new sdk.ChainApi({ chain: 'flare', timestamp: api.timestamp }) + const { assetManager, agents } = await getAgents(flareApi) + const owners = agents.map(a => a.underlyingAddress) + + const coreVaultManager = await flareApi.call({ target: assetManager, abi: abi.getCoreVaultManager }) + const coreVault = coreVaultManager === ADDRESSES.null ? undefined : await flareApi.call({ target: coreVaultManager, abi: abi.coreVaultAddress }) + if (coreVault) owners.push(coreVault) + + await sumTokens({ api, chain: 'ripple', owners }) + if (!coreVault) return + + // core vault escrows return to the core vault at expiry; escrows other accounts made towards it are skipped + const escrows = await xrpl.getAccountObjects({ account: coreVault, type: 'escrow' }) + const escrowedDrops = escrows + .filter(e => e.Account === coreVault && typeof e.Amount === 'string') + .reduce((sum, e) => sum + Number(e.Amount), 0) + api.addCGToken('ripple', escrowedDrops / 1e6) +} + module.exports = { - methodology: "Value of USDT0 and WFLR held in Agent's vaults and pools together with XRP tokens locked on XRPL either in core vault or in the escrows.", + methodology: 'XRPL: XRP held in the underlying XRPL address of every FXRP agent and in the FAssets core vault, plus the XRP in escrows created by the core vault. Agents and the core vault address are read from the FXRP AssetManager and CoreVaultManager contracts on Flare. Flare: vault collateral (currently USDT0) in each agent vault and WFLR in each agent collateral pool.', + timetravel: false, flare: { tvl: flareTvl }, - ripple: { tvl: XRPLLocked }, + ripple: { tvl: xrplTvl }, } From 9b29286aa133f9d3990e7303bbf42bbc299711ac Mon Sep 17 00:00:00 2001 From: silto Date: Mon, 9 Nov 2026 09:27:33 +0100 Subject: [PATCH 639/988] docs: fix project submission guide link (#22089) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6f6a0b7e39c..ceafd79d004 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Defillama Adapters -Follow [this guide](https://docs.llama.fi/submit-a-project) to create an adapter and submit a PR with it. +Follow [this guide](https://docs.llama.fi/list-your-project/submit-a-project) to create an adapter and submit a PR with it. Also, don't hesitate to send a message on [our discord](https://discord.defillama.com/) if we're late to merge your PR. From 2e2dfc3805abc6b48f51032522e6f6fc0bfc202b Mon Sep 17 00:00:00 2001 From: pseudo-name100 <80414139+pseudo-name100@users.noreply.github.com> Date: Mon, 9 Nov 2026 02:32:04 -0600 Subject: [PATCH 640/988] Add Hollow (HLO) (#22083) Co-authored-by: ccipherx --- registries/sumTokens.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 040c37ea7f9..c0c5022fabd 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -16127,6 +16127,16 @@ const configs = { ] }, }, + "hollow": { + "methodology": "TVL is the WETH held by the Hollow Treasury, the reserve HLO holders redeem against at the floor price. HLO in the lock contract is not counted, since its backing is the Treasury already counted in TVL. The protocol-owned Uniswap v4 position is not counted.", + "start": "2026-11-07", + "ethereum": { + "owner": "0x2a737e134f968D94F70B9f669AAd0cc829BE345b", + "tokens": [ + ADDRESSES.ethereum.WETH + ] + }, + }, "hoodbets": { "methodology": "TVL is the native ETH held by the HoodBets contract: open parimutuel betting pools plus settled winnings awaiting claim. Markets are settled permissionlessly against Chainlink stock price feeds.", "robinhood": { From 175a1850749ed721e043a38ead0f35f22d67d6cb Mon Sep 17 00:00:00 2001 From: 33ming Date: Mon, 9 Nov 2026 12:32:53 +0400 Subject: [PATCH 641/988] Add MING (BSC): TVL, staking and treasury (#22086) Co-authored-by: 33ming <326839147+33ming@users.noreply.github.com> Co-authored-by: ccipherx --- projects/ming/index.js | 44 +++++++++++++++++++++++++++++++++++++ projects/treasury/ming.js | 46 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 projects/ming/index.js create mode 100644 projects/treasury/ming.js diff --git a/projects/ming/index.js b/projects/ming/index.js new file mode 100644 index 00000000000..a6be849873c --- /dev/null +++ b/projects/ming/index.js @@ -0,0 +1,44 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress } = require('../helper/tokenMapping') +const { staking } = require('../helper/unknownTokens') + +// MING on BSC: https://ming.family +const GRID_MINING = '0x50518bfb43d526F0342459cF92CB0AeC25D38Fd9' +const AUTO_MINER = '0x0a570E5Ac33118f36c9B0AC7bFFCAB6bde57c308' +const STAKING = '0x9515533189751237D92A77068a61D1D100ABd966' +const ACCOUNT_FACTORY = '0xcA03db2bACd90C6B35494d3b942C8FBF1634bFbA' // creates players' Loop accounts +const MING = '0x35771285a60B2aA5d4f5AcB917cc019Ee1DF7777' +const MING_WBNB = '0x14BaCB4C10578c6D561b22244b3f5bF0dF1764c8' // PancakeSwap V2 pair, prices MING +const XAUT = '0x21cAef8A43163Eea865baeE23b9C2E327696A3bf' +const MULTICALL3 = '0xcA11bde05977b3631167028862bE2a173976CA11' + +async function tvl(api) { + const count = await api.call({ target: ACCOUNT_FACTORY, abi: 'uint256:totalAccounts' }) + const accounts = await api.multiCall({ target: ACCOUNT_FACTORY, abi: 'function accountAt(uint256) view returns (address)', calls: [...Array(Number(count)).keys()] }) + + // GridMining and the AutoMiner also hold BNB that belongs to the protocol: the float that pays for round + // triggers and fees not yet sent on. Only the rest, the players' BNB, is counted. + const [gridBnb, autoBnb] = await api.multiCall({ target: MULTICALL3, abi: 'function getEthBalance(address) view returns (uint256)', calls: [GRID_MINING, AUTO_MINER] }) + const triggerFloat = await api.call({ target: GRID_MINING, abi: 'uint256:triggerFloat' }) + const feeOwed = await api.call({ target: GRID_MINING, abi: 'uint256:feeOwed' }) + const treasuryOwed = await api.call({ target: GRID_MINING, abi: 'uint256:treasuryOwed' }) + const triggerReserve = await api.call({ target: AUTO_MINER, abi: 'uint256:triggerReserve' }) + const autoMinerFees = await api.call({ target: AUTO_MINER, abi: 'uint256:accumulatedFees' }) + const nonNegative = (v) => (v > 0n ? v : 0n).toString() + api.add(nullAddress, nonNegative(BigInt(gridBnb) - BigInt(triggerFloat) - BigInt(feeOwed) - BigInt(treasuryOwed))) + api.add(nullAddress, nonNegative(BigInt(autoBnb) - BigInt(triggerReserve) - BigInt(autoMinerFees))) + + await api.sumTokens({ owners: accounts, tokens: [nullAddress] }) + // WBNB waiting to become Goldpot gold, the Goldpot's and players' XAUt, and the XAUt owed to stakers + return api.sumTokens({ owners: [GRID_MINING, STAKING, ...accounts], tokens: [ADDRESSES.bsc.WBNB, XAUT] }) +} + +module.exports = { + misrepresentedTokens: true, + methodology: "TVL: BNB and gold (XAUt) held for players: the current round, unclaimed payouts, AutoMiner and Loop deposits, the Goldpot and gold owed to stakers. Staking: MING staked, plus mined MING held for players until they claim it, priced from the MING/WBNB PancakeSwap pool.", + start: '2026-11-05', + bsc: { + tvl, + staking: staking({ owners: [STAKING, GRID_MINING], tokens: [MING], lps: [MING_WBNB], useDefaultCoreAssets: true }), + }, +} diff --git a/projects/treasury/ming.js b/projects/treasury/ming.js new file mode 100644 index 00000000000..7f1ae0a4dba --- /dev/null +++ b/projects/treasury/ming.js @@ -0,0 +1,46 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress } = require('../helper/tokenMapping') +const { unwrapUniswapV4NFTs, sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') + +// MING on BSC: https://ming.family +const TREASURY = '0x427992090a24122Df5b77b5cC259804af7Ad8844' // BNB waiting for MING buybacks and staker gold +const GOLD_RESERVE = '0x2dfadF788a3eF31F6F3eAc85b2ac0339FdD535be' // the protocol's gold reserve, published at ming.family/reserve +const MING = '0x35771285a60B2aA5d4f5AcB917cc019Ee1DF7777' +const XAUT = '0x21cAef8A43163Eea865baeE23b9C2E327696A3bf' +const UNISWAP_V4_POSITION_MANAGER = '0x7a4a5c919ae2541aed11041a1aeee68f1287f95b' + +// only the reserve's position ids come from MING's API, every amount is read on chain +async function reservePositions() { + return getConfig('ming/reserve-positions', undefined, { + fetcher: async () => { + const { positions } = await get('https://core.ming.family/v1/reserve') + if (!Array.isArray(positions) || !positions.length) throw new Error('ming: empty reserve position list') + return positions + }, + }) +} + +// MING's own token is left out of every position +async function tvl(api) { + await api.sumTokens({ owners: [TREASURY], tokens: [nullAddress, ADDRESSES.bsc.WBNB, XAUT] }) + await api.sumTokens({ owners: [GOLD_RESERVE], tokens: [XAUT] }) + + const positions = await reservePositions() + if (!Array.isArray(positions)) throw new Error('ming: no reserve position list (api down, nothing cached)') + if (positions.some(p => p.venue !== 'uniswap-v4' || p.nft?.id == null)) throw new Error('ming: reserve position on a venue this adapter does not unwrap') + const ids = positions.map(p => String(p.nft.id)) + // ownerOf reverts for a burned position + const owners = await api.multiCall({ target: UNISWAP_V4_POSITION_MANAGER, abi: 'function ownerOf(uint256) view returns (address)', calls: ids, permitFailure: true }) + const held = ids.filter((_, i) => owners[i]?.toLowerCase() === GOLD_RESERVE.toLowerCase()) + if (held.length) await unwrapUniswapV4NFTs({ api, balances: api.getBalances(), owner: GOLD_RESERVE, nftAddress: UNISWAP_V4_POSITION_MANAGER, blacklistedTokens: [MING], uniV4ExtraConfig: { positionIds: held } }) + + // Uniswap V3 and PancakeSwap V3 positions + return sumTokens2({ api, owner: GOLD_RESERVE, resolveUniV3: true, blacklistedTokens: [MING] }) +} + +module.exports = { + methodology: "BNB and gold in MING's Treasury contract, plus the gold (XAUt) in the protocol's reserve wallet and its liquidity positions. MING itself is not counted.", + bsc: { tvl }, +} From d2f88de0d2f29f5c1886e8e824842183ad04f915 Mon Sep 17 00:00:00 2001 From: justin <1539088+justingreenberg@users.noreply.github.com> Date: Mon, 9 Nov 2026 03:33:28 -0500 Subject: [PATCH 642/988] Add Elysium Bridge (Kinetiq) (#22088) Co-authored-by: ccipherx --- projects/kinetiq-elysium-bridge/index.js | 66 ++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 projects/kinetiq-elysium-bridge/index.js diff --git a/projects/kinetiq-elysium-bridge/index.js b/projects/kinetiq-elysium-bridge/index.js new file mode 100644 index 00000000000..820219961b7 --- /dev/null +++ b/projects/kinetiq-elysium-bridge/index.js @@ -0,0 +1,66 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs2 } = require('../helper/cache/getLogs') +const { getUniqueAddresses } = require('../helper/tokenMapping') + +// Elysium is Kinetiq's Arbitrum Orbit chain, settling to HyperEVM. Its canonical bridge escrows +// deposits on HyperEVM: native HYPE in the rollup's Bridge contract (WHYPE is unwrapped into it +// by the WETH gateway) and ERC-20s in the standard and custom gateways behind the gateway router. +const BRIDGE = '0x503D572157113fAaaD4DbeD2647Bb10b949216B6' +const ERC20_GATEWAY = '0xd97B30dE0bA0C2eAeE942afce77530e06c5F122c' +const CUSTOM_GATEWAY = '0xF735A40938BEfC34CDE27049f7F70780bD460748' +const GATEWAYS = [ERC20_GATEWAY, CUSTOM_GATEWAY] +const GATEWAYS_FROM_BLOCK = 48957103 + +const KNTQ = '0x000000000000780555bD0BCA3791f89f9542c2d6' +const sKNTQ = '0x696238e0Ca31c94e24ca4CBe7921754E172E4d0F' +const OWN_TOKENS = [KNTQ, sKNTQ] + +// HyperEVM tokens with a representation on Elysium; any other token deposited through a +// gateway is picked up from its DepositInitiated events +const tokens = [ + ADDRESSES.hyperliquid.WHYPE, + '0xfD739d4e423301CE9385c1fb8850539D657C296D', // kHYPE + '0x360C140E5344A1A0593D44B4ea6Fc7C3DAf0C473', // kmHYPE + '0x9BA2EDc44E0A4632EB4723E81d4142353e1bB160', // vkHYPE + ADDRESSES.hyperliquid.USDC, + ADDRESSES.hyperliquid.USDT0, + ADDRESSES.hyperliquid.USDe, + '0x111111a1a0667d36bD57c0A9f569b98057111111', // USDH + '0x9FDBdA0A5e284c32744D2f17Ee5c74B284993463', // UBTC + '0xBe6727B535545C67d5cAa73dEa54865B92CF7907', // UETH + '0x068f321Fa8Fb9f0D135f290Ef6a3e2813e1c8A29', // USOL + '0x9b498C3c8A0b8CD8BA1D9851d40D186F1872b44E', // PURR + '0x62D5dD0190376c444a4B2E2e860aa392eC83Ed80', // JOFF + '0x07c57E32a3C29D5659bda1d3EFC2E7BF004E3035', // NEST +] + +// cache only the deposited token set, not every DepositInitiated log +const customCacheFunction = ({ cache, logs }) => { + cache.logs = getUniqueAddresses([...(cache.logs ?? []), ...logs.map((i) => i.l1Token)]) + return cache +} + +const tvl = async (api) => { + const tokensAndOwners = [[ADDRESSES.null, BRIDGE]] // HYPE + for (const gateway of GATEWAYS) { + const deposited = await getLogs2({ + api, + target: gateway, + fromBlock: GATEWAYS_FROM_BLOCK, + eventAbi: 'event DepositInitiated(address l1Token, address indexed _from, address indexed _to, uint256 indexed _sequenceNumber, uint256 _amount)', + customCacheFunction, + extraKey: 'deposit-tokens', + }) + getUniqueAddresses([...tokens, ...deposited]).forEach((token) => tokensAndOwners.push([token, gateway])) + } + return sumTokens2({ api, tokensAndOwners, blacklistedTokens: OWN_TOKENS }) +} + +const staking = (api) => api.sumTokens({ owners: GATEWAYS, tokens: OWN_TOKENS }) + +module.exports = { + methodology: 'Counts HYPE and ERC-20 tokens locked on HyperEVM in the Elysium canonical bridge: native HYPE in the rollup Bridge contract and tokens in its ERC20 and custom gateways, including any token found in their deposit events. Kinetiq\'s own KNTQ and sKNTQ in the gateways are counted under staking.', + start: '2026-10-19', + hyperliquid: { tvl, staking }, +} From dc982918e1b4492930ad5dcc2afea08b6d24a727 Mon Sep 17 00:00:00 2001 From: J W Date: Mon, 9 Nov 2026 03:57:02 -0500 Subject: [PATCH 643/988] Add GraveStake (Solana staking pools) (#22079) Co-authored-by: Claude Opus 5.5 --- projects/gravestake/index.js | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 projects/gravestake/index.js diff --git a/projects/gravestake/index.js b/projects/gravestake/index.js new file mode 100644 index 00000000000..12ac6b36444 --- /dev/null +++ b/projects/gravestake/index.js @@ -0,0 +1,63 @@ +const bs58 = require('bs58').default || require('bs58') +const { svm } = require('@defillama/sdk').chains + +// GraveStake: no-code staking pools on Solana (NFT and fungible). Every stake is a StakePosition +// account of the program, which records the staked mint and amount. Reward vaults (rewards funded +// by pool creators) have no position, so they are not counted. The EVM deployments (same factory on +// 12 chains) have not created any pool yet. +const PROGRAM_ID = 'GRv7q7Tff1yEEwvuuBin9xySF35pk7Vc4sVyJLM9wSTK' + +// sha256("account:StakePosition")[0..8] +const POSITION_DISCRIMINATOR = Buffer.from([78, 165, 30, 111, 171, 125, 11, 220]) + +// StakePosition (Anchor/borsh, after the 8-byte discriminator): +// version u8, pool Pubkey, owner Pubkey, position_key Pubkey, asset_mint Pubkey, amount u64, ... +// position_key is the owner for a fungible position (one per user per pool) and the NFT / asset id +// otherwise, so position_key == owner selects the fungible stakes. +const SLICE = { offset: 41, length: 104 } // owner .. amount +const OWNER = 0 +const POSITION_KEY = 32 +const ASSET_MINT = 64 +const AMOUNT = 96 + +// $DEADS, the SolanaDeads ecosystem token (GraveStake is a SolanaDeads product) +const DEADS = 'DEADsWJZaonaiZPFkrqEEBGf43mzA5uHeHpwgy9dW666' + +// tvl and staking read the same accounts: fetch once per run +let cached = {} +function getFungiblePositions(api) { + const key = `${api.chain}-${api.timestamp}` + if (!cached[key]) cached = { [key]: fetchFungiblePositions(api.chain).catch((e) => { delete cached[key]; throw e }) } + return cached[key] +} + +async function fetchFungiblePositions(chain) { + const accounts = await svm.getProgramAccounts({ + chain, programId: PROGRAM_ID, dataSlice: SLICE, + filters: [{ memcmp: { offset: 0, bytes: bs58.encode(POSITION_DISCRIMINATOR) } }], + }) + const positions = [] + for (const { account } of accounts) { + const data = Buffer.from(account.data[0], 'base64') + if (data.length !== SLICE.length) throw new Error('gravestake: unexpected StakePosition layout') + if (!data.subarray(OWNER, OWNER + 32).equals(data.subarray(POSITION_KEY, POSITION_KEY + 32))) continue // NFT position + positions.push({ mint: bs58.encode(data.subarray(ASSET_MINT, ASSET_MINT + 32)), amount: data.readBigUInt64LE(AMOUNT) }) + } + return positions +} + +async function tvl(api) { + const positions = await getFungiblePositions(api) + positions.filter(p => p.mint !== DEADS).forEach(p => api.add(p.mint, p.amount.toString())) +} + +async function staking(api) { + const positions = await getFungiblePositions(api) + positions.filter(p => p.mint === DEADS).forEach(p => api.add(p.mint, p.amount.toString())) +} + +module.exports = { + timetravel: false, + methodology: 'TVL is the fungible SPL and Token-2022 tokens users have staked in GraveStake pools, summed from the program\'s StakePosition accounts (staked mint and amount of each fungible position). $DEADS, the SolanaDeads ecosystem token, is reported under staking instead. Staked NFTs are not counted, and neither are reward vaults, because those hold rewards funded by pool creators, not user deposits.', + solana: { tvl, staking }, +} From a14d2ff353a805377b6ac69bedd75b7153a46d59 Mon Sep 17 00:00:00 2001 From: Satyam-10124 Date: Mon, 9 Nov 2026 14:28:56 +0530 Subject: [PATCH 644/988] GrowStreams V3: Expand TVL tracking across V3 contracts (TokenVault, SplitsRouter, BountyAdapter, PermissionManager, GROW) (#22082) Co-authored-by: ccipherx --- projects/vara-grow-streams/index.js | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/projects/vara-grow-streams/index.js b/projects/vara-grow-streams/index.js index cff0c22dc2b..73e31ecfdda 100644 --- a/projects/vara-grow-streams/index.js +++ b/projects/vara-grow-streams/index.js @@ -2,27 +2,17 @@ const blake = require('blakejs') const { post } = require('../helper/http') const VARA_RPC = 'https://rpc.vara.network' -const GAS_LIMIT = 750000000000 -const ZERO_ACCOUNT = '0x' + '0'.repeat(64) const VARA_DECIMALS = 1e12 -const TOKEN_VAULT = '0x20099b7637ae936670f54464c4109d1f028fbb63230e151ea4ef29c4a94cbcef' +const TOKEN_VAULT_V2 = '0x20099b7637ae936670f54464c4109d1f028fbb63230e151ea4ef29c4a94cbcef' +// vault set as token_vault in StreamCore 0x8298…0659 GetConfig +const TOKEN_VAULT_V3 = '0x657cf9c4f929aeac97092037826c1117f9e6cd0e3c4edc44e49decc17b840aa9' const WVARA = '0xf5e9cb1d1e46b0cda6578dd1684b30f281a45dfaa390e4945b7bfc8ab3e27f3d' const GVARA = '0x04314af41b7dbac322e3e66920211d2f799719e1cdc3122a99752f72b6ae84ee' // twox128("System") ++ twox128("Account") const SYSTEM_ACCOUNT_PREFIX = '26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9' -function scaleString(value) { - const bytes = Buffer.from(value, 'utf8') - if (bytes.length >= 64) throw new Error('vara-grow-streams: route segment is too long') - return Buffer.concat([Buffer.from([bytes.length << 2]), bytes]) -} - -function route(service, method) { - return Buffer.concat([scaleString(service), scaleString(method)]) -} - function u128LE(bytes, offset = 0) { let value = 0n for (let i = 15; i >= 0; i--) value = (value << 8n) | BigInt(bytes[offset + i]) @@ -66,13 +56,13 @@ async function getSpendableNative(addresses, at) { async function tvl(api) { const at = await rpc('chain_getFinalizedHead', []) - const [vaultNative, wvaraNative, gvaraNative] = await getSpendableNative([TOKEN_VAULT, WVARA, GVARA], at) - const total = vaultNative + wvaraNative + gvaraNative + const balances = await getSpendableNative([TOKEN_VAULT_V2, TOKEN_VAULT_V3, WVARA, GVARA], at) + const total = balances.reduce((acc, b) => acc + b, 0n) api.addCGToken('vara-network', Number(total) / VARA_DECIMALS) } module.exports = { - methodology: 'GrowStreams deploys and owns the token vault and its wVARA and gVARA wrapper programs. TVL is the combined spendable native VARA held by all three: the vault balance plus the native VARA backing wVARA and gVARA tokens.', + methodology: 'GrowStreams deploys and owns the V2 and V3 token vaults and its wVARA and gVARA wrapper programs. TVL is the combined spendable native VARA held by all four: the vault balances plus the native VARA backing wVARA and gVARA tokens.', vara: { tvl }, } From 135d54bf18e62bc52bf3510c9ee42e6f014b6e09 Mon Sep 17 00:00:00 2001 From: Dani Date: Mon, 9 Nov 2026 10:19:50 +0100 Subject: [PATCH 645/988] algebra forks: count custom-deployer pools, add QuickSwap V4 on Anubis (#22095) --- projects/helper/uniswapV3.js | 20 ++++++++++++++++++-- projects/quickswap-v4/index.js | 5 +++++ registries/uniswapV3.js | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/projects/helper/uniswapV3.js b/projects/helper/uniswapV3.js index 7c1e3147e82..c50af4beb01 100644 --- a/projects/helper/uniswapV3.js +++ b/projects/helper/uniswapV3.js @@ -10,19 +10,21 @@ const uniswapConfig = { const algebraConfig = { eventAbi: 'event Pool (address indexed token0, address indexed token1, address pool)', topics: ['0x91ccaa7a278130b65168c3a0c8d3bcae84cf5e43704342bd3ec0b59e59c036db'], + // Integral 1.1 to 1.2.2 emit only this for custom-deployer pools, 1.2.3+ emit it next to Pool + customPoolEventAbi: 'event CustomPool(address indexed deployer, address indexed token0, address indexed token1, address pool)', } function uniV3Export(config) { const exports = {} Object.keys(config).forEach(chain => { - let { factory: target, fromBlock, topics, eventAbi, isAlgebra, blacklistedTokens = [], blacklistedOwners = [], permitFailure, sumChunkSize, filterFn, sumChunkSleep, onlyUseExistingCache, extraKey, } = config[chain] + let { factory: target, fromBlock, topics, eventAbi, isAlgebra, customPools, blacklistedTokens = [], blacklistedOwners = [], permitFailure, sumChunkSize, filterFn, sumChunkSleep, onlyUseExistingCache, extraKey, } = config[chain] if (!topics) topics = isAlgebra ? algebraConfig.topics : uniswapConfig.topics if (!eventAbi) eventAbi = isAlgebra ? algebraConfig.eventAbi : uniswapConfig.eventAbi exports[chain] = { tvl: async (api) => { - const logs = await getLogs({ + let logs = await getLogs({ api, target, topics, @@ -33,6 +35,20 @@ function uniV3Export(config) { extraKey, }) + if (customPools) { + const customLogs = await getLogs({ + api, + target, + fromBlock, + eventAbi: algebraConfig.customPoolEventAbi, + onlyUseExistingCache, + onlyArgs: true, + extraKey: extraKey ? `${extraKey}-custom-pool` : 'custom-pool', + }) + const seen = new Set(logs.map(i => i.pool.toLowerCase())) + logs = logs.concat(customLogs.filter(i => !seen.has(i.pool.toLowerCase()))) + } + if (filterFn) blacklistedTokens.push(... await filterFn(api, logs)) diff --git a/projects/quickswap-v4/index.js b/projects/quickswap-v4/index.js index 38a2b2b5099..f3886bb7730 100644 --- a/projects/quickswap-v4/index.js +++ b/projects/quickswap-v4/index.js @@ -28,6 +28,11 @@ module.exports = uniV3Export({ isAlgebra: true, fromBlock: 85606804, }, + anubi: { + factory: '0x10253594A832f967994b44f33411940533302ACb', + isAlgebra: true, + fromBlock: 14481466, + }, /* mantra: { factory: '0x10253594A832f967994b44f33411940533302ACb', isAlgebra: true, diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 4c787971887..e8b2f66969f 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -392,6 +392,7 @@ const uniV3Configs = { factory: '0xfb8Ed3485EfA29a0e4bed93351dD51B59fC4b0f0', fromBlock: 23739977, isAlgebra: true, + customPools: true, }, }, 'dackieswap': { From 7020e63374b191cf89fd71cc0d8cfb4c0242b985 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 9 Nov 2026 10:26:09 +0100 Subject: [PATCH 646/988] update bitget --- projects/bitget/index.js | 21 +++++++++++++++++++-- projects/helper/bitcoin-book/index.js | 2 ++ registries/uniswapV2.js | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/projects/bitget/index.js b/projects/bitget/index.js index a4e900feab7..8155fbee5ee 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -163,6 +163,7 @@ const config = { "3NCT4RE6ix2Qfdw1c5kfNYBfJmVHPcJd9cABQ6aP6Zzg", // add on 21/10/2026 "7ScZfANFtjzDZWk94DLb2eZUs8zBgYmnotYrsDd1MfYv", // add on 21/10/2026 "HnxVDcZamsojYy3AFZndHEtQ9y5sf1H1V1pyLYyWk3BN", // add on 21/10/2026 + "H4QWaqSy5TDXvy5hCRWRvQ2LfwF24r8q8aSCpHqBxEU4", // add on 09/11/2026 ], }, doge: { @@ -261,11 +262,18 @@ const config = { xdc: { owners: ["0x68c34a122c3b632e7ecd39f553dd5ffc1433f45b"] }, // xdc68c34a122c3b632e7ecd39f553dd5ffc1433f45b harmony: { owners: ["0xb09dd9c27da4cbbf28f92109eb13615b34257fd3"] }, // one1kzwansna5n9m728eyyy7kymptv6z2l7n92uudx fetchhub: { owners: ["fetch1s3l4s5f2j79872qjtt9f3p86vxxyf6g854lw4v"] }, - zcash: { owners: ["t1Xd1Lx2EXi2qwE1Kpc2F95TE2VrdKuJriY"] }, + zcash: { + owners: [ + "t1Xd1Lx2EXi2qwE1Kpc2F95TE2VrdKuJriY", + "t1Tz755oKrYcjh4M5DzH9kmE2opn75SLpnU", // add on 09/11/2026 + "t1buK2T66Wrkf8TTc1Um2Y9co9dR3Pb5uFW", // add on 09/11/2026 + ], + }, bittensor: { owners: [ "5ELWnR5A7DUmmqHsYPA3iZMFu1BX3gceruEqFPtsmTkCqR7J", "5HbDZ6ULuwZegAMSPaS2kaUfBLMDaht5t48RcDrQATSgGCAR", + "5EbxNU8FqoWcY5g8HpyGnLFTUbyx3qfsfhSLUq3YvKLkYEN2", // add on 09/11/2026 ], }, pi: { owners: ["GDFNWH6ZFJVHJDLBMNOUT35X4EEKQVJAO3ZDL4NL7VQJLC4PJOQFWJ75"] }, @@ -273,9 +281,17 @@ const config = { owners: [ "0x48d1db7cb8529f17c88300515ed068bb8bbf01e6bd60ac81071d1160562a5144", "0xbabf76f1e6ac1af9c2666c07be12f90b188ed484fcef0bf1408961b5461373e9", + "0xd5c940e87dc41b83b8371d77e2daece86312f7d5dede5af3b564fc0ad21c4c97", // add on 09/11/2026 + ], + }, + litecoin: { + owners: [ + "LSm75uocx76va8UvrVqyTztkWwXDvjS416", + "LcQnFxNQgTiwWXamwSrU4N9N4TCHMiSFHq", // add on 09/11/2026 + "LhNRam9LPfSHbgnewAdcDpqbvZrDVQqUJz", // add on 09/11/2026 ], }, - litecoin: { owners: ["LSm75uocx76va8UvrVqyTztkWwXDvjS416"] }, + bitcoincash: { owners: ["18G6Xwo3rD4Rqf1c9QVZKmWfrhPtRhjozX"] }, // add on 09/11/2026 stellar: { owners: ["GBD6CUO335LQMOIZ53CE3L6QJ3X3DAQVC7F5TWE2BKI7AQWTHDUHFNJ4"] }, hedera: { owners: ["0.0.4735544"] }, kaspa: { owners: ["kaspa:qqywx2wszmnrsu0mzgav85rdwvzangfpdj9j3ady9jpr7hu4u8c2wl9wqgd6j"] }, @@ -284,6 +300,7 @@ const config = { "1hBczpJHSWrEejKT5hevU3h2oBKNBpY26zPo7jTpVanj3JV", "13KjpoC6rn9NsKzweB5p68oBcsp77NvMSGdp6BZTMHjHTupB", "15u2N1pqWr56teREjQTP5M3tk1SPQjEoUAV6jFfcQCoVy3S5", + "12cWLsubAGAiyoUGtgAG58yJZeRZv1wxeFeZaExEVR7CPKVK", // add on 09/11/2026 ], }, injective: { owners: ["inj18seg7en3tdhy4ugvfv3s93srapdlkkpv6z56r4"] }, diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index bca3e248755..c16efe93a81 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -441,6 +441,8 @@ module.exports = { "bc1ps398h24s2zwm763k0n6c7hq9y4r6jm94pf6mxntrwprtj47nyt8q8qacet", // add on 21/10/2026 "bc1p0jm3ucw8sh7edx37lw06ce9aaem09tcx2yr2zuenqr33hqce3lps67k0ns", // add on 21/10/2026 "bc1pk0ynqw5zt36sep3eq5qe3c70w7vcwremwv092e02e0htm9wlm7zsf4dvt6", // add on 21/10/2026 + "19E7ErLwXbACKhfNoBAngYK6DBPukmx9V1", // add on 09/11/2026 + "1EDu33g4TfWtQHktDK9uNS6GvhqhrmqP2q", // add on 09/11/2026 ], bitmake: [ // wallet provide by a bitmake team diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index e1b4b377e9d..198bbe28299 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -2966,6 +2966,7 @@ const uniV2Configs = { polygon_zkevm: ADDRESSES.shibarium.BONE_1, }, 'bcswap': { + deadFrom: '2026-10-29', // chain state wiped bcypher: '0x927bf500361987b365f6d0ff38c1d45155f4975c', }, 'velox': { From 4a04bf0a6ea99d4bbc94ea672fbabe801038fcb3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 9 Nov 2026 10:41:39 +0100 Subject: [PATCH 647/988] sovryn is sunset --- projects/sovryn-lending/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/sovryn-lending/index.js b/projects/sovryn-lending/index.js index 75222ea5273..3736c2cd30a 100644 --- a/projects/sovryn-lending/index.js +++ b/projects/sovryn-lending/index.js @@ -29,5 +29,6 @@ async function borrowed(api) { } module.exports = { + deadFrom: "2026-07-12", // sunset? rsk: { tvl, borrowed, } } \ No newline at end of file From 706b3c70dc5c64cda65b3ce1abe0e089fc1e0b49 Mon Sep 17 00:00:00 2001 From: Ivo Greshev Date: Mon, 9 Nov 2026 12:08:46 +0200 Subject: [PATCH 648/988] Add Roulana (Solana, Luck Games) (#22094) Co-authored-by: Ivo Greshev Co-authored-by: ccipherx --- registries/sumTokens.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index c0c5022fabd..6f43eacab41 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -24687,6 +24687,13 @@ const configs = { ] }, }, + "roulana": { + "start": "2026-10-01", + "methodology": "TVL is the USDC held in the Roulana table program's vault: the bank funded by its investors, the players' own safes, and fees not yet paid out.", + "solana": { + "tokenAccounts": ["BPJmrTZFCBi4iK6bA4FxV43wM1qQqiHXBGMHbfd4aw56"] // USDC vault of table AfyXCSmsshBZ998TCCNbuUSB5hcw4RnJFeEk1LWhh63J + }, + }, "routerprotocol": { "methodology": "All tokens locked in Router Protocol contracts.", "arbitrum": { From 2399d8eecabe0d5f95deb56b9b8808b324331681 Mon Sep 17 00:00:00 2001 From: bheluga Date: Mon, 9 Nov 2026 10:19:46 +0000 Subject: [PATCH 649/988] blacklist varlamore vault (#22097) --- projects/helper/curators/configs.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/curators/configs.js b/projects/helper/curators/configs.js index 6d2e1c805ba..999cfd0b3df 100644 --- a/projects/helper/curators/configs.js +++ b/projects/helper/curators/configs.js @@ -445,6 +445,7 @@ const SiloConfigs = { '0x9a1bf5365edbb99c2c61ca6d9ffad0b705acfc6f', '0xb6a23cb29e512df41876b28d7a848bd831f9c5ba', '0xf6bc16b79c469b94cdd25f3e2334dd4fee47a581', + '0xcc7bdb3ff050d65918b96e4bdf1060a1aa0bb409', ] }, ethereum: { From 22d9834c3ca339eab199e118fd8bd343abbb5dcb Mon Sep 17 00:00:00 2001 From: Vet <109047316+xVet@users.noreply.github.com> Date: Mon, 9 Nov 2026 14:15:39 +0100 Subject: [PATCH 650/988] xrpl-dex: fix stale TVL, read AMM reserves on-chain via a custom script (#22093) Co-authored-by: ccipherx --- .../sushi-analytics-v2/adapterMapping.js | 1 + projects/xrpl-dex/api.js | 286 +++++++----------- projects/xrpl-dex/index.js | 29 +- projects/xrpl-dex/package-lock.json | 195 ------------ projects/xrpl-dex/package.json | 15 - projects/xrpl-dex/run.sh | 3 - 6 files changed, 123 insertions(+), 406 deletions(-) delete mode 100644 projects/xrpl-dex/package-lock.json delete mode 100644 projects/xrpl-dex/package.json delete mode 100644 projects/xrpl-dex/run.sh diff --git a/projects/helper/custom-scripts/sushi-analytics-v2/adapterMapping.js b/projects/helper/custom-scripts/sushi-analytics-v2/adapterMapping.js index 1b5e0aa532a..59526bb18c3 100644 --- a/projects/helper/custom-scripts/sushi-analytics-v2/adapterMapping.js +++ b/projects/helper/custom-scripts/sushi-analytics-v2/adapterMapping.js @@ -105,6 +105,7 @@ module.exports = { // 'yodeswap': '/yodeswap/api', // dogechain is dead // 'dogeswap-org': '/dogeswap-org/api', // dogechain is dead 'o2': '/o2/api', + 'xrpl-dex': '/xrpl-dex/api', // breaks often // 'equilibrium': '/equilibrium/api', diff --git a/projects/xrpl-dex/api.js b/projects/xrpl-dex/api.js index f76143fb6a2..41b637e66ea 100644 --- a/projects/xrpl-dex/api.js +++ b/projects/xrpl-dex/api.js @@ -1,193 +1,139 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const rippleCodec = require("ripple-binary-codec"); -const { PromisePool } = require("@supercharge/promise-pool"); -const { getCache, setCache } = require("../helper/cache"); +// Values every XRPL AMM pool with amm_info at one validated ledger. Too slow for the hourly runner (about 32k reads), so the +// custom-scripts runner (helper/custom-scripts/sushi-analytics-v2, bulky group) runs it and stores the result for ./index.js. +// XRPScan is used only to list the pools. Test with: node test.js projects/xrpl-dex/api.js +const sdk = require('@defillama/sdk') const axios = require('axios') +const { PromisePool } = require('@supercharge/promise-pool') +const { transformDexBalances } = require('../helper/portedTokens') + +const { xrpl } = sdk.chains +const PROJECT = 'xrpl-dex' +const POOL_LIST_URL = 'https://api.xrpscan.com/api/v1/amm/pools' +const PAGE_SIZES = [5000, 1000, 2500] +const MAX_POOL_ROWS = 100000 +const RLUSD = '524C555344000000000000000000000000000000.rMxCKbEDwqr76QuheSUMdEGf4B9xJ8m5De' +const MIN_POOLS = 20000 // the ledger held 32,121 AMM pools on 2026-11-09 +const MAX_DELETED_SHARE = 0.01 // a normal run sees about 10 pools deleted between listing and reading +const CONCURRENCY = 20 // the sdk caps in-flight XRPL requests at 5, extra slots stay busy during retry waits +const RPC_TIMEOUT = 10_000 +const LEDGER_LAG = 10 +const RLUSD_DECIMALS = 6 // coins-server decimals for RLUSD on ripple, see helper/sumTokens.js -const NODE_URL = "https://xrplcluster.com"; -const API_XRP = "https://api.xrpscan.com/api/v1/amm/" -const RATE_LIMIT_DELAY_MS = 500; -const MIN_POOL_SIZE = 9500 -const getTimeNow = () => Math.floor(Date.now() / 1000); const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) -const retry = async (fn, retries = 7, delay) => { - let attempts = 0; - while (attempts < retries) { - try { - return await fn(); - } catch (error) { - attempts++; - console.error(`Attempt ${attempts} failed. Retrying...`); - const currentDelay = delay ? delay : attempts * 1000; - if (attempts >= retries) throw error; +// amm_info amount: XRP as a drops string, issued tokens as { currency, issuer, value }, MPTs as { mpt_issuance_id, value } +const parseSide = (s) => typeof s === 'string' ? ['XRP', Number(s) / 1e6] + : [s.mpt_issuance_id ? `MPT.${s.mpt_issuance_id}` : `${s.currency}.${s.issuer}`, Number(s.value)] - await sleep(currentDelay); +async function getPoolPage(offset, limit) { + for (let attempt = 1; ; attempt++) { + try { + const { data } = await axios.get(POOL_LIST_URL, { params: { limit, offset }, timeout: 60_000 }) + if (!Array.isArray(data)) throw new Error('unexpected pool list response') + return data + } catch (e) { + if (attempt >= 3) throw e + await sleep(5_000 * attempt) } } -}; - -const getLedgerDatas = async (binary, marker, atLedgerIndex) => { - const payload = { - method: "ledger_data", - params: [ - { - ledger_index: atLedgerIndex ?? "validated", - binary, - type: "amm", - ...(marker && { marker }), - }, - ], - }; - - return await retry(async () => { - const { data } = await axios.post(NODE_URL, payload); - - if (data.result && data.result?.state) { - return { - state: data.result.state, - marker: data.result.marker, - }; - } - - throw new Error("Invalid response format from XRPL"); - }); -}; - -let poolIndex = 0; -const getPools = async (nextMarker, isBinary, atLedgerIndex, poolsFound = []) => { - try { - console.log(`${++poolIndex} Fetching pools... Marker: ${nextMarker || 'start'}, Pools found so far: ${poolsFound.length}`); - const { state, marker } = await getLedgerDatas(isBinary, nextMarker, atLedgerIndex); - - if (state && state.length > 0) { - const decodedState = isBinary - ? state.map((entry) => rippleCodec.decode(entry.data)) - : state; - - poolsFound.push( - ...decodedState.map((entry) => ({ - account: entry.Account, - asset1: { currency: entry.Asset.currency, issuer: entry.Asset.issuer }, - asset2: { currency: entry.Asset2.currency, issuer: entry.Asset2.issuer }, - })) - ); - - } +} - if (marker) { - await sleep(RATE_LIMIT_DELAY_MS); - return getPools(marker, isBinary, atLedgerIndex, poolsFound); +// XRPScan sorts by the pool's XRP balance, which moves between requests and ties at 0, so one offset walk skips pools +async function listPools() { + const accounts = new Set() + let rows = 0 + for (const limit of PAGE_SIZES) { + rows = 0 + for (let offset = 0; offset < MAX_POOL_ROWS; offset += limit) { + const data = await getPoolPage(offset, limit) + data.forEach((pool) => { if (pool?.Account) accounts.add(pool.Account) }) + rows += data.length + if (data.length < limit) break } - - } catch (error) { - console.error("Failed to fetch pools:", error.message); + console.log(`${PROJECT}: pool list walk of ${limit}: ${rows} rows, ${accounts.size} unique so far`) + if (accounts.size >= rows) return [...accounts] } - - return poolsFound; -}; - -const parseReserve = (reserveData) => { - if (!reserveData) return null; - - const isXrp = typeof reserveData === "string"; - return { - currency: isXrp ? ADDRESSES.ripple.XRP : reserveData.currency, - issuer: isXrp ? null : reserveData.issuer, - amount: isXrp ? reserveData : reserveData.value, - }; -}; - -const getReserveDatas = async (pool) => { - return await retry(async () => { - const { data } = await axios.get(API_XRP + pool.account); + throw new Error(`${PROJECT}: pool list incomplete, ${accounts.size} unique of ${rows} rows`) +} - return { - token0: parseReserve(data?.amount), - token1: parseReserve(data?.amount2) +// keep only the endpoints that serve the pinned ledger, so a lagging or hanging node cannot stall the run +async function pickEndpoints(ledgerIndex) { + const healthy = [] + for (const url of xrpl.getEndpoints()) { + try { + const { data } = await axios.post(url, { method: 'ledger', params: [{ ledger_index: ledgerIndex }] }, { timeout: 5_000 }) + if (data?.result?.validated) healthy.push(url) + else console.error(`${PROJECT}: endpoint ${url} skipped: ledger ${ledgerIndex} not served`) + } catch (e) { + console.error(`${PROJECT}: endpoint ${url} skipped: ${e.message}`) } - }); -}; - -const getAllReservesDatas = async (poolAddresses, atLedgerIndex) => { - const poolsWithReserves = []; + } + if (!healthy.length) throw new Error(`${PROJECT}: no endpoint serves ledger ${ledgerIndex}`) + return healthy +} - const { errors } = await PromisePool.withConcurrency(4) - .for(poolAddresses) - .process(async (pool) => { +async function readPools(accounts, ledgerIndex) { + const pools = [] + const deleted = [] + let pending = accounts + for (let pass = 1; pass <= 3 && pending.length; pass++) { + if (pass > 1) await sleep(30_000) + const failed = [] + await PromisePool.withConcurrency(CONCURRENCY).for(pending).process(async (account) => { try { - await sleep(RATE_LIMIT_DELAY_MS); - - const { token0, token1 } = await getReserveDatas(pool, atLedgerIndex); - poolsWithReserves.push({ - pool: pool.account, - token0Reserve: token0, - token1Reserve: token1, - }); - } catch (error) { - console.error("Errors occurred while fetching reserves:", error); + const { amm } = await xrpl.rpc('amm_info', { amm_account: account }, { ledgerIndex, timeout: RPC_TIMEOUT }) + pools.push({ account, amount: amm.amount, amount2: amm.amount2 }) + } catch (e) { + // amm_info answers actMalformed for an account that is not (or no longer) an AMM + if (e?.error === 'actNotFound' || e?.error === 'actMalformed') deleted.push(account) + else failed.push(account) } - }); - - if (errors?.length) console.log(errors) - if (errors.length > 0) throw errors[0] - - return poolsWithReserves; -}; - -const getXrplPools = async () => { - const timeNow = getTimeNow() - const startOfDay = Math.floor(new Date().setUTCHours(0, 0, 0, 0) / 1000); - let { pools: cachedPools = [], marker: lastMarker = null, lastUpdate = 0 } = await getCache('xrpl-dex', 'pools'); - - if (lastUpdate >= startOfDay && cachedPools?.length > MIN_POOL_SIZE) { - console.log(`Pools have already been updated today. Last update: ${new Date(lastUpdate * 1000).toISOString()}`); - return; - } - - console.time("xrpl-dex fetch pool list") - - try { - const pools = await getPools(null, 1); - console.timeEnd("xrpl-dex fetch pool list"); - console.log("Total pools fetched:", pools.length); - const finalMarker = pools.marker || lastMarker - - await setCache('xrpl-dex', 'pools', { pools, marker: finalMarker, lastUpdate: timeNow }); - } catch (error) { - console.error("Error during XRPL pool fetching:", error.message); - console.timeEnd("xrpl-dex fetch pool list"); + }) + console.log(`${PROJECT}: pass ${pass}: ${pools.length} read, ${deleted.length} deleted, ${failed.length} failed`) + pending = failed } + if (pending.length) throw new Error(`${PROJECT}: ${pending.length} pools unread after 3 passes (${pending.slice(0, 5).join(', ')})`) + if (deleted.length > accounts.length * MAX_DELETED_SHARE) + throw new Error(`${PROJECT}: ${deleted.length} of ${accounts.length} pools reported deleted, more than ${MAX_DELETED_SHARE * 100}%`) + return pools } -const getXrplBalances = async (pools) => { - const timeNow = getTimeNow(); - const startOfDay = Math.floor(new Date().setUTCHours(0, 0, 0, 0) / 1000); - const { balanaces: _preBalances, lastUpdate = 0 } = await getCache('xrpl-dex', 'balances') || {}; +async function tvl(api) { + const accounts = await listPools() + if (accounts.length < MIN_POOLS) throw new Error(`${PROJECT}: only ${accounts.length} pools listed`) - if (lastUpdate >= startOfDay && _preBalances?.length > MIN_POOL_SIZE) { - console.log(`Balances have already been updated today. Last update: ${new Date(lastUpdate * 1000).toISOString()}`); - return; - } - - console.time("Fetching balances for pools"); + const latest = await xrpl.getLatestLedger() + const ledger = await xrpl.getLedger({ ledgerIndex: latest.number - LEDGER_LAG }) + const endpoints = await pickEndpoints(ledger.number) + console.log(`${PROJECT}: ${accounts.length} pools listed, ledger ${ledger.number}, endpoints: ${endpoints.join(' ')}`) + // the sdk reads the endpoint list from env on every call, restore it since the runner shares the process + const previous = process.env.XRPL_WHITELISTED_RPC + process.env.XRPL_WHITELISTED_RPC = endpoints.join(',') + let pools try { - const balances = await getAllReservesDatas(pools); - console.timeEnd("Fetching balances for pools"); - await setCache('xrpl-dex', 'balances', { balances, lastUpdate: timeNow }); - return balances; - } catch (error) { - console.error("Error during balances fetching:", error.message); + pools = await readPools(accounts, ledger.number) + } finally { + if (previous === undefined) delete process.env.XRPL_WHITELISTED_RPC + else process.env.XRPL_WHITELISTED_RPC = previous } -}; - -const main = async () => { - await getXrplPools(); - const { pools = [] } = await getCache('xrpl-dex', 'pools'); - const seen = new Set(); - const uniquePools = pools.filter(pool => seen.has(JSON.stringify(pool)) ? false : seen.add(JSON.stringify(pool))); - await getXrplBalances(uniquePools) -}; + if (pools.length < MIN_POOLS) throw new Error(`${PROJECT}: only ${pools.length} pools read`) + + const data = pools.map(({ amount, amount2 }) => { + const [token0, token0Bal] = parseSide(amount) + const [token1, token1Bal] = parseSide(amount2) + return { token0, token0Bal, token1, token1Bal } + }).filter((p) => p.token0Bal > 0 && p.token1Bal > 0) // an emptied AMM keeps its account until AMMDelete + if (data.length < MIN_POOLS) throw new Error(`${PROJECT}: only ${data.length} of ${pools.length} pools have reserves`) + + const { XRP: xrp = 0, [RLUSD]: rlusd = 0 } = transformDexBalances({ chain: api.chain, coreTokens: new Set(['XRP', RLUSD]), data }) + api.addCGToken('ripple', xrp) + if (rlusd) api.add(RLUSD, rlusd * 10 ** RLUSD_DECIMALS) + console.log(`${PROJECT}: ledger ${ledger.number} closed ${new Date(ledger.timestamp * 1000).toISOString()}, ${data.length} of ${pools.length} pools valued`) + return api.getBalances() // the custom-scripts runner stores what tvl returns +} -main().catch(console.error).finally(() => process.exit(0)); \ No newline at end of file +module.exports = { + timetravel: false, + ripple: { tvl }, +} diff --git a/projects/xrpl-dex/index.js b/projects/xrpl-dex/index.js index 05c9820c042..4d060f8894f 100644 --- a/projects/xrpl-dex/index.js +++ b/projects/xrpl-dex/index.js @@ -1,26 +1,9 @@ -const { getCache } = require("../helper/cache"); -const { transformDexBalances } = require("../helper/portedTokens"); - -const tvl = async (api) => { - const { balances = [] } = await getCache('xrpl-dex', 'balances'); - if (balances.length < 9500) throw new Error('No balances found') - - const tvl = transformDexBalances({ - chain: 'ripple', - data: balances - .filter(i => i.token0Reserve && i.token1Reserve) - .map(i => ({ - token0: i.token0Reserve.currency, - token0Bal: i.token0Reserve.amount, - token1: i.token1Reserve.currency, - token1Bal: i.token1Reserve.amount, - })) - }) - api.addCGToken('ripple', tvl?.XRP / 1e6) -} +const { getExports } = require('../helper/heroku-api') +// balances are computed by ./api.js in the custom-scripts runner (bulky group) and read back from elastic module.exports = { - methodology: "Finds all AMM pools on XRPL, checks their reserves, calculates TVL (in XRP) for each pool and sums them up.", - ripple: { tvl }, + timetravel: false, misrepresentedTokens: true, -}; \ No newline at end of file + methodology: 'Sums the reserves of every AMM pool on the XRP Ledger (XLS-30), read with amm_info at one validated ledger by a scheduled job. XRP and RLUSD are priced directly, and a pool with one priced asset counts that side twice. Other tokens are converted at the price of their deepest pool against XRP or RLUSD, capped as in other DEX adapters. Order-book offers are not counted: offer funds stay in the owner account and are not locked.', + ...getExports('xrpl-dex', ['ripple']), +} diff --git a/projects/xrpl-dex/package-lock.json b/projects/xrpl-dex/package-lock.json deleted file mode 100644 index f55185a8570..00000000000 --- a/projects/xrpl-dex/package-lock.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "name": "xrpl-dex", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "xrpl-dex", - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "ripple-binary-codec": "^2.1.0", - "xrpl": "^4.0.0" - } - }, - "node_modules/@noble/curves": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", - "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", - "license": "MIT", - "dependencies": { - "@noble/hashes": "1.5.0" - }, - "engines": { - "node": "^14.21.3 || >=16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@noble/hashes": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", - "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", - "license": "MIT", - "engines": { - "node": "^14.21.3 || >=16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@scure/base": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", - "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", - "license": "MIT", - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@scure/bip32": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.5.0.tgz", - "integrity": "sha512-8EnFYkqEQdnkuGBVpCzKxyIwDCBLDVj3oiX0EKUFre/tOjL/Hqba1D6n/8RcmaQy4f95qQFrO2A8Sr6ybh4NRw==", - "license": "MIT", - "dependencies": { - "@noble/curves": "~1.6.0", - "@noble/hashes": "~1.5.0", - "@scure/base": "~1.1.7" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@scure/bip39": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.4.0.tgz", - "integrity": "sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==", - "license": "MIT", - "dependencies": { - "@noble/hashes": "~1.5.0", - "@scure/base": "~1.1.8" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@xrplf/isomorphic": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@xrplf/isomorphic/-/isomorphic-1.0.1.tgz", - "integrity": "sha512-0bIpgx8PDjYdrLFeC3csF305QQ1L7sxaWnL5y71mCvhenZzJgku9QsA+9QCXBC1eNYtxWO/xR91zrXJy2T/ixg==", - "dependencies": { - "@noble/hashes": "^1.0.0", - "eventemitter3": "5.0.1", - "ws": "^8.13.0" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@xrplf/secret-numbers": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@xrplf/secret-numbers/-/secret-numbers-1.0.0.tgz", - "integrity": "sha512-qsCLGyqe1zaq9j7PZJopK+iGTGRbk6akkg6iZXJJgxKwck0C5x5Gnwlb1HKYGOwPKyrXWpV6a2YmcpNpUFctGg==", - "license": "ISC", - "dependencies": { - "@xrplf/isomorphic": "^1.0.0", - "ripple-keypairs": "^2.0.0" - } - }, - "node_modules/bignumber.js": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", - "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", - "engines": { - "node": "*" - } - }, - "node_modules/eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" - }, - "node_modules/ripple-address-codec": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-5.0.0.tgz", - "integrity": "sha512-de7osLRH/pt5HX2xw2TRJtbdLLWHu0RXirpQaEeCnWKY5DYHykh3ETSkofvm0aX0LJiV7kwkegJxQkmbO94gWw==", - "dependencies": { - "@scure/base": "^1.1.3", - "@xrplf/isomorphic": "^1.0.0" - }, - "engines": { - "node": ">= 16" - } - }, - "node_modules/ripple-binary-codec": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-2.1.0.tgz", - "integrity": "sha512-q0GAx+hj3UVcDbhXVjk7qeNfgUMehlElYJwiCuIBwqs/51GVTOwLr39Ht3eNsX5ow2xPRaC5mqHwcFDvLRm6cA==", - "dependencies": { - "@xrplf/isomorphic": "^1.0.1", - "bignumber.js": "^9.0.0", - "ripple-address-codec": "^5.0.0" - }, - "engines": { - "node": ">= 16" - } - }, - "node_modules/ripple-keypairs": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ripple-keypairs/-/ripple-keypairs-2.0.0.tgz", - "integrity": "sha512-b5rfL2EZiffmklqZk1W+dvSy97v3V/C7936WxCCgDynaGPp7GE6R2XO7EU9O2LlM/z95rj870IylYnOQs+1Rag==", - "license": "ISC", - "dependencies": { - "@noble/curves": "^1.0.0", - "@xrplf/isomorphic": "^1.0.0", - "ripple-address-codec": "^5.0.0" - }, - "engines": { - "node": ">= 16" - } - }, - "node_modules/ws": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", - "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/xrpl": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xrpl/-/xrpl-4.0.0.tgz", - "integrity": "sha512-VZm1lQWHQ6PheAAFGdH+ISXKvqB2hZDQ0w4ZcdAEtmqZQXtSIVQHOKPz95rEgGANbos7+XClxJ73++joPhA8Cw==", - "license": "ISC", - "dependencies": { - "@scure/bip32": "^1.3.1", - "@scure/bip39": "^1.2.1", - "@xrplf/isomorphic": "^1.0.1", - "@xrplf/secret-numbers": "^1.0.0", - "bignumber.js": "^9.0.0", - "eventemitter3": "^5.0.1", - "ripple-address-codec": "^5.0.0", - "ripple-binary-codec": "^2.1.0", - "ripple-keypairs": "^2.0.0" - }, - "engines": { - "node": ">=18.0.0" - } - } - } -} diff --git a/projects/xrpl-dex/package.json b/projects/xrpl-dex/package.json deleted file mode 100644 index ea7ef196a40..00000000000 --- a/projects/xrpl-dex/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "xrpl-dex", - "version": "1.0.0", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "MIT", - "description": "", - "dependencies": { - "ripple-binary-codec": "^2.1.0", - "xrpl": "^4.0.0" - } -} diff --git a/projects/xrpl-dex/run.sh b/projects/xrpl-dex/run.sh deleted file mode 100644 index 6f1fe596c7f..00000000000 --- a/projects/xrpl-dex/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -npm i -cd .. && npm i && cd xrpl-dex -node api.js \ No newline at end of file From af74b3f24ca3a73e22e7eb1a55194110fe914868 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 9 Nov 2026 14:21:16 +0100 Subject: [PATCH 651/988] update @defillama/sdk version --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 60ca5e72115..8690b49f664 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", - "@defillama/sdk": "5.0.249", + "@defillama/sdk": "5.0.250", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", "@supercharge/promise-pool": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9e6524068f9..9dd1daa97fc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^0.30.1 version: 0.30.1(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) '@defillama/sdk': - specifier: 5.0.249 - version: 5.0.249(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) + specifier: 5.0.250 + version: 5.0.250(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) '@project-serum/anchor': specifier: ^0.26.0 version: 0.26.0(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -269,8 +269,8 @@ packages: peerDependencies: '@solana/web3.js': ^1.68.0 - '@defillama/sdk@5.0.249': - resolution: {integrity: sha512-1hCf9Nj+QDUNiGO0NlRbjr0zYzpkCvfNVbzUtLVa+AMnrPlNC2q1wcCx1hPmxrSizmCMmTKRmpct8Zdg35Pomw==} + '@defillama/sdk@5.0.250': + resolution: {integrity: sha512-h6CidP6PlYJ1Q2j7e3GBC3MzbzhgkLpKC6jAxENyAmCTMBZi+GGl+5wXvLx2g3JLo7zUkHqxwRqthJ2HqAJ9+Q==} peerDependencies: '@solana/web3.js': '>=1.73.0' peerDependenciesMeta: @@ -1942,7 +1942,7 @@ snapshots: bn.js: 5.2.2 buffer-layout: 1.2.2 - '@defillama/sdk@5.0.249(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': + '@defillama/sdk@5.0.250(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': dependencies: '@aws-sdk/client-s3': 3.913.0 '@elastic/elasticsearch': 8.19.1(supports-color@7.2.0) From 3dc4502eb50a5c705ef66dff547e8e7f53baa3f8 Mon Sep 17 00:00:00 2001 From: arkhampad Date: Mon, 9 Nov 2026 16:36:37 +0300 Subject: [PATCH 652/988] Add ArkhamPad (Elysium) (#22040) Co-authored-by: FelixBruguera --- projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 4 ++++ registries/uniswapV3.js | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 247f30d5462..5fd384b8c74 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -157,6 +157,7 @@ "elrond", "elsm", "elys", + "elysium", "embr", "empire", "energi", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index dd61e10b9e0..ec2ac3e2274 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -62,6 +62,10 @@ const fixBalancesTokens = { platon: { [ADDRESSES.null]: { coingeckoId: 'platon-network', decimals: 18 }, }, + // Elysium (Kinetiq's Hyperliquid L2): wrapped HYPE used by ArkhamPad pools + elysium: { + '0x43ca3cee078d8cb8528915b16e8bdcc9adbe6090': { coingeckoId: 'hyperliquid', decimals: 18 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index e8b2f66969f..c54c9dd96e4 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1968,7 +1968,11 @@ const uniV3Configs = { 'vectaswap': { arbitrum: { factory: '0xe84FA17C2Ea423E0dea3C986EE3E1560D684bb2d', fromBlock: 518470299}, base: { factory: '0xe84FA17C2Ea423E0dea3C986EE3E1560D684bb2d', fromBlock: 53245146} - } + }, + 'arkhampad': { + methodology: 'TVL is the value of tokens held in ArkhamPad launch pools (Uniswap v3 style pools created by the ArkhamPad factory on Elysium). Launch liquidity is locked forever.', + elysium: { factory: '0x75656d8d2A59293DBdA4178F11Af6EE506ef60dD', fromBlock: 65264 }, + }, } module.exports = buildProtocolExports(uniV3Configs, uniV3Export) From 904b189539bbee8ae15ecc3e8319f5b2c933cd3b Mon Sep 17 00:00:00 2001 From: justin <1539088+justingreenberg@users.noreply.github.com> Date: Mon, 9 Nov 2026 08:52:46 -0500 Subject: [PATCH 653/988] Add Elysium Kinetiq chain (#22090) Co-authored-by: Define101 <93603962+Define101@users.noreply.github.com> --- projects/helper/coreAssets.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index bc13167bc8f..8e7ca8388d9 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -2929,5 +2929,13 @@ }, "pentagonchain": { "WPC": "0xAA3d9411DD08FDA149d4545089e241E62EE87860" + }, + "elysium": { + "WHYPE": "0xbA876237B0F021A6c6D852d6c26E107997cC5E81", + "kHYPE": "0x248888D396A546A69A188f3Deb476964e581E9d0", + "USDC": "0xb47c4C8F73F009CC0C0d3f92B388d13E293F0B65", + "USDT0": "0x3BdE42a1dA8F1D95564f2c4a51a0cF73a725674C", + "UBTC": "0xE9C29585EAe4B9a55b02a9605AEa892B40d972E8", + "UETH": "0x7A66A75fe41Bc26867C17fe1bc7D1C076EBd4eCd" } -} \ No newline at end of file +} From 089b01edf33c2ee65b8b2f0b9bbcf1f431f756ee Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 9 Nov 2026 11:13:50 -0400 Subject: [PATCH 654/988] add elysium to ramses (#22100) --- registries/traderJoeV2.js | 1 + registries/uniswapV2.js | 1 + registries/uniswapV3.js | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/registries/traderJoeV2.js b/registries/traderJoeV2.js index 9b0f02fcfce..4b8ee85c02b 100644 --- a/registries/traderJoeV2.js +++ b/registries/traderJoeV2.js @@ -82,6 +82,7 @@ const configs = { }, 'ramses-dlmm': { robinhood: '0xdcD5F77697914E27f56FD263EF82923C8524AbAc', + elysium: '0xF31632C73B8775e45Ce6d2539dEb008cB766D51b', }, 'hoodit': { robinhood: '0x22602d966DeFd638ee94E97A92e2Eb0934c3fE1B', diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index 198bbe28299..19ff9b2af1f 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -2787,6 +2787,7 @@ const uniV2Configs = { arbitrum: '0xADd32480630A16dfAcEe6eeFcB3ab2181449Dc3B', polygon: '0xA87c8308722237F6442Ef4762B7287afB84fB191', robinhood: '0x43B2Bf9f33036a02fC7A00935571c2A6b0108e66', + elysium: "0x088703700f4FA35BF9EABc8CDbCeAD3678432779", }, 'raphael': { misrepresentedTokens: true, diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index c54c9dd96e4..bcf3da665d7 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1218,6 +1218,10 @@ const uniV3Configs = { factory: '0xE0c4ceb92d08CA985bB70fe0a22fEb121A9854A8', fromBlock: 15761673, }, + elysium: { + factory: '0x29cd8852FF040CfE74fb20277A121eD1293AFb41', + fromBlock: 61399, + } }, 'reservoir-tools-v3': { abstract: { From 69822c86ee09eb23c0b24ab2cff9d1f3b2244012 Mon Sep 17 00:00:00 2001 From: saurabh sharma <146759278+0x-saurabh@users.noreply.github.com> Date: Mon, 9 Nov 2026 22:01:57 +0530 Subject: [PATCH 655/988] Add Kyte: fully collateralised options on Robinhood Chain (#22099) --- projects/kyte/index.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 projects/kyte/index.js diff --git a/projects/kyte/index.js b/projects/kyte/index.js new file mode 100644 index 00000000000..280534fbc47 --- /dev/null +++ b/projects/kyte/index.js @@ -0,0 +1,40 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// Kyte: fully collateralised call and put options on Robinhood Chain. Every option is backed 1:1 at creation: +// a covered call locks the underlying token in CallMarket, a cash-secured put locks the full strike in WETH in +// PutMarket. Collateral only ever moves to the seller (expiry, cancel) or the holder (exercise). Older market +// versions still hold collateral for options that were open when the contracts were upgraded, so they are summed too. +const ASSET_REGISTRY = '0xcD076486FBd192e2E942dA9DB2B78817DF0d5235' // every token options can be written on +const CALL_MARKETS = [ + '0x459cF18A424271A417547F6B349e962c09e492EE', // current + '0xb6759D8893601BB7c1A032eC8ea40C856a6adf80', // v3 + '0x15B5d324960234B193246B122C555e88E341eD72', // v2 +] +const PUT_MARKETS = [ + '0xD1a3c2Fa0E7901437929B7518AD66d71B1d676a4', // current + '0x2E2d5DfB4cf30d15688Cc2DDD30641c78DFfcb35', // v3 + '0x1025f5b1f7549a1192226ddC0D36E1359A8D1305', // v2 +] +const STAKING_POOL = '0xD7253a90fd43507F44cF0934F3D5d7432760d17f' +const KYTE = '0x072D88c2F31F568C0F4B8F613692eB489541Ed45' + +async function tvl(api) { + const count = await api.call({ abi: 'uint256:assetCount', target: ASSET_REGISTRY }) + const tokens = await api.multiCall({ + abi: 'function listedTokens(uint256) view returns (address)', + calls: Array.from({ length: Number(count) }, (_, i) => ({ target: ASSET_REGISTRY, params: [i] })), + }) + await api.sumTokens({ owners: CALL_MARKETS, tokens }) + return api.sumTokens({ owners: PUT_MARKETS, tokens: [ADDRESSES.robinhood.WETH] }) +} + +async function staking(api) { + return api.sumTokens({ owner: STAKING_POOL, tokens: [KYTE] }) +} + +module.exports = { + methodology: + 'TVL is the collateral locked behind open options on Robinhood Chain: the underlying tokens held by the CallMarket contracts (covered calls) and the WETH held by the PutMarket contracts (cash-secured puts). The token list is read from the on-chain AssetRegistry. Staking is the $KYTE locked in the StakingPool, which receives 30% of protocol fees.', + start: '2026-11-01', + robinhood: { tvl, staking }, +} From 9eccfaacec6e29feb9bd9b8147e0753bfabb841e Mon Sep 17 00:00:00 2001 From: Product-ES <160380537+0xKeepBuilding@users.noreply.github.com> Date: Tue, 10 Nov 2026 00:38:23 +0800 Subject: [PATCH 656/988] Add ipUSD (Stablecoin Wrapper on Soneium) (#22098) Co-authored-by: adam --- registries/sumTokens/data3.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 5d6d6d79ffd..39ccb3f19da 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1301,4 +1301,18 @@ module.exports = { "solOwners": ["6ShdjduDkwcBi9jEeYQFbAvsqUGgYrX2ASxjfHypEkYa"] }, }, + "ipusd": { + "methodology": "ipUSD reserves (USDSC and USDC.e held by the IPUSDWrapper contract) plus the reserve assets backing sIPUSD, the yield-bearing version of ipUSD (PGIP+ held by the IP Vault contract). ipUSD held inside the IP Vault is excluded to avoid counting the same reserves twice.", + "start": "2026-10-24", + "soneium": { + "tvl": { + "tokensAndOwners": [ + ["0x3f99231dD03a9F0E7e3421c92B7b90fbe012985a", "0xef63d926A0d15e6e7d96d767665f9312Cb7993C4"], + ["0xbA9986D2381edf1DA03B0B9c1f8b00dc4AacC369", "0xef63d926A0d15e6e7d96d767665f9312Cb7993C4"], + ["0x0D90a6eE85d5668734bb3A515147f53EBDfE866c", "0x2Ba3FC5BDbBE7BE2630fB71e759739625246bCd9"] + ] + } + } + }, + } From c0af367b3edce3206c84b4f84f3188c8f250b162 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 9 Nov 2026 14:26:35 -0400 Subject: [PATCH 657/988] add elysium to uniswap (#22104) --- projects/uniswap-v2/index.js | 1 + projects/uniswap-v4/index.js | 1 + projects/uniswap/index.js | 1 + 3 files changed, 3 insertions(+) diff --git a/projects/uniswap-v2/index.js b/projects/uniswap-v2/index.js index f1cc433362f..510d8af4491 100644 --- a/projects/uniswap-v2/index.js +++ b/projects/uniswap-v2/index.js @@ -29,6 +29,7 @@ const config = { ink: '0xfe57a6ba1951f69ae2ed4abe23e0f095df500c04', arc: '0x89e5db8b5aa49aa85ac63f691524311aeb649eba', wc: '0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f', + elysium: '0xBbBcC62853a5fA27b93d6Bab3E6F7ce841E25Df2', } Object.keys(config).forEach(chain => { diff --git a/projects/uniswap-v4/index.js b/projects/uniswap-v4/index.js index 049cfee9886..7bb5bafd66d 100644 --- a/projects/uniswap-v4/index.js +++ b/projects/uniswap-v4/index.js @@ -33,6 +33,7 @@ const config = { celo: { factory: "0x288dc841a52fca2707c6947b3a777c5e56cd87bc", fromBlock: 43985163 }, hyperliquid: { factory: "0x12d4fd9c5dedd00ab8a0bce2cf0167bbf94b6b1f", fromBlock: 45998366 }, linea: { factory: "0x248083fb965359d82b06c1f5322480dcfc1ad857", fromBlock: 28974969 }, + elysium: { factory: "0xE2e105d3F7209A9DA11f83cCf3E7398a753823F1", fromBlock: 256083 }, soneium: { factory: "0x360e68faccca8ca495c1b759fd9eee466db9fb32", fromBlock: 2473300, useIndexerSql: true }, avax: { factory: "0x06380c0e0912312b5150364b9dc4542ba0dbbc85", fromBlock: 56195376, useIndexerSql: true }, bsc: { factory: "0x28e2ea090877bf75740558f6bfb36a5ffee9e9df", fromBlock: 45970610, useIndexerSql: true, blacklistedTokens: ['0xb4357054c3dA8D46eD642383F03139aC7f090343', '0x8145eb83744aac883b68ae34060bebb5031d8f5c', diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index bc98c8dae83..18fcf9e7521 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -89,6 +89,7 @@ const uniV3Config = { robinhood: { factory: '0x1f7d7550B1b028f7571E69A784071F0205FD2EfA', fromBlock: 8930 }, ink: { factory: '0x640887A9ba3A9C53Ed27D0F7e8246A4F933f3424', fromBlock: 284117 }, arc: { factory: '0xf0db7b58379503491d857db50ac9ece64c653918', fromBlock: 1946500 }, + elysium: { factory: '0x1707327F626496A7b5b3872e7E4d2879Df7d7a9f', fromBlock: 256055 }, } Object.keys(uniV3Config).forEach(chain => { From 6f8b9a07f154969cead393683db9a2ec3526e6af Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 9 Nov 2026 14:46:05 -0400 Subject: [PATCH 658/988] add elysium to nest v2 (#22105) --- registries/uniswapV2.js | 1 + 1 file changed, 1 insertion(+) diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index 19ff9b2af1f..d43d9bf2112 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -1395,6 +1395,7 @@ const uniV2Configs = { hasStablePools: true, }, hyperliquid: '0x889fd0ada8453c7619cd7f11e9029a1f0848fdf5', + elysium: '0x8b3f6eb2C9BFBEE74CFc5372EB88A6353EA0a887', }, 'netswap': { metis: '0x70f51d68D16e8f9e418441280342BD43AC9Dff9f', From f3be957b22fe5216501764fb7ebb55954ea716d5 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 9 Nov 2026 15:49:00 -0400 Subject: [PATCH 659/988] add elysium to aero (#22107) --- projects/aero-lite/index.js | 1 + projects/aero-v2/index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/aero-lite/index.js b/projects/aero-lite/index.js index 195d8cf9a6c..bd014872de6 100644 --- a/projects/aero-lite/index.js +++ b/projects/aero-lite/index.js @@ -19,6 +19,7 @@ const config = { ethereum: {factories: ['0xF4Fd2E6c5B60c5b365cd1B96DD6245E6D60414c2']}, ink: {factories: ['0x7660BF2aDefC687C22906112ca323d60A00358cF']}, robinhood: {factories: ['0xc63d7338c178e805c544B8f897066bD3BBcBE136']}, + elysium: {factories: ['0xEfd7A089D3057F05189B05f74Ffcf30610c42891']}, } const exportsList = [] diff --git a/projects/aero-v2/index.js b/projects/aero-v2/index.js index 04c94d6be3f..4c3fa968e80 100644 --- a/projects/aero-v2/index.js +++ b/projects/aero-v2/index.js @@ -8,7 +8,7 @@ const abis = { const stableTvl = uniTvlExport('chain', "0x78589E876edcEbdce72ee3436ab3c9AD3a7cEF2D", { abis, hasStablePools: true, permitFailure: true, useDefaultCoreAssets: false, }).chain.tvl const volatileTvl = uniTvlExport('chain', "0x8E6a9FCd1d638CC760Ffba397605Fe3355dE76D2", { abis, permitFailure: true, }).chain.tvl -const chains = ['optimism', 'base', 'arc', 'arbitrum', 'ethereum', 'ink', 'robinhood'] +const chains = ['optimism', 'base', 'arc', 'arbitrum', 'ethereum', 'ink', 'robinhood', 'elysium'] module.exports = { misrepresentedTokens: true, From 107d4511d06c4a3bd6bcd5a86e9de29fd09fbff5 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 9 Nov 2026 16:22:16 -0400 Subject: [PATCH 660/988] Btcd update (#22109) Co-authored-by: z-j-lin Co-authored-by: Claude Opus 5.5 --- projects/btcd/index.js | 340 ++++++++++++++++++++++++++++++----------- 1 file changed, 253 insertions(+), 87 deletions(-) diff --git a/projects/btcd/index.js b/projects/btcd/index.js index 66961e91708..03d849cbf81 100644 --- a/projects/btcd/index.js +++ b/projects/btcd/index.js @@ -1,21 +1,62 @@ +const sdk = require('@defillama/sdk'); const { sumTokens2 } = require('../helper/unwrapLPs'); const ADDRESSES = require('../helper/coreAssets.json') -// ─────────────────────────── Ethereum Static custody owners ─────────────────── +// ─────────────────────────── Ethereum strategy discovery ────────────────────── +// The engine Multicall only calls targets it has authorized, so its target list +// is the live set of strategy position managers. Each one names itself through +// TYP(), formatted ":::". +const ENGINE_MULTICALL = '0x18f1FAC179feB0ee44F339a616feFb979A6961BE'; + +// ─────────────────────────── Ethereum static custody ────────────────────────── +// Reserve contracts swept for idle tokens. Strategy targets are added at run +// time; targets without a TYP are not swept, so an authorized third-party +// contract can never be counted as BTCD collateral. const STATIC_CUSTODY = [ '0xD22FFF18B5E25EF1f07F8E194b89966652d44f5b', // BTCDMinting - '0x700ac5F087468a253920818e662f08AD7d991AF5', // VaultMinting + '0xc60F6892973934C93AdE915d5c249f10d4eCE7b4', // VaultMinting + '0x613cB55810C0BA4262bBB18Bc31900a6BbFc6fc3', // BridgeManager (in-transit to Arbitrum) + '0x523f6B7C7B314228f0dE8C9924B8b8C8C08a2BFf', // YieldBasis hybrid position manager + '0x0601E1B0d579441A90c07cC8077C7D36b3EF23f7', // YieldBasis hybrid vault (scrvUSD backing leg) +]; + +// ─────────────────────────── YieldBasis hybrid sleeve ───────────────────────── +// The hybrid vault custodies one YieldBasis LT per BTC market. It is driven by +// its own actor, not the Multicall. +const YB_HYBRID_VAULT = '0x0601E1B0d579441A90c07cC8077C7D36b3EF23f7'; +const YB_HYBRID_LTS = [ + '0x651D4b8168488FA163D85304662E8278d4c55BAa', // yb-WBTC + '0x722FC3640BA007C3E9867CCdB0dCa59F2e2F29F9', // yb-cbBTC + '0x771F7290428d830ECd41E980745c327e507823Ec', // yb-tBTC ]; -// ──────────────────────── Ethereum Driver (strategy) addresses ──────────────── -const DRV_CURVE_HEMI = '0x7c82B4A667bf5DD6a58DBFDb34ac3A4E0D2C6543'; // CURVE:WBTCCBBTCHEMIBTCTRIPOOL:WBTC:0 -const DRV_MORPHO_SBTCD = '0x24313a5DB051E08e8064582F8a5e2F5C52968319'; // MORPHOBLUE:SBTCDWBTC:WBTC:0 -const DRV_YIELD_BASIS = '0x174A18b8fdf9ae3ff5e841b69cA9A57D2EBFCA59'; // YIELDBASIS:WBTC:WBTC:0 -const DRV_AAVE_CARRY = '0x7457Af3cbc75e30042BF1B7dA69cabc5D5563E4b'; // AAVECARRY:SBTCDWBTC:USDC:0 -const DRV_CURVE_SUSDE = '0x81Ae2ce1a7af582E1f186C0D88415Fd752EAe814'; // CURVE:SUSDESUSDS:USDC:0 -const DRV_FLUID_LITE = '0xfDD0224cC556aF301E06D46bbe27b5298d25A0F9'; // FLUIDLITE:LITEUSD:USDC:0 -const DRV_SUSDS = '0x344E78a1B267c19DfD6D53838E8815AC54e2Cf58'; // SUSDS:sUSDS:USDC:0 -const DRV_UNIV4_SYRUP = '0xdE128F649634e7B3e4b6c372836d38F435DA9Ba3'; // UNIV4SWAP:SYRUPUSDC:USDC:0 +// ─────────────────────────── Strategies without position getters ───────────── +// Stake DAO and Morpho carry position managers expose only TYP(), so their +// venue is looked up by the TYP investment name. A strategy missing here is +// skipped (its idle tokens are still counted). +const STAKEDAO_VAULTS = { + FRXUSDSUSDS: '0x5E1DACDBEF6bcEba53600d0BcE33FD30EE09fA82', + FRXUSDDUSD: '0x6ea128D83bc4223A0d1e6E475CEE85998AcB6337', + FRXUSDUSD3: '0xcad206958a16080eDe0b1e9245D6689554Ed5600', + FRXUSDSUSDE: '0xE70Fc8fFb97f6D539E5d50F657F4AAe69F01B87D', + WBTCCBBTCHEMIBTCTRIPOOL: '0x3C69C2F6852C65CDD8e02C4FdA1A7221CB79DDd5', + CBBTCWBTC: '0x3bf225861cbB865A0aBeccC8ba924748118276f3', + VUSDCRVUSD: '0x102A475c8d660fDe678D108DCc6D4A2227661AF2', + CRVUSDUSDC: '0xD4467fBCBd3511112D2FD1af667E745D4987C8eb', + PYUSDCRVUSD: '0x0F67C05A034fEC0183ad74d3be42c8Ba27F6c4c4', + SCRVUSDSUSDE: '0xABf0973EC993be9F0151cFe4CD03A87c3CC7f638', + USD3SCRVUSD: '0x7b303cF6124A74a867C99889d39278Bc63e1054B', + REUSDSCRVUSD: '0xC5F79C63715cc7F3d65818b6b7B585Eb5b00AA74', + USDTUSDE: '0x238A772cf271eb8bB7b75B91F102FC854F043542', +}; +// Morpho carry: WBTC collateral on a Morpho Blue market, the borrowed loan +// token deployed to an ERC-4626 vault. +const MORPHOCARRY_VENUES = { + FLUIDLITE: { + marketId: '0x3a85e619751152991742810df6ec69ce473daef99e28a64ab2340d7b7ccfee49', // WBTC/USDC + vault: '0x273DA948ACa9261043fbdb2a857BC255ECC29012', // fLiteUSD + }, +}; // ─────────────────────────── Arbitrum (GMX V2 sleeve) ───────────────────────── const ARBITRUM_GM_POSITION_MANAGER = '0xAf307925E44bbAc289C1EF6221a8Ae36B839f4d0'; @@ -24,92 +65,215 @@ const ARBITRUM_BRIDGE_OWNERS = [ '0xAa8DcD578f23A09065Aa6028Aa9c091554055c8A', // BridgeActor ]; -const ethTokens = [ +// Tokens counted by plain balanceOf on every custody contract and strategy +// target: idle reserves, funds in transit, and holdings DefiLlama prices +// directly (sUSDS for the SUSDS strategy, syrupUSDC for the UNIV4SWAP one, +// scrvUSD for the YieldBasis hybrid vault). +const idleTokens = [ ADDRESSES.ethereum.WBTC, ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDS, ADDRESSES.ethereum.sUSDS, - ADDRESSES.ethereum.cbBTC, + ADDRESSES.ethereum.USDe, ADDRESSES.ethereum.sUSDe, - '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c', // aEthUSDC - '0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b', // SYRUP - '0x06ea695B91700071B161A434fED42D1DcbAD9f00', // HEMIBTC - '0x66039342C66760874047c36943B1e2d8300363BB', // Curve HemiCbWBTC LP - '0x3CEf1AFC0E8324b57293a6E7cE663781bbEFBB79', // Curve sUSDeUSDS LP - '0xeCBcF829742987c0600e0ee1117a32d09451882E', // Curve HemiCbWBTC gauge - '0xc4316d27eC627E03BD4d176E570cD0018e6a0456', // Curve sUSDeUSDS gauge - '0x273DA948ACa9261043fbdb2a857BC255ECC29012', // fLiteUSD share token - '0x40aAbEf1aa8f0eEc637E0E7d92fbfFB2F26A8b7B', // variableDebtEthWBTC (debt) -]; - -// YB driver excluded — its full WBTC value is tracked via totalAssets() -const ethOwners = [ - ...STATIC_CUSTODY, - DRV_CURVE_HEMI, DRV_MORPHO_SBTCD, DRV_AAVE_CARRY, - DRV_CURVE_SUSDE, DRV_FLUID_LITE, DRV_SUSDS, DRV_UNIV4_SYRUP, + ADDRESSES.ethereum.cbBTC, + ADDRESSES.ethereum.tBTC, + ADDRESSES.ethereum.CRVUSD, + '0x0655977FEb2f289A4aB78af67BAB0d17aAb84367', // scrvUSD + '0xCAcd6fd266aF91b8AeD52aCCc382b4e165586E29', // frxUSD + '0x6c3ea9036406852006290770BEdFcAbA0e23A0e8', // PYUSD + '0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b', // syrupUSDC ]; // Morpho Blue uses virtual offsets on share<->asset conversion to prevent // inflation attacks; ignoring them leaves a sub-bp error vs the on-chain // value. Mirror the contract's constants. +const MORPHO_BLUE = '0xbbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb'; const MORPHO_VIRTUAL_ASSETS = 1n; const MORPHO_VIRTUAL_SHARES = 1000000n; // 1e6 -const morphoMarketAbi = 'function market(bytes32 id) view returns (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee)'; -const morphoPositionAbi = 'function position(bytes32 id, address user) view returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral)'; +const abi = { + getAuthorizedTargets: 'function getAuthorizedTargets() view returns (address[])', + TYP: 'function TYP() view returns (string)', + MARKET_ID: 'function MARKET_ID() view returns (bytes32)', + VAULT: 'function VAULT() view returns (address)', + POOL: 'function POOL() view returns (address)', + gauge: 'function gauge() view returns (address)', + LT: 'function LT() view returns (address)', + ASSET: 'function ASSET() view returns (address)', + A_USDC: 'function A_USDC() view returns (address)', + VARIABLE_DEBT_WBTC: 'function VARIABLE_DEBT_WBTC() view returns (address)', + previewWithdraw: 'function preview_withdraw(uint256 shares) view returns (uint256)', + ltAsset: 'function ASSET_TOKEN() view returns (address)', + convertToAssets: 'function convertToAssets(uint256 shares) view returns (uint256)', + asset: 'function asset() view returns (address)', + morphoMarket: 'function market(bytes32 id) view returns (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee)', + morphoPosition: 'function position(bytes32 id, address user) view returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral)', + morphoMarketParams: 'function idToMarketParams(bytes32 id) view returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv)', +}; -const MORPHO_BLUE = '0xbbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb'; -const SBTCD_WBTC_MARKET = '0xc2ab3fb4c64dc05d69a833cbedb82d6869d05135f3a164c0c7b844c8f0a3a220'; -const morphoSuppliers = [DRV_MORPHO_SBTCD, DRV_AAVE_CARRY] +// SkipStrategy marks a strategy this adapter cannot value; it is logged and +// left out instead of failing the chain's TVL. +class SkipStrategy extends Error {} /** - * Computes BTCD's Ethereum-mainnet TVL by aggregating on-chain collateral - * across custody contracts and strategy drivers. + * Returns the Morpho Blue position of `user` in market `marketId`: supplied + * and borrowed loan-token assets (shares converted with the virtual offsets; + * debt rounded up as Morpho does) and the posted collateral. + */ +async function morphoPosition(api, marketId, user) { + const pos = await api.call({ target: MORPHO_BLUE, abi: abi.morphoPosition, params: [marketId, user] }); + const market = await api.call({ target: MORPHO_BLUE, abi: abi.morphoMarket, params: [marketId] }); + const params = await api.call({ target: MORPHO_BLUE, abi: abi.morphoMarketParams, params: [marketId] }); + const supplyAssets = BigInt(market.totalSupplyAssets) + MORPHO_VIRTUAL_ASSETS; + const supplyShares = BigInt(market.totalSupplyShares) + MORPHO_VIRTUAL_SHARES; + const borrowAssets = BigInt(market.totalBorrowAssets) + MORPHO_VIRTUAL_ASSETS; + const borrowShares = BigInt(market.totalBorrowShares) + MORPHO_VIRTUAL_SHARES; + return { + loanToken: params.loanToken, + collateralToken: params.collateralToken, + supplied: (BigInt(pos.supplyShares) * supplyAssets) / supplyShares, + borrowed: (BigInt(pos.borrowShares) * borrowAssets + borrowShares - 1n) / borrowShares, + collateral: BigInt(pos.collateral), + }; +} + +/** + * Returns [asset, amount] for the ERC-4626 shares of `vault` held by `owner`, + * converted through the vault's own convertToAssets. + */ +async function erc4626Holding(api, vault, owner) { + const shares = await api.call({ target: vault, abi: 'erc20:balanceOf', params: [owner] }); + const asset = await api.call({ target: vault, abi: abi.asset }); + const amount = await api.call({ target: vault, abi: abi.convertToAssets, params: [shares] }); + return [asset, amount]; +} + +const balanceOf = (api, token, owner) => api.call({ target: token, abi: 'erc20:balanceOf', params: [owner] }); +const getter = (api, target, getterAbi) => api.call({ target, abi: getterAbi }); + +// Each valuer returns the [token, amount] holdings of one strategy position +// manager, excluding idle tokens (those are counted by the balanceOf sweep). +// Debt is a negative amount of the borrowed token. +const VALUERS = { + // WBTC supplied to the Morpho Blue market the PM names. + async MORPHOBLUE(api, { target }) { + const { loanToken, supplied } = await morphoPosition(api, await getter(api, target, abi.MARKET_ID), target); + return [[loanToken, supplied]]; + }, + // USDC supplied on Aave, minus the WBTC borrowed against it, plus that WBTC + // supplied to the PM's Morpho Blue market. + async AAVECARRY(api, { target }) { + const marketId = await getter(api, target, abi.MARKET_ID); + const aUsdc = await getter(api, target, abi.A_USDC); + const debtWbtc = await getter(api, target, abi.VARIABLE_DEBT_WBTC); + const { loanToken, supplied } = await morphoPosition(api, marketId, target); + const aUsdcBalance = await balanceOf(api, aUsdc, target); + const debt = await balanceOf(api, debtWbtc, target); + return [[loanToken, supplied], [ADDRESSES.ethereum.USDC, aUsdcBalance], [ADDRESSES.ethereum.WBTC, -BigInt(debt)]]; + }, + // WBTC collateral, minus the loan token borrowed against it, plus that loan + // token deployed to the venue vault. + async MORPHOCARRY(api, { target, investment }) { + const venue = MORPHOCARRY_VENUES[investment]; + if (!venue) throw new SkipStrategy('no venue in MORPHOCARRY_VENUES'); + const { loanToken, collateralToken, borrowed, collateral } = await morphoPosition(api, venue.marketId, target); + const vaultHolding = await erc4626Holding(api, venue.vault, target); + return [[collateralToken, collateral], [loanToken, -borrowed], vaultHolding]; + }, + // Shares of the ERC-4626 vault the PM names. + async MORPHOV2(api, { target }) { + return [await erc4626Holding(api, await getter(api, target, abi.VAULT), target)]; + }, + async FLUIDLITE(api, { target }) { + return [await erc4626Holding(api, await getter(api, target, abi.VAULT), target)]; + }, + // Stake DAO reward-vault shares, converted to the Curve LP token. + async STAKEDAO(api, { target, investment }) { + const vault = STAKEDAO_VAULTS[investment]; + if (!vault) throw new SkipStrategy('no vault in STAKEDAO_VAULTS'); + return [await erc4626Holding(api, vault, target)]; + }, + // Curve LP held directly and staked in the PM's gauge (1:1 LP). + async CURVE(api, { target }) { + const pool = await getter(api, target, abi.POOL); + const gauge = await getter(api, target, abi.gauge); + const held = await balanceOf(api, pool, target); + const staked = await balanceOf(api, gauge, target); + return [[pool, held], [pool, staked]]; + }, + // YieldBasis LT shares redeemed at the LT's preview_withdraw. + async YIELDBASIS(api, { target }) { + const lt = await getter(api, target, abi.LT); + const asset = await getter(api, target, abi.ASSET); + const shares = await balanceOf(api, lt, target); + if (BigInt(shares) === 0n) return []; + return [[asset, await api.call({ target: lt, abi: abi.previewWithdraw, params: [shares] })]]; + }, + // sUSDS and syrupUSDC are counted by the balanceOf sweep. + async SUSDS() { return []; }, + async UNIV4SWAP() { return []; }, +}; + +const isRevert = (e) => /revert|CALL_EXCEPTION/i.test(String(e && e.message)); + +/** + * Values one strategy position manager and adds its holdings. A strategy with + * no valuer, a missing venue entry, or a reverting read is logged and skipped + * so the rest of the chain's TVL still reports; other errors (RPC) propagate. + */ +async function addStrategyPosition(api, strategy) { + const valuer = VALUERS[strategy.protocol]; + try { + if (!valuer) throw new SkipStrategy('no valuation'); + const holdings = await valuer(api, strategy); + holdings.forEach(([token, amount]) => api.add(token, amount)); + } catch (e) { + if (!(e instanceof SkipStrategy) && !isRevert(e)) throw e; + sdk.log(`btcd: skipped ${strategy.typ} at ${strategy.target}: ${e instanceof SkipStrategy ? e.message : 'read reverted'}`); + } +} + +/** + * Adds the YieldBasis hybrid vault's LT shares, each redeemed at its LT's + * preview_withdraw. The vault's scrvUSD is counted by the balanceOf sweep. + */ +async function addYieldBasisHybrid(api) { + const ltShares = await api.multiCall({ abi: 'erc20:balanceOf', calls: YB_HYBRID_LTS.map((lt) => ({ target: lt, params: [YB_HYBRID_VAULT] })) }); + const held = YB_HYBRID_LTS.map((lt, i) => [lt, ltShares[i]]).filter(([, shares]) => BigInt(shares) > 0n); + if (!held.length) return; + const assets = await api.multiCall({ abi: abi.ltAsset, calls: held.map(([lt]) => lt) }); + const amounts = await api.multiCall({ abi: abi.previewWithdraw, calls: held.map(([lt, shares]) => ({ target: lt, params: [shares] })) }); + api.add(assets, amounts); +} + +/** + * Computes BTCD's Ethereum-mainnet TVL. * * Steps: - * 1. balanceOf sweep over static custody + driver addresses for all tracked - * ERC-20s. Includes Curve gauge tokens, the fLiteUSD share token, - * and the Aave V3 variable-debt WBTC token (priced negative). - * 2. YieldBasis driver — totalAssets() reports full WBTC value (the driver - * itself is excluded from the balanceOf sweep to avoid double-counting). - * 3. Morpho Blue supply positions — read via position()+market(), applying - * the protocol's virtual-offset share/asset conversion to stay consistent - * with on-chain accounting. + * 1. Discover the strategy position managers from the engine Multicall's + * authorized targets and value each by its TYP protocol. + * 2. balanceOf sweep of idle tokens over the strategy position managers and + * the static custody contracts. + * 3. YieldBasis hybrid vault LT shares. * - * Off-chain Fireblocks/CEX balances are intentionally excluded. + * Off-chain Fireblocks/CEX balances and EOAs are intentionally excluded. */ async function ethereumTvl(api) { - await sumTokens2({ api, owners: ethOwners, tokens: ethTokens }); + const targets = await api.call({ target: ENGINE_MULTICALL, abi: abi.getAuthorizedTargets }); + const typs = await api.multiCall({ abi: abi.TYP, calls: targets, permitFailure: true }); + const strategies = targets + .map((target, i) => ({ target, typ: typs[i] })) + .filter(({ typ }) => typ) + .map((s) => { + const [protocol, investment] = s.typ.split(':'); + return { ...s, protocol, investment }; + }); - const yb = await api.call({ - target: DRV_YIELD_BASIS, - abi: 'function totalAssets() view returns (uint256 totalAssets_, uint256 totalShares_)', - }); - api.add(ADDRESSES.ethereum.WBTC, yb.totalAssets_); - - const [positions, market] = await Promise.all([ - api.multiCall({ - abi: morphoPositionAbi, - calls: morphoSuppliers.map((s) => ({ - target: MORPHO_BLUE, - params: [SBTCD_WBTC_MARKET, s], - })), - }), - api.call({ - target: MORPHO_BLUE, - abi: morphoMarketAbi, - params: [SBTCD_WBTC_MARKET], - }), - ]); - const totalSupplyAssets = BigInt(market.totalSupplyAssets) + MORPHO_VIRTUAL_ASSETS; - const totalSupplyShares = BigInt(market.totalSupplyShares) + MORPHO_VIRTUAL_SHARES; - positions.forEach((pos, i) => { - if (!pos) return; - const shares = BigInt(pos.supplyShares); - if (shares === 0n) return; - const assets = (shares * totalSupplyAssets) / totalSupplyShares; - api.add(ADDRESSES.ethereum.WBTC, assets); - }); + for (const strategy of strategies) await addStrategyPosition(api, strategy); + await sumTokens2({ api, owners: [...STATIC_CUSTODY, ...strategies.map(({ target }) => target)], tokens: idleTokens }); + await addYieldBasisHybrid(api); } /** @@ -125,11 +289,9 @@ async function ethereumTvl(api) { * factored in — only the realized GM balance and idle inventory are counted. */ async function arbitrumTvl(api) { - const [longToken, shortToken, gmToken] = await Promise.all([ - api.call({ target: ARBITRUM_GM_POSITION_MANAGER, abi: 'function LONG_TOKEN() view returns (address)' }), - api.call({ target: ARBITRUM_GM_POSITION_MANAGER, abi: 'function SHORT_TOKEN() view returns (address)' }), - api.call({ target: ARBITRUM_GM_POSITION_MANAGER, abi: 'function GM_TOKEN() view returns (address)' }), - ]); + const longToken = await api.call({ target: ARBITRUM_GM_POSITION_MANAGER, abi: 'function LONG_TOKEN() view returns (address)' }); + const shortToken = await api.call({ target: ARBITRUM_GM_POSITION_MANAGER, abi: 'function SHORT_TOKEN() view returns (address)' }); + const gmToken = await api.call({ target: ARBITRUM_GM_POSITION_MANAGER, abi: 'function GM_TOKEN() view returns (address)' }); const raw = await api.call({ target: ARBITRUM_GM_POSITION_MANAGER, @@ -147,14 +309,18 @@ async function arbitrumTvl(api) { } module.exports = { + doublecounted: true, methodology: - 'On-chain collateral across the protocol\'s custody contracts and eight ' + - 'driver contracts. Most value is captured by ERC-20 balanceOf (including ' + - 'Curve gauge tokens, fLiteUSD shares, and Aave V3 variable-debt WBTC ' + - '— priced negatively to net out carry-trade debt); the YieldBasis LT ' + - 'and Morpho Blue supply positions are read explicitly. Arbitrum holds ' + - 'the GMX V2 sleeve. Off-chain custody is not included.', + 'On-chain collateral across the protocol\'s custody contracts and strategy ' + + 'position managers. Strategies are discovered from the engine Multicall\'s ' + + 'authorized targets and valued by protocol: Morpho Blue supply, ERC-4626 ' + + 'vault shares (Morpho V2, Fluid Lite, Stake DAO reward vaults over Curve ' + + 'LP), Curve LP and gauges, YieldBasis LT shares, and Aave and Morpho ' + + 'carry trades net of their debt. Idle reserves are read by balanceOf. ' + + 'The YieldBasis hybrid vault and the Arbitrum GMX V2 sleeve are read ' + + 'explicitly. Off-chain custody and EOAs are not included. Collateral is ' + + 'deployed into Morpho, Stake DAO, Curve, Fluid, Aave and YieldBasis, so ' + + 'it is marked double counted.', ethereum: { tvl: ethereumTvl }, arbitrum: { tvl: arbitrumTvl }, }; - From 8caedd8fe7ccfface7871e96f2b10e61ea52b79f Mon Sep 17 00:00:00 2001 From: hypertokens Date: Mon, 9 Nov 2026 13:44:44 -0700 Subject: [PATCH 661/988] Add Hyper Tokens (hypertokens) TVL adapter (#22108) Co-authored-by: hypertokens Co-authored-by: FelixBruguera --- registries/erc4626.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/registries/erc4626.js b/registries/erc4626.js index 2d2f548f1bc..097f8090e7d 100644 --- a/registries/erc4626.js +++ b/registries/erc4626.js @@ -575,6 +575,13 @@ const configs = { start: '2026-04-07', base: { vaults: [], stakingVaults: ['0x60Bf63729f688287a450299962b36Cef0aFfaa42'] }, }, + 'hypertokens': { + methodology: 'TVL is the sum of ERC-4626 totalAssets() across the Ensemble iVOL and VOL vaults on HyperEVM, counted in their underlying USDC. Hyper Tokens (hypertokens.io) is the non-custodial front end for trading these ~6x leveraged BTC exposure tokens.', + hyperliquid: [ + '0x59A72A4b8D632005112f7D2bc0D035E06bE043D9', // iVOL + '0xEb22eC1b402dcc4155B9D8d2E1db2f2d229162CC', // VOL + ], + }, } module.exports = buildProtocolExports(configs, erc4626ExportFn) From e1ce550c2447a772a4a0d1b6dc8a098ee99fc0ff Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 9 Nov 2026 23:49:49 +0100 Subject: [PATCH 662/988] remove stellar.exper dependency --- projects/blend-pools-v2/index.js | 29 ++++-------- projects/etherfuse/index.js | 19 ++------ projects/helper/chain/stellar.js | 59 +++++++++++++++++------- projects/ondofinance/index.js | 7 ++- projects/sushi-stellar/index.js | 77 +++++++++++++++++--------------- projects/vnx-rwa/index.js | 16 +++---- 6 files changed, 106 insertions(+), 101 deletions(-) diff --git a/projects/blend-pools-v2/index.js b/projects/blend-pools-v2/index.js index e64613141f1..eb00e750a26 100644 --- a/projects/blend-pools-v2/index.js +++ b/projects/blend-pools-v2/index.js @@ -1,5 +1,4 @@ -const { callSoroban, parseScVal } = require("../helper/chain/stellar"); -const { get } = require("../helper/http"); +const { callSoroban, getContractEvents } = require("../helper/chain/stellar"); const { getCache, setCache } = require("../helper/cache"); const methodologies = require("../helper/methodologies"); @@ -7,33 +6,23 @@ const BACKSTOP_ID = "CAQQR5SWBXKIGZKPBZDH3KM5GQ5GUTPKB7JAFCINLZBC5WXPJKRG3IM7"; const POOL_FACTORY_V2 = "CDSYOAVXFY7SM5S64IZPPPYB4GVGGLMQVFREPSQQEZVIWXX5R23G4QSU"; const SCALAR_12 = 10n ** 12n; // v2 b_rate/d_rate fixed-point scalar -// All pools ever deployed by the v2 pool factory ('deploy' events, full -// history via stellar.expert), plus whatever is currently in the backstop -// reward zone (can be empty - pools get rotated out, so it alone is not a -// reliable enumeration source). The list is persisted in the llama cache and -// only ever grows, so a stellar.expert outage falls back to the last known -// pool set instead of failing. +// All pools deployed by the v2 pool factory ('deploy' events), plus whatever is +// currently in the backstop reward zone (can be empty - pools get rotated out, +// so it alone is not a reliable enumeration source). The Soroban RPC only keeps +// ~7 days of events, so the list is persisted in the llama cache and only ever +// grows; each run merges in the deploys the RPC still has. async function getPools() { const pools = new Set(await callSoroban(BACKSTOP_ID, "reward_zone")); const cached = (await getCache("blend-pools-v2", "stellar"))?.pools ?? []; cached.forEach((p) => pools.add(p)); try { - let cursor; - while (true) { - const url = `https://api.stellar.expert/explorer/public/contract/${POOL_FACTORY_V2}/events?order=asc&limit=200` + (cursor ? `&cursor=${cursor}` : ""); - const { _embedded: { records } } = await get(url); - if (!records.length) break; - for (const r of records) { - if (r.topics?.[0] !== "deploy") continue; - pools.add(parseScVal(Buffer.from(r.bodyXdr, "base64"), 0).value); - } - cursor = records[records.length - 1].id; - } + const events = await getContractEvents({ contractId: POOL_FACTORY_V2, topic: "deploy" }); + events.forEach(({ data }) => pools.add(data)); if (pools.size > cached.length) await setCache("blend-pools-v2", "stellar", { pools: [...pools] }); } catch (e) { if (!cached.length) throw e; - console.log("blend-pools-v2: stellar.expert failed, using cached pool list:", e.message); + console.log("blend-pools-v2: getEvents failed, using cached pool list:", e.message); } return [...pools]; } diff --git a/projects/etherfuse/index.js b/projects/etherfuse/index.js index a0ca4781923..a59288bbd01 100644 --- a/projects/etherfuse/index.js +++ b/projects/etherfuse/index.js @@ -1,6 +1,6 @@ const { sumTokens2 } = require('../helper/unwrapLPs'); const { getTokenSupplies } = require('../helper/solana'); -const { get } = require('../helper/http'); +const { stellar } = require('@defillama/sdk').chains; // ---------------- CONFIG ---------------- const config = { @@ -48,20 +48,9 @@ async function solanaTVL(api) { // ---------------- STELLAR TVL ---------------- async function stellarTVL(api) { - for (const [tokenName, asset] of Object.entries(config.stellar)) { - const [code, issuer] = asset.split('-'); - try { - const res = await get(`https://api.stellar.expert/explorer/public/asset/${code}-${issuer}`); - if (!res || !res.supply) { - throw new Error(`Stellar API returned invalid data for ${asset}: ${JSON.stringify(res)}`); - } - - // Correct scaling: divide by 10^7 to get actual supply in millions - const supply = Number(res.supply) / 1e7; - api.addTokens(asset, supply); - } catch (err) { - throw err; - } + for (const asset of Object.values(config.stellar)) { + const { supply } = await stellar.getAssetSupply({ asset }); // stroops, the coins server prices `CODE-ISSUER` with 7 decimals + api.addTokens(asset, supply); } } diff --git a/projects/helper/chain/stellar.js b/projects/helper/chain/stellar.js index 86752216d94..d024b7b9ea7 100644 --- a/projects/helper/chain/stellar.js +++ b/projects/helper/chain/stellar.js @@ -1,6 +1,5 @@ // Horizon / Soroban transport and the StrKey / XDR / ScVal codec live in @defillama/sdk (`sdk.chains.stellar`); // this file keeps the TVL helpers (sumTokens, addUSDCBalance) and the historical export shapes. -const { get } = require('../http') const { transformBalances } = require('../portedTokens') const { stellar } = require('@defillama/sdk').chains @@ -18,15 +17,24 @@ async function getAssetSupply(asset) { return supply } +const USDC = 'USDC-GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN' + +// USDC held by a Soroban contract (read through the asset's SAC) async function addUSDCBalance(api, account) { - const { balances } = await get(`https://api.stellar.expert/explorer/public/contract/${account}/value`) - const usdc = balances.find(({ asset }) => asset === 'USDC-GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN-1') - if (usdc) { - api.addCGToken('usd-coin', usdc.value / 1e7) - } + const raw = await stellar.getTokenBalance({ asset: USDC, address: account }) + api.add(`${USDC}-1`, raw) } +// balance key in the format the coins server prices: `XLM` for the native asset, +// `CODE-ISSUER-1` (alphanum4) / `CODE-ISSUER-2` (alphanum12) for trustlines, pool shares are skipped +function balanceKey({ asset, assetType, code, issuer }) { + if (assetType === 'native') return 'XLM' + if (assetType === 'credit_alphanum4') return `${code}-${issuer}-1` + if (assetType === 'credit_alphanum12') return `${code}-${issuer}-2` + return null +} +// classic account balances via Horizon; an account that was never funded is logged and skipped async function sumTokens(config) { const { api, owners = [], owner, ...rest } = config if (owners?.length) { @@ -34,21 +42,39 @@ async function sumTokens(config) { await sumTokens({ ...rest, owner, api, skiTransform: true }) return transformBalances(api.chain, api.getBalances()) } else { - // validateStatus lets a 404 (account not yet created/funded on-chain) through so it can be skipped instead of thrown - const res = await get(`https://api.stellar.expert/explorer/public/account/${owner}/value`, { validateStatus: (s) => s < 500, }) - if (res?.status === 404 || !Array.isArray(res?.balances)) { - console.log(`[stellar] account ${owner} not found on-chain, skipping`) - if (config.skiTransform) return api.getBalances() - return transformBalances(api.chain, api.getBalances()) + const balances = await stellar.getAccountBalances({ address: owner }) + if (!balances.length) console.log(`[stellar] account ${owner} not found on-chain, skipping`) + for (const bal of balances) { + const key = balanceKey(bal) + if (key) api.add(key, bal.raw) } - // `balance` is the raw on-chain amount (7 decimals); `value` is a USD estimate and must not be used as a balance - res.balances.forEach(({ asset, balance }) => { - api.add(asset, balance) - }) } if (config.skiTransform) return api.getBalances() return transformBalances(api.chain, api.getBalances()) +} +/** + * Events emitted by a contract within the Soroban RPC retention window (~7 days on the public RPCs), oldest first. + * `topic` keeps only events whose first topic symbol matches. Each event carries decoded `topics` and `data` (the event value). + * Full history is not available from the RPC: persist what this returns (see sushi-stellar, blend-pools-v2). + */ +async function getContractEvents({ contractId, topic, lookbackLedgers = 100_000, limit = 200 }) { + const latest = await stellar.getLatestSorobanLedger() + const filters = [{ type: 'contract', contractIds: [contractId] }] + let params = { startLedger: Math.max(1, latest.number - lookbackLedgers), filters, pagination: { limit } } + const events = [] + while (true) { + const res = await stellar.sorobanRpc('getEvents', params) + const page = res.events ?? [] + for (const ev of page) { + const topics = ev.topic.map(t => stellar.parseScVal(t)) + if (topic && topics[0] !== topic) continue + events.push({ ...ev, topics, data: stellar.parseScVal(ev.value) }) + } + if (page.length < limit) break + params = { filters, pagination: { limit, cursor: res.cursor } } + } + return events } /** @@ -100,6 +126,7 @@ module.exports = { getAssetSupply, addUSDCBalance, sumTokens, + getContractEvents, getTokenBalance, decodeStrKey, callSoroban, diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index 82e6427d584..99ee05e7157 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -4,6 +4,7 @@ const sui = require("../helper/chain/sui"); const { function_view } = require("../helper/chain/aptos"); const { get } = require("../helper/http"); const {post} = require("../helper/http"); +const { stellar } = require("@defillama/sdk").chains; const RIPPLE_ENDPOINT = 'https://xrplcluster.com'; @@ -122,10 +123,8 @@ Object.keys(config).forEach((chain) => { const ousgSupply = (await getXrplTokenBalances(XRPL_OUSG_ISSUER, XRPL_OUSG_CURRENCY)) * Math.pow(10, 6); api.addTokens(config.ripple.OUSG, ousgSupply); } else if (chain === "stellar") { - const [code, issuer] = config.stellar.USDY.split('-'); - const res = await get(`https://api.stellar.expert/explorer/public/asset/${code}-${issuer}`); - - api.addTokens(config.stellar.USDY, res.supply); + const { supply } = await stellar.getAssetSupply({ asset: config.stellar.USDY }); // stroops + api.addTokens(config.stellar.USDY, supply); } else if (chain === "plume_mainnet") { // Plume's Multicall3 implementation has known issues, use individual calls for (const token of fundAddresses) { diff --git a/projects/sushi-stellar/index.js b/projects/sushi-stellar/index.js index 02707aff543..9a0a34b4e81 100644 --- a/projects/sushi-stellar/index.js +++ b/projects/sushi-stellar/index.js @@ -1,49 +1,52 @@ -const { get } = require('../helper/http') -const { getConfig } = require('../helper/cache') -const { callSoroban, parseScVal } = require('../helper/chain/stellar') +const { getCache, setCache } = require('../helper/cache') +const { callSoroban, parseScVal, getContractEvents } = require('../helper/chain/stellar') const FACTORY = 'CD3KRKGDRVWPXVB3VXLUMQKMX6XZ6Q2H334IVZD4XXNAMKSRVQL5GLYF' -const STELLAR_EXPERT = 'https://api.stellar.expert/explorer/public' - -async function getContractEvents({ contract, topic, limit = 200 }) { - const all = [] - let cursor - for (let page = 0; page < 50; page++) { - const url = `${STELLAR_EXPERT}/contract/${contract}/events?order=asc&limit=${limit}` + (cursor ? `&cursor=${cursor}` : '') - const data = await get(url) - const records = data?._embedded?.records || [] - if (!records.length) break - for (const r of records) { - if (!topic || r.topics?.[0] === topic) all.push(r) - } - if (records.length < limit) break - cursor = records[records.length - 1].paging_token + +// The factory does not enumerate its pools, so the list is built from `pool_created` events. +// The Soroban RPC only keeps ~7 days of events, hence the list is persisted in the llama cache and only ever grows; +// each run merges in whatever the RPC still has. +async function getPools() { + const cached = (await getCache('sushi-stellar', 'stellar'))?.pools ?? [] + const pools = {} + cached.forEach(p => pools[p.pool_address] = p) + + // one-off seed from the stellar.expert event list the adapter cached before that API went paid + if (!cached.length) { + const legacy = await getCache('config-cache', `sushi-stellar/${FACTORY}`) + if (Array.isArray(legacy)) + legacy.forEach(ev => addPool(parseScVal(Buffer.from(ev.bodyXdr, 'base64'), 0).value)) } - return all -} -async function getPoolsFromFactory(factory) { - const events = await getConfig(`sushi-stellar/${factory}`, null, { - fetcher: () => getContractEvents({ contract: factory, topic: 'pool_created' }), - }) - return events.map(ev => parseScVal(Buffer.from(ev.bodyXdr, 'base64'), 0).value) -} + try { + const events = await getContractEvents({ contractId: FACTORY, topic: 'pool_created' }) + events.forEach(({ data }) => addPool(data)) + } catch (e) { + if (!Object.keys(pools).length) throw e + console.log('sushi-stellar: getEvents failed, using cached pool list:', e.message) + } -async function tvl(api) { - const pools = await getPoolsFromFactory(FACTORY) + const list = Object.values(pools) + if (list.length > cached.length) await setCache('sushi-stellar', 'stellar', { pools: list }) + return list - const balances = await Promise.all(pools.flatMap(p => [ - callSoroban(p.token0, 'balance', [p.pool_address]).catch(() => 0n), - callSoroban(p.token1, 'balance', [p.pool_address]).catch(() => 0n), - ])) + function addPool({ pool_address, token0, token1 }) { + pools[pool_address] = { pool_address, token0, token1 } + } +} - pools.forEach((p, i) => { - api.add(p.token0, balances[i * 2].toString()) - api.add(p.token1, balances[i * 2 + 1].toString()) - }) +async function tvl(api) { + const pools = await getPools() + for (const { pool_address, token0, token1 } of pools) { + for (const token of [token0, token1]) { + const balance = await callSoroban(token, 'balance', [pool_address]).catch(() => 0n) + api.add(token, balance.toString()) + } + } } module.exports = { timetravel: false, + methodology: 'Token balances held by every pool created by the Sushi Stellar factory.', stellar: { tvl }, -} \ No newline at end of file +} diff --git a/projects/vnx-rwa/index.js b/projects/vnx-rwa/index.js index 7a0a6367444..f0a705c219d 100644 --- a/projects/vnx-rwa/index.js +++ b/projects/vnx-rwa/index.js @@ -1,5 +1,6 @@ const { getTokenSupplies } = require("../helper/solana"); const { get } = require("../helper/http"); +const { stellar } = require("@defillama/sdk").chains; const ASSETS = { EVM: { @@ -80,10 +81,8 @@ const MAPPINGS = { }; const fetchStellarSupply = async (asset) => { - const stellarApi = `https://api.stellar.expert/explorer/public/asset/${asset}`; - const response = await fetch(stellarApi); - const { supply } = await response.json(); - return supply / 1e7 * 1e18; // supply / stellar dec * eth dec + const { supply } = await stellar.getAssetSupply({ asset }); // stroops + return BigInt(supply) * 10n ** 11n; // 7 stellar decimals -> 18 ethereum decimals }; const solanaTvl = async (api, assets) => { @@ -92,11 +91,10 @@ const solanaTvl = async (api, assets) => { }; const stellarTvl = async (api, assets) => { - const supplies = await Promise.all(assets.map(fetchStellarSupply)); - supplies.forEach((supply, index) => { - const ethereumAsset = MAPPINGS.stellar[assets[index]]; - api.add(`ethereum:${ethereumAsset}`, supply, { skipChain: true }); - }); + for (const asset of assets) { + const supply = await fetchStellarSupply(asset); + api.add(`ethereum:${MAPPINGS.stellar[asset]}`, supply.toString(), { skipChain: true }); + } }; const evmTvl = (chain, assets) => { From d1c156f5ebc7ddda6399b6e6855a0ac5cf4c4273 Mon Sep 17 00:00:00 2001 From: sonevibegrok Date: Tue, 10 Nov 2026 03:47:12 -0400 Subject: [PATCH 663/988] [feat] SoneVibe - add new Soneium factory and keep the existing one (#22116) Co-authored-by: Cursor Agent Co-authored-by: SoneVibe --- projects/sonevibe/index.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/projects/sonevibe/index.js b/projects/sonevibe/index.js index 48f3501a4f5..27cc6139eba 100644 --- a/projects/sonevibe/index.js +++ b/projects/sonevibe/index.js @@ -11,6 +11,12 @@ const dex = { arbitrum: '0xA95107ebE4e54480bA755061eF3207c3421150f0', } +// Drain-free Soneium factory, deployed 2026-11-10 03:56:01 UTC (block 30574105), +// tx 0x69f8165d69abe21ac04f9e9b2e05e67fe97a2fd7ee976d97732068c0a2e57ad4. +// The original soneium factory stays in `dex` so historical TVL still reads those pairs. +const soneiumNewFactory = '0x77b141dCFDa726e239efF005E3DE7A47AeBFf948' +const soneiumNewFactoryStartBlock = 30574105 + const lending = { // V_Master has no getAllMarkets(), so markets are pinned (from networks.json) // Arbitrum One has an empty master and no cTokens there, so it stays DEX-only. @@ -29,10 +35,20 @@ Object.entries(dex).forEach(([chain, factory]) => { // allPairsLength is still 0 then. The WETH/USDC pair is created in block 521390325 at 05:41:58Z. dexExports.arbitrum.start = 1793855370 +const soneiumNewFactoryTVL = getUniTVL({ factory: soneiumNewFactory, useDefaultCoreAssets: true }) +const soneiumNewExports = { + soneium: { + tvl: async (api) => { + if (api.block != null && Number(api.block) < soneiumNewFactoryStartBlock) return {} + return soneiumNewFactoryTVL(api) + }, + }, +} + const lendingExports = {} Object.entries(lending).forEach(([chain, config]) => { lendingExports[chain] = compoundExports2(config) }) -module.exports = mergeExports([dexExports, lendingExports]) -module.exports.methodology = 'DEX TVL: reserves of all VibeSwap pairs created by the factory (core assets only). Lending TVL: underlying tokens held by SoneVibe cTokens listed by the comptroller; borrowed = total borrows. Arbitrum counts those factory reserves only; that chain has no comptroller or cTokens.' +module.exports = mergeExports([dexExports, soneiumNewExports, lendingExports]) +module.exports.methodology = 'DEX TVL: reserves of all VibeSwap pairs created by the factories (core assets only). On Soneium this includes the original factory 0x06C0b58287794a0bdce20ce768b601CA974618DC, kept for history, and the drain-free factory 0x77b141dCFDa726e239efF005E3DE7A47AeBFf948 from block 30574105 (2026-11-10). Lending TVL: underlying tokens held by SoneVibe cTokens listed by the comptroller; borrowed = total borrows. Arbitrum counts those factory reserves only; that chain has no comptroller or cTokens.' From 69ebc198c779f596c13da072da1d2a862c9234b2 Mon Sep 17 00:00:00 2001 From: semyon-metric Date: Tue, 10 Nov 2026 10:47:58 +0300 Subject: [PATCH 664/988] [update] metric-v1 - add Elysium (#22114) --- projects/metric-v1/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/metric-v1/index.js b/projects/metric-v1/index.js index 751f33eb91c..8f5bd6fbbfd 100644 --- a/projects/metric-v1/index.js +++ b/projects/metric-v1/index.js @@ -28,6 +28,8 @@ const config = { avax: [FACTORY], monad: [FACTORY], megaeth: [FACTORY], + // Elysium (Kinetiq's Arbitrum Orbit chain, chain id 99901): factory live since 2026-10-29. + elysium: [FACTORY], } Object.keys(config).forEach(chain => { From 903d980b2a2b9b02a2d5e7eebabfddec14cbf72e Mon Sep 17 00:00:00 2001 From: thomas <81407403+thomas-cloud579@users.noreply.github.com> Date: Tue, 10 Nov 2026 15:52:55 +0800 Subject: [PATCH 665/988] GateUpdateReserveAddresses20261110 (#22113) Co-authored-by: ccipherx --- projects/gate-io/index.js | 27 ++++++++++++++++++++++----- projects/helper/chain/neo3.js | 1 + 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index 5c11d763856..af4068439c7 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { cexExports } = require("../helper/cex"); +const { cexExports, defaultTokens } = require("../helper/cex"); const bitcoinAddressBook = require("../helper/bitcoin-book/index.js"); const { mergeExports, getStakedEthTVL } = require("../helper/utils"); const { cosmosStaked, suiStaked, aptosStaked, nearStaked, bittensorStaked, confluxStaked, cardanoStaked, algorandStaked, starknetStaked, aleoStaked, neo3Staked } = require("../helper/stakingHelper"); @@ -308,7 +308,8 @@ const config = { "1665ypcQXKmqXtjE9yuWsZqK5MQmBQokFjPGLq5SvoKAWBjQ", // Gate Earn, nominator (bonded DOT stays in the account) // "123tA7zfH9XdqHX5v9W4mB4VfmrjE95yJvdvMbpWv5V851rX", // "15NtvAi8CGHrbaUBvXdki8GXc5YfHM9yTv6HGmaYDetLH2ob", - // "15dZTKqG6YZiQNiisMZP1DT4J6J9bmEEC4Bkz24nMC1ccRe2" + "15dZTKqG6YZiQNiisMZP1DT4J6J9bmEEC4Bkz24nMC1ccRe2", // Gate Earn + "15FWs1pcTz8NbjGvBAMzmqUdWPnaLhBPwDNsJEVoAG4jc22n" // Gate Earn, nominator ] }, "scroll": { @@ -1859,7 +1860,9 @@ const config = { "UQDQSAWWKRBUm0VnUrny-9Ni_deobis0aC6XpEtalxxl_eUa", "UQCalNyv57ob7KK1r7nsVaY4VivZu712RTlqiEYAffoM3kJ-", "EQC0lrj3O0af8GotieYsTXChA_wijIIVN7Sd_wkgYLwoH07q", - ] + ], + // default TON whitelist + EVAA (EVAA Protocol), held in Gate's TON reserve wallet UQDQSAWW... + tokens: [...defaultTokens.ton, 'EQBKMfjX_a_dsOLm-juxyVZytFP7_KKnzGv6J01kGc72gVBp'], }, "umee": { "owners": [ @@ -1983,7 +1986,9 @@ const config = { "zil1melkmjzv6v784dlk30rhx2ck4zccqpprsdd3jt", "zil12zn46cppzsg0thgn7e66ugjd3c25hcl0acjaud", "zil1jcmadzrm6w49gegqw94esdkyhfq75y4fxl9wrv", - "zil12acrew80f00m4v3cs4hw9yawx7m74fwdwtmdj5" + "zil12acrew80f00m4v3cs4hw9yawx7m74fwdwtmdj5", + "zil1ezptzyd8tsxx2l79qlqyl07d9nycfur3wgesc7", // = 0xc882b111a75c0c657fc507c04fbfcd2cc984f071 + "zil1p5rs093e2te0hfva6phjksj6eeqtfyh70mhnw4", // = 0x0d0707963952f2fba59dd06f2b425ace40b492fe ] }, "zircuit": { @@ -2029,13 +2034,25 @@ const config = { "zig1xunyznpjmj9jv5e2zwngp2qrzmulr2ggejyvt7", ] }, + kusama: { + owners: [ + "J5VsgNemdBg2bfvHresAtBZdxE67WrS656Caup3MgsBE2y7", + "CspNJ5uJ9WcF6Nf6sJY9YRQL3dWZmKrMnmd2qY4BXMTGEgi", + ] + }, + initia: { + owners: [ + "init1xunyznpjmj9jv5e2zwngp2qrzmulr2ggkwpdz5", + "init155svs6sgxe55rnvs6ghprtqu0mh69kehd907tp", + ] + }, robinhood: { owners: ['0xc882b111a75c0c657fc507c04fbfcd2cc984f071', '0x0d0707963952f2fba59dd06f2b425ace40b492fe'], } }; // remove chains w/o historical tvl -const unsupportedChains = ['aeternity', 'beam', 'binance', 'bitchain', 'bittensor', 'bone', 'callisto', 'clv', 'concordium', 'cmp', 'defichain', 'edg', 'elastos', 'elys', 'equilibrium', 'findora', 'flow', 'fusion', 'heiko', 'hydra', 'icon', 'interlay', 'karura', 'kintsugi', 'kusuma', 'manta_atlantic', 'lisk', 'neo', 'neo3', 'nibiru', 'ontology', 'parallel', 'pokt', 'polkadex', 'proton', 'reef', 'rvn', 'shiden', 'sora', 'stafi', 'starcoin', 'syscoin', 'telos', 'velas', 'venom', 'vite', 'waves', 'wax', 'zilliqa', 'secret', 'etn', 'zkfair', 'acala', 'harmony', +const unsupportedChains = ['aeternity', 'beam', 'binance', 'bitchain', 'bone', 'callisto', 'clv', 'concordium', 'cmp', 'defichain', 'edg', 'elastos', 'elys', 'equilibrium', 'findora', 'flow', 'fusion', 'heiko', 'hydra', 'icon', 'interlay', 'karura', 'kintsugi', 'kusuma', 'manta_atlantic', 'lisk', 'neo', 'nibiru', 'parallel', 'pokt', 'polkadex', 'reef', 'rvn', 'shiden', 'sora', 'stafi', 'starcoin', 'syscoin', 'telos', 'velas', 'venom', 'vite', 'waves', 'wax', 'secret', 'etn', 'zkfair', 'acala', 'harmony', 'vinu', 'rollux', 'aelf', 'ailayer', 'archway', ] diff --git a/projects/helper/chain/neo3.js b/projects/helper/chain/neo3.js index 11fc9a821ae..91e6082ab18 100644 --- a/projects/helper/chain/neo3.js +++ b/projects/helper/chain/neo3.js @@ -17,6 +17,7 @@ async function sumTokens({ api, owners = [] }) { api.add(`neo:${assethash.toLowerCase()}`, amount, { skipChain: true }) await sleep(200) } + return api.getBalances() } module.exports = { From 73f531b3f350f66df1f16a632c1dc1ff04347226 Mon Sep 17 00:00:00 2001 From: Fugaku <107969108+fugakux@users.noreply.github.com> Date: Mon, 9 Nov 2026 23:53:29 -0800 Subject: [PATCH 666/988] Add Kalos (Elysium Kinetiq): Kalos DEX, Kalos Fate, treasury (#22111) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- registries/sumTokens.js | 8 ++++++++ registries/treasury.js | 19 +++++++++++++++++++ registries/uniswapV3.js | 6 ++++++ 3 files changed, 33 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 6f43eacab41..f507811a958 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -17014,6 +17014,14 @@ const configs = { "resolveUniV3": true }, }, + "kalos-fate": { + "start": "2026-11-09", + "methodology": "TVL is the native HYPE held by the Kalos Fate house contract: the kFATE bankroll that pays for winning attempts, plus the stakes it escrows for attempts not settled yet.", + "elysium": { + "owner": "0xCA10517731a5D3709b40A76DdF382A647852d6ac", + "tokens": [ADDRESSES.null] + }, + }, "katana-perps": { "methodology": "TVL counts the USDC (Vault Bridge USDC) held in the Katana Perps contract on the Katana chain.", "katana": { diff --git a/registries/treasury.js b/registries/treasury.js index d105a728996..8448f1b670d 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -3190,6 +3190,25 @@ const configs = { ownTokens: ["0x91fbB2503AC69702061f1AC6885759Fc853e6EaE"] }, }, + 'treasury/kalos': { + elysium: { + owners: [ + '0xcA105395094Ceb27e6AfdA492c6379cBF468CDb8', // revenue splitter + '0xca10595e1F7a722ed80A6BEc7Ac27d183F3C541C', // Treasury vault + '0xCA1058B5339e97cE75AB2885A56570Ecb2F54881', // Team vault + '0xcA10538C4e513512cf1a222A2e00cF720b9CA9Cc', // Rewards vault + '0xCA105Dd42d1563889D4eF0905Fdf91E97517Df46', // Liquidity vault + ], + tokens: [ + nullAddress, + ADDRESSES.elysium.WHYPE, + ADDRESSES.elysium.USDC, + ADDRESSES.elysium.USDT0, + ADDRESSES.elysium.kHYPE, + '0xe45a355d9e9cAd2aD85F2d03E3eE3102A036acF0', // KNTQ + ], + }, + }, 'treasury/kayen-finance': { chz: { tokens: [nullAddress], diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index bcf3da665d7..105cc0bc5fa 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1977,6 +1977,12 @@ const uniV3Configs = { methodology: 'TVL is the value of tokens held in ArkhamPad launch pools (Uniswap v3 style pools created by the ArkhamPad factory on Elysium). Launch liquidity is locked forever.', elysium: { factory: '0x75656d8d2A59293DBdA4178F11Af6EE506ef60dD', fromBlock: 65264 }, }, + 'kalos-dex': { + // Kalos DEX (https://www.kalos.fun): the canonical Uniswap V3 contracts deployed unmodified by Kalos, https://www.kalos.fun/learn/contracts + start: '2026-11-05', + methodology: 'TVL is the tokens held in Kalos DEX pools, the Uniswap V3 pools created by the Kalos factory (found from its PoolCreated events).', + elysium: { factory: '0x8C60243181370bDA9A7d1a45b1249A8263da0158', fromBlock: 915221 }, + }, } module.exports = buildProtocolExports(uniV3Configs, uniV3Export) From 9d1b47a94ccb39c3533214d0fe4adf3d81aba693 Mon Sep 17 00:00:00 2001 From: Homer Finance Date: Tue, 10 Nov 2026 15:12:04 +0700 Subject: [PATCH 667/988] Add Homer (Elysium)Add files via upload (#22115) Co-authored-by: ccipherx --- projects/homer/index.js | 127 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 projects/homer/index.js diff --git a/projects/homer/index.js b/projects/homer/index.js new file mode 100644 index 00000000000..aecadf29b0e --- /dev/null +++ b/projects/homer/index.js @@ -0,0 +1,127 @@ +// Homer: the liquidity layer of Elysium (https://homer.finance). +// TVL is the liquidity in positions users opened through Homer: Uniswap v3-style NFTs held by +// HomerLiquidityManager contracts and Uniswap v4 positions held by HomerV4Manager contracts. +// Those positions sit in other DEXes' pools (KleosSwap, ElysPump, BOXA, Uniswap v4...), so the +// TVL is marked as double counted. Staked $HOMER is reported separately. + +const { sumTokens2, addUniV3LikePosition } = require('../helper/unwrapLPs') +const { getLogs2 } = require('../helper/cache/getLogs') +const { staking } = require('../helper/staking') + +// HomerLiquidityManager versions (v3 positions). Positions opened in earlier versions stay there +// until their owners move them, so every version is counted. +const V3_MANAGERS = [ + '0xff60e4f370c0243a820e0864ca92e1eb6ab7937e', + '0xfcbd0977c9e610a1d53f56746d7b6cc5fb5fb9b9', + '0x9ba039830404b8f658f8a79e774338cad510621a', + '0xa70551dc12b4c2cd52b4a91127a204e8eb233d10', + '0xdb61b2fba50ced1f6271963d9e357ed9d2136420', +] + +// HomerV4Manager versions (Uniswap v4 positions) and the block each was deployed in. +const V4_MANAGERS = [ + { address: '0x2168787fa608338be994ba7e0e3852589ae0715f', fromBlock: 199157 }, + { address: '0xcf76489a3f2bda1a15825a600ef25d28315cf83c', fromBlock: 206024 }, + { address: '0x63b202b8c36b0cd35782af0068d0a60fd1394b86', fromBlock: 334629 }, +] + +// Uniswap v4 PositionManagers Homer opens positions through, and their PoolManager (any other is +// asked for its poolManager() at run time). +const V4_POOL_MANAGER = { + '0x1f9b957071228a3190280e062cc62a3f66b6a13a': '0x5fb015a49f5b35073f9ce01c2adb287a75f89600', // ElysPump's v4 + '0x1d1c51b9d07fd27d36412a2b66cc23d19eb3e518': '0xe2e105d3f7209a9da11f83ccf3e7398a753823f1', // Uniswap v4 +} + +const HOMER = '0x365be4728d0ee2140e8b75a05c5dcf6b7d76399a' +const HOMER_STAKING = '0x5bdc2d45b54f909bae587ff3a051299e802fd6e8' + +const MINTED = 'event Minted(address indexed user, address indexed manager, uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1)' +const REBALANCED = 'event Rebalanced(address indexed user, address indexed manager, uint256 indexed oldTokenId, uint256 newTokenId, uint128 liquidity, uint256 amount0, uint256 amount1)' +const POOL_AND_INFO = 'function getPoolAndPositionInfo(uint256 tokenId) view returns ((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) poolKey, uint256 info)' +const POSITION_LIQUIDITY = 'function getPositionLiquidity(uint256 tokenId) view returns (uint128)' +const EXTSLOAD = 'function extsload(bytes32 slot) view returns (bytes32)' +const POOLS_SLOT = 6n // PoolManager's `_pools` mapping + +const int24 = (v) => { const n = Number(v & 0xffffffn); return n >= 0x800000 ? n - 0x1000000 : n } + +// keep only ":" in the log cache, not the raw logs +const idCache = (field) => ({ cache, logs }) => { + cache.logs = [...new Set([...(cache.logs ?? []), ...logs.map((l) => `${l.manager.toLowerCase()}:${l[field]}`)])] + return cache +} + +async function v4Positions(api) { + // Every position a Homer v4 manager opened (minted or created by a rebalance), still held by it. + const held = [] // { nft, tokenId } + for (const { address, fromBlock } of V4_MANAGERS) { + const [minted, rebalanced] = await Promise.all([ + getLogs2({ api, target: address, eventAbi: MINTED, fromBlock, extraKey: 'minted-ids', customCacheFunction: idCache('tokenId') }), + getLogs2({ api, target: address, eventAbi: REBALANCED, fromBlock, extraKey: 'rebalanced-ids', customCacheFunction: idCache('newTokenId') }), + ]) + const ids = [...minted, ...rebalanced].map((i) => i.split(':')) + const owners = await api.multiCall({ abi: 'function ownerOf(uint256) view returns (address)', calls: ids.map(([nft, id]) => ({ target: nft, params: [id] })), permitFailure: true }) + ids.forEach(([nft, id], i) => { if (owners[i] && owners[i].toLowerCase() === address) held.push({ nft: nft.toLowerCase(), tokenId: id }) }) + } + if (!held.length) return + + const calls = held.map(({ nft, tokenId }) => ({ target: nft, params: [tokenId] })) + const liquidityAll = await api.multiCall({ abi: POSITION_LIQUIDITY, calls }) + // Emptied positions (liquidity 0) hold nothing: skip them. + const live = held.map((p, i) => ({ ...p, call: calls[i], liquidity: liquidityAll[i] })).filter((p) => BigInt(p.liquidity) > 0n) + if (!live.length) return + const infos = await api.multiCall({ abi: POOL_AND_INFO, calls: live.map((p) => p.call) }) + + // Each PositionManager's PoolManager: the known ones from the list, any other asked directly + // (a Homer V4 manager can be allowed a new PositionManager later; TVL must not fail on it). + const poolManagers = { ...V4_POOL_MANAGER } + const unknown = [...new Set(live.map((p) => p.nft))].filter((nft) => !poolManagers[nft]) + if (unknown.length) { + const found = await api.multiCall({ abi: 'address:poolManager', calls: unknown }) + unknown.forEach((nft, i) => { poolManagers[nft] = found[i].toLowerCase() }) + } + + // Pool price from the PoolManager's storage (slot0 of each pool), the way StateView reads it. + const coder = new (require('ethers').AbiCoder)() + const { keccak256 } = require('ethers') + const poolOf = infos.map(({ poolKey: k }, i) => { + const id = keccak256(coder.encode(['address', 'address', 'uint24', 'int24', 'address'], [k.currency0, k.currency1, k.fee, k.tickSpacing, k.hooks])) + return { id, manager: poolManagers[live[i].nft] } + }) + const slots = await api.multiCall({ + abi: EXTSLOAD, + calls: poolOf.map(({ id, manager }) => ({ target: manager, params: [keccak256(coder.encode(['bytes32', 'uint256'], [id, POOLS_SLOT]))] })), + }) + + infos.forEach(({ poolKey, info }, i) => { + const packed = BigInt(info) + const slot0 = BigInt(slots[i]) + addUniV3LikePosition({ + api, + token0: poolKey.currency0, + token1: poolKey.currency1, + liquidity: Number(live[i].liquidity), + tickLower: int24(packed >> 8n), + tickUpper: int24(packed >> 32n), + tick: int24(slot0 >> 160n), + }) + }) +} + +async function tvl(api) { + // Each manager lists the position managers (Uniswap v3 NFTs) it accepts. + const nfts = await api.multiCall({ abi: 'address[]:managers', calls: V3_MANAGERS }) + await sumTokens2({ api, uniV3nftsAndOwners: V3_MANAGERS.flatMap((owner, i) => nfts[i].map((nft) => [nft, owner])) }) + await v4Positions(api) + api.removeTokenBalance(HOMER) // own token stays out of tvl + return api.getBalances() +} + +module.exports = { + doublecounted: true, + methodology: 'TVL is the liquidity in positions users opened through Homer: Uniswap v3-style NFTs held by HomerLiquidityManager contracts and Uniswap v4 positions held by HomerV4Manager contracts. These positions sit in other DEXes\' pools, so the TVL is double counted with those DEXes. HOMER inside positions is excluded. Staking is the $HOMER staked in HomerStaking.', + start: '2026-10-30', + elysium: { + tvl, + staking: staking(HOMER_STAKING, HOMER), + }, +} From 28e59482af9c374ce90173b762647d25bff699e9 Mon Sep 17 00:00:00 2001 From: Dani Date: Tue, 10 Nov 2026 10:37:51 +0100 Subject: [PATCH 668/988] jitter: count points bid quote escrow (resolves #22117) (#22118) Co-authored-by: 100x-badev <297748082+100x-badev@users.noreply.github.com> --- projects/jitter/index.js | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/projects/jitter/index.js b/projects/jitter/index.js index cc23d9849d8..9fc370eb04e 100644 --- a/projects/jitter/index.js +++ b/projects/jitter/index.js @@ -6,6 +6,36 @@ const SCALLOP_VAULT = '0xe77999674332f5bd078c8d7182002f7bbf7844591f4d36dbfd1182b const HAEDAL_VAULT = '0x4e4f6a5ee9504840a1bd5a9db589782fa44d6d1ce6f4fe45e93c6b664e161ca3::haedal_market_vault::HaedalMarketVault' const EMBER_VAULT = '0xc56a55893f4791d03726f9c109725765b584c06eb5625704ce782112d763ef99::ember_market_vault::EmberMarketVault' const HASUI = '0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI' +const ORDERBOOK = '0x15e9e1df6c5c67e16244069eb4b2feb10f16ae7d3f06fc51b8b51e1dc70a6f37::orderbook::OrderBook' +const JITTER_POINT = '0xabf187fe86408e5eb89001d44947dbb55ee727a9da340631a15a7611bec28b78::jitter_point::JITTER_POINT' + +// Quote coins escrowed in Jitter Points bids (input + unspent maker fee reserve), asks hold own points and the fee vault is protocol revenue +async function addPointEscrow(api) { + const books = await sui.getObjectsByType(ORDERBOOK) + for (const { type, fields } of books) { + const [base, quote] = sui.parseStructTag(type).typeParams + if (normalizeCoinType(base) !== normalizeCoinType(JITTER_POINT)) continue + const bids = fields.bids.fields + const slices = await sui.getDynamicFieldObjects({ parent: bids.levels.fields.id.id }) + let balance = 0n, levelCount = 0, orderCount = 0 + for (const { fields: { value: slice } } of slices) { + if (!slice?.type?.includes('::keyed_big_vector::Slice<')) continue // key-to-index table holds no funds + for (const { fields: { value: level } } of slice.fields.vector) { + levelCount++ + const table = level.fields.orders.fields + const orders = await sui.getDynamicFieldObjects({ parent: table.id.id }) + if (orders.length !== +table.size) throw new Error('Incomplete Jitter point order table') + for (const order of orders) { + const { input, maker_fee_reserve } = order.fields.value.fields.value.fields + balance += BigInt(input) + BigInt(maker_fee_reserve) + orderCount++ + } + } + } + if (levelCount !== +bids.levels.fields.length || orderCount !== +bids.order_count) throw new Error('Incomplete Jitter point orderbook') + api.add(quote, balance.toString()) + } +} async function tvl(api) { const scallopVaults = await sui.getObjectsByType(SCALLOP_VAULT) @@ -41,11 +71,12 @@ async function tvl(api) { const [, receipt] = sui.parseStructTag(type).typeParams api.add(receipt, fields.receipt_balance) } + await addPointEscrow(api) } module.exports = { timetravel: false, doublecounted: true, - methodology: 'Counts the receipt assets held in Jitter market vaults, including pending withdrawals until paid. Scallop MarketCoin shares are converted using on-chain (cash + debt - revenue) / market_coin_supply. Haedal and Ember receipts are priced as their own tokens. SY, PT, YT, LP and treasury assets are not added separately. The backing assets overlap with Scallop, Haedal and Ember Protocol TVL.', + methodology: 'Counts receipt assets in Jitter market vaults, including pending withdrawals until paid, plus quote coins locked in Jitter Points bids and their unspent maker-fee reserves. Scallop shares use on-chain (cash + debt - revenue) / market_coin_supply; Haedal and Ember receipts are priced as their own tokens. Own Jitter Points on asks, accrued point-trading protocol fees, and separate SY/PT/YT/LP or treasury balances are excluded. Yield backing overlaps with Scallop, Haedal and Ember TVL.', sui: { tvl }, } From c69325ca9f6fc003bfd348140a236920be41acbd Mon Sep 17 00:00:00 2001 From: Dani Date: Tue, 10 Nov 2026 11:08:00 +0100 Subject: [PATCH 669/988] ssv-network: compute tvl in the adapter instead of the custom script (#22106) Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/custom-scripts/ssv/index.js | 266 ------------------ .../helper/custom-scripts/ssv/package.json | 18 -- .../helper/custom-scripts/ssv/pnpm-lock.yaml | 173 ------------ projects/ssv-network/index.js | 61 +++- 4 files changed, 57 insertions(+), 461 deletions(-) delete mode 100644 projects/helper/custom-scripts/ssv/index.js delete mode 100644 projects/helper/custom-scripts/ssv/package.json delete mode 100644 projects/helper/custom-scripts/ssv/pnpm-lock.yaml diff --git a/projects/helper/custom-scripts/ssv/index.js b/projects/helper/custom-scripts/ssv/index.js deleted file mode 100644 index 323402c77d4..00000000000 --- a/projects/helper/custom-scripts/ssv/index.js +++ /dev/null @@ -1,266 +0,0 @@ -const https = require("https"); -const { pipeline } = require("stream"); -const { parser } = require("stream-json"); -const { pick } = require("stream-json/filters/Pick"); -const { streamArray } = require("stream-json/streamers/StreamArray"); -const sdk = require('@defillama/sdk'); -const { Client: ElasticClient } = require('@elastic/elasticsearch'); - -async function writeBalancesToElastic(balances) { - const cfg = JSON.parse(process.env.ELASTICSEARCH_CONFIG || '{}') - if (!cfg.host) { - console.log('ELASTICSEARCH_CONFIG missing or invalid, skipping write') - return - } - const client = new ElasticClient({ - node: cfg.host, - auth: { username: cfg.username, password: cfg.password }, - requestTimeout: 60000, - maxRetries: 2, - }) - const now = new Date() - const index = `custom-scripts-${now.getUTCFullYear()}-${now.getUTCMonth()}` - await client.index({ - index, - body: { - metadata: { type: 'tvl' }, - chain: 'ethereum', - project: 'ssv-network', - balances, - timestamp: Date.now(), - }, - }) - console.log(`Elastic write OK to ${index}`) -} - -const BEACON_API_URL = "https://ethereum-beacon-api.publicnode.com/eth/v1/beacon/states/finalized/validators"; - -/** - * Streams all validators from beacon chain and computes total balance - * for validators matching the provided public keys - * @param {Set} validatorKeys - Set of validator public keys to match - * @returns {Promise<{totalBalance: number, validatorCount: number}>} - */ -function streamBeaconValidators(_validatorKeys) { - return new Promise((resolve, reject) => { - const options = { - method: "GET", - headers: { Accept: "application/json" }, - }; - - https - .get(BEACON_API_URL, options, (res) => { - if (res.statusCode !== 200) { - reject(new Error(`Beacon API returned status code: ${res.statusCode}`)); - res.resume(); - return; - } - - let totalBalance = 0; - let validatorCount = 0; - let processedCount = 0; - - const pipelineStream = pipeline( - res, - parser(), - pick({ filter: "data" }), - streamArray(), - (err) => { - if (err) { - reject(err); - return; - } - resolve({ totalBalance, validatorCount }); - } - ); - - pipelineStream.on("data", ({ value }) => { - processedCount++; - - if (processedCount % 100000 === 0) { - console.log(`Processed ${(processedCount / 1e6).toFixed(1)}M validators... balance so far: ${totalBalance / 1e9} ETH for ${validatorCount} matched validators`); - } - - let pubKey = value.validator.pubkey.toLowerCase() - - // Check if this validator's public key matches our SSV keys - if (validatorPubKeys.has(pubKey)) { - totalBalance += +value.balance; - validatorCount++; - } - }); - - res.on("error", reject); - }) - .on("error", reject); - }); -} - -async function streamBeaconValidatorsWithRetry(maxRetries = 3) { - let lastErr - for (let attempt = 1; attempt <= maxRetries; attempt++) { - try { - if (attempt > 1) console.log(`Beacon stream attempt ${attempt}/${maxRetries}...`) - return await streamBeaconValidators() - } catch (e) { - lastErr = e - const isTransient = e.code === 'ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC' - || e.code === 'ECONNRESET' - || e.code === 'ETIMEDOUT' - || e.code === 'ENOTFOUND' - || e.code === 'EAI_AGAIN' - || /socket hang up/i.test(e.message || '') - if (!isTransient || attempt === maxRetries) throw e - const wait = 5000 * attempt - console.log(`Beacon stream failed (${e.code || e.message}), retrying in ${wait / 1000}s...`) - await new Promise(r => setTimeout(r, wait)) - } - } - throw lastErr -} - -const abis = { - ValidatorAdded: 'event ValidatorAdded(address indexed owner, uint64[] operatorIds, bytes publicKey, bytes shares, (uint32 validatorCount, uint64 networkFeeIndex, uint64 index, bool active, uint256 balance) cluster)', - ValidatorRemoved: 'event ValidatorRemoved(address indexed owner, uint64[] operatorIds, bytes publicKey, (uint32 validatorCount, uint64 networkFeeIndex, uint64 index, bool active, uint256 balance) cluster)' -} - -let validatorPubKeys = new Set() - -const SSV_CONTRACT = '0xDD9BC35aE942eF0cFa76930954a156B3fF30a4E1' -const DEPLOY_TIMESTAMP = 1685577600 // block 17507487 -const INTER_CALL_DELAY_MS = 10000 - -async function getValidatorsFromEvents() { - let fromTimestamp = DEPLOY_TIMESTAMP - const toTimestamp = Math.floor(Date.now() / 1000) - 3600 - - const localValidatorCache = await sdk.cache.readCache(`ssv-network/validator-events`, { - skipCompression: true, - skipR2Cache: true, - }) - - if (localValidatorCache.fromTimestamp) { - fromTimestamp = localValidatorCache.fromTimestamp - } else { - localValidatorCache.data = {} - } - - if (toTimestamp <= fromTimestamp - 3 * 3600) { - console.log("No new blocks to process for validator events") - Object.keys(localValidatorCache.data).forEach(key => validatorPubKeys.add(key)) - return - } - - console.log(`Fetching validator events from SSV Network from timestamp ${fromTimestamp} to ${toTimestamp}...`) - - // Fetch Removes first into an ordinal map (latest remove ordinal per pubkey) - let removedSeen = 0 - const removeOrdinals = {} - await sdk.indexer.getLogs({ - target: SSV_CONTRACT, - eventAbi: abis.ValidatorRemoved, - onlyArgs: false, - clientStreaming: true, - collect: false, - all: true, - limit: 'all', - fromTimestamp, - toTimestamp, - decoderType: 'ethers', - processor: (event) => { - if (!Array.isArray(event)) event = [event] - for (const ev of event) { - const key = ev.args.publicKey.toLowerCase() - const ord = ev.blockNumber * 1e5 + ev.logIndex - if (!removeOrdinals[key] || removeOrdinals[key] < ord) removeOrdinals[key] = ord - removedSeen++ - } - }, - }) - console.log(`ValidatorRemoved events seen: ${removedSeen}`) - - // Pause to let the SDK clean up its streaming state before the next big call - await new Promise(r => setTimeout(r, INTER_CALL_DELAY_MS)) - - let addedCount = 0 - await sdk.indexer.getLogs({ - target: SSV_CONTRACT, - eventAbi: abis.ValidatorAdded, - onlyArgs: false, - clientStreaming: true, - collect: false, - all: true, - limit: 'all', - fromTimestamp, - toTimestamp, - decoderType: 'ethers', - processor: (event) => { - if (!Array.isArray(event)) event = [event] - for (const ev of event) { - const key = ev.args.publicKey.toLowerCase() - localValidatorCache.data[key] = ev.blockNumber * 1e5 + ev.logIndex - addedCount++ - } - }, - }) - console.log(`ValidatorAdded events processed: ${addedCount}`) - - // Apply removes against the populated add cache - let removedApplied = 0 - for (const [key, removeOrd] of Object.entries(removeOrdinals)) { - if (localValidatorCache.data[key] && localValidatorCache.data[key] < removeOrd) { - delete localValidatorCache.data[key] - removedApplied++ - } - } - console.log(`ValidatorRemoved events applied: ${removedApplied}`) - - localValidatorCache.fromTimestamp = toTimestamp - - await sdk.cache.writeCache(`ssv-network/validator-events`, localValidatorCache, { - skipCompression: true, - skipR2Cache: true, - }) - - Object.keys(localValidatorCache.data).forEach(key => validatorPubKeys.add(key)) - console.log(`Total unique active validator keys: ${validatorPubKeys.size}`) -} - -/** - * Main function to get SSV Network TVL - * Fetches validator keys from SSV API, then streams beacon chain data - * to compute total staked ETH balance - * @param {object} api - DefiLlama API object - */ -async function getSsvTvl(api) { - console.log("Fetching SSV validator keys..."); - await getValidatorsFromEvents(api) - console.log(`Total unique validator keys from events: ${validatorPubKeys.size}`); - - // Balance from beacon API is in gwei, convert to wei - const { totalBalance, validatorCount } = await streamBeaconValidatorsWithRetry(); - console.log(`Matched ${validatorCount} validators with total balance: ${totalBalance / 1e9} ETH`); - api.addGasToken(totalBalance * 1e9); -} - -async function main() { - - const api = new sdk.ChainApi({ chain: 'ethereum' }) - await getSsvTvl(api); - const balances = await api.getBalances(); - - console.log("SSV Network TVL:", balances); - - console.log("Writing to Elastic via fresh client..."); - try { - await writeBalancesToElastic(balances) - } catch (e) { - console.error("Elastic write FAILED:", e.message, e.stack); - throw e; - } -} - -main().catch((err) => { - console.error("Error computing SSV Network TVL:", err); - process.exit(1); -}).then(() => process.exit(0)); \ No newline at end of file diff --git a/projects/helper/custom-scripts/ssv/package.json b/projects/helper/custom-scripts/ssv/package.json deleted file mode 100644 index f99d3cf7e34..00000000000 --- a/projects/helper/custom-scripts/ssv/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "ssv", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "packageManager": "pnpm@10.23.0", - "dependencies": { - "@elastic/elasticsearch": "8.19.1", - "stream": "^0.0.3", - "stream-json": "^1.9.1" - } -} diff --git a/projects/helper/custom-scripts/ssv/pnpm-lock.yaml b/projects/helper/custom-scripts/ssv/pnpm-lock.yaml deleted file mode 100644 index 1f5e08c7a1d..00000000000 --- a/projects/helper/custom-scripts/ssv/pnpm-lock.yaml +++ /dev/null @@ -1,173 +0,0 @@ -lockfileVersion: '9.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -importers: - - .: - dependencies: - '@elastic/elasticsearch': - specifier: 8.19.1 - version: 8.19.1 - stream: - specifier: ^0.0.3 - version: 0.0.3 - stream-json: - specifier: ^1.9.1 - version: 1.9.1 - -packages: - - '@elastic/elasticsearch@8.19.1': - resolution: {integrity: sha512-+1j9NnQVOX+lbWB8LhCM7IkUmjU05Y4+BmSLfusq0msCsQb1Va+OUKFCoOXjCJqQrcgdRdQCjYYyolQ/npQALQ==} - engines: {node: '>=18'} - - '@elastic/transport@8.11.0': - resolution: {integrity: sha512-1QD1j7gQF8+tVrf+UOcOrLF1LXnhBYwBnNl4xd+fYxkQONjaOjiTcfqXcALHesKezUv8wRzv3tedEnhtYLBmhw==} - engines: {node: '>=18'} - - '@opentelemetry/api@1.9.1': - resolution: {integrity: sha512-gLyJlPHPZYdAk1JENA9LeHejZe1Ti77/pTeFm/nMXmQH/HFZlcS/O2XJB+L8fkbrNSqhdtlvjBVjxwUYanNH5Q==} - engines: {node: '>=8.0.0'} - - '@opentelemetry/core@2.11.0': - resolution: {integrity: sha512-7YP44XH0tV6+Mb54x2YGf84i7yi+31MBZlE8JwvozkxyTvXbSp10X7cI7YE49ChJ3shMJoBmCJF3+1QFBJctGA==} - engines: {node: ^18.19.0 || >=20.6.0} - peerDependencies: - '@opentelemetry/api': '>=1.0.0 <1.10.0' - - '@opentelemetry/semantic-conventions@1.43.0': - resolution: {integrity: sha512-eSYWTm620tTk45EKSedaUL8MFYI8hW164hIXsgIHyxu3VobUB3fFCu5t0hQby6OoWRPsG1KkKUG2M5UadiLiVg==} - engines: {node: '>=14'} - - '@types/node@25.9.8': - resolution: {integrity: sha512-VfMrScDmMhUJQmd5hArdQnFvK0OIeD36uN2Va1FcpYaLB/BgkgM8Ulc50XtYISPMz7APJ30+N0T5EM0jlcdfRw==} - - apache-arrow@21.2.0: - resolution: {integrity: sha512-Hxe6Agq26gQOM954qpzYSllJBPJl+e16U5CkfuMUhLrNba+5nKkttIVlflaovN6oaTratqMGAO8H5u/aNhmHWQ==} - hasBin: true - - component-emitter@2.0.0: - resolution: {integrity: sha512-4m5s3Me2xxlVKG9PkZpQqHQR7bgpnN7joDMJ4yvVkVXngjoITG76IaZmzmywSeRTeTpc6N6r3H3+KyUurV8OYw==} - engines: {node: '>=18'} - - debug@4.4.3: - resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - - flatbuffers@25.9.23: - resolution: {integrity: sha512-MI1qs7Lo4Syw0EOzUl0xjs2lsoeqFku44KpngfIduHBYvzm8h2+7K8YMQh1JtVVVrUvhLpNwqVi4DERegUJhPQ==} - - hpagent@1.2.0: - resolution: {integrity: sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==} - engines: {node: '>=14'} - - json-with-bigint@3.5.12: - resolution: {integrity: sha512-uwbF/wSSuOgC7qqlq27Xp5B6a2MHVug3t0idZdTqu0JnlFvgJuH7ju+KAk/J06C7GfhoYy2gnb9wz2INqcne7w==} - - ms@2.1.3: - resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - - secure-json-parse@3.0.2: - resolution: {integrity: sha512-H6nS2o8bWfpFEV6U38sOSjS7bTbdgbCGU9wEM6W14P5H0QOsz94KCusifV44GpHDTu2nqZbuDNhTzu+mjDSw1w==} - - stream-chain@2.2.5: - resolution: {integrity: sha512-1TJmBx6aSWqZ4tx7aTpBDXK0/e2hhcNSTV8+CbFJtDjbb+I1mZ8lHit0Grw9GRT+6JbIrrDd8esncgBi8aBXGA==} - - stream-json@1.9.1: - resolution: {integrity: sha512-uWkjJ+2Nt/LO9Z/JyKZbMusL8Dkh97uUBTv3AJQ74y07lVahLY4eEFsPsE97pxYBwr8nnjMAIch5eqI0gPShyw==} - - stream@0.0.3: - resolution: {integrity: sha512-aMsbn7VKrl4A2T7QAQQbzgN7NVc70vgF5INQrBXqn4dCXN1zy3L9HGgLO5s7PExmdrzTJ8uR/27aviW8or8/+A==} - - tslib@2.8.1: - resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} - - undici-types@7.24.6: - resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==} - - undici@6.29.0: - resolution: {integrity: sha512-R+RODBqp6i2pPflGdq+xIOUkl+RNfGgHwoinecKu/JCuf2uO06cOKoDbI2P7Dn6KcswdKwrczbU6IYJ6K8X+wg==} - engines: {node: '>=18.17'} - -snapshots: - - '@elastic/elasticsearch@8.19.1': - dependencies: - '@elastic/transport': 8.11.0 - apache-arrow: 21.2.0 - tslib: 2.8.1 - transitivePeerDependencies: - - supports-color - - '@elastic/transport@8.11.0': - dependencies: - '@opentelemetry/api': 1.9.1 - '@opentelemetry/core': 2.11.0(@opentelemetry/api@1.9.1) - debug: 4.4.3 - hpagent: 1.2.0 - ms: 2.1.3 - secure-json-parse: 3.0.2 - tslib: 2.8.1 - undici: 6.29.0 - transitivePeerDependencies: - - supports-color - - '@opentelemetry/api@1.9.1': {} - - '@opentelemetry/core@2.11.0(@opentelemetry/api@1.9.1)': - dependencies: - '@opentelemetry/api': 1.9.1 - '@opentelemetry/semantic-conventions': 1.43.0 - - '@opentelemetry/semantic-conventions@1.43.0': {} - - '@types/node@25.9.8': - dependencies: - undici-types: 7.24.6 - - apache-arrow@21.2.0: - dependencies: - '@types/node': 25.9.8 - flatbuffers: 25.9.23 - json-with-bigint: 3.5.12 - tslib: 2.8.1 - - component-emitter@2.0.0: {} - - debug@4.4.3: - dependencies: - ms: 2.1.3 - - flatbuffers@25.9.23: {} - - hpagent@1.2.0: {} - - json-with-bigint@3.5.12: {} - - ms@2.1.3: {} - - secure-json-parse@3.0.2: {} - - stream-chain@2.2.5: {} - - stream-json@1.9.1: - dependencies: - stream-chain: 2.2.5 - - stream@0.0.3: - dependencies: - component-emitter: 2.0.0 - - tslib@2.8.1: {} - - undici-types@7.24.6: {} - - undici@6.29.0: {} diff --git a/projects/ssv-network/index.js b/projects/ssv-network/index.js index ad96d35a88a..7bd49baf6e8 100644 --- a/projects/ssv-network/index.js +++ b/projects/ssv-network/index.js @@ -1,5 +1,58 @@ -const { customScriptTvlExports } = require('../helper/utils'); +const { Interface } = require('ethers') +const { getCache, setCache } = require('../helper/cache') +const { getLogs2 } = require('../helper/cache/getLogs') +const { post } = require('../helper/http') -module.exports = customScriptTvlExports({ - ethereum: 'ssv-network', -}) \ No newline at end of file +const SSV_NETWORK = '0xDD9BC35aE942eF0cFa76930954a156B3fF30a4E1' +const FROM_BLOCK = 17507487 +const CATCH_UP_BLOCKS = 50_000 +const FINALITY_BLOCKS = 64 +const BEACON_VALIDATORS = 'https://ethereum-beacon-api.publicnode.com/eth/v1/beacon/states/finalized/validators' +const BEACON_BATCH = 2000 + +const CLUSTER = '(uint32 validatorCount, uint64 networkFeeIndex, uint64 index, bool active, uint256 balance) cluster' +const VALIDATOR_ADDED = `event ValidatorAdded(address indexed owner, uint64[] operatorIds, bytes publicKey, bytes shares, ${CLUSTER})` +const VALIDATOR_REMOVED = `event ValidatorRemoved(address indexed owner, uint64[] operatorIds, bytes publicKey, ${CLUSTER})` +const iface = new Interface([VALIDATOR_ADDED, VALIDATOR_REMOVED]) + +// raw logs (no eventAbi) keep block number and log index for ordering, skipCache keeps them out of the cache +const getEvents = (api, name, fromBlock, toBlock) => getLogs2({ + api, target: SSV_NETWORK, topics: [iface.getEvent(name).topicHash], extraKey: name, fromBlock, toBlock, skipCache: true, + transform: log => ({ block: log.blockNumber, index: Number(log.logIndex ?? log.index), isAdd: name === 'ValidatorAdded', key: iface.parseLog(log).args.publicKey.toLowerCase() }), +}) + +async function getValidatorKeys(api) { + const cache = await getCache('ssv-network', 'validators') + const live = new Set(cache.keys ?? []) + let toBlock = cache.toBlock ?? FROM_BLOCK - 1 + const end = (await api.getBlock()) - FINALITY_BLOCKS + let savedAt = Date.now() + while (toBlock < end) { + const fromBlock = toBlock + 1 + toBlock = Math.min(toBlock + CATCH_UP_BLOCKS, end) + const events = (await Promise.all(['ValidatorAdded', 'ValidatorRemoved'].map(name => getEvents(api, name, fromBlock, toBlock)))).flat() + events.sort((a, b) => a.block - b.block || a.index - b.index).forEach(({ isAdd, key }) => isAdd ? live.add(key) : live.delete(key)) + if (toBlock === end || Date.now() - savedAt > 60_000) { + await setCache('ssv-network', 'validators', { toBlock, keys: [...live] }) + savedAt = Date.now() + } + } + return [...live] +} + +async function tvl(api) { + const keys = await getValidatorKeys(api) + let gwei = 0n + for (let i = 0; i < keys.length; i += BEACON_BATCH) { + const { data } = await post(BEACON_VALIDATORS, { ids: keys.slice(i, i + BEACON_BATCH) }) + data.forEach(({ balance }) => gwei += BigInt(balance)) + } + api.addGasToken((gwei * 10n ** 9n).toString()) +} + +module.exports = { + timetravel: false, + isHeavyProtocol: true, + methodology: 'Sums the beacon chain balances of all validators registered on the SSV Network contract (ValidatorAdded minus ValidatorRemoved, replayed in chain order).', + ethereum: { tvl }, +} From 80b0c8a36b93588e65b79e13315337fe55cf2dfd Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 10 Nov 2026 11:30:24 +0100 Subject: [PATCH 670/988] bugfix --- projects/helper/custom-scripts/metadao/jfile | 10 +++++++--- .../helper/custom-scripts/sushi-analytics-v2/jfile | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/projects/helper/custom-scripts/metadao/jfile b/projects/helper/custom-scripts/metadao/jfile index 780cf666088..584f8440601 100644 --- a/projects/helper/custom-scripts/metadao/jfile +++ b/projects/helper/custom-scripts/metadao/jfile @@ -26,7 +26,7 @@ pipeline { pnpm --version echo "=== Installing root dependencies ===" - pnpm install --frozen-lockfile --ignore-scripts + pnpm install --frozen-lockfile --ignore-scripts --ignore-workspace --config.minimum-release-age=0 ''' } } @@ -38,7 +38,9 @@ pipeline { dir("${env.WORKSPACE}/projects/helper/custom-scripts/metadao") { sh ''' echo "=== Installing metadao dependencies ===" - pnpm install --frozen-lockfile --ignore-scripts + # --ignore-workspace: the repo root has a pnpm-workspace.yaml with no packages, without the flag + # pnpm resolves to the root workspace, reports "Already up to date" and never installs this package.json + pnpm install --frozen-lockfile --ignore-scripts --ignore-workspace ''' } } @@ -52,7 +54,9 @@ pipeline { script { def timestamp = new Date().format("yyyy-MM-dd_HH-mm-ss", TimeZone.getTimeZone('UTC')) - sh """ + // bash + pipefail: with plain sh the pipeline only sees tee's exit code, so a crashing script was reported as SUCCESS + sh """#!/bin/bash + set -eo pipefail echo "=== Running MetaDAO TVL Script ===" echo "Start time: ${timestamp}" diff --git a/projects/helper/custom-scripts/sushi-analytics-v2/jfile b/projects/helper/custom-scripts/sushi-analytics-v2/jfile index 2d7c34f4e9d..34383a449c4 100644 --- a/projects/helper/custom-scripts/sushi-analytics-v2/jfile +++ b/projects/helper/custom-scripts/sushi-analytics-v2/jfile @@ -53,7 +53,9 @@ pipeline { script { def timestamp = new Date().format("yyyy-MM-dd_HH-mm-ss", TimeZone.getTimeZone('UTC')) - sh """ + // bash + pipefail: with plain sh the pipeline only sees tee's exit code, so a crashing script is reported as SUCCESS + sh """#!/bin/bash + set -eo pipefail echo "=== Running sushi analytics TVL Script ===" echo "Start time: ${timestamp}" From ea48c43b16b3f37bcc01a59b81d97d0a494b2c03 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 10 Nov 2026 13:28:22 +0100 Subject: [PATCH 671/988] bugfix --- projects/helper/custom-scripts/metadao/index.js | 2 +- projects/helper/utils.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/projects/helper/custom-scripts/metadao/index.js b/projects/helper/custom-scripts/metadao/index.js index 6a264897686..cf966682d6b 100644 --- a/projects/helper/custom-scripts/metadao/index.js +++ b/projects/helper/custom-scripts/metadao/index.js @@ -604,7 +604,7 @@ async function main() { chain: 'solana', project: 'metadao/futarchy-dao-treasuries', balances, - timestamp: Math.floor(Date.now() / 1000), + timestamp: Date.now(), // epoch ms, what getCustomScriptTvl's freshness check expects }); } diff --git a/projects/helper/utils.js b/projects/helper/utils.js index f29606627d9..44e7fc579d3 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -370,7 +370,9 @@ function getCustomScriptTvl(chain, project) { { range: { timestamp: { - gte: Math.floor(Date.now() / 1000) - 24 * 60 * 60, // last 24 hours + // last 24 hours; log timestamps are epoch milliseconds (sdk.elastic.writeLog default). + // comparing against a seconds threshold accepted any log, however old - metadao served April balances for months + gte: Date.now() - 24 * 60 * 60 * 1000, }, }, }, @@ -383,7 +385,10 @@ function getCustomScriptTvl(chain, project) { }) if (cachedLog?.hits?.hits?.length > 0) { - const balances = cachedLog.hits.hits[0]._source.balances + const { balances, timestamp } = cachedLog.hits.hits[0]._source + // belt and braces: a script that stamps seconds would slip past the range filter above + if (timestamp < Date.now() - 24 * 60 * 60 * 1000) + throw new Error(`Latest custom script log for ${project}/${chain} is stale (timestamp ${timestamp})`) return balances } throw new Error("No recent cached TVL found, run the custom script to populate the cache") From ffc4f6c8c1fdbe758de58c931014bff117973495 Mon Sep 17 00:00:00 2001 From: Aurumlend Date: Wed, 11 Nov 2026 00:22:40 +0800 Subject: [PATCH 672/988] Add aurumlend(Arc) (#22120) Co-authored-by: FelixBruguera --- registries/compound.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/registries/compound.js b/registries/compound.js index 74fb9f85633..f02ae9632bc 100644 --- a/registries/compound.js +++ b/registries/compound.js @@ -666,6 +666,9 @@ const configs = { bitkub: { comptroller: '0x42f098E6aE5e81f357D3fD6e104BAA77A195133A', cether: '0x0cA8DaD1e517a9BB760Ba0C27051C4C3A036eA75' }, klaytn: { comptroller: '0x2591d179a0B1dB1c804210E111035a3a13c95a48', cether: '0x2029f3E3C667EBd68b1D29dbd61dc383BdbB56e5' }, }, + 'aurumlend': { + arc: { comptroller: '0x966168Ecd30bf368acB7d18f1c64afEE34941233', } + } } module.exports = buildProtocolExports(configs, compoundExportFn) From 43264f7bae28471ae56008c7b99bd720ae00184c Mon Sep 17 00:00:00 2001 From: Denys Leshchenko <103111651+Dill777@users.noreply.github.com> Date: Tue, 10 Nov 2026 20:01:44 +0100 Subject: [PATCH 673/988] Add Flowlex TVL (#22121) Co-authored-by: FelixBruguera --- projects/flowlex/index.js | 132 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 projects/flowlex/index.js diff --git a/projects/flowlex/index.js b/projects/flowlex/index.js new file mode 100644 index 00000000000..621d832328f --- /dev/null +++ b/projects/flowlex/index.js @@ -0,0 +1,132 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { unwrapUniswapV3NFT } = require('../helper/unwrapLPs') + +// Flowlex is non-custodial: users open Uniswap V3 positions through the LP manager, a pass-through helper that holds +// no funds and sends the position NFT straight to the user's own smart wallet. Those wallets can hold other Uniswap +// positions, so we count only the token ids the manager itself minted (it emits them). +// Every position is counted as liquidity plus its uncollected fees. Closed positions drop out: +// withdraw leaves zero liquidity and burn removes the NFT. +const config = { + base: { + manager: '0xE20435aC8160aa58ADea4A1fc5641bB5aDAED053', + managerFromBlock: 44474281, + openEvents: ['positionOpened'], + nfpm: '0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1', // Uniswap V3 NonfungiblePositionManager + }, + robinhood: { + // same manager address as on Base; this deployment can also open from the pool's own tokens + manager: '0xE20435aC8160aa58ADea4A1fc5641bB5aDAED053', + managerFromBlock: 106211342, + openEvents: ['positionOpened', 'positionOpenedDual'], + nfpm: '0x73991a25C818Bf1f1128dEAaB1492D45638DE0D3', + }, +} + +const abis = { + positionOpened: 'event PositionOpened(address indexed user, uint256 indexed tokenId, address pool, uint256 depositAmount, uint256 commission)', + positionOpenedDual: 'event PositionOpenedDual(address indexed user, uint256 indexed tokenId, address pool, uint256 amountUsdc, uint256 amountOther, uint256 commissionUsdc, uint256 commissionOther)', + positionRebalanced: 'event PositionRebalanced(address indexed user, uint256 indexed oldTokenId, uint256 indexed newTokenId)', + ownerOf: 'function ownerOf(uint256) view returns (address)', + positions: 'function positions(uint256) view returns (uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', + factory: 'address:factory', + getPool: 'function getPool(address, address, uint24) view returns (address)', + slot0: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)', + feeGrowthGlobal0X128: 'uint256:feeGrowthGlobal0X128', + feeGrowthGlobal1X128: 'uint256:feeGrowthGlobal1X128', + ticks: 'function ticks(int24) view returns (uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized)', +} + +async function managerTokenIds(api, cfg) { + const fetch = (event) => getLogs2({ api, target: cfg.manager, eventAbi: abis[event], fromBlock: cfg.managerFromBlock, extraKey: event }) + const ids = [] + for (const event of cfg.openEvents) { + const logs = await fetch(event) + ids.push(...logs.map(i => i.tokenId)) + } + const rebalanced = await fetch('positionRebalanced') + ids.push(...rebalanced.map(i => i.newTokenId)) + return [...new Set(ids.map(String))] +} + +// A failed ownerOf in the batch is retried alone: the id is dropped only when the position manager confirms the token +// does not exist (burned); any other failure (e.g. RPC) throws instead of silently undercounting. +async function isLive(api, nfpm, id) { + try { + await api.call({ abi: abis.ownerOf, target: nfpm, params: [id] }) + return true + } catch (e) { + if (String(e?.message ?? e).includes('nonexistent token')) return false + throw e + } +} + +// Fees a position could collect right now: tokensOwed plus what it earned since its last update, +// using the same fee-growth math as the Uniswap V3 position manager. +const Q128 = 2n ** 128n +const MOD = 2n ** 256n +const sub = (a, b) => ((a - b) % MOD + MOD) % MOD + +async function addUncollectedFees(api, nfpm, positionIds) { + const positions = (await api.multiCall({ abi: abis.positions, target: nfpm, calls: positionIds })).filter(p => BigInt(p.liquidity) > 0n || BigInt(p.tokensOwed0) > 0n || BigInt(p.tokensOwed1) > 0n) + if (!positions.length) return + + const factory = await api.call({ abi: abis.factory, target: nfpm }) + const pools = await api.multiCall({ abi: abis.getPool, target: factory, calls: positions.map(p => ({ params: [p.token0, p.token1, p.fee] })) }) + const uniquePools = [...new Set(pools)] + const slot0s = await api.multiCall({ abi: abis.slot0, calls: uniquePools }) + const global0s = await api.multiCall({ abi: abis.feeGrowthGlobal0X128, calls: uniquePools }) + const global1s = await api.multiCall({ abi: abis.feeGrowthGlobal1X128, calls: uniquePools }) + const lowers = await api.multiCall({ abi: abis.ticks, calls: positions.map((p, i) => ({ target: pools[i], params: [p.tickLower] })) }) + const uppers = await api.multiCall({ abi: abis.ticks, calls: positions.map((p, i) => ({ target: pools[i], params: [p.tickUpper] })) }) + const poolState = {} + uniquePools.forEach((pool, i) => { poolState[pool] = { tick: Number(slot0s[i].tick), global: [BigInt(global0s[i]), BigInt(global1s[i])] } }) + + positions.forEach((p, i) => { + const { tick, global } = poolState[pools[i]] + const tickLower = Number(p.tickLower) + const tickUpper = Number(p.tickUpper) + const liquidity = BigInt(p.liquidity) + const last = [BigInt(p.feeGrowthInside0LastX128), BigInt(p.feeGrowthInside1LastX128)] + const owed = [BigInt(p.tokensOwed0), BigInt(p.tokensOwed1)] + const outside = (t, k) => BigInt(t[k === 0 ? 'feeGrowthOutside0X128' : 'feeGrowthOutside1X128']) + + ;[p.token0, p.token1].forEach((token, k) => { + const below = tick >= tickLower ? outside(lowers[i], k) : sub(global[k], outside(lowers[i], k)) + const above = tick < tickUpper ? outside(uppers[i], k) : sub(global[k], outside(uppers[i], k)) + const inside = sub(sub(global[k], below), above) + const earned = (liquidity * sub(inside, last[k])) / Q128 + const total = owed[k] + earned + if (total > 0n) api.add(token, total.toString()) + }) + }) +} + +async function tvl(api) { + const cfg = config[api.chain] + const ids = await managerTokenIds(api, cfg) + if (!ids.length) return + + // Burned NFTs revert on positions(), so keep only ids that still exist. + const owners = await api.multiCall({ abi: abis.ownerOf, target: cfg.nfpm, calls: ids, permitFailure: true }) + const positionIds = [] + for (let i = 0; i < ids.length; i++) { + if (owners[i] || await isLive(api, cfg.nfpm, ids[i])) positionIds.push(ids[i]) + } + if (!positionIds.length) return + + await unwrapUniswapV3NFT({ api, nftAddress: cfg.nfpm, uniV3ExtraConfig: { positionIds } }) + await addUncollectedFees(api, cfg.nfpm, positionIds) +} + +module.exports = { + doublecounted: true, + methodology: + 'Counts the Uniswap V3 positions opened through Flowlex, valued at the pool\'s current price, plus each position\'s uncollected fees. ' + + 'Positions are the NFTs minted by the Flowlex LP manager (found by its PositionOpened and PositionRebalanced events); they sit in ' + + 'the users\' own smart wallets, and other Uniswap positions in those wallets are not counted. Closed and burned positions are ' + + 'excluded. Double counted with Uniswap V3.', +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) From ac64f1ee723b57b927e9c5a7a3b05f2705624b25 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 10 Nov 2026 15:26:21 -0400 Subject: [PATCH 674/988] Coinlotto (#22130) Co-authored-by: Mike Pachevskii --- projects/coinlotto/index.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/projects/coinlotto/index.js b/projects/coinlotto/index.js index bf4eef00392..fe9516704e7 100644 --- a/projects/coinlotto/index.js +++ b/projects/coinlotto/index.js @@ -1,14 +1,12 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + const getLotteryBatchAbi = 'function getLotteryBatch(uint256[] lotteryIds) view returns (tuple(uint256 lotteryId, address manager, tuple(address creator, uint8 kind, uint8 model, tuple(uint256 ticketPrice, address asset, uint256 feeBp, uint24 maxTickets, uint64 startTime, uint64 endTime) params, uint256 payoutRateBp, uint256 cltAmountPerTicket, uint256 feederSuperLotteryId, uint256 feederAllocBp) lottery, tuple(uint8 status, uint64 drawDeadline, uint32 drawGeneration, uint256 seed, uint256 referrerFees, uint256 creatorFees, uint256 prizePool, uint256 claimedPrizePool, uint256 currentPrizePool) state, uint256 ticketsSold, uint16[] tiers)[] results)' const LOTTERY_HUB = '0x4958CB13Fa5881B2c67bde408708e72411Bb3bbb' const BATCH_SIZE = 100 -/** - * Sums the remaining prize pool (`currentPrizePool`) of every lottery registered in the LotteryHub. - * Lottery IDs are enumerated on-chain via `lotteryCount()` and fetched in batches of `BATCH_SIZE`. - * Manager balances are not used: they also hold refunds, creator fees, referral revenue share and treasury funds. - * @param {import('@defillama/sdk').ChainApi} api - DefiLlama chain API for the target chain and block - */ +// Lottery managers and ticket assets are discovered from the LotteryHub; TVL is the managers' balances of those assets. +// SUPER lotteries are funded by REGULAR feeder lotteries, so their prize assets are already among the ticket assets. async function tvl(api) { const lotteryCount = Number(await api.call({ abi: 'uint256:lotteryCount', target: LOTTERY_HUB })) if (!lotteryCount) return @@ -19,13 +17,14 @@ async function tvl(api) { for (let i = 0; i < ids.length; i += BATCH_SIZE) calls.push({ params: [ids.slice(i, i + BATCH_SIZE)] }) - const batches = await api.multiCall({ abi: getLotteryBatchAbi, target: LOTTERY_HUB, calls }) - for (const lottery of batches.flat()) - api.add(lottery.lottery.params.asset, lottery.state.currentPrizePool) + const lotteries = (await api.multiCall({ abi: getLotteryBatchAbi, target: LOTTERY_HUB, calls })).flat() + const owners = [...new Set(lotteries.map(l => l.manager))] + const tokens = [...new Set(lotteries.map(l => l.lottery.params.asset))] + return sumTokens2({ api, owners, tokens }) } module.exports = { - methodology: "TVL is the sum of the remaining prize pools (prize pool minus already claimed prizes) of all lotteries registered in the LotteryHub contract, read on-chain on each supported chain.", + methodology: "TVL is the balance of the lottery assets (ticket and prize tokens) held by the CoinLotto lottery manager contracts registered in the LotteryHub. This covers prize pools awaiting draws and claims, plus creator and referrer fees not yet withdrawn.", start: '2026-10-27', } From 70e277b4aa5baa3f8b63d51c5b35a567ff611a43 Mon Sep 17 00:00:00 2001 From: srijani-raccoons Date: Wed, 11 Nov 2026 01:16:08 +0530 Subject: [PATCH 675/988] add Jupiter Vaults TVL adapter (#22123) Co-authored-by: FelixBruguera --- projects/jupiter-vaults/index.js | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 projects/jupiter-vaults/index.js diff --git a/projects/jupiter-vaults/index.js b/projects/jupiter-vaults/index.js new file mode 100644 index 00000000000..bc134cbc469 --- /dev/null +++ b/projects/jupiter-vaults/index.js @@ -0,0 +1,40 @@ +const { getProvider } = require('../helper/solana') +const { PublicKey } = require('@solana/web3.js') + +// IDL: https://github.com/jup-ag/earn-vaults-curators-sdk/blob/main/idl.json +const PROGRAM_ID = new PublicKey('JUPVau1tSdENvv7KCwFY6Geer1a442q9mAfmaRXm83g') + +// Vault account: tag byte 1, aum (u64, USD 6 decimals) at offset 137, +// positions: 8 x PositionConfig (28 bytes) at offset 1705 -> protocol u8 at +0, lastValue u64 (USD 6 decimals) at +12 +const VAULT_TAG = Buffer.from([1]) +const OFF_AUM = 137 +const OFF_POSITIONS = 1705 +const POSITION_SIZE = 28 +const POSITION_COUNT = 8 +const PROTOCOL_NEST = 4 // Protocol enum: spotTokens, offerbook, jupiterLend, ccip, nest + +async function tvl(api) { + const connection = getProvider(api.chain).connection + const vaults = await connection.getProgramAccounts(PROGRAM_ID, { + dataSlice: { offset: OFF_AUM, length: OFF_POSITIONS + POSITION_SIZE * POSITION_COUNT - OFF_AUM }, + filters: [{ memcmp: { offset: 0, bytes: VAULT_TAG.toString('base64'), encoding: 'base64' } }], + }) + let aum = 0n + for (const { account: { data } } of vaults) { + aum += data.readBigUInt64LE(0) + // nest positions are shares of another vault whose aum is already summed here + for (let i = 0; i < POSITION_COUNT; i++) { + const o = OFF_POSITIONS - OFF_AUM + i * POSITION_SIZE + if (data[o] === PROTOCOL_NEST) aum -= data.readBigUInt64LE(o + 12) + } + } + api.addUSDValue(Number(aum) / 1e6) +} + +module.exports = { + doublecounted: true, + misrepresentedTokens: true, + timetravel: false, + methodology: 'Sum of the USD value (aum) recorded on each Jupiter Vault account, minus positions held in other Jupiter Vaults (nest), which are already counted in those vaults. Vault deposits are deployed into Jupiter Lend and Jupiter Offerbook and are already counted there, so this TVL is marked doublecounted.', + solana: { tvl }, +} From 1179f2d6fb409ee4060c021a57aacfbf15c7eeeb Mon Sep 17 00:00:00 2001 From: B`nh Nguyen Hai <164451578+negativez2@users.noreply.github.com> Date: Wed, 11 Nov 2026 03:38:12 +0700 Subject: [PATCH 676/988] Add Pendle Loop (#22126) --- projects/pendle-loop/index.js | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 projects/pendle-loop/index.js diff --git a/projects/pendle-loop/index.js b/projects/pendle-loop/index.js new file mode 100644 index 00000000000..629b3ca075d --- /dev/null +++ b/projects/pendle-loop/index.js @@ -0,0 +1,53 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +// Same addresses on every chain +const LOOPER = '0xF82Ef4080A53b71093f9c470676Fc80E2ADC4263' +const LOOPER_VIEW = '0x887b00B5F584f1cC015e8f68C29d6Feb6bf95b02' +const BOX_FACTORY = '0xe5125dfE3Fc232723E7Ae17cFa66034b3BCAC696' + +const config = { + ethereum: { fromBlock: 25529371 }, + arbitrum: { fromBlock: 491662229 }, + base: { fromBlock: 52757118 }, + plasma: { fromBlock: 27074014 }, + xlayer: { fromBlock: 69388397 }, + robinhood: { fromBlock: 98117595 }, + monad: { fromBlock: 88900541 }, +} + +const abi = { + PositionIncreased: 'event PositionIncreased(address indexed owner, bytes32 indexed boxId, bytes32 requestHash, uint256 nonce, uint256 preInBalance, uint256 netPtToMM, uint256 postDebtBalance)', + boxData: 'function boxData(bytes32 boxId) view returns ((uint32 hubChainId, uint32 spokeChainId, address hubPt, address hubDebtToken, address spokePt, address spokeDebtToken, address spokeMMBeacon, bytes32 mmPayload))', + getAll: 'function getAll(address owner, bytes32 boxId) returns ((uint256 mmPtBalance, uint256 mmDebtBalance, uint256 ltv, uint256 liquidationThreshold, uint256 borrowingLiquidity, uint256 lendingLiquidity, (address token, uint256 claimable)[] borrowingRewards, (address token, uint256 claimable)[] lendingRewards, (uint256 minBorrowing, uint256 maxBorrowing, uint256 minBorrowingForRewards, uint256 minLending, uint256 maxLending, uint256 minLendingForRewards) limits, uint256 borrowingRate, uint256 lendingRate, uint256 ptDebtRateWad))', +} + +// A position is one (owner, boxId) pair. Its collateral and debt sit in a money market (Morpho, Aave, Euler, ...) +// under a per-position account, and the looper view reads the collateral balance from the money market. +async function tvl(api) { + const { fromBlock } = config[api.chain] + const logs = await getLogs2({ api, target: LOOPER, eventAbi: abi.PositionIncreased, fromBlock }) + const seen = new Set() + const positions = [] + logs.forEach(({ owner, boxId }) => { + const key = `${owner}-${boxId}`.toLowerCase() + if (seen.has(key)) return + seen.add(key) + positions.push({ owner, boxId }) + }) + + const boxIds = [...new Set(positions.map(p => p.boxId))] + const boxes = await api.multiCall({ abi: abi.boxData, target: BOX_FACTORY, calls: boxIds }) + const boxById = Object.fromEntries(boxIds.map((id, i) => [id, boxes[i]])) + + const balances = await api.multiCall({ abi: abi.getAll, target: LOOPER_VIEW, calls: positions.map(p => ({ params: [p.owner, p.boxId] })) }) + balances.forEach((balance, i) => api.add(boxById[positions[i].boxId].spokePt, balance.mmPtBalance)) +} + +module.exports = { + doublecounted: true, + methodology: 'PendleLoop opens leveraged positions on Pendle PTs and other yield-bearing tokens through lending markets (Morpho, Aave, Euler and others). TVL is the collateral of every position. The collateral is held in the lending markets and PT collateral is also part of Pendle TVL, so the listing is doublecounted.', +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) From 5e14572bf4f6c7c9cecd3fc53dfe75483461118d Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 10 Nov 2026 16:29:21 -0500 Subject: [PATCH 677/988] Add Helios (Elysium) (#22129) Co-authored-by: veyr0x <209966354+veyr0x@users.noreply.github.com> Co-authored-by: FelixBruguera --- projects/heliosliq/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/heliosliq/index.js diff --git a/projects/heliosliq/index.js b/projects/heliosliq/index.js new file mode 100644 index 00000000000..b94d3e6fa50 --- /dev/null +++ b/projects/heliosliq/index.js @@ -0,0 +1,26 @@ +const { getHookPools, addUniV4PoolReserves } = require('../helper/uniswapV4') + +// Helios (https://heliosliq.app): DLMM (bin) and DAMM (full range) pools on Elysium. They are Uniswap v4 pools +// carrying the Helios fee hook, so each pool's reserves are rebuilt on chain from its tick liquidity and +// current price (StateView). The tokens sit in the Uniswap v4 PoolManager, which uniswap-v4 also counts. +const POOL_MANAGER = '0xE2e105d3F7209A9DA11f83cCf3E7398a753823F1' // Uniswap v4 PoolManager on Elysium +const STATE_VIEW = '0x27eD73aE0652fdCf71d6793412A7525f32bE9dfE' // Uniswap v4 StateView on Elysium +const FROM_BLOCK = 256083 // same as the uniswap-v4 adapter, so the Initialize log cache is shared with it +const FEE_HOOKS = [ + '0xa129c69D439f30e6FfACC435a1627b7f4F9d30c4', // HeliosFeeHook + '0x885E170Ab95421C38175d6aD43017b54AD6E30c4', // HeliosFeeHook v2 +] + +async function tvl(api) { + const pools = [] + for (const hook of FEE_HOOKS) + pools.push(...await getHookPools({ api, hook, poolManager: POOL_MANAGER, fromBlock: FROM_BLOCK })) + await addUniV4PoolReserves({ api, pools, stateView: STATE_VIEW }) +} + +module.exports = { + doublecounted: true, // the pools live in the Uniswap v4 PoolManager, which the uniswap-v4 adapter counts too + methodology: 'Counts the liquidity in Helios DLMM and DAMM pools: the Uniswap v4 pools that carry the Helios fee hook. Pools are found from the PoolManager\'s Initialize events and their reserves are rebuilt on chain from tick liquidity and the current price via StateView. The pools sit in the Uniswap v4 PoolManager, so the TVL is double counted with Uniswap v4.', + start: '2026-11-04', + elysium: { tvl }, +} From 518f43b824e45b07bd522691e7d156c5dbfd7c6c Mon Sep 17 00:00:00 2001 From: Pedro Ferreira <81267194+Pedro-Ferreira-89@users.noreply.github.com> Date: Tue, 10 Nov 2026 21:33:11 +0000 Subject: [PATCH 678/988] Add Indexfy TVL adapter (#22125) Co-authored-by: FelixBruguera --- projects/indexfy/index.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 projects/indexfy/index.js diff --git a/projects/indexfy/index.js b/projects/indexfy/index.js new file mode 100644 index 00000000000..0b855e39750 --- /dev/null +++ b/projects/indexfy/index.js @@ -0,0 +1,33 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// IndexfyFolioFactory on Base: every Indexfy index (a Reserve Folio) is deployed through it +const FACTORY = '0xf6e0F9eB258F3201738b5ced92beA1ef44F9C497' +const FROM_BLOCK = 52828011 + +async function tvl(api) { + const logs = await getLogs({ + api, + target: FACTORY, + eventAbi: 'event FolioDeployed(address indexed creator, address indexed timelock, address indexed folio)', + fromBlock: FROM_BLOCK, + onlyArgs: true, + }) + const allFolios = logs.map((log) => log.folio) + // skip fully redeemed indexes: a cheap totalSupply read instead of the basket read. + // Every address comes from the factory's own events, so a failed read is an error, not an empty index. + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: allFolios }) + const folios = allFolios.filter((_, i) => BigInt(supplies[i]) > 0n) + // the basket tokens of each index, then each index's balance of them + const baskets = await api.multiCall({ + abi: 'function totalAssets() view returns (address[] _assets, uint256[] _amounts)', + calls: folios, + }) + const tokensAndOwners = folios.flatMap((folio, i) => baskets[i]._assets.map((token) => [token, folio])) + return sumTokens2({ api, tokensAndOwners }) +} + +module.exports = { + methodology: 'TVL is the value of the basket tokens held by every index token deployed through the IndexfyFolioFactory on Base.', + base: { tvl }, +} From 6143db0bdca0485b8cc75a599cb051b573a32d9a Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Tue, 10 Nov 2026 17:33:51 -0400 Subject: [PATCH 679/988] fix(strato): exclude issued USDST from base TVL (#22128) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/strato/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/strato/index.js b/projects/strato/index.js index 6b007963425..bbe017863ab 100644 --- a/projects/strato/index.js +++ b/projects/strato/index.js @@ -142,6 +142,10 @@ async function tvl(api) { if (BigInt(saveTotalAssets) > 0n) api.add(saveAsset, saveTotalAssets.toString()) if (BigInt(safetyTotalAssets) > 0n) api.add(safetyAsset, safetyTotalAssets.toString()) + + // USDST is issued against CDP collateral / PSM reserves already counted above. + const usdst = await api.call({ target: CDP_REGISTRY, abi: 'function usdst() view returns (address)' }) + api.removeTokenBalance(usdst) } async function borrowed(api) { @@ -173,7 +177,7 @@ async function staking(api) { module.exports = { methodology: - 'All values verified on-chain via sequential eth_call (no Multicall3). Swap pools enumerated from PoolFactory.allPools and PoolV3Factory.allPools (concentrated liquidity); StablePool coins enumerated via getNumCoins/coins so multi-coin pools are fully counted. CDP collateral read from CDPVault, lending deposits (idle liquidity + collateral) from LiquidityPool + CollateralVault, savings from SaveUSDSTVault, staked assets from SafetyModule, vault holdings from the Vault botExecutor, stablecoin reserves held by the DirectMintPSM, and idle assets held by each ERC-4626 YieldVault (capital deployed to strategies is excluded because it is redeployed into CDPs/pools already counted). Holder addresses resolved from on-chain registries (CDPRegistry, LendingRegistry). Outstanding debt is reported separately under `borrowed` and excluded from TVL: LiquidityPool debt (totalScaledDebt × borrowIndex / RAY against the LiquidityPool borrowableAsset) plus CDP debt (CDPEngine.totalDebtAll, outstanding USDST summed across every enumerated collateral asset). Staked $STRATO (StratoStaking totalUserStake + totalSelfBond) is reported under `staking`, priced against the Ethereum STRATO ERC-20 because $STRATO has no price feed on the STRATO chain itself. Prices resolved server-side by DefiLlama for the `strato` chain.', + 'All values verified on-chain via sequential eth_call (no Multicall3). Swap pools enumerated from PoolFactory.allPools and PoolV3Factory.allPools (concentrated liquidity); StablePool coins enumerated via getNumCoins/coins so multi-coin pools are fully counted. CDP collateral read from CDPVault, lending deposits (idle liquidity + collateral) from LiquidityPool + CollateralVault, savings from SaveUSDSTVault, staked assets from SafetyModule, vault holdings from the Vault botExecutor, stablecoin reserves held by the DirectMintPSM, and idle assets held by each ERC-4626 YieldVault (capital deployed to strategies is excluded because it is redeployed into CDPs/pools already counted). USDST is excluded from base TVL across all holders because its backing CDP collateral and PSM reserves are already counted. Holder addresses resolved from on-chain registries (CDPRegistry, LendingRegistry). Outstanding debt is reported separately under `borrowed` and excluded from TVL: LiquidityPool debt (totalScaledDebt × borrowIndex / RAY against the LiquidityPool borrowableAsset) plus CDP debt (CDPEngine.totalDebtAll, outstanding USDST summed across every enumerated collateral asset). Staked $STRATO (StratoStaking totalUserStake + totalSelfBond) is reported under `staking`, priced against the Ethereum STRATO ERC-20 because $STRATO has no price feed on the STRATO chain itself. Prices resolved server-side by DefiLlama for the `strato` chain.', misrepresentedTokens: true, timetravel: false, start: '2026-04-02', From faf8feb525e94281fab52bc1835ac0e14cb16c27 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 11 Nov 2026 08:59:31 +0100 Subject: [PATCH 680/988] gainzswap is abandoned --- projects/GainzSwap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/GainzSwap/index.js b/projects/GainzSwap/index.js index 9bccf3bf183..2fa5018d867 100644 --- a/projects/GainzSwap/index.js +++ b/projects/GainzSwap/index.js @@ -77,4 +77,5 @@ module.exports = { tvl, }, start: '2025-01-12', + deadFrom: "2026-11-01", // abandoned }; From b7f8e8f3c8ec1b46d1da4605d949de96a1e14c67 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 11 Nov 2026 13:27:37 +0100 Subject: [PATCH 681/988] bugfix --- projects/helper/chain/avaxX.js | 49 +++++++++++++++++++++++++++------ projects/panoptic-v1_1/index.js | 1 + projects/panoptic/index.js | 1 + 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/projects/helper/chain/avaxX.js b/projects/helper/chain/avaxX.js index 0ee16d164e5..f153c521f98 100644 --- a/projects/helper/chain/avaxX.js +++ b/projects/helper/chain/avaxX.js @@ -3,20 +3,53 @@ const { sleep } = require('../utils') // Avalanche X-Chain (AVM) native AVAX balances; these addresses are not on the C-Chain so the evm // path never sees them. Added to the `avax` chain by the caller. +// The public node no longer serves avm.getBalance, so balances are summed from avm.getUTXOs. const RPC = 'https://api.avax.network/ext/bc/X' -const AVAX_ASSET_ID = 'FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z' +const AVAX_ASSET_ID_HEX = '21e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff' // FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z +const SECP_TRANSFER_OUTPUT = 7 +const PAGE_LIMIT = 1024 -async function getBalance(address) { - const { result } = await post(RPC, { jsonrpc: '2.0', id: 1, method: 'avm.getBalance', params: { address, assetID: AVAX_ASSET_ID } }) - return result.balance // nAVAX +// utxo hex layout: codecID(2) txID(32) outputIndex(4) assetID(32) typeID(4) amount(8) locktime(8) threshold(4) numAddrs(4) addrs(20 each) checksum(4) +function parseUtxo(hex) { + const buf = Buffer.from(hex.replace(/^0x/, ''), 'hex') + const assetID = buf.subarray(38, 70).toString('hex') + const typeID = buf.readUInt32BE(70) + const amount = buf.readBigUInt64BE(74) + return { assetID, typeID, amount } } -async function sumTokens({ api, owners = [] }) { - for (const owner of owners) { - const balance = await getBalance(owner) - api.addCGToken('avalanche-2', Number(balance) / 1e9) +async function getUtxos(addresses) { + const utxos = [] + let startIndex + while (true) { + const params = { addresses, limit: PAGE_LIMIT, encoding: 'hex' } + if (startIndex) params.startIndex = startIndex + const { result, error } = await post(RPC, { jsonrpc: '2.0', id: 1, method: 'avm.getUTXOs', params }) + if (error) throw new Error(`avm.getUTXOs: ${error.message}`) + utxos.push(...result.utxos) + if (Number(result.numFetched) < PAGE_LIMIT) break + startIndex = result.endIndex await sleep(200) } + return utxos +} + +// nAVAX held across the given addresses (one query so shared/multisig utxos are counted once) +async function getBalance(addresses) { + if (!Array.isArray(addresses)) addresses = [addresses] + let total = 0n + for (const hex of await getUtxos(addresses)) { + const { assetID, typeID, amount } = parseUtxo(hex) + if (assetID !== AVAX_ASSET_ID_HEX || typeID !== SECP_TRANSFER_OUTPUT) continue + total += amount + } + return total.toString() +} + +async function sumTokens({ api, owners = [] }) { + if (!owners.length) return api.getBalances() + const balance = await getBalance(owners) + api.addCGToken('avalanche-2', Number(balance) / 1e9) return api.getBalances() } diff --git a/projects/panoptic-v1_1/index.js b/projects/panoptic-v1_1/index.js index bd76a59ca56..b5e0a138c37 100644 --- a/projects/panoptic-v1_1/index.js +++ b/projects/panoptic-v1_1/index.js @@ -82,6 +82,7 @@ async function tvl(api) { } module.exports = { + deadFrom: "2026-11-01", // migrated to v2 ethereum: { tvl, methodology: 'This adapter counts tokens held by all PanopticPool contracts created by the PanopticFactory, as well as the token composition of all Uniswap liquidity held by the SemiFungiblePositionManager (which is used by every PanopticPool to manage liquidity).', diff --git a/projects/panoptic/index.js b/projects/panoptic/index.js index f08dc2922d9..bac1f178dbe 100644 --- a/projects/panoptic/index.js +++ b/projects/panoptic/index.js @@ -92,6 +92,7 @@ async function tvl(api) { } module.exports = { + deadFrom: "2026-11-01", // migrated to v2 ethereum: { tvl, methodology: 'This adapter counts tokens held by all PanopticPool contracts created by the PanopticFactory, as well as the token composition of all Uniswap liquidity held by the SemiFungiblePositionManager (which is used by every PanopticPool to manage liquidity).', From ef9571428494db986aaf8028ccfa5d9344659e57 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 11 Nov 2026 08:31:27 -0400 Subject: [PATCH 682/988] fix binance (#22144) --- projects/binance/index.js | 8 +++++--- projects/helper/chain/avaxX.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/binance/index.js b/projects/binance/index.js index 0b4eb8e4724..27e486ec86c 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -170,13 +170,15 @@ async function getOwners(api) { getConfig('binance-cex/lock-info', LOCK_INFO_ENDPOINT), ]) + const evmChains = ['ethereum', 'bsc', 'celo', 'chz', 'polygon', 'arbitrum', 'arc', 'optimism', 'avax', 'fantom', 'base', 'era', 'manta', 'ronin', 'robinhood', 'op_bnb', 'scroll', 'sonic', 'plasma', 'klaytn','sei', 'kava', 'wc'] + const isEvm = evmChains.includes(chain) + const contracts = data.data .filter(({ network }) => networks.includes(network.toUpperCase())) .map(({ address }) => address) .filter(Boolean) - - const evmChains = ['ethereum', 'bsc', 'celo', 'chz', 'polygon', 'arbitrum', 'arc', 'optimism', 'avax', 'fantom', 'base', 'era', 'manta', 'ronin', 'robinhood', 'op_bnb', 'scroll', 'sonic', 'plasma', 'klaytn','sei', 'kava', 'wc'] - const isEvm = evmChains.includes(chain) + // PoR api sometimes lists non-evm addresses under evm networks; avax X-Chain owners are handled by sumTokens + .filter(a => !isEvm || /^0x[0-9a-fA-F]{40}$/.test(a) || (chain === 'avax' && /^(X-)?avax1[a-z0-9]{38}$/i.test(a))) const porAddresses = new Set(contracts.map(a => a.toLowerCase())) const lockInfoAddresses = [] diff --git a/projects/helper/chain/avaxX.js b/projects/helper/chain/avaxX.js index f153c521f98..8ffb9349428 100644 --- a/projects/helper/chain/avaxX.js +++ b/projects/helper/chain/avaxX.js @@ -61,4 +61,4 @@ module.exports = { getBalance, sumTokens, sumTokensExport, -} +} \ No newline at end of file From aea9847b7f39c5a462ed391b3c599a6464742c6c Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 11 Nov 2026 13:59:03 +0000 Subject: [PATCH 683/988] Update methodology description in index.js (#22146) --- projects/jusd-finance/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/jusd-finance/index.js b/projects/jusd-finance/index.js index 500d9a435e9..e2f58b6bc80 100644 --- a/projects/jusd-finance/index.js +++ b/projects/jusd-finance/index.js @@ -59,7 +59,7 @@ async function aleoUsdcx() { } module.exports = { - methodology: 'TVL is the USDC value of JUSD on each chain it is issued on: the Accountable vault on Ethereum and the Venzo vault on Arbitrum (share supply valued with convertToAssets(), covering idle USDC and capital allocated to strategies, principally delta-neutral funding trades plus lending), and jusd_vault_arc_production.aleo on Aleo. Aleo deposits are bridged to Ethereum and held as Ethereum JUSD by the vault\'s adapter; that position is counted on Aleo, where the deposits were made, and subtracted from Ethereum, so nothing is counted twice. The Ethereum vault is also part of Accountable, so this listing is marked as double counted.', + methodology: 'TVL is the USDC value of USDdw on each chain it is issued on: the Accountable vault on Ethereum and the Venzo vault on Arbitrum (share supply valued with convertToAssets(), covering idle USDC and capital allocated to strategies, principally delta-neutral funding trades plus lending), and USDdw_vault_arc_production.aleo on Aleo. Aleo deposits are bridged to Ethereum and held as Ethereum USDdw by the vault\'s adapter; that position is counted on Aleo, where the deposits were made, and subtracted from Ethereum, so nothing is counted twice. The Ethereum vault is also part of Accountable, so this listing is marked as double counted.', doublecounted: true, ethereum: { tvl }, arbitrum: { tvl }, From c1da9fcd9b27de1797826e7413735f79df519cb1 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 11 Nov 2026 14:15:21 +0000 Subject: [PATCH 684/988] valdora (#22119) --- projects/valdora/index.js | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/projects/valdora/index.js b/projects/valdora/index.js index 669c904a8aa..ed1548112c7 100644 --- a/projects/valdora/index.js +++ b/projects/valdora/index.js @@ -1,15 +1,7 @@ -const { queryContract, endPoints } = require('../helper/chain/cosmos'); +const { queryContract } = require('../helper/chain/cosmos'); const { transformBalances } = require('../helper/portedTokens'); -const { get } = require('../helper/http'); -const { getConfig } = require('../helper/cache'); const VALDORA_STAKER_CONTRACT = 'zig18nnde5tpn76xj3wm53n0tmuf3q06nruj3p6kdemcllzxqwzkpqzqk7ue55'; -const VAULTS_API = 'https://valdora.finance/api/vaults'; -const FALLBACK_VAULTS = [ - 'zig1h3au5n3lsyqm32ydz3usgy7r9z7wpx4gttcxmypfecz29adtu64svluenp', - 'zig1mayx7wkzensav40j3qc8c5lh6s884jlhsu0c0js058t4u9xcg0mql58gkq', - 'zig1m526fltgrf70qdsufx9k9fdl4x07usjlydcn32jn83fs6za9c5cswd9grk', -]; async function fetchStakerAUM() { const { funds_raised } = await queryContract({ @@ -21,45 +13,18 @@ async function fetchStakerAUM() { return funds_raised; } -async function queryRaw({ contract, key }) { - const keyB64 = Buffer.from(key).toString('base64'); - const url = `${endPoints.zigchain}/cosmwasm/wasm/v1/contract/${contract}/raw/${keyB64}`; - const { data } = await get(url); - if (!data) return null; - return JSON.parse(Buffer.from(data, 'base64').toString()); -} - -async function fetchVaultBalance(vaultAddress) { - const [{ aum }, assetDenom] = await Promise.all([ - queryContract({ contract: vaultAddress, chain: 'zigchain', data: { aum: {} } }), - queryRaw({ contract: vaultAddress, key: 'asset_denom' }), - ]); - return { aum, assetDenom }; -} - async function tvl(api) { const balances = api.getBalances(); const stakerAum = await fetchStakerAUM(); if (stakerAum) balances['zigchain:azig'] = stakerAum; - const payload = await getConfig('valdora/vaults', VAULTS_API); - const vaults = Array.isArray(payload) && payload.length ? payload : FALLBACK_VAULTS.map(address => ({ address })); - const results = await Promise.all( - vaults.map(v => fetchVaultBalance(v.address)) - ); - for (const r of results) { - if (!r || !r.aum || !r.assetDenom) continue; - const key = `zigchain:${r.assetDenom}`; - balances[key] = (BigInt(balances[key] || 0) + BigInt(r.aum)).toString(); - } - return transformBalances('zigchain', balances); } module.exports = { timetravel: false, misrepresentedTokens: false, - methodology: "Total USD value of assets held in Valdora smart contracts, including ZIG deposited into Valdora liquid staking and assets deposited across active Valdora Vault contracts. Receipt tokens such as stZIG and vault tokens are excluded to avoid double-counting.", + methodology: "Total ZIG deposited into Valdora liquid staking. The stZIG receipt token is excluded to avoid double-counting. Valdora Vaults (short-duration private credit) are real-world assets tracked on the RWA dashboard, not in TVL.", zigchain: { tvl }, }; From 5d1bd6044aa5b015c9ff8e17ae6e2b7af5abdea2 Mon Sep 17 00:00:00 2001 From: collin-aftermath <117765650+collin-aftermath@users.noreply.github.com> Date: Wed, 11 Nov 2026 06:18:48 -0800 Subject: [PATCH 685/988] Add Parchment TVL (Sui) (#22127) --- projects/parchment/index.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 projects/parchment/index.js diff --git a/projects/parchment/index.js b/projects/parchment/index.js new file mode 100644 index 00000000000..e0f78948cbd --- /dev/null +++ b/projects/parchment/index.js @@ -0,0 +1,36 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') +const sui = require('../helper/chain/sui') + +// Parchment perps (https://parchment.trade). Contracts: https://docs.parchment.trade/contracts +// Core `parchment` package that defines `Exchange` and `extended_field::VersionKey`. +const PARCHMENT_CORE = '0xb4d5d077a8997f8dcbfefe36dd61ec8f26dfa0f789ba83e81e55252fd30eb3a2' +// The single USDC Exchange (shared). Its state, including the one vault `Balance` that holds every +// trader deposit, open-position margin, queued payout and the house pool, is the `ExchangeStateV1` child object +// stored under the dynamic object field `VersionKey(exchange.version)`. +const EXCHANGE = '0xbe3c5d2d066c8ec04b4f280fab7c560f78deff91c7abcbdb38a750b797c29c82' + +async function tvl(api) { + const exchange = await sui.getObject(EXCHANGE) + const versionKey = Buffer.alloc(8) + versionKey.writeBigUInt64LE(BigInt(exchange.fields.version)) // BCS of `VersionKey(u64)` is the bare u64 + const state = await sdk.chains.sui.getDynamicFieldObject({ + chain: 'sui', + parent: EXCHANGE, + nameType: `${PARCHMENT_CORE}::extended_field::VersionKey`, + nameBcs: versionKey.toString('base64'), + }) + if (!state?.type?.includes('::exchange::ExchangeStateV1<')) throw new Error('Parchment: Exchange state not found') + const f = state.fields + const amount = (v) => BigInt(v?.fields?.value ?? v?.value ?? v) + // The vault also holds fees already earned but not yet withdrawn (treasury, staker and growth buckets); + // those belong to the protocol, not to users or the pool, so they are left out. + const protocolFees = ['fee_lp', 'fee_staker', 'fee_growth', 'fee_dev'].reduce((sum, k) => sum + amount(f[k]), 0n) + api.add(ADDRESSES.sui.USDC_CIRCLE, (amount(f.vault) - protocolFees).toString()) +} + +module.exports = { + timetravel: false, + methodology: 'USDC held in the Parchment Exchange vault: trader free balances, margin of open positions, queued payouts and the house pool that is every trade\'s counterparty. Trading fees earned by the protocol and stakers that still sit in the vault are excluded. Trading volume is high relative to TVL because markets allow 100x-1000x leverage on small margins, and positions are short-lived.', + sui: { tvl }, +} From 15ea109ef9d7af649fa5ae9e2431100a63466984 Mon Sep 17 00:00:00 2001 From: SeaBee <85791528+seabee33@users.noreply.github.com> Date: Thu, 12 Nov 2026 01:25:41 +1100 Subject: [PATCH 686/988] maple: exclude Maple's labelled cash-deployment loans from borrowed (#22141) Co-authored-by: conor --- projects/maple/index.js | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/projects/maple/index.js b/projects/maple/index.js index cf91b3cbdd7..b61b4bb3389 100644 --- a/projects/maple/index.js +++ b/projects/maple/index.js @@ -21,6 +21,8 @@ const POOLS_QUERY = `{ } }` +const LOANS_QUERY = (skip) => `{ openTermLoans(first: 1000, skip: ${skip}) { id fundingPool { id } loanMeta { type } } }` + // keyed by poolCollaterals `blockchain:asset`, tokens are only needed on EVM chains const COLLATERALS = { 'Bitcoin:BTC': { chain: 'bitcoin' }, @@ -55,6 +57,24 @@ async function getPools() { return pools } +// open-term loans Maple labels (amm, defi, intercompany, strategy, tBills, termBasis...) deploy pool cash and are not loans to borrowers +async function getLabelledLoans() { + const { loans } = await getConfig('maple/labelled-open-term-loans', undefined, { + fetcher: async () => { + const loans = [] + for (let skip = 0; ; skip += 1000) { + const { data, errors } = await post('https://api.maple.finance/v2/graphql', { query: LOANS_QUERY(skip) }) + if (errors?.length || !data?.openTermLoans) throw new Error('Maple: invalid openTermLoans response') + loans.push(...data.openTermLoans) + if (data.openTermLoans.length < 1000) break + } + if (!loans.length) throw new Error('Maple: no open-term loans') + return { loans: loans.filter(l => l.loanMeta?.type) } + }, + }) + return loans +} + // custody addresses of the collateral currently backing loans, grouped by chain async function getCollateralOwners() { const pools = await getPools() @@ -99,11 +119,19 @@ const collateralTvl = (chain) => async (api) => { } async function borrowed(api) { + const pools = await getPools() const loanManagers = {} - for (const p of await getPools()) + for (const p of pools) for (const lm of [p.loanManager, p.openTermLoanManager]) if (lm) loanManagers[lm.id.toLowerCase()] = p.asset.id const principal = await api.multiCall({ abi: 'uint256:principalOut', calls: Object.keys(loanManagers) }) api.addTokens(Object.values(loanManagers), principal) + // the loan managers' principalOut includes the labelled loans, take their principal back out + const poolAssets = Object.fromEntries(pools.map(p => [p.id.toLowerCase(), p.asset.id])) + const labelled = await getLabelledLoans() + const assets = labelled.map(l => poolAssets[l.fundingPool.id.toLowerCase()]) + if (assets.some(a => !a)) throw new Error('Maple: labelled loan from an unknown pool') + const labelledPrincipal = await api.multiCall({ abi: 'uint256:principal', calls: labelled.map(l => l.id) }) + api.addTokens(assets, labelledPrincipal.map(v => -v)) } async function staking(api) { @@ -111,7 +139,7 @@ async function staking(api) { } module.exports = { - methodology: 'TVL is the cash held by Maple pools on Ethereum, including cash deployed to yield strategies, plus borrower collateral: the balances of the collateral tokens at the custody addresses Maple publishes for each pool, read on the chain where they are held (BTC on Bitcoin, XRP on the XRP Ledger, ETH, wstETH, PYUSD and other tokens on Ethereum). Collateral Maple reports that is not held at those addresses is not counted. Borrowed is the principal outstanding in the pools\' loan managers. Staking is SYRUP deposited in stSYRUP.', + methodology: 'TVL is the cash held by Maple pools on Ethereum, including cash deployed to yield strategies, plus borrower collateral: the balances of the collateral tokens at the custody addresses Maple publishes for each pool, read on the chain where they are held (BTC on Bitcoin, XRP on the XRP Ledger, ETH, wstETH, PYUSD and other tokens on Ethereum). Collateral Maple reports that is not held at those addresses is not counted. Borrowed is the principal outstanding in the pools\' loan managers, less the open-term loans Maple labels as its own cash deployments (AMM, DeFi, intercompany, strategy, T-bills, term basis), which Maple does not count as loans. Staking is SYRUP deposited in stSYRUP.', // custody addresses are only published for current loans timetravel: false, doublecounted: true, // we are counting collateral on other chains like bitcoin, these are not smart contracts, so should not be treated as defi tvl. From dfe6eca9322ac9c4c60e8435a1260be2bd72cf82 Mon Sep 17 00:00:00 2001 From: Dani Date: Wed, 11 Nov 2026 15:25:58 +0100 Subject: [PATCH 687/988] Add HedgeHood Options (Robinhood Chain), resolves #22133 (#22148) Co-authored-by: leo Co-authored-by: Claude Fable 5.2 --- registries/sumTokens.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index f507811a958..5e51ee981c7 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -15877,6 +15877,24 @@ const configs = { ] }, }, + "hedgehood-options": { + "methodology": "TVL is the USDG held by the seven option markets (one per underlying stock): account deposits, the margin that backs short option positions and premiums not yet withdrawn. Options are cash-settled in USDG, so the markets hold no stock.", + "start": "2026-10-29", + "robinhood": { + "owners": [ + "0x99AfB93D21B4369207f090f80Fad6551b5316163", // NVDA + "0x205E146a5Bfc4213399a6e01D347ac1F443bb1Ab", // TSLA + "0x6bc821D2E305C0486f1a2c40A4CaBA67F32E9Fce", // MU + "0xF00Db795444EE30ad3dBE836BCd82A5f18D39Afd", // GOOGL + "0x348dc1b94099CfbFf5A142f78a41542a42f4b2C7", // CRCL + "0x39B338A02B33766C56C91049A5965ba7694754DF", // MSTR + "0x4698Dd37664ade58c173FFd10C3A4DCE6d33241D" // AMD + ], + "tokens": [ + ADDRESSES.robinhood.USDG + ] + }, + }, "hegic": { "methodology": "TVL for Hegic is calculated using the HEGIC tokens deposited into Stake & Cover pool on Arbitrum and pools liquidity in USDC, ETH and WBTC", "ethereum": { From 23552ae35eb3cf19e0231080a7a51793b64b041d Mon Sep 17 00:00:00 2001 From: 0xfff <125829532+keyuyuan@users.noreply.github.com> Date: Wed, 11 Nov 2026 09:30:53 -0500 Subject: [PATCH 688/988] Add HedgeHood StockLend (Robinhood Chain) (#22134) Co-authored-by: leo Co-authored-by: Claude Fable 5.2 --- projects/hedgehood-stock-lend/index.js | 55 ++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 projects/hedgehood-stock-lend/index.js diff --git a/projects/hedgehood-stock-lend/index.js b/projects/hedgehood-stock-lend/index.js new file mode 100644 index 00000000000..b9c848d4fd3 --- /dev/null +++ b/projects/hedgehood-stock-lend/index.js @@ -0,0 +1,55 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +// StockLend by HedgeHood (hedgehood.io/loan): isolated stock-lending markets on Robinhood Chain. Lenders deposit a +// stock token; a borrower posts collateral (USDG, or SGOV / SPY on two retired markets), borrows the stock for a +// fixed term and pays an opening fee and a time fee in the collateral token. Each market is one contract that holds +// the idle stock and all collateral. +const MARKETS = [ + '0x4977c00783605750789cEEc5A3cbfaEDA3f015DB', // SPCX + '0x426A79a122c6A0A47fE2F5c5F41C4BC4d102c414', // NVDA + '0x0Ac2B1411E4c0623D936DD3E8586eA5EeF1eADB2', // MU + '0x8e8f3CC988e0D56C52a49F3055aacd62ef1b970c', // GME + '0x5C88B4f4a1acBBb1E5E63d4414bc194477bD2A7a', // CRCL + '0x6Ddc8f2dE5DCe2ff2EAc2c12CD96C936948C2912', // USO + // retired: closed to new loans, lenders and borrowers can still exit + '0xD233AC577cd0010A7B67EF2d0DA0447FD02375f8', // GME v3, SGOV collateral + '0x412a33d1266B5D408191E66b31c372580d9168c8', // GME v3, SPY collateral + '0x3D15BB430a70c3dD4ADf329ee7E089885a887e09', // GME v3 +] +// retired, first contract version: USDG collateral only, read from usdg() (there is no collateral() getter) +const LEGACY_MARKETS = [ + '0x118266F880d8A99c8D4F3E507B87c6CabdDF2339', // GME v1 + '0x028727fcf3b76Bcc1a1877100f77a38A73B9eb35', // GME v2 + '0x4BC618Fd846602113D494d5f86A0B915257d8d10', // SPCX v2 +] +const ALL = [...MARKETS, ...LEGACY_MARKETS] + +// A failed read fails the run: a market silently dropped, or priced in the wrong collateral, would misstate TVL. +async function tokens(api) { + const [stocks, collaterals, legacyCollaterals] = await Promise.all([ + api.multiCall({ abi: 'address:stock', calls: ALL }), + api.multiCall({ abi: 'address:collateral', calls: MARKETS }), + api.multiCall({ abi: 'address:usdg', calls: LEGACY_MARKETS }), + ]) + return { stocks, collaterals: [...collaterals, ...legacyCollaterals] } +} + +// idle lender stock and borrowers' collateral, both held by the market +async function tvl(api) { + const { stocks, collaterals } = await tokens(api) + return sumTokens2({ api, tokensAndOwners: ALL.flatMap((market, i) => [[stocks[i], market], [collaterals[i], market]]) }) +} + +// stock out on loan +async function borrowed(api) { + const { stocks } = await tokens(api) + const lent = await api.multiCall({ abi: 'uint256:lentOut', calls: ALL }) + lent.forEach((amount, i) => api.add(stocks[i], amount)) +} + +module.exports = { + methodology: + 'TVL counts what each StockLend market holds: the stock lenders deposited that is not lent out, and the collateral borrowers posted (USDG; SGOV or SPY on two retired markets). Borrowed counts the stock out on loan (lentOut).', + start: '2026-09-07', // the earliest market with a recorded deployment block (57171859), + robinhood: { tvl, borrowed }, +} From 7becd4fe91baef27cdd52d3985c9bdcf5c5ee09e Mon Sep 17 00:00:00 2001 From: Odomart <49200403+0domart@users.noreply.github.com> Date: Wed, 11 Nov 2026 15:31:11 +0100 Subject: [PATCH 689/988] rise-protocol: add Rise v2 markets to TVL and borrowed (#22145) Co-authored-by: Claude Opus 5.5 --- projects/rise-protocol/index.js | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/projects/rise-protocol/index.js b/projects/rise-protocol/index.js index 801eadf9e5d..0f2ad256454 100644 --- a/projects/rise-protocol/index.js +++ b/projects/rise-protocol/index.js @@ -29,6 +29,14 @@ const ML_TOTAL_DEBT_OFFSET = 56 const ML_PDA_SEED = Buffer.from('market_linear') +// Rise v2 runs on its own program. Market layout (Anchor): 8-byte discriminator, +// mintMain at 78, vault (SPL token account) at 142, totalDebt (u64) at 445. +const RISE_V2 = 'RiseP9yY3UnMxd1df7mgGJiR39frg9QGsr1ro3zxrDq' +const V2_MARKET_DISC = bs58.encode(Buffer.from([219, 190, 213, 55, 0, 227, 198, 154])) +const V2_MINT_MAIN_OFFSET = 78 +const V2_VAULT_OFFSET = 142 +const V2_TOTAL_DEBT_OFFSET = 445 + async function fetchRiseMarkets() { const programId = new PublicKey(MAYFLOWER) const connection = getConnection() @@ -56,10 +64,24 @@ async function fetchRiseMarkets() { }) } +async function fetchV2Markets() { + const accounts = await getConnection().getProgramAccounts(new PublicKey(RISE_V2), { + encoding: 'base64', + filters: [{ memcmp: { offset: 0, bytes: V2_MARKET_DISC } }], + dataSlice: { offset: V2_MINT_MAIN_OFFSET, length: V2_TOTAL_DEBT_OFFSET + 8 - V2_MINT_MAIN_OFFSET }, + }) + return accounts.map(({ account: { data } }) => ({ + mintMain: new PublicKey(data.slice(0, 32)).toBase58(), + vault: new PublicKey(data.slice(V2_VAULT_OFFSET - V2_MINT_MAIN_OFFSET, V2_VAULT_OFFSET - V2_MINT_MAIN_OFFSET + 32)).toBase58(), + totalDebt: data.readBigUInt64LE(V2_TOTAL_DEBT_OFFSET - V2_MINT_MAIN_OFFSET), + })) +} + async function tvl(api) { - const markets = await fetchRiseMarkets() - if (!markets.length) return - return sumTokens2({ api, tokenAccounts: markets.map(m => m.liqVaultMain) }) + const [markets, v2Markets] = await Promise.all([fetchRiseMarkets(), fetchV2Markets()]) + const tokenAccounts = [...markets.map(m => m.liqVaultMain), ...v2Markets.map(m => m.vault)] + if (!tokenAccounts.length) return + return sumTokens2({ api, tokenAccounts }) } /** @@ -68,7 +90,8 @@ async function tvl(api) { * token account to read). */ async function borrowed(api) { - const markets = await fetchRiseMarkets() + const [markets, v2Markets] = await Promise.all([fetchRiseMarkets(), fetchV2Markets()]) + v2Markets.forEach(m => { if (m.totalDebt > 0n) api.add(m.mintMain, m.totalDebt.toString()) }) if (!markets.length) return const accounts = await getMultipleAccounts(markets.map(m => m.marketLinear), { api }) accounts.forEach((acc, i) => { @@ -80,6 +103,6 @@ async function borrowed(api) { module.exports = { timetravel: false, - methodology: `TVL: sum of the main quote token (WSOL, USDC, etc.) actually held on-chain in each Rise market's liquidity vault (the liqVaultMain SPL token account stored on its MarketMeta). Borrowed: sum of MarketLinear.totalDebt across the same markets, representing main-token debt that users have drawn against their token collateral. Rise markets are identified on-chain by selecting Mayflower MarketMeta accounts whose marketGroup field is Rise's group pubkey (HA9pvTe8...).`, + methodology: `TVL: sum of the main quote token (WSOL, USDC, etc.) actually held on-chain in each Rise market's liquidity vault (the liqVaultMain SPL token account stored on its MarketMeta). Borrowed: sum of MarketLinear.totalDebt across the same markets, representing main-token debt that users have drawn against their token collateral. Rise markets are identified on-chain by selecting Mayflower MarketMeta accounts whose marketGroup field is Rise's group pubkey (HA9pvTe8...), plus every Market account of the Rise v2 program (RiseP9...), counted the same way (vault balance for TVL, totalDebt for borrowed).`, solana: { tvl, borrowed }, } From 38d8bf5eb773727fc58ce02da64cbcf9ffb472f3 Mon Sep 17 00:00:00 2001 From: Nullmask Date: Wed, 11 Nov 2026 18:49:25 +0400 Subject: [PATCH 690/988] Nullmask: add Arbitrum and Monad (#22147) --- registries/sumTokens.js | 2 ++ registries/treasury.js | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 5e51ee981c7..9eae0539a5d 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -20837,6 +20837,8 @@ const configs = { bsc: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT] }, robinhood: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null] }, avax: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null, ADDRESSES.avax.USDC, ADDRESSES.avax.USDt] }, + arbitrum: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null, ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.USDT] }, + monad: { owner: '0xd64EF1417EB047ed0b54736a5a41F01178C391c6', tokens: [ADDRESSES.null, ADDRESSES.monad.USDC, ADDRESSES.monad.USDT] }, solana: { solOwners: ['xVm2WXtsMh1h41HKgAS2Dymf5ex1GggWbqUeefXUsJg'], // SOL vault of the Nullmask program (Ee6we6Bnbok55FzHfa8fU8td7NDwbKa1qgLehP4iH1Uj) tokenAccounts: [ // coin vaults (CoinAdded events) diff --git a/registries/treasury.js b/registries/treasury.js index 8448f1b670d..dd8a57d7892 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -4219,6 +4219,14 @@ const configs = { owners: ['0xDD85F4AfDE114dc7c480b012Feaa83152a0C0D09'], // pool treasury(), receives swept protocol fees tokens: [nullAddress, ADDRESSES.avax.USDC, ADDRESSES.avax.USDt], }, + arbitrum: { + owners: ['0xDD85F4AfDE114dc7c480b012Feaa83152a0C0D09'], // pool treasury(), receives swept protocol fees + tokens: [nullAddress, ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.USDT], + }, + monad: { + owners: ['0xDD85F4AfDE114dc7c480b012Feaa83152a0C0D09'], // pool treasury(), receives swept protocol fees + tokens: [nullAddress, ADDRESSES.monad.USDC, ADDRESSES.monad.USDT], + }, solana: { owners: [ 'GRbpmTbmDeGn8BXHXb1jfEeUT6sGAt7Da44YpWxCS8nr', // ops wallet From 478f60672fd7c4ff0a0f47530b7bd62b475d5943 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 11 Nov 2026 10:50:31 -0400 Subject: [PATCH 691/988] add horizen bridge tvl (#22149) --- registries/sumTokens/covalent.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/registries/sumTokens/covalent.js b/registries/sumTokens/covalent.js index f293d482ded..f3103aeff96 100644 --- a/registries/sumTokens/covalent.js +++ b/registries/sumTokens/covalent.js @@ -430,6 +430,18 @@ module.exports = { ] }, }, + "horizen-bridge": { + // Horizen is an OP Stack L3 (Caldera) settling to Base. https://docs.horizen.io/horizen-chain/bridging/how-bridging-works + "methodology": "Counts assets escrowed on Base for Horizen's canonical bridge: ETH in the OptimismPortal and ERC-20s in the L1StandardBridge. ZEN, USDC and cbBTC reach Horizen through Stargate and are not included.", + "start": "2025-11-17", // first deposit through the OptimismPortal + "base": { + "owners": [ + "0xf4a6cc4171fda694439f856d912777aa6ab05369", // L1StandardBridge + "0x78e794d10a355468A0e7A14AA1a9F9A253D78784" // OptimismPortal2, L1StandardBridge.messenger().portal() + ], + "fetchCoValentTokens": true + }, + }, "immutable-zkevm": { "ethereum": { "owner": "0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6", From 6192011b3bdcaf1e6676a923503c8927cd375281 Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Wed, 11 Nov 2026 15:51:10 +0100 Subject: [PATCH 692/988] aerodrome-ignition: mark as doublecounted (#22143) Co-authored-by: ccipherx --- registries/uniswapV2.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index d43d9bf2112..66d36a04b4c 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -3336,6 +3336,9 @@ const uniV2Configs = { morph: '0x174c4C03DfeA09682728A5959A253bf1F7C7766F', }, 'aerodrome-ignition': { + // 0xade65... is the Slipstream "Gauge Caps" CL factory, also counted by aerodrome-CL (Aerodrome Slipstream) + doublecounted: true, + methodology: 'Value of the tokens in all pools of the Aerodrome Slipstream Gauge Caps CL factory 0xaDe65c38CD4849aDBA595a4323a8C7DdfE89716a on Base. This is a general Slipstream factory that also holds non-Ignition pools, and Aerodrome Slipstream (aerodrome-CL) counts all of them, so this listing is marked as double counted.', base: { factory: '0xade65c38cd4849adba595a4323a8c7ddfe89716a', blacklistedTokens: [], fetchBalances: true, useDefaultCoreAssets: false, abis: { allPairsLength: 'uint256:allPoolsLength', allPairs: 'function allPools(uint) view returns (address)' }, From 2ea4e1bcf7e01d7b7aa1a98f7cbafad9555cda8f Mon Sep 17 00:00:00 2001 From: NARAProtocol Date: Wed, 11 Nov 2026 16:52:22 +0200 Subject: [PATCH 693/988] nara: migrate to V5 contracts and add tvl + pool2 on Base (#22139) Co-authored-by: ccipherx --- registries/stakingOnly.js | 6 ------ registries/sumTokens.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/registries/stakingOnly.js b/registries/stakingOnly.js index b9e09f0de50..14ad6847b34 100644 --- a/registries/stakingOnly.js +++ b/registries/stakingOnly.js @@ -165,12 +165,6 @@ const configs = { staking: { owners: ['0x0EFBE19Cb7B07D934D01990a8989E9CaA98b9009'], tokens: ['0xFf8104251E7761163faC3211eF5583FB3F8583d6']} } }, - 'nara': { - methodology: 'Total NARA locked in NARAEngineV4 on Base. Users lock NARA for a chosen duration to participate in protocol consensus and earn rewards every 15-minute epoch.', - base: { - staking: { owners: ['0x98ab6406D6B548F37dEF7110961bb45A399e5aFC'], tokens: ['0xB6333F5D4cEd8dffA80F3F13697D6aA3BB3f19c1']} - } - }, 'venice-protocol': { methodology: 'Counts the total VVV tokens locked in the Venice Protocol staking contract (sVVV) on Base.', base: { diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 9eae0539a5d..30253d40203 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -19362,6 +19362,36 @@ const configs = { ] }, }, + "nara": { + "methodology": "TVL counts the ETH, WETH, USDC and cbBTC held by the CryptoSLIP slip vaults (user slip escrow plus fees not yet forwarded to the treasury) and any non-NARA balance in the V5 position-sale escrow and reward contracts. Staking counts NARA committed in NARAPrincipalLedgerV5 and NARA held in CryptoSLIP slips. The Treasury Safe, its range-order managers and the fee vault hold protocol-owned liquidity and are not counted.", + "base": { + "tvl": { + "owners": [ + "0x3f80aa68Fb4834d6E119EE1cf932C14419Cf63EB", + "0x38BF0321FA7489576978353a6a8da4A3e85C2F18", + "0x04Ac83045d26259D46400Ce6beb9bBd0641df225", + "0xC72671D9438388638547444524F6542b650C9264", + "0x44130CC47b886D8488041F5eaE271477D1aFA909" + ], + "tokens": [ + ADDRESSES.null, + ADDRESSES.base.USDC, + ADDRESSES.base.WETH, + ADDRESSES.base.cbBTC + ] + }, + "staking": { + "owners": [ + "0x7F866a9fbe41D54F0d9C35b6892fcf27Ea766DB2", + "0x3f80aa68Fb4834d6E119EE1cf932C14419Cf63EB", + "0x38BF0321FA7489576978353a6a8da4A3e85C2F18" + ], + "tokens": [ + "0x91FB78A9F46B67f54BbD4489941d19666b2fAe0f" + ] + } + }, + }, "narbet": { "methodology": "NarBet TVL is the MON held in the BankrollAndStaking contract, which serves as the house liquidity pool. LPs deposit MON to earn yield from casino game outcomes across 11 on-chain games including Coin Flip, Dice/Range, Slots, Plinko, Mines, Roulette, Baccarat, Video Poker, Rock Paper Scissors, Limbo, and Fish Prawn Crab. All games use Pyth Entropy for verifiable randomness.", "start": "2025-11-11", From 2823dc73b02e9491578737300519e0aae6809cff Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 11 Nov 2026 15:56:03 +0100 Subject: [PATCH 694/988] optimize 40acres --- projects/40acres/helpers.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/projects/40acres/helpers.js b/projects/40acres/helpers.js index 022a9a074f2..44d7a786591 100644 --- a/projects/40acres/helpers.js +++ b/projects/40acres/helpers.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); const { unwrapSolidlyVeNft } = require('../helper/unwrapLPs'); +const SOLIDLY_VE_NFT_ABI = require('../helper/abis/solidlyVeNft.json'); const vaultMapping = { optimism: ['0x08dCDBf7baDe91Ccd42CB2a4EA8e5D199d285957'], @@ -98,22 +98,22 @@ async function getAvaxTvl(api) { await unwrapSolidlyVeNft({ api, baseToken: baseTokenMapping[chain]['blackhole'], veNft: veNftMapping[chain]['blackhole'], owner:fortyAcresMapping[chain][1],isAltAbi:true}); } +// same as unwrapSolidlyVeNft but batched across all portfolios: 3 multicalls total instead of 3 calls per portfolio async function getPortfolioVeNftTvl(api) { const chain = api.chain; + const veNft = veNftMapping[chain] const factories = await api.call({ target: portfolioManager, abi: allFactoriesAbi }) const portfolios = await api.multiCall({ calls: factories.map(f => ({target: f})), abi: portfolioAbi}); const allPortfolios = [...new Set(portfolios.flat().map(a => a.toLowerCase()))] - - await sdk.util.runInPromisePool({ - items: allPortfolios, - concurrency: 10, - processor: owner => unwrapSolidlyVeNft({ - api, - baseToken: baseTokenMapping[chain], - veNft: veNftMapping[chain], - owner, - }), - }); + + const counts = await api.multiCall({ abi: 'erc20:balanceOf', calls: allPortfolios, target: veNft }) + const idCalls = [] + counts.forEach((count, i) => { + for (let j = 0; j < +count; j++) idCalls.push({ params: [allPortfolios[i], j] }) + }) + const tokenIds = await api.multiCall({ abi: SOLIDLY_VE_NFT_ABI.ownerToNFTokenIdList, calls: idCalls, target: veNft }) + const locked = await api.multiCall({ abi: SOLIDLY_VE_NFT_ABI.locked, calls: tokenIds, target: veNft }) + locked.forEach(i => api.add(baseTokenMapping[chain], i.amount)) } module.exports = { From 8b779dd118f73ec7ba39183c486c84a7e209ec91 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 11 Nov 2026 11:51:06 -0400 Subject: [PATCH 695/988] optimize adapters (#22150) --- projects/kamino-lending/index.js | 99 ++++++++++++-------------------- projects/manifest-trade/index.js | 32 ++++------- projects/peerme/index.js | 35 +++++++---- projects/stakepoint/index.js | 38 ++++++++---- 4 files changed, 101 insertions(+), 103 deletions(-) diff --git a/projects/kamino-lending/index.js b/projects/kamino-lending/index.js index aca7e7335c4..3eab3577a85 100644 --- a/projects/kamino-lending/index.js +++ b/projects/kamino-lending/index.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { PublicKey } = require('@solana/web3.js'); -const { getConnection, sumTokens2, getTokenAccountBalances } = require('../helper/solana'); +const { getConnection, sumTokens2, getTokenAccountBalances, getMultipleAccounts } = require('../helper/solana'); const { Program } = require('@project-serum/anchor'); const kaminoIdl = require('./kamino-lending-idl.json'); const kaminoFarmsIdl = require('./kamino-farms-idl.json'); @@ -27,35 +27,40 @@ const ETHENA_KVAULT_POSITIONS = [ }, ] -async function tvl(api) { +const KLEND_PROGRAM_ID = new PublicKey('KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD'); +const KAMINO_PROGRAM_ID = new PublicKey('6LtLpnUFNByNXLyCoK9wA2MykKAmQNZKBdY8s47dehDc'); + +// tvl and borrowed both need the reserves of the listed markets, so they are read once per process +let reservesPromise; +function getReserves() { + if (!reservesPromise) reservesPromise = fetchReserves(); + return reservesPromise; +} + +// Reserves of the markets listed by the Kamino API, without kToken reserves (their underlying is counted elsewhere) +async function fetchReserves() { const connection = getConnection(); - const programId = new PublicKey('KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD'); - const markets = (await getConfig('kamino-lending', 'https://api.kamino.finance/v2/kamino-market')).map(x => x.lendingMarket); - const tokenAccounts = []; - const ktokens = {}; + const markets = new Set((await getConfig('kamino-lending', 'https://api.kamino.finance/v2/kamino-market')).map(x => x.lendingMarket)); - const kaminoLendProgram = new Program(kaminoIdl, programId, { connection, publicKey: PublicKey.unique() }); - for (const market of markets) { - const reserves = await kaminoLendProgram.account.reserve.all([ - { dataSize: 8624 }, - { memcmp: { offset: 32, bytes: market } }, - ]); + // one scan of every reserve, then keep the listed markets, instead of one scan per market + const kaminoLendProgram = new Program(kaminoIdl, KLEND_PROGRAM_ID, { connection, publicKey: PublicKey.unique() }); + const reserves = (await kaminoLendProgram.account.reserve.all([{ dataSize: 8624 }])) + .map(r => r.account) + .filter(r => markets.has(r.lendingMarket.toString())); - for (const reserveData of reserves) { - const reserve = reserveData.account; - if ( - ktokens[reserve.liquidity.mintPubkey] || - (await isKToken(new PublicKey(reserve.liquidity.mintPubkey), connection)) - ) { - ktokens[reserve.liquidity.mintPubkey] = true; - } else { - ktokens[reserve.liquidity.mintPubkey] = false; - tokenAccounts.push(reserve.liquidity.supplyVault.toString()); - } - } - } + // one batched read of the distinct mints instead of a getAccountInfo per reserve + const mints = [...new Set(reserves.map(r => r.liquidity.mintPubkey.toString()))]; + const mintInfos = await getMultipleAccounts(mints); + const kTokens = new Set(mints.filter((mint, i) => isKToken(new PublicKey(mint), mintInfos[i]))); + + return reserves.filter(r => !kTokens.has(r.liquidity.mintPubkey.toString())); +} + +async function tvl(api) { + const reserves = await getReserves(); + const tokenAccounts = reserves.map(r => r.liquidity.supplyVault.toString()); await sumTokens2({ api, tokenAccounts }) - await subtractEthenaKVaultDeposits(api, connection) + await subtractEthenaKVaultDeposits(api, getConnection()) } async function subtractEthenaKVaultDeposits(api, connection) { @@ -83,10 +88,9 @@ async function subtractEthenaKVaultDeposits(api, connection) { } } -async function isKToken(mint, connection) { - const mintInfo = await connection.getAccountInfo(new PublicKey(mint.toString())); +// a kToken's mint authority is the Kamino PDA derived from the mint +function isKToken(mint, mintInfo) { const rawMint = MintLayout.decode(mintInfo.data.slice(0, MintLayout.span)); - const KAMINO_PROGRAM_ID = new PublicKey('6LtLpnUFNByNXLyCoK9wA2MykKAmQNZKBdY8s47dehDc'); const [expectedMintAuthority] = PublicKey.findProgramAddressSync( [Buffer.from('authority'), mint.toBuffer()], KAMINO_PROGRAM_ID @@ -95,38 +99,11 @@ async function isKToken(mint, connection) { } async function borrowed(api) { - const connection = getConnection(); - const programId = new PublicKey('KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD'); - const markets = (await getConfig('kamino-lending', 'https://api.kamino.finance/v2/kamino-market')).map(x => x.lendingMarket); - const ktokens = {}; - - const kaminoLendProgram = new Program(kaminoIdl, programId, { connection, publicKey: PublicKey.unique() }); - - for (const market of markets) { - const reserves = await kaminoLendProgram.account.reserve.all([ - { dataSize: 8624 }, - { memcmp: { offset: 32, bytes: market } }, - ]); - for (const reserveData of reserves) { - const reserve = reserveData.account; - - // Skip kTokens like in the tvl function - if ( - ktokens[reserve.liquidity.mintPubkey] || - (await isKToken(new PublicKey(reserve.liquidity.mintPubkey), connection)) - ) { - ktokens[reserve.liquidity.mintPubkey] = true; - } else { - ktokens[reserve.liquidity.mintPubkey] = false; - - // Calculate borrowed amount using this formula - // liquidity.borrowedAmountSf / 2**60 / 10**liquidity.mintDecimals - const borrowedAmountSf = reserve.liquidity.borrowedAmountSf; - const borrowedAmount = borrowedAmountSf / Math.pow(2, 60) - - api.add(reserve.liquidity.mintPubkey.toString(), borrowedAmount); - } - } + const reserves = await getReserves(); + for (const reserve of reserves) { + // liquidity.borrowedAmountSf / 2**60 is the borrowed amount in the mint's base units + const borrowedAmount = reserve.liquidity.borrowedAmountSf / Math.pow(2, 60) + api.add(reserve.liquidity.mintPubkey.toString(), borrowedAmount); } } diff --git a/projects/manifest-trade/index.js b/projects/manifest-trade/index.js index 085122b3e50..51615c7e2db 100644 --- a/projects/manifest-trade/index.js +++ b/projects/manifest-trade/index.js @@ -18,7 +18,12 @@ function getGlobalVaultAddress(mint) { return globalVaultAddress; } -async function listMarketPublicKeys( +// Market account: base mint at bytes 16-48, quote mint at 48-80 +const MINTS_OFFSET = 16; +const MINTS_LENGTH = 64; + +// one scan returns every market with just its two mints, no per-market fetch needed +async function listMarkets( connection, ) { const accounts = await connection.getProgramAccounts(PROGRAM_ID, { @@ -31,34 +36,21 @@ async function listMarketPublicKeys( }, }, ], + dataSlice: { offset: MINTS_OFFSET, length: MINTS_LENGTH }, }); - return accounts.map((a) => a.pubkey); + return accounts.map((a) => ({ pk: a.pubkey, data: a.account.data })); } async function tvl() { const connection = getConnection(); - const marketPks = await listMarketPublicKeys(connection); + const markets = await listMarkets(connection); const vaultAccounts = []; let globalAccounts = []; - for (const pk of marketPks) { - const [buffer, _slot] = await connection - .getAccountInfoAndContext(pk) - .then( - ( - getAccountInfoAndContext, - ) => { - return [ - getAccountInfoAndContext.value?.data, - getAccountInfoAndContext.context.slot, - ]; - }, - ); - - let offset = 16; - const baseMint = new PublicKey(buffer.subarray(offset, offset + 32)); - const quoteMint = new PublicKey(buffer.subarray(offset + 32, offset + 32 + 32)); + for (const { pk, data } of markets) { + const baseMint = new PublicKey(data.subarray(0, 32)); + const quoteMint = new PublicKey(data.subarray(32, 64)); const baseVaultPk = getVaultAddress(pk, baseMint); const quoteVaultPk = getVaultAddress(pk, quoteMint); diff --git a/projects/peerme/index.js b/projects/peerme/index.js index 2e94c842b06..e09ae3ad173 100644 --- a/projects/peerme/index.js +++ b/projects/peerme/index.js @@ -1,6 +1,8 @@ const { sumTokens } = require("../helper/chain/elrond"); const { getConfig } = require("../helper/cache"); const { getCoreAssets } = require("../helper/tokenMapping"); +const { transformBalances } = require("../helper/portedTokens"); +const sdk = require("@defillama/sdk"); const API_BASE_URL = "https://api.peerme.io"; @@ -17,20 +19,33 @@ async function getDaoAddresses() { )).filter(address => address !== null); } -async function tvl() { +// The elrond helper pauses between owners, so reading every DAO twice (once for tvl, once for vesting) +// doubled the run. Balances are read once per process and split into core assets (tvl) and the rest (vesting). +let balancesPromise; +function getSplitBalances() { + if (!balancesPromise) balancesPromise = fetchSplitBalances(); + return balancesPromise; +} + +async function fetchSplitBalances() { const daoAddresses = await getDaoAddresses(); - return await sumTokens({ - owners: [...PROTOCOL_ADDRESSES, ...daoAddresses], - whitelistedTokens: getCoreAssets("elrond"), - }); + const all = await sumTokens({ owners: [...PROTOCOL_ADDRESSES, ...daoAddresses] }); + // the helper prefixes and renames token ids in its output, so core assets are matched by the keys it would produce + const coreBalances = {}; + getCoreAssets("elrond").forEach(t => sdk.util.sumSingleBalance(coreBalances, t, "1", "elrond")); + const coreKeys = new Set(Object.keys(transformBalances("elrond", coreBalances))); + const core = {}; + const rest = {}; + for (const [key, value] of Object.entries(all)) (coreKeys.has(key) ? core : rest)[key] = value; + return { core, rest }; +} + +async function tvl() { + return { ...(await getSplitBalances()).core }; } async function vestingTvl() { - const daoAddresses = await getDaoAddresses(); - return await sumTokens({ - owners: [...PROTOCOL_ADDRESSES, ...daoAddresses], - blacklistedTokens: getCoreAssets("elrond"), - }); + return { ...(await getSplitBalances()).rest }; } module.exports = { diff --git a/projects/stakepoint/index.js b/projects/stakepoint/index.js index 9467e34118f..b517b2785ee 100644 --- a/projects/stakepoint/index.js +++ b/projects/stakepoint/index.js @@ -1,5 +1,5 @@ const { PublicKey } = require("@solana/web3.js"); -const { getConnection, sumTokens2 } = require("../helper/solana"); +const { getConnection, sumTokens2, getMultipleAccounts } = require("../helper/solana"); const PROGRAM_ID = "gLHaGJsZ6G7AXZxoDL9EsSWkRbKAWhFHi73gVfNXuzK"; const TOKEN_2022_PROGRAM = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"; @@ -30,24 +30,38 @@ async function unwrapRaydiumLP(lpMint, lpBalance) { }; } -async function getVaultData() { +// tvl and staking both need the same scan, so it runs once per process +let vaultDataPromise; +function getVaultData() { + if (!vaultDataPromise) vaultDataPromise = fetchVaultData(); + return vaultDataPromise; +} + +async function fetchVaultData() { const connection = getConnection(); - + + // only the token mint (40-72) and the staking vault (80-112) are read const accounts = await connection.getProgramAccounts( new PublicKey(PROGRAM_ID), - { filters: [{ dataSize: 379 }] } + { + filters: [{ dataSize: 379 }], + dataSlice: { offset: TOKEN_MINT_OFFSET, length: STAKING_VAULT_OFFSET + 32 - TOKEN_MINT_OFFSET }, + } ); - + const sptVaults = { spl: [], token2022: [] }; const otherVaults = { spl: [], token2022: [] }; const lpTokens = []; - - for (const { account } of accounts) { - const data = account.data; - const tokenMint = new PublicKey(data.slice(TOKEN_MINT_OFFSET, TOKEN_MINT_OFFSET + 32)); - const stakingVault = new PublicKey(data.slice(STAKING_VAULT_OFFSET, STAKING_VAULT_OFFSET + 32)); - - const vaultInfo = await connection.getAccountInfo(stakingVault); + + const pools = accounts.map(({ account: { data } }) => ({ + tokenMint: new PublicKey(data.slice(0, 32)), + stakingVault: new PublicKey(data.slice(STAKING_VAULT_OFFSET - TOKEN_MINT_OFFSET, STAKING_VAULT_OFFSET - TOKEN_MINT_OFFSET + 32)), + })); + // one batched read for every vault instead of a getAccountInfo per pool + const vaultInfos = await getMultipleAccounts(pools.map(p => p.stakingVault)); + + for (const [i, { tokenMint, stakingVault }] of pools.entries()) { + const vaultInfo = vaultInfos[i]; if (!vaultInfo) continue; const balance = Number(vaultInfo.data.readBigUInt64LE(64)); From f8486ff6dbcc0561fbe29b0a7571638cbce2f43c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 11 Nov 2026 19:00:54 +0100 Subject: [PATCH 696/988] optimize --- projects/accountable/index.js | 82 ++++---- projects/avalon-finance/index.js | 20 +- projects/btcd/index.js | 179 +++++++++--------- projects/cap-money/index.js | 14 +- projects/cap-money/lib/helpers.js | 13 +- projects/dodo/index.js | 2 +- .../index.js | 6 +- projects/euler-v2/index.js | 12 +- projects/fables/index.js | 75 +++++--- projects/helper/chain/strato.js | 107 +++++++++++ projects/helper/curators/index.js | 53 +++--- projects/idle/index.js | 2 +- projects/mosh/index.js | 54 ++++-- projects/peapods-finance/index.js | 24 ++- projects/radiant-v2/index.js | 34 +++- projects/reserve/helper.js | 14 +- projects/reserve/index.js | 6 +- projects/royco-v2/index.js | 124 ++++++------ projects/strato-dex/index.js | 16 ++ projects/strato/index.js | 150 +++++---------- projects/tangible/index.js | 128 ++++++------- projects/tarot/index.js | 2 + projects/tarot/tarotHelper.js | 51 +++-- projects/teller/index.js | 16 +- projects/tetu/index.js | 31 ++- 25 files changed, 701 insertions(+), 514 deletions(-) create mode 100644 projects/helper/chain/strato.js create mode 100644 projects/strato-dex/index.js diff --git a/projects/accountable/index.js b/projects/accountable/index.js index d8190ffc7b4..1c7137a7dd1 100644 --- a/projects/accountable/index.js +++ b/projects/accountable/index.js @@ -101,28 +101,24 @@ async function getVaults(api) { (EXCLUDED_STRATEGIES[api.chain] || []).map((s) => s.toLowerCase()) ) - for (const factory of factories) { - const strategies = await api.fetchList({ - target: factory, - lengthAbi: 'getStrategiesCount', - itemAbi: 'strategyProxies', - }) - const validStrategies = strategies.filter( - (s) => s && s !== NULL_ADDRESS && !excludedStrategies.has(s.toLowerCase()) - ) - if (!validStrategies.length) continue - - const factoryVaults = await api.multiCall({ - target: factory, - abi: abis.strategyVaults, - calls: validStrategies.map((strategy) => ({ params: [strategy] })), - }) + // all factories are read in the same multicalls + const strategies = await api.fetchList({ + targets: factories, + lengthAbi: 'getStrategiesCount', + itemAbi: 'strategyProxies', + groupedByInput: true, + }) + const calls = strategies.map((factoryStrategies, i) => factoryStrategies + .filter((s) => s && s !== NULL_ADDRESS && !excludedStrategies.has(s.toLowerCase())) + .map((strategy) => ({ target: factories[i], params: [strategy] })) + ).flat() - factoryVaults.forEach((vault) => { - if (!vault || vault === NULL_ADDRESS) return - vaults.add(vault.toLowerCase()) - }) - } + const factoryVaults = await api.multiCall({ abi: abis.strategyVaults, calls }) + + factoryVaults.forEach((vault) => { + if (!vault || vault === NULL_ADDRESS) return + vaults.add(vault.toLowerCase()) + }) for (const vault of (EXTRA_VAULTS[api.chain] || [])) vaults.add(vault.toLowerCase()) @@ -135,25 +131,39 @@ async function getVaults(api) { * @param {boolean} isBorrowed When true, counts supplied assets minus idle vault liquidity. * @returns {Function} DefiLlama adapter handler. */ +async function fetchVaultData(api) { + const vaults = await getVaults(api) + if (!vaults.length) return { vaults } + + const [supplies, underlyings] = await Promise.all([ + api.multiCall({ abi: 'erc20:totalSupply', calls: vaults, permitFailure: true }), + api.multiCall({ abi: abis.asset, calls: vaults, permitFailure: true }), + ]) + + const [totalAssets, liquidity] = await Promise.all([ + api.multiCall({ + abi: abis.convertToAssets, + calls: vaults.map((vault, i) => ({ target: vault, params: [supplies[i] || 0] })), + permitFailure: true, + }), + api.multiCall({ abi: 'erc20:balanceOf', calls: vaults.map((vault, i) => ({ target: underlyings[i], params: vault })), permitFailure: true }) + ]) + return { vaults, underlyings, totalAssets, liquidity } +} + +// tvl and borrowed are built from the same reads, fetch them once per chain/block +const vaultDataCache = {} +function getVaultData(api) { + const key = `${api.chain}-${api.block}` + if (!vaultDataCache[key]) vaultDataCache[key] = fetchVaultData(api) + return vaultDataCache[key] +} + function tvl(isBorrowed) { return async (api) => { - const vaults = await getVaults(api) + const { vaults, underlyings, totalAssets, liquidity } = await getVaultData(api) if (!vaults.length) return - const [supplies, underlyings] = await Promise.all([ - api.multiCall({ abi: 'erc20:totalSupply', calls: vaults, permitFailure: true }), - api.multiCall({ abi: abis.asset, calls: vaults, permitFailure: true }), - ]) - - const [totalAssets, liquidity] = await Promise.all([ - api.multiCall({ - abi: abis.convertToAssets, - calls: vaults.map((vault, i) => ({ target: vault, params: [supplies[i] || 0] })), - permitFailure: true, - }), - api.multiCall({ abi: 'erc20:balanceOf', calls: vaults.map((vault, i) => ({ target: underlyings[i], params: vault })), permitFailure: true }) - ]) - vaults.forEach((vault, i) => { if (!underlyings[i] || !totalAssets[i]) return if (liquidity[i] == null) throw new Error(`balanceOf failed for vault ${vault}`) diff --git a/projects/avalon-finance/index.js b/projects/avalon-finance/index.js index 0dfc176a2fb..be509a553a4 100644 --- a/projects/avalon-finance/index.js +++ b/projects/avalon-finance/index.js @@ -1,9 +1,11 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { aaveExports } = require('../helper/aave') +const { aaveExports: aaveMarketsExports } = require('../helper/aave') const methodologies = require('../helper/methodologies') const { mergeExports } = require('../helper/utils') +// only records the market's data helper (the registry is unused when a data helper is set), markets are grouped per chain at the bottom +const aaveExports = (_chain, _registry, _transform, dataHelpers, options) => ({ dataHelpers, options }) //@note Main & Innovative Markets @@ -110,7 +112,21 @@ const usdxMarkets = { } -module.exports = mergeExports( +const allMarkets = [ mainMarket, innovativeMarket, solvMarkets, pumpBTCMarkets, unibtcMarkets, stbtcMarkets, otherProtocolTokenMarkets, obtcMarkets, ubtcMarkets, xaumMarkets, lbtcMarkets, listaMarkets, uniIotxMarkets, usdxMarkets +] + +// markets on the same chain with the same blacklist are read together: one set of multicalls per group instead of per market +const marketGroups = {} +allMarkets.forEach(markets => Object.entries(markets).forEach(([chain, { dataHelpers, options }]) => { + const key = `${chain}-${(options.blacklistedTokens || []).join().toLowerCase()}` + if (!marketGroups[key]) marketGroups[key] = { chain, dataHelpers: [], options } + marketGroups[key].dataHelpers.push(...dataHelpers) +})) + +module.exports = mergeExports( + Object.values(marketGroups).map(({ chain, dataHelpers, options }) => ({ [chain]: aaveMarketsExports('', '', undefined, dataHelpers, options) })) ) module.exports.methodology = methodologies.lendingMarket +module.exports.merlin.borrowed = async () => ({}) // is insolvent +module.exports.merlin.pharos = async () => ({}) // is insolvent diff --git a/projects/btcd/index.js b/projects/btcd/index.js index 03d849cbf81..883e485b748 100644 --- a/projects/btcd/index.js +++ b/projects/btcd/index.js @@ -113,19 +113,12 @@ const abi = { morphoMarketParams: 'function idToMarketParams(bytes32 id) view returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv)', }; -// SkipStrategy marks a strategy this adapter cannot value; it is logged and -// left out instead of failing the chain's TVL. -class SkipStrategy extends Error {} - /** - * Returns the Morpho Blue position of `user` in market `marketId`: supplied - * and borrowed loan-token assets (shares converted with the virtual offsets; + * Converts a Morpho Blue position/market/params read into supplied and + * borrowed loan-token assets (shares converted with the virtual offsets; * debt rounded up as Morpho does) and the posted collateral. */ -async function morphoPosition(api, marketId, user) { - const pos = await api.call({ target: MORPHO_BLUE, abi: abi.morphoPosition, params: [marketId, user] }); - const market = await api.call({ target: MORPHO_BLUE, abi: abi.morphoMarket, params: [marketId] }); - const params = await api.call({ target: MORPHO_BLUE, abi: abi.morphoMarketParams, params: [marketId] }); +function morphoPosition(pos, market, params) { const supplyAssets = BigInt(market.totalSupplyAssets) + MORPHO_VIRTUAL_ASSETS; const supplyShares = BigInt(market.totalSupplyShares) + MORPHO_VIRTUAL_SHARES; const borrowAssets = BigInt(market.totalBorrowAssets) + MORPHO_VIRTUAL_ASSETS; @@ -139,100 +132,110 @@ async function morphoPosition(api, marketId, user) { }; } -/** - * Returns [asset, amount] for the ERC-4626 shares of `vault` held by `owner`, - * converted through the vault's own convertToAssets. - */ -async function erc4626Holding(api, vault, owner) { - const shares = await api.call({ target: vault, abi: 'erc20:balanceOf', params: [owner] }); - const asset = await api.call({ target: vault, abi: abi.asset }); - const amount = await api.call({ target: vault, abi: abi.convertToAssets, params: [shares] }); - return [asset, amount]; -} - -const balanceOf = (api, token, owner) => api.call({ target: token, abi: 'erc20:balanceOf', params: [owner] }); -const getter = (api, target, getterAbi) => api.call({ target, abi: getterAbi }); - // Each valuer returns the [token, amount] holdings of one strategy position -// manager, excluding idle tokens (those are counted by the balanceOf sweep). -// Debt is a negative amount of the borrowed token. +// manager from the reads addStrategyPositions stored on it, excluding idle +// tokens (those are counted by the balanceOf sweep). Debt is a negative amount +// of the borrowed token. const VALUERS = { // WBTC supplied to the Morpho Blue market the PM names. - async MORPHOBLUE(api, { target }) { - const { loanToken, supplied } = await morphoPosition(api, await getter(api, target, abi.MARKET_ID), target); - return [[loanToken, supplied]]; - }, + MORPHOBLUE: ({ morpho }) => [[morpho.loanToken, morpho.supplied]], // USDC supplied on Aave, minus the WBTC borrowed against it, plus that WBTC // supplied to the PM's Morpho Blue market. - async AAVECARRY(api, { target }) { - const marketId = await getter(api, target, abi.MARKET_ID); - const aUsdc = await getter(api, target, abi.A_USDC); - const debtWbtc = await getter(api, target, abi.VARIABLE_DEBT_WBTC); - const { loanToken, supplied } = await morphoPosition(api, marketId, target); - const aUsdcBalance = await balanceOf(api, aUsdc, target); - const debt = await balanceOf(api, debtWbtc, target); - return [[loanToken, supplied], [ADDRESSES.ethereum.USDC, aUsdcBalance], [ADDRESSES.ethereum.WBTC, -BigInt(debt)]]; - }, + AAVECARRY: ({ morpho, aUsdcBalance, debt }) => + [[morpho.loanToken, morpho.supplied], [ADDRESSES.ethereum.USDC, aUsdcBalance], [ADDRESSES.ethereum.WBTC, -BigInt(debt)]], // WBTC collateral, minus the loan token borrowed against it, plus that loan // token deployed to the venue vault. - async MORPHOCARRY(api, { target, investment }) { - const venue = MORPHOCARRY_VENUES[investment]; - if (!venue) throw new SkipStrategy('no venue in MORPHOCARRY_VENUES'); - const { loanToken, collateralToken, borrowed, collateral } = await morphoPosition(api, venue.marketId, target); - const vaultHolding = await erc4626Holding(api, venue.vault, target); - return [[collateralToken, collateral], [loanToken, -borrowed], vaultHolding]; - }, + MORPHOCARRY: ({ morpho, vaultAsset, vaultAmount }) => + [[morpho.collateralToken, morpho.collateral], [morpho.loanToken, -morpho.borrowed], [vaultAsset, vaultAmount]], // Shares of the ERC-4626 vault the PM names. - async MORPHOV2(api, { target }) { - return [await erc4626Holding(api, await getter(api, target, abi.VAULT), target)]; - }, - async FLUIDLITE(api, { target }) { - return [await erc4626Holding(api, await getter(api, target, abi.VAULT), target)]; - }, + MORPHOV2: ({ vaultAsset, vaultAmount }) => [[vaultAsset, vaultAmount]], + FLUIDLITE: ({ vaultAsset, vaultAmount }) => [[vaultAsset, vaultAmount]], // Stake DAO reward-vault shares, converted to the Curve LP token. - async STAKEDAO(api, { target, investment }) { - const vault = STAKEDAO_VAULTS[investment]; - if (!vault) throw new SkipStrategy('no vault in STAKEDAO_VAULTS'); - return [await erc4626Holding(api, vault, target)]; - }, + STAKEDAO: ({ vaultAsset, vaultAmount }) => [[vaultAsset, vaultAmount]], // Curve LP held directly and staked in the PM's gauge (1:1 LP). - async CURVE(api, { target }) { - const pool = await getter(api, target, abi.POOL); - const gauge = await getter(api, target, abi.gauge); - const held = await balanceOf(api, pool, target); - const staked = await balanceOf(api, gauge, target); - return [[pool, held], [pool, staked]]; - }, + CURVE: ({ pool, held, staked }) => [[pool, held], [pool, staked]], // YieldBasis LT shares redeemed at the LT's preview_withdraw. - async YIELDBASIS(api, { target }) { - const lt = await getter(api, target, abi.LT); - const asset = await getter(api, target, abi.ASSET); - const shares = await balanceOf(api, lt, target); - if (BigInt(shares) === 0n) return []; - return [[asset, await api.call({ target: lt, abi: abi.previewWithdraw, params: [shares] })]]; - }, + YIELDBASIS: ({ asset, shares, redeemed }) => BigInt(shares) === 0n ? [] : [[asset, redeemed]], // sUSDS and syrupUSDC are counted by the balanceOf sweep. - async SUSDS() { return []; }, - async UNIV4SWAP() { return []; }, + SUSDS: () => [], + UNIV4SWAP: () => [], }; -const isRevert = (e) => /revert|CALL_EXCEPTION/i.test(String(e && e.message)); - /** - * Values one strategy position manager and adds its holdings. A strategy with - * no valuer, a missing venue entry, or a reverting read is logged and skipped - * so the rest of the chain's TVL still reports; other errors (RPC) propagate. + * Values the strategy position managers and adds their holdings. Reads are + * batched across strategies: one multicall per getter / read kind instead of + * one call per strategy. A strategy with no valuer, a missing venue entry, or + * a reverting read is logged and skipped so the rest of the chain's TVL still + * reports; other errors (RPC) propagate. */ -async function addStrategyPosition(api, strategy) { - const valuer = VALUERS[strategy.protocol]; - try { - if (!valuer) throw new SkipStrategy('no valuation'); - const holdings = await valuer(api, strategy); - holdings.forEach(([token, amount]) => api.add(token, amount)); - } catch (e) { - if (!(e instanceof SkipStrategy) && !isRevert(e)) throw e; - sdk.log(`btcd: skipped ${strategy.typ} at ${strategy.target}: ${e instanceof SkipStrategy ? e.message : 'read reverted'}`); +async function addStrategyPositions(api, strategies) { + const skipped = new Map(); + const skip = (s, reason = 'read reverted') => { if (!skipped.has(s)) skipped.set(s, reason); }; + const of = (...protocols) => strategies.filter((s) => protocols.includes(s.protocol) && !skipped.has(s)); + // Runs calls[i] for list[i] in one multicall and stores each result on its + // strategy under `key`; a reverting read skips that strategy only. + const read = async (list, key, readAbi, toCall) => { + if (!list.length) return; + const res = await api.multiCall({ abi: readAbi, calls: list.map(toCall), permitFailure: true }); + list.forEach((s, i) => (res[i] == null ? skip(s) : (s[key] = res[i]))); + }; + const self = (s) => s.target; + + strategies.forEach((s) => { + if (!VALUERS[s.protocol]) return skip(s, 'no valuation'); + if (s.protocol === 'STAKEDAO') { + s.vault = STAKEDAO_VAULTS[s.investment]; + if (!s.vault) skip(s, 'no vault in STAKEDAO_VAULTS'); + } + if (s.protocol === 'MORPHOCARRY') { + const venue = MORPHOCARRY_VENUES[s.investment]; + if (!venue) return skip(s, 'no venue in MORPHOCARRY_VENUES'); + s.marketId = venue.marketId; + s.vault = venue.vault; + } + }); + + // venue addresses the position managers name themselves + await read(of('MORPHOBLUE', 'AAVECARRY'), 'marketId', abi.MARKET_ID, self); + await read(of('AAVECARRY'), 'aUsdc', abi.A_USDC, self); + await read(of('AAVECARRY'), 'debtWbtc', abi.VARIABLE_DEBT_WBTC, self); + await read(of('MORPHOV2', 'FLUIDLITE'), 'vault', abi.VAULT, self); + await read(of('CURVE'), 'pool', abi.POOL, self); + await read(of('CURVE'), 'gauge', abi.gauge, self); + await read(of('YIELDBASIS'), 'lt', abi.LT, self); + await read(of('YIELDBASIS'), 'asset', abi.ASSET, self); + + // Morpho Blue positions + const MORPHO = ['MORPHOBLUE', 'AAVECARRY', 'MORPHOCARRY']; + await read(of(...MORPHO), 'morphoPos', abi.morphoPosition, (s) => ({ target: MORPHO_BLUE, params: [s.marketId, s.target] })); + await read(of(...MORPHO), 'morphoMarket', abi.morphoMarket, (s) => ({ target: MORPHO_BLUE, params: [s.marketId] })); + await read(of(...MORPHO), 'morphoParams', abi.morphoMarketParams, (s) => ({ target: MORPHO_BLUE, params: [s.marketId] })); + of(...MORPHO).forEach((s) => { s.morpho = morphoPosition(s.morphoPos, s.morphoMarket, s.morphoParams); }); + + // every balanceOf any strategy needs: [protocols, token field, result field] + const VAULTS = ['MORPHOV2', 'FLUIDLITE', 'STAKEDAO', 'MORPHOCARRY']; + const balanceReads = [ + [VAULTS, 'vault', 'vaultShares'], + [['AAVECARRY'], 'aUsdc', 'aUsdcBalance'], + [['AAVECARRY'], 'debtWbtc', 'debt'], + [['CURVE'], 'pool', 'held'], + [['CURVE'], 'gauge', 'staked'], + [['YIELDBASIS'], 'lt', 'shares'], + ].flatMap(([protocols, tokenKey, key]) => of(...protocols).map((s) => ({ s, token: s[tokenKey], key }))); + if (balanceReads.length) { + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls: balanceReads.map(({ s, token }) => ({ target: token, params: [s.target] })), permitFailure: true }); + balanceReads.forEach(({ s, key }, i) => (balances[i] == null ? skip(s) : (s[key] = balances[i]))); } + + // ERC-4626 shares converted through the vault's own convertToAssets + await read(of(...VAULTS), 'vaultAsset', abi.asset, (s) => s.vault); + await read(of(...VAULTS), 'vaultAmount', abi.convertToAssets, (s) => ({ target: s.vault, params: [s.vaultShares] })); + await read(of('YIELDBASIS').filter((s) => BigInt(s.shares) > 0n), 'redeemed', abi.previewWithdraw, (s) => ({ target: s.lt, params: [s.shares] })); + + strategies.forEach((s) => { + if (skipped.has(s)) return sdk.log(`btcd: skipped ${s.typ} at ${s.target}: ${skipped.get(s)}`); + VALUERS[s.protocol](s).forEach(([token, amount]) => api.add(token, amount)); + }); } /** @@ -271,7 +274,7 @@ async function ethereumTvl(api) { return { ...s, protocol, investment }; }); - for (const strategy of strategies) await addStrategyPosition(api, strategy); + await addStrategyPositions(api, strategies); await sumTokens2({ api, owners: [...STATIC_CUSTODY, ...strategies.map(({ target }) => target)], tokens: idleTokens }); await addYieldBasisHybrid(api); } diff --git a/projects/cap-money/index.js b/projects/cap-money/index.js index 514dbea3ec6..7c5cead6774 100644 --- a/projects/cap-money/index.js +++ b/projects/cap-money/index.js @@ -60,14 +60,12 @@ const ethereumBorrowed = async (api) => { asset: asset, }))).flat() - const results = await api.batchCall( - agentAndAsset.map(({ agent, asset }) => ({ - abi: capABI.Lender.debt, - target: infra.lender.address, - params: [agent, asset], - permitFailure: true - })) - ); + const results = await api.multiCall({ + abi: capABI.Lender.debt, + target: infra.lender.address, + calls: agentAndAsset.map(({ agent, asset }) => ({ params: [agent, asset] })), + permitFailure: true, + }); for (const [{ asset }, debt] of arrayZip(agentAndAsset, results)) { if (!debt) continue; diff --git a/projects/cap-money/lib/helpers.js b/projects/cap-money/lib/helpers.js index 91193d8ecaa..7dc5cc9955f 100644 --- a/projects/cap-money/lib/helpers.js +++ b/projects/cap-money/lib/helpers.js @@ -125,9 +125,18 @@ const mapWrappedAssetBalance = (chain, address, availableBalance) => { return [address, availableBalance]; } +// tvl and borrowed need the same data, so fetch it once per run +const perRunCache = {} +const cachedPerRun = (name, fn) => (api, chain) => { + if (!api.block && !api.timestamp) return fn(api, chain) + const key = `${name}-${chain}-${api.block}-${api.timestamp}` + if (!perRunCache[key]) perRunCache[key] = fn(api, chain).catch(e => { delete perRunCache[key]; throw e }) + return perRunCache[key] +} + module.exports = { - fetchAgentConfigs, - fetchAssetAddresses, + fetchAgentConfigs: cachedPerRun('agentConfigs', fetchAgentConfigs), + fetchAssetAddresses: cachedPerRun('assetAddresses', fetchAssetAddresses), mapWrappedAssetBalance, } diff --git a/projects/dodo/index.js b/projects/dodo/index.js index 05b193ef535..844e090a434 100644 --- a/projects/dodo/index.js +++ b/projects/dodo/index.js @@ -69,7 +69,7 @@ Object.keys(config).forEach(chain => { async function addLogs(target, eventAbi) { if (!target) return; const convert = i => [[i.baseToken, i.quoteToken], i.pool] - let logs = await getLogs({ api, target, eventAbi, onlyArgs: true, fromBlock, }) + let logs if (chain === 'base' && target === '0xc0F9553Df63De5a97Fe64422c8578D0657C360f7') logs = await getLogs({ api, target, eventAbi, onlyArgs: true, fromBlock: 8964122, }) // hard to get old logs, too far back in time, manually added missing pairs else diff --git a/projects/etherfi-cash-collateral-management/index.js b/projects/etherfi-cash-collateral-management/index.js index 5d5f77847d3..e6c655a7975 100644 --- a/projects/etherfi-cash-collateral-management/index.js +++ b/projects/etherfi-cash-collateral-management/index.js @@ -12,6 +12,8 @@ const CONFIG = { etherFiCashFactory: '0xF4e147Db314947fC1275a8CbB6Cde48c510cd8CF', cashBorrowerHelperContract: '0x0Da474E396F059594C0412ED79b2C9349bbc8087', cashDebitCore: '0x0078C5a459132e279056B2371fE8A8eC973A9553', + // one eth_call covers 400 safes: the helper handles 600 per call here and reverts (gas) at 1200 + multicallSize: 8, }, } @@ -27,14 +29,14 @@ const MULTICALL_SIZE = 3 const CONCURRENCY = 80 const tvl = async (api) => { - const { etherFiCashFactory, cashBorrowerHelperContract } = CONFIG[api.chain] + const { etherFiCashFactory, cashBorrowerHelperContract, multicallSize = MULTICALL_SIZE } = CONFIG[api.chain] const numSafes = (await api.call({ abi: abi.numContractsDeployed, target: etherFiCashFactory })) - 1 const calls = [] for (let i = 0; i < numSafes; i += SAFES_PER_CALL) { calls.push({ target: cashBorrowerHelperContract, params: [i, Math.min(SAFES_PER_CALL, numSafes - i)] }) } - const chunks = sliceIntoChunks(calls, MULTICALL_SIZE) + const chunks = sliceIntoChunks(calls, multicallSize) let processed = 0 let failures = 0 diff --git a/projects/euler-v2/index.js b/projects/euler-v2/index.js index 7c9ddd5e901..51574bbb4f8 100644 --- a/projects/euler-v2/index.js +++ b/projects/euler-v2/index.js @@ -44,7 +44,17 @@ async function fetchPriceMap(api, addresses) { Object.keys(config).forEach(chain => { const { factory, } = config[chain] - async function getVaults(api) { + const vaultCache = {} + + // tvl and borrowed need the same vault list, fetch it once per run + function getVaults(api) { + if (!api.block && !api.timestamp) return _getVaults(api) + const key = `${api.block}-${api.timestamp}` + if (!vaultCache[key]) vaultCache[key] = _getVaults(api).catch(e => { delete vaultCache[key]; throw e }) + return vaultCache[key] + } + + async function _getVaults(api) { const vaults = await api.fetchList({ lengthAbi: 'getProxyListLength', itemAbi: 'proxyList', target: factory }) const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) return { vaults, tokens } diff --git a/projects/fables/index.js b/projects/fables/index.js index 1feabfe72fb..a809b622191 100644 --- a/projects/fables/index.js +++ b/projects/fables/index.js @@ -16,49 +16,62 @@ async function tvl(api) { // activePools() returns the full PoolKey per pool; the nested tuple[] decodes cleanly (verified live). const pools = await api.call({ target: REGISTRY, abi: POOLS_ABI }) - for (const p of pools) { - const token0 = p.key.currency0 - const token1 = p.key.currency1 - const ts = Number(p.key.tickSpacing) + // every step is one multicall across all pools, instead of one set of calls per pool + const slot0s = await api.multiCall({ target: STATE_VIEW, abi: SLOT0_ABI, calls: pools.map((p) => ({ params: [p.id] })) }) - const slot0 = await api.call({ target: STATE_VIEW, abi: SLOT0_ABI, params: [p.id] }) - const tick = Number(slot0.tick) - - // Find every initialized tick via the bitmap. compressed = tick / tickSpacing; wordPos = compressed >> 8. + // Find every initialized tick via the bitmap. compressed = tick / tickSpacing; wordPos = compressed >> 8. + const wordCalls = [] + pools.forEach((p, poolIdx) => { + const ts = Number(p.key.tickSpacing) const minWord = Math.floor(-MAX_TICK / ts) >> 8 const maxWord = Math.floor(MAX_TICK / ts) >> 8 - const words = [] - for (let w = minWord; w <= maxWord; w++) words.push(w) - const bitmaps = await api.multiCall({ - target: STATE_VIEW, - abi: BITMAP_ABI, - calls: words.map((w) => ({ params: [p.id, w] })), - }) + for (let w = minWord; w <= maxWord; w++) wordCalls.push({ poolIdx, word: w, ts }) + }) + const bitmaps = await api.multiCall({ + target: STATE_VIEW, + abi: BITMAP_ABI, + calls: wordCalls.map(({ poolIdx, word }) => ({ params: [pools[poolIdx].id, word] })), + chunkSize: 1000, // a bitmap word is a single storage read, so bigger chunks than the default are cheap + }) - const ticks = [] - bitmaps.forEach((bm, i) => { - const word = BigInt(bm) - if (word === 0n) return - for (let bit = 0; bit < 256; bit++) { - if ((word >> BigInt(bit)) & 1n) ticks.push((words[i] * 256 + bit) * ts) - } - }) + const poolTicks = pools.map(() => []) + bitmaps.forEach((bm, i) => { + const word = BigInt(bm) + if (word === 0n) return + const { poolIdx, word: wordPos, ts } = wordCalls[i] + for (let bit = 0; bit < 256; bit++) { + if ((word >> BigInt(bit)) & 1n) poolTicks[poolIdx].push((wordPos * 256 + bit) * ts) + } + }) + + const tickCalls = [] + poolTicks.forEach((ticks, poolIdx) => { ticks.sort((a, b) => a - b) - if (ticks.length < 2) continue + if (ticks.length < 2) return + ticks.forEach((t) => tickCalls.push({ poolIdx, params: [pools[poolIdx].id, t] })) + }) + const nets = await api.multiCall({ + target: STATE_VIEW, + abi: TICKLIQ_ABI, + calls: tickCalls.map(({ params }) => ({ params })), + }) + const poolNets = pools.map(() => []) + nets.forEach((net, i) => poolNets[tickCalls[i].poolIdx].push(net)) - const nets = await api.multiCall({ - target: STATE_VIEW, - abi: TICKLIQ_ABI, - calls: ticks.map((t) => ({ params: [p.id, t] })), - }) + pools.forEach((p, poolIdx) => { + const ticks = poolTicks[poolIdx] + if (ticks.length < 2) return + const token0 = p.key.currency0 + const token1 = p.key.currency1 + const tick = Number(slot0s[poolIdx].tick) let liquidity = 0 for (let i = 0; i < ticks.length - 1; i++) { - liquidity += Number(nets[i].liquidityNet) + liquidity += Number(poolNets[poolIdx][i].liquidityNet) if (liquidity <= 0) continue addUniV3LikePosition({ api, token0, token1, liquidity, tickLower: ticks[i], tickUpper: ticks[i + 1], tick }) } - } + }) } module.exports = { diff --git a/projects/helper/chain/strato.js b/projects/helper/chain/strato.js new file mode 100644 index 00000000000..ec9993a383a --- /dev/null +++ b/projects/helper/chain/strato.js @@ -0,0 +1,107 @@ +const ADDRESSES = require('../coreAssets.json') +const { ethers } = require('ethers') +const { post } = require('../http') +const { sliceIntoChunks } = require('../utils') + +const RPC_URL = 'https://noderpc.strato.nexus/rpc' +if (!process.env.STRATO_RPC) process.env.STRATO_RPC = RPC_URL + +const POOL_FACTORY = '0x000000000000000000000000000000000000100a' +const POOL_V3_FACTORY = '0x5d630126d908b46bcf8d00bc15e591a459375809' + +const BATCH_SIZE = 100 +const ENUMERATE_PAGE = 50 +const lc = (address) => address.toLowerCase() + +// STRATO has no Multicall3 and its node does not take eth_call state overrides, so reads that do not +// depend on each other go out together as one JSON-RPC batch request. Results come back in call order; +// with permitFailure a reverted or empty call is null instead of an error. +async function batchCall(calls, { permitFailure = false } = {}) { + const out = [] + for (const chunk of sliceIntoChunks(calls, BATCH_SIZE)) { + const ifaces = chunk.map(({ abi }) => new ethers.Interface([abi])) + const body = chunk.map(({ target, params = [] }, id) => ({ + jsonrpc: '2.0', id, method: 'eth_call', + params: [{ to: target, data: ifaces[id].encodeFunctionData(ifaces[id].fragments[0], [].concat(params)) }, 'latest'], + })) + const res = await post(process.env.STRATO_RPC.split(',')[0], body) + if (!Array.isArray(res)) throw new Error(`[strato] batch request failed: ${JSON.stringify(res).slice(0, 200)}`) + const byId = new Map(res.map((r) => [r.id, r])) + chunk.forEach(({ target }, id) => { + const r = byId.get(id) + if (!r || r.error || !r.result || r.result === '0x') { + if (!permitFailure) throw new Error(`[strato] ${ifaces[id].fragments[0].name} failed on ${target}: ${JSON.stringify(r?.error ?? r)}`) + return out.push(null) + } + const decoded = ifaces[id].decodeFunctionResult(ifaces[id].fragments[0], r.result) + out.push(decoded.length === 1 ? decoded[0] : decoded) + }) + } + return out +} + +// Reads `abi(i)` for i = 0, 1, 2... until the first revert or null address. +async function enumerateArray(target, abi, max = 500) { + const seen = new Set() + const out = [] + for (let start = 0; start < max; start += ENUMERATE_PAGE) { + const indexes = Array.from({ length: Math.min(ENUMERATE_PAGE, max - start) }, (_, i) => start + i) + const res = await batchCall(indexes.map((i) => ({ target, abi, params: [i] })), { permitFailure: true }) + for (const r of res) { + if (!r || r === ADDRESSES.null) return out + if (!seen.has(lc(r))) { seen.add(lc(r)); out.push(lc(r)) } + } + } + console.warn(`[strato] enumerateArray hit cap ${max} on ${target} — likely truncated`) + return out +} + +// Constant-product and StablePool swap pools from PoolFactory. Pools are not ERC20s (no LP token). +async function getV2Pools() { + const poolAddrs = await enumerateArray(POOL_FACTORY, 'function allPools(uint256) view returns (address)') + // StablePool can hold more than two coins (e.g. USDT-USDC-USDST). tokenA/tokenB + // only expose the first two, so enumerate the full `coins` array instead. + // Legacy pools have no isStable(): the failed read counts as not stable. + const isStable = await batchCall(poolAddrs.map((target) => ({ target, abi: 'function isStable() view returns (bool)' })), { permitFailure: true }) + const stablePools = poolAddrs.filter((_, i) => isStable[i]) + const plainPools = poolAddrs.filter((_, i) => !isStable[i]) + + const numCoins = await batchCall(stablePools.map((target) => ({ target, abi: 'function getNumCoins() view returns (uint256)' }))) + const coinCalls = stablePools.flatMap((target, i) => Array.from({ length: Number(numCoins[i]) }, (_, j) => ({ target, abi: 'function coins(uint256) view returns (address)', params: [j] }))) + const coins = await batchCall(coinCalls) + const tokensA = await batchCall(plainPools.map((target) => ({ target, abi: 'function tokenA() view returns (address)' }))) + const tokensB = await batchCall(plainPools.map((target) => ({ target, abi: 'function tokenB() view returns (address)' }))) + + const tokens = new Map(poolAddrs.map((pool) => [pool, new Set()])) + coinCalls.forEach(({ target }, i) => tokens.get(target).add(lc(coins[i]))) + plainPools.forEach((pool, i) => tokens.get(pool).add(lc(tokensA[i])).add(lc(tokensB[i]))) + return poolAddrs.map((pool, i) => ({ pool, tokens: [...tokens.get(pool)], isStable: !!isStable[i] })) +} + +// Concentrated-liquidity (Uniswap-v3 style) pools from PoolV3Factory. Token balances held by the +// pool contract are the TVL; positions are accounted inside the pool. +async function getV3Pools() { + const poolAddrs = await enumerateArray(POOL_V3_FACTORY, 'function allPools(uint256) view returns (address)') + const tokens0 = await batchCall(poolAddrs.map((target) => ({ target, abi: 'function token0() view returns (address)' }))) + const tokens1 = await batchCall(poolAddrs.map((target) => ({ target, abi: 'function token1() view returns (address)' }))) + return poolAddrs.map((pool, i) => ({ pool, tokens: [lc(tokens0[i]), lc(tokens1[i])] })) +} + +// Sum of every pool token held by every v2 + v3 pool. +async function sumPoolBalances(api, pools) { + const pairs = pools.flatMap(({ pool, tokens }) => tokens.map((token) => ({ holder: pool, token }))) + const balances = await batchCall(pairs.map(({ token, holder }) => ({ target: token, abi: 'function balanceOf(address) view returns (uint256)', params: [holder] }))) + pairs.forEach(({ token }, i) => { if (balances[i] > 0n) api.add(token, balances[i].toString()) }) +} + +module.exports = { + RPC_URL, + POOL_FACTORY, + POOL_V3_FACTORY, + lc, + batchCall, + enumerateArray, + getV2Pools, + getV3Pools, + sumPoolBalances, +} diff --git a/projects/helper/curators/index.js b/projects/helper/curators/index.js index 082bc72fe2e..a2ff2e559f9 100644 --- a/projects/helper/curators/index.js +++ b/projects/helper/curators/index.js @@ -382,37 +382,32 @@ async function getCuratorTvlErc4626(api, vaults, { euler = false, booked = new S const v2VaultSet = new Set(v2Vaults.map(v => v.vault)) + // v2's deposits in v1: the v1 shares held by the v2 adapter, converted to underlying assets + // (two multicalls for all pairs instead of two calls per pair) + const deposits = [...v1Groups.values()].flatMap(({ v1, v2Vaults: v2List }) => + v2List.filter(v2 => v2.depositor).map(v2 => ({ v1, v2 }))) + const depositShares = await api.multiCall({ + abi: ABI.ERC4626.balanceOf, + calls: deposits.map(({ v1, v2 }) => ({ target: v1.vault, params: [v2.depositor] })), + permitFailure: true, + }) + const heldDeposits = deposits.map((d, i) => ({ ...d, shares: depositShares[i] })).filter(d => d.shares && BigInt(d.shares) > 0n) + const depositAssets = await api.multiCall({ + abi: ABI.ERC4626.convertToAssets, + calls: heldDeposits.map(({ v1, shares }) => ({ target: v1.vault, params: [shares] })), + permitFailure: true, + }) + const v2DepositsInV1 = new Map() // v1 address -> assets its v2 vaults hold in it + heldDeposits.forEach(({ v1 }, i) => { + if (!depositAssets[i]) return + const key = v1.vault.toLowerCase() + v2DepositsInV1.set(key, (v2DepositsInV1.get(key) || 0n) + BigInt(depositAssets[i])) + }) + // Process each unique V1 vault once, summing all V2 contributions for (const { v1, v2Vaults: v2List } of v1Groups.values()) { - let totalV2Assets = 0n - let totalV2DepositsInV1 = 0n - - for (const v2 of v2List) { - totalV2Assets += v2.totalAssets - - if (v2.depositor) { - // Get v2's deposits in v1 using the adapter that holds v1 shares - const v2AdapterSharesInV1 = await api.call({ - abi: ABI.ERC4626.balanceOf, - target: v1.vault, - params: [v2.depositor], - permitFailure: true, - }) - - if (v2AdapterSharesInV1 && BigInt(v2AdapterSharesInV1) > 0n) { - // Convert v1 shares held by v2 adapter to underlying assets - const v2AssetsInV1 = await api.call({ - abi: ABI.ERC4626.convertToAssets, - target: v1.vault, - params: [v2AdapterSharesInV1], - permitFailure: true, - }) - if (v2AssetsInV1) { - totalV2DepositsInV1 += BigInt(v2AssetsInV1) - } - } - } - } + const totalV2Assets = v2List.reduce((sum, v2) => sum + v2.totalAssets, 0n) + const totalV2DepositsInV1 = v2DepositsInV1.get(v1.vault.toLowerCase()) || 0n // Unique TVL = V1 + sum(V2) - sum(v2_deposits_in_v1) // Count V1 totalAssets only ONCE regardless of how many V2 vaults wrap it diff --git a/projects/idle/index.js b/projects/idle/index.js index 80086521dd6..879f6ff3a9e 100644 --- a/projects/idle/index.js +++ b/projects/idle/index.js @@ -172,7 +172,7 @@ async function tvl(api) { const [wrap4626Supplies, wrap4626Tokens] = await Promise.all(['uint256:totalSupply', 'address:token'].map( abi => api.multiCall({ abi, calls: wrap4626 }) )) - const wrap6426Assets = await Promise.all(wrap4626Supplies.map( (supply, i) => api.call({ abi: 'function convertToAssets(uint256 shares) external view returns (uint256 assets)', target: wrap4626[i], params: [supply] }) )) + const wrap6426Assets = await api.multiCall({ abi: 'function convertToAssets(uint256 shares) external view returns (uint256 assets)', calls: wrap4626Supplies.map( (supply, i) => ({ target: wrap4626[i], params: [supply] }) ) }) wrap6426Assets.map( (value, i) => sdk.util.sumSingleBalance(balances, wrap4626Tokens[i], value, api.chain) ) diff --git a/projects/mosh/index.js b/projects/mosh/index.js index 40c4bc72cef..2f518a8b24d 100644 --- a/projects/mosh/index.js +++ b/projects/mosh/index.js @@ -39,10 +39,17 @@ function poolIdOf({ currency0, currency1, fee, tickSpacing, hooks }) { const SwarmCreated = 'event SwarmCreated(address indexed swarm, address indexed creator, uint256 index, bytes32 launchParamsHash)' -// Sums the swarms' and vaults' pair asset and both sides of the vaults' ranges, keeping only BUN -// (ownToken) or everything but BUN (!ownToken) -async function swarmBalances(api, ownToken) { - const counts = (token) => (token.toLowerCase() === BUN) === ownToken +// tvl and staking walk the same swarms, vaults and ranges and differ only in which token they keep, +// so that state is read once per run (keyed by timestamp) and shared; a failed read is not cached +const stateCache = {} +function getState(api) { + const key = api.timestamp + if (!stateCache[key]) stateCache[key] = loadState(api).catch(e => { delete stateCache[key]; throw e }) + return stateCache[key] +} + +// Swarms, their vaults and the vaults' open ranges with each range's pool key and price; null if no swarm +async function loadState(api) { const created = [] for (const target of FACTORIES) created.push(...await getLogs2({ api, target, eventAbi: SwarmCreated, fromBlock })) const allSwarms = [...new Set([...created.map(i => i.swarm.toLowerCase()), ...LEGACY_SWARMS])] @@ -59,7 +66,7 @@ async function swarmBalances(api, ownToken) { }) const swarms = allSwarms.filter((_, i) => Boolean(allCounters[i])) const counterOf = allCounters.filter(Boolean) - if (!swarms.length) return api.getBalances() + if (!swarms.length) return null const memecoins = await api.multiCall({ abi: 'address:memecoin', calls: swarms, permitFailure: true }) // counts say how many vaults exist: a failed read must fail the run, not read as zero vaults @@ -71,12 +78,6 @@ async function swarmBalances(api, ownToken) { const vaults = await api.multiCall({ abi: 'function vaults(uint256) view returns (address)', calls: vaultCalls.map(({ target, params }) => ({ target, params })) }) const swarmOfVault = vaults.map((_, k) => vaultCalls[k].swarm) - // cash: the pair asset held by each swarm and each of its vaults - const ownerTokens = swarms.map((s, i) => [[counterOf[i]], s]) - vaults.forEach((v, k) => ownerTokens.push([[counterOf[swarmOfVault[k]]], v])) - const counted = ownerTokens.filter(([[token]]) => counts(token)) - if (counted.length) await sumTokens2({ api, ownerTokens: counted }) - // Each vault's pool key for venue 0, the token's Pons pool const fees = await api.multiCall({ abi: 'uint24:v4Fee', calls: vaults, permitFailure: true }) const spacings = await api.multiCall({ abi: 'int24:v4TickSpacing', calls: vaults, permitFailure: true }) @@ -122,6 +123,23 @@ async function swarmBalances(api, ownToken) { const slot0 = pools.length ? await api.multiCall({ abi: GET_SLOT0_ABI, target: STATE_VIEW, calls: pools, permitFailure: true }) : [] const sqrtPriceOf = new Map(pools.map((id, i) => [id, slot0[i] ? Number(slot0[i].sqrtPriceX96) / 2 ** 96 : 0])) + return { swarms, counterOf, memecoins, hasPair, vaults, swarmOfVault, ponsKeyOf, rangeCalls, ranges, rangeKeys, rangePools, sqrtPriceOf } +} + +// Sums the swarms' and vaults' pair asset and both sides of the vaults' ranges, keeping only BUN +// (ownToken) or everything but BUN (!ownToken) +async function swarmBalances(api, ownToken) { + const counts = (token) => (token.toLowerCase() === BUN) === ownToken + const state = await getState(api) + if (!state) return api.getBalances() + const { swarms, counterOf, memecoins, hasPair, vaults, swarmOfVault, ponsKeyOf, rangeCalls, ranges, rangeKeys, rangePools, sqrtPriceOf } = state + + // cash: the pair asset held by each swarm and each of its vaults + const ownerTokens = swarms.map((s, i) => [[counterOf[i]], s]) + vaults.forEach((v, k) => ownerTokens.push([[counterOf[swarmOfVault[k]]], v])) + const counted = ownerTokens.filter(([[token]]) => counts(token)) + if (counted.length) await sumTokens2({ api, ownerTokens: counted }) + ranges.forEach((r, j) => { if (!r) return const key = rangeKeys[j], sp = key && sqrtPriceOf.get(rangePools[j]), L = Number(r.liquidity) @@ -151,15 +169,15 @@ async function swarmBalances(api, ownToken) { }) // a swarm whose token has not graduated has no Pons pool to sell into const sells = [...idleOf].filter(([i, idle]) => idle > 0n && keyOf.has(i)).map(([i, idle]) => ({ i, idle, key: keyOf.get(i) })) - for (const { i, idle, key } of sells) { - const memeIs0 = key.currency0 !== counterOf[i] - const poolKey = [key.currency0, key.currency1, key.fee, key.tickSpacing, key.hooks] - const { amountOut } = await api.call({ abi: QUOTE_ABI, target: QUOTER, params: [[poolKey, memeIs0, idle.toString(), '0x']] }) - const { sqrtPriceX96 } = await api.call({ abi: GET_SLOT0_ABI, target: STATE_VIEW, params: poolIdOf(key) }) - const s2 = BigInt(sqrtPriceX96) ** 2n, q192 = 1n << 192n + const memeIs0Of = ({ i, key }) => key.currency0 !== counterOf[i] + const quotes = sells.length ? await api.multiCall({ abi: QUOTE_ABI, target: QUOTER, calls: sells.map(sell => ({ params: [[[sell.key.currency0, sell.key.currency1, sell.key.fee, sell.key.tickSpacing, sell.key.hooks], memeIs0Of(sell), sell.idle.toString(), '0x']] })) }) : [] + const sellSlot0 = sells.length ? await api.multiCall({ abi: GET_SLOT0_ABI, target: STATE_VIEW, calls: sells.map(({ key }) => poolIdOf(key)) }) : [] + sells.forEach((sell, j) => { + const { i, idle } = sell, memeIs0 = memeIs0Of(sell), { amountOut } = quotes[j] + const s2 = BigInt(sellSlot0[j].sqrtPriceX96) ** 2n, q192 = 1n << 192n const spotEquivalent = memeIs0 ? BigInt(amountOut) * q192 / s2 : BigInt(amountOut) * s2 / q192 api.add(memecoins[i], spotEquivalent < idle ? spotEquivalent : idle) - } + }) } return api.getBalances() diff --git a/projects/peapods-finance/index.js b/projects/peapods-finance/index.js index d51115d3385..18ed6dc44fb 100644 --- a/projects/peapods-finance/index.js +++ b/projects/peapods-finance/index.js @@ -35,8 +35,26 @@ async function discoverLendingPairs (api) { } +const balancesCache = {} + const getTvl = async (api, isStaking) => { - const { indexManagerV2, indexManagerV3, leverageManager, peasToken } = config[api.chain]; + const { peasToken } = config[api.chain]; + // tvl and staking are the same balances split on the PEAS token, so fetch them once per run + const key = `${api.chain}-${api.block}-${api.timestamp}` + const useCache = api.block || api.timestamp + if (useCache && balancesCache[key]) api.addBalances(await balancesCache[key]) + else { + const promise = fetchBalances(api) + if (useCache) balancesCache[key] = promise + await promise.catch(e => { delete balancesCache[key]; throw e }) + } + Object.keys(api.getBalances()) + .filter(token => new RegExp(peasToken, 'i').test(token) !== isStaking) + .forEach(t => api.removeTokenBalance(t)); +}; + +const fetchBalances = async (api) => { + const { indexManagerV2, indexManagerV3, leverageManager } = config[api.chain]; const ownerTokens = []; let indexesV3 = []; let indexesV2 = []; @@ -89,9 +107,7 @@ const getTvl = async (api, isStaking) => { await sumTokens2({ api, ownerTokens, blacklistedTokens: [...indexesV2,...indexesV3, '0xc31389794ffac23331e0d9f611b7953f90aa5fdc'], resolveLP: true }); [...indexesV2, ...indexesV3].forEach(t => api.removeTokenBalance(t)); - Object.keys(api.getBalances()) - .filter(token => new RegExp(peasToken, 'i').test(token) !== isStaking) - .forEach(t => api.removeTokenBalance(t)); + return { ...api.getBalances() } }; diff --git a/projects/radiant-v2/index.js b/projects/radiant-v2/index.js index d7b9a3f834f..e14b1cec102 100644 --- a/projects/radiant-v2/index.js +++ b/projects/radiant-v2/index.js @@ -1,6 +1,7 @@ +const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); -const { sumTokensExport } = require("../helper/unwrapLPs"); -const { aaveExports, methodology, aaveV2Export, } = require("../helper/aave"); +const { sumTokensExport, sumTokens2 } = require("../helper/unwrapLPs"); +const { aaveExports, methodology, } = require("../helper/aave"); const { mergeExports } = require('../helper/utils'); const coreMarkets = { @@ -52,19 +53,36 @@ const rizMarketsConfig = { } const rizMarketExports = {} +const rizAbi = { + getReservesList: "address[]:getReservesList", + getReserveData: "function getReserveData(address asset) view returns (tuple(tuple(uint256 data) configuration, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 currentLiquidityRate, uint128 currentVariableBorrowRate, uint128 currentStableBorrowRate, uint40 lastUpdateTimestamp, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint8 id))", +} + +// same as aaveV2Export(pool) for each pool, but batched across all pools of the chain +async function getRizReserves(api, pools) { + const reserves = await api.multiCall({ abi: rizAbi.getReservesList, calls: pools }) + const calls = pools.map((pool, i) => reserves[i].map(token => ({ target: pool, params: token }))).flat() + const data = await api.multiCall({ abi: rizAbi.getReserveData, calls }) + return data.map((v, i) => ({ underlying: calls[i].params, aTokenAddress: v.aTokenAddress, stableDebtTokenAddress: v.stableDebtTokenAddress, variableDebtTokenAddress: v.variableDebtTokenAddress })) +} + Object.keys(rizMarketsConfig).forEach(chain => { const pools = rizMarketsConfig[chain] rizMarketExports[chain] = { tvl: async (api) => { - for (const pool of pools) { - await aaveV2Export(pool).tvl(api) - } + const data = await getRizReserves(api, pools) + await sumTokens2({ api, tokensAndOwners: data.map(i => [i.underlying, i.aTokenAddress]) }) return api.getBalances() }, borrowed: async (api) => { - for (const pool of pools) { - await aaveV2Export(pool).borrowed(api) - } + const balances = api.getBalances() + const data = await getRizReserves(api, pools) + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: data.map(i => i.variableDebtTokenAddress).concat(data.map(i => i.stableDebtTokenAddress)) }) + data.forEach((i, idx) => { + const value = +supplies[idx] + +supplies[data.length + idx] + sdk.util.sumSingleBalance(balances, i.underlying, value, api.chain) + }) + await sumTokens2({ api, balances }) return api.getBalances() } } diff --git a/projects/reserve/helper.js b/projects/reserve/helper.js index 1b3d87eb17f..b92d7d55c24 100644 --- a/projects/reserve/helper.js +++ b/projects/reserve/helper.js @@ -91,7 +91,19 @@ const getCompoundUsdcValues = async ( }); }; -const _getLogs = async (api, config) => { +// tvl and staking both need the RToken creation logs: fetch them once per chain and run +const rTokenLogs = {}; +const _getLogs = (api, config) => { + const key = `${api.chain}-${api.timestamp}`; + if (!rTokenLogs[key]) + rTokenLogs[key] = _fetchLogs(api, config).catch((e) => { + delete rTokenLogs[key]; + throw e; + }); + return rTokenLogs[key]; +}; + +const _fetchLogs = async (api, config) => { const resLog = ( await Promise.all( config.deployerAddresses.map((deployerAddress) => diff --git a/projects/reserve/index.js b/projects/reserve/index.js index ebf497a351b..2d17cc2ac9b 100644 --- a/projects/reserve/index.js +++ b/projects/reserve/index.js @@ -148,7 +148,11 @@ async function tvl(api) { const allManagers = basketRes.flatMap(([tokens], i) => tokens.map(() => backingManagers[i]) ); - const allNames = await api.multiCall({ abi: "string:name", calls: allTokens, }); + // the same collateral tokens repeat across RTokens, read each name once + const uniqueTokens = [...new Set(allTokens)]; + const uniqueNames = await api.multiCall({ abi: "string:name", calls: uniqueTokens, }); + const nameOf = Object.fromEntries(uniqueTokens.map((token, i) => [token, uniqueNames[i]])); + const allNames = allTokens.map((token) => nameOf[token]); const aTokenWrappersV2 = allTokens.filter((_, i) => allNames[i].startsWith("Static Aave") && allNames[i].includes("interest")); diff --git a/projects/royco-v2/index.js b/projects/royco-v2/index.js index ead950b94f1..142609c12c8 100644 --- a/projects/royco-v2/index.js +++ b/projects/royco-v2/index.js @@ -84,7 +84,16 @@ const strategyTypeAbi = "function strategyType() view returns (uint8)"; const getMakinaMachineAbi = "function getMakinaMachine() view returns (address)"; const hubCaliberAbi = "function hubCaliber() view returns (address)"; -const resolveStrategies = async (api, vault) => { +// Promise memo scoped to one run (keyed by timestamp): every chain's run needs the same mainnet strategy +// list and the same V2 market list, so they are read once instead of once per chain. A failed read is +// evicted so the next caller retries. +const memo = {}; +const memoize = (key, fn) => { + if (!memo[key]) memo[key] = fn().catch(e => { delete memo[key]; throw e; }); + return memo[key]; +}; + +const resolveStrategies = (api, vault) => memoize(`strategies:${vault}:${api.timestamp}`, async () => { const strategies = await api.call({ abi: getStrategiesAbi, target: vault }); if (!strategies.length) return []; @@ -96,7 +105,7 @@ const resolveStrategies = async (api, vault) => { const machines = await api.multiCall({ abi: getMakinaMachineAbi, calls: crosschain }); const calibers = await api.multiCall({ abi: hubCaliberAbi, calls: machines }); return [...selfCustody, ...calibers]; -}; +}); // NAV_UNIT (18 decimals, USDC-denominated) -> USDC (6 decimals) const NAV_TO_USDC = 10n ** 12n; @@ -169,7 +178,7 @@ const getEscrowedDeposits = async (api, generation, tokens, trancheShares) => { return escrowed; }; -const getTranches = async (api) => { +const getTranches = (api) => memoize(`tranches:${api.chain}:${api.timestamp}`, async () => { const { factoryAddress, factoryFromBlock } = config[api.chain].v2; const marketDeployedLogs = await getLogs2({ api, @@ -182,10 +191,11 @@ const getTranches = async (api) => { const senior = deployed.map(market => market.seniorTranche); const junior = deployed.map(market => market.juniorTranche); - const seniorAssets = await api.multiCall({ abi: 'address:asset', calls: senior, permitFailure: true }); - const juniorAssets = await api.multiCall({ abi: 'address:asset', calls: junior, permitFailure: true }); - const seniorClaims = await api.multiCall({ abi: totalAssetsAbi, calls: senior, permitFailure: true }); - const juniorClaims = await api.multiCall({ abi: totalAssetsAbi, calls: junior, permitFailure: true }); + // senior and junior share each multiCall: first half senior, second half junior + const assets = await api.multiCall({ abi: 'address:asset', calls: [...senior, ...junior], permitFailure: true }); + const claims = await api.multiCall({ abi: totalAssetsAbi, calls: [...senior, ...junior], permitFailure: true }); + const seniorAssets = assets.slice(0, senior.length), juniorAssets = assets.slice(senior.length); + const seniorClaims = claims.slice(0, senior.length), juniorClaims = claims.slice(senior.length); const markets = deployed .map((market, i) => ({ @@ -200,7 +210,7 @@ const getTranches = async (api) => { logSkipped(api, 'V2', deployed.length - markets.length, deployed.length); return markets; -}; +}); const getDayMarkets = async (api) => { const { factoryAddress, factoryFromBlock } = config[api.chain].day; @@ -217,9 +227,9 @@ const getDayMarkets = async (api) => { const collateralAssets = await api.multiCall({ abi: 'address:collateralAsset', calls: kernels, permitFailure: true }); const quoteAssets = await api.multiCall({ abi: 'address:quoteAsset', calls: kernels, permitFailure: true }); const lptAssets = await api.multiCall({ abi: 'address:lptAsset', calls: kernels, permitFailure: true }); - const stClaims = await api.multiCall({ abi: dayTotalAssetsAbi, calls: deployed.map(market => market.seniorTranche), permitFailure: true }); - const jtClaims = await api.multiCall({ abi: dayTotalAssetsAbi, calls: deployed.map(market => market.juniorTranche), permitFailure: true }); - const lptClaims = await api.multiCall({ abi: dayTotalAssetsAbi, calls: deployed.map(market => market.liquidityProviderTranche), permitFailure: true }); + // the three tranches share one multiCall: senior, then junior, then LPT + const claims = await api.multiCall({ abi: dayTotalAssetsAbi, calls: ['seniorTranche', 'juniorTranche', 'liquidityProviderTranche'].flatMap(tranche => deployed.map(market => market[tranche])), permitFailure: true }); + const stClaims = claims.slice(0, deployed.length), jtClaims = claims.slice(deployed.length, 2 * deployed.length), lptClaims = claims.slice(2 * deployed.length); const resolved = deployed .map((market, i) => ({ @@ -388,24 +398,25 @@ const getStrategyNav = async (api, strategies, dawnMarkets) => { const tranches = markets.flatMap(market => [market.seniorTranche, market.juniorTranche]); if (!tranches.length) return 0n; + // every strategy x tranche in one multiCall + const holdings = strategies.flatMap(strategy => tranches.map(tranche => ({ tranche, strategy }))); + if (!holdings.length) return 0n; + const shares = await api.multiCall({ + abi: 'erc20:balanceOf', + calls: holdings.map(({ tranche, strategy }) => ({ target: tranche, params: [strategy] })), + }); + + // convert only the non-zero positions to their USDC value (nav). + const claimsCalls = holdings + .map(({ tranche }, i) => ({ target: tranche, params: [shares[i]] })) + .filter((_, i) => BigInt(shares[i]) > 0n); + if (!claimsCalls.length) return 0n; + let nav = 0n; - for (const strategy of strategies) { - const shares = await api.multiCall({ - abi: 'erc20:balanceOf', - calls: tranches.map(tranche => ({ target: tranche, params: [strategy] })), - }); - - // convert only the non-zero positions to their USDC value (nav). - const claimsCalls = tranches - .map((tranche, i) => ({ target: tranche, params: [shares[i]] })) - .filter((_, i) => BigInt(shares[i]) > 0n); - if (!claimsCalls.length) continue; - - const claims = await api.multiCall({ abi: convertToAssetsAbi, calls: claimsCalls }); - claims.forEach(claim => { - nav += BigInt(claim.nav); - }); - } + const claims = await api.multiCall({ abi: convertToAssetsAbi, calls: claimsCalls }); + claims.forEach(claim => { + nav += BigInt(claim.nav); + }); return nav; }; @@ -436,35 +447,34 @@ const subtractDayStrategyPositions = async (api, markets, strategies, roycoToken const tranches = [...collateralTranches, ...markets.map(market => market.liquidityProviderTranche)]; const strategyBpt = markets.map(() => 0n); - for (const strategy of strategies) { - const shares = await api.multiCall({ - abi: 'erc20:balanceOf', - calls: tranches.map(tranche => ({ target: tranche, params: [strategy] })), - }); - - const positions = tranches - .map((tranche, i) => ({ tranche, i, shares: BigInt(shares[i]) })) - .filter(position => position.shares > 0n); - if (!positions.length) continue; - - const claims = await api.multiCall({ - abi: dayConvertToAssetsAbi, - calls: positions.map(position => ({ target: position.tranche, params: [position.shares] })), - }); - - claims.forEach((claim, k) => { - const { i } = positions[k]; - const market = i % markets.length; - if (i < collateralTranches.length) { - addMarketAsset(api, roycoTokens, collateralAssets[market], -BigInt(claim.collateralAssets)); - } else { - // Settled below, once every holder's BPT is accumulated. (`claim.stShares` is - // untouched: the LPT's convertToAssets zeroes it, so idle premium shares were never - // attributed to this strategy.) - strategyBpt[market] -= BigInt(claim.lptAssets); - } - }); - } + // every strategy x tranche in one multiCall; `i` stays the index into `tranches` + const holdings = strategies.flatMap(strategy => tranches.map((tranche, i) => ({ tranche, i, strategy }))); + const shares = await api.multiCall({ + abi: 'erc20:balanceOf', + calls: holdings.map(({ tranche, strategy }) => ({ target: tranche, params: [strategy] })), + }); + + const positions = holdings + .map(({ tranche, i }, h) => ({ tranche, i, shares: BigInt(shares[h]) })) + .filter(position => position.shares > 0n); + + const claims = positions.length ? await api.multiCall({ + abi: dayConvertToAssetsAbi, + calls: positions.map(position => ({ target: position.tranche, params: [position.shares] })), + }) : []; + + claims.forEach((claim, k) => { + const { i } = positions[k]; + const market = i % markets.length; + if (i < collateralTranches.length) { + addMarketAsset(api, roycoTokens, collateralAssets[market], -BigInt(claim.collateralAssets)); + } else { + // Settled below, once every holder's BPT is accumulated. (`claim.stShares` is + // untouched: the LPT's convertToAssets zeroes it, so idle premium shares were never + // attributed to this strategy.) + strategyBpt[market] -= BigInt(claim.lptAssets); + } + }); // An LPT position's BPT claims BOTH pool legs, and BOTH were added, in different places: the quote // leg by addDayMarkets, the senior leg by the collateral claims above (a senior share sitting in diff --git a/projects/strato-dex/index.js b/projects/strato-dex/index.js new file mode 100644 index 00000000000..76369df68ee --- /dev/null +++ b/projects/strato-dex/index.js @@ -0,0 +1,16 @@ +const { getV2Pools, getV3Pools, sumPoolBalances } = require('../helper/chain/strato') + +// STRATO swap pools: constant-product + StablePool (PoolFactory) and concentrated-liquidity +// (PoolV3Factory). TVL is every pool token held by the pool contracts, USDST included. +async function tvl(api) { + const pools = [...await getV2Pools(), ...await getV3Pools()] + await sumPoolBalances(api, pools) +} + +module.exports = { + methodology: + 'Swap pools enumerated on-chain from PoolFactory.allPools (constant-product and StablePool; StablePool coins enumerated via getNumCoins/coins so multi-coin pools are fully counted) and PoolV3Factory.allPools (concentrated liquidity). TVL is the balance of each pool token held by the pool contract, read via batched eth_call (STRATO has no Multicall3). Prices resolved server-side by DefiLlama for the `strato` chain; tokens traded only on these pools are priced from pool depth.', + timetravel: false, + start: '2026-04-02', + strato: { tvl }, +} diff --git a/projects/strato/index.js b/projects/strato/index.js index bbe017863ab..ffb1e4c1ca6 100644 --- a/projects/strato/index.js +++ b/projects/strato/index.js @@ -1,6 +1,5 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const RPC_URL = 'https://noderpc.strato.nexus/rpc' -const POOL_FACTORY = '0x000000000000000000000000000000000000100a' +const { batchCall, enumerateArray, getV2Pools, getV3Pools, lc } = require('../helper/chain/strato') + const CDP_REGISTRY = '0x0000000000000000000000000000000000001012' const LENDING_REGISTRY = '0x0000000000000000000000000000000000001007' const LENDING_POOL = '0x0000000000000000000000000000000000001005' @@ -12,7 +11,6 @@ const STRATO_STAKING = '0xf30a022ce83bed7adeafc286c719388dcc3b3988' // Ethereum ERC-20 (`ethereum-strato`), same 18 decimals, so staked balance is // reported against that address. const STRATO_ON_ETHEREUM = 'ethereum:0x4c93b9fbf7fd1777ccbcbc538b1d0a8b58fb1ad6' -const POOL_V3_FACTORY = '0x5d630126d908b46bcf8d00bc15e591a459375809' // DirectMintPSM: mints USDST 1:1 against stablecoin reserves it holds. const DIRECT_MINT_PSM = '0xb1efdc86eecfbedf83d0295671214fee451786f3' // ERC-4626 YieldVaults. There is no on-chain factory/registry to enumerate @@ -25,82 +23,28 @@ const YIELD_VAULTS = [ '0xf8884c44d7cfbfb7c6326c515f375f8572f03e2b', // yieldSILVST ] -if (!process.env.STRATO_RPC) process.env.STRATO_RPC = RPC_URL - const RAY = 10n ** 27n -async function enumerateArray(api, target, abi, max = 500) { - const seen = new Set() - const out = [] - for (let i = 0; i < max; i++) { - let r - try { r = await api.call({ target, abi, params: i }) } catch { break } - if (!r || r === ADDRESSES.null) break - const lc = r.toLowerCase() - if (!seen.has(lc)) { seen.add(lc); out.push(lc) } - } - if (out.length === max) console.warn(`[strato] enumerateArray hit cap ${max} on ${target} — likely truncated`) - return out -} - -async function discoverPools(api) { - const poolAddrs = await enumerateArray( - api, POOL_FACTORY, 'function allPools(uint256) view returns (address)' - ) - const pools = [] - for (const pool of poolAddrs) { - let tokens - // StablePool can hold more than two coins (e.g. USDT-USDC-USDST). tokenA/tokenB - // only expose the first two, so enumerate the full `coins` array instead. - let isStable = false - try { isStable = await api.call({ target: pool, abi: 'function isStable() view returns (bool)' }) } catch { /* legacy pool */ } - if (isStable) { - const n = Number(await api.call({ target: pool, abi: 'function getNumCoins() view returns (uint256)' })) - tokens = [] - for (let i = 0; i < n; i++) { - tokens.push((await api.call({ target: pool, abi: 'function coins(uint256) view returns (address)', params: i })).toLowerCase()) - } - } else { - const tokenA = (await api.call({ target: pool, abi: 'function tokenA() view returns (address)' })).toLowerCase() - const tokenB = (await api.call({ target: pool, abi: 'function tokenB() view returns (address)' })).toLowerCase() - tokens = [tokenA, tokenB] - } - pools.push({ pool, tokens: [...new Set(tokens)] }) - } - return pools -} - -// Concentrated-liquidity (Uniswap-v3 style) pools. Token balances held by the -// pool contract are the TVL; positions are accounted inside the pool. -async function discoverV3Pools(api) { - const poolAddrs = await enumerateArray( - api, POOL_V3_FACTORY, 'function allPools(uint256) view returns (address)' - ) - const pools = [] - for (const pool of poolAddrs) { - const token0 = (await api.call({ target: pool, abi: 'function token0() view returns (address)' })).toLowerCase() - const token1 = (await api.call({ target: pool, abi: 'function token1() view returns (address)' })).toLowerCase() - pools.push({ pool, tokens: [token0, token1] }) - } - return pools -} - async function tvl(api) { - const pools = [...await discoverPools(api), ...await discoverV3Pools(api)] - - const cdpVault = (await api.call({ target: CDP_REGISTRY, abi: 'function cdpVault() view returns (address)' })).toLowerCase() - const collateralVault = (await api.call({ target: LENDING_REGISTRY, abi: 'function collateralVault() view returns (address)' })).toLowerCase() - const liquidityPool = (await api.call({ target: LENDING_REGISTRY, abi: 'function liquidityPool() view returns (address)' })).toLowerCase() - const borrowableAsset = (await api.call({ target: LENDING_POOL, abi: 'function borrowableAsset() view returns (address)' })).toLowerCase() - const lendingCollateralTokens = await enumerateArray( - api, LENDING_POOL, 'function configuredAssets(uint256) view returns (address)' - ) - - const vaultBotExecutor = (await api.call({ target: VAULT, abi: 'function botExecutor() view returns (address)' })).toLowerCase() - const vaultAssets = await enumerateArray(api, VAULT, 'function supportedAssets(uint256) view returns (address)') - - const saveAsset = (await api.call({ target: SAVE_USDST_VAULT, abi: 'function asset() view returns (address)' })).toLowerCase() - const safetyAsset = (await api.call({ target: SAFETY_MODULE, abi: 'function asset() view returns (address)' })).toLowerCase() + // Swap pool liquidity is listed separately (strato-dex). The pools are still enumerated here only + // as the token universe to probe the CDP vault and PSM with: neither holder enumerates its assets. + const pools = [...await getV2Pools(), ...await getV3Pools()] + + const [cdpVault, collateralVault, liquidityPool, borrowableAsset, vaultBotExecutor, saveAsset, safetyAsset, usdst, saveTotalAssets, safetyTotalAssets, ...yieldVaultAssets] = await batchCall([ + { target: CDP_REGISTRY, abi: 'function cdpVault() view returns (address)' }, + { target: LENDING_REGISTRY, abi: 'function collateralVault() view returns (address)' }, + { target: LENDING_REGISTRY, abi: 'function liquidityPool() view returns (address)' }, + { target: LENDING_POOL, abi: 'function borrowableAsset() view returns (address)' }, + { target: VAULT, abi: 'function botExecutor() view returns (address)' }, + { target: SAVE_USDST_VAULT, abi: 'function asset() view returns (address)' }, + { target: SAFETY_MODULE, abi: 'function asset() view returns (address)' }, + { target: CDP_REGISTRY, abi: 'function usdst() view returns (address)' }, + { target: SAVE_USDST_VAULT, abi: 'function totalAssets() view returns (uint256)' }, + { target: SAFETY_MODULE, abi: 'function totalAssets() view returns (uint256)' }, + ...YIELD_VAULTS.map((target) => ({ target, abi: 'function asset() view returns (address)' })), + ]).then((res) => res.map((r) => typeof r === 'string' ? lc(r) : r)) + const lendingCollateralTokens = await enumerateArray(LENDING_POOL, 'function configuredAssets(uint256) view returns (address)') + const vaultAssets = await enumerateArray(VAULT, 'function supportedAssets(uint256) view returns (address)') const tokenSet = new Set() pools.forEach(p => p.tokens.forEach(t => tokenSet.add(t))) @@ -112,9 +56,6 @@ async function tvl(api) { const allTokens = [...tokenSet] const pairs = [] - for (const { pool, tokens } of pools) { - for (const token of tokens) pairs.push({ holder: pool, token }) - } for (const token of allTokens) pairs.push({ holder: cdpVault, token }) for (const token of lendingCollateralTokens) pairs.push({ holder: collateralVault, token }) pairs.push({ holder: liquidityPool, token: borrowableAsset }) @@ -127,57 +68,52 @@ async function tvl(api) { // YieldVaults: count only assets idle in the vault contract. `deployedAssets` // is capital handed to strategy wallets that redeploy it into CDPs / pools on // STRATO, where it is already counted above. Counting it here would double count. - for (const vault of YIELD_VAULTS) { - const asset = (await api.call({ target: vault, abi: 'function asset() view returns (address)' })).toLowerCase() - pairs.push({ holder: vault, token: asset }) - } - - for (const { token, holder } of pairs) { - const balance = await api.call({ target: token, abi: 'erc20:balanceOf', params: holder }) - if (BigInt(balance) > 0n) api.add(token, balance.toString()) - } + YIELD_VAULTS.forEach((vault, i) => pairs.push({ holder: vault, token: yieldVaultAssets[i] })) - const saveTotalAssets = await api.call({ target: SAVE_USDST_VAULT, abi: 'function totalAssets() view returns (uint256)' }) - const safetyTotalAssets = await api.call({ target: SAFETY_MODULE, abi: 'function totalAssets() view returns (uint256)' }) + const balances = await batchCall(pairs.map(({ token, holder }) => ({ target: token, abi: 'function balanceOf(address) view returns (uint256)', params: [holder] }))) + pairs.forEach(({ token }, i) => { if (balances[i] > 0n) api.add(token, balances[i].toString()) }) - if (BigInt(saveTotalAssets) > 0n) api.add(saveAsset, saveTotalAssets.toString()) - if (BigInt(safetyTotalAssets) > 0n) api.add(safetyAsset, safetyTotalAssets.toString()) + if (saveTotalAssets > 0n) api.add(saveAsset, saveTotalAssets.toString()) + if (safetyTotalAssets > 0n) api.add(safetyAsset, safetyTotalAssets.toString()) // USDST is issued against CDP collateral / PSM reserves already counted above. - const usdst = await api.call({ target: CDP_REGISTRY, abi: 'function usdst() view returns (address)' }) api.removeTokenBalance(usdst) } async function borrowed(api) { - const borrowableAsset = await api.call({ target: LENDING_POOL, abi: 'function borrowableAsset() view returns (address)' }) - const borrowIndex = await api.call({ target: LENDING_POOL, abi: 'function borrowIndex() view returns (uint256)' }) - const totalScaledDebt = await api.call({ target: LENDING_POOL, abi: 'function totalScaledDebt() view returns (uint256)' }) - - const lendingDebt = (BigInt(totalScaledDebt) * BigInt(borrowIndex)) / RAY + const [borrowableAsset, borrowIndex, totalScaledDebt, cdpEngine, usdst] = await batchCall([ + { target: LENDING_POOL, abi: 'function borrowableAsset() view returns (address)' }, + { target: LENDING_POOL, abi: 'function borrowIndex() view returns (uint256)' }, + { target: LENDING_POOL, abi: 'function totalScaledDebt() view returns (uint256)' }, + { target: CDP_REGISTRY, abi: 'function cdpEngine() view returns (address)' }, + { target: CDP_REGISTRY, abi: 'function usdst() view returns (address)' }, + ]) + + const lendingDebt = (totalScaledDebt * borrowIndex) / RAY if (lendingDebt > 0n) api.add(borrowableAsset, lendingDebt.toString()) // CDP debt. `totalDebtAll` sums outstanding USDST across every enumerated // collateral asset, using the stored rateAccumulator so the call has no accrual // side effects. Returns WAD (18 decimals), matching USDST. - const cdpEngine = await api.call({ target: CDP_REGISTRY, abi: 'function cdpEngine() view returns (address)' }) - const usdst = await api.call({ target: CDP_REGISTRY, abi: 'function usdst() view returns (address)' }) - const cdpDebt = await api.call({ target: cdpEngine, abi: 'function totalDebtAll() view returns (uint256)' }) - if (BigInt(cdpDebt) > 0n) api.add(usdst, cdpDebt.toString()) + const [cdpDebt] = await batchCall([{ target: cdpEngine, abi: 'function totalDebtAll() view returns (uint256)' }]) + if (cdpDebt > 0n) api.add(usdst, cdpDebt.toString()) } // Phase 1 $STRATO staking. There is no receipt token; stake is tracked as // internal accounting on StratoStaking. Principal = delegated user stake + // operator self-bond. Unbonding stake and the reward reserve are excluded. async function staking(api) { - const totalUserStake = await api.call({ target: STRATO_STAKING, abi: 'function totalUserStake() view returns (uint256)' }) - const totalSelfBond = await api.call({ target: STRATO_STAKING, abi: 'function totalSelfBond() view returns (uint256)' }) - const staked = BigInt(totalUserStake) + BigInt(totalSelfBond) + const [totalUserStake, totalSelfBond] = await batchCall([ + { target: STRATO_STAKING, abi: 'function totalUserStake() view returns (uint256)' }, + { target: STRATO_STAKING, abi: 'function totalSelfBond() view returns (uint256)' }, + ]) + const staked = totalUserStake + totalSelfBond if (staked > 0n) api.add(STRATO_ON_ETHEREUM, staked.toString(), { skipChain: true }) } module.exports = { methodology: - 'All values verified on-chain via sequential eth_call (no Multicall3). Swap pools enumerated from PoolFactory.allPools and PoolV3Factory.allPools (concentrated liquidity); StablePool coins enumerated via getNumCoins/coins so multi-coin pools are fully counted. CDP collateral read from CDPVault, lending deposits (idle liquidity + collateral) from LiquidityPool + CollateralVault, savings from SaveUSDSTVault, staked assets from SafetyModule, vault holdings from the Vault botExecutor, stablecoin reserves held by the DirectMintPSM, and idle assets held by each ERC-4626 YieldVault (capital deployed to strategies is excluded because it is redeployed into CDPs/pools already counted). USDST is excluded from base TVL across all holders because its backing CDP collateral and PSM reserves are already counted. Holder addresses resolved from on-chain registries (CDPRegistry, LendingRegistry). Outstanding debt is reported separately under `borrowed` and excluded from TVL: LiquidityPool debt (totalScaledDebt × borrowIndex / RAY against the LiquidityPool borrowableAsset) plus CDP debt (CDPEngine.totalDebtAll, outstanding USDST summed across every enumerated collateral asset). Staked $STRATO (StratoStaking totalUserStake + totalSelfBond) is reported under `staking`, priced against the Ethereum STRATO ERC-20 because $STRATO has no price feed on the STRATO chain itself. Prices resolved server-side by DefiLlama for the `strato` chain.', + 'All values verified on-chain via batched eth_call (no Multicall3). CDP collateral read from CDPVault, lending deposits (idle liquidity + collateral) from LiquidityPool + CollateralVault, savings from SaveUSDSTVault, staked assets from SafetyModule, vault holdings from the Vault botExecutor, stablecoin reserves held by the DirectMintPSM, and idle assets held by each ERC-4626 YieldVault (capital deployed to strategies is excluded because it is redeployed into CDPs/pools already counted). Swap pool liquidity (PoolFactory / PoolV3Factory) is listed separately as STRATO DEX. USDST is excluded from base TVL across all holders because its backing CDP collateral and PSM reserves are already counted. Holder addresses resolved from on-chain registries (CDPRegistry, LendingRegistry). Outstanding debt is reported separately under `borrowed` and excluded from TVL: LiquidityPool debt (totalScaledDebt × borrowIndex / RAY against the LiquidityPool borrowableAsset) plus CDP debt (CDPEngine.totalDebtAll, outstanding USDST summed across every enumerated collateral asset). Staked $STRATO (StratoStaking totalUserStake + totalSelfBond) is reported under `staking`, priced against the Ethereum STRATO ERC-20 because $STRATO has no price feed on the STRATO chain itself. Prices resolved server-side by DefiLlama for the `strato` chain.', misrepresentedTokens: true, timetravel: false, start: '2026-04-02', diff --git a/projects/tangible/index.js b/projects/tangible/index.js index e819d11302a..e1127afdba5 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -34,12 +34,6 @@ const PEARL_PAIR_FACTORY = '0xEaF188cdd22fEEBCb345DCb529Aa18CA9FcB4FBd'; const PEARL_VOTER = '0xa26C2A6BfeC5512c13Ae9EacF41Cb4319d30cCF0'; async function getInsuranceFundValue(api, INSURANCE_FUND) { - await Promise.all([ - addVePearlBal(api, INSURANCE_FUND), - addVeTetuBal(api, INSURANCE_FUND), - caviarTvl(api, INSURANCE_FUND), - pearlFactoryTvl(api, INSURANCE_FUND), - ]) return sumTokens2({ api, owner: INSURANCE_FUND, tokens: Object.values(insuranceTokens), resolveUniV3: true, resolveLP: true, blacklistedTokens: [ insuranceTokens.USDR, insuranceTokens.WUSDR, @@ -47,42 +41,44 @@ async function getInsuranceFundValue(api, INSURANCE_FUND) { ] }) } -async function caviarTvl(api, owner) { +// the helpers below take all insurance fund owners at once, so each read is one multiCall instead of one call per owner +async function caviarTvl(api, owners) { + // the staking chef's pending reward is wUSDR and not counted, so it is not read const [ - stakingAmount, pendingStakingReward, stakingRewardToken, pendingRebaseReward, rebaseRewardToken + stakingAmounts, pendingRebaseRewards, rebaseRewardToken ] = await Promise.all([ - api.call({ target: CAVIAR_STAKING_CHEF, abi: CAVIAR_CHEF_ABI.userInfo, params: [owner] }), - api.call({ target: CAVIAR_STAKING_CHEF, abi: CAVIAR_CHEF_ABI.pendingReward, params: [owner] }), - api.call({ target: CAVIAR_STAKING_CHEF, abi: CAVIAR_CHEF_ABI.rewardToken, }), - api.call({ target: CAVIAR_REBASE_CHEF, abi: CAVIAR_CHEF_ABI.pendingReward, params: [owner] }), + api.multiCall({ target: CAVIAR_STAKING_CHEF, abi: CAVIAR_CHEF_ABI.userInfo, calls: owners }), + api.multiCall({ target: CAVIAR_REBASE_CHEF, abi: CAVIAR_CHEF_ABI.pendingReward, calls: owners }), api.call({ target: CAVIAR_REBASE_CHEF, abi: CAVIAR_CHEF_ABI.rewardToken, }), ]) - // api.add(stakingRewardToken, pendingStakingReward); // it is wUSDR - api.add(rebaseRewardToken, pendingRebaseReward); - api.add(insuranceTokens.CAVIAR, stakingAmount.amount); + owners.forEach((_, i) => { + api.add(rebaseRewardToken, pendingRebaseRewards[i]); + api.add(insuranceTokens.CAVIAR, stakingAmounts[i].amount); + }) } -async function pearlFactoryTvl(api, owner) { +async function pearlFactoryTvl(api, owners) { const pairs = await api.fetchList({ lengthAbi: 'uint256:allPairsLength', itemAbi: "function allPairs(uint256) view returns (address)", target: PEARL_PAIR_FACTORY }) const gauges = await api.multiCall({ abi: "function gauges(address) view returns (address)", calls: pairs, target: PEARL_VOTER }) - const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: gauges.map(g => ({ target: g, params: owner })) }) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: owners.flatMap(owner => gauges.map(g => ({ target: g, params: owner }))) }) bals.forEach((bal, i) => { - if (pairs[i].toLowerCase() !== '0x0edc235693c20943780b76d79dd763236e94c751') - api.add(pairs[i], bal) + const pair = pairs[i % pairs.length] + if (pair.toLowerCase() !== '0x0edc235693c20943780b76d79dd763236e94c751') + api.add(pair, bal) }) } -async function addVePearlBal(api, INSURANCE_FUND) { - const count = await api.call({ abi: 'erc20:balanceOf', target: UTILITY_TOKENS.VE_PEARL, params: INSURANCE_FUND }) - const tokenIds = await api.multiCall({ abi: VE_VELO_ABI.tokenOfOwnerByIndex, calls: createIncrementArray(count).map(i => ({ params: [INSURANCE_FUND, i] })), target: UTILITY_TOKENS.VE_PEARL }) +async function addVePearlBal(api, owners) { + const counts = await api.multiCall({ abi: 'erc20:balanceOf', target: UTILITY_TOKENS.VE_PEARL, calls: owners }) + const tokenIds = await api.multiCall({ abi: VE_VELO_ABI.tokenOfOwnerByIndex, calls: owners.flatMap((owner, j) => createIncrementArray(counts[j]).map(i => ({ params: [owner, i] }))), target: UTILITY_TOKENS.VE_PEARL }) const bals = await api.multiCall({ abi: VE_VELO_ABI.lockedPearl, calls: tokenIds, target: UTILITY_TOKENS.VE_PEARL }) bals.forEach(i => api.add(insuranceTokens.PEARL, i.amount)) } -async function addVeTetuBal(api, INSURANCE_FUND) { - const count = await api.call({ abi: 'erc20:balanceOf', target: UTILITY_TOKENS.VE_TETU, params: INSURANCE_FUND }) - const tokenIds = await api.multiCall({ abi: VE_VELO_ABI.tokenOfOwnerByIndex, calls: createIncrementArray(count).map(i => ({ params: [INSURANCE_FUND, i] })), target: UTILITY_TOKENS.VE_TETU }) +async function addVeTetuBal(api, owners) { + const counts = await api.multiCall({ abi: 'erc20:balanceOf', target: UTILITY_TOKENS.VE_TETU, calls: owners }) + const tokenIds = await api.multiCall({ abi: VE_VELO_ABI.tokenOfOwnerByIndex, calls: owners.flatMap((owner, j) => createIncrementArray(counts[j]).map(i => ({ params: [owner, i] }))), target: UTILITY_TOKENS.VE_TETU }) const bals = await api.multiCall({ abi: VE_VELO_ABI.lockedAmounts, calls: tokenIds.map(i => ({ params: [i, insuranceTokens.TETU_BPT] })), target: UTILITY_TOKENS.VE_TETU }) bals.forEach(i => api.add(insuranceTokens.TETU_BPT, i)) } @@ -203,10 +199,16 @@ async function treasuryTvl(api) { } async function insuranceTvl(api) { - await Promise.all(insuranceConfig.polygon.owners.map(i => (async () => { - await unwrapBalancerToken(api, i); - await getInsuranceFundValue(api, i); - })())) + const owners = insuranceConfig.polygon.owners + await Promise.all([ + unwrapBalancerToken(api, owners), + addVePearlBal(api, owners), + addVeTetuBal(api, owners), + caviarTvl(api, owners), + pearlFactoryTvl(api, owners), + ]) + // one owner at a time: each call also unwraps the LPs already in the balances + for (const owner of owners) await getInsuranceFundValue(api, owner) } async function insuranceTvlOp(api) { @@ -238,47 +240,43 @@ async function rwaTVL(api) { params: ["0xadbe96ac53cb4ca392e9ee5a7e23c7d7c8450cb015ceaad4d4677fae1c0bb1a4"], //keccak of underlying }) - //now we fetch value of all tnfts ever minted - await Promise.all(tnftContractsAddresses.map(async (tnft) => { + //now we fetch value of all tnfts ever minted, every tnft contract in the same multiCalls - //fetch all token ids - let ids = []; - const tokenIds = await api.fetchList({ target: tnft, itemAbi: getTokenByIndex, lengthAbi: getTotalSupply, }) - if (!tokenIds.length) return; - const inTangibleCustody = await api.multiCall({ target: tnft, abi: getTnftCustody, calls: tokenIds, }) - inTangibleCustody.forEach((v, i) => { - if (v) ids.push(tokenIds[i]) - }) + //fetch all token ids + const tokenIds = await api.fetchList({ targets: tnftContractsAddresses, itemAbi: getTokenByIndex, lengthAbi: getTotalSupply, groupedByInput: true, }) + const custodyCalls = tnftContractsAddresses.flatMap((tnft, t) => tokenIds[t].map(id => ({ target: tnft, params: [id], t }))) + const inTangibleCustody = await api.multiCall({ abi: getTnftCustody, calls: custodyCalls.map(({ target, params }) => ({ target, params })), }) + const ids = tnftContractsAddresses.map(() => []) + inTangibleCustody.forEach((v, i) => { + if (v) ids[custodyCalls[i].t].push(custodyCalls[i].params[0]) + }) - // now fetch all prices - const prices = await api.call({ - abi: getItemPriceBatchTokenIds, - target: priceManagerAddress, - params: [tnft, underlyingAddress, ids], - }) + // now fetch all prices (tnfts without any token are skipped) + const allPrices = await api.multiCall({ + abi: getItemPriceBatchTokenIds, + target: priceManagerAddress, + calls: tnftContractsAddresses.map((tnft, t) => ({ params: [tnft, underlyingAddress, ids[t]], t })).filter(({ t }) => tokenIds[t].length).map(({ params }) => ({ params })), + }) + allPrices.forEach(prices => { for (let i = 0; i < prices.weSellAt.length; i++) { api.add(underlyingAddress, prices.weSellAt[i]) // how can get the rwa value instead of the price you are willing to sell at? api.add(underlyingAddress, prices.lockedAmount[i]) // what is this amount? } - })) + }) } async function tangiblePOL(api) { - //pearl pair api address - const pearlPairApi = await api.call({ - abi: apGetAddress, - target: ADDRESS_PROVIDER_ADDRESS, - params: ["0xd1e0c1a56a62f2e6553b45bde148c89c51a01f766c23f4bb2c612bd2c822f711"],//keccak of paerl api address - }) - - // liquidity manager - const liquidityManager = await api.call({ + //pearl pair api address and liquidity manager + const [pearlPairApi, liquidityManager] = await api.multiCall({ abi: apGetAddress, target: ADDRESS_PROVIDER_ADDRESS, - params: ["0x6878742ff510854cb02c186504af5267007c4a6d33f490fc28ec83e83e1458e1"],//keccak of liquidity manager + calls: [ + "0xd1e0c1a56a62f2e6553b45bde148c89c51a01f766c23f4bb2c612bd2c822f711",//keccak of paerl api address + "0x6878742ff510854cb02c186504af5267007c4a6d33f490fc28ec83e83e1458e1",//keccak of liquidity manager + ], }) const { data } = await getConfig('tangible', "https://api.pearl.exchange/api/v15/pools"); @@ -323,20 +321,20 @@ module.exports = { real: { tvl: realTvl }, } -async function unwrapBalancerToken(api, owner) { +async function unwrapBalancerToken(api, owners) { const gauge = '0x07222e30b751c1ab4a730745afe19810cfd762c0' const balancerToken = '0x9f9f548354b7c66dc9a9f3373077d86aaaccf8f2' - const [lpSupply, lpTokens] = await api.batchCall([ - { abi: 'erc20:totalSupply', target: balancerToken }, - { abi: 'erc20:balanceOf', target: gauge, params: owner }, - ]) - const ratio = lpTokens / lpSupply + const lpSupply = await api.call({ abi: 'erc20:totalSupply', target: balancerToken }) + const lpTokens = await api.multiCall({ abi: 'erc20:balanceOf', target: gauge, calls: owners }) const poolId = await api.call({ abi: 'function getPoolId() view returns (bytes32)', target: balancerToken }) const vault = await api.call({ abi: 'address:getVault', target: balancerToken }) const [tokens, bals] = await api.call({ abi: 'function getPoolTokens(bytes32) view returns (address[], uint256[],uint256)', target: vault, params: poolId }) - tokens.forEach((v, i) => { - if (v.toLowerCase() === TNGBL) return; - api.add(v, bals[i] * ratio) + lpTokens.forEach(lpBal => { + const ratio = lpBal / lpSupply + tokens.forEach((v, i) => { + if (v.toLowerCase() === TNGBL) return; + api.add(v, bals[i] * ratio) + }) }) } \ No newline at end of file diff --git a/projects/tarot/index.js b/projects/tarot/index.js index c802d74fbcb..0afcf35c6c3 100644 --- a/projects/tarot/index.js +++ b/projects/tarot/index.js @@ -82,3 +82,5 @@ const config = { } tarotHelper(module.exports, config) + +module.exports.bsc.borrowed = () => ({}) // is insolvent \ No newline at end of file diff --git a/projects/tarot/tarotHelper.js b/projects/tarot/tarotHelper.js index e899c1001f1..90aac5fe559 100644 --- a/projects/tarot/tarotHelper.js +++ b/projects/tarot/tarotHelper.js @@ -4,22 +4,27 @@ const sdk = require('@defillama/sdk') const { nullAddress } = require('../helper/tokenMapping') function tarotHelper(exportsObj, config, { tarotSymbol = 'vTAROT' } = {}) { - async function tvl(api) { - const { factories } = config[api.chain] - const pools = [] - await Promise.all(factories.map(async (factory) => { - const lendingPools = await api.fetchList({ lengthAbi: abi.allLendingPoolsLength, itemAbi: abi.allLendingPools, target: factory }) + // tvl and borrowed read the same pool list, fetch it once per chain/block and batch all factories together + const poolDataCache = {} + function getPoolData(api) { + const key = `${api.chain}-${api.block}` + if (!poolDataCache[key]) poolDataCache[key] = fetchPoolData(api) + return poolDataCache[key] + } - const poolData = await api.multiCall({ - target: factory, - abi: abi.getLendingPool, - calls: lendingPools, - }) + async function fetchPoolData(api) { + const { factories } = config[api.chain] + const lendingPools = await api.fetchList({ lengthAbi: abi.allLendingPoolsLength, itemAbi: abi.allLendingPools, targets: factories, groupedByInput: true }) + const calls = lendingPools.map((pools, i) => pools.map(pool => ({ target: factories[i], params: pool }))).flat() + return api.multiCall({ abi: abi.getLendingPool, calls, }) + } - poolData.forEach(i => { - pools.push(i.collateral, i.borrowable0, i.borrowable1) - }) - })) + async function tvl(api) { + const pools = [] + const poolData = await getPoolData(api) + poolData.forEach(i => { + pools.push(i.collateral, i.borrowable0, i.borrowable1) + }) const underlyings = await api.multiCall({ abi: abi.underlying, @@ -42,22 +47,12 @@ function tarotHelper(exportsObj, config, { tarotSymbol = 'vTAROT' } = {}) { } async function borrowed(api) { - const { factories } = config[api.chain] const balances = {} const borrowables = [] - await Promise.all(factories.map(async (factory) => { - const lendingPools = await api.fetchList({ lengthAbi: abi.allLendingPoolsLength, itemAbi: abi.allLendingPools, target: factory }) - - const poolData = await api.multiCall({ - target: factory, - abi: abi.getLendingPool, - calls: lendingPools, - }) - - poolData.forEach(i => { - borrowables.push(i.borrowable0, i.borrowable1) - }) - })) + const poolData = await getPoolData(api) + poolData.forEach(i => { + borrowables.push(i.borrowable0, i.borrowable1) + }) const underlyings = await api.multiCall({ abi: abi.underlying, diff --git a/projects/teller/index.js b/projects/teller/index.js index b5c06531d34..b698b654e9a 100644 --- a/projects/teller/index.js +++ b/projects/teller/index.js @@ -113,6 +113,14 @@ async function getPoolBidData(chain) { return { activeBids, allPoolBidIds }; } +// tvl and borrowed need the same TellerV2 info and the same full bid scan, run them once per chain/block +const sharedResults = {}; +function runOnce(name, api, fn) { + const key = `${name}-${api.chain}-${api.block}`; + if (!sharedResults[key]) sharedResults[key] = fn(); + return sharedResults[key]; +} + async function getTellerV2Info(api, pools) { if (pools.length === 0) return null; let tellerV2; @@ -265,14 +273,14 @@ async function tvl(api) { } // Get TellerV2 info - const tellerInfo = await getTellerV2Info(api, pools); + const tellerInfo = await runOnce('tellerInfo', api, () => getTellerV2Info(api, pools)); if (tellerInfo) { // Pool escrow collateral const poolEscrowTokens = await getPoolEscrowTokens(api, pools, activeBids, tellerInfo.collateralManager); tokensAndOwners.push(...poolEscrowTokens); // Direct (non-pool) bid ERC20 collateral (active + defaulted, skipping NFTs) - const directBids = await getDirectBids(api, tellerInfo, allPoolBidIds); + const directBids = await runOnce('directBids', api, () => getDirectBids(api, tellerInfo, allPoolBidIds)); for (const bid of directBids) { for (const c of bid.collaterals) { if (c._collateralAddress && c._collateralAddress !== ZERO_ADDR && String(c._collateralType) === COLLATERAL_ERC20) { @@ -293,7 +301,7 @@ async function borrowed(api) { const { activeBids, allPoolBidIds } = poolBidData; const addresses = pools.map(p => p.group_pool_address); - const tellerInfo = await getTellerV2Info(api, pools); + const tellerInfo = await runOnce('tellerInfo', api, () => getTellerV2Info(api, pools)); // Pool borrowed const [lended, repaid, tokens] = await Promise.all([ @@ -358,7 +366,7 @@ async function borrowed(api) { // Direct (non-pool) bid borrowed — only non-defaulted loans if (tellerInfo) { - const directBids = await getDirectBids(api, tellerInfo, allPoolBidIds); + const directBids = await runOnce('directBids', api, () => getDirectBids(api, tellerInfo, allPoolBidIds)); const activeDirectBids = directBids.filter(b => !b.defaulted); const bidIds = activeDirectBids.map(b => b.bidId); diff --git a/projects/tetu/index.js b/projects/tetu/index.js index 8d797680f8d..c2415dd1205 100644 --- a/projects/tetu/index.js +++ b/projects/tetu/index.js @@ -93,32 +93,23 @@ Object.keys(config).forEach(chain => { // * ############### veTETU let veTETU_USDC = 0; if (veTETU) { - for (let i = 0; i < 100; i++) { - let token = ''; - try { - token = (await api.call({ abi: abi.veTokens, target: veTETU, params: i, })); - } catch (e) { - // assume that tokens ended - // we don't have length for tokens so this workaround - break; - } - - const amount = (await api.call({ abi: abi.balanceOf, target: token, params: veTETU, })); - const price = (await api.call({ abi: abi.getPrice, target: contract_Reader, params: token, })); + // we don't have length for tokens so probe the first 100 indexes, tokens end at the first failure + const probed = await api.multiCall({ abi: abi.veTokens, target: veTETU, calls: [...Array(100).keys()], permitFailure: true, }) + const firstMissing = probed.findIndex(i => !i) + const veTokens = firstMissing === -1 ? probed : probed.slice(0, firstMissing) + const amounts = await api.multiCall({ abi: abi.balanceOf, calls: veTokens.map(token => ({ target: token, params: veTETU })), }) + const prices = await api.multiCall({ abi: abi.getPrice, target: contract_Reader, calls: veTokens, }) - // assume all tokens inside with decimal 18 - // if not need addtionial call with decimals - veTETU_USDC += amount * price / 1e36; - } + // assume all tokens inside with decimal 18 + // if not need addtionial call with decimals + veTokens.forEach((_, i) => veTETU_USDC += amounts[i] * prices[i] / 1e36) } // * ############### TOTALS let total = veTETU_USDC - for (const vault of vaultsCall) { - const usdcs = await api.call({ target: contract_Reader, abi: abi.totalTvlUsdc, params: [[vault]], }) - total += usdcs / 1e18 - } + const vaultUsdcs = await api.multiCall({ target: contract_Reader, abi: abi.totalTvlUsdc, calls: vaultsCall.map(vault => ({ params: [[vault]] })), }) + vaultUsdcs.forEach(usdcs => total += usdcs / 1e18) usdcsV2.forEach(i => total += i / 1e18) return { From 7578a849d842139080a529aa38acb0857f4c5f9c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 11 Nov 2026 19:01:18 +0100 Subject: [PATCH 697/988] minor fix --- projects/strato/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/strato/index.js b/projects/strato/index.js index ffb1e4c1ca6..0112c23522e 100644 --- a/projects/strato/index.js +++ b/projects/strato/index.js @@ -114,7 +114,6 @@ async function staking(api) { module.exports = { methodology: 'All values verified on-chain via batched eth_call (no Multicall3). CDP collateral read from CDPVault, lending deposits (idle liquidity + collateral) from LiquidityPool + CollateralVault, savings from SaveUSDSTVault, staked assets from SafetyModule, vault holdings from the Vault botExecutor, stablecoin reserves held by the DirectMintPSM, and idle assets held by each ERC-4626 YieldVault (capital deployed to strategies is excluded because it is redeployed into CDPs/pools already counted). Swap pool liquidity (PoolFactory / PoolV3Factory) is listed separately as STRATO DEX. USDST is excluded from base TVL across all holders because its backing CDP collateral and PSM reserves are already counted. Holder addresses resolved from on-chain registries (CDPRegistry, LendingRegistry). Outstanding debt is reported separately under `borrowed` and excluded from TVL: LiquidityPool debt (totalScaledDebt × borrowIndex / RAY against the LiquidityPool borrowableAsset) plus CDP debt (CDPEngine.totalDebtAll, outstanding USDST summed across every enumerated collateral asset). Staked $STRATO (StratoStaking totalUserStake + totalSelfBond) is reported under `staking`, priced against the Ethereum STRATO ERC-20 because $STRATO has no price feed on the STRATO chain itself. Prices resolved server-side by DefiLlama for the `strato` chain.', - misrepresentedTokens: true, timetravel: false, start: '2026-04-02', strato: { tvl, borrowed, staking }, From b683ba35d0c48893d969efe08f22f11a4aebb266 Mon Sep 17 00:00:00 2001 From: Amaury <129635385+9992D@users.noreply.github.com> Date: Wed, 11 Nov 2026 14:16:41 -0400 Subject: [PATCH 698/988] =?UTF-8?q?add=20=CF=83-Labs=20curator=20(Lagoon?= =?UTF-8?q?=20vaults)=20(#22151)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- registries/curators.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/registries/curators.js b/registries/curators.js index 8c0caa0fcdd..41f09a837a9 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -1175,6 +1175,20 @@ const configs = { } }, }, + "sigma-labs": { + config: { + methodology: 'Counts the settled NAV (totalAssets) of the Lagoon vaults curated by σ-Labs on Ethereum: Cross-chain USDC Lending (sigmaUSDC), stETH Redemption Carry (rcETH) and Stablecoin Market Making (sigmaLPP). sigmaUSDC lends part of its USDC on other chains and its whole NAV is counted on Ethereum, where the vault lives. Also counted under Lagoon.', + blockchains: { + ethereum: { + erc4626: [ + '0xF02030AB0d7385CE4CC2f7F64b7B44430fB44c89', // Lagoon: Cross-chain USDC Lending (sigmaUSDC) + '0x2746f31096f23670Caf4043f8b30D8D02405a257', // Lagoon: stETH Redemption Carry (rcETH) + '0x8595f5eE036e1F7C4f3ca66327Ba5f38C21cb7Fb', // Lagoon: Stablecoin Market Making (sigmaLPP) + ], + }, + }, + }, + }, "singularv": { config: { methodology: 'Count all assets are deposited in all vaults curated by singularV.', From 4a15fb899c511487ff8fcab67b21ac9e7a2aadc1 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 11 Nov 2026 14:36:53 -0400 Subject: [PATCH 699/988] Add Gully Core (#22155) Co-authored-by: OxForged Co-authored-by: Claude Fable 5.1 --- projects/gullycore/index.js | 32 ++++++++++++++++++++++++++++++++ projects/helper/tokenMapping.js | 4 +++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 projects/gullycore/index.js diff --git a/projects/gullycore/index.js b/projects/gullycore/index.js new file mode 100644 index 00000000000..738b9a3a8e1 --- /dev/null +++ b/projects/gullycore/index.js @@ -0,0 +1,32 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const CL = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint160 sqrtPriceX96, int24 tick)' +const BIN = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint24 activeId)' + +const config = { + anubi: { vault: '0x080afe8C30e48e126e9EFAd6F455BaF53c16Ec91', clPoolManager: '0xC85Edc14Fc6053151066f6D497B11E6982946a50', binPoolManager: '0x4f5c8F759912BbcE685B2315136615Bb13DDe509', fromBlock: 18483713, start: '2026-11-07' }, + robinhood: { vault: '0x90c882D9C307c2bF7E961bC279b0929f92997dD4', clPoolManager: '0x6D0721230b6beD4bc9eeb65E200B6f90c2C9aEE6', binPoolManager: '0x4255B0B14F3dd4e2350954Da78707E3fA6c94E2B', fromBlock: 109466287, start: '2026-11-08' }, + base: { vault: '0x90c882D9C307c2bF7E961bC279b0929f92997dD4', clPoolManager: '0x6D0721230b6beD4bc9eeb65E200B6f90c2C9aEE6', binPoolManager: '0x4255B0B14F3dd4e2350954Da78707E3fA6c94E2B', fromBlock: 54386424, start: '2026-11-07' }, + bsc: { vault: '0x90c882D9C307c2bF7E961bC279b0929f92997dD4', clPoolManager: '0x6D0721230b6beD4bc9eeb65E200B6f90c2C9aEE6', binPoolManager: '0x4255B0B14F3dd4e2350954Da78707E3fA6c94E2B', fromBlock: 132456409, start: '2026-11-08' }, + elysium: { vault: '0x90c882D9C307c2bF7E961bC279b0929f92997dD4', clPoolManager: '0x6D0721230b6beD4bc9eeb65E200B6f90c2C9aEE6', binPoolManager: '0x4255B0B14F3dd4e2350954Da78707E3fA6c94E2B', fromBlock: 2834807, start: '2026-11-09' }, +} + +module.exports = { + methodology: 'Gully Core is a singleton AMM: one Vault holds the tokens of every pool. TVL is the Vault balance of every currency initialized in the CL and Bin pool managers.', +} + +Object.keys(config).forEach(chain => { + const { vault, clPoolManager, binPoolManager, fromBlock, start } = config[chain] + module.exports[chain] = { + start, + tvl: async (api) => { + const tokens = [] + for (const [target, eventAbi] of [[clPoolManager, CL], [binPoolManager, BIN]]) { + const logs = await getLogs2({ api, target, fromBlock, eventAbi }) + logs.forEach(l => tokens.push(l.currency0, l.currency1)) + } + return sumTokens2({ api, owner: vault, tokens, permitFailure: true }) + }, + } +}) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index ec2ac3e2274..e4bcbc3fb3c 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -62,9 +62,11 @@ const fixBalancesTokens = { platon: { [ADDRESSES.null]: { coingeckoId: 'platon-network', decimals: 18 }, }, - // Elysium (Kinetiq's Hyperliquid L2): wrapped HYPE used by ArkhamPad pools + // Elysium (Kinetiq's Hyperliquid L2): wrapped HYPE used by ArkhamPad pools, and the WETH9-bytecode wrapped HYPE + // Gully Core's pools are quoted in (deployment record: https://github.com/gully-labs/gully-core); neither is priced by the coins service elysium: { '0x43ca3cee078d8cb8528915b16e8bdcc9adbe6090': { coingeckoId: 'hyperliquid', decimals: 18 }, + '0xceeb06009b870430ac2872e3ba875ab6a9ab6699': { coingeckoId: 'hyperliquid', decimals: 18 }, }, } From 0931783c879a9a2eeca7acd8050037c5556ff2de Mon Sep 17 00:00:00 2001 From: burnbytes26 Date: Wed, 11 Nov 2026 20:48:30 +0100 Subject: [PATCH 700/988] Add H10X Index (Hedera) TVL adapter (#22156) Co-authored-by: FelixBruguera --- registries/sumTokens/data3.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 39ccb3f19da..049fe05345c 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1314,5 +1314,23 @@ module.exports = { } } }, + "h10x": { + "timetravel": false, + "methodology": "TVL is the basket of Hedera tokens held by the H10X vault (0.0.10907483), which backs every H10X token 1:1: issuing H10X requires depositing the proportional basket and redeeming returns it. Balances are read from the Hedera mirror node. H10X liquidity in SaucerSwap pools is not counted (it is part of SaucerSwap TVL), and H10X held by the vault as unclaimed fees is not counted either (it is backed by the same basket).", + "hedera": { + // H10X vault; basket changes only by governance (addComponent), update this list when it does + "owners": ["0.0.10907483"], + "tokens": [ + "0.0.1456986", // WHBAR + "0.0.10082597", // WBTC (LayerZero) + "0.0.1460200", // xSAUCE + "0.0.9770617", // WETH (LayerZero) + "0.0.3716059", // DOVU + "0.0.4794920", // PACK + "0.0.834116", // HBARX + "0.0.7893707", // GIB + ] + } + }, } From 02aeae14d3696810f01a16bd8b66666ea2871e4f Mon Sep 17 00:00:00 2001 From: Josh Chun Date: Wed, 11 Nov 2026 15:29:30 -0500 Subject: [PATCH 701/988] Theo Network thBILL: add StableEarn Prime PYUSD vault on Stable (#22157) --- projects/theo-network-thbill/index.js | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/projects/theo-network-thbill/index.js b/projects/theo-network-thbill/index.js index 9803409b7d6..cc293dbf33c 100644 --- a/projects/theo-network-thbill/index.js +++ b/projects/theo-network-thbill/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unwrapLPs') +const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') const { getConnection } = require('../helper/solana') const { PublicKey } = require('@solana/web3.js') @@ -20,6 +20,11 @@ const ULTRA_ARB = '0xc26af85ede9cc25d449bcebef866bb85afd5d346' const GTUSDCP_BASE = '0x050ce30b927da55177a4914ec73480238bad56f0' // Morpho Gauntlet USDC Prime (Base) const aMonUSDC = '0x35a73bacb179d3740395a3cecc87ff2e581d6042' // Aave v3 on Monad const STABLEEARN = '0xb7Df8db22A5DBBFA9ebeb94b3910aec6a4f05c08' // Morpho StableEarn vault on Stable (ERC4626, USDT0) +const GPYUSDSE = '0x8c3250f028a2c8d29319eb3ee3214b90462394ba' // Morpho StableEarn Prime PYUSD vault on Stable (ERC4626, PYUSD) +const PYUSD_STABLE = '0x28f1f38a9f7db1f769a71af0a13e8bace2ab0e9f' +// No code before these blocks, so calls to them fail +const PYUSD_STABLE_DEPLOY_BLOCK = 38998158 +const GPYUSDSE_DEPLOY_BLOCK = 44644572 // Solana const ULTRA_TOKEN_ACCOUNT = '6fk5UwZXF1Zs327zV5Fbmay2xTYCqg7eM5QeNQyyu7ae' @@ -34,11 +39,20 @@ async function solanaTvl(api) { } } -// Only the backing wallet's share of the vault; the shared erc4626 helper would count every depositor. async function stableTvl(api) { - const shares = await api.call({ abi: 'erc20:balanceOf', target: STABLEEARN, params: BACKING }) - const assets = await api.call({ abi: 'function convertToAssets(uint256 shares) view returns (uint256)', target: STABLEEARN, params: shares }) - api.add(ADDRESSES.stable.USDT0, assets) + const block = await api.getBlock() + const tokens = [ADDRESSES.stable.USDT0] + if (block >= PYUSD_STABLE_DEPLOY_BLOCK) tokens.push(PYUSD_STABLE) + await sumTokens2({ api, owner: BACKING, tokens }) + + // Only the backing wallet's share of each vault; the shared erc4626 helper would count every depositor. + const vaults = [[STABLEEARN, ADDRESSES.stable.USDT0]] + if (block >= GPYUSDSE_DEPLOY_BLOCK) vaults.push([GPYUSDSE, PYUSD_STABLE]) + for (const [vault, asset] of vaults) { + const shares = await api.call({ abi: 'erc20:balanceOf', target: vault, params: BACKING }) + const assets = await api.call({ abi: 'function convertToAssets(uint256 shares) view returns (uint256)', target: vault, params: shares }) + api.add(asset, assets) + } } module.exports = { @@ -46,7 +60,7 @@ module.exports = { methodology: 'thBILL TVL is the value of the reserve assets held in the thBILL backing wallets: tokenized Treasury ' + 'fund shares (ULTRA, FILQ-A), stablecoins, and stablecoin lending positions (Aave v3, Morpho vaults) ' + - 'across Ethereum, Arbitrum, Base, Monad, Stable and Solana. About 96% of thBILL supply is held as reserve by ' + + 'across Ethereum, Arbitrum, Base, Monad, Stable and Solana. Most thBILL supply is held as reserve by ' + 'thUSD (see Theo Network thUSD), so this adapter is flagged doublecounted under the Theo Network parent.', hallmarks: [ ['2025-11-20', 'Reserve rotated into ULTRA on Ethereum, Arbitrum and Solana'], @@ -54,6 +68,7 @@ module.exports = { ['2026-06-25', 'FILQ-A (Fidelity USD Digital Liquidity Fund) added to reserve'], ['2026-08-06', 'Aave v3 on Monad added to reserve'], ['2026-09-04', 'Solana ULTRA redeemed; USDC proceeds pending'], + ['2026-11-06', 'Aave v3 USDC (Ethereum) moved into the StableEarn Prime PYUSD vault on Stable'], ], ethereum: { tvl: sumTokensExport({ From 329f27e8b6155df4969a39b06af188eaebc98b25 Mon Sep 17 00:00:00 2001 From: NARAProtocol Date: Thu, 12 Nov 2026 09:11:03 +0200 Subject: [PATCH 702/988] nara: add treasury adapter and legacy CryptoSLIP user vaults (#22158) Co-authored-by: ccipherx --- projects/treasury/nara.js | 166 ++++++++++++++++++++++++++++++++++++++ registries/sumTokens.js | 4 +- 2 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 projects/treasury/nara.js diff --git a/projects/treasury/nara.js b/projects/treasury/nara.js new file mode 100644 index 00000000000..71a846983c4 --- /dev/null +++ b/projects/treasury/nara.js @@ -0,0 +1,166 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require('../helper/treasury') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// Canonical NARA Protocol V5 Treasury & Protocol-Owned Liquidity (POL) on Base (8453). +// Unissued emission reserves in NARAEmissionReserveV5 (0xf932178F24b0813C82093985F0Af6Db27Ae25930) +// and user-escrowed balances in PrincipalLedgerV5 / RewardLedgerV5 / CryptoSLIP vaults are excluded. +const NARA_TOKEN = '0x91FB78A9F46B67f54BbD4489941d19666b2fAe0f' +const BASE_USDC = ADDRESSES.base.USDC +const BASE_WETH = ADDRESSES.base.WETH +const BASE_CBBTC = ADDRESSES.base.cbBTC + +const TREASURY_SAFE = '0xe320C281c86079eA85f2Bc67864E873A61D551E3' +const ACTIVE_RANGE_MANAGER_V5 = '0x221c625d2BC416460C397035C1286C1f4A4D3A7C' +const LEGACY_RANGE_MANAGER_V5 = '0xa72557fcBE56B3eC739dF3aF7b6b893B6Db4D288' +const NARA_FEE_VAULT_V5 = '0xF1f361F803895BF5cf67eC6C506dbFEf2f6E88Cf' +const NARA_CAPITAL_BUDGET_V5 = '0x6f5f586Bd4F14e47F432264D88Fe9A6A6A80552B' +const NARA_POL_POSITION_V5 = '0x01EF9de9f4e9197F2A3944b5B34A90eA2f558b64' + +const UNIV4_POSITION_MANAGER = '0x7C5f5A4bBd8fD63184577525326123B519429bDc' +const SAFE_SEED_V4_TOKEN_ID = '3209802' + +const TREASURY_OWNERS = [ + TREASURY_SAFE, + ACTIVE_RANGE_MANAGER_V5, + LEGACY_RANGE_MANAGER_V5, + NARA_FEE_VAULT_V5, + NARA_CAPITAL_BUDGET_V5, + NARA_POL_POSITION_V5, +] +const RANGE_MANAGERS = [ACTIVE_RANGE_MANAGER_V5, LEGACY_RANGE_MANAGER_V5] + +const FEE_VAULT_INVENTORY_ABI = + 'function inventory(uint8 asset) view returns ((uint256 holderClaims, uint256 polClaims, uint256 holderRaw, uint256 polRaw, uint256 hookFees, uint256 lpFees, uint256 claimsRedeemed, uint256 holdersForwarded, uint256 polDonations, uint256 polReturned, uint256 polSpent) booked, uint256 rawBalance, uint256 claimBalance, uint256 rawSurplus, uint256 claimSurplus, bool solvent)' +const GET_ACTIVE_ORDER_IDS_ABI = + 'function getActiveOrderIds(uint256 offset, uint256 limit) view returns (uint256[] orderIds, uint256 nextOffset)' +const GET_ORDER_ABI = + 'function getOrder(uint256 orderId) view returns ((uint256 tokenId, uint256 inputAmount, uint256 minimumOutputAmount, bytes32 strategyHash, uint160 terminalSqrtPriceX96, uint128 liquidity, int24 tickLower, int24 tickUpper, uint64 createdBlock, uint64 expiresAt, uint64 terminalBlock, uint8 side, uint8 status) order)' +const OWNER_OF_ABI = 'function ownerOf(uint256 tokenId) view returns (address)' +const POL_TOKEN_ID_ABI = 'function positionTokenId() view returns (uint256)' + +async function getActiveV4PolPositionIds(api) { + const positionIdSet = new Set() + + const [seedOwner, polTokenId] = await Promise.all([ + api.call({ + target: UNIV4_POSITION_MANAGER, + params: [SAFE_SEED_V4_TOKEN_ID], + abi: OWNER_OF_ABI, + permitFailure: true, + }), + api.call({ + target: NARA_POL_POSITION_V5, + abi: POL_TOKEN_ID_ABI, + }), + ]) + + if (seedOwner && seedOwner.toLowerCase() === TREASURY_SAFE.toLowerCase()) { + positionIdSet.add(SAFE_SEED_V4_TOKEN_ID) + } + if (polTokenId && String(polTokenId) !== '0') { + positionIdSet.add(String(polTokenId)) + } + + const PAGE_SIZE = 100 + for (const manager of RANGE_MANAGERS) { + let offset = 0 + while (true) { + const page = await api.call({ + target: manager, + params: [offset, PAGE_SIZE], + abi: GET_ACTIVE_ORDER_IDS_ABI, + }) + const orderIds = page.orderIds + if (!orderIds.length) break + + const orders = await api.multiCall({ + target: manager, + calls: orderIds, + abi: GET_ORDER_ABI, + }) + orders.forEach((order) => { + if (order?.tokenId && String(order.tokenId) !== '0') { + positionIdSet.add(String(order.tokenId)) + } + }) + + if (orderIds.length < PAGE_SIZE) break + offset = Number(page.nextOffset) + } + } + + return [...positionIdSet] +} + +const treasury = treasuryExports({ + base: { + tokens: [nullAddress, BASE_USDC, BASE_WETH, BASE_CBBTC], + owners: TREASURY_OWNERS, + ownTokens: [NARA_TOKEN], + resolveUniV3: true, + fetchCoValentTokens: false, + }, +}) + +const baseTvl = treasury.base.tvl +const baseOwnTokens = treasury.base.ownTokens + +treasury.base.tvl = async (api) => { + await baseTvl(api) + + // Add Uniswap v4 PoolManager ERC-6909 POL claims held by NARAFeeVaultV5 (1 = ETH, 2 = USDC) + const [ethInv, usdcInv] = await api.multiCall({ target: NARA_FEE_VAULT_V5, abi: FEE_VAULT_INVENTORY_ABI, calls: [1, 2] }) + api.add(nullAddress, ethInv.booked.polClaims) + api.add(BASE_USDC, usdcInv.booked.polClaims) + + // Unwrap non-NARA side of active Uniswap v4 POL positions (Treasury Safe seed + RangeManager orders) + const positionIds = await getActiveV4PolPositionIds(api) + if (positionIds.length) { + await sumTokens2({ + api, + resolveUniV4: true, + uniV4ExtraConfig: { + positionIds, + whitelistedTokens: [nullAddress, BASE_USDC, BASE_WETH, BASE_CBBTC], + }, + blacklistedTokens: [NARA_TOKEN], + }) + } + + return api.getBalances() +} + +treasury.base.ownTokens = async (api) => { + await baseOwnTokens(api) + + // Add Uniswap v4 PoolManager ERC-6909 POL NARA claims held by NARAFeeVaultV5 (0 = NARA) + const naraInv = await api.call({ + target: NARA_FEE_VAULT_V5, + params: [0], + abi: FEE_VAULT_INVENTORY_ABI, + }) + api.add(NARA_TOKEN, naraInv.booked.polClaims) + + // Unwrap NARA side of active Uniswap v4 POL positions + const positionIds = await getActiveV4PolPositionIds(api) + if (positionIds.length) { + await sumTokens2({ + api, + resolveUniV4: true, + uniV4ExtraConfig: { + positionIds, + whitelistedTokens: [NARA_TOKEN], + }, + blacklistedTokens: [nullAddress, BASE_USDC, BASE_WETH, BASE_CBBTC], + }) + } + + return api.getBalances() +} + +module.exports = { + methodology: + 'Treasury TVL counts non-NARA reserves (ETH, USDC, WETH, cbBTC) held in the NARA Treasury Safe, NARATreasuryRangeManagerV5, NARAFeeVaultV5 (including Uniswap v4 ERC-6909 POL claims), NARACapitalBudgetV5, and Protocol-Owned Liquidity (POL) across Uniswap v4 and Uniswap v3. Protocol NARA held in those contracts and LP positions is reported separately under ownTokens, excluding unissued NARAEmissionReserveV5 reserves.', + ...treasury, +} diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 30253d40203..82f44bf347b 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -19363,12 +19363,14 @@ const configs = { }, }, "nara": { - "methodology": "TVL counts the ETH, WETH, USDC and cbBTC held by the CryptoSLIP slip vaults (user slip escrow plus fees not yet forwarded to the treasury) and any non-NARA balance in the V5 position-sale escrow and reward contracts. Staking counts NARA committed in NARAPrincipalLedgerV5 and NARA held in CryptoSLIP slips. The Treasury Safe, its range-order managers and the fee vault hold protocol-owned liquidity and are not counted.", + "methodology": "TVL counts the ETH, WETH, USDC and cbBTC held by the CryptoSLIP slip vaults (user slip escrow plus fees not yet forwarded to the treasury) and any non-NARA balance in the V5 position-sale escrow and reward contracts. Staking counts NARA committed in NARAPrincipalLedgerV5 and NARA held in CryptoSLIP slips. The Treasury Safe, its range-order managers and the fee vault hold protocol-owned liquidity and are tracked separately under treasury/nara.js.", "base": { "tvl": { "owners": [ "0x3f80aa68Fb4834d6E119EE1cf932C14419Cf63EB", "0x38BF0321FA7489576978353a6a8da4A3e85C2F18", + "0x4Dc2b5A801A81b17b8d05C737c727FEd1f30699A", + "0x87aadDF2d3aa11Cddf36939715508066a99BA415", "0x04Ac83045d26259D46400Ce6beb9bBd0641df225", "0xC72671D9438388638547444524F6542b650C9264", "0x44130CC47b886D8488041F5eaE271477D1aFA909" From 20cc78b6a19382b8eaf133d543a7d3044fa64542 Mon Sep 17 00:00:00 2001 From: Michael Tan <108757170+michaelbtan@users.noreply.github.com> Date: Thu, 12 Nov 2026 02:12:32 -0500 Subject: [PATCH 703/988] strato: map native $STRATO to CoinGecko (#22152) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/strato-bridge/index.js | 18 ++++++------------ projects/strato/index.js | 27 ++++++++++++++++++--------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/projects/strato-bridge/index.js b/projects/strato-bridge/index.js index a3cbe4ae796..58039e86305 100644 --- a/projects/strato-bridge/index.js +++ b/projects/strato-bridge/index.js @@ -26,11 +26,9 @@ const STRATO_NATIVE_TOKENS = [ '0xcdc93d30182125e05eec985b631c7c61b3f63ff0', // GOLDST '0x2c59ef92d08efde71fe1a1cb5b45f4f6d48fcc94', // SILVST ] -// $STRATO locked in the vault is exactly what circulates as the Ethereum STRATO -// ERC-20, which is where CoinGecko tracks it (`ethereum-strato`, 18 decimals). -// It has no price feed on the STRATO chain, so it is counted against that address. -const STRATO_ON_STRATO = '0x2ca3e170e6714282da77815f7864b17f612f5f83' -const STRATO_ON_ETHEREUM = 'ethereum:0x4c93b9fbf7fd1777ccbcbc538b1d0a8b58fb1ad6' +const STRATO = '0x2ca3e170e6714282da77815f7864b17f612f5f83' + +const custodyVault = (api) => api.call({ target: STRATO_NATIVE_BRIDGE, abi: 'function custodyVault() view returns (address)' }) const registry = (mapping) => getConfig( `strato-bridge/${mapping}`, @@ -58,15 +56,11 @@ async function getTokens(chainId) { module.exports = { methodology: - 'Inbound: assets escrowed in the Mercata bridge custody address on each source chain (Ethereum, Base, Linea, Robinhood Chain, HyperEVM), each backing a 1:1 wrapped *ST token minted on STRATO. Custody addresses and the asset list per chain are read from the MercataBridge assets/chains registry on STRATO mainnet (only entries flagged enabled are counted). Outbound: STRATO-native assets (STRATO, USDST, GOLDST, SILVST) locked in the StratoNativeBridge custody vault while represented on other chains; locked $STRATO is priced against the Ethereum STRATO ERC-20 because it has no price feed on the STRATO chain.', + 'Inbound: assets escrowed in the Mercata bridge custody address on each source chain (Ethereum, Base, Linea, Robinhood Chain, HyperEVM), each backing a 1:1 wrapped *ST token minted on STRATO. Custody addresses and the asset list per chain are read from the MercataBridge assets/chains registry on STRATO mainnet (only entries flagged enabled are counted). Outbound: STRATO-native assets (USDST, GOLDST, SILVST) locked in the StratoNativeBridge custody vault while represented on other chains. $STRATO locked in the same vault is the protocol token and is reported under staking.', start: '2026-04-02', strato: { - tvl: async (api) => { - const vault = await api.call({ target: STRATO_NATIVE_BRIDGE, abi: 'function custodyVault() view returns (address)' }) - await api.sumTokens({ owner: vault, tokens: STRATO_NATIVE_TOKENS }) - const stratoLocked = await api.call({ target: STRATO_ON_STRATO, abi: 'erc20:balanceOf', params: vault }) - if (BigInt(stratoLocked) > 0n) api.add(STRATO_ON_ETHEREUM, stratoLocked.toString(), { skipChain: true }) - }, + tvl: async (api) => sumTokens2({ api, owner: await custodyVault(api), tokens: STRATO_NATIVE_TOKENS }), + staking: async (api) => sumTokens2({ api, owner: await custodyVault(api), tokens: [STRATO] }), }, } diff --git a/projects/strato/index.js b/projects/strato/index.js index 0112c23522e..ce250f87ec2 100644 --- a/projects/strato/index.js +++ b/projects/strato/index.js @@ -1,4 +1,5 @@ const { batchCall, enumerateArray, getV2Pools, getV3Pools, lc } = require('../helper/chain/strato') +const { sumTokens2 } = require('../helper/unwrapLPs') const CDP_REGISTRY = '0x0000000000000000000000000000000000001012' const LENDING_REGISTRY = '0x0000000000000000000000000000000000001007' @@ -7,10 +8,8 @@ const SAFETY_MODULE = '0x0000000000000000000000000000000000001015' const SAVE_USDST_VAULT = '0x22550671fcad04a213697ac7ae4f4366e96446ed' const VAULT = '0x34bc729f66106a146b0864e673a3571b28fa23e1' const STRATO_STAKING = '0xf30a022ce83bed7adeafc286c719388dcc3b3988' -// $STRATO is not priced on the STRATO chain itself. CoinGecko tracks it as the -// Ethereum ERC-20 (`ethereum-strato`), same 18 decimals, so staked balance is -// reported against that address. -const STRATO_ON_ETHEREUM = 'ethereum:0x4c93b9fbf7fd1777ccbcbc538b1d0a8b58fb1ad6' +// $STRATO, native to the STRATO chain +const STRATO_TOKEN = '0x2ca3e170e6714282da77815f7864b17f612f5f83' // DirectMintPSM: mints USDST 1:1 against stablecoin reserves it holds. const DIRECT_MINT_PSM = '0xb1efdc86eecfbedf83d0295671214fee451786f3' // ERC-4626 YieldVaults. There is no on-chain factory/registry to enumerate @@ -25,6 +24,11 @@ const YIELD_VAULTS = [ const RAY = 10n ** 27n +/** + * Assets held by STRATO's CDP, lending, savings, safety-module, vault, PSM and + * YieldVault contracts. USDST (issued against that collateral) and $STRATO (the + * protocol's own token) are excluded. + */ async function tvl(api) { // Swap pool liquidity is listed separately (strato-dex). The pools are still enumerated here only // as the token universe to probe the CDP vault and PSM with: neither holder enumerates its assets. @@ -78,6 +82,8 @@ async function tvl(api) { // USDST is issued against CDP collateral / PSM reserves already counted above. api.removeTokenBalance(usdst) + // $STRATO is the protocol's own token: reported under `staking`, not TVL. + api.removeTokenBalance(STRATO_TOKEN) } async function borrowed(api) { @@ -99,21 +105,24 @@ async function borrowed(api) { if (cdpDebt > 0n) api.add(usdst, cdpDebt.toString()) } -// Phase 1 $STRATO staking. There is no receipt token; stake is tracked as -// internal accounting on StratoStaking. Principal = delegated user stake + -// operator self-bond. Unbonding stake and the reward reserve are excluded. +/** + * Phase 1 $STRATO staking. There is no receipt token; stake is tracked as + * internal accounting on StratoStaking. Principal = delegated user stake + + * operator self-bond. Unbonding stake and the reward reserve are excluded. + */ async function staking(api) { const [totalUserStake, totalSelfBond] = await batchCall([ { target: STRATO_STAKING, abi: 'function totalUserStake() view returns (uint256)' }, { target: STRATO_STAKING, abi: 'function totalSelfBond() view returns (uint256)' }, ]) const staked = totalUserStake + totalSelfBond - if (staked > 0n) api.add(STRATO_ON_ETHEREUM, staked.toString(), { skipChain: true }) + if (staked > 0n) api.add(STRATO_TOKEN, staked.toString()) + return sumTokens2({ api }) } module.exports = { methodology: - 'All values verified on-chain via batched eth_call (no Multicall3). CDP collateral read from CDPVault, lending deposits (idle liquidity + collateral) from LiquidityPool + CollateralVault, savings from SaveUSDSTVault, staked assets from SafetyModule, vault holdings from the Vault botExecutor, stablecoin reserves held by the DirectMintPSM, and idle assets held by each ERC-4626 YieldVault (capital deployed to strategies is excluded because it is redeployed into CDPs/pools already counted). Swap pool liquidity (PoolFactory / PoolV3Factory) is listed separately as STRATO DEX. USDST is excluded from base TVL across all holders because its backing CDP collateral and PSM reserves are already counted. Holder addresses resolved from on-chain registries (CDPRegistry, LendingRegistry). Outstanding debt is reported separately under `borrowed` and excluded from TVL: LiquidityPool debt (totalScaledDebt × borrowIndex / RAY against the LiquidityPool borrowableAsset) plus CDP debt (CDPEngine.totalDebtAll, outstanding USDST summed across every enumerated collateral asset). Staked $STRATO (StratoStaking totalUserStake + totalSelfBond) is reported under `staking`, priced against the Ethereum STRATO ERC-20 because $STRATO has no price feed on the STRATO chain itself. Prices resolved server-side by DefiLlama for the `strato` chain.', + 'All values verified on-chain via batched eth_call (no Multicall3). CDP collateral read from CDPVault, lending deposits (idle liquidity + collateral) from LiquidityPool + CollateralVault, savings from SaveUSDSTVault, staked assets from SafetyModule, vault holdings from the Vault botExecutor, stablecoin reserves held by the DirectMintPSM, and idle assets held by each ERC-4626 YieldVault (capital deployed to strategies is excluded because it is redeployed into CDPs/pools already counted). Swap pool liquidity (PoolFactory / PoolV3Factory) is listed separately as STRATO DEX. USDST is excluded from base TVL across all holders because its backing CDP collateral and PSM reserves are already counted. Holder addresses resolved from on-chain registries (CDPRegistry, LendingRegistry). Outstanding debt is reported separately under `borrowed` and excluded from TVL: LiquidityPool debt (totalScaledDebt × borrowIndex / RAY against the LiquidityPool borrowableAsset) plus CDP debt (CDPEngine.totalDebtAll, outstanding USDST summed across every enumerated collateral asset). Staked $STRATO (StratoStaking totalUserStake + totalSelfBond) is reported under `staking` and excluded from base TVL. Prices resolved server-side by DefiLlama for the `strato` chain.', timetravel: false, start: '2026-04-02', strato: { tvl, borrowed, staking }, From ccda107120836e958ec145259f0e6ccde5db4feb Mon Sep 17 00:00:00 2001 From: null <78634899+nullsui@users.noreply.github.com> Date: Wed, 11 Nov 2026 23:21:10 -0800 Subject: [PATCH 704/988] Add Perpsplexity (Sui) (#22159) Co-authored-by: ccipherx --- projects/perpsplexity/index.js | 193 +++++++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 projects/perpsplexity/index.js diff --git a/projects/perpsplexity/index.js b/projects/perpsplexity/index.js new file mode 100644 index 00000000000..933c2607a38 --- /dev/null +++ b/projects/perpsplexity/index.js @@ -0,0 +1,193 @@ +// Perpsplexity: leveraged meme pools and leveraged tokens on Sui, backed by perpetual positions on Aftermath. +// Every pool and token is valued by its own contract through a read-only call (devInspect) on the latest state. +const sdk = require('@defillama/sdk') +const sui = require('../helper/chain/sui') + +const suiSdk = sdk.chains.sui +const CLOCK = '0x6' + +// One entry per deployed package line. `original` is the first publish (event and object types carry it); +// view calls go to the newest version of that line, looked up on chain. `layout` picks the reader below. +// Adding a new generation (for example the v2 pools) is one more entry here plus, if its objects differ, a reader. +const DEPLOYMENTS = [ + { version: 'v1-immutable', layout: 'core1', original: '0xaedb8c9a905a778e831aeb4928f660210a7a645925348a7c4ec1cb4a6a3fd16e', config: '0xb57be7c2f90d8bf9232af4cb967b411861b713f4480dfe50871dc85579f98411' }, + { version: 'v1', layout: 'core1', original: '0x97fea95545c04dc73f8174c6195013b100a26e3fa978e7cf8b100a51dfaf8354', config: '0x7566f0f6508b7797f906c78ae5a39aaf1cd5aec58ff765b2599a6fba1dfce12c' }, + { version: 'lev', layout: 'lev', original: '0x294e0968e465d9e2e560b825c603a40d34a7ee72e5a9157ff796519d44f7df4a', config: '0xfa003af67a3c948d1ebf9bbde1b08da54bee838d92ce577046fbc8fdc7d15cb4' }, +] + +// Object types each layout lists. Pools and tokens are shared objects, so listing them by type needs no event history. +const OBJECT_TYPES = { + core1: ['composite_pool::CompositePool', 'pool::Pool'], + lev: ['token::LevToken'], +} + +// ---------------------------------------------------------------- chain reads + +/** Objects with their json, type and initial shared version, 50 per GraphQL query. */ +async function loadObjects(ids, cache) { + const missing = [...new Set(ids.map(normalize))].filter(id => !cache.has(id)) + for (let i = 0; i < missing.length; i += 50) { + const chunk = missing.slice(i, i + 50) + const keys = chunk.map(id => `{ address: "${id}" }`).join(', ') + const data = await suiSdk.graphqlCall({ + query: `{ multiGetObjects(keys: [${keys}]) { address owner { ... on Shared { initialSharedVersion } } asMoveObject { contents { type { repr } json } } } }`, + }) + for (const o of data.multiGetObjects ?? []) { + if (!o?.address) continue + cache.set(normalize(o.address), { + type: o.asMoveObject?.contents?.type?.repr, + json: o.asMoveObject?.contents?.json, + isv: o.owner?.initialSharedVersion, + }) + } + } + return ids.map(id => cache.get(normalize(id))) +} + +/** Newest package version of a package line (view calls go there). */ +async function latestPackage(original) { + const data = await suiSdk.graphqlCall({ query: `{ packageVersions(address: "${original}", last: 1) { nodes { address } } }` }) + return data.packageVersions?.nodes?.[0]?.address ?? original +} + +/** Read-only Move call over shared objects; returns the BCS bytes of each return value, or null if it aborts. */ +async function view(cache, packageId, module, functionName, typeArguments, args) { + const objs = await loadObjects(args.map(a => a.id), cache) + const sharedObjects = args.map((a, i) => { + if (objs[i]?.isv == null) throw new Error(`${a.id} is not a shared object`) + return { objectId: a.id, initialSharedVersion: objs[i].isv, mutable: !!a.mut } + }) + const txBytes = sui.buildProgrammableMoveCallBytes({ packageId, module, functionName, typeArguments, sharedObjects }) + try { + const res = await sui.devInspectTransactionBlock(txBytes) + return (res?.results?.[0]?.returnValues ?? []).map(v => v[0]) + } catch (e) { + // only a Move abort (paused market, stale feed) falls back, rpc errors fail the run + if (!/simulateTransaction failed|devInspectTransactionBlock failed/.test(String(e?.message))) throw e + sdk.log(`[perpsplexity] ${module}::${functionName} aborted: ${String(e?.message ?? e).slice(0, 200)}`) + return null + } +} + +// ---------------------------------------------------------------- readers, one per object layout + +// composite_pool::Health: pool, engine, market (3 x ID), timestamp_ms u64, state u8, config_paused bool, +// last_epoch_ms u64, epoch_interval_ms u64, meme_reserve u64, then quote_nav u64 at byte 130. +const HEALTH_QUOTE_NAV = 130 +// token::Status: token ID, state u8, long bool, target_bps, min_bps, max_bps (u64), then nav u64 at byte 58. +const STATUS_NAV = 58 + +const big = v => BigInt(v ?? 0) + +/** Coins the pool keeps apart from its curve: treasury, unpaid dividends, platform fees and the launch escrow. */ +function setApart(json) { + return big(json.treasury?.funds) + big(json.dividends) + big(json.platform) + big(json.pending_seed) +} + +async function creatorFees(cache, pkg, module, typeArgs, id) { + const out = await view(cache, pkg, module, 'creator_fees', typeArgs, [{ id }]) + return out?.[1] ? sui.fromU64(out[1]) : 0n +} + +/** Leveraged pool (composite_pool::CompositePool): quote_nav from observe / observe_cash, plus what it keeps apart. */ +async function compositePool(api, cache, pkg, id, obj) { + const typeArgs = sui.parseStructTag(obj.type).typeParams + const quote = typeArgs[2] + const p = obj.json + const state = Number(p.state) + let total = setApart(p) + await creatorFees(cache, pkg, 'composite_pool', typeArgs, id) + // 3: being set up (seed sits in pending_seed), 4: cancelled + if (state !== 3 && state !== 4) { + const q = p.quote + const cash = state === 2 || state === 6 + let args + if (cash) { + const [reserve] = await loadObjects([q.reserve], cache) + args = [{ id }, { id: p.config }, { id: q.sleeve }, { id: q.reserve }, { id: reserve.json.account_id }, { id: q.lending_market }, { id: q.market }, { id: CLOCK }] + } else { + const [engine, reserve] = await loadObjects([q.engine, q.reserve], cache) + const e = engine.json + const [vault] = await loadObjects([e.vault], cache) + args = [ + { id }, { id: p.config }, { id: q.engine }, { id: e.vault }, { id: vault.json.account_id }, { id: q.market, mut: true }, { id: e.sleeve }, + { id: q.lending_market }, { id: q.sleeve }, { id: q.reserve }, { id: reserve.json.account_id }, { id: q.registry }, { id: e.base_oracle }, { id: e.collateral_oracle }, { id: CLOCK }, + ] + } + const out = await view(cache, pkg, 'composite_pool', cash ? 'observe_cash' : 'observe', typeArgs, args) + // if the venue cannot be valued right now (paused market, stale feed), count only the cash the pool object holds + total += out?.[0] ? sui.fromU64(out[0], HEALTH_QUOTE_NAV) : big(q.hot) + } + api.add(quote, total.toString()) +} + +/** Spot pool (pool::Pool): the quote balance in the pool object plus what it keeps apart. */ +async function spotPool(api, cache, pkg, id, obj) { + const typeArgs = sui.parseStructTag(obj.type).typeParams + const total = big(obj.json.quote) + setApart(obj.json) + await creatorFees(cache, pkg, 'pool', typeArgs, id) + api.add(typeArgs[1], total.toString()) +} + +async function core1(api, cache, dep, pkg, ids) { + const objs = await loadObjects(ids, cache) + await sdk.util.runInPromisePool({ + items: ids.map((id, i) => [id, objs[i]]), + concurrency: 5, + processor: async ([id, obj]) => { + if (!obj?.type) return + if (obj.type.includes('::composite_pool::CompositePool<')) return compositePool(api, cache, pkg, id, obj) + if (obj.type.includes('::pool::Pool<')) return spotPool(api, cache, pkg, id, obj) + }, + }) +} + +/** Leveraged token (token::LevToken): nav from token::status (free cash plus position equity at the oracle price). */ +async function lev(api, cache, dep, pkg, ids) { + const objs = await loadObjects(ids, cache) + await sdk.util.runInPromisePool({ + items: ids.map((id, i) => [id, objs[i]]), + concurrency: 5, + processor: async ([id, obj]) => { + if (!obj?.type) return + const t = obj.json + if (Number(t.state) === 0) return // being set up + const typeArgs = sui.parseStructTag(obj.type).typeParams + const [vault] = await loadObjects([t.vault], cache) + const out = await view(cache, pkg, 'token', 'status', typeArgs, [ + { id: dep.config }, { id }, { id: t.vault }, { id: vault.json.account_id }, { id: t.market, mut: true }, + { id: t.registry }, { id: t.base_oracle }, { id: t.collateral_oracle }, { id: CLOCK }, + ]) + if (!out?.[0]) return // venue cannot be valued right now (logged in view) + api.add(typeArgs[1], sui.fromU64(out[0], STATUS_NAV).toString()) + }, + }) +} + +const READERS = { core1, lev } + +// ---------------------------------------------------------------- tvl + +function normalize(id) { + return '0x' + id.replace(/^0x/, '').toLowerCase().padStart(64, '0') +} + +async function tvl(api) { + const cache = new Map() + for (const dep of DEPLOYMENTS) { + const pkg = await latestPackage(dep.original) + const ids = new Set() + for (const type of OBJECT_TYPES[dep.layout]) { + const objects = await sui.getObjectsByType(`${dep.original}::${type}`) + objects.forEach(o => ids.add(normalize(o.id))) + } + sdk.log(`[perpsplexity] ${dep.version}: ${ids.size} pools/tokens`) + await READERS[dep.layout](api, cache, dep, pkg, [...ids]) + } +} + +module.exports = { + timetravel: false, + start: '2026-09-16', // first pool, ZUK on the immutable package + doublecounted: true, + methodology: 'TVL is what every Perpsplexity pool and leveraged token holds, valued by its own contract through a read-only call on the latest chain state. Leveraged pools: composite_pool::observe (observe_cash while a pool rests in cash) returns quote_nav = cash in the pool + its Suilend deposit + idle margin in its Aftermath reserve account + the value of its Aftermath perp position (collateral plus unrealized PnL and funding); the treasury, unpaid holder dividends, uncollected platform and creator fees and launch escrow kept in the pool are added. Spot pools: the quote balance in the pool plus the same set-apart balances. Leveraged tokens: token::status nav (free cash plus perp position equity at the oracle price). Pool tokens themselves (the meme coins in each pool reserve) are not counted. Marked doublecounted because part of the pools\' cash is lent on Suilend and also appears in Suilend\'s TVL. Margin posted on Aftermath Perps is not counted by any other DefiLlama adapter (the Aftermath afLP adapter counts only the afLP vault account), so it is included here.', + sui: { tvl }, +} From fd27768432cb14817f42f786fa3e2ba1f32e7872 Mon Sep 17 00:00:00 2001 From: Dani Date: Thu, 12 Nov 2026 09:17:10 +0100 Subject: [PATCH 705/988] vfat: add elysium, keep lisk as empty export (#22161) --- projects/vfat/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/vfat/index.js b/projects/vfat/index.js index 8042f1d993f..3419b3b5242 100644 --- a/projects/vfat/index.js +++ b/projects/vfat/index.js @@ -3,12 +3,12 @@ const { getCache } = require('../helper/http'); const chains = { ethereum: 1, optimism: 10, cronos: 25, telos: 40, bsc: 56, unichain: 130, polygon: 137, monad: 143, sonic: 146, fraxtal: 252, - pulse: 369, wc: 480, bot: 677, hyperliquid: 999, lisk: 1135, + pulse: 369, wc: 480, bot: 677, hyperliquid: 999, metall2: 1750, soneium: 1868, peaq: 3338, tempo: 4217, megaeth: 4326, robinhood: 4663, mantle: 5000, arc: 5042, zeta: 7000, base: 8453, plasma: 9745, mode: 34443, arbitrum: 42161, celo: 42220, etlk: 42793, hemi: 43111, avax: 43114, ink: 57073, linea: 59144, berachain: 80094, - scroll: 534352, katana: 747474, + elysium: 99901, scroll: 534352, katana: 747474, }; // The publisher runs every 30 minutes. Allow delayed runs, but not an @@ -57,5 +57,6 @@ module.exports = { for (const [chain, chainId] of Object.entries(chains)) module.exports[chain] = { tvl: api => tvl(api, chainId) }; -// fantom is no longer in the API response; keep the export so historical TVL stays in the API +// fantom and lisk dropped out of the API response, keep the exports so historical TVL stays in the API module.exports.fantom = { tvl: () => ({}) }; +module.exports.lisk = { tvl: () => ({}) }; From 669df3cc56f1d4c300d7a61ad8676f7bf9df1883 Mon Sep 17 00:00:00 2001 From: webmass <9001716+webmass@users.noreply.github.com> Date: Thu, 12 Nov 2026 12:20:50 +0400 Subject: [PATCH 706/988] add swan dao (#22160) Co-authored-by: ccipherx --- registries/sumTokens.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 82f44bf347b..aa71465859b 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -27448,6 +27448,19 @@ const configs = { ] }, }, + "swan-dao": { + "methodology": "TVL is the wstETH collateral and the sUSDS PSM reserves held by the Swan DAO Monolith lender. Staking is the SWAN held by the sSWAN staking contract.", + "doublecounted": true, // lender comes from the Monolith factory, also counted in monolith-market + "ethereum": { + "tvl": { + "owner": "0x4ed5c72816aBc1b67ac31DdAbE31cff4a8c56a15", + "tokens": [ADDRESSES.ethereum.WSTETH, ADDRESSES.ethereum.sUSDS] + }, + "staking": { + "__staking": ["0xcBC108384e874D9B0436adE3918685BaA709e48c", "0xD0a32F6d4850F9D6DF7d4F8f84af1Fcd3Cf993CC"] + } + }, + }, "swell-l2-farm": { "hallmarks": [ [ From cec5157069824d4da81b603ac6e0a47ce578beb1 Mon Sep 17 00:00:00 2001 From: Dani Date: Thu, 12 Nov 2026 09:28:09 +0100 Subject: [PATCH 707/988] lista-lending: skip ethereum before vault deployment (#22162) --- projects/lista-lending/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/lista-lending/index.js b/projects/lista-lending/index.js index 69b5579d20b..8ad7fd31a36 100644 --- a/projects/lista-lending/index.js +++ b/projects/lista-lending/index.js @@ -5,7 +5,7 @@ const MARKET_LIST_URL = 'https://api.lista.org/api/moolah/borrow/marketList?page const config = { bsc: { vault: '0x8F73b65B4caAf64FBA2aF91cC5D4a2A1318E5D8C' }, - ethereum: { vault: '0xf820fB4680712CD7263a0D3D024D5b5aEA82Fd70' }, + ethereum: { vault: '0xf820fB4680712CD7263a0D3D024D5b5aEA82Fd70', start: 1758872495 }, // vault deployed at block 23445769 (2025-09-26) } const abi = { @@ -51,7 +51,8 @@ async function getAllMarketIds(api) { } async function tvl(api) { - const { vault } = config[api.chain] + const { vault, start } = config[api.chain] + if (start && api.timestamp < start) return {} const marketIds = await getMarketIdsForTvl(api) if (marketIds.length === 0) return {} const marketInfos = await api.multiCall({ @@ -64,7 +65,8 @@ async function tvl(api) { } async function borrowed(api) { - const { vault } = config[api.chain] + const { vault, start } = config[api.chain] + if (start && api.timestamp < start) return {} const marketIds = await getAllMarketIds(api) if (marketIds.length === 0) return {} const [marketInfos, marketData] = await Promise.all([ From e9fa0b4236b481764a16eff6d68de7c6ad1dafb0 Mon Sep 17 00:00:00 2001 From: freelook <7212860+freelook@users.noreply.github.com> Date: Thu, 12 Nov 2026 14:25:02 +0100 Subject: [PATCH 708/988] feat: update yld.cx TVL adapter to v0.4 (#22164) Co-authored-by: FelixBruguera --- projects/yld-cx/index.js | 73 ++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/projects/yld-cx/index.js b/projects/yld-cx/index.js index 1d98fd91d86..28539964856 100644 --- a/projects/yld-cx/index.js +++ b/projects/yld-cx/index.js @@ -1,47 +1,54 @@ const { getLogs2 } = require('../helper/cache/getLogs') -const YLD = '0x0000014563b23d9ac3ac11fe68d63cdfc19a43db' const pairCreated = 'event PairCreated(uint256 indexed pairId, address indexed token0, address indexed token1)' -const startBlocks = { ethereum: 26167740, base: 52457955, robinhood: 85678610 } +const contracts = [ + // v0.3: tokenLiability includes accrued protocol fees, subtracted below + { + address: '0x0000014563b23d9ac3ac11fe68d63cdfc19a43db', + subtractFees: true, + startBlocks: { ethereum: 26167740, base: 52457955, robinhood: 85678610 }, + }, + // v0.4: tokenLiability tracks user-owned tick reserves only; fees are surplus above it + { + address: '0x00007e639751Af64b8b108c3E40b1Cd7faDdE627', + subtractFees: false, + startBlocks: { ethereum: 26391743, base: 56052624, robinhood: 111707405 }, + }, +] async function tvl(api) { const block = await api.getBlock() - const fromBlock = startBlocks[api.chain] - if (block < fromBlock) return - - const pairs = await getLogs2({ - api, - target: YLD, - eventAbi: pairCreated, - fromBlock, - toBlock: block, - }) - const tokens = [...new Set(pairs.flatMap(({ token0, token1 }) => [token0.toLowerCase(), token1.toLowerCase()]))] - if (!tokens.length) return - - const [liabilities, fees] = await Promise.all([ - api.multiCall({ target: YLD, abi: 'function tokenLiability(address) view returns (uint256)', calls: tokens }), - api.multiCall({ target: YLD, abi: 'function accruedProtocolFees(address) view returns (uint256)', calls: tokens }), - ]) - - tokens.forEach((token, i) => { - const liability = BigInt(liabilities[i]) - const protocolFees = BigInt(fees[i]) - - if (protocolFees > liability) { - throw new Error(`yld.cx ${api.chain}: fees exceed liability for ${token}`) - } - - if (liability > 0n) { - api.add(token, (liability - protocolFees).toString()) - } - }) + + for (const { address, subtractFees, startBlocks } of contracts) { + const fromBlock = startBlocks[api.chain] + if (block < fromBlock) continue + + const pairs = await getLogs2({ + api, + target: address, + eventAbi: pairCreated, + fromBlock, + toBlock: block, + }) + const tokens = [...new Set(pairs.flatMap(({ token0, token1 }) => [token0.toLowerCase(), token1.toLowerCase()]))] + if (!tokens.length) continue + + const liabilities = await api.multiCall({ target: address, abi: 'function tokenLiability(address) view returns (uint256)', calls: tokens }) + const fees = subtractFees + ? await api.multiCall({ target: address, abi: 'function accruedProtocolFees(address) view returns (uint256)', calls: tokens }) + : tokens.map(() => 0) + + tokens.forEach((token, i) => { + const amount = BigInt(liabilities[i]) - BigInt(fees[i]) + if (amount > 0n) api.add(token, amount.toString()) + }) + } } module.exports = { start: '2026-10-11', - methodology: 'User-owned ERC-20 assets held by Yield Orders: on-chain tokenLiability minus accruedProtocolFees at the snapshot block.', + methodology: 'User-owned ERC-20 assets held by Yield Orders v0.3 and v0.4, read from on-chain tokenLiability per pair token. v0.3 liability includes accrued protocol fees, which are subtracted; in v0.4 fees and donations sit above liability and are excluded by construction.', ethereum: { tvl }, base: { tvl }, robinhood: { tvl }, From 4e6499c3d480d9b378bbe49e59e4af4383b010ae Mon Sep 17 00:00:00 2001 From: Marinus Protocol Date: Thu, 12 Nov 2026 08:29:45 -0500 Subject: [PATCH 709/988] Marinus: add Polygon TVL (lending + smPOL) (#22165) Co-authored-by: Claude Opus 5.5 --- projects/marinus/index.js | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/projects/marinus/index.js b/projects/marinus/index.js index 0cf7ef6361e..19232bc3f22 100644 --- a/projects/marinus/index.js +++ b/projects/marinus/index.js @@ -1,34 +1,54 @@ const ADDRESSES = require('../helper/coreAssets.json') const WSEI = ADDRESSES.sei.WSEI +const SPOL = '0xd1CD49A08AeF3Af93457aEc17C786C2b7F48eCd7' // Polygon Labs liquid-staked POL // MPool -> underlying -const mPools = { +const seiMPools = { '0xC9B14f5164E6fE89D71E21D0B7c40Ee7db8367d4': WSEI, // mSEI '0x9a50eDE5c7db417ebe65107d68Bda6c36c807859': ADDRESSES.sei.USDC_Circle, // mUSDC '0x14914cA91A6C1d82F03c3fE51B4AAf7d031a37bF': ADDRESSES.sei.USDT0, // mUSDT0 } -const stakingPools = [ +const seiStakingPools = [ '0xcfE179E0A6ca284Ec02E0c8656992c870371Ba03', // smSEI '0xAa1331C59B8FA07bf17DA828328f11Ae43061513', // srSEI ] -async function tvl(api) { - await api.sumTokens({ tokensAndOwners: Object.entries(mPools).map(([pool, token]) => [token, pool]) }) - await api.sumTokens({ owners: stakingPools, tokens: [WSEI, ADDRESSES.null] }) - api.addGasToken(await api.multiCall({ abi: 'uint256:totalDelegated', calls: stakingPools })) +const polygonMPools = { + '0xA8Ab73Fdce0A8050D4345E4F5A881cC57df025bE': ADDRESSES.polygon.WMATIC_2, // mPOL (WPOL) + '0x0972Fc4889346067dDEeFcD022dF7982dF744dD9': ADDRESSES.polygon.USDC_CIRCLE, // mUSDC + '0x0559501DDdE3fdbc6F356A523e07325774dE2339': ADDRESSES.polygon.USDT, // mUSDT0 } -async function borrowed(api) { +const smPolVault = '0x31E8a6c0f710A42593917F1f53E3e13246E8102d' // smPOL (ERC-4626 over sPOL) + +async function seiTvl(api) { + await api.sumTokens({ tokensAndOwners: Object.entries(seiMPools).map(([pool, token]) => [token, pool]) }) + await api.sumTokens({ owners: seiStakingPools, tokens: [WSEI, ADDRESSES.null] }) + api.addGasToken(await api.multiCall({ abi: 'uint256:totalDelegated', calls: seiStakingPools })) +} + +async function polygonTvl(api) { + await api.sumTokens({ + tokensAndOwners: [ + ...Object.entries(polygonMPools).map(([pool, token]) => [token, pool]), + [SPOL, smPolVault], + ], + }) +} + +const borrowed = (mPools) => async (api) => { api.add(Object.values(mPools), await api.multiCall({ abi: 'uint256:totalBorrows', calls: Object.keys(mPools) })) } module.exports = { - methodology: 'TVL counts the underlying tokens held by the Marinus MPools and the SEI in the smSEI and srSEI staking pools (delegated plus liquid). Borrowed is the MPools totalBorrows.', + methodology: 'TVL counts the underlying tokens held by the Marinus MPools, the SEI in the smSEI and srSEI staking pools (delegated plus liquid), and the sPOL held by the smPOL vault on Polygon. Borrowed is the MPools totalBorrows.', hallmarks: [ ['2026-10-20', 'Marinus moves to Sei; Harmony markets retired'], + ['2026-11-12', 'Polygon markets and smPOL vault deployed'], ], harmony: { tvl: () => ({}), borrowed: () => ({}) }, - sei: { tvl, borrowed }, + sei: { tvl: seiTvl, borrowed: borrowed(seiMPools) }, + polygon: { tvl: polygonTvl, borrowed: borrowed(polygonMPools) }, } From 63c4b9a616fec78ace28bfe5b4324bfdbb459ece Mon Sep 17 00:00:00 2001 From: aidaonsui-collab Date: Thu, 12 Nov 2026 07:42:27 -0600 Subject: [PATCH 710/988] Add Kleos (Elysium) (#22166) Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/helper/tokenMapping.js | 2 + projects/kleos/index.js | 70 +++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 projects/kleos/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index e4bcbc3fb3c..98217eb9862 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -67,6 +67,8 @@ const fixBalancesTokens = { elysium: { '0x43ca3cee078d8cb8528915b16e8bdcc9adbe6090': { coingeckoId: 'hyperliquid', decimals: 18 }, '0xceeb06009b870430ac2872e3ba875ab6a9ab6699': { coingeckoId: 'hyperliquid', decimals: 18 }, + // Kleos's wrapped HYPE (WETH9-style), which KleosSwap pools are quoted in (https://thekleos.pro) + '0x0269031ace34a7821e9d9980d087c35ce7c19eef': { coingeckoId: 'hyperliquid', decimals: 18 }, }, } diff --git a/projects/kleos/index.js b/projects/kleos/index.js new file mode 100644 index 00000000000..855a79e5206 --- /dev/null +++ b/projects/kleos/index.js @@ -0,0 +1,70 @@ +// Kleos: a launchpad on Elysium (https://thekleos.pro). Every coin launches straight into a pool with its liquidity +// locked, so TVL is what sits in Kleos's own venues: +// - KleosSwap, Kleos's Uniswap v3-style DEX, where classic launches trade +// - Kleos's own Uniswap v4 PoolManager, where its v4 launches, $KLEOS-paired launches and its first v5 set trade +// - the Road to Core funds (HYPE backers put toward listing a coin on HyperCore) +// - the limit-order escrow (HYPE held for open buy orders) +// Kleos's current v5 coins trade on Uniswap's own v4 PoolManager on Elysium, which the Uniswap V4 adapter already counts, +// so they're left out here. $KLEOS, staked or sitting in +// Kleos's venues, is reported under staking. + +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { getLogs2 } = require('../helper/cache/getLogs') + +const KLEOSSWAP_FACTORY = '0x809ff79945FfFbf9B8Df33Bb3B62872CEB2efaF1' +const KLEOSSWAP_FROM_BLOCK = 7700 +const KLEOS_POOL_MANAGER = '0xb308B5df891c300a5f5a5b8fdBC30108bA842490' +const CORE_FUNDS = [ + '0x6274d0eB33e16BDf9B5Ebd97C7d43B054BF1F3e2', + '0x6aC6A8204Df95AD604eC138AEe1fE6C57D7D857B', // first launchpad's +] +const LIMIT_ESCROW = '0x10AffB1Fe0dCB8a2A6e34Cb6ccfa7cF26e116Ce4' + +const KLEOS = '0x51C343Ed5131F17895991849860B61C2cb0E7e7a' +const KLEOS_STAKING = '0xdd9Ece123c8c9EE95122B412871C52987E4aBcdD' +// Kleos's own wrapped HYPE, which KleosSwap pools are quoted in (mapped to HYPE in helper/tokenMapping.js). +const KLEOS_WHYPE = '0x0269031ace34a7821e9D9980d087c35cE7c19EEF' +// Tokens Kleos's v4 pools are quoted in besides HYPE and $KLEOS: BLOB (ElysPump) and KNTQ. +const V4_QUOTES = ['0x9a9815Af521149E8D982791703A31bca2F95f534', '0xe45a355d9e9cAd2aD85F2d03E3eE3102A036acF0'] + +const isKleos = (token) => token.toLowerCase() === KLEOS.toLowerCase() + +async function getPools(api) { + return getLogs2({ + api, + target: KLEOSSWAP_FACTORY, + fromBlock: KLEOSSWAP_FROM_BLOCK, + eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool)', + }) +} + +// Everything in Kleos's venues except $KLEOS, which goes to staking. +async function tvl(api) { + const pools = await getPools(api) + const ownerTokens = pools.map((p) => [[p.token0, p.token1].filter((t) => !isKleos(t)), p.pool]) + ownerTokens.push([[nullAddress, KLEOS_WHYPE, ADDRESSES.elysium.WHYPE, ...V4_QUOTES], KLEOS_POOL_MANAGER]) + ownerTokens.push([[nullAddress], CORE_FUNDS[0]], [[nullAddress], CORE_FUNDS[1]]) + ownerTokens.push([[nullAddress, KLEOS_WHYPE, ADDRESSES.elysium.WHYPE], LIMIT_ESCROW]) + return sumTokens2({ api, ownerTokens }) +} + +// $KLEOS in the staking contract, the v4 PoolManager and every KleosSwap pool paired with it. +async function staking(api) { + const pools = await getPools(api) + const kleosPools = pools.filter((p) => isKleos(p.token0) || isKleos(p.token1)).map((p) => p.pool) + return sumTokens2({ api, owners: [KLEOS_STAKING, KLEOS_POOL_MANAGER, ...kleosPools], tokens: [KLEOS] }) +} + +module.exports = { + methodology: + "TVL is the tokens held by Kleos's own venues on Elysium: every KleosSwap pool (Kleos's Uniswap v3-style DEX), " + + "Kleos's own Uniswap v4 PoolManager, the Road to Core funds and the limit-order escrow, excluding $KLEOS. Kleos v5 coins " + + "that trade on Uniswap's v4 PoolManager are counted by the Uniswap V4 adapter, so they're not counted again here. " + + "Staking is the $KLEOS held by the Kleos staking contract, the Kleos v4 PoolManager and the KleosSwap pools paired with $KLEOS.", + start: '2026-10-25', + elysium: { + tvl, + staking, + }, +} From e4515295bd096e01af37e08ec2b4a36276d4ed3a Mon Sep 17 00:00:00 2001 From: sasnes2000 Date: Thu, 12 Nov 2026 14:20:07 +0000 Subject: [PATCH 711/988] Add DeltaUSD on-chain TVL adapter (#22167) Co-authored-by: FelixBruguera --- projects/deltausd/index.js | 103 +++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 projects/deltausd/index.js diff --git a/projects/deltausd/index.js b/projects/deltausd/index.js new file mode 100644 index 00000000000..8612d325e0d --- /dev/null +++ b/projects/deltausd/index.js @@ -0,0 +1,103 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// DeltaUSD strategy/reserve wallet (receives USDT from the dUSD owner on BSC) +const owner = '0x12edd10a11fd9c94f9ac1b085a627f3745730899' +const dUSD = '0x1851302297e318d658829fd94b89d5ae6528cb9e' // dUSD token, also the mint/redeem contract +const operator = '0x929c98a6e23721f379b5e27cc694744a2b6d46c2' // dUSD owner + +// Aave V3-style pool data providers, one per chain where the wallet has positions +const aaveDataProviders = { + base: '0x0f43731eb8d45a581f4a36dd74f5f358bc90c73a', + xlayer: '0x6c505c31714f14e8af2a03633eb2cdfb4959138f', + plasma: '0xf2D6E38B407e31E7E7e4a16E6769728b76c7419F', +} + +const MORPHO = '0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb' +const morphoMarket = '0x2ea32f6f734f87db12a3b72cfe2b7381837f115411eb57171f672e2d03ed7cf7' // SOL loan / JitoSOL collateral + +const aeroPool = '0xf634058dc94e6bf8e828e27621320c423bc8b18e' +const aeroGauge = '0xd424ba8ca9d4e278753de76651a0095451e65cd1' +const avnt = '0x696f9436b67233384889472cd7cd58a6fb5df4f1' + +const dolomite = '0x003ca23fd5f0ca87d01f6ec6cd14a8ae60c2b97d' +const dolomiteAccounts = ['0', '53264408180604475640276221492191081784140241066643000915729132825556750807079'] +const kodiakIsland = '0xe5a2ab5d2fb268e5ff43a5564e44c3309609aff9' +const kodiakFarm = '0x75da1d58a8d97f7b626224e7e71fa44db13689f2' +const kodiakNft = '0xfe5e8c83ffe4d9627a75eaa7fee864768db989bd' +const sWBERA = '0x118d2ceee9785eaf70c15cd74cd84c9f8c3eec9a' + +// Supplied minus borrowed, per reserve; returns the reserve list so wallet balances of those tokens are counted too +async function addAave(api) { + const dataProvider = aaveDataProviders[api.chain] + const reserves = await api.call({ target: dataProvider, abi: 'function getAllReservesTokens() view returns ((string symbol, address tokenAddress)[])' }) + const tokens = reserves.map(r => r.tokenAddress) + const positions = await api.multiCall({ + target: dataProvider, + abi: 'function getUserReserveData(address asset, address user) view returns (uint256 currentATokenBalance, uint256 currentStableDebt, uint256 currentVariableDebt, uint256 principalStableDebt, uint256 scaledVariableDebt, uint256 stableBorrowRate, uint256 liquidityRate, uint40 stableRateLastUpdated, bool usageAsCollateralEnabled)', + calls: tokens.map(t => ({ params: [t, owner] })), + }) + positions.forEach((p, i) => api.add(tokens[i], BigInt(p.currentATokenBalance) - BigInt(p.currentStableDebt) - BigInt(p.currentVariableDebt))) + return tokens +} + +async function bsc(api) { + return sumTokens2({ api, owners: [dUSD, operator, owner], tokens: [ADDRESSES.bsc.USDT, ADDRESSES.null] }) +} + +async function base(api) { + const aaveTokens = await addAave(api) + + // Morpho Blue: collateral minus debt (shares converted at the market's last accrual) + const params = await api.call({ target: MORPHO, abi: 'function idToMarketParams(bytes32) view returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv)', params: morphoMarket }) + const market = await api.call({ target: MORPHO, abi: 'function market(bytes32) view returns (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee)', params: morphoMarket }) + const position = await api.call({ target: MORPHO, abi: 'function position(bytes32,address) view returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral)', params: [morphoMarket, owner] }) + api.add(params.collateralToken, position.collateral) + if (BigInt(market.totalBorrowShares) > 0n) + api.add(params.loanToken, -(BigInt(position.borrowShares) * BigInt(market.totalBorrowAssets) / BigInt(market.totalBorrowShares))) + + // Aerodrome LP staked in its gauge, unwrapped below + api.add(aeroPool, await api.call({ target: aeroGauge, abi: 'erc20:balanceOf', params: owner })) + + return sumTokens2({ api, owner, tokens: [...aaveTokens, params.loanToken, params.collateralToken, ADDRESSES.base.WETH, avnt, ADDRESSES.null], resolveLP: true }) +} + +async function xlayer(api) { + const tokens = await addAave(api) + return sumTokens2({ api, owner, tokens: [...tokens, ADDRESSES.null] }) +} + +async function plasma(api) { + const tokens = await addAave(api) + return sumTokens2({ api, owner, tokens: [...tokens, ADDRESSES.null] }) +} + +async function berachain(api) { + const accounts = await api.multiCall({ + target: dolomite, + abi: 'function getAccountBalances((address owner, uint256 number) account) view returns (uint256[], address[], (bool sign, uint128 value)[], (bool sign, uint256 value)[])', + calls: dolomiteAccounts.map(number => ({ params: [[owner, number]] })), + }) + const tokens = new Set([ADDRESSES.berachain.WBERA, sWBERA, kodiakIsland, ADDRESSES.null]) + for (const [, accountTokens, , values] of accounts) + accountTokens.forEach((token, i) => { + api.add(token, values[i].sign ? values[i].value : -BigInt(values[i].value)) + tokens.add(token) + }) + + // Kodiak island shares staked in its farm (island token is priced by coins) + api.add(kodiakIsland, await api.call({ target: kodiakFarm, abi: 'erc20:balanceOf', params: owner })) + + return sumTokens2({ api, owner, tokens: [...tokens], uniV3nftsAndOwners: [[kodiakNft, owner]] }) +} + +module.exports = { + timetravel: false, + doublecounted: true, + methodology: 'Counts configured on-chain DeltaUSD backing: BSC USDT at the dUSD mint/redeem contract, configured operator staging address and reserve wallet, wallet balances of tracked assets, proportional AMM deposits, owner-held Kodiak V3 NFT liquidity, deposits across the configured Aave Base, XLayer and Plasma pools, and the configured Base Morpho SOL/JitoSOL market. Subtracts Dolomite borrowing, all stable/variable debt across the configured lending pools, and Morpho debt. Excludes the Solana network, issued dUSD, Binance balances and futures, GoMining NFTs, unclaimed rewards/fees, and unconfigured positions including WETH/FAI and WETH/AVNT LPs. Assets deployed into other protocols overlap their TVL. This is a partial on-chain backing measure, not total reserves or a solvency attestation.', + bsc: { tvl: bsc }, + base: { tvl: base }, + xlayer: { tvl: xlayer }, + plasma: { tvl: plasma }, + berachain: { tvl: berachain }, +} From df93cce084db14d17b9db5a81309a01eba7e39ee Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 12 Nov 2026 10:44:22 -0400 Subject: [PATCH 712/988] track boxa (#22172) --- projects/boxa/index.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/boxa/index.js diff --git a/projects/boxa/index.js b/projects/boxa/index.js new file mode 100644 index 00000000000..866ab70d1e7 --- /dev/null +++ b/projects/boxa/index.js @@ -0,0 +1,42 @@ +// BOXA: a token launchpad on Elysium (https://boxa.club). Every coin launches into a Uniswap v4 pool whose hook is a BOXA +// hook that owns the launch liquidity. TVL is what sits in BOXA's own venues: +// - BOXA's own Uniswap v4 PoolManager, home of its first launches (boxaV4), its pair launches (boxaV4Pairs) and its +// meme-paired launches (boxaV4MemePairs) - addresses from the boxa.club front-end config, all deployed by 0x4ac872…ee2 +// - the limit-order escrow (HYPE held for open buy orders) +// Newer launches (boxaUni V1-V4 hooks) trade on Uniswap's own v4 PoolManager on Elysium, which the Uniswap V4 adapter already +// counts, so they're left out here. $BOXA in BOXA's PoolManager is reported under staking. + +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const BOXA_POOL_MANAGER = '0x06c63714fbf1f5753017123e2fcfdede4540b2c4' +const LIMIT_ORDERS = '0x346e65fb84ac7a1a8a9ebd4335d042c4ad61646b' +const BOXA = '0xa3c1d6a8648df3978a38ce1478fbc284c75d95d7' + +// Pair assets BOXA launches are quoted in besides native HYPE and $BOXA: WHYPE, KNTQ, wNVDAx and BLOB (ElysPump). +const QUOTES = [ + nullAddress, + '0xba876237b0f021a6c6d852d6c26e107997cc5e81', // WHYPE + '0xe45a355d9e9cad2ad85f2d03e3ee3102a036acf0', // KNTQ + '0x11265018bf2d5a99fb71efae73ad670203c1df44', // wNVDAx + '0x9a9815af521149e8d982791703a31bca2f95f534', // BLOB +] + +async function tvl(api) { + return sumTokens2({ api, owners: [BOXA_POOL_MANAGER, LIMIT_ORDERS], tokens: QUOTES }) +} + +async function staking(api) { + return sumTokens2({ api, owner: BOXA_POOL_MANAGER, tokens: [BOXA] }) +} + +module.exports = { + methodology: + "TVL is the pair assets (HYPE, WHYPE, KNTQ, wNVDAx, BLOB) held by BOXA's own Uniswap v4 PoolManager on Elysium, where its " + + "launch pools trade, plus HYPE escrowed for open limit orders. Launches on Uniswap's own v4 PoolManager are counted by the " + + "Uniswap V4 adapter, so they're not counted again here. Staking is the $BOXA held by BOXA's PoolManager.", + start: '2026-10-26', + elysium: { + tvl, + staking, + }, +} From 1c67dbde546ba333cea9abc1a2897db1ee34165a Mon Sep 17 00:00:00 2001 From: labs-alpha Date: Thu, 12 Nov 2026 15:44:33 +0100 Subject: [PATCH 713/988] alpha-launchpad: add Monad, Avalanche and Arbitrum (#22168) Co-authored-by: labs-alpha <332989026+labs-alpha@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- projects/alpha-launchpad/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/alpha-launchpad/index.js b/projects/alpha-launchpad/index.js index d6a237c4176..cc38644a89c 100644 --- a/projects/alpha-launchpad/index.js +++ b/projects/alpha-launchpad/index.js @@ -11,6 +11,9 @@ const config = { bsc: { factory: '0x71abe80C8f08ebE5dac018601170e687ED737AC3', fromBlock: 131062839 }, ethereum: { factory: '0x2DC4f507BD30c6b5df90B288FaeCDeCE627386Ec', fromBlock: 26320476 }, arc: { factory: '0x11A5ac5fC2A1e7D4bF61B781b0b784462C2BD9e7', fromBlock: 28998006 }, + monad: { factory: '0xB2Aa70bF167AEc63DBC49f14F12d4301E5a3c2A8', fromBlock: 121283239 }, + avax: { factory: '0xB2Aa70bF167AEc63DBC49f14F12d4301E5a3c2A8', fromBlock: 100053182 }, + arbitrum: { factory: '0xB2Aa70bF167AEc63DBC49f14F12d4301E5a3c2A8', fromBlock: 523406566 }, } async function tvl(api) { From 6a2a41b220f028844051683e42e8b3c3cad8eb90 Mon Sep 17 00:00:00 2001 From: maxusdebank Date: Thu, 12 Nov 2026 10:05:03 -0500 Subject: [PATCH 714/988] Add Hubble TVL adapter (#22169) Co-authored-by: FelixBruguera --- projects/hubble-sonic/index.js | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 projects/hubble-sonic/index.js diff --git a/projects/hubble-sonic/index.js b/projects/hubble-sonic/index.js new file mode 100644 index 00000000000..31be31be911 --- /dev/null +++ b/projects/hubble-sonic/index.js @@ -0,0 +1,43 @@ +const { staking } = require('../helper/staking') + +const HUBBLE = '0xd441a37aA73fc1DDd2db99FC4c92f233b7d41CBd' +const EX = '0xd4d197F3397C8F28f4BC2C698104CfbCC3e04802' +const XHUBBLE = '0x14D1Db2367312Ee3BBA54905b64f3bf0f0D677A8' // locked HUBBLE +const XEX = '0x13a67513c56c9E90D09d4163d233DaD819c2FC87' // locked EX +const STS = '0xE5DA20F15420aD15DE0fa650600aFc998bbE3955' + +const MISSION_CONTROL = '0xd268e36Ea3c1948284D40855cc2C26A71Ad07095' +const REDEEMER = '0x3C3cC567b7c8f98e7BD244E575FdE61016ef66B5' + +const HUBBLE_USDC_LP = '0x9ff1b68f8bedF4665fE358F92C3E9aF386cb295f' +const EX_STS_LP = '0x37be2fF30Efde8c05E8E4A59486Db82AEBC5d892' + +async function tvl(api) { + const redemptionPool = await api.call({ target: REDEEMER, abi: 'address:redemptionPool' }) + return api.sumTokens({ owner: redemptionPool, tokens: [STS] }) +} + +// Mission Control's share of each pair's token balances. The Shadow LPs have an empty symbol(), +// so resolveLP does not recognise them as LPs. +async function pool2(api) { + const lps = [HUBBLE_USDC_LP, EX_STS_LP] + const token0s = await api.multiCall({ abi: 'address:token0', calls: lps }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: lps }) + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: lps }) + const staked = await api.multiCall({ abi: 'erc20:balanceOf', calls: lps.map(lp => ({ target: lp, params: MISSION_CONTROL })) }) + const tokens = lps.flatMap((lp, i) => [[token0s[i], lp], [token1s[i], lp]]) + const pairBalances = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map(([token, lp]) => ({ target: token, params: lp })) }) + tokens.forEach(([token], j) => { + const i = Math.floor(j / 2) + api.add(token, BigInt(pairBalances[j]) * BigInt(staked[i]) / BigInt(supplies[i])) + }) +} + +module.exports = { + methodology: "TVL is the stS held in Hubble's active EX redemption pool. Staking is the HUBBLE and EX locked in xHUBBLE and xEX. Pool2 is the HUBBLE/USDC and EX/stS LP staked in Mission Control.", + sonic: { + tvl, + staking: staking([XHUBBLE, XEX], [HUBBLE, EX]), + pool2, + }, +} From 968c104c1484c67874188fff28876fca8214ffaf Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 12 Nov 2026 15:43:22 +0000 Subject: [PATCH 715/988] misc adapter fixes (#22171) --- projects/cian-yl/index.js | 10 +++++++++- projects/contango-v2/index.js | 3 ++- registries/curators.js | 7 +++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/projects/cian-yl/index.js b/projects/cian-yl/index.js index 21d70b5fe07..9dce7e70992 100644 --- a/projects/cian-yl/index.js +++ b/projects/cian-yl/index.js @@ -112,7 +112,15 @@ const tvl = async (api) => { await api.sumTokens({ token: '0xc152d5A599F83B3d0098cbAdb23FcE95F27Ff30B', owner: '0x821d2e44984168d278C698fD742d5138c01bAAA2' }) } - return await api.erc4626Sum({ calls: [...vaults, ...preVaults], isOG4626: true, permitFailure: true }) + const calls = [...vaults, ...preVaults] + const [tokens, totalAssets, underlyingTvl] = await Promise.all(['address:asset', 'uint256:totalAssets', 'uint256:underlyingTvl'] + .map(abi => api.multiCall({ abi, calls, permitFailure: true }))) + // totalAssets() reverts with PriceNotUpdated() on a stale vault price; underlyingTvl() is the same figure without that guard + tokens.forEach((token, i) => { + const balance = totalAssets[i] ?? underlyingTvl[i] + if (token && balance) api.add(token, balance) + }) + return api.getBalances() } Object.keys(config).forEach((chain) => { diff --git a/projects/contango-v2/index.js b/projects/contango-v2/index.js index 24cddcb5e9c..244af48276d 100644 --- a/projects/contango-v2/index.js +++ b/projects/contango-v2/index.js @@ -13,7 +13,8 @@ const excludedIds_arb = [ "0x574554485553444300000000000000000bffffffff00000000000000000001e8", "0x574554485553444300000000000000000bffffffff0000000000000000000309", "0x776545544857455448000000000000000bffffffff0000000000000000003099", - "0x777374455448574554480000000000000bffffffff00000000000000000010a7" + "0x777374455448574554480000000000000bffffffff00000000000000000010a7", + "0x54414e474f555344430000000000000010ffffffff0000000000000000005ace", // TANGO/USDC, lens returns 2.5B TANGO collateral (> 1B supply) and 1.69M USDC debt for a 429k TANGO (~$1.7k) position, so debt is excluded from borrowed too ]; const config = { diff --git a/registries/curators.js b/registries/curators.js index 41f09a837a9..078841efaa4 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -1507,12 +1507,19 @@ const configs = { '0x7054b25D47b9342dA3517AD41A4BD083De8D3f70', '0x7d07BFdd01422D7b655B333157eB551B9712dCd8', ], + excludedVaults: [ + '0x138c289Bb8b855CF271305C8bcf91DC31Ba30194', // Stream xUSD, collapsed Nov 2025 + ], }, ethereum: { eulerVaultOwners: [ '0x7054b25D47b9342dA3517AD41A4BD083De8D3f70', '0x7d07BFdd01422D7b655B333157eB551B9712dCd8', ], + excludedVaults: [ + '0xf1BA8c5Ca5aB011d06f31e64DaD313d204aCb9Eb', // Stream xUSD, price flaps 1.27 / 0.01 + '0x0f080Bf8Ba818001EcfB2f461708D8484323D0cE', // PT-xUSD-18DEC2025 + ], } } }, From f8dde172f62e22fc0ebaac7947b7fee2c3c1f1cf Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 12 Nov 2026 15:43:57 +0000 Subject: [PATCH 716/988] lista / saturn (#22163) --- projects/lista-lending/index.js | 37 ++++++++++++++++++++++++++++++- projects/saturn-protocol/index.js | 7 +++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/projects/lista-lending/index.js b/projects/lista-lending/index.js index 8ad7fd31a36..1bb5789b19e 100644 --- a/projects/lista-lending/index.js +++ b/projects/lista-lending/index.js @@ -8,7 +8,16 @@ const config = { ethereum: { vault: '0xf820fB4680712CD7263a0D3D024D5b5aEA82Fd70', start: 1758872495 }, // vault deployed at block 23445769 (2025-09-26) } +// Curator vaults counted under their own listing; their pro-rata market share is removed here to avoid double counting. +const excludedVaults = { + bsc: [{ address: '0x87e01662febb5145ff648c1fa7b73d81519d9c66', start: 1788497446 }], // Saturn USDT (saturn-protocol), deployed at block 119857679 (2026-09-04) +} + const abi = { + withdrawQueueLength: 'uint256:withdrawQueueLength', + withdrawQueue: 'function withdrawQueue(uint256) view returns (bytes32)', + position: + 'function position(bytes32,address) view returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral)', idToMarketParams: 'function idToMarketParams(bytes32) view returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv)', market: @@ -50,6 +59,29 @@ async function getAllMarketIds(api) { return list.map((m) => m.marketId).filter(Boolean) } +/** Removes the excluded vaults' share of each market's liquidity (supply - borrow) and, for borrowed, of its borrows. */ +async function subtractExcludedVaults(api, kind) { + for (const { address: excluded, start } of excludedVaults[api.chain] ?? []) { + if (api.timestamp < start) continue // vault not deployed yet, nothing to subtract + const { vault } = config[api.chain] + const length = await api.call({ target: excluded, abi: abi.withdrawQueueLength }) + const ids = await api.multiCall({ target: excluded, abi: abi.withdrawQueue, calls: Array.from({ length: Number(length) }, (_, i) => i) }) + const [params, markets, positions] = await Promise.all([ + api.multiCall({ target: vault, abi: abi.idToMarketParams, calls: ids }), + api.multiCall({ target: vault, abi: abi.market, calls: ids }), + api.multiCall({ target: vault, abi: abi.position, calls: ids.map((id) => ({ params: [id, excluded] })) }), + ]) + ids.forEach((_, i) => { + const { totalSupplyAssets, totalSupplyShares, totalBorrowAssets } = markets[i] + if (Number(totalSupplyShares) === 0) return + const share = BigInt(positions[i].supplyShares) + const supply = (share * BigInt(totalSupplyAssets)) / BigInt(totalSupplyShares) + const borrow = (share * BigInt(totalBorrowAssets)) / BigInt(totalSupplyShares) + api.add(params[i].loanToken, (kind === 'tvl' ? supply - borrow : borrow) * -1n) + }) + } +} + async function tvl(api) { const { vault, start } = config[api.chain] if (start && api.timestamp < start) return {} @@ -61,7 +93,9 @@ async function tvl(api) { calls: marketIds, }) const tokens = marketInfos.flatMap((i) => [i.collateralToken, i.loanToken]) - return api.sumTokens({ tokens, owner: vault }) + await api.sumTokens({ tokens, owner: vault }) + await subtractExcludedVaults(api, 'tvl') + return api.getBalances() } async function borrowed(api) { @@ -76,6 +110,7 @@ async function borrowed(api) { const loanTokens = marketInfos.map((i) => i.loanToken) const borrowedAmounts = marketData.map((m) => m.totalBorrowAssets) api.add(loanTokens, borrowedAmounts) + await subtractExcludedVaults(api, 'borrowed') return api.getBalances() } diff --git a/projects/saturn-protocol/index.js b/projects/saturn-protocol/index.js index 020b0e75fe3..e4a85a3b163 100644 --- a/projects/saturn-protocol/index.js +++ b/projects/saturn-protocol/index.js @@ -12,7 +12,9 @@ const USDC = ADDRESSES.ethereum.USDC; const VAULTS = { ethereum: ['0xAbe418cc8c06D265E4EB009C02eA4B265eCA7240'], monad: ['0x75753e494e5e374C52E1d84fc04EB14B10F2C079'], + bsc: ['0x87e01662febb5145ff648c1fa7b73d81519d9c66'], // Lista USDT vault; excluded from lista-lending }; +const BSC_VAULT_START = 1788497446; // vault deployed at block 119857679 (2026-09-04) async function vaultTvl(api) { const vaults = VAULTS[api.chain]; @@ -53,11 +55,14 @@ async function tvl(api) { } module.exports = { - methodology: "USDat backing (the PYUSDx reserve, legacy $M, and USDC held by the USDat contract) plus the STRC digital-credit backing of sUSDat, priced via DefiLlama's tradfi STRC feed (NASDAQ: STRC), plus USDC deposits in Saturn's co-curated Morpho vaults on Ethereum and Monad.", + methodology: "USDat backing (the PYUSDx reserve, legacy $M, and USDC held by the USDat contract) plus the STRC digital-credit backing of sUSDat, priced via DefiLlama's tradfi STRC feed (NASDAQ: STRC), plus USDC deposits in Saturn's co-curated Morpho vaults on Ethereum and Monad and its Lista USDT vault on BSC.", ethereum: { tvl, }, monad: { tvl: vaultTvl, }, + bsc: { + tvl: (api) => api.timestamp < BSC_VAULT_START ? {} : vaultTvl(api), + }, }; From 1001b07b28f8e8d6bc631b9c25f2e4cdb2cc909c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 12 Nov 2026 18:33:40 +0100 Subject: [PATCH 717/988] valdora: support refill --- projects/helper/coreAssets.json | 5 ++++- projects/helper/tokenMapping.js | 17 ----------------- projects/valdora/index.js | 34 ++++++++++++++++++--------------- 3 files changed, 23 insertions(+), 33 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 8e7ca8388d9..be09d9edde1 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -2936,6 +2936,9 @@ "USDC": "0xb47c4C8F73F009CC0C0d3f92B388d13E293F0B65", "USDT0": "0x3BdE42a1dA8F1D95564f2c4a51a0cF73a725674C", "UBTC": "0xE9C29585EAe4B9a55b02a9605AEa892B40d972E8", - "UETH": "0x7A66A75fe41Bc26867C17fe1bc7D1C076EBd4eCd" + "UETH": "0x7A66A75fe41Bc26867C17fe1bc7D1C076EBd4eCd", + "WHYPE_1": "0x43ca3cee078d8cb8528915b16e8bdcc9adbe6090", + "WHYPE_2": "0xceeb06009b870430ac2872e3ba875ab6a9ab6699", + "WHYPE_3": "0x0269031ace34a7821e9d9980d087c35ce7c19eef" } } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 98217eb9862..9ff97e075ca 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -53,23 +53,6 @@ const fixBalancesTokens = { 'pm.pool.asset.3hjz8rcr3pejdc3msntlvy': { coingeckoId: 'usd-coin', decimals: 0 }, 'pm.pool.asset.1y3flutqcyuf8duew1vj2g': { coingeckoId: 'usd-coin', decimals: 0 }, }, - // ZIGChain v5 migrates the native denom from uzig (6 decimals) to azig (18 decimals); - // azig is not priced under zigchain:azig by the coins service yet - zigchain: { - azig: { coingeckoId: 'zignaly', decimals: 18 }, - }, - // the coins service has no platon: entry for the gas token - platon: { - [ADDRESSES.null]: { coingeckoId: 'platon-network', decimals: 18 }, - }, - // Elysium (Kinetiq's Hyperliquid L2): wrapped HYPE used by ArkhamPad pools, and the WETH9-bytecode wrapped HYPE - // Gully Core's pools are quoted in (deployment record: https://github.com/gully-labs/gully-core); neither is priced by the coins service - elysium: { - '0x43ca3cee078d8cb8528915b16e8bdcc9adbe6090': { coingeckoId: 'hyperliquid', decimals: 18 }, - '0xceeb06009b870430ac2872e3ba875ab6a9ab6699': { coingeckoId: 'hyperliquid', decimals: 18 }, - // Kleos's wrapped HYPE (WETH9-style), which KleosSwap pools are quoted in (https://thekleos.pro) - '0x0269031ace34a7821e9d9980d087c35ce7c19eef': { coingeckoId: 'hyperliquid', decimals: 18 }, - }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/valdora/index.js b/projects/valdora/index.js index ed1548112c7..315bb5b28e2 100644 --- a/projects/valdora/index.js +++ b/projects/valdora/index.js @@ -1,30 +1,34 @@ -const { queryContract } = require('../helper/chain/cosmos'); -const { transformBalances } = require('../helper/portedTokens'); +const sdk = require('@defillama/sdk'); +const cosmos = sdk.chains.cosmos; +const chain = 'zigchain'; const VALDORA_STAKER_CONTRACT = 'zig18nnde5tpn76xj3wm53n0tmuf3q06nruj3p6kdemcllzxqwzkpqzqk7ue55'; -async function fetchStakerAUM() { - const { funds_raised } = await queryContract({ +// historical runs query state at the block of the requested timestamp +// (the public LCD only retains a few weeks of state, older timestamps throw) +async function getBlock(api) { + const isHistorical = api.timestamp && Date.now() / 1e3 - api.timestamp > 3600; + if (!isHistorical) return undefined; + if (api.block) return api.block; + const { number } = await cosmos.getBlockAtTimestamp({ chain, timestamp: api.timestamp }); + return number; +} + +async function fetchStakerAUM(api) { + const { funds_raised } = await cosmos.queryContract({ + chain, contract: VALDORA_STAKER_CONTRACT, - chain: 'zigchain', data: { funds_raised: {} }, + block: await getBlock(api), }); - if (!funds_raised || funds_raised === '0') return null; - return funds_raised; + api.add('azig', funds_raised); } async function tvl(api) { - const balances = api.getBalances(); - - const stakerAum = await fetchStakerAUM(); - if (stakerAum) balances['zigchain:azig'] = stakerAum; - - return transformBalances('zigchain', balances); + return fetchStakerAUM(api); } module.exports = { - timetravel: false, - misrepresentedTokens: false, methodology: "Total ZIG deposited into Valdora liquid staking. The stZIG receipt token is excluded to avoid double-counting. Valdora Vaults (short-duration private credit) are real-world assets tracked on the RWA dashboard, not in TVL.", zigchain: { tvl }, }; From c4d25183223a47d0dae78185b14689f09683609c Mon Sep 17 00:00:00 2001 From: "Nox.Fund" Date: Thu, 12 Nov 2026 18:05:17 +0000 Subject: [PATCH 718/988] Add NoxFund protocol adapter (#22170) Co-authored-by: FelixBruguera --- registries/sumTokens.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index aa71465859b..bb5a112b771 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -20714,6 +20714,10 @@ const configs = { ] }, }, + "noxfund": { + "methodology": "Counts the USDT held in the NoxFund contract.", + "bsc": { owner: '0x433830E36585bdACC840E1caB419C4211bBf13f5', tokens: [ADDRESSES.bsc.USDT] }, + }, "nord-finance": { "ethereum": { "tvl": { From edc850a4b792a6228a3f36f175c026462fcbc177 Mon Sep 17 00:00:00 2001 From: busy20771 <120372104+busy20771@users.noreply.github.com> Date: Fri, 13 Nov 2026 03:05:17 +0800 Subject: [PATCH 719/988] Add wstO Vault (o1.exchange) (#22173) Co-authored-by: FelixBruguera --- registries/stakingOnly.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/registries/stakingOnly.js b/registries/stakingOnly.js index 14ad6847b34..56571511f4d 100644 --- a/registries/stakingOnly.js +++ b/registries/stakingOnly.js @@ -52,6 +52,11 @@ const configs = { ], }, }, + 'o1-wsto-vault': { + methodology: "Counts the O tokens held by each chain's wstO vault as staking.", + robinhood: { staking: ['0xE92bD1C05E4E308792003C8205127A6FA662b4D4', '0x500A02a20B0B0A3F3efCCFc0559543F5743bd1C4'] }, + base: { staking: ['0x80C6BAE89B636c6Ee96FE8F198c0D6926C2C91df', '0x182FA643E5f29d5EcA75e7b9CF9336A3fe4620b2'] }, + }, 'onecash': { misrepresentedTokens: true, methodology: "Counts liquidty on the Staking and Pool2 Only", From f222502db7353ed79ffa47a10ac177da84a76487 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 12 Nov 2026 16:23:05 -0400 Subject: [PATCH 720/988] include commit link for registry additions in unlisted alerts (#22174) --- scripts/buildImports.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/scripts/buildImports.js b/scripts/buildImports.js index 78c078d1601..66ea21d4aa0 100644 --- a/scripts/buildImports.js +++ b/scripts/buildImports.js @@ -100,7 +100,7 @@ async function run() { // stamp each module with the commit that added its file (meta.addedCommit), // so consumers (born-to-llama bot) do not need a local clone for commit links try { - const { fileMap, dirMap, createdMap } = getGitAddedInfo() + const { fileMap, dirMap, createdMap, registryKeyMap } = getGitAddedInfo() for (const [modulePath, moduleObject] of Object.entries(moduleMap)) { if (!moduleObject || typeof moduleObject !== 'object') continue const path = `projects/${modulePath}` @@ -112,6 +112,8 @@ async function run() { ?? dirMap[path.replace(/\/index\.js$/, '')] ?? createdMap[path] ?? createdMap[`${path}.js`] + // registry adapters are a key inside a shared registries/ file, not a file of their own + ?? registryKeyMap[modulePath.replace(/\.js$/, '').replace(/\/index$/, '')] if (commit) { if (!moduleObject.meta) moduleObject.meta = {} moduleObject.meta.addedCommit = commit @@ -164,6 +166,8 @@ function convertHallmarkStrings(hallmarks) { // dirMap: directory path -> commit that added the first file under it (adapter creation) // createdMap: file path -> oldest commit that touched it, i.e. the commit that // created it (fallback for files that never show as added) +// registryKeyMap: registry key -> oldest commit whose diff added that key at the +// top level of a registries/ or cex/ config object function getGitAddedInfo() { const { execSync } = require("child_process") @@ -198,7 +202,24 @@ function getGitAddedInfo() { const added = walk('--diff-filter=A', false) const touched = walk('', true) - return { fileMap: added.fileMap, dirMap: added.dirMap, createdMap: touched.fileMap } + return { fileMap: added.fileMap, dirMap: added.dirMap, createdMap: touched.fileMap, registryKeyMap: walkRegistryKeys() } + + function walkRegistryKeys() { + const output = execSync('git log --first-parent --no-renames --format="%H|" -p --unified=0 -- registries/ cex/', { maxBuffer: 1024 * 1024 * 512 }).toString() + const keyMap = {} + let commit = null + for (const line of output.split('\n')) { + if (line.length === 41 && line[40] === '|' && /^[0-9a-f]{40}$/.test(line.slice(0, 40))) { + commit = line.slice(0, 40) + continue + } + // added top level entry, e.g. `+ "h10x": {` or `+ 'o1-wsto-vault': {` + const match = /^\+ ['"]?([\w.$/-]+)['"]?\s*:/.exec(line) + // log is newest-first: overwriting keeps the oldest commit that added the key + if (match && commit) keyMap[match[1]] = commit + } + return keyMap + } } //Replace all fuctions with mock functions in an object all the way down From 2dcb204053f717d996e7249eddbc2245411c7aa5 Mon Sep 17 00:00:00 2001 From: bheluga Date: Fri, 13 Nov 2026 07:28:23 +0000 Subject: [PATCH 721/988] track synthra and stockiumswap tvl on elysium (#22178) --- projects/synthra-v3/index.js | 4 ++++ registries/uniswapV3.js | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/projects/synthra-v3/index.js b/projects/synthra-v3/index.js index 86c39f27e09..94c4b72dd34 100644 --- a/projects/synthra-v3/index.js +++ b/projects/synthra-v3/index.js @@ -13,6 +13,10 @@ const CONFIG = { { factory: '0x6307fc239C7964942c1BfFE51930E55606619c74', fromBlock: 12953009 }, // V3 { factory: '0x84169f9adf4f5f0e483bfc350498a85b1d7ec638', fromBlock: 21893415 }, // V3.1 ], + // https://docs.synthra.org/docs/contract-addresses: + elysium: [ + { factory: '0x6307fc239C7964942c1BfFE51930E55606619c74', fromBlock: 105690 }, + ], } async function tvl(api, factories) { diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 105cc0bc5fa..27b63e309fa 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1983,6 +1983,11 @@ const uniV3Configs = { methodology: 'TVL is the tokens held in Kalos DEX pools, the Uniswap V3 pools created by the Kalos factory (found from its PoolCreated events).', elysium: { factory: '0x8C60243181370bDA9A7d1a45b1249A8263da0158', fromBlock: 915221 }, }, + 'stockiumswap': { + start: '2026-10-29', + methodology: 'TVL is the tokens held in StockiumSwap pools, the Uniswap V3 pools created by the StockiumSwap factory on Elysium (found from its PoolCreated events).', + elysium: { factory: '0x4F66184A9FFabB7f7071D590C2c48DEDf41676f4', fromBlock: 42214 }, + }, } module.exports = buildProtocolExports(uniV3Configs, uniV3Export) From 45b14e21563ea63163724e7036409fa7374c270f Mon Sep 17 00:00:00 2001 From: octoman-molina Date: Fri, 13 Nov 2026 03:22:44 -0500 Subject: [PATCH 722/988] Add Drakewell SPYdw; count its USDdw floor once (#22176) Co-authored-by: Rob --- projects/drakewell-spydw/index.js | 26 ++++++++++++++++++++++++++ projects/jusd-finance/index.js | 8 ++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 projects/drakewell-spydw/index.js diff --git a/projects/drakewell-spydw/index.js b/projects/drakewell-spydw/index.js new file mode 100644 index 00000000000..a7c54a979ee --- /dev/null +++ b/projects/drakewell-spydw/index.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// SPYdw (Drakewell) is a principal-protected S&P 500 note. Each deposit is split: the option premium +// buys XSP calls off-chain (at IBKR) and the rest is deposited into USDdw, Drakewell's Accountable vault +// on Ethereum, and held by the SPYdw contract as the principal floor. +// TVL counts what SPYdw holds on-chain: its USDdw shares, valued with the vault's convertToAssets(), plus +// USDC held by the contract (deposit requests waiting to be filled). The off-chain calls are not counted. +// The same USDdw shares are subtracted from the Drakewell USDdw listing, so nothing is counted twice. +const SPYDW = '0x88e570F58881d8b200CA58B5a050fb5C9BAC8deb' +const USDDW = '0x2B5895b716311A1eaC8f93fB88C56aF9eC8C1A69' // Drakewell USDdw vault (Accountable) + +async function tvl(api) { + const shares = await api.call({ target: USDDW, abi: 'erc20:balanceOf', params: [SPYDW] }) + if (shares > 0) { + const assets = await api.call({ target: USDDW, abi: 'function convertToAssets(uint256) view returns (uint256)', params: [shares] }) + api.add(ADDRESSES.ethereum.USDC, assets) + } + return api.sumTokens({ owner: SPYDW, tokens: [ADDRESSES.ethereum.USDC] }) +} + +module.exports = { + methodology: 'TVL is what the SPYdw contract holds on-chain: its USDdw shares (the principal floor of each note, deposited into the Drakewell USDdw vault on Ethereum and valued with convertToAssets()) plus USDC waiting in the contract for deposit requests. The S&P 500 call options bought with each deposit\'s premium are held off-chain and are not counted. The USDdw shares are subtracted from the Drakewell USDdw listing, so they are counted once within Drakewell. The USDdw vault is also part of Accountable, so this listing is marked as double counted.', + doublecounted: true, + start: 1793734883, // SPYdw deployment, 3 Nov 2026 (block 26336431) + ethereum: { tvl }, +} diff --git a/projects/jusd-finance/index.js b/projects/jusd-finance/index.js index e2f58b6bc80..e27e2b07c0d 100644 --- a/projects/jusd-finance/index.js +++ b/projects/jusd-finance/index.js @@ -19,6 +19,7 @@ const USDC = { const ALEO_ADAPTER = '0x65DD658a02FaAdD866423cc08Dde9c89fFE345aA' // Ethereum side of the Aleo vault const ALEO_ADAPTER_BLOCK = 26096619 // adapter deployment (1 Oct 2026) const ALEO_VAULT = 'aleo1dkf9r56swfvdd62n0wjx083jqqjkk0yrrh304gwv8ntft7lpdggqplajaa' // jusd_vault_arc_production.aleo, live since 22 Oct 2026 +const SPYDW = '0x88e570F58881d8b200CA58B5a050fb5C9BAC8deb' // Drakewell SPYdw; holds USDdw as each note's principal floor (listed separately) const adapterStateAbi = 'function state() view returns (uint256 usdcBal, uint256 jusdBal, uint256 pending, uint256 claimable)' const convertToAssetsAbi = 'function convertToAssets(uint256) view returns (uint256)' @@ -32,7 +33,10 @@ async function aleoPosition(ethApi) { async function tvl(api) { const vault = VAULTS[api.chain] let shares = BigInt(await api.call({ target: vault, abi: 'erc20:totalSupply' })) - if (api.chain === 'ethereum') shares -= (await aleoPosition(api)).shares // counted on Aleo instead + if (api.chain === 'ethereum') { + shares -= (await aleoPosition(api)).shares // counted on Aleo instead + shares -= BigInt(await api.call({ target: vault, abi: 'erc20:balanceOf', params: [SPYDW] })) // counted under Drakewell SPYdw instead + } const assets = await api.call({ target: vault, abi: convertToAssetsAbi, params: [shares.toString()] }) api.add(USDC[api.chain], assets) } @@ -59,7 +63,7 @@ async function aleoUsdcx() { } module.exports = { - methodology: 'TVL is the USDC value of USDdw on each chain it is issued on: the Accountable vault on Ethereum and the Venzo vault on Arbitrum (share supply valued with convertToAssets(), covering idle USDC and capital allocated to strategies, principally delta-neutral funding trades plus lending), and USDdw_vault_arc_production.aleo on Aleo. Aleo deposits are bridged to Ethereum and held as Ethereum USDdw by the vault\'s adapter; that position is counted on Aleo, where the deposits were made, and subtracted from Ethereum, so nothing is counted twice. The Ethereum vault is also part of Accountable, so this listing is marked as double counted.', + methodology: 'TVL is the USDC value of USDdw on each chain it is issued on: the Accountable vault on Ethereum and the Venzo vault on Arbitrum (share supply valued with convertToAssets(), covering idle USDC and capital allocated to strategies, principally delta-neutral funding trades plus lending), and jusd_vault_arc_production.aleo on Aleo. Aleo deposits are bridged to Ethereum and held as Ethereum USDdw by the vault\'s adapter; that position is counted on Aleo, where the deposits were made, and subtracted from Ethereum, so nothing is counted twice. USDdw held by Drakewell SPYdw as its principal floor is counted under that listing and subtracted here. The Ethereum vault is also part of Accountable, so this listing is marked as double counted.', doublecounted: true, ethereum: { tvl }, arbitrum: { tvl }, From d6ee4a194e9745fe3f361b0583854078d7f0d778 Mon Sep 17 00:00:00 2001 From: NARAProtocol Date: Fri, 13 Nov 2026 10:23:07 +0200 Subject: [PATCH 723/988] treasury/nara: unwrap Aerodrome Slipstream POL positions and include AERO (#22177) --- projects/treasury/nara.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/treasury/nara.js b/projects/treasury/nara.js index 71a846983c4..bd0895616c4 100644 --- a/projects/treasury/nara.js +++ b/projects/treasury/nara.js @@ -9,6 +9,7 @@ const NARA_TOKEN = '0x91FB78A9F46B67f54BbD4489941d19666b2fAe0f' const BASE_USDC = ADDRESSES.base.USDC const BASE_WETH = ADDRESSES.base.WETH const BASE_CBBTC = ADDRESSES.base.cbBTC +const BASE_AERO = ADDRESSES.base.AERO const TREASURY_SAFE = '0xe320C281c86079eA85f2Bc67864E873A61D551E3' const ACTIVE_RANGE_MANAGER_V5 = '0x221c625d2BC416460C397035C1286C1f4A4D3A7C' @@ -95,10 +96,11 @@ async function getActiveV4PolPositionIds(api) { const treasury = treasuryExports({ base: { - tokens: [nullAddress, BASE_USDC, BASE_WETH, BASE_CBBTC], + tokens: [nullAddress, BASE_USDC, BASE_WETH, BASE_CBBTC, BASE_AERO], owners: TREASURY_OWNERS, ownTokens: [NARA_TOKEN], resolveUniV3: true, + resolveSlipstream: true, fetchCoValentTokens: false, }, }) @@ -122,7 +124,7 @@ treasury.base.tvl = async (api) => { resolveUniV4: true, uniV4ExtraConfig: { positionIds, - whitelistedTokens: [nullAddress, BASE_USDC, BASE_WETH, BASE_CBBTC], + whitelistedTokens: [nullAddress, BASE_USDC, BASE_WETH, BASE_CBBTC, BASE_AERO], }, blacklistedTokens: [NARA_TOKEN], }) @@ -152,7 +154,7 @@ treasury.base.ownTokens = async (api) => { positionIds, whitelistedTokens: [NARA_TOKEN], }, - blacklistedTokens: [nullAddress, BASE_USDC, BASE_WETH, BASE_CBBTC], + blacklistedTokens: [nullAddress, BASE_USDC, BASE_WETH, BASE_CBBTC, BASE_AERO], }) } @@ -161,6 +163,6 @@ treasury.base.ownTokens = async (api) => { module.exports = { methodology: - 'Treasury TVL counts non-NARA reserves (ETH, USDC, WETH, cbBTC) held in the NARA Treasury Safe, NARATreasuryRangeManagerV5, NARAFeeVaultV5 (including Uniswap v4 ERC-6909 POL claims), NARACapitalBudgetV5, and Protocol-Owned Liquidity (POL) across Uniswap v4 and Uniswap v3. Protocol NARA held in those contracts and LP positions is reported separately under ownTokens, excluding unissued NARAEmissionReserveV5 reserves.', + 'Treasury TVL counts non-NARA reserves (ETH, USDC, WETH, cbBTC, AERO) held in the NARA Treasury Safe, NARATreasuryRangeManagerV5, NARAFeeVaultV5 (including Uniswap v4 ERC-6909 POL claims), NARACapitalBudgetV5, and Protocol-Owned Liquidity (POL) across Uniswap v4, Uniswap v3, and Aerodrome Slipstream. Protocol NARA held in those contracts and LP positions is reported separately under ownTokens, excluding unissued NARAEmissionReserveV5 reserves.', ...treasury, } From d1e62e143f5503da55ef433f7719e731c0d45625 Mon Sep 17 00:00:00 2001 From: sasnes2000 Date: Fri, 13 Nov 2026 10:43:11 +0000 Subject: [PATCH 724/988] DeltaUSD: add X Layer Aave and Mantle Dolomite reserves (#22175) --- projects/deltausd/index.js | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/projects/deltausd/index.js b/projects/deltausd/index.js index 8612d325e0d..d43d571a051 100644 --- a/projects/deltausd/index.js +++ b/projects/deltausd/index.js @@ -3,6 +3,8 @@ const { sumTokens2 } = require('../helper/unwrapLPs') // DeltaUSD strategy/reserve wallet (receives USDT from the dUSD owner on BSC) const owner = '0x12edd10a11fd9c94f9ac1b085a627f3745730899' +// Additional X Layer Aave account identified by the operator as dUSD backing +const xlayerAaveOwner = '0xacc5b404eb5b31728e225040830162a9482a81f9' const dUSD = '0x1851302297e318d658829fd94b89d5ae6528cb9e' // dUSD token, also the mint/redeem contract const operator = '0x929c98a6e23721f379b5e27cc694744a2b6d46c2' // dUSD owner @@ -22,20 +24,23 @@ const avnt = '0x696f9436b67233384889472cd7cd58a6fb5df4f1' const dolomite = '0x003ca23fd5f0ca87d01f6ec6cd14a8ae60c2b97d' const dolomiteAccounts = ['0', '53264408180604475640276221492191081784140241066643000915729132825556750807079'] +const mantleDolomite = '0xe6ef4f0b2455bab92ce7cc78e35324ab58917de8' +// Account numbers discovered in Dolomite's subgraph and verified on-chain for the reserve owner +const mantleDolomiteAccounts = ['0', '94109458643557659221009538510460159269947386444327873651138030750987690255911'] const kodiakIsland = '0xe5a2ab5d2fb268e5ff43a5564e44c3309609aff9' const kodiakFarm = '0x75da1d58a8d97f7b626224e7e71fa44db13689f2' const kodiakNft = '0xfe5e8c83ffe4d9627a75eaa7fee864768db989bd' const sWBERA = '0x118d2ceee9785eaf70c15cd74cd84c9f8c3eec9a' // Supplied minus borrowed, per reserve; returns the reserve list so wallet balances of those tokens are counted too -async function addAave(api) { +async function addAave(api, account = owner) { const dataProvider = aaveDataProviders[api.chain] const reserves = await api.call({ target: dataProvider, abi: 'function getAllReservesTokens() view returns ((string symbol, address tokenAddress)[])' }) const tokens = reserves.map(r => r.tokenAddress) const positions = await api.multiCall({ target: dataProvider, abi: 'function getUserReserveData(address asset, address user) view returns (uint256 currentATokenBalance, uint256 currentStableDebt, uint256 currentVariableDebt, uint256 principalStableDebt, uint256 scaledVariableDebt, uint256 stableBorrowRate, uint256 liquidityRate, uint40 stableRateLastUpdated, bool usageAsCollateralEnabled)', - calls: tokens.map(t => ({ params: [t, owner] })), + calls: tokens.map(t => ({ params: [t, account] })), }) positions.forEach((p, i) => api.add(tokens[i], BigInt(p.currentATokenBalance) - BigInt(p.currentStableDebt) - BigInt(p.currentVariableDebt))) return tokens @@ -64,6 +69,7 @@ async function base(api) { async function xlayer(api) { const tokens = await addAave(api) + await addAave(api, xlayerAaveOwner) return sumTokens2({ api, owner, tokens: [...tokens, ADDRESSES.null] }) } @@ -91,13 +97,29 @@ async function berachain(api) { return sumTokens2({ api, owner, tokens: [...tokens], uniV3nftsAndOwners: [[kodiakNft, owner]] }) } +async function mantle(api) { + const accounts = await api.multiCall({ + target: mantleDolomite, + abi: 'function getAccountBalances((address owner, uint256 number) account) view returns (uint256[], address[], (bool sign, uint128 value)[], (bool sign, uint256 value)[])', + calls: mantleDolomiteAccounts.map(number => ({ params: [[owner, number]] })), + }) + const tokens = new Set([ADDRESSES.mantle.USDT, ADDRESSES.null]) + for (const [, accountTokens, , values] of accounts) + accountTokens.forEach((token, i) => { + api.add(token, values[i].sign ? values[i].value : -BigInt(values[i].value)) + tokens.add(token) + }) + return sumTokens2({ api, owner, tokens: [...tokens] }) +} + module.exports = { timetravel: false, doublecounted: true, - methodology: 'Counts configured on-chain DeltaUSD backing: BSC USDT at the dUSD mint/redeem contract, configured operator staging address and reserve wallet, wallet balances of tracked assets, proportional AMM deposits, owner-held Kodiak V3 NFT liquidity, deposits across the configured Aave Base, XLayer and Plasma pools, and the configured Base Morpho SOL/JitoSOL market. Subtracts Dolomite borrowing, all stable/variable debt across the configured lending pools, and Morpho debt. Excludes the Solana network, issued dUSD, Binance balances and futures, GoMining NFTs, unclaimed rewards/fees, and unconfigured positions including WETH/FAI and WETH/AVNT LPs. Assets deployed into other protocols overlap their TVL. This is a partial on-chain backing measure, not total reserves or a solvency attestation.', + methodology: 'Counts tracked on-chain DeltaUSD reserve balances and DeFi positions, minus borrowing. Excludes issued dUSD, off-chain assets and untracked positions. DeFi deposits are also counted in the TVL of the protocols used.', bsc: { tvl: bsc }, base: { tvl: base }, xlayer: { tvl: xlayer }, plasma: { tvl: plasma }, berachain: { tvl: berachain }, + mantle: { tvl: mantle }, } From 42888784a02e6f5d4d10ced2605696f7bc5c7592 Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Fri, 13 Nov 2026 11:49:22 +0100 Subject: [PATCH 725/988] curve: add Twocrypto-NG factory on gnosis (#22179) --- projects/curve/contracts.json | 6 +++++- projects/curve/index.js | 14 +++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/projects/curve/contracts.json b/projects/curve/contracts.json index 4eab3e3d05a..3dd3c4bc299 100644 --- a/projects/curve/contracts.json +++ b/projects/curve/contracts.json @@ -158,7 +158,11 @@ "metapoolBases": { "3CRV": "0x1337bedc9d22ecbe766df105c9623922a27963ec" }, - "CurveStableswapFactoryNG": "0xbC0797015fcFc47d9C1856639CaE50D0e69FbEE8" + "CurveStableswapFactoryNG": "0xbC0797015fcFc47d9C1856639CaE50D0e69FbEE8", + "CurveTwocryptoFactoryNG": "0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F", + "startBlocks": { + "CurveTwocryptoFactoryNG": 31618034 + } }, "moonbeam": { "addressProvider": "0x0000000022D53366457F9d5E68Ec105046FC4383", diff --git a/projects/curve/index.js b/projects/curve/index.js index 0475c847949..529abc1f23e 100644 --- a/projects/curve/index.js +++ b/projects/curve/index.js @@ -132,7 +132,7 @@ function getRegistryType(registryId) { return registryIdsReverse[registryId] } -async function getPools(block, chain) { +async function getPools(block, chain, api) { let { registriesMapping, addressProvider } = contracts[chain] if (!registriesMapping) { registriesMapping = {}; @@ -147,13 +147,17 @@ async function getPools(block, chain) { .forEach(({ input: { params: [registryId] }, output: { addr } }) => registriesMapping[getRegistryType(registryId)] = addr) } } - if (contracts[chain].CurveStableswapFactoryNG) { + // factories added to a chain after its first deployment list their deployment block, earlier dates skip them + const { startBlocks = {} } = contracts[chain] + const currentBlock = Object.keys(startBlocks).length ? await api.getBlock() : undefined + const isDeployed = name => !startBlocks[name] || currentBlock >= startBlocks[name] + if (contracts[chain].CurveStableswapFactoryNG && isDeployed('CurveStableswapFactoryNG')) { registriesMapping.CurveStableswapFactoryNG = contracts[chain].CurveStableswapFactoryNG } - if (contracts[chain].CurveTricryptoFactoryNG) { + if (contracts[chain].CurveTricryptoFactoryNG && isDeployed('CurveTricryptoFactoryNG')) { registriesMapping.CurveTricryptoFactoryNG = contracts[chain].CurveTricryptoFactoryNG } - if (contracts[chain].CurveTwocryptoFactoryNG) { + if (contracts[chain].CurveTwocryptoFactoryNG && isDeployed('CurveTwocryptoFactoryNG')) { registriesMapping.CurveTwocryptoFactoryNG = contracts[chain].CurveTwocryptoFactoryNG } const poolList = {} @@ -295,7 +299,7 @@ async function tvl(api) { const { plainFactoryConfig = [] } = config[chain] ?? {} const { block } = api let balances = {}; - let poolLists = await getPools(block, chain); + let poolLists = await getPools(block, chain, api); const bl = new Set((blacklistedPools[chain] || []).map(a => a.toLowerCase())); for (const [registry, pools] of Object.entries(poolLists)) { From d00991d98816fd03b6f5bb335878dd32d312a58f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 13 Nov 2026 12:17:37 +0100 Subject: [PATCH 726/988] update @defillama/sdk version --- package.json | 2 +- pnpm-lock.yaml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8690b49f664..ef5d4532058 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", - "@defillama/sdk": "5.0.250", + "@defillama/sdk": "5.0.251", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", "@supercharge/promise-pool": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9dd1daa97fc..a365a2673e7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^0.30.1 version: 0.30.1(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) '@defillama/sdk': - specifier: 5.0.250 - version: 5.0.250(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) + specifier: 5.0.251 + version: 5.0.251(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) '@project-serum/anchor': specifier: ^0.26.0 version: 0.26.0(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -269,8 +269,8 @@ packages: peerDependencies: '@solana/web3.js': ^1.68.0 - '@defillama/sdk@5.0.250': - resolution: {integrity: sha512-h6CidP6PlYJ1Q2j7e3GBC3MzbzhgkLpKC6jAxENyAmCTMBZi+GGl+5wXvLx2g3JLo7zUkHqxwRqthJ2HqAJ9+Q==} + '@defillama/sdk@5.0.251': + resolution: {integrity: sha512-GpFNpRe4v2WrfVKxlzx5nnVBvgEknciX19TDu+IpbbnS79uoA6SBDzBwJdiXPBDnXBdEYvpLuneYcYqi3zwdmQ==} peerDependencies: '@solana/web3.js': '>=1.73.0' peerDependenciesMeta: @@ -1942,7 +1942,7 @@ snapshots: bn.js: 5.2.2 buffer-layout: 1.2.2 - '@defillama/sdk@5.0.250(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': + '@defillama/sdk@5.0.251(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': dependencies: '@aws-sdk/client-s3': 3.913.0 '@elastic/elasticsearch': 8.19.1(supports-color@7.2.0) @@ -2098,7 +2098,7 @@ snapshots: '@scure/bip32@1.7.0': dependencies: - '@noble/curves': 1.9.7 + '@noble/curves': 1.9.1 '@noble/hashes': 1.8.0 '@scure/base': 1.2.6 From d3d39817b4c28f7f4d42ce2aebd3a0489bd4eec0 Mon Sep 17 00:00:00 2001 From: thomas <81407403+thomas-cloud579@users.noreply.github.com> Date: Fri, 13 Nov 2026 20:07:30 +0800 Subject: [PATCH 727/988] Exclude delisted token TAO (#22180) --- projects/gate-io/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index af4068439c7..5aee0a81481 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -208,6 +208,11 @@ const config = { ] }, "solana": { + // Exclude delisted The Anthropic Order (TAO), + // a different asset from Bittensor TAO. + blacklistedTokens: [ + "9cYXqd1ggyMTjwZFWnbDuf5EfLEcLuumMG67jRkJpump", + ], "owners": [ "u6PJ8DtQuPFnfmwHbGFULQ4u4EgjDiyYKjVEsynXq2w", "HiRpdAZifEsZGdzQ5Xo5wcnaH3D2Jj9SoNsUzcYNK78J", From c752dfc257b5e0a0279be789f52e65b670413173 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 13 Nov 2026 14:45:28 +0000 Subject: [PATCH 728/988] nvhome (#22184) --- projects/nuva/index.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/projects/nuva/index.js b/projects/nuva/index.js index 7b56eda1cfa..083718ec9f3 100644 --- a/projects/nuva/index.js +++ b/projects/nuva/index.js @@ -1,18 +1,20 @@ const { get } = require('../helper/http') const PROVENANCE_VAULT_API = 'https://api.provenance.io' -const NVYLDS_SHARE_DENOM = 'nuva.ylds' +const PROVENANCE_SHARE_DENOMS = ['nuva.ylds', 'nuva.home'] // nvYLDS, nvHOME const NVPRIME_ROUTER = '0x50AE1e4A612A4623b747aEeFb30aFBA82804e12c' async function provenanceTvl(api) { - const data = await get( - `${PROVENANCE_VAULT_API}/vault/v1/vaults/${encodeURIComponent(NVYLDS_SHARE_DENOM)}` - ) - const amount = data?.total_vault_value?.amount - if (!amount) { - throw new Error(`nvYLDS total_vault_value missing for ${NVYLDS_SHARE_DENOM}`) + for (const denom of PROVENANCE_SHARE_DENOMS) { + const data = await get( + `${PROVENANCE_VAULT_API}/vault/v1/vaults/${encodeURIComponent(denom)}` + ) + const amount = data?.total_vault_value?.amount + if (!amount) { + throw new Error(`total_vault_value missing for ${denom}`) + } + api.addUSDValue(Number(amount) / 1e6) } - api.addUSDValue(Number(amount) / 1e6) } async function ethereumTvl(api) { @@ -29,7 +31,7 @@ module.exports = { misrepresentedTokens: true, start: '2026-04-27', methodology: - 'NUVA TVL is the sum of (1) nvYLDS total_vault_value from the Provenance vault module (canonical vault state; Ethereum and Base bridge contracts are excluded to avoid double-counting bridged deposits) and (2) nvPRIME underlying assets held in the Ethereum Nuva vault.', + 'NUVA TVL is the sum of (1) nvYLDS and nvHOME total_vault_value from the Provenance vault module (canonical vault state; Ethereum and Base bridge contracts are excluded to avoid double-counting bridged deposits) and (2) nvPRIME underlying assets held in the Ethereum Nuva vault.', provenance: { tvl: provenanceTvl }, ethereum: { tvl: ethereumTvl }, } From 8c06967c9fa81c5ace167f6f7046009ab287abae Mon Sep 17 00:00:00 2001 From: Tim Mustafin Date: Fri, 13 Nov 2026 16:01:47 +0100 Subject: [PATCH 729/988] fix(shield-swap): include BAT in TVL (#22183) --- projects/shield-swap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/shield-swap/index.js b/projects/shield-swap/index.js index 33dcbb4f271..1a2b7e15eaa 100644 --- a/projects/shield-swap/index.js +++ b/projects/shield-swap/index.js @@ -4,6 +4,7 @@ const SHIELD_SWAP = 'shield_swap.aleo' const TOKENS = [ { program: 'shield_swap_arc20_credits.aleo', coingeckoId: 'aleo', decimals: 6 }, + { program: 'shield_swap_arc20_wrapped_bat.aleo', coingeckoId: 'basic-attention-token', decimals: 18 }, { program: 'arc20_eth.aleo', coingeckoId: 'ethereum', decimals: 18 }, { program: 'arc20_sol.aleo', coingeckoId: 'solana', decimals: 9 }, { program: 'arc20_wbtc.aleo', coingeckoId: 'bitcoin', decimals: 8 }, @@ -36,6 +37,6 @@ module.exports = { timetravel: false, misrepresentedTokens: true, methodology: - 'TVL is the aggregate balance held by shield_swap.aleo in Shield Swap\'s verified ALEO, ETH, SOL, WBTC, ZEC, USDCx, and USDG token programs, read directly from Aleo chain state. It includes pool capital, accrued fees, and funds awaiting claims.', + 'TVL is the aggregate balance held by shield_swap.aleo in Shield Swap\'s verified ALEO, BAT, ETH, SOL, WBTC, ZEC, USDCx, and USDG token programs, read directly from Aleo chain state. It includes pool capital, accrued fees, and funds awaiting claims.', aleo: { tvl }, } From 3b9d2f7b0b0311455aae161e84baf38934464470 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 13 Nov 2026 16:23:14 +0100 Subject: [PATCH 730/988] fix liquidcore --- projects/liquidcore/index.js | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/projects/liquidcore/index.js b/projects/liquidcore/index.js index de093afc6db..bdbe965fa50 100644 --- a/projects/liquidcore/index.js +++ b/projects/liquidcore/index.js @@ -1,9 +1,14 @@ +const sdk = require('@defillama/sdk') const ADDRESSES = require('../helper/coreAssets.json') +const { getCache, setCache } = require('../helper/cache') + +const project = 'liquidcore' const chainConfig = { hyperliquid: { router: '0x625aC1D165c776121A52ff158e76e3544B4a0b8B', fromBlock: 28736539, + lastGoodBlock: 50662125, // 2026-11-07, last block where getTokens() worked on every pool (they started reverting one by one after it) legacyPools: [ '0xA7478A5ff7cB27A8008D6D90785db10223bc6087', '0xD3994A6CF46cA91536376f89aCDadf92eD289a9F', @@ -11,11 +16,12 @@ const chainConfig = { }, robinhood: { router: '0x322F277BfB7Ba9c196194ad18011377A0fF55Fb3', - fromBlock: 11400065 + fromBlock: 11400065, + lastGoodBlock: 108868678, // 2026-11-08, last block where the router/pool view calls worked } } -async function tvl(api) { +async function getTokensAndOwners(api) { const { router, legacyPools = [], fromBlock } = chainConfig[api.chain] const pools = [...legacyPools] if (await api.getBlock() >= fromBlock) { @@ -32,6 +38,32 @@ async function tvl(api) { if (!tokens[i]) return tokensAndOwners.push([tokens[i].token0, pool], [tokens[i].token1, pool]) }) + return tokensAndOwners +} + +// pool.getTokens() and then router.getPools() started reverting on 2026-11-07/08. +// Every successful live pull is cached; when the live calls fail, the list from the last +// successful run is used. lastGoodBlock only seeds the cache if it is still empty +async function getCachedTokensAndOwners(api) { + const { lastGoodBlock } = chainConfig[api.chain] + const cache = await getCache(project, api.chain) + if (cache.tokensAndOwners?.length) return cache.tokensAndOwners + const pastApi = new sdk.ChainApi({ chain: api.chain, block: lastGoodBlock }) + const tokensAndOwners = await getTokensAndOwners(pastApi) + await setCache(project, api.chain, { tokensAndOwners }) + return tokensAndOwners +} + +async function tvl(api) { + let tokensAndOwners + try { + tokensAndOwners = await getTokensAndOwners(api) + // historical refills must not overwrite the cache with an older list + const isCurrentRun = !api.timestamp || Date.now() / 1e3 - api.timestamp < 3600 + if (isCurrentRun) await setCache(project, api.chain, { tokensAndOwners }) + } catch (e) { + tokensAndOwners = await getCachedTokensAndOwners(api) + } return api.sumTokens({ tokensAndOwners }) } From 2a07a15349cf52d2b5507d109f0647aa94b86c58 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 13 Nov 2026 20:01:39 +0100 Subject: [PATCH 731/988] optimize --- projects/delta-liquidity/index.js | 1 + projects/krystal/index.js | 1 + projects/krystal/solana.js | 42 +++++++++++++++++++------ projects/loopscale/index.js | 52 +++++++++++++++++++++++-------- projects/strato/index.js | 4 +-- projects/vaultex/index.js | 36 +++++++++++++++------ 6 files changed, 101 insertions(+), 35 deletions(-) diff --git a/projects/delta-liquidity/index.js b/projects/delta-liquidity/index.js index 2388d90e40d..c0d5feb7da3 100644 --- a/projects/delta-liquidity/index.js +++ b/projects/delta-liquidity/index.js @@ -128,3 +128,4 @@ module.exports = { doublecounted: true, // liquidity sits inside Uniswap pools, which DefiLlama counts under Uniswap robinhood: { tvl, staking }, } +module.exports.isHeavyProtocol = true; diff --git a/projects/krystal/index.js b/projects/krystal/index.js index 42638dcac8e..516b0a9f64e 100644 --- a/projects/krystal/index.js +++ b/projects/krystal/index.js @@ -20,6 +20,7 @@ chains.forEach(chain => { }); module.exports.solana = { tvl: solana.tvl }; +module.exports.ronin.tvl = () => ({}) // low tvl, takes too long to scan. module.exports.isHeavyProtocol = true; module.exports.methodology = diff --git a/projects/krystal/solana.js b/projects/krystal/solana.js index b933bf35c88..c2cd3ad0c56 100644 --- a/projects/krystal/solana.js +++ b/projects/krystal/solana.js @@ -10,6 +10,9 @@ const { const idl = require("./idl/krystal_auto_vault.json"); const { addUniV3LikePosition } = require("../helper/unwrapLPs.js"); const { getUniqueAddresses } = require("../helper/tokenMapping.js"); +const { getCache, setCache } = require("../helper/cache"); + +const CACHE_PROJECT = "krystal"; const CLMM_PROGRAM_ID = new PublicKey( "CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK" @@ -24,6 +27,11 @@ if (!userVaultAccount) { const USER_VAULT_DISCRIMINATOR = userVaultAccount.discriminator; +// Each vault costs two getTokenAccountsByOwner calls, and about two thirds of the vaults hold +// nothing (no token accounts, or only zero balances). Those are remembered in the cache and +// rescanned once a week instead of on every run; a refilled vault is picked up at its next rescan. +const DORMANT_RECHECK_SECONDS = 7 * 24 * 3600; + async function tvl(api) { const connection = getConnection(); const vaults = await connection.getProgramAccounts(new PublicKey(idl.address), { @@ -33,10 +41,26 @@ async function tvl(api) { ], }); - await addRaydiumPositions({ api, connection, owners: vaults.map((i) => i.pubkey) }); + const now = Math.floor(Date.now() / 1e3); + const { dormant = {} } = await getCache(CACHE_PROJECT, "solana"); // vault -> last time it was found empty + const owners = vaults + .map((i) => i.pubkey) + .filter((vault) => now - (dormant[vault.toBase58()] ?? 0) >= DORMANT_RECHECK_SECONDS); + + const emptyOwners = new Set(); + await addRaydiumPositions({ api, connection, owners, emptyOwners }); + + const scanned = new Set(owners.map((vault) => vault.toBase58())); + const updatedDormant = {}; + vaults.forEach(({ pubkey }) => { + const vault = pubkey.toBase58(); + if (emptyOwners.has(vault)) updatedDormant[vault] = now; + else if (!scanned.has(vault)) updatedDormant[vault] = dormant[vault]; + }); + await setCache(CACHE_PROJECT, "solana", { dormant: updatedDormant }); } -async function addRaydiumPositions({ api, owners = [], owner, connection = getConnection() }) { +async function addRaydiumPositions({ api, owners = [], owner, connection = getConnection(), emptyOwners }) { const pools = new Map(); @@ -91,14 +115,8 @@ async function addRaydiumPositions({ api, owners = [], owner, connection = getCo async function findClmmPositionsByOwner(connection, owner) { - const [tokenAccounts, token2022Accounts] = await Promise.all([ - connection.getTokenAccountsByOwner(owner, { - programId: TOKEN_PROGRAM_ID, - }), - connection.getTokenAccountsByOwner(owner, { - programId: TOKEN_2022_PROGRAM_ID, - }), - ]); + const tokenAccounts = await connection.getTokenAccountsByOwner(owner, { programId: TOKEN_PROGRAM_ID }); + const token2022Accounts = await connection.getTokenAccountsByOwner(owner, { programId: TOKEN_2022_PROGRAM_ID }); const allTokenAccounts = []; if (tokenAccounts?.value) { @@ -109,11 +127,13 @@ async function addRaydiumPositions({ api, owners = [], owner, connection = getCo } const tokenNftMints = []; + let holdsValue = false; allTokenAccounts.forEach(({ account }) => { const { amount, mint } = decodeAccount("tokenAccount", account) const rawAmount = amount.toString(); const token = mint.toBase58(); + if (rawAmount !== "0") holdsValue = true; if (rawAmount === "1") { tokenNftMints.push(mint); } else { @@ -121,6 +141,8 @@ async function addRaydiumPositions({ api, owners = [], owner, connection = getCo } }); + if (!holdsValue && emptyOwners) emptyOwners.add(owner.toBase58()); + const pdaPersonalPositionAddresses = tokenNftMints.map(getPdaPersonalPositionAddress) pdaPersonalPositionAddressesAll.push(...pdaPersonalPositionAddresses) } diff --git a/projects/loopscale/index.js b/projects/loopscale/index.js index 718768fe743..47c45903d29 100644 --- a/projects/loopscale/index.js +++ b/projects/loopscale/index.js @@ -307,19 +307,45 @@ async function getDeposits(connection) { Object.entries(rawDeposits).filter(([key, value]) => value !== 0n) )); - const response = await fetch(endpoint, { - method: "POST", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify({ - rawBalances: rawDeposits - }) - }); - - const parsedDeposits = parseBigIntStringMap(await response.json()); - - return parsedDeposits; + return decompileMints(rawDeposits); +} + +// the endpoint fails the whole request if a single mint can't be decompiled, so the mints it +// names in the error are dropped from the request and reported as-is (raw mint, undecompiled) +async function decompileMints(rawBalances) { + const pending = { ...rawBalances }; + const passthrough = {}; + + for (let attempt = 0; attempt < 5; attempt++) { + const response = await fetch(endpoint, { + method: "POST", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({ + rawBalances: pending + }) + }); + const data = await response.json(); + + if (response.ok && !data.error) { + const parsed = parseBigIntStringMap(data); + for (const [mint, balance] of Object.entries(passthrough)) + parsed[mint] = (parsed[mint] || 0n) + BigInt(balance); + return parsed; + } + + const failedMints = [...String(data.error).matchAll(/ratio\(([1-9A-HJ-NP-Za-km-z]+)\)/g)] + .map(m => m[1]).filter(mint => mint in pending); + if (!failedMints.length) throw new Error(`loopscale decompile_mints failed: ${data.error}`); + + for (const mint of failedMints) { + passthrough[mint] = pending[mint]; + delete pending[mint]; + } + } + + throw new Error('loopscale decompile_mints: still failing after dropping unpriceable mints'); } async function tvl(api) { diff --git a/projects/strato/index.js b/projects/strato/index.js index ce250f87ec2..ef48e17a544 100644 --- a/projects/strato/index.js +++ b/projects/strato/index.js @@ -86,7 +86,7 @@ async function tvl(api) { api.removeTokenBalance(STRATO_TOKEN) } -async function borrowed(api) { +async function borrowed(api) { // we dont track borrowed for CDPs const [borrowableAsset, borrowIndex, totalScaledDebt, cdpEngine, usdst] = await batchCall([ { target: LENDING_POOL, abi: 'function borrowableAsset() view returns (address)' }, { target: LENDING_POOL, abi: 'function borrowIndex() view returns (uint256)' }, @@ -125,5 +125,5 @@ module.exports = { 'All values verified on-chain via batched eth_call (no Multicall3). CDP collateral read from CDPVault, lending deposits (idle liquidity + collateral) from LiquidityPool + CollateralVault, savings from SaveUSDSTVault, staked assets from SafetyModule, vault holdings from the Vault botExecutor, stablecoin reserves held by the DirectMintPSM, and idle assets held by each ERC-4626 YieldVault (capital deployed to strategies is excluded because it is redeployed into CDPs/pools already counted). Swap pool liquidity (PoolFactory / PoolV3Factory) is listed separately as STRATO DEX. USDST is excluded from base TVL across all holders because its backing CDP collateral and PSM reserves are already counted. Holder addresses resolved from on-chain registries (CDPRegistry, LendingRegistry). Outstanding debt is reported separately under `borrowed` and excluded from TVL: LiquidityPool debt (totalScaledDebt × borrowIndex / RAY against the LiquidityPool borrowableAsset) plus CDP debt (CDPEngine.totalDebtAll, outstanding USDST summed across every enumerated collateral asset). Staked $STRATO (StratoStaking totalUserStake + totalSelfBond) is reported under `staking` and excluded from base TVL. Prices resolved server-side by DefiLlama for the `strato` chain.', timetravel: false, start: '2026-04-02', - strato: { tvl, borrowed, staking }, + strato: { tvl, staking }, } diff --git a/projects/vaultex/index.js b/projects/vaultex/index.js index 6bd1a052411..df2a9e192c6 100644 --- a/projects/vaultex/index.js +++ b/projects/vaultex/index.js @@ -1,6 +1,6 @@ const { getConnection } = require('../helper/solana') const { PublicKey } = require('@solana/web3.js') -const { sleep } = require('../helper/utils') +const { getCache, setCache } = require('../helper/cache') // Vaultex (https://vaultex.fun): Solana meme coin launchpad built on Meteora's // Dynamic Bonding Curve. Coins can be paired with several quote assets (SOL, @@ -21,6 +21,11 @@ const CONFIG_FEE_CLAIMER_OFFSET = 40 const POOL_CONFIG_OFFSET = 72 const QUOTE_RESERVE_OFFSET = 240 const IS_MIGRATED_OFFSET = 305 +const NOT_MIGRATED = '1' // base58 of the single byte 0x00 + +const CACHE_PROJECT = 'vaultex' +const CACHE_KEY = 'solana-empty-configs' +const EMPTY_CONFIG_RECHECK_SECONDS = 7 * 24 * 3600 async function tvl(api) { const connection = getConnection() @@ -33,28 +38,39 @@ async function tvl(api) { dataSlice: { offset: CONFIG_QUOTE_MINT_OFFSET, length: 32 }, }) + // most configs have no live pools: those are re-checked once a week, the rest (and new configs) every run + const { emptyConfigs = {} } = await getCache(CACHE_PROJECT, CACHE_KEY) + const now = Math.floor(Date.now() / 1000) + for (const { pubkey, account } of configs) { + const config = pubkey.toBase58() + if (now - emptyConfigs[config] < EMPTY_CONFIG_RECHECK_SECONDS) continue + const quoteMint = new PublicKey(account.data).toBase58() - // one getProgramAccounts per config; spaced so public RPCs don't rate-limit (429) - await sleep(1200) + // one getProgramAccounts per config: memcmp filters can't be OR'ed const pools = await connection.getProgramAccounts(DBC_PROGRAM, { filters: [ { memcmp: { offset: 0, bytes: VIRTUAL_POOL_DISC } }, - { memcmp: { offset: POOL_CONFIG_OFFSET, bytes: pubkey.toBase58() } }, + { memcmp: { offset: POOL_CONFIG_OFFSET, bytes: config } }, + // migration moves the reserve to DAMM v2 but leaves quote_reserve unchanged, so migrated pools are filtered out by the RPC + { memcmp: { offset: IS_MIGRATED_OFFSET, bytes: NOT_MIGRATED } }, ], - dataSlice: { offset: QUOTE_RESERVE_OFFSET, length: IS_MIGRATED_OFFSET - QUOTE_RESERVE_OFFSET + 1 }, + dataSlice: { offset: QUOTE_RESERVE_OFFSET, length: 8 }, }) - for (const { account: { data } } of pools) { - // migration moves the reserve to DAMM v2 but leaves quote_reserve unchanged - if (data.readUInt8(IS_MIGRATED_OFFSET - QUOTE_RESERVE_OFFSET) !== 0) continue - // quote_reserve excludes the unclaimed protocol, partner and creator fees that sit in the same quote vault + // quote_reserve excludes the unclaimed protocol, partner and creator fees that sit in the same quote vault + for (const { account: { data } } of pools) api.add(quoteMint, data.readBigUInt64LE(0).toString()) - } + + if (pools.length) delete emptyConfigs[config] + else emptyConfigs[config] = now } + + await setCache(CACHE_PROJECT, CACHE_KEY, { emptyConfigs }) } module.exports = { timetravel: false, + isHeavyProtocol: true, methodology: 'TVL is the quote asset (SOL, USDC, PUMP and others) held as reserves in Vaultex bonding curves on Meteora Dynamic Bonding Curve. Vaultex pools are the pools created against DBC configs whose partner fee claimer is the Vaultex treasury. Launched tokens and unclaimed trading fees are not counted. Graduated curves are excluded: their liquidity moves to Meteora DAMM v2 and is counted there.', solana: { tvl }, From f8ce230eb46a3633ce50b83a478eb2738c9b80cd Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 13 Nov 2026 15:08:02 -0400 Subject: [PATCH 732/988] add zkapi (#22187) --- registries/sumTokens.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index bb5a112b771..5dc93a5acac 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -42243,6 +42243,15 @@ const configs = { ], }, }, + "zkapi": { + "methodology": "TVL is the ETH escrowed in the ZkApiVault contract, which users prepay for anonymous API access.", + "ethereum": { + "owner": "0x4386FDbdA35D995beB3BF8625118Ec5982ec81fe", + "tokens": [ + ADDRESSES.null + ] + }, + }, "zkasino": { "bsc": { "owners": [ From 06548fff4e5118d47885a21180e3cb6bb0e5763b Mon Sep 17 00:00:00 2001 From: OxForged Date: Fri, 13 Nov 2026 11:48:12 -0800 Subject: [PATCH 733/988] Peddles: TVL on Ethereum and Anubis (Gully Core CL pools) (#22186) --- projects/helper/uniswapV4.js | 15 ++++++++----- projects/peddles/index.js | 42 ++++++++++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/projects/helper/uniswapV4.js b/projects/helper/uniswapV4.js index 0cedac122b2..6989bef044f 100644 --- a/projects/helper/uniswapV4.js +++ b/projects/helper/uniswapV4.js @@ -92,10 +92,15 @@ async function getHookPools({ api, hook, poolManager, fromBlock }) { } // adds the reserves of the given v4 pools ([{ id, token0, token1, spacing }]) to api, reconstructed from -// the pool's tick bitmap, tick liquidity and current price read via StateView (v4 keeps all pools in one PoolManager) -async function addUniV4PoolReserves({ api, pools, stateView }) { +// the pool's tick bitmap, tick liquidity and current price read via StateView (v4 keeps all pools in one PoolManager). +// `abis` overrides the three view ABIs for a v4-shaped pool manager that names them differently, e.g. PancakeSwap +// Infinity's CLPoolManager (getPoolBitmapInfo / getPoolTickInfo, same tick layout), passed in as `stateView`. +async function addUniV4PoolReserves({ api, pools, stateView, abis = {} }) { if (!pools.length) return - const slot0s = await api.multiCall({ abi: getSlot0Abi, target: stateView, calls: pools.map((p) => p.id) }) + const slot0Abi = abis.getSlot0 ?? getSlot0Abi + const bitmapAbi = abis.getTickBitmap ?? getTickBitmapAbi + const tickInfoAbi = abis.getTickInfo ?? getTickInfoAbi + const slot0s = await api.multiCall({ abi: slot0Abi, target: stateView, calls: pools.map((p) => p.id) }) const live = [] slot0s.forEach((s, i) => { const sqrtP = BigInt(s.sqrtPriceX96) @@ -110,7 +115,7 @@ async function addUniV4PoolReserves({ api, pools, stateView }) { const hi = Math.floor(MAX_TICK / p.spacing) >> 8 for (let w = lo; w <= hi; w++) words.push({ pool: i, word: w }) }) - const bitmaps = await api.multiCall({ abi: getTickBitmapAbi, target: stateView, calls: words.map(({ pool, word }) => ({ params: [live[pool].id, word] })) }) + const bitmaps = await api.multiCall({ abi: bitmapAbi, target: stateView, calls: words.map(({ pool, word }) => ({ params: [live[pool].id, word] })) }) bitmaps.forEach((raw, i) => { const bits = BigInt(raw) if (bits === 0n) return @@ -126,7 +131,7 @@ async function addUniV4PoolReserves({ api, pools, stateView }) { p.ticks.forEach((tick) => tickCalls.push({ pool: i, tick })) }) if (tickCalls.length) { - const tickData = await api.multiCall({ abi: getTickInfoAbi, target: stateView, calls: tickCalls.map(({ pool, tick }) => ({ params: [live[pool].id, tick] })) }) + const tickData = await api.multiCall({ abi: tickInfoAbi, target: stateView, calls: tickCalls.map(({ pool, tick }) => ({ params: [live[pool].id, tick] })) }) tickData.forEach((info, i) => { const { pool, tick } = tickCalls[i] live[pool].nets[tick] = BigInt(info.liquidityNet) diff --git a/projects/peddles/index.js b/projects/peddles/index.js index bb2ed69f531..8679a873160 100644 --- a/projects/peddles/index.js +++ b/projects/peddles/index.js @@ -10,34 +10,61 @@ const { addUniV4PoolReserves, chainConfig } = require('../helper/uniswapV4') // PoolRegistered carries no tick spacing, so each pool's key is read from its Initialize log, looked up by the // indexed pool id in the block the hook registered it (the launch initializes and registers in one transaction). // Reserves are then rebuilt on chain from tick liquidity via StateView. +// +// On Anubis the venue is Gully Core, a PancakeSwap Infinity fork. The launch is the same, on its CLPoolManager, +// paired against DAI, with PeddlesPancakeFeeHook (same PoolRegistered event). Infinity has no StateView: the +// CLPoolManager answers getSlot0 / getPoolBitmapInfo / getPoolTickInfo itself, with the same tick layout as v4, +// and its Initialize log carries the tick spacing inside `parameters` (bits 16-39). const hooks = { base: { hook: '0xAB8E39207718f519865D6f0d52eFB31b231D40cc', fromBlock: 51855962 }, robinhood: { hook: '0xfe055282E3cD471A8b2cd922d31E75ECd3bBc0CC', fromBlock: 76092920 }, bsc: { hook: '0x39D760601731025e0F02A3e5D232445797fAC0CC', fromBlock: 125076797 }, arc: { hook: '0x317e34De0298F23bd41bf9A853289e227E9cC0CC', fromBlock: 23687888 }, + ethereum: { hook: '0x2AC9dAc4eB0e43c0ba0da85551eE55e369b980cC', fromBlock: 26374000 }, + anubi: { hook: '0x53edFBD1d70a65C027Bd1605a5e693e42c527E7c', fromBlock: 18653741, infinityCl: '0xC85Edc14Fc6053151066f6D497B11E6982946a50' }, } const poolRegisteredAbi = 'event PoolRegistered(bytes32 indexed poolId, address indexed token, address indexed quote, address creator, uint16 creatorTaxBps, uint16 excessToCreatorBps, address rewards)' const initializeAbi = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks, uint160 sqrtPriceX96, int24 tick)' const INITIALIZE_TOPIC = '0xdd466e674ea557f56295e2d0218a125ea4b4f0f6f3307b95f85e6110838d6438' +const clInitializeAbi = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint160 sqrtPriceX96, int24 tick)' +const CL_INITIALIZE_TOPIC = '0x426cc62fe6a33a40ba2788c2c87a9c34ee4582b95bc9fa5a7bb7ae70b750b99c' + +// Infinity CLPoolManager views, the same shapes as v4 StateView's (Tick.Info is a static struct, so flat returns decode it) +const clAbis = { + getSlot0: 'function getSlot0(bytes32 id) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)', + getTickBitmap: 'function getPoolBitmapInfo(bytes32 id, int16 word) view returns (uint256 tickBitmap)', + getTickInfo: 'function getPoolTickInfo(bytes32 id, int24 tick) view returns (uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128)', +} -async function peddlesPools(api, { hook, fromBlock }) { - const { poolManager } = chainConfig[api.chain] - const registered = await getLogs2({ api, target: hook, eventAbi: poolRegisteredAbi, fromBlock, onlyArgs: false }) +async function peddlesPools(api, { hook, fromBlock, infinityCl }) { + const poolManager = infinityCl ?? chainConfig[api.chain].poolManager + const rpcOnly = infinityCl ? { useIndexer: false } : {} // Anubis is read over RPC, as projects/thumb does + const registered = await getLogs2({ api, target: hook, eventAbi: poolRegisteredAbi, fromBlock, onlyArgs: false, ...rpcOnly }) const pools = [] for (const log of registered) { const id = log.args.poolId const block = Number(log.blockNumber) - const [init] = await getLogs2({ api, target: poolManager, eventAbi: initializeAbi, topics: [INITIALIZE_TOPIC, id], fromBlock: block, toBlock: block + 1, skipCache: true }) + const [init] = await getLogs2({ + api, + target: poolManager, + eventAbi: infinityCl ? clInitializeAbi : initializeAbi, + topics: [infinityCl ? CL_INITIALIZE_TOPIC : INITIALIZE_TOPIC, id], + fromBlock: block, + toBlock: infinityCl ? block : block + 1, // Anubis refuses a log range that reaches past its head + skipCache: true, + ...rpcOnly, + }) if (!init || init.hooks.toLowerCase() !== hook.toLowerCase()) continue - pools.push({ id, token0: init.currency0, token1: init.currency1, spacing: Number(init.tickSpacing) }) + const spacing = infinityCl ? Number((BigInt(init.parameters) >> 16n) & 0xffffffn) : Number(init.tickSpacing) + pools.push({ id, token0: init.currency0, token1: init.currency1, spacing }) } return pools } module.exports = { - doublecounted: true, // the pools live in the Uniswap v4 PoolManager, so Uniswap v4 TVL counts them too - methodology: 'Counts the liquidity in every Uniswap v4 pool created by a Peddles launch. Pools are read from the Peddles fee hook\'s PoolRegistered events, each pool\'s key from its Initialize log, and reserves are rebuilt on chain from tick liquidity and the current price via StateView. Launch liquidity is locked in these pools. Fees the hook has accrued but not yet paid out are not counted.', + doublecounted: true, // the pools live in the shared Uniswap v4 PoolManager (Gully's CLPoolManager on Anubis), so the venue's own TVL counts them too + methodology: 'Counts the liquidity in every pool created by a Peddles launch: Uniswap v4 pools, and on Anubis Gully Core (a PancakeSwap Infinity fork) CL pools. Pools are read from the Peddles fee hook\'s PoolRegistered events, each pool\'s key from its Initialize log, and reserves are rebuilt on chain from tick liquidity and the current price (via StateView on v4, from the CLPoolManager on Gully). Launch liquidity is locked in these pools. Fees the hook has accrued but not yet paid out are not counted.', start: '2026-09-27', } @@ -45,6 +72,7 @@ Object.entries(hooks).forEach(([chain, config]) => { module.exports[chain] = { tvl: async (api) => { const pools = await peddlesPools(api, config) + if (config.infinityCl) return addUniV4PoolReserves({ api, pools, stateView: config.infinityCl, abis: clAbis }) await addUniV4PoolReserves({ api, pools, stateView: chainConfig[chain].stateView }) }, } From 5998ea0fc3198f9a92f92122ecdcbdb2ccfdb1b9 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 13 Nov 2026 21:06:00 +0100 Subject: [PATCH 734/988] optimize --- projects/delta-liquidity/index.js | 72 +++++++++++++++++++++++++------ projects/hawksight/index.js | 51 ++++++++++++++++------ 2 files changed, 96 insertions(+), 27 deletions(-) diff --git a/projects/delta-liquidity/index.js b/projects/delta-liquidity/index.js index c0d5feb7da3..b4d5b94a135 100644 --- a/projects/delta-liquidity/index.js +++ b/projects/delta-liquidity/index.js @@ -1,7 +1,13 @@ +const sdk = require('@defillama/sdk') const { sumTokens2 } = require('../helper/unwrapLPs') const { getLogs2 } = require('../helper/cache/getLogs') +const { getCache, setCache } = require('../helper/cache') const ADDRESSES = require('../helper/coreAssets.json') +const PROJECT = 'delta-liquidity' +const MANAGED_OPEN_V4_ABI = 'event ManagedOpenV4(address indexed owner, bytes32 indexed poolId, uint256[] tokenIds)' +const RESCAN_BLOCKS = 2000 // overlap re-scanned each run so events near the previous head are not missed + // Delta v3 (live stack) const VAULT_FACTORY = '0x68EDc4948F60D21c4a7Dcbb8Ed4500cE6D0b153c' // DeltaLadderManager v1..v9 + DeltaRangeOrderManager (https://deltaliquidity.app/docs) @@ -30,7 +36,19 @@ const V4_POSM = '0x58daec3116aae6D93017bAAea7749052E8a04fA7' // UniswapV4 Positi const V4_STATE_VIEW = '0xF3334192D15450CdD385c8B70e03f9A6bD9E673b' const DELTA = '0xe8ffd7e24187F72afB08d75B1bb13088A989a791' +// tvl and staking need the same owners / LP tokens / v4 position ids, so the discovery +// (factory lists, event scan, ownerOf multicall) runs once per block and is shared +const discoveryCache = {} async function getOwnersAndTokens(api) { + const block = await api.getBlock() + if (!discoveryCache[block]) { + Object.keys(discoveryCache).forEach(key => delete discoveryCache[key]) + discoveryCache[block] = _getOwnersAndTokens(api) + } + return discoveryCache[block] +} + +async function _getOwnersAndTokens(api) { // Delta vaults (each vault custodies one Uniswap v3 position NFT) const vaults = await api.fetchList({ lengthAbi: 'uint256:vaultCount', @@ -48,19 +66,43 @@ async function getOwnersAndTokens(api) { const lpTokens = farmsV2.length ? await api.multiCall({ abi: 'address:stakingToken', calls: farmsV2 }) : [] const owners = [...LADDER_MANAGERS, ROUTER_V3, ROUTER_V2, ...vaults, ...farmsV2] - // Uniswap v4 positions managed by the ladder managers. - // No v4 subgraph on this chain, so position ids are enumerated from each - // manager's own events, then filtered to those the manager still holds. + const positionIds = await getV4PositionIds(api) + + return { owners, lpTokens, positionIds } +} + +// Uniswap v4 positions managed by the ladder managers. +// No v4 subgraph on this chain, so position ids are enumerated from each +// manager's own events, then filtered to those the manager still holds. +// +// ~99% of the ids ever opened are burned, and a burned id never comes back. So current runs +// keep the ids that still exist plus the last scanned block in the cache, and only look at +// those ids and the events since that block, instead of re-checking every id ever opened. +// Historical runs (and the first run, with an empty cache) take the full path. +async function getV4PositionIds(api) { + const block = await api.getBlock() + const isCurrentRun = !api.timestamp || Date.now() / 1e3 - api.timestamp < 3600 + const cache = isCurrentRun ? await getCache(PROJECT, api.chain) : {} + const toIds = logs => logs.flatMap(i => i.tokenIds.map(j => j.toString())) + let candidateIds = [] - for (const { address: target, fromBlock } of LADDER_MANAGER_CONFIGS) { - const opened = await getLogs2({ - api, - target, - eventAbi: 'event ManagedOpenV4(address indexed owner, bytes32 indexed poolId, uint256[] tokenIds)', - fromBlock, - extraKey: 'managed-open-v4', + if (cache.lastBlock && cache.lastBlock <= block) { + const opened = await sdk.getEventLogs({ + chain: api.chain, + targets: LADDER_MANAGERS, + eventAbi: MANAGED_OPEN_V4_ABI, + fromBlock: cache.lastBlock - RESCAN_BLOCKS, + toBlock: block, + onlyArgs: true, + flatten: true, + skipCache: true, }) - candidateIds.push(...opened.flatMap(i => i.tokenIds.map(j => j.toString()))) + candidateIds = [...cache.liveIds, ...toIds(opened)] + } else { + for (const { address: target, fromBlock } of LADDER_MANAGER_CONFIGS) { + const opened = await getLogs2({ api, target, eventAbi: MANAGED_OPEN_V4_ABI, fromBlock, extraKey: 'managed-open-v4' }) + candidateIds.push(...toIds(opened)) + } } candidateIds = [...new Set(candidateIds)] @@ -69,10 +111,12 @@ async function getOwnersAndTokens(api) { calls: candidateIds.map(i => ({ target: V4_POSM, params: [i] })), permitFailure: true, // closed positions are burned and revert }) - const managerSet = new Set(LADDER_MANAGERS.map(i => i.toLowerCase())) - const positionIds = candidateIds.filter((_, i) => positionOwners[i] && managerSet.has(positionOwners[i].toLowerCase())) - return { owners, lpTokens, positionIds } + if (isCurrentRun) + await setCache(PROJECT, api.chain, { lastBlock: block, liveIds: candidateIds.filter((_, i) => positionOwners[i]) }) + + const managerSet = new Set(LADDER_MANAGERS.map(i => i.toLowerCase())) + return candidateIds.filter((_, i) => positionOwners[i] && managerSet.has(positionOwners[i].toLowerCase())) } async function tvl(api) { diff --git a/projects/hawksight/index.js b/projects/hawksight/index.js index bf6e1e29a2e..03b67bf7162 100644 --- a/projects/hawksight/index.js +++ b/projects/hawksight/index.js @@ -2,6 +2,7 @@ const sdk = require('@defillama/sdk') const { PublicKey } = require('@solana/web3.js') const { bs58 } = require('@project-serum/anchor/dist/cjs/utils/bytes') const { getConnection, getMultipleAccounts, decodeAccount, sumTokens2 } = require('../helper/solana') +const { getCache, setCache } = require('../helper/cache') const { POSITION_V2_DISCRIMINATOR } = require('../helper/utils/solana/layouts/meteora-dlmm-layout') const HAWKFI_PROGRAM = new PublicKey('FqGg2Y1FNxMiGd51Q6UETixQWkF5fB92MysbYogRJb3P') @@ -12,6 +13,10 @@ const BINS_PER_ARRAY = 70 const DLMM_POSITION_BASE_SIZE = 8120 // resized positions append 112 bytes per extra bin, liquidity share first const DLMM_EXTRA_BIN_SIZE = 112 +const CACHE_PROJECT = 'hawksight' +const CACHE_KEY = 'solana-dlmm-empty-owners' +const EMPTY_OWNER_RECHECK_SECONDS = 7 * 24 * 3600 + const readU128 = (data, offset) => data.readBigUInt64LE(offset) + (data.readBigUInt64LE(offset + 8) << 64n) async function getUserPdas(connection) { @@ -22,28 +27,48 @@ async function getUserPdas(connection) { return accounts.map(({ pubkey }) => pubkey.toBase58()) } -async function tvl(api) { - const connection = getConnection(api.chain) - const ownerSet = new Set(await getUserPdas(connection)) - // no dataSize filter: resized positions are larger than the base PositionV2 account - // the scan is sharded by the owner's first byte, a single scan over all positions exceeds the RPC's scan limit - const positionKeys = [] +// Positions are fetched per owner: scanning all DLMM positions exceeds the RPC's scan limit, even sharded by owner byte. +// ~95% of user PDAs hold no position, so owners found empty are cached and only re-checked once a week; +// owners with positions and new owners are checked every run. +async function getPositionAccounts(connection) { + const owners = await getUserPdas(connection) + const { emptyOwners = {} } = await getCache(CACHE_PROJECT, CACHE_KEY) + const now = Math.floor(Date.now() / 1000) + const stillEmpty = {} + const toCheck = [] + for (const owner of owners) { + if (now - emptyOwners[owner] < EMPTY_OWNER_RECHECK_SECONDS) stillEmpty[owner] = emptyOwners[owner] + else toCheck.push(owner) + } + + const positionAccounts = [] await sdk.util.runInPromisePool({ - concurrency: 3, - items: [...Array(256).keys()], - processor: async (ownerByte) => { + concurrency: 10, + items: toCheck, + processor: async (owner) => { + // no dataSize filter: resized positions are larger than the base PositionV2 account const rows = await connection.getProgramAccounts(DLMM_PROGRAM, { filters: [ { memcmp: { offset: 0, bytes: bs58.encode(POSITION_V2_DISCRIMINATOR) } }, - { memcmp: { offset: 40, bytes: bs58.encode(Buffer.from([ownerByte])) } }, + { memcmp: { offset: 40, bytes: owner } }, ], - dataSlice: { offset: 40, length: 32 }, }) - rows.forEach(({ pubkey, account }) => { if (ownerSet.has(new PublicKey(account.data).toBase58())) positionKeys.push(pubkey) }) + rows.forEach(({ account }) => positionAccounts.push(account)) + if (rows.length) return + // first-time empties get a random age so the weekly re-checks are spread across runs instead of landing on one + const firstSeen = emptyOwners[owner] === undefined + stillEmpty[owner] = firstSeen ? now - Math.floor(Math.random() * EMPTY_OWNER_RECHECK_SECONDS) : now }, }) - const positions = (await getMultipleAccounts(positionKeys)).filter(Boolean).map(info => { + await setCache(CACHE_PROJECT, CACHE_KEY, { emptyOwners: stillEmpty }) + return positionAccounts +} + +async function tvl(api) { + const connection = getConnection(api.chain) + + const positions = (await getPositionAccounts(connection)).map(info => { const position = decodeAccount('meteoraPosition', info) const shares = position.liquidityShares.map(share => BigInt(share.toString())) for (let offset = DLMM_POSITION_BASE_SIZE; offset < info.data.length; offset += DLMM_EXTRA_BIN_SIZE) From c6452aa79249e91cb97db7b45fe56c8e6d666d14 Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 13 Nov 2026 22:39:49 +0200 Subject: [PATCH 735/988] phoenix: update YieldStrategy addresses to current mainnet set (#22188) Co-authored-by: Justin <12531162+gititGoro@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- registries/sumTokens.js | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 5dc93a5acac..a70af8b9682 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -22603,24 +22603,12 @@ const configs = { "ethereum": { "tokensAndOwners": [ [ - "0x79eB84B5E30Ef2481c8f00fD0Aa7aAd6Ac0AA54d", - "0xE7aEC21BF6420FF483107adCB9360C4b31d69D78" + "0xb45ad160634c528Cc3D2926d9807104FA3157305", + "0x981c7BE1460c7C8Cb40B8EB5908B29510Ae0B7EE" ], [ "0xa7569A44f348d3D70d8ad5889e50F78E33d80D35", - "0x8b4A75290A1C4935eC1dfd990374AC4BD4D33952" - ], - [ - ADDRESSES.ethereum.sUSDe, - "0xFc629bC5F6339F77635f4F656FBb114A31F7bCB3" - ], - [ - "0x79eB84B5E30Ef2481c8f00fD0Aa7aAd6Ac0AA54d", - "0x90ce274b20A2aF4265152B369d09ce6E6Dc177F9" - ], - [ - "0xa7569A44f348d3D70d8ad5889e50F78E33d80D35", - "0x90af002Ee537Ad5C2c9817Ebd4EF22B2e8952470" + "0xaFDf8DeA96a0F37Aae4869f813901bf73a3eAB83" ], [ ADDRESSES.ethereum.sUSDe, From e9ac3aa5e0e7395f64108f04236c17a1e779fd9a Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 13 Nov 2026 16:40:30 -0400 Subject: [PATCH 736/988] add nest avr (#22189) --- projects/nest-avr/index.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 projects/nest-avr/index.js diff --git a/projects/nest-avr/index.js b/projects/nest-avr/index.js new file mode 100644 index 00000000000..60fe964967d --- /dev/null +++ b/projects/nest-avr/index.js @@ -0,0 +1,32 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { addUniV4PoolReserves } = require('../helper/uniswapV4') + +// Nest AVR pools on Elysium are Uniswap v4 pools, each with its own hook deployed by the Nest AVR factory. +// The tokens sit in the Uniswap v4 PoolManager, so each pool's reserves are rebuilt on chain from its tick +// liquidity and current price (StateView). +const POOL_MANAGER = '0xE2e105d3F7209A9DA11f83cCf3E7398a753823F1' // Uniswap v4 PoolManager on Elysium +const STATE_VIEW = '0x27eD73aE0652fdCf71d6793412A7525f32bE9dfE' // Uniswap v4 StateView on Elysium +const POOL_MANAGER_FROM_BLOCK = 256083 // same as the uniswap-v4 adapter, so the Initialize log cache is shared with it +const AVR_FACTORY = '0x24c1e5076230a496083a23d7c00482d982a06171' +const AVR_FACTORY_FROM_BLOCK = 1501298 +// emitted by the factory for every pool it deploys: (address indexed hook, bytes32 indexed poolId, ...) +const POOL_DEPLOYED_TOPIC = '0x38e2693f0bd70571420a5caefce8dac22025da8b5d27448280c9c5e557ee3923' +const initializeAbi = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks, uint160 sqrtPriceX96, int24 tick)' + +async function tvl(api) { + const deployLogs = await getLogs2({ api, target: AVR_FACTORY, topics: [POOL_DEPLOYED_TOPIC], fromBlock: AVR_FACTORY_FROM_BLOCK }) + const poolIds = new Set(deployLogs.map((log) => log.topics[2].toLowerCase())) + + const initLogs = await getLogs2({ api, factory: POOL_MANAGER, eventAbi: initializeAbi, fromBlock: POOL_MANAGER_FROM_BLOCK }) + const pools = initLogs + .filter((log) => poolIds.has(log.id.toLowerCase())) + .map((log) => ({ id: log.id, token0: log.currency0, token1: log.currency1, spacing: Number(log.tickSpacing) })) + + await addUniV4PoolReserves({ api, pools, stateView: STATE_VIEW }) +} + +module.exports = { + doublecounted: true, // the pools live in the Uniswap v4 PoolManager, which the uniswap-v4 adapter counts too + methodology: 'Counts the liquidity in Nest AVR pools: the Uniswap v4 pools deployed through the Nest AVR factory, each with its own hook. Pools are found from the factory\'s deployment events and their reserves are rebuilt on chain from tick liquidity and the current price via StateView. The pools sit in the Uniswap v4 PoolManager, so the TVL is double counted with Uniswap v4.', + elysium: { tvl }, +} From a90b5f94ccfb2c16d8e367688d18cdce0fbe6a90 Mon Sep 17 00:00:00 2001 From: "duke.sol" <77286113+cryptoduke01@users.noreply.github.com> Date: Sat, 14 Nov 2026 12:21:24 +0100 Subject: [PATCH 737/988] Gloam: add Elysium (#22190) Co-authored-by: FelixBruguera --- projects/gloam/index.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/projects/gloam/index.js b/projects/gloam/index.js index 93bd5682fc1..289ccf446f0 100644 --- a/projects/gloam/index.js +++ b/projects/gloam/index.js @@ -1,18 +1,14 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokensExport } = require('../helper/unwrapLPs') +const { staking } = require('../helper/staking') -// Gloam's shielded pool (ShieldPoolPayments), the same address on every chain. +// Gloam's shielded pool (ShieldPoolPayments), the same address on every chain except Elysium. const POOL = '0x39e28cde55cab798874746ac52cb4b5cc99a0194' +const ELYSIUM_POOL = '0x89d3042390204f57b8b4f8949d3c2203e4002164' const GLOAM = '0xDcD885F5c60b3aD49F6D58718696417314e8724d' const OUSD = '0x20c0000000000000000000006a37da5c996874be' - -// pool balance minus the cash-out fees it holds for feeRecipient -async function addPoolBalances(api, tokens) { - if (!tokens.length) return - const balances = await api.getTokenBalances({ owner: POOL, tokens }) - const fees = await api.multiCall({ abi: 'function feesOwed(address) view returns (uint256)', target: POOL, calls: tokens }) - tokens.forEach((token, i) => api.add(token, BigInt(balances[i]) - BigInt(fees[i]))) -} +const KNTQ = '0xe45a355d9e9cad2ad85f2d03e3ee3102a036acf0' // the assets the pool accepts, from its DepositLimitSet events async function poolAssets(api, fromBlock) { @@ -20,19 +16,23 @@ async function poolAssets(api, fromBlock) { return [...new Set(logs.map(l => l.asset.toLowerCase()))].filter(t => t !== GLOAM.toLowerCase()) } -const fromLogs = (fromBlock) => ({ tvl: async (api) => addPoolBalances(api, await poolAssets(api, fromBlock)) }) +const fromLogs = (fromBlock) => async (api) => api.sumTokens({ owner: POOL, tokens: await poolAssets(api, fromBlock) }) module.exports = { - methodology: 'TVL is the tokens held by the Gloam shielded pool on Robinhood Chain, Tempo, Base and Ethereum, minus the cash-out fees the pool holds for the fee recipient. On Robinhood Chain, Base and Ethereum the accepted assets are discovered from the pool\'s DepositLimitSet events. $GLOAM held in the pool is the protocol\'s own token and is counted under staking.', + methodology: 'TVL is the tokens held by the Gloam shielded pool on Robinhood Chain, Tempo, Base, Ethereum and Elysium. On Robinhood Chain, Base and Ethereum the accepted assets are discovered from the pool\'s DepositLimitSet events. $GLOAM held in the pool is the protocol\'s own token and is counted under staking.', start: '2026-10-21', robinhood: { - tvl: async (api) => addPoolBalances(api, await poolAssets(api, 94194599)), - staking: (api) => addPoolBalances(api, [GLOAM]), + tvl: fromLogs(94194599), + staking: staking(POOL, GLOAM), }, tempo: { // static: the SDK's Tempo RPC rejects getLogs ranges; these are all of the pool's DepositLimitSet assets - tvl: (api) => addPoolBalances(api, [ADDRESSES.tempo.pathUSD, ADDRESSES.tempo.USDC_E, ADDRESSES.tempo.USDT0, OUSD]), + tvl: sumTokensExport({ owner: POOL, tokens: [ADDRESSES.tempo.pathUSD, ADDRESSES.tempo.USDC_E, ADDRESSES.tempo.USDT0, OUSD] }), + }, + base: { tvl: fromLogs(53109632) }, + ethereum: { tvl: fromLogs(26276183) }, + elysium: { + // the Elysium pool also holds native HYPE (address 0) + tvl: sumTokensExport({ owner: ELYSIUM_POOL, tokens: [ADDRESSES.null, ADDRESSES.elysium.USDC, KNTQ] }), }, - base: fromLogs(53109632), - ethereum: fromLogs(26276183), } From c8850c387cee5f9c0d5103b0e84453a26ebb4924 Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Sat, 14 Nov 2026 12:23:05 +0100 Subject: [PATCH 738/988] sentora: stop counting Euler vaults now governed by K3 (#22193) --- projects/sentora/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/projects/sentora/index.js b/projects/sentora/index.js index e2ef269778d..37434bcd368 100644 --- a/projects/sentora/index.js +++ b/projects/sentora/index.js @@ -97,10 +97,7 @@ const curatorExport = getCuratorExport({ methodology: 'Count all assets are deposited in all vaults curated by Sentora.', blockchains: { ethereum: { - eulerVaultOwners: [ - '0x5aB5FE7d04CFDeFb9daf61f6f569a58A53D05eE1', - '0xe78C246ea973389F55BAEADF71e04750D50417d1', - ], + // The Euler RLUSD and PYUSD markets Sentora deployed are now governed by K3 Capital and counted under projects/k3 morpho: ethereumMorphoVaults, morphoVaultOwners: ethereumMorphoVaultOwners, boringVaults: ethereumBoringVaults, From 39eb12068998065bd50089669bd77422efc4ac38 Mon Sep 17 00:00:00 2001 From: sudotx Date: Sat, 14 Nov 2026 12:37:17 +0100 Subject: [PATCH 739/988] Add Curveball TVL adapter on RISE (#22191) Co-authored-by: FelixBruguera --- registries/sumTokens.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index a70af8b9682..5c368c0db17 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -12473,6 +12473,11 @@ const configs = { ] }, }, + "curveball": { + methodology: 'Counts the WETH held by the Curveball launchpad, which backs its active bonding curves. Liquidity that has graduated into Icarus pools is not counted.', + start: '2026-11-09', + rise: { owner: '0xCD07f89C29E1FAE77EC1a342b5D47D9008E9a72d', tokens: ['0x4200000000000000000000000000000000000006'] }, + }, "curves": { "methodology": "We count the ETH locked in the Curves trading contracts (0xEad4138380B508949Ccd48B97AD930bd89aAb719, 0x88c7484d19E49B09233484824698a5214d81f866)", "formnetwork": { From c28077607d97000ebc0f63e605a7c4b6384330d3 Mon Sep 17 00:00:00 2001 From: labs-alpha Date: Sat, 14 Nov 2026 16:16:33 +0100 Subject: [PATCH 740/988] alpha-launchpad: add Polygon (#22194) Co-authored-by: labs-alpha <332989026+labs-alpha@users.noreply.github.com> --- projects/alpha-launchpad/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/alpha-launchpad/index.js b/projects/alpha-launchpad/index.js index cc38644a89c..e52f2f75f28 100644 --- a/projects/alpha-launchpad/index.js +++ b/projects/alpha-launchpad/index.js @@ -14,6 +14,7 @@ const config = { monad: { factory: '0xB2Aa70bF167AEc63DBC49f14F12d4301E5a3c2A8', fromBlock: 121283239 }, avax: { factory: '0xB2Aa70bF167AEc63DBC49f14F12d4301E5a3c2A8', fromBlock: 100053182 }, arbitrum: { factory: '0xB2Aa70bF167AEc63DBC49f14F12d4301E5a3c2A8', fromBlock: 523406566 }, + polygon: { factory: '0xB2Aa70bF167AEc63DBC49f14F12d4301E5a3c2A8', fromBlock: 97230966 }, } async function tvl(api) { From 87aeadc0e9ec4b9d414a49ebf78a796fba182933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Murrell?= Date: Sat, 14 Nov 2026 16:18:00 +0100 Subject: [PATCH 741/988] feat(peridot): add Robinhood Chain lending markets (#22195) --- projects/peridot/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/peridot/index.js b/projects/peridot/index.js index ffc602be635..5c6df2c982d 100644 --- a/projects/peridot/index.js +++ b/projects/peridot/index.js @@ -33,8 +33,10 @@ async function stellarBorrowed(api) { } module.exports = { - methodology: 'TVL is the underlying held by the protocol: on BSC and Monad the cash of every Peridot market listed on the comptroller, on Stellar the available liquidity of each Soroban ReceiptVault (underlying held directly plus underlying the vault has forwarded into its DeFindex boosted vault). Outstanding debt is reported separately as borrowed.', + methodology: 'TVL is the underlying held by the protocol: on BSC, Monad and Robinhood Chain the cash of every Peridot market listed on the comptroller (on Robinhood Chain getCash() already includes the share each market has forwarded into its paired liquidity vault), on Stellar the available liquidity of each Soroban ReceiptVault (underlying held directly plus underlying the vault has forwarded into its DeFindex boosted vault). Outstanding debt is reported separately as borrowed.', bsc: compoundExports2({ comptroller: '0x6fC0c15531CB5901ac72aB3CFCd9dF6E99552e14' }), monad: compoundExports2({ comptroller: '0x6D208789f0a978aF789A3C8Ba515749598940716', blacklistedMarkets: ['0xf8255935e62aa000c89de46a97d2f00bfff147e7'], cether: '0x2FB2861402A22244464435773dd1C6951735CdF7' }), + // USDG / NVDA lending markets behind the isolated-margin product; margin collateral is pUSDG, so it is in the market cash. + robinhood: compoundExports2({ comptroller: '0x6148183676e304dbe63a85c350c208da3ceac39c' }), stellar: { tvl: stellarTvl, borrowed: stellarBorrowed }, } From 8f74954473561dd881d587e2d833c9d68ed509d8 Mon Sep 17 00:00:00 2001 From: paboxolabs Date: Sun, 15 Nov 2026 02:01:30 +0700 Subject: [PATCH 742/988] Add Paboxo: lending market for Stock Tokens on Robinhood Chain (#22196) Co-authored-by: Paboxo <356716720+paboxolabs@users.noreply.github.com> --- projects/paboxo/index.js | 77 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 projects/paboxo/index.js diff --git a/projects/paboxo/index.js b/projects/paboxo/index.js new file mode 100644 index 00000000000..ac63601453f --- /dev/null +++ b/projects/paboxo/index.js @@ -0,0 +1,77 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// Paboxo (paboxo.xyz) is a lending market for tokenized stocks on Robinhood Chain: users post a stock token +// (or WETH) as collateral and borrow USDG from it. +// +// Lenders deposit USDG into one ERC4626 earn vault, which is the only supplier of every market. The vault keeps +// the USDG idle and a market pulls it only when a borrow needs it, so un-borrowed liquidity sits in the vault and +// a little booked cash (plus reserves) sits in each market's LendingPool. Every borrower gets a Position contract +// per market, created by the LendingPool and announced through the PaboxoEmitter; the Position holds the +// collateral. +// +// tvl = USDG held by the vault and by every market it supplies (vault withdraw/supply queues) +// + collateral held by every Position contract (PositionCreated logs) +// borrowed = totalBorrowAssets of every market router the vault supplies +// +// Not counted yet: Uniswap v3/v4 LP NFTs posted as collateral in the LP markets (their Positions are announced +// by a separate emitter). Their USDG cash and debt are counted, since the same vault supplies them. +const VAULT = '0xaF5aE508b2B57587c6cB9704950fa86c4090c634' // Paboxo USDG earn vault +const EMITTER = '0xe3463043C6dFda7444E9C133C368740b8C4057d9' // PaboxoEmitter of the stock/WETH markets +const FROM_BLOCK = 86793701 // core deployment block + +const abi = { + asset: 'function asset() view returns (address)', + withdrawQueueLength: 'function withdrawQueueLength() view returns (uint256)', + withdrawQueue: 'function withdrawQueue(uint256) view returns (address)', + supplyQueueLength: 'function supplyQueueLength() view returns (uint256)', + supplyQueue: 'function supplyQueue(uint256) view returns (address)', + markets: 'function markets(address) view returns (address router, uint256 cap, bool enabled)', + router: 'function router() view returns (address)', + collateralToken: 'function collateralToken() view returns (address)', + borrowToken: 'function borrowToken() view returns (address)', + totalBorrowAssets: 'function totalBorrowAssets() view returns (uint256)', + positionCreated: 'event PositionCreated(address lendingPool, address lendingPoolRouter, address user, address position)', +} + +async function getMarkets(api) { + const [withdrawQueue, supplyQueue] = await Promise.all([ + api.fetchList({ lengthAbi: abi.withdrawQueueLength, itemAbi: abi.withdrawQueue, target: VAULT }), + api.fetchList({ lengthAbi: abi.supplyQueueLength, itemAbi: abi.supplyQueue, target: VAULT }), + ]) + const pools = [...new Set([...withdrawQueue, ...supplyQueue].map((p) => p.toLowerCase()))] + const routers = (await api.multiCall({ abi: abi.markets, target: VAULT, calls: pools })).map((m) => m.router) + return { pools, routers } +} + +async function tvl(api) { + const usdg = await api.call({ abi: abi.asset, target: VAULT }) + const { pools } = await getMarkets(api) + const tokensAndOwners = [VAULT, ...pools].map((owner) => [usdg, owner]) + + const logs = await getLogs2({ api, target: EMITTER, eventAbi: abi.positionCreated, fromBlock: FROM_BLOCK }) + if (logs.length) { + const routers = [...new Set(logs.map((l) => l.lendingPoolRouter.toLowerCase()))] + const collaterals = await api.multiCall({ abi: abi.collateralToken, calls: routers }) + const collateralOf = Object.fromEntries(routers.map((r, i) => [r, collaterals[i]])) + logs.forEach((l) => tokensAndOwners.push([collateralOf[l.lendingPoolRouter.toLowerCase()], l.position])) + } + + return sumTokens2({ api, tokensAndOwners }) +} + +async function borrowed(api) { + const { routers } = await getMarkets(api) + const [tokens, debts] = await Promise.all([ + api.multiCall({ abi: abi.borrowToken, calls: routers }), + api.multiCall({ abi: abi.totalBorrowAssets, calls: routers }), + ]) + api.add(tokens, debts) +} + +module.exports = { + methodology: + 'TVL is the USDG held by the Paboxo earn vault and by the lending markets it supplies, plus the stock tokens and WETH that borrowers hold as collateral in their Position contracts (found through PositionCreated events). Borrowed is the outstanding USDG debt of every market. Uniswap LP NFTs posted as collateral in the LP markets are not counted yet.', + start: '2026-10-12', + robinhood: { tvl, borrowed }, +} From d12c921528332743d0e31fa332b962748f6f44f8 Mon Sep 17 00:00:00 2001 From: brnrbase Date: Sun, 15 Nov 2026 02:40:40 -0500 Subject: [PATCH 743/988] Add AurixDEX (Flare) (#22198) --- projects/aurixdex/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/aurixdex/index.js diff --git a/projects/aurixdex/index.js b/projects/aurixdex/index.js new file mode 100644 index 00000000000..42d4bd17c05 --- /dev/null +++ b/projects/aurixdex/index.js @@ -0,0 +1,18 @@ +const sdk = require('@defillama/sdk') +const { getUniTVL } = require('../helper/unknownTokens') +const { uniV3Export } = require('../helper/uniswapV3') + +// AurixDEX on Flare: Uniswap V2-style pools + concentrated-liquidity (Uniswap V3) pools +const V2_FACTORY = '0x2951Ae32056B037E43a6028cce7f735aff6214Ac' +const V3_FACTORY = '0x7b79037CcEd1fDfAF77d57214de5663E180E3Eb1' + +const v2 = getUniTVL({ chain: 'flare', factory: V2_FACTORY, useDefaultCoreAssets: true }) +const v3 = uniV3Export({ flare: { factory: V3_FACTORY, fromBlock: 72138196 } }) + +module.exports = { + methodology: 'TVL is the value of the tokens held in AurixDEX liquidity pools on Flare: the reserves of every V2 pair created by the AurixDEX V2 factory, plus the token balances of every concentrated-liquidity (Uniswap V3-style) pool created by the AurixDEX V3 factory, found from its PoolCreated events.', + start: '2026-11-14', + flare: { + tvl: sdk.util.sumChainTvls([v2, v3.flare.tvl]), + }, +} From 7b468f4843a76b69d928a1cf2870d4d3e7ef5290 Mon Sep 17 00:00:00 2001 From: Infinite Minds Dev Date: Sun, 15 Nov 2026 03:05:53 -0500 Subject: [PATCH 744/988] STOCKMON: add DNA-era Genesis vault to TVL, move staking from MON to DNA (#22200) Co-authored-by: Claude --- projects/stockmon/index.js | 48 ++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/projects/stockmon/index.js b/projects/stockmon/index.js index 2048769d4dd..555ddbeb783 100644 --- a/projects/stockmon/index.js +++ b/projects/stockmon/index.js @@ -1,40 +1,38 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') -// Vaults by collection. -const VAULTS = [ - "0xb78edcb4de39355747c62e6d55209c01a2294ad8", // Genesis Vault -]; -// Aetheryn birth vaults: each Aetheryn's MON is held here until its owner redeems it. -const AETHERYN_BIRTH_VAULTS = [ - "0xa54221b56837d5f3707d0ed9883a01edf7dae2cf", // Aetheryn Birth Vault (Breeding v3) - "0xad2a6cbdb2c1b01c19d52585eee75b8e86f9989a", // Aetheryn Birth Vault (Breeding v4) -]; +// Genesis vaults: each Genesis NFT owns a basket of stock tokens. +const GENESIS_VAULT = "0xb78edcb4de39355747c62e6d55209c01a2294ad8" // original vault (WETH in, stock tokens bought) +const GENESIS_SIDECAR_VAULT = "0x1410d31db4a947736bbbe54ecbdd5cdc4a1cea4c" // DNA-era vault (native ETH in, same 16 stock tokens bought) + +// DNA held for Aetheryn NFTs and sealed Eggs until the owner redeems, hatches or refunds. +const DNA = "0x5f2b0542caa2e6b8dab50bfa846063a723b5823b" +const DNA_HOLDERS = [ + "0xbe230be974523724c873232a73269025005f7738", // Aetheryn Birth Vault (Breeding v5) + "0xb155dff749032dd5c1d37ae719207abac3bada9f", // Aetheryn Legacy DNA Vault (backs Breeding v3 and v4 Aetheryns after the MON to DNA migration) + "0xfb61c5061721aa99563149599a64f0fcbcb5e6ec", // Aetheryn Tier Pool + "0x6834f2132ba6fb15831e0dff9fd874d6a7fd7451", // Breeding v4 top-up vault + "0x9d63df98db28fcb3dcc78d59e20aec04bc591706", // Breeding v5 coordinator (refundable Egg escrow) +] const WETH = ADDRESSES.robinhood.WETH.toLowerCase() -const MON = "0x7c646a41572b441527169c576ef0c0a40c667777" async function tvl(api) { - const assetRegistry = await api.call({ abi: 'address:assetRegistry', target:'0xb78edcb4de39355747c62e6d55209c01a2294ad8' }); - const stocks = await api.fetchList({ lengthAbi: 'ASSET_COUNT', itemAbi: 'function assetAt(uint8) view returns (address)', target: assetRegistry}) - const tokens = stocks.concat([WETH]) - await api.sumTokens({ tokens, owners: VAULTS }) + const assetRegistry = await api.call({ abi: 'address:assetRegistry', target: GENESIS_VAULT }) + const stocks = await api.fetchList({ lengthAbi: 'ASSET_COUNT', itemAbi: 'function assetAt(uint8) view returns (address)', target: assetRegistry }) + await api.sumTokens({ tokens: stocks.concat([WETH]), owners: [GENESIS_VAULT] }) + // The sidecar vault holds the same stock tokens plus native ETH waiting to be spent on them; all of it belongs to Genesis holders. + await api.sumTokens({ tokens: stocks.concat([ADDRESSES.null]), owners: [GENESIS_SIDECAR_VAULT] }) - // Treasury revenue remains in the vault until claimed, but it is not user TVL. - const claimableTreasuryWeth = await api.multiCall({ - abi: 'uint256:claimableNonStockQuote', - calls: VAULTS.map(target => ({ target })), - }) - const totalClaimableTreasuryWeth = claimableTreasuryWeth.reduce( - (total, amount) => total + BigInt(amount), 0n - ) - api.add(WETH, (-totalClaimableTreasuryWeth).toString()) + // Treasury revenue remains in the original vault until claimed, but it is not user TVL. + const claimableTreasuryWeth = await api.call({ abi: 'uint256:claimableNonStockQuote', target: GENESIS_VAULT }) + api.add(WETH, (-BigInt(claimableTreasuryWeth)).toString()) return api.getBalances() } module.exports = { - methodology: "TVL is the value of stock tokens and holder-backed WETH held in STOCKMON vaults, excluding WETH claimable by the protocol treasury. Staking is the MON held in the Aetheryn birth vaults (Breeding v3 and v4) that backs each Aetheryn", + methodology: "TVL is the value of stock tokens, holder-backed WETH and ETH held in the two STOCKMON Genesis vaults, excluding WETH claimable by the protocol treasury. Staking is the DNA (the protocol token, which replaced MON) held in the Aetheryn vaults and the Breeding Egg escrow, which backs each Aetheryn and each sealed Egg.", robinhood: { tvl, - staking: sumTokensExport({ owners: AETHERYN_BIRTH_VAULTS, tokens: [MON] }), + staking: sumTokensExport({ owners: DNA_HOLDERS, tokens: [DNA] }), }, }; From 30b23642d6399dcfd97882d0c778a587cf24a3eb Mon Sep 17 00:00:00 2001 From: Dani Date: Sun, 15 Nov 2026 09:08:45 +0100 Subject: [PATCH 745/988] Add BLNT V3 (Stellar), resolves #22197 (#22202) Co-authored-by: Donovan Levinson --- projects/blnt-v3/index.js | 89 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 projects/blnt-v3/index.js diff --git a/projects/blnt-v3/index.js b/projects/blnt-v3/index.js new file mode 100644 index 00000000000..47c1e93bde9 --- /dev/null +++ b/projects/blnt-v3/index.js @@ -0,0 +1,89 @@ +const { callSoroban, getContractEvents } = require("../helper/chain/stellar"); +const { getCache, setCache } = require("../helper/cache"); +const methodologies = require("../helper/methodologies"); + +const BACKSTOP = "CAHCUKBPTW5DR5RNXOHCTJD5U76A6EEZXYZAQFRQEEQRXQ3CRUZ6Z3MO"; +const POOL_FACTORY = "CAKLFWAHB2RIYRBSPUL6EH43AIQ5ILBEM7HTMWYSJRL7PHZQ676KMCV5"; +const USDC = "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75"; +const XLM = "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA"; +const BLNT_USDC = "CDQMIKIHKA5UY3FQJ2UDTLNX3GOPD3GPNZWSPTOBVOHEUMQJQXOPC7Y3"; +const BLNT_XLM = "CA5HX3D47PQZWC2E7VWXCKH4534P2NOJEOIXAWU47MI4QV2FQUYY3FLC"; +const SCALAR_12 = 10n ** 12n; + +// Seed the production pools because Soroban RPC event history is bounded. New +// pools are added from factory events and persisted in the DefiLlama cache. +const KNOWN_POOLS = [ + "CACSQWCMKG45TUHCQ3LXHOB7YEEJH4W376ZHQPXH2IZ3TE4NJHFZMCY7", // Fixed Pool V3 + "CAUTPSQDAJEUV5XEU3EXFVYRGDJLEJGVTFJCFZCSPTDCREAMZ573VF4D", // YieldBlent +]; + +async function getPools() { + const cached = (await getCache("blnt-v3", "stellar"))?.pools ?? []; + const pools = new Set([...KNOWN_POOLS, ...cached]); + (await callSoroban(BACKSTOP, "reward_zone")).forEach((pool) => pools.add(pool)); + + try { + const events = await getContractEvents({ contractId: POOL_FACTORY, topic: "deploy" }); + events.forEach(({ data }) => pools.add(data)); + } catch (e) { + console.log("blnt-v3: factory event discovery failed, using known and cached pools:", e.message); + } + + const next = [...pools].sort(); + if (JSON.stringify(next) !== JSON.stringify([...cached].sort())) + await setCache("blnt-v3", "stellar", { pools: next }); + return next; +} + +let poolAssets; +async function getPoolAssets() { + if (!poolAssets) poolAssets = (async () => { + const out = []; + for (const pool of await getPools()) + out.push({ pool, assets: await callSoroban(pool, "get_reserve_list") }); + return out; + })(); + return poolAssets; +} + +// pool reserve custody (borrowed excluded) plus direct USDC/XLM backstop tier deposits +async function tvl(api) { + for (const { pool, assets } of await getPoolAssets()) + for (const asset of assets) + api.add(asset, (await callSoroban(asset, "balance", [pool])).toString()); + for (const token of [USDC, XLM]) + api.add(token, (await callSoroban(token, "balance", [BACKSTOP])).toString()); +} + +async function borrowed(api) { + for (const { pool, assets } of await getPoolAssets()) + for (const asset of assets) { + const { data } = await callSoroban(pool, "get_reserve", [asset]); + api.add(asset, ((data.d_supply * data.d_rate) / SCALAR_12).toString()); + } +} + +// backstop's share of each canonical Comet pool's recorded reserves, as raw tokens +async function pool2(api) { + for (const comet of [BLNT_USDC, BLNT_XLM]) { + const [lp, totalSupply, tokens] = await Promise.all([ + callSoroban(comet, "balance", [BACKSTOP]), + callSoroban(comet, "get_total_supply"), + callSoroban(comet, "get_tokens"), + ]); + for (const token of tokens) { + const reserve = await callSoroban(comet, "get_balance", [token]); + api.add(token, (reserve * lp / totalSupply).toString()); + } + } +} + +module.exports = { + timetravel: false, + methodology: `${methodologies.lendingMarket} TVL is the on-chain reserve-token custody of every pool deployed by the BLNT V3 factory, plus the USDC and XLM deposited directly into the shared backstop's USDC and XLM tiers. Borrowed is each reserve's outstanding debt (d_supply * d_rate). Pool2 is the backstop's proportional share of the canonical BLNT:USDC and BLNT:XLM Comet pools, counted as raw tokens. BLNT emissions held by the backstop are excluded.`, + stellar: { + tvl, + borrowed, + pool2, + }, +}; From 7317541f0ea9391c662ecf92cd93bbdbcd41df4e Mon Sep 17 00:00:00 2001 From: Robin | Liquidium <75593191+robin-liquidium@users.noreply.github.com> Date: Mon, 16 Nov 2026 02:17:32 +0800 Subject: [PATCH 746/988] Add Liquidium SOL pool to TVL adapter (#22203) Co-authored-by: Claude Opus 5.5 --- projects/liquidium/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/liquidium/index.js b/projects/liquidium/index.js index 8c454ca3ece..e40c111a8c7 100644 --- a/projects/liquidium/index.js +++ b/projects/liquidium/index.js @@ -6,12 +6,14 @@ const USDT_POOL_CANISTER_ID = 'hnnn4-iyaaa-aaaar-qb4bq-cai' const USDC_POOL_CANISTER_ID = '6sna2-oiaaa-aaaar-qb66q-cai' const ICP_POOL_CANISTER_ID = 'r2pk3-4yaaa-aaaar-qb7zq-cai' const ETH_POOL_CANISTER_ID = 'qcg7y-syaaa-aaaar-qb75q-cai' +const SOL_POOL_CANISTER_ID = 'xhh4q-qyaaa-aaaar-qci2q-cai' const ALLOWED_POOL_CANISTERS = new Set([ BTC_POOL_CANISTER_ID, USDT_POOL_CANISTER_ID, USDC_POOL_CANISTER_ID, ICP_POOL_CANISTER_ID, ETH_POOL_CANISTER_ID, + SOL_POOL_CANISTER_ID, ]) const MAX_SAFE_BIGINT = BigInt(Number.MAX_SAFE_INTEGER) From 1afacabaea9b406c02ca33c9dd7439acc716044c Mon Sep 17 00:00:00 2001 From: silto Date: Sun, 15 Nov 2026 19:18:42 +0100 Subject: [PATCH 747/988] Add Hookr TVL on Robinhood (#22199) Co-authored-by: ccipherx --- projects/hookr/index.js | 123 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 projects/hookr/index.js diff --git a/projects/hookr/index.js b/projects/hookr/index.js new file mode 100644 index 00000000000..d92c68d968b --- /dev/null +++ b/projects/hookr/index.js @@ -0,0 +1,123 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') +const { addUniV4PoolReserves, chainConfig } = require('../helper/uniswapV4') + +// https://hookr.fun/docs/reference/contracts-and-addresses · https://hookr.fun/docs/previous-releases +const HOOKR = '0x18e674231a58c239dc7daedcffe15ec3a24cff5c' +const registry = '0x463c82bea1a52f4cc05ca0741a24f0ad24ba4602' +const root = '0x89c9fb50d1f03192230ffb1c279bb6e7d3fe6acc' +const treasury = '0x2242f7fc75606500503075f29ea8cda684efb4a9' +const modularRegistry = '0x5b7f1a117a83aaac15b0698aa4eb9d53fe5f5ba3' +const modularKernels = [ + '0xb3ca29cf721380cee8b8e4755f3865ebc68fe8cc', + '0xb914f955294799de4b891bd2ea8af628fa1c68cc', + '0xc7c516cd5546bcb2592fe3f8aa91c2a4ba3768cc', + '0xa99902a2922014bbe2bf2dcf15742ac5104828cc', + '0xe5429db8f63912e632e86733905667aaeb6ea8cc', +] +const launchFields = '(address indexed token,bytes32 indexed poolId,uint160 sqrtPriceX96,uint256 ethLiquidity,uint256 tokenLiquidity,uint256 tokensBurned)' +const launchpads = [ + { target: '0xaaed6fab06d53311220f35421dda5cc6d6e9d6c3', fromBlock: 27763919, eventAbi: `event Graduated${launchFields}` }, + { target: '0x5ce779d23d2e99d322004f203813389b6a426e3b', fromBlock: 33485079, eventAbi: `event Graduated${launchFields}` }, + { target: '0xa043cabe645636899dde91cce4693c00a015e660', fromBlock: 41850162, eventAbi: `event Migrated${launchFields}` }, +] +const rootEvents = [ + 'event RootRegistered(address indexed root)', + 'event FactoryRootRegistered(address indexed factory,address indexed root)', + 'event OwnedRootRegistered(address indexed root,address indexed factory,address indexed template,address rules)', +] +const poolOpenedAbi = 'event PoolOpened(bytes32 indexed id,address indexed launcher,bytes32 indexed policyHash,address rules,address advisory)' +const stackInitializedAbi = 'event StackInitialized(bytes32 indexed poolId,bytes32 indexed stackHash,address indexed kernel)' +const initializeAbi = 'event Initialize(bytes32 indexed id,address indexed currency0,address indexed currency1,uint24 fee,int24 tickSpacing,address hooks,uint160 sqrtPriceX96,int24 tick)' +const INITIALIZE_TOPIC = '0xdd466e674ea557f56295e2d0218a125ea4b4f0f6f3307b95f85e6110838d6438' + +const eventName = (abi) => abi.match(/event (\w+)/)[1] + +async function registrations(api) { + const regs = [] + for (const { target, fromBlock, eventAbi } of launchpads) { + const logs = await getLogs2({ api, target, eventAbi, fromBlock, onlyArgs: false, extraKey: `hookr-${eventName(eventAbi)}` }) + logs.forEach((l) => regs.push({ id: l.args.poolId.toLowerCase(), block: l.blockNumber })) + } + + const roots = new Set([root]) + for (const eventAbi of rootEvents) { + const logs = await getLogs2({ api, target: registry, eventAbi, fromBlock: 82269732, extraKey: `hookr-${eventName(eventAbi)}` }) + logs.forEach((l) => roots.add(l.root.toLowerCase())) + } + const opened = [] + for (const hook of roots) { + const logs = await getLogs2({ api, target: hook, eventAbi: poolOpenedAbi, fromBlock: 82270270, onlyArgs: false, extraKey: 'hookr-PoolOpened' }) + logs.forEach((l) => opened.push({ id: l.args.id.toLowerCase(), block: l.blockNumber, hook, rules: l.args.rules.toLowerCase() })) + } + // only pools whose Rules pay Hookr's treasury, not independent roots running the same software + const rules = [...new Set(opened.map((p) => p.rules))] + const recipients = rules.length ? await api.multiCall({ abi: 'address:protocolRecipient', calls: rules }) : [] + const admitted = new Set(rules.filter((_, i) => recipients[i].toLowerCase() === treasury)) + opened.filter((p) => admitted.has(p.rules)).forEach(({ id, block, hook }) => regs.push({ id, block, hook })) + + const stacks = await getLogs2({ api, target: modularRegistry, eventAbi: stackInitializedAbi, fromBlock: 57319489, onlyArgs: false }) + stacks + .filter((l) => modularKernels.includes(l.args.kernel.toLowerCase())) + .forEach((l) => regs.push({ id: l.args.poolId.toLowerCase(), block: l.blockNumber, hook: l.args.kernel.toLowerCase() })) + return regs +} + +async function discoverPools(api) { + const byId = new Map() + for (const reg of await registrations(api)) { + const prev = byId.get(reg.id) + if (prev && (prev.block !== reg.block || (prev.hook && reg.hook && prev.hook !== reg.hook))) + throw new Error(`Hookr: conflicting registration for ${reg.id}`) + byId.set(reg.id, { ...prev, ...reg }) + } + // each registration is emitted in the same block as its PoolManager Initialize, so read that one block by pool id + const { poolManager } = chainConfig[api.chain] + const regs = [...byId.values()] + const pools = new Map() + for (let i = 0; i < regs.length; i += 10) { + await Promise.all(regs.slice(i, i + 10).map(async ({ id, block, hook }) => { + // skipCache: the PoolManager key is shared with uniswap-v4's unfiltered Initialize cache + const [log] = await getLogs2({ api, target: poolManager, eventAbi: initializeAbi, topics: [INITIALIZE_TOPIC, id], fromBlock: block, toBlock: block + 1, skipCache: true, useIndexer: false }) + if (!log || (hook && hook !== log.hooks.toLowerCase())) throw new Error(`Hookr: Initialize does not match registration for ${id}`) + pools.set(id, { id: log.id, token0: log.currency0, token1: log.currency1, spacing: Number(log.tickSpacing) }) + })) + } + if (pools.size !== byId.size) throw new Error(`Hookr: ${byId.size} registered pools but ${pools.size} Initialize events`) + return [...pools.values()] +} + +// quote assets only: launched tokens are excluded, HOOKR (the protocol token) goes to staking +const quotes = new Set([ADDRESSES.null, ...Object.values(ADDRESSES.robinhood)].map((a) => a.toLowerCase())) +const reserves = {} + +async function poolBalances(api) { + const key = `${api.chain}-${api.block}` + if (!reserves[key]) reserves[key] = (async () => { + const pools = await discoverPools(api) + const balances = {} + const recorder = { multiCall: (...args) => api.multiCall(...args), add: (token, amount) => { token = token.toLowerCase(); balances[token] = (balances[token] ?? 0) + Number(amount) } } + await addUniV4PoolReserves({ api: recorder, pools, stateView: chainConfig[api.chain].stateView }) + return balances + })() + return reserves[key] +} + +async function tvl(api) { + await api.getBlock() + const balances = await poolBalances(api) + Object.entries(balances).forEach(([token, amount]) => { if (token !== HOOKR && quotes.has(token)) api.add(token, amount) }) +} + +async function staking(api) { + await api.getBlock() + const balances = await poolBalances(api) + if (balances[HOOKR]) api.add(HOOKR, balances[HOOKR]) +} + +module.exports = { + start: '2026-08-04', + doublecounted: true, + methodology: 'Counts the quote-asset side (ETH, USDG and other Robinhood core assets) of the liquidity in Hookr Uniswap V4 pools across the legacy launchpads, modular kernels and current roots, including third-party LP positions. Hookr-launched tokens are excluded. HOOKR held in these pools is counted under staking. Accrued fees, pre-pool curves and auctions, tokenizer backing and treasury or burn-jar balances are excluded. Pools overlap Uniswap V4 TVL.', + robinhood: { tvl, staking }, +} From 78d0df2e4920dcdd928a01075fab5a528f79cf3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Murrell?= Date: Sun, 15 Nov 2026 19:20:14 +0100 Subject: [PATCH 748/988] Peridot: track the new Stellar cash markets (#22204) --- projects/peridot/index.js | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/projects/peridot/index.js b/projects/peridot/index.js index 5c6df2c982d..ca4f4ae91fb 100644 --- a/projects/peridot/index.js +++ b/projects/peridot/index.js @@ -2,38 +2,34 @@ const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports2 } = require('../helper/compound') const { callSoroban } = require('../helper/chain/stellar') -// Peridot on Stellar is a Soroban deployment (not a Compound fork port): each market is a -// ReceiptVault contract that custodies the underlying SAC and tracks its own debt ledger. -// https://github.com/PeridotFinance/Peridot-Soroban/blob/main/peridot-contracts/contracts/receipt-vault/src/lib.rs +// Peridot on Stellar is a Soroban deployment (not a Compound fork port). Since 2026-11-12 it runs +// supply-only cash markets: each market contract custodies its underlying SAC directly, with +// borrowing disabled and no yield source attached. The previous ReceiptVault markets +// (CBU4Y7CJ..., CBVUJJIJ..., CD3WN3PL...) were retired after a key compromise and hold nothing. const stellarMarkets = [ - { vault: 'CBU4Y7CJFOUZZE3QBOXTKM54UTUYW3SDJWTNMDGJBNCR5HS5UCEKV3BE', underlying: ADDRESSES.stellar.XLM }, - { vault: 'CBVUJJIJTRJNOORPPCVH72DP7YDCOMDHI6WYKP3WOFVEPSCVP3TBXHIN', underlying: ADDRESSES.stellar.USDC }, - { vault: 'CD3WN3PLW63HFZXE56OTRLMBV46WG54TFPGRL4RDQ43HQTTWVB4RPO3G', underlying: ADDRESSES.stellar.EURC }, + { market: 'CDW3GDNKLUEPPJLEUVGLJSKGYLB3YYDQBUY7NBHJILGQWNN55AYFHY3F', underlying: ADDRESSES.stellar.USDC }, + { market: 'CBHMG4CNJO2CRGADUMIO3UJ45C5MTWGCBFECMR6QE2TDDCDBB3N24WMS', underlying: ADDRESSES.stellar.XLM }, + { market: 'CD6OTGA6J6UIEKXTXA5CLPLSJA4VQ5HEOYP3CA375CZEHI3KMIL2OYZC', underlying: 'CCCRWH6Q3FNP3I2I57BDLM5AFAT7O6OF6GKQOC6SSJNDAVRZ57SPHGU2' }, // PYUSD + { market: 'CAXWP5M2SF74DW22EQAYOXR4ZHN2FO2HGL737KQ2WFPEZTA4Z3W5E2M4', underlying: ADDRESSES.stellar.EURC }, ] -// Unborrowed underlying owned by the vault, i.e. the Soroban equivalent of Compound's getCash(). -// -// This must be read from the vault's own ledger rather than from the SAC balance of the vault -// address: each ReceiptVault forwards idle underlying into a DeFindex "boosted" vault for extra -// yield, so the underlying it owns is (SAC balance held directly) + (value of the DeFindex shares -// it holds). get_available_liquidity() returns that sum. Reading balance(underlying, vault) sees -// only the un-swept remainder and understates every market by roughly an order of magnitude. +// Unborrowed underlying held by each market, i.e. the Soroban equivalent of Compound's getCash(). async function stellarTvl(api) { - await Promise.all(stellarMarkets.map(async ({ vault, underlying }) => { - const cash = await callSoroban(vault, 'get_available_liquidity') + await Promise.all(stellarMarkets.map(async ({ market, underlying }) => { + const cash = await callSoroban(market, 'get_available_liquidity') api.add(underlying, cash.toString()) })) } async function stellarBorrowed(api) { - await Promise.all(stellarMarkets.map(async ({ vault, underlying }) => { - const borrowed = await callSoroban(vault, 'get_total_borrowed') + await Promise.all(stellarMarkets.map(async ({ market, underlying }) => { + const borrowed = await callSoroban(market, 'get_total_borrowed') api.add(underlying, borrowed.toString()) })) } module.exports = { - methodology: 'TVL is the underlying held by the protocol: on BSC, Monad and Robinhood Chain the cash of every Peridot market listed on the comptroller (on Robinhood Chain getCash() already includes the share each market has forwarded into its paired liquidity vault), on Stellar the available liquidity of each Soroban ReceiptVault (underlying held directly plus underlying the vault has forwarded into its DeFindex boosted vault). Outstanding debt is reported separately as borrowed.', + methodology: 'TVL is the underlying held by the protocol and not lent out: on BSC, Monad and Robinhood Chain the underlying balance of every Peridot market listed on the comptroller, on Stellar the available liquidity of each cash market (USDC, XLM, PYUSD, EURC). Outstanding debt is reported separately as borrowed.', bsc: compoundExports2({ comptroller: '0x6fC0c15531CB5901ac72aB3CFCd9dF6E99552e14' }), monad: compoundExports2({ comptroller: '0x6D208789f0a978aF789A3C8Ba515749598940716', blacklistedMarkets: ['0xf8255935e62aa000c89de46a97d2f00bfff147e7'], cether: '0x2FB2861402A22244464435773dd1C6951735CdF7' }), // USDG / NVDA lending markets behind the isolated-margin product; margin collateral is pUSDG, so it is in the market cash. From 298ec0581a79f8e4d4343a393084b7d231a41346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Mon, 16 Nov 2026 12:11:28 +0530 Subject: [PATCH 749/988] venofinance: stop counting vETH/vUSD on Cronos zkEVM on top of ethereum (#22205) --- projects/venofinance/index.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/projects/venofinance/index.js b/projects/venofinance/index.js index 16765dd6a71..f7f74222b8f 100644 --- a/projects/venofinance/index.js +++ b/projects/venofinance/index.js @@ -6,8 +6,6 @@ const vno_contract_address = "0xdb7d0a1ec37de1de924f8e8adac6ed338d4404e9"; const zkCRO_contract_address = "0x28Ff2E4dD1B58efEB0fC138602A28D5aE81e44e2"; const ybETH_contract_address = "0x76bf2D1e6dFda645c0c17440B17Eccc181dfC351"; const ybUSD_contract_address = "0xFA59075DfCE274E028b58BdDFcC3D709960F594a"; -const vETH_contract_address = "0x271602A97027ee1dd03b1E6e5dB153eB659A80b1"; -const vUSD_contract_address = "0x5b91e29Ae5A71d9052620Acb813d5aC25eC7a4A2"; async function tvlCronos(api) { @@ -41,15 +39,6 @@ async function tvlEthereum(api) { return api.getBalances(); } -async function tvlCronosZkEVM(api) { - const totalVEth = await api.call({ abi: "uint256:ybEthValue", target: vETH_contract_address }); - api.addCGToken('ethereum', totalVEth / 1e18); - const totalVUsd = await api.call({ abi: "uint256:ybUsdValue", target: vUSD_contract_address }); - api.addCGToken('dai', totalVUsd / 1e18); - - return api.getBalances(); -} - module.exports = { methodology: "TVL counts tokens staked by the protocol.", cronos: { @@ -65,7 +54,11 @@ module.exports = { ethereum: { tvl: tvlEthereum, }, + // vETH and vUSD on Cronos zkEVM (0x271602A9..., 0x5b91e29A...) only hold ybETH and ybUSD bridged + // from ethereum. The L1 tokens sit in the ZK Stack native token vault (0xbeD1EB54...), and the + // ethereum leg above already counts the ETH and USD behind every ybETH and ybUSD, so counting + // vETH/vUSD again on cronos_zkevm was the same assets twice cronos_zkevm: { - tvl: tvlCronosZkEVM, + tvl: () => ({}), }, }; From 554328a3b6007db6bc7cd4829390b7afe1006673 Mon Sep 17 00:00:00 2001 From: 0xGumpy Date: Mon, 16 Nov 2026 01:42:05 -0500 Subject: [PATCH 750/988] Add Buttonwood Cash (Robinhood Chain) (#22210) --- projects/buttonwood-cash/index.js | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 projects/buttonwood-cash/index.js diff --git a/projects/buttonwood-cash/index.js b/projects/buttonwood-cash/index.js new file mode 100644 index 00000000000..8e38223979a --- /dev/null +++ b/projects/buttonwood-cash/index.js @@ -0,0 +1,43 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const GENERAL_MANAGER = '0xc127d8aBcbB08f7A5C0442AE5A24883027bd910C' + +async function tvl(api) { + const [consol, usdx] = await Promise.all([ + api.call({ target: GENERAL_MANAGER, abi: 'address:consol' }), + api.call({ target: GENERAL_MANAGER, abi: 'address:usdx' }), + ]) + const [inputs, fap, usdTokens] = await Promise.all([ + api.call({ target: consol, abi: 'address[]:getSupportedTokens' }), + api.call({ target: consol, abi: 'address:forfeitedAssetsPool' }), + api.call({ target: usdx, abi: 'address[]:getSupportedTokens' }), + ]) + // Every other Consol input is a SubConsol holding one collateral + const skip = new Set([fap, usdx].map((a) => a.toLowerCase())) + const subConsols = inputs.filter((a) => !skip.has(a.toLowerCase())) + + const [collaterals, yieldAmounts, fapAssets] = await Promise.all([ + api.multiCall({ abi: 'address:collateral', calls: subConsols }), + api.multiCall({ abi: 'uint256:yieldAmount', calls: subConsols }), + api.fetchList({ lengthAbi: 'uint256:totalAssets', itemAbi: 'function getAsset(uint256) view returns (address)', target: fap }), + ]) + + // Collateral a SubConsol has moved to a yield strategy, at its deposited amount + collaterals.forEach((c, i) => api.add(c, yieldAmounts[i])) + + return sumTokens2({ + api, + tokensAndOwners: [ + ...collaterals.map((c, i) => [c, subConsols[i]]), + ...usdTokens.map((t) => [t, usdx]), + ...fapAssets.map((a) => [a, fap]), + ], + }) +} + +module.exports = { + methodology: + 'TVL is the tokenized-equity collateral held by each SubConsol for open mortgages (including any amount moved to a yield strategy), the stablecoins backing USDX, and assets held by the Forfeited Assets Pool from foreclosed mortgages. USDX, Consol, SubConsol and Forfeited Assets Pool tokens held by origination pools, vaults or users are claims on these same assets and are not counted.', + start: '2026-09-23', + robinhood: { tvl }, +} From df83c1cc374544eb2798b068227f2ae3bc7734e5 Mon Sep 17 00:00:00 2001 From: Fugaku <107969108+fugakux@users.noreply.github.com> Date: Sun, 15 Nov 2026 22:57:18 -0800 Subject: [PATCH 751/988] Add Kalos V4 (Elysium Kinetiq): Kalos's Uniswap v4 hook pools (#22208) Co-authored-by: Claude Opus 5.5 --- projects/kalos-v4/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/kalos-v4/index.js diff --git a/projects/kalos-v4/index.js b/projects/kalos-v4/index.js new file mode 100644 index 00000000000..8d788d152a4 --- /dev/null +++ b/projects/kalos-v4/index.js @@ -0,0 +1,27 @@ +const { getHookPools, addUniV4PoolReserves } = require('../helper/uniswapV4') + +// Kalos V4 (https://www.kalos.fun): Kalos's Uniswap v4 pools on Kinetiq Elysium, the pools that carry Kalos's own fee +// hook. Only addresses the hook allows can create a pool with it and it registers every pool in afterInitialize, so +// every pool with one of these hooks is a Kalos pool; no pool is hardcoded. The tokens sit in the shared Uniswap v4 +// PoolManager, which uniswap-v4 also counts. Contracts: https://www.kalos.fun/learn/contracts +const POOL_MANAGER = '0xE2e105d3F7209A9DA11f83cCf3E7398a753823F1' // Uniswap v4 PoolManager on Elysium +const STATE_VIEW = '0x27eD73aE0652fdCf71d6793412A7525f32bE9dfE' // Uniswap v4 StateView on Elysium +const FROM_BLOCK = 256083 // same as uniswap-v4 and heliosliq, so the Initialize log cache is shared with them +const KALOS_HOOKS = [ + '0x0559EF6bC07974bfaB2149d7fbC0E898914115CF', // KalosDynamic (Kalos V4 fee hook v2), deployed 2026-11-16 in block 6897730 + '0x0885b1C4aCDF4613C51F602B21D2bBd0876410CC', // Kalos V4 fee hook v1, deployed 2026-11-14 in block 6605271, replaced by v2 +] + +async function tvl(api) { + const pools = [] + for (const hook of KALOS_HOOKS) + pools.push(...await getHookPools({ api, hook, poolManager: POOL_MANAGER, fromBlock: FROM_BLOCK })) + await addUniV4PoolReserves({ api, pools, stateView: STATE_VIEW }) +} + +module.exports = { + doublecounted: true, // the pools live in the Uniswap v4 PoolManager, which the uniswap-v4 adapter counts too + methodology: 'Counts the liquidity in Kalos V4 pools: the Uniswap v4 pools on Elysium that carry the Kalos fee hook (KalosDynamic, and its first version). Pools are found from the PoolManager\'s Initialize events and their reserves are rebuilt on chain from tick liquidity and the current price via StateView. Uncollected fees are not counted. The pools sit in the Uniswap v4 PoolManager, so the TVL is double counted with Uniswap v4.', + start: '2026-11-15', + elysium: { tvl }, +} From 281897cbb10047774aaf44cf96f80b6ca69af5da Mon Sep 17 00:00:00 2001 From: bheluga Date: Mon, 16 Nov 2026 07:45:40 +0000 Subject: [PATCH 752/988] update tron evm rpc (#22214) --- projects/helper/env.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/env.js b/projects/helper/env.js index 0522d2a07cc..19876599a82 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -35,6 +35,7 @@ const DEFAULTS = { LULO_API_KEY: '', TRON_RPC: 'https://api.trongrid.io', TRON_WALLET_RPC: 'https://api.trongrid.io', + TRON_EVM_WHITELISTED_RPC: 'https://api.trongrid.io/jsonrpc,https://tron-rpc.publicnode.com/jsonrpc', MOVE_RPC: 'https://mainnet.movementnetwork.xyz', SUPRA_RPC: 'https://rpc-mainnet.supra.com', IOTA_RPC: "https://api.mainnet.iota.cafe", From c60fa8b042ff65419460b5710ccce826d1e1f68e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 16 Nov 2026 11:42:15 +0100 Subject: [PATCH 753/988] refactor: comment out unused Tron owner addresses in configuration --- projects/bitget/index.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/projects/bitget/index.js b/projects/bitget/index.js index 8155fbee5ee..e9ae21473f8 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -95,30 +95,30 @@ const evmChains = ["bsc","ethereum","arbitrum","optimism","era","fantom","cronos const config = { tron: { owners: [ - "TAa8e7U7seCy7NcZ52xYVQXXybFfwvsUxz", - "TBXEdr2pD1tszUNAkVX18K7nie1MptkZ1y", - "TBytnmJqL47n8bAP2NgPWfboXCwEUfEayv", + // "TAa8e7U7seCy7NcZ52xYVQXXybFfwvsUxz", + // "TBXEdr2pD1tszUNAkVX18K7nie1MptkZ1y", + // "TBytnmJqL47n8bAP2NgPWfboXCwEUfEayv", "TFrRVZFoHty7scd2a1q6BDxPU5fyqiB4iR", - "TGJagVsVg9QSePG5GreotgdefgaXPRo8SH", - "TGZ959FTLRk8droUqDNgLxML1X9mEVej8q", - "TYiQTHtgLo6KX6hYgbKLJsTbWK5hu9X5MG", - "TZHW3PJe6VoyV8NWAaeukqWNRe3bVU7u8n", - "TBM2FK4KBEEsMVYjm4WAW2Q8Es2NKdmUB8", //add on 12/01/2024 - "TCvfZC9h6fFXnF7KbHPgY4jgfen93VkfVW", //add on 12/01/2024 - "TGp7SNzjrctsWNwaFFN2PNTh3b1Kgxdtib", //add on 12/01/2024 + // "TGJagVsVg9QSePG5GreotgdefgaXPRo8SH", + // "TGZ959FTLRk8droUqDNgLxML1X9mEVej8q", + // "TYiQTHtgLo6KX6hYgbKLJsTbWK5hu9X5MG", + // "TZHW3PJe6VoyV8NWAaeukqWNRe3bVU7u8n", + // "TBM2FK4KBEEsMVYjm4WAW2Q8Es2NKdmUB8", //add on 12/01/2024 + // "TCvfZC9h6fFXnF7KbHPgY4jgfen93VkfVW", //add on 12/01/2024 + // "TGp7SNzjrctsWNwaFFN2PNTh3b1Kgxdtib", //add on 12/01/2024 "TBpo1Sh7vKCLrfxocZHd8CA5wc2R75kSJM", // add on 27/05/2024 "TMauqkA78pfysSTn8jD1dvEUkjme2gEEdn", // add on 27/05/2024 "TKPqvBMU2v23RyjjViKvp16kiHPx7FnrHQ", // add on 27/05/2024 - "TVSdtELybCCa9DPDH15CMAPjeRcENAmDJZ", // add on 27/05/2024 + // "TVSdtELybCCa9DPDH15CMAPjeRcENAmDJZ", // add on 27/05/2024 "TYPUgo9ZtYk34XgBHbCHJCaoYZ5RejhhVD", - "TKurFA1LqaLU6cYa7QKbYqFceT3Xf22pNT", - "TN9DMsWq8CwE9GZV4akjxUzwG93PPceuiV", - "TYAdiDkvjsSPMQt8AvA8jWJrXKcjyKb5rs", - "TTky11V7Q3ng6hkYjLs3R3YkeDB8suQ7dC", + // "TKurFA1LqaLU6cYa7QKbYqFceT3Xf22pNT", + // "TN9DMsWq8CwE9GZV4akjxUzwG93PPceuiV", + // "TYAdiDkvjsSPMQt8AvA8jWJrXKcjyKb5rs", + // "TTky11V7Q3ng6hkYjLs3R3YkeDB8suQ7dC", "TJ8kFqncqv3GP15DTcbzufX5HFgFMCK3kC", "TEk5sAuuk6URqvT5tL7hrUB65NGEgq895X", "TJ7hhYhVhaxNx6BPyq7yFpqZrQULL3JSdb", - "TWpNmnuq6EFMRnxWQTGGf47gjkkbtYJdbm", + // "TWpNmnuq6EFMRnxWQTGGf47gjkkbtYJdbm", "TKfMrRSwhuLoTHcziSeNEAdSjaTe2677md", "TQQ29P8gw2Tp8XeYKC8vasQmJ7rvHGFhiG", "TUktrKwLLGGjks6DoN1zGta8muskbd9tnk", From 0e68b20b463a1fc8bfbc8d59e73b787a17d3c5de Mon Sep 17 00:00:00 2001 From: layerbank-dev <135123153+layerbank-dev@users.noreply.github.com> Date: Mon, 16 Nov 2026 21:14:22 +0900 Subject: [PATCH 754/988] Deprecate LayerBank chains (#22213) Co-authored-by: FelixBruguera --- projects/lineabank/index.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/projects/lineabank/index.js b/projects/lineabank/index.js index 10e96fce3c1..27831819c29 100644 --- a/projects/lineabank/index.js +++ b/projects/lineabank/index.js @@ -93,13 +93,26 @@ module.exports.move = { /* LayerBank V3 */ -const v3Config = { +const deprecatedV3Config = { plume_mainnet: [`0xF9642C3B35Cd4Ccd55D22Fb2B35fcc31c5E0B62E`], hemi: [`0x8D45801736F3504BEfA35ABEf8bc7a1C4d610651`], nibiru: [`0x7F5f9E5D4643B4333464c18d072167B452C20d28`], bob: { poolDatas: [`0xeb1Bea032d0DDCAFd29fb3b8c33A67BCAfCaFD8c`], isInsolvent: true, }, +}; + +const v3Config = { rsk: ['0x47C1ef207d49cfC519F48b8251857CA6BE6c2caf'], robinhood: ['0x7ED03A856D52172f9501aB0176f184baD287e546'], }; -module.exports = mergeExports([module.exports, compoundExports, aaveV3Export(v3Config)]); \ No newline at end of file +// Deprecated deployments (V2, Move, older V3): the chains stay exported so their history is kept, +// and return nothing from the cutoff onwards +const DEPRECATED_TS = Date.parse('2026-11-16') / 1e3 +const gate = (fn) => async (api, ...args) => !api.timestamp || api.timestamp >= DEPRECATED_TS ? {} : fn(api, ...args) + +const deprecated = mergeExports([module.exports, compoundExports, aaveV3Export(deprecatedV3Config)]) +Object.values(deprecated).forEach(chainExport => { + Object.keys(chainExport).forEach(key => chainExport[key] = gate(chainExport[key])) +}) + +module.exports = mergeExports([deprecated, aaveV3Export(v3Config)]); \ No newline at end of file From 8c6d32c5491d26711cb39f4c27b09bca3ee2a34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Mon, 16 Nov 2026 18:36:29 +0530 Subject: [PATCH 755/988] sierra-money: mark as doublecounted (reserves sit in OpenTrade vaults) (#22217) --- projects/sierra-money/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/sierra-money/index.js b/projects/sierra-money/index.js index 01712e28ed7..97d1e5a7484 100644 --- a/projects/sierra-money/index.js +++ b/projects/sierra-money/index.js @@ -53,8 +53,15 @@ async function tvl(api) { } } +// Nearly all of the reserves are deposits in OpenTrade vaults, and every vault listed above is an +// OpenTrade factory pool (PoolCreated from the factories in projects/opentrade), so the opentrade +// adapter already counts the same USDC through totalAssets(). Measured at avax block 100456203 and +// ethereum block 26425932: avax 6,460,382 in vaults vs 8,295 plain USDC, ethereum 22,543,838 vs +// 50,176. Sierra holds all of xMorphoGPUSDC-Base (915,890) and xUSCLO (1,220,095) and 4,324,397 +// of the 5,731,436 in xTradeflowCEMP90. module.exports = { - methodology: 'TVL includes USDC held in the reserve wallets and assets staked in OpenTrade vaults backing SIERRA tokens, summed across all supported chains.', + doublecounted: true, + methodology: 'TVL includes USDC held in the reserve wallets and assets staked in OpenTrade vaults backing SIERRA tokens, summed across all supported chains. The OpenTrade vault deposits are also counted in OpenTrade TVL.', }; Object.keys(openTradeVaultsByChain).forEach(chain => { From 63e1eaec4def889cacbb7326b3ab7ab4c366509b Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 16 Nov 2026 17:11:42 +0400 Subject: [PATCH 756/988] three-f: mark tvl doublecounted with morpho-blue (#22219) Co-authored-by: Claude Opus 5.5 --- projects/three-f/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/three-f/index.js b/projects/three-f/index.js index 1a223ffb874..d7686bca496 100644 --- a/projects/three-f/index.js +++ b/projects/three-f/index.js @@ -34,7 +34,8 @@ async function tvl(api) { module.exports = { - methodology: "Value of assets locked inside all wrapper tokens.", + methodology: "Value of assets locked inside all wrapper tokens. The wrappers are posted as collateral on Morpho Blue, which counts them too.", + doublecounted: true, start: "2026-04-08", ethereum: { tvl } }; \ No newline at end of file From a633287ef09ceb7147e3d6c6953a364f74d8883f Mon Sep 17 00:00:00 2001 From: ayggdrasil Date: Mon, 16 Nov 2026 22:53:49 +0900 Subject: [PATCH 757/988] Add CallPut TVL on Robinhood Chain (#22215) --- registries/sumTokens.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 5c368c0db17..c54d0e25180 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -3460,6 +3460,10 @@ const configs = { ADDRESSES.base.USDC ] }, + "robinhood": { + "owners": ["0x21bA39e9394657A6196f6948C2701D9fD9612289"], + "tokens": [ADDRESSES.robinhood.USDG] + }, }, "cantohm": { "misrepresentedTokens": true, From 77dfc03401b1cfaec06c87c7bd3553e1a803967c Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 16 Nov 2026 15:13:19 +0100 Subject: [PATCH 758/988] feat(btr): add btr v2 (#22212) Co-authored-by: FelixBruguera --- projects/btr-v2/index.js | 20 ++++++++++++++++++++ projects/btr/index.js | 1 + 2 files changed, 21 insertions(+) create mode 100644 projects/btr-v2/index.js diff --git a/projects/btr-v2/index.js b/projects/btr-v2/index.js new file mode 100644 index 00000000000..b42b6002927 --- /dev/null +++ b/projects/btr-v2/index.js @@ -0,0 +1,20 @@ +const FACTORY = '0xbbbbbbb16b9B5Fa94AD8CD35e696bEA55DB9C8B0' + +async function tvl(api) { + const pools = await api.fetchList({ lengthAbi: 'getOfficialPoolsCount', itemAbi: 'officialPools', target: FACTORY }) + const tokens = await api.multiCall({ target: FACTORY, abi: 'function getPoolTokens(address pool) view returns (address[])', calls: pools }) + await api.sumTokens({ ownerTokens: pools.map((pool, i) => [tokens[i], pool]) }) + // liquidity a leg's yield hook placed in external venues belongs to the pool's LPs: count the hook NAV + const legs = pools.flatMap((pool, i) => tokens[i].map(token => ({ pool, token }))) + const hooks = await api.multiCall({ abi: 'function getAssetHook(address) view returns (address)', calls: legs.map(l => ({ target: l.pool, params: [l.token] })) }) + const live = legs.map((l, i) => ({ ...l, hook: hooks[i] })).filter(l => +l.hook) + const nav = await api.multiCall({ abi: 'uint256:navAssets', calls: live.map(l => l.hook) }) + live.forEach((l, i) => api.add(l.token, nav[i])) +} + +module.exports = { + doublecounted: true, + methodology: "Sums the token balances held by every official BTR V2 pool listed by the PoolFactory, plus the liquidity each asset's yield hook has deposited in external lending markets or vaults (currently Aave and Euler) on the pool's behalf, valued at the hook's reported NAV. That liquidity is also counted in those venues' TVL.", + start: '2026-11-12', + monad: { tvl }, +} diff --git a/projects/btr/index.js b/projects/btr/index.js index 05257dbc35c..967109db6ce 100644 --- a/projects/btr/index.js +++ b/projects/btr/index.js @@ -16,5 +16,6 @@ module.exports = { doublecounted: true, methodology: "Sums the token balances held by every official BTR pool listed by the PoolFactory, plus the liquidity each pool's yield hook has deposited in external lending markets or vaults (currently Aave and Euler) on the pool's behalf, valued at the hook's reported NAV. That liquidity is also counted in those venues' TVL.", start: '2026-10-01', + hallmarks: [['2026-11-10', 'V1 halt']], monad: { tvl }, } From 4f7a21e4bcb8948b5832a87b7b65a18830aec7e7 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 16 Nov 2026 18:24:41 +0400 Subject: [PATCH 759/988] resupply: mark tvl doublecounted with curve llamalend and fraxlend (#22220) Co-authored-by: Claude Opus 5.5 --- projects/resupply/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/resupply/index.js b/projects/resupply/index.js index 56d614c5f5b..caed58df36f 100644 --- a/projects/resupply/index.js +++ b/projects/resupply/index.js @@ -38,6 +38,8 @@ async function stakingTvl(api) { } module.exports = { + doublecounted: true, + methodology: 'Collateral is Curve LlamaLend and Fraxlend vault shares, valued in their underlying crvUSD and frxUSD. Those protocols also count these deposits.', start: '2025-03-15', ethereum: { tvl, From 301eddaf98619a47487cb91ec863d6c89ee544e1 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 16 Nov 2026 18:35:59 +0400 Subject: [PATCH 760/988] papertrade: count USDC supplied to HyperCore lending (#22218) Co-authored-by: Claude Opus 5.5 --- projects/helper/chain/hyperliquid.js | 79 +++++++++++++++++++--------- projects/papertrade/index.js | 13 +++-- 2 files changed, 64 insertions(+), 28 deletions(-) diff --git a/projects/helper/chain/hyperliquid.js b/projects/helper/chain/hyperliquid.js index 21c52601ced..5cbebdda2e8 100644 --- a/projects/helper/chain/hyperliquid.js +++ b/projects/helper/chain/hyperliquid.js @@ -25,35 +25,66 @@ async function getHypercoreStakedHype(user) { * they are unpriceable dust here. */ async function addHypercoreSpotBalances({ api, owners = [], blacklistedTokens = [] }) { + const addToken = await getCoreTokenAdder({ api, blacklistedTokens }) + for (const user of owners) { + const { balances } = await post(API_URL, { type: 'spotClearinghouseState', user }) + for (const { coin, token, total } of balances) addToken(token, +total, coin) + } +} + +/** + * Add a user's HyperCore lending positions (supplied minus borrowed, per token) to the api. + * + * On a default-mode account, manually supplied tokens leave the spot balance, so + * spotClearinghouseState no longer shows them. Unified and portfolio-margin accounts + * already report lent balances in spot state, so those are skipped here. + */ +async function addHypercoreLendingBalances({ api, owners = [], blacklistedTokens = [] }) { + const addToken = await getCoreTokenAdder({ api, blacklistedTokens }) + for (const user of owners) { + const mode = await post(API_URL, { type: 'userAbstraction', user }) + if (mode === 'unifiedAccount' || mode === 'portfolioMargin') continue + const { tokenToState } = await post(API_URL, { type: 'borrowLendUserState', user }) + if (!Array.isArray(tokenToState)) + throw new Error(`Unexpected borrowLendUserState response for ${user}`) + for (const [token, { supply, borrow }] of tokenToState) { + const supplied = Number(supply?.value) + const borrowed = Number(borrow?.value) + if (typeof supply?.value !== 'string' || typeof borrow?.value !== 'string' || !Number.isFinite(supplied) || !Number.isFinite(borrowed)) + throw new Error(`Unexpected borrowLendUserState value for ${user}, token ${token}`) + addToken(token, supplied - borrowed) + } + } +} + +// Returns (token index, amount, coin?) => void, which adds one HyperCore token amount to the api. +async function getCoreTokenAdder({ api, blacklistedTokens = [] }) { const { tokens: meta } = await post(API_URL, { type: 'spotMeta' }) const tokenById = {} meta.forEach(token => tokenById[token.index] = token) const blacklist = new Set(blacklistedTokens.map(i => i.toLowerCase())) - for (const user of owners) { - const { balances } = await post(API_URL, { type: 'spotClearinghouseState', user }) - for (const { coin, token, total } of balances) { - const amount = +total - if (!amount) continue - const info = tokenById[token] - if (!info) continue - if (coin === 'HYPE') { - api.addGasToken(BigInt(Math.round(amount * 1e18))) - continue - } - if (coin === 'USDC') { - // spotMeta points USDC at its bridge contract, which is not the address - // the pricing side knows - count it as plain dollars instead - api.addUSDValue(amount) - continue - } - const address = info.evmContract?.address - if (!address || blacklist.has(address.toLowerCase())) continue - // the EVM twin's decimals are the core token's weiDecimals shifted by the - // per-token extra the bridge applies - const decimals = info.weiDecimals + (info.evmContract.evm_extra_wei_decimals ?? 0) - api.add(address, BigInt(Math.round(amount * 10 ** decimals))) + return (token, amount, coin) => { + if (!amount) return + const info = tokenById[token] + if (!info) return + coin = coin ?? info.name + if (coin === 'HYPE') { + api.addGasToken(BigInt(Math.round(amount * 1e18))) + return + } + if (coin === 'USDC') { + // spotMeta points USDC at its bridge contract, which is not the address + // the pricing side knows - count it as plain dollars instead + api.addUSDValue(amount) + return } + const address = info.evmContract?.address + if (!address || blacklist.has(address.toLowerCase())) return + // the EVM twin's decimals are the core token's weiDecimals shifted by the + // per-token extra the bridge applies + const decimals = info.weiDecimals + (info.evmContract.evm_extra_wei_decimals ?? 0) + api.add(address, BigInt(Math.round(amount * 10 ** decimals))) } } @@ -76,4 +107,4 @@ async function addHypercoreBalances({ api, owners = [], blacklistedTokens = [] } await addHypercorePerpMargin({ api, owners }) } -module.exports = { getUserStakingSummary, getHypercoreStakedHype, addHypercoreSpotBalances, addHypercorePerpMargin, addHypercoreBalances } +module.exports = { getUserStakingSummary, getHypercoreStakedHype, addHypercoreSpotBalances, addHypercoreLendingBalances, addHypercorePerpMargin, addHypercoreBalances } diff --git a/projects/papertrade/index.js b/projects/papertrade/index.js index 8c35fef4a58..6ba99455775 100644 --- a/projects/papertrade/index.js +++ b/projects/papertrade/index.js @@ -1,13 +1,18 @@ -const { addHypercoreSpotBalances } = require('../helper/chain/hyperliquid') +const { addHypercoreSpotBalances, addHypercoreLendingBalances } = require('../helper/chain/hyperliquid') // Papertrade: synthetic BTC/ETH perps on HyperEVM against a protocol-owned LP. Trader deposits and the LP sit as USDC -// in the Exchange contract's HyperCore spot account, not on the EVM (its EVM token balances are zero). +// in the Exchange contract's HyperCore account, not on the EVM (its EVM token balances are zero). Part of that USDC is +// supplied to HyperCore lending, where it no longer shows in the spot balance. const EXCHANGE = '0x6cd5661646289fb6e65ea5c032310fded797d0a2' module.exports = { timetravel: false, - methodology: 'USDC held in the Papertrade Exchange contract\'s HyperCore spot account: trader trading balances plus the protocol-owned LP that takes the other side of every position.', + doublecounted: true, // USDC supplied to HyperCore lending is also in hyperliquid-earn's TVL + methodology: 'USDC held in the Papertrade Exchange contract\'s HyperCore account (spot balance plus USDC supplied to HyperCore lending): trader trading balances plus the protocol-owned LP that takes the other side of every position.', hyperliquid: { - tvl: (api) => addHypercoreSpotBalances({ api, owners: [EXCHANGE] }), + tvl: async (api) => { + await addHypercoreSpotBalances({ api, owners: [EXCHANGE] }) + await addHypercoreLendingBalances({ api, owners: [EXCHANGE] }) + }, }, } From 73e7b3936ba8c37803984a18befcc394ddfc0dc0 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 16 Nov 2026 18:48:30 +0400 Subject: [PATCH 761/988] alpaca-finance: count lyf worker positions instead of vault totalToken (#22221) Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/alpaca-finance/index.js | 75 ++------------------------------ projects/alpaca-finance/lyf.js | 13 ------ 2 files changed, 3 insertions(+), 85 deletions(-) diff --git a/projects/alpaca-finance/index.js b/projects/alpaca-finance/index.js index 8857c575cf1..f82abd043bc 100644 --- a/projects/alpaca-finance/index.js +++ b/projects/alpaca-finance/index.js @@ -1,79 +1,9 @@ -const sdk = require('@defillama/sdk') const abi = { - "vaultDebtVal": "uint256:vaultDebtVal", - "totalToken": "uint256:totalToken", - "token": "address:token", - "pid": "uint256:pid", - "reservePool": "uint256:reservePool", - "balanceOf": "function balanceOf(address account) view returns (uint256)", - "totalSupply": "uint256:totalSupply", - "lpToken": "address:lpToken", - "userInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)", - "userInfoCake": "function userInfo(address) view returns (uint256 shares, uint256 lastDepositedTime)", - "singleAssetPrice": "uint256:getPricePerFullShare", - "pId": "uint256:pid", - "ausdTotalStablecoinIssued": "uint256:totalStablecoinIssued", "xalpacaTotalSupply": "uint256:supply" }; const { getConfig } = require('../helper/cache') -const { calLyfTvl } = require("./lyf"); const aExports = require('../alpaca-finance-lend'); -// ===== inlined from ./ausd ===== -async function getProcolAUSDAddresses(chain) { - if (chain == "bsc") { - return ( - await getConfig('alpaca-finance/ausd-bsc', - "https://raw.githubusercontent.com/alpaca-finance/alpaca-stablecoin/main/.mainnet.json" - ) - ); - } -} - -async function getProcolLYFAddresses(chain) { - if (chain == "bsc") { - return ( - await getConfig('alpaca-finance/lyf-bsc', - "https://raw.githubusercontent.com/alpaca-finance/bsc-alpaca-contract/main/.mainnet.json" - ) - ); - } - if (chain == "fantom") { - return ( - await getConfig('alpaca-finance/lyf-fantom', - "https://raw.githubusercontent.com/alpaca-finance/bsc-alpaca-contract/main/.fantom_mainnet.json" - ) - ); - } -} - -async function calAusdTvl(api) { - const chain = api.chain; - - const ausdAddresses = await getProcolAUSDAddresses(chain); - const lyfAddresses = await getProcolLYFAddresses(chain); - const ibTokens = ausdAddresses["IbTokenAdapters"].map((i) => i.address) - const pids = await api.multiCall({ abi: abi.pid, calls: ibTokens }); - const failaunchUserInfos = await api.multiCall({ - abi: abi.userInfo, - target: lyfAddresses["FairLaunch"].address, - calls: pids.map((each, i) => { - return { - params: [each, ibTokens[i]], - }; - }), - }); - const collateralTokens = ausdAddresses.IbTokenAdapters.map((each) => each.collateralToken); - const totalTokens = await api.multiCall({ abi: abi.totalToken, calls: collateralTokens }); - const totalSupplys = await api.multiCall({ abi: abi.totalSupply, calls: collateralTokens, }); - const vaultTokens = await api.multiCall({ abi: abi.token, calls: collateralTokens, }); - - failaunchUserInfos.forEach((eachUserInfo, i) => { - api.add(vaultTokens[i], eachUserInfo.amount * totalTokens[i] / totalSupplys[i]); - }) - return api.getBalances() -} - // ===== inlined from ./xalpaca ===== async function getProcolXAlpacaAddresses(chain) { if (chain == "bsc") { @@ -102,12 +32,13 @@ async function calxALPACAtvl(api) { module.exports = { start: '2020-10-07', + methodology: 'Base token balances held by the lending vaults. Vault debt is not counted.', bsc: { - tvl: sdk.util.sumChainTvls([calLyfTvl, calAusdTvl, aExports.bsc.tvl]), + tvl: aExports.bsc.tvl, staking: calxALPACAtvl, }, fantom: { - tvl: sdk.util.sumChainTvls([calLyfTvl, aExports.fantom.tvl]), + tvl: aExports.fantom.tvl, staking: calxALPACAtvl, } }; diff --git a/projects/alpaca-finance/lyf.js b/projects/alpaca-finance/lyf.js index f6461842812..c0a0e2eaeaa 100644 --- a/projects/alpaca-finance/lyf.js +++ b/projects/alpaca-finance/lyf.js @@ -1,4 +1,3 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { getConfig } = require('../helper/cache') async function getProcolAddresses(chain) { @@ -18,18 +17,6 @@ async function getProcolAddresses(chain) { } } -async function calLyfTvl(api) { - const chain = api.chain; - const addresses = await getProcolAddresses(chain); - const vaults = addresses["Vaults"].map(i => i.address) - const tokens = await api.multiCall({ abi: 'address:token', calls: vaults }) - const bals = await api.multiCall({ abi: 'uint256:totalToken', calls: vaults }) - api.add(tokens, bals) - api.removeTokenBalance(ADDRESSES.bsc.BTCB) - return api.getBalances() -} - module.exports = { - calLyfTvl, getProcolAddresses } From 6e4660acbd14ffc4dbcfcff468b2f32ebe343132 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 16 Nov 2026 15:49:49 +0100 Subject: [PATCH 762/988] update core assets --- projects/helper/cex.js | 2 +- projects/helper/coreAssets.json | 26 +++++++++++++++++--------- registries/sumTokens.js | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 9f0b1cc9482..1f54cd3c14a 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -305,7 +305,7 @@ const defaultTokens = { ADDRESSES.arbitrum.USDC, // USDC ADDRESSES.arbitrum.USDT, // USDT ADDRESSES.arbitrum.DAI, // DAI - ADDRESSES.arbitrum.aidoge, //aidoge + '0x09e18590e8f76b6cf471b3cd75fe1a1a9d2b2c2b', //aidoge // '0x088cd8f5ef3652623c22d48b1605dcfe860cd704', //vela ADDRESSES.arbitrum.LPT, //lpt '0x51fc0f6660482ea73330e414efd7808811a57fa2', //premia diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index be09d9edde1..58ce9995d57 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -337,8 +337,7 @@ "fBOMB": "0x74ccbe53f77b08632ce0cb91d3a545bf6b8e0979", "GRAIL": "0x3d9907f9a368ad0a51be60f7da3b97cf940982d8", "LUSD": "0x93b346b6bc2548da6a1e7d98e9a421b42541425b", - "EURA": "0xfa5ed56a203466cbbc2430a43c66b9d8723528e7", - "aidoge": "0x09e18590e8f76b6cf471b3cd75fe1a1a9d2b2c2b" + "EURA": "0xfa5ed56a203466cbbc2430a43c66b9d8723528e7" }, "fuse": { "WFUSE": "0x0be9e53fd7edac9f859882afdda116645287c629", @@ -455,7 +454,8 @@ "USDT": "0x617f3112bf5397d0467d315cc709ef968d9ba546", "STEUR": "0x004626A008B1aCdC4c74ab51644093b155e59A23", "USDT_1": "0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e", - "cEUR": "0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73" + "cEUR": "0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73", + "BTC": "0xd629eb00deced2a080b7ec630ef6ac117e614f1b" }, "boba": { "WETH": "0xd203de32170130082896b4111edf825a4774c18e", @@ -1109,7 +1109,9 @@ "WSGB": "0x02f0826ef6ad107cfc861152b32b52fd11bab9ed", "CAND": "0x70ad7172ef0b131a1428d0c1f66457eb041f2176", "SFIN": "0x0D94e59332732D18CF3a3D457A8886A2AE29eA1B", - "EXFI": "0xc348f894d0e939fe72c467156e6d7dcbd6f16e21" + "EXFI": "0xc348f894d0e939fe72c467156e6d7dcbd6f16e21", + "USDX": "0x4a771cc1a39fdd8aa08b8ea51f7fd412e73b3d2b", + "exUSDT": "0x1a7b46656b2b8b29b1694229e122d066020503d0" }, "energi": { "WNRG": "0xa55f26319462355474a9f2c8790860776a329aa4" @@ -1203,7 +1205,8 @@ "USDT": "0xfe97e85d13abd9c1c33384e796f10b73905637ce", "WBTC": "0x1f545487c62e5acfea45dcadd9c627361d1616d8", "ETH": "0xa47f43de2f9623acb395ca4905746496d2014d57", - "PPI": "0x22f41abf77905f50df398f21213290597e7414dd" + "PPI": "0x22f41abf77905f50df398f21213290597e7414dd", + "USDT0": "0xaf37e8b6c9ed7f6318979f56fc287d76c30847ff" }, "muuchain": { "WMUU": "0x875358f6194d7c622d6355455f3137cceb2955c4" @@ -1635,7 +1638,8 @@ "WBTC": "0x0555E30da8f98308EdB960aa94C0Db47230d2B9c", "USDe": "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34", "sUSDe": "0x211Cc4DD073734dA055fbF44a2b4667d5E5fE5d2", - "AERO": "0x940181a94a35a4569e4529a3cdfb74e38fd98631" + "AERO": "0x940181a94a35a4569e4529a3cdfb74e38fd98631", + "SOL": "0x311935cd80b76769bf2ecc9d8ab7635b2139cf82" }, "sei": { "SEI": "usei", @@ -1650,7 +1654,8 @@ "USDC": "0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1", "USDC_Circle": "0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392", "USDT0": "0x9151434b16b9763660705744891fA906F660EcC5", - "USDT": "0xB75D0B03c06A926e488e2659DF1A861F860bD3d1" + "USDT": "0xB75D0B03c06A926e488e2659DF1A861F860bD3d1", + "WBTC_1": "0x0555e30da8f98308edb960aa94c0db47230d2b9c" }, "op_bnb": { "WBNB": "0x4200000000000000000000000000000000000006", @@ -2183,7 +2188,8 @@ }, "shape": { "WETH": "0x4200000000000000000000000000000000000006", - "WETH_1": "0x48A9B22b80F566E88f0f1DcC90Ea15A8A3bAE8a4" + "WETH_1": "0x48A9B22b80F566E88f0f1DcC90Ea15A8A3bAE8a4", + "USDC_e": "0xdb7dd8b00edc5778fe00b2408bf35c7c054f8bbe" }, "hela": { "hUSDC": "0xf5b85320a772b436cb8105441a3db9ba29437b4a", @@ -2702,7 +2708,9 @@ "ENIDOG": "0xddd0b3ca34da2a8beca3ed76e8275e57c80ff814" }, "peaq": { - "WPEAQ": "0x3cD66d2e1fac1751B0A20BeBF6cA4c9699Bb12d7" + "WPEAQ": "0x3cD66d2e1fac1751B0A20BeBF6cA4c9699Bb12d7", + "USDC": "0xbba60da06c2c5424f03f7434542280fcad453d10", + "USDT": "0xf4d9235269a96aadafc9adae454a0618ebe37949" }, "tac": { "LBTC": "0xecAc9C5F704e954931349Da37F60E39f515c11c1", diff --git a/registries/sumTokens.js b/registries/sumTokens.js index c54d0e25180..0d7519ec5d4 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -19651,7 +19651,7 @@ const configs = { ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.USDT, ADDRESSES.optimism.DAI, - ADDRESSES.arbitrum.aidoge, + '0x09e18590e8f76b6cf471b3cd75fe1a1a9d2b2c2b', "0x3082cc23568ea640225c2467653db90e9250aaa0", "0x088cd8f5ef3652623c22d48b1605dcfe860cd704", ADDRESSES.arbitrum.LPT, From 3694a7d15a409bae1f5e16f84add8ad63d296d27 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 16 Nov 2026 11:09:11 -0400 Subject: [PATCH 763/988] sai: count canonical USDC custody on Nibiru (#22222) Co-authored-by: Unique Divine --- projects/sai/index.js | 76 +++++++++++-------------------------------- 1 file changed, 19 insertions(+), 57 deletions(-) diff --git a/projects/sai/index.js b/projects/sai/index.js index 68ae6c7849e..6d1899fcd65 100644 --- a/projects/sai/index.js +++ b/projects/sai/index.js @@ -1,73 +1,35 @@ -const { nibiru } = require('../helper/coreAssets'); -const { getBalance2 } = require('../helper/chain/cosmos') +const { getBalance2 } = require('../helper/chain/cosmos'); -const contractAddrs = { - perp: 'nibi1ntmw2dfvd0qnw5fnwdu9pev2hsnqfdj9ny9n0nzh2a5u8v0scflq930mph', - vaultUsdc: 'nibi193m2a00pmdsvkcvugrfewqzhtq6k0srkjzvxp2sk357vlpspx5vqxu8d7p', - vaultStnibi: 'nibi1mrplvu3scplnrgns96kg0j8pk3l2p9c7eaz0qdedx0kt3vmcujyqrjkfej', -}; +// Sai USDC: minted on Nibiru against USDC held in the Teller hub on Base +const SAI_USDC = '0x357c97796aA8e2A6b5A64b1Fc19d5baB9668E190'; +const SAI_USDC_DENOM = `erc20/${SAI_USDC}`; +const SAI_EVM = '0x25589C8071fa10B7a8c62CdCA7035c539242A774'; // Wasm precompile address on Nibiru const WASM_PRECOMPILE_ADDRESS = '0x0000000000000000000000000000000000000802'; -// removed from coreAssets (unpriced), kept here so the adapter still tracks the balance -const STNIBI = '0xcA0a9Fb5FBF692fa12fD13c0A900EC56Bb3f0a7b'; - async function tvl(api) { - // Query both vaults in parallel using multiCall - const vaultQueries = [ - { contract: contractAddrs.vaultUsdc, asset: nibiru.USDC, name: 'USDC vault' }, - { contract: contractAddrs.vaultStnibi, asset: STNIBI, name: 'stNIBI vault' } - ]; - - const queryMsg = { tvl: {} }; - const queryBytes = vaultQueries.map(() => - Buffer.from(JSON.stringify(queryMsg), 'utf8') - ); + const perp = await api.call({ + target: SAI_EVM, + abi: 'function perpContractAddress() view returns (string)', + }); - const calls = queryBytes.map((bytes, i) => ({ + // the reserves query is only used to discover the configured USDC vaults + const reservesBytes = await api.call({ target: WASM_PRECOMPILE_ADDRESS, - params: [vaultQueries[i].contract, bytes] - })); - - const results = await api.multiCall({ abi: 'function query(string contractAddr, bytes req) view returns (bytes)', - calls: calls, - permitFailure: true - }); - - // Process results - results.forEach((result, i) => { - const { asset } = vaultQueries[i]; - - if (result && result !== '0x' && result.length > 2) { - const hexBuffer = Buffer.from(result.slice(2), 'hex'); - const tvlData = JSON.parse(hexBuffer.toString('utf8')); - - if (tvlData) { - api.add(asset, tvlData); - } - } - }); - - // Perp Balances - const tokensToFetch = [ - { key: "erc20/0x0829F361A05D993d5CEb035cA6DF3446b060970b", symbol: nibiru.USDC }, - { key: "tf/nibi1udqqx30cw8nwjxtl4l28ym9hhrp933zlq8dqxfjzcdhvl8y24zcqpzmh8m/ampNIBI", symbol: STNIBI }, - ]; - const relevantTokens = tokensToFetch.map(t => t.key); - const balancesPerp = await getBalance2({ - owner: contractAddrs.perp, - tokens: relevantTokens, - chain: api.chain, + params: [perp, `0x${Buffer.from(JSON.stringify({ get_sai_reserves: {} })).toString('hex')}`], }); - tokensToFetch.forEach(({ key, symbol }) => { - const normalizedKey = key.replaceAll("/", ":"); - api.add(symbol, balancesPerp[normalizedKey]); - }) + const { vaults } = JSON.parse(Buffer.from(reservesBytes.slice(2), 'hex').toString('utf8')); + const owners = [perp, ...vaults.map(vault => vault.slp_addr)]; + for (const owner of owners) { + const balances = await getBalance2({ owner, tokens: [SAI_USDC_DENOM], chain: api.chain }); + api.add(SAI_USDC, balances[SAI_USDC_DENOM.replaceAll('/', ':')] ?? 0); + } } module.exports = { + methodology: 'Counts the Sai USDC held by the Perp contract and its configured USDC vaults on Nibiru.', nibiru: { tvl }, }; From 97689b83a3fb80b053613fa84f3452aff1068245 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 16 Nov 2026 12:24:12 -0400 Subject: [PATCH 764/988] move htx to ownTokens in huobi (#22228) --- projects/huobi/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/huobi/index.js b/projects/huobi/index.js index 42656e8ad04..4419c9c8300 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -75,6 +75,7 @@ const config = { ], }, tron: { + ownTokens: ['TUPM7K8REVzD2UdV4R5fe5M8XbnR2DdoJ6'], // HTX (HTX DAO), successor of HT owners: [ "TYh6mgoMNZTCsgpYHBz7gttEfrQmDMABub", "TKgD8Qnx9Zw3DNvG6o83PkufnMbtEXis4T", From cb12a509361b3c1a48af89abe0b0e5e109e42ac9 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 16 Nov 2026 17:02:41 +0000 Subject: [PATCH 765/988] labelled principle in tvl (#22227) --- projects/maple/index.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/projects/maple/index.js b/projects/maple/index.js index b61b4bb3389..8508d9d9354 100644 --- a/projects/maple/index.js +++ b/projects/maple/index.js @@ -93,6 +93,15 @@ async function getCollateralOwners() { return owners } +async function getLabelledPrincipal(api, pools, excludeTypes = []) { + const poolAssets = Object.fromEntries(pools.map(p => [p.id.toLowerCase(), p.asset.id])) + const labelled = (await getLabelledLoans()).filter(l => !excludeTypes.includes(l.loanMeta.type)) + const assets = labelled.map(l => poolAssets[l.fundingPool.id.toLowerCase()]) + if (assets.some(a => !a)) throw new Error('Maple: labelled loan from an unknown pool') + const principal = await api.multiCall({ abi: 'uint256:principal', calls: labelled.map(l => l.id) }) + return { assets, principal } +} + async function addStrategyCash(api, pools) { // pool managers that predate strategies have no strategy list const lengths = await api.multiCall({ abi: 'uint256:strategyListLength', calls: pools.map(p => p.poolManager.id), permitFailure: true }) @@ -110,6 +119,9 @@ async function ethereumTvl(api) { const pools = await getPools() const { ethereum = [] } = await getCollateralOwners() await addStrategyCash(api, pools) + // pool cash deployed through labelled loans is still pool AUM, except intercompany loans which would double count + const { assets, principal } = await getLabelledPrincipal(api, pools, ['intercompany']) + api.addTokens(assets, principal) return api.sumTokens({ tokensAndOwners: [...pools.map(p => [p.asset.id, p.id]), ...ethereum] }) } @@ -126,11 +138,7 @@ async function borrowed(api) { const principal = await api.multiCall({ abi: 'uint256:principalOut', calls: Object.keys(loanManagers) }) api.addTokens(Object.values(loanManagers), principal) // the loan managers' principalOut includes the labelled loans, take their principal back out - const poolAssets = Object.fromEntries(pools.map(p => [p.id.toLowerCase(), p.asset.id])) - const labelled = await getLabelledLoans() - const assets = labelled.map(l => poolAssets[l.fundingPool.id.toLowerCase()]) - if (assets.some(a => !a)) throw new Error('Maple: labelled loan from an unknown pool') - const labelledPrincipal = await api.multiCall({ abi: 'uint256:principal', calls: labelled.map(l => l.id) }) + const { assets, principal: labelledPrincipal } = await getLabelledPrincipal(api, pools) api.addTokens(assets, labelledPrincipal.map(v => -v)) } From e6060c151c851af78d285747966c4f31a0258734 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 16 Nov 2026 22:24:02 +0400 Subject: [PATCH 766/988] reservoir-protocol: mark tvl doublecounted with curvance and morpho (#22224) Co-authored-by: Claude Opus 5.5 --- projects/reservoir-protocol/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/reservoir-protocol/index.js b/projects/reservoir-protocol/index.js index 8493b54581b..9034060c108 100644 --- a/projects/reservoir-protocol/index.js +++ b/projects/reservoir-protocol/index.js @@ -265,4 +265,7 @@ module.exports.solana = { module.exports.hallmarks = [ ['2025-11-04', 'Stream finance XUSD depeg'], -] \ No newline at end of file +] + +module.exports.doublecounted = true +module.exports.methodology = 'Reserve assets backing rUSD. Most of them are deposited into other listed protocols (lending markets, Morpho vaults), which count them too.' From f1ce64096c01d15b5090e16440a2deb7e1d39b7d Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 16 Nov 2026 22:26:44 +0400 Subject: [PATCH 767/988] cap-money: mark tvl doublecounted with symbiotic (#22225) Co-authored-by: Claude Opus 5.5 --- projects/cap-money/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/cap-money/index.js b/projects/cap-money/index.js index 7c5cead6774..6a1d50c8c1e 100644 --- a/projects/cap-money/index.js +++ b/projects/cap-money/index.js @@ -75,6 +75,7 @@ const ethereumBorrowed = async (api) => { } module.exports = { + doublecounted: true, // delegated restaking collateral sits in Symbiotic vaults and EigenLayer strategies, which count it too methodology: 'count the total supplied assets on capToken vaults and the total delegated assets on networks (symbiotic, eigenlayer, etc.). Bridged tokens on MegaETH are tracked via source chain (Ethereum) collateral only.', start: "2025-08-01", ethereum: { tvl: ethereumTvl, borrowed: ethereumBorrowed }, From 2d57ebbfb3f2e8370ad5d6aff41c8ef76784d77e Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 16 Nov 2026 22:45:51 +0400 Subject: [PATCH 768/988] okx: add wallets from the 2026-11-01 proof of reserves (#22223) Co-authored-by: Claude Opus 5.5 --- projects/helper/bitcoin-book/okex.js | 36 +++++++ projects/okex/index.js | 136 +++++++++++++++++++++++++++ 2 files changed, 172 insertions(+) diff --git a/projects/helper/bitcoin-book/okex.js b/projects/helper/bitcoin-book/okex.js index 5b98e720099..2fc277f4951 100644 --- a/projects/helper/bitcoin-book/okex.js +++ b/projects/helper/bitcoin-book/okex.js @@ -256,4 +256,40 @@ module.exports = [ "bc1q27annpxr04hjx5kkejscr0k6ljjrt0a28g4nvfmun0p7qnvhreyqeedmup", "bc1q8ad2qzkg2g6wrydeqjuwrg0ft5ktu69fzky8m2jzu9g6a5tq6c2qpp685j", "bc1qt0x0vrfw7a5f3y324ucpk4slm3r8xx9mmt9plmvn668udtvpad7s88xwys", + // OKX proof of reserves, 2026-11-01 snapshot + "32SyM6fBLTngNnriWiHTp8ED9GLBUAUyLr", + "33BGk4ZLCKjtUAgzivM49vKpoDoRncTZCY", + "38MKB8Ai4riiXdeLeEd1sBC1iBREhPvxnT", + "3BhWUtKTVmduvs17ZLdXb7NDnPAspi1iXy", + "3CpvgvyBrLf4ZLPf9y9dPbPLpmYbx2nQ3R", + "3CqtFxYc5ixtWwwBkoyPjAR3cUizABEYPA", + "3DPdTQBNpVi73kBv2SkRhv9rHbbW1LVURC", + "3G2TcSgJthEFDrEHeJ7dbS8tQHMHkFMUTV", + "3GqmwHd3ruxQgX4N9CmhMFec5UpyoadU7P", + "3GY8LTkx3hps44UwUJD517hywvY34RyKfx", + "3JxjJ9JpBBjGST24GSU2eWXtKdjdkeYKtu", + "3MXz94UsXWQhUgaSi9BUySvoWgTqGLLxvF", + "bc1q04eh0e7tnhqhh6upnf6x38x8r0u54zkl95zlxg78phyv8tc38rtqznv2t7", + "bc1q4fg2ve2qrcyhctfekhekflan82uz3ykhzyklh58xjszyahew44dsg0k63j", + "bc1q4tzyrsvzgd3fkpac53s92ka5y4q3fplcax3836xhmtru2ks5hd0qknt6ne", + "bc1q57a0dakju38w75jm5qlcukr26wn79evxhws52py33uhqw42qjk9qluagyh", + "bc1q5x9p784q6jkj4w3cw56h8vejz326yrf6u4tuksgg8kjnfkpg7l5qe8kpz6", + "bc1q67dr4v6g8uexjueszaa3ej0929hf2tyx52dqlnl8ttwj0kwgfklqsyt72d", + "bc1q6vkqlcw06txtftz6200up6st4ynzslwy3hev08p5fsm9mjp3u2cqn359ar", + "bc1q7nyuj64ultx4jwge8muxwl894j62xj03qeqyve0wg35jyx8sj37qmjm8q9", + "bc1q7pgng7e8rq9gr3qwlguaj0een5aet98fdfcny396alc4ph5x6a4q38j6kd", + "bc1qaeg09dmtlyxaamwdl6pqndxnrwamc62a5avskhmfjggwqlaaurfqe3l5ze", + "bc1qdpjlmemwdvgmyj02eh97myu7pkxyqdwsmcq56dmdg468f2lag0yq7hg60d", + "bc1qe9zkatrururnpg29dangq67acr7engfxy5zdtn5fe0r566zx8kqs3q032u", + "bc1qhnzy8cd0ufxqv7tsy7graj7k2fr4h3a9gyf7yq9mxrf63sujncpsr985du", + "bc1qlccksaaehjkdv4tgf032pvx8n76uhazqt4rgy70y4drmqwh5espqwx89f9", + "bc1qlpc3e8uswv5n77cztd8axvldtxfh2t3hxrvwle2qky7cuhl44r8qjj0ccp", + "bc1qlx87a27s84ngdyveaqmcanxre8n4pk6lw998kfncqkndeqdmuuzs74zh0v", + "bc1qnjx7l9v53hchrngmeapjy48md4smafmhten5kg9httg5836rkxgsxu2dmz", + "bc1qqxcfk2sxcsp59mc96wmznegync8kzgphw25th9sp9crhwq0q405ql4872h", + "bc1qr5gap3pf40h2zrsjusrnh223gccaym77yzcnazxgwtvvmlu2rcdsyrf4v3", + "bc1qwjdlnt65s99rlx6zdszv72pyx3hqyhf40p5cfyqm89uf9fwlpj0qekskuy", + "bc1qx5v2wc3hnc5eygsnaxe5npqpcvdr0d2kngllqyt8hgsv9evcg5ls9qvzq7", + "bc1qzwulfhjt0pkm2sh4cj4gnf79asqvu23l6dez6m2ysnd75jp9sk8qas9r82", + "bc1qzy2hg9aup0vnt3cnetlpc8h7eytqveqxk36rjfsd8dy8kfyg29yqg29swh", ]; diff --git a/projects/okex/index.js b/projects/okex/index.js index b0dad52f761..c694dd0505c 100644 --- a/projects/okex/index.js +++ b/projects/okex/index.js @@ -248,6 +248,32 @@ const config = { "0xcff6efc78928d873f9c30251decefaf2ad92fbed", "0x9c22a4039f269e72de6b029b273be059cdbb831c", "0xcf3061b9e65f1f84d0839bb54d79a471eed7b11a", + // OKX proof of reserves, 2026-11-01 snapshot + "0x002cf36badd53a680feebefd17fbeb7fa72105d4", + "0x05d9617595e69ff577076355abc5e7c51ed0bdf3", + "0x18d516d87f12895ffb25aeda13ecc6bdc3a1fbbb", + "0x1b8de2a8144bd40166ba49fc404e94582d28ffcc", + "0x35cba33a679983debc9f0989af85467cf9d79bd5", + "0x4832517f832f63b983fd43cfb15150fad4ffc5f0", + "0x536c4921d1aafde6a5cda882fb5ca046f3601c65", + "0x55823001c8cd87a6e86716ca768bce51f2d89c9c", + "0x6a7801854f38616341b983092eb707600fdb5fbf", + "0x6cbb2add2a126e65cef029afca45576910a26b5f", + "0x7d328f5d5f4640f81b2f93d2903ec0a6c030eed6", + "0x9391466ad56f2705ce5fd12e763a65509aee4862", + "0x9c189d979b997818357afc9ded180532e007594d", + "0xae5dde433888a7456c3e0aecbb2e0a5748cbc1eb", + "0xaf6e08926da465fb3c59c2ad5dad47f6dca252ab", + "0xb4625df7d1bbce0547fe37a4c4e5bab22df529f4", + "0xbf90664017218ac7d9db5ae0c84873628e9ae1ae", + "0xc69c42cac383f86f37e4820e34791c0216999c6f", + "0xcf1ff3f452043a6c871720616f663c032ab3798d", + "0xd49522c289221697b416396e3d591aa3f98bc0a2", + "0xe839a3e9efb32c6a56ab7128e51056585275506c", + "0xee6ef8ba56a6f969eac852473c6bac522221893a", + "0xf0a31dcc3a2b799941e9d0ec35411228266b4ea6", + "0xf7b52be96b229dc63e6301bea175a1b5f756c274", + "0xff8a035ea6c80673f741c2265985ed976a40d390", ], //ETH DONE }, tron: { @@ -275,6 +301,25 @@ const config = { "TD9GNrgmrg46yistfTMJpRQZcDmDRx1Bmq", "TBNHZP2iAVyDhpTSZ8ee2Xjci1JExZTPE5", "THdXEcBCZ7nagnmfRrfSHoiLRTbSRueoVW", + // OKX proof of reserves, 2026-11-01 snapshot + "TAqkpXjGwu2s6o6hjxj4advFnUcCJCmLuZ", + "TAYmju2ZADQQxnnoJ7n5hGTgUBr896tDY7", + "TB8h4xAuzeb6SRqwjZbW5jkS9Yyi4oHkJA", + "TBZijVV1NXgQ5Nwbnbq9qYuZvmpwDm4Abn", + "TDte9ahHNpH4gixrzDFKNfWo4ezmNTHAbs", + "TEHPn1jYEePZz7v3Fp3VT9N5xDSKS8xTym", + "TFAXd82DvBpykbt9JyTpevDZWfkmqy2CnZ", + "THxEcFnr2fNXefzERQTVzU983dnUpLjCBn", + "TJVeQfDKsV2ZqrDzZKabgoE6De1vJhnP7h", + "TNkUL9Za9uBnSJ5MQMDaf2aSSFpuuoKw3k", + "TQQBRmmgRXJChVC66Vp5T5vpcnAq7ZXVL3", + "TRvDdpXnjWutnyhC6sUVuU8CbdHs9VEk94", + "TSAvg79MmExMFiwV5pkaXhKWvEuFdxZ1C6", + "TTFm9VabNHtUrfks9esDPNKgLCRxJsMZqX", + "TUZKXuaksVcDrfQfFcWrfkn3Jvqdp4H1Wx", + "TVvyKT63p66nqhQiNHX25izSUAvjcdER9X", + "TWAY47W8ci9XtfMgvs4r2A7Z2NFGUDJqpp", + "TZ7wp7mcM2Qq4kmDNW3pS7ZZ8Y8ztXUVji", ], //TRON DONE }, arbitrum: { @@ -291,6 +336,13 @@ const config = { "0x77a9b3fa8387652128ca5a9e4756e9e88dac3634", "0xafee421482faea92292ed3ffe29371742542ad72", "0xda225ad5d93bd96da9306d0f570ae0ed1013e7fc", + // OKX proof of reserves, 2026-11-01 snapshot + "0xa0c9b4ce1785953abdceae569789aa158a01da4c", + "0xb0473ca01e91981623b65daf84ab7bc94a7e4000", + "0xb2746ef5c9021def18a7568a56380eef6041eca6", + "0xc706f61c9b7eba61fd7170f191fce16e79c7f314", + "0xd8a3ed83a59d3e10d82a4b845d64b24ba0572baf", + "0xe7c5e276b2434743f6c79365d967cbe4291477bc", ], //ARB DONE }, avax: { @@ -300,6 +352,11 @@ const config = { "0xc94bb9b883ab642c1c3ed07af4e36523e7daf1fe", "0x3d3490a4744de78c06fb761bc1e9d17f007a219c", "0xb2cf3660cef92c4b394c741a1ecc29d2bd135fc6", + // OKX proof of reserves, 2026-11-01 snapshot + "0x3f03440b19d15ff2068daf68e57eb656bfd0a67e", + "0x5bc27f67cdfb4cf989455be1d2b3e33cd80efe53", + "0xde3c8d726e906b379a020cdb04bbe4b8f39a726f", + "0xef4b0d5e09fbba089671b08763e8aaec3512c365", ], //AVAX DONE }, polygon: { @@ -309,6 +366,11 @@ const config = { "0x06959153b974d0d5fdfd87d561db6d8d4fa0bb0b", "0xbe787d53e09822cc42bfb4abe1fb4492cae3d19d", "0x41205307b6618f03be2d95747a07311456bdb143", + // OKX proof of reserves, 2026-11-01 snapshot + "0x343d752bb710c5575e417edb3f9fa06241a4749a", + "0x3b50287cf8f073ff443b84de57e2375d446b962b", + "0x4aadf8d70a9a72947079610ed0490df06464094f", + "0xba2987a1a6b8662b8fa04c8512f7fbec346af336", ], //POLYGON DONE }, optimism: { @@ -324,6 +386,9 @@ const config = { "0x63a34366eff680c1a01a0146feccbcedf72d95ff", "0xb5216cb558cb018583bed009ee25ca73eb27bb1d", "0xc66c72b175b1a26ef4107c68aef9740b244955c4", + // OKX proof of reserves, 2026-11-01 snapshot + "0x76705493d53beefadffc253acb8aef72b7e7f6c6", + "0xb57198a6e5af11544936a520a54268bc6ababb0c", ], //OP DONE }, era: { @@ -393,6 +458,20 @@ const config = { "8PFD2CYF275p8YdRmhk4C1wcNoKeRVrouYdMbZV6HwHH", "3n7E2gZmCaDGpmvmHVHhHg13x7y1zG37tnEXvizxnKY1", "5njZuDSS2WTFkvWWsgv8Q4TfQBuCASKJAztc5yF2qLWZ", + // OKX proof of reserves, 2026-11-01 snapshot + "2egbJxkMXZ3LQz457NysWNFB99VJFUt5CXf5niYk3y2C", + "2YxQCXt9spMwoQZiwFLwdjHtscVvXi4nmxCkQCD6Rvgg", + "4UP7t9p3HEd9gfF9gFKkGa1ZvLXFS2naHgnxB4fwpLfS", + "8KBargHcP6pZFyWGXnn9YpL5mit4AgLkuXeMAYitjU9f", + "8wn2fZPKmUSMqNKLNsBfb3KkrVhChYYrL5Kzyfc2Dqox", + "8ZpnmeK7untiGBd47uB3isp95o2WzXmbhbdB983FuPKQ", + "9isrZBGb9CWU79466DCUxN25iH7krrLRei5niqvH5WxU", + "BN8rRoEifmfexngPpL4Rh8jpgi4VHizDXm15Qz81METK", + "EkeyuVghbRfGWPyEtm3vnjKZPbUXXrPqxdar8fsEMuXd", + "FrRqBZ3cxkfE4m7yG4BNVu8wwMhBqxt5hXDZY7Cbcf4P", + "FxmrpAFvRUYQwY67AstmZ4oDQWLZcTDzRst4mg3xi3BQ", + "GFg1X8GhgS1cid3KDHwP13FWmjCGm8BUEeaXJXjkapM2", + "Gk73RezntpEs1tjhL4hLzo7LpM7qo8oSxAhjxLVVcgyD", ], }, //SOL DONE ripple: { @@ -413,6 +492,16 @@ const config = { "rwSY8Fwq6PKKDUtjScSi7ZVap3BJHi6oRs", "rUVtjZ5Kg4TJ4osZCJooq3hunjuACtNx4W", "rQfxZ8c12uByDtLVnT1a56aXkcBFdDMwhq", + // OKX proof of reserves, 2026-11-01 snapshot + "r2iJ8ur9zndH1g2Vb8mfC3hCXUNSErET2", + "r9obQ7QtcnEpT5MfZ4WTn8wXpBAcNDu8CM", + "r9TF48pGQSqRN198ZVr6qT9NT4GrG5xbH", + "r9xhMpXDsxzt4sY3W2R2nqGQfig9Cg47KP", + "rJ8hb4jMHgRNhEQ7BTGz6vt14kWn2z6H78", + "rK2NmBC22DRxCBXUzbAsL2Tv6x4iPGxNor", + "rMU4XXyDRzvvuMmdtE321s2rar8jd8hwDK", + "rnvVBA7Z7MUZqd6Yr2BqDXznsKAs8Mn5iR", + "rU3knThAMvYomiB9qw1R4bUhAqRrQQGPVf", ], }, //XRP DONE litecoin: { @@ -586,6 +675,15 @@ const config = { "ltc1qupe6qcd9xlh7a8xe5jdpcl4w0qgxmnxxfz6z6h544zw37xntamcqkppkv6", "ltc1qcm29pexe8q9n6qzfquvga8xwj9nqq9txhejq0phuw445h8t0hwsq65njjm", "ltc1q7tm3qxw59zatfzw4993l6h30sp2jwa7dhem62z8v4tw0ty7vl2rsmf963x", + // OKX proof of reserves, 2026-11-01 snapshot + "ltc1q0a3nwmua3za9d7jxmu6hjj7fmrwu9esx85dxtnpum07n0z3009ysxlu4rt", + "ltc1qcfxz37cdmd235t0375f2ausfcltuw3q2mxutsmnu9p4px9w0t6fq7l95pa", + "ltc1qdnrtvkkynjjkgrjcp44jg77rknrkxu8tgdfu3479nvrfljljesjs2ekg02", + "ltc1qk6ah32yp7vt3kfrryduu0kp23k8457rk2jga05uqgtt980pr2e0s8njk39", + "ltc1qm3un22e8gzyrr2strwzs3x8c3qpcvm7g2snq40m3cezdu9m5czls5prvqe", + "ltc1qr4uuhzgw0wwk70twj82lcnfj3239xecysdehfj3fhdjjyypkjwaqxh4xh0", + "ltc1qu4xqx3usn6lvw5mjsdaunaplrwuka0r4f2dyu88q92uazgtkr5kqdh0rhw", + "ltc1qy560xhu03ggs5tyzfusfdclqn3j9kvmmrx4rytwx64myys6tsuwshmu5ew", ], }, //LTC DONE wallets with more than 750 LTc linea: { @@ -607,6 +705,8 @@ const config = { "16UvKYsqojoivDsNXH3d5G48oXMfo1asxA4NtF2GxhoBjZHz", "1gn68eNGNGqV3QjVcRRDVfw22xFn1eFyUizHCENVn256LXh", "14n7KYKKjZohVapvNYnWdCVu7oCJMjyWHqehGcC11wE7dKWv", + // OKX proof of reserves, 2026-11-01 snapshot + "15yXD7x2Cy8uVuTdtujRjAtjdi2FHZc6wUyFrjCNqYiBjPUQ", ], }, //polkadot DONE aptos: { @@ -617,6 +717,16 @@ const config = { "0x51c6abe562e755582d268340b2cf0e2d8895a155dc9b7a7fb5465000d62d770b", "0x3621fa917ffef3f0509f5d5953672a69791df329139644d89d0a1b0beb98c585", "0x4c1ef44079cb31851349fba50d385f708a10ec7ac612859fdbf28888d1f7b572", + // OKX proof of reserves, 2026-11-01 snapshot + "0x2af5827f7017a7f6127184d73b2340f12e5dc248a48f48e2fe3fff08f6007beb", + "0x581bdd91ed2b08496cbab0d6b02674f8da3a2f128b086a3209d23ebafc5df553", + "0x612a398b1320b877cbc84fee033e88aa9e06cfa630b9d56d2b469ea7750bf157", + "0x6f64b49c6c9899abaab8b748aa37c5776105a4e243cc4ee0a62d7aea4fb13865", + "0x709b8e7b649b6de24552f8154c5c5edd4be950145d48f74829511e3cbef41b5a", + "0xabc1f0788277b325b8357068e7c75a4e6614ed2a42cb5e950cfac4ec3599bb04", + "0xd0c23b2613e9c14f4888ff6c4359f197424ca88cf2970bac9e862e5ee65d5fa8", + "0xd7eb876597276ad1c4159eb7a03dd4b694db9c142f28a9472a42510bc6a13a6e", + "0xffd7f0d7b24ba690657dd2aa7ccb754c4be938e4fb970c72eef966d664bd1a45", ], }, starknet: { @@ -630,6 +740,13 @@ const config = { "A1D5sbS86TMJxwGT5q2oTWkXXLfgJ5j8up", "ADNbM5fBujCRBW1vqezNeAWmnsLp19ki3n", "9vPesMs2Md65mu2JBEccp8RKBqccqaLMRL", + // OKX proof of reserves, 2026-11-01 snapshot + "9sjCMx1BiTNv3gw5rD31TCQpFyqBpsbjok", + "A65PRXy9qRzvwGcuLsBWR6Fp4yLAukZQfQ", + "A7zXZBP6SzR1yNaFxD3jKAT8YPkY8Uz9Ch", + "AA431oUHgBPpuEbGt6G1Z96bgkZhyE4KTx", + "AAoFDDavpFLGTu2mkDAsyjc48WfJGkqo7b", + "ABKETAr5U7DP4k1yE8x9z2eFAmM1LxbP62", ], }, base: { @@ -638,6 +755,8 @@ const config = { "0x10b7dfc30e290b77ded2550d66974c6a124dfa0d", "0xc8802feab2fafb48b7d1ade77e197002c210f391", "0x0db6ffb36e26958cfa53cbe6d767f3cc7ba595d7", + // OKX proof of reserves, 2026-11-01 snapshot + "0x17fe9197970454875df742a74b74ed5f984b645a", ], }, scroll: { @@ -685,6 +804,10 @@ const config = { "UQAqc2WkItRXN4xB6n5tBzNxhT8pP-e3MtTlReU3UdIJVI-s", // "UQDY4-KtVxawZU_Vva7KTOhlhx8Ho0jI0ahyebYT5YuJkYSf", "UQDY4-KtVxawZU_Vva7KTOhlhx8Ho0jI0ahyebYT5YuJkYSf", + // OKX proof of reserves, 2026-11-01 snapshot + "UQAHsamD0jg4uG0FtCCkKBP2JPLLT02RaU2Ous8PX0sCrbCt", + "UQB6lLuzS5bEDTrsFzdNmA5xcmaH5V20WfPd6A7cvdFAxbz8", + "UQDYa6Lp99YwuDrDmCsngxs5dKzL_P7epA4iP0T7dsoY1po4", ], }, xlayer: { @@ -714,6 +837,19 @@ const config = { "0x52a109504af4a587f773faf949e65987c6ae544a", "0xe64b0f1a50ba340426861f29327e9eaa7fb404ad", "0xcfb691fe064f1caef47eef90a3ddae45225f358c", + // OKX proof of reserves, 2026-11-01 snapshot + "0x3a664ab28cc1edffbe33cc8adb17ca0975fe3b68", + "0x45f329ff834a84fccea2319f91e1993540b22a2a", + "0x463f606c0e7c82ea21751a07cbf5ce17476fd911", + "0x611f7bf868a6212f871e89f7e44684045ddfb09d", + "0x9b5583975773a4f20364fb8c8e69ea5a91961624", + "0xa3b9656f9127e56ab026f1f5cbb4e48669b5cd6f", + "0xb52b53393680596b63b421a9d27a84e043160e53", + "0xc847f0480c3a1eefcf36c728fc2b85c3bbf83a5e", + "0xca2e105de6dc1f4f16d0fed5bdce72156a2f6390", + "0xddd5abcbae5e0a4e2cd31e04b984736f4b245f71", + "0xe5aeb8a1a60ed4900e3c36e8a4b9967f5cf1a8c9", + "0xec3b1a439cd39098a15bd3dba36bda472a247f37", ], }, bitcoincash: { From 73f5d7cf48b89207ebcc56d0e6fbd303030e5081 Mon Sep 17 00:00:00 2001 From: EscapeHub Date: Mon, 16 Nov 2026 21:52:19 +0300 Subject: [PATCH 769/988] Add EscapeHub (#22206) Co-authored-by: EscapeHub <225285006+escapehub-ai@users.noreply.github.com> Co-authored-by: FelixBruguera --- projects/escapehub/index.js | 52 +++++++++++++++++++++++++++++++++++++ registries/treasury.js | 23 ++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 projects/escapehub/index.js diff --git a/projects/escapehub/index.js b/projects/escapehub/index.js new file mode 100644 index 00000000000..d5f30cca193 --- /dev/null +++ b/projects/escapehub/index.js @@ -0,0 +1,52 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getProvider, sumTokens2: sumTokens2Solana } = require('../helper/solana') +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { PublicKey } = require('@solana/web3.js') + +const CURVE_PROGRAM = new PublicKey('EscapeCu75SSPg24kyh7R6NvwgMUT8QEpCLY6kKHYCeD') +const BONDING_CURVE_SIZE = 120 +const BONDING_CURVE_DISCRIMINATOR = '4y6pru6YvC7' // 17b7f83760d8ac60 +const OFFSET_MINT = 8 // pubkey +const OFFSET_IS_GRADUATED = 104 // bool +const NOT_GRADUATED = '1' // 0x00 + +async function solanaTvl(api) { + const connection = getProvider().connection + const curves = await connection.getProgramAccounts(CURVE_PROGRAM, { + filters: [ + { dataSize: BONDING_CURVE_SIZE }, + { memcmp: { offset: 0, bytes: BONDING_CURVE_DISCRIMINATOR } }, + { memcmp: { offset: OFFSET_IS_GRADUATED, bytes: NOT_GRADUATED } }, + ], + dataSlice: { offset: OFFSET_MINT, length: 32 }, + }) + // the SOL of each curve sits in its vault, the PDA of ["curve-vault", mint] + const vaults = curves.map(({ account }) => PublicKey.findProgramAddressSync([Buffer.from('curve-vault'), account.data], CURVE_PROGRAM)[0].toBase58()) + return sumTokens2Solana({ api, solOwners: vaults }) +} + +const TOKEN_CREATED = 'event TokenCreated(address indexed token, address indexed market, address indexed creator, string name, string symbol, string metadataURI, uint256 virtualNativeOffset)' + +const EVM_FACTORIES = { + base: { factory: '0x99Feb0E3d5Ba40eB5DF8D914f5A06370CaE5CA6E', fromBlock: 57899403 }, + robinhood: { factory: '0x99Feb0E3d5Ba40eB5DF8D914f5A06370CaE5CA6E', fromBlock: 115197467 }, +} + +function evmTvl({ factory, fromBlock }) { + return async (api) => { + const logs = await getLogs2({ api, target: factory, eventAbi: TOKEN_CREATED, fromBlock }) + const markets = logs.map((log) => log.market) + return sumTokens2({ api, owners: markets, tokens: [ADDRESSES.null] }) + } +} + +module.exports = { + timetravel: false, + methodology: 'Counts SOL and ETH in bonding curves that have not graduated yet. Solana: SOL balance of the vault of every non-graduated bonding curve. Base and Robinhood: ETH balance of every market created by the TokenFactory. Graduated liquidity and launched tokens are not counted.', + solana: { tvl: solanaTvl }, +} + +Object.entries(EVM_FACTORIES).forEach(([chain, config]) => { + module.exports[chain] = { tvl: evmTvl(config) } +}) diff --git a/registries/treasury.js b/registries/treasury.js index dd8a57d7892..9fb5c41126d 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -1967,6 +1967,29 @@ const configs = { ownTokens: ['0xE1da44C0dA55B075aE8E2e4b6986AdC76Ac77d73'], }, }, + 'treasury/escapehub': { + solana: { + owners: [ + '4grHVxs1ja1aRMZ7kvGKs5cPbkbLjJYr9eTE7uuJGyhf', + '73CzwRjyUiANeLFKWwTqwgGmQrafiW7DiaJDyy7cvf4T', + '3erpBQDik1HfHjcUFZvk1pwpeYEo3pspeAjkDXf7ZsKD', + '9JUq2gJ23qBsfDWJ4SuSHjQyy4iMejYnv5CUScDsKdiK', + '3RvCQ7CimppEa3Vh3eT8cWVTZ3wrcXxxzdYB2oSLLQEo', + 'BFZmmrBpStJhd73f8eAK6kKHCENcRbrfeFXjudBjzG5z', + '3HXixFEArKq9bkT12eESU2Qvi2AYpFbu5hUbwN8VKNcv', + '8ZniFaHPUyAEGC2ca8E29sBzHCKZkNLEU1cx2PMWyRLX', + ], + tokens: [ADDRESSES.solana.SOL], + }, + base: { + owners: ['0x1f4E1154f549a1CA1E6f4C7fd2908fC7BF4C76Cd'], + tokens: [nullAddress, ADDRESSES.base.WETH], + }, + robinhood: { + owners: ['0x1f4E1154f549a1CA1E6f4C7fd2908fC7BF4C76Cd'], + tokens: [nullAddress, ADDRESSES.robinhood.WETH], + }, + }, 'treasury/ether': { optimism: { tokens: [ From fc167c0a2812616d4c6a43ba7f31c17c76688aa8 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 16 Nov 2026 22:53:46 +0400 Subject: [PATCH 770/988] okx: count staked eth on compounding validators (#22226) Co-authored-by: Claude Opus 5.5 --- projects/okex/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/okex/index.js b/projects/okex/index.js index c694dd0505c..c1efbf6ab75 100644 --- a/projects/okex/index.js +++ b/projects/okex/index.js @@ -994,6 +994,10 @@ const withdrawalAddresses = [ "0xe839a3e9efb32c6a56ab7128e51056585275506c", "0x9c595f9518b11b2876b2a5e89996b1fd2c748726", "0x32ddc4d173745a41e428ccf3756b907673301992", + "0xd5f8c864f21824daf3a4b22d9c33693642ed7634", + "0x9b4495fcc3c99b3cb73a3722320ff1858c81c2f0", + "0x4ccda666c69cd35be70aabd8931d824b2cfa3d2d", + "0x05e851e9196fa1fc55f92ddd07ee83a978db35d0", ]; /** From 4d5e0720703c2e02a4112245b11ac57150baae82 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 16 Nov 2026 23:01:17 +0400 Subject: [PATCH 771/988] nest-staking: deduct Nest shares held by other Nest vaults (#22229) Co-authored-by: Claude Opus 5.5 --- projects/nest-staking/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/projects/nest-staking/index.js b/projects/nest-staking/index.js index 5716420733d..b0528748363 100644 --- a/projects/nest-staking/index.js +++ b/projects/nest-staking/index.js @@ -22,8 +22,15 @@ function evmTvl(chain) { return async function tvl(api) { const vaults = await getIncludedVaults(); const addresses = vaults.filter(vault => vault.chain?.[chain]).map(vault => vault.vaultAddress); + await api.getBlock(); // supplies and nested balances must come from the same block const supplies = await api.multiCall({ abi: "erc20:totalSupply", calls: addresses }); - api.add(addresses, supplies); + // Nest vaults also hold shares of other Nest vaults, which are already counted in the inner vault's supply + const owners = [...new Set(vaults.map(vault => vault.vaultAddress))]; + const calls = addresses.flatMap(target => owners.filter(owner => owner !== target).map(owner => ({ target, params: owner }))); + const nested = await api.multiCall({ abi: "erc20:balanceOf", calls }); + const netSupplies = Object.fromEntries(addresses.map((token, i) => [token, BigInt(supplies[i])])); + calls.forEach(({ target }, i) => netSupplies[target] -= BigInt(nested[i])); + api.add(addresses, addresses.map(token => netSupplies[token].toString())); } } @@ -34,7 +41,7 @@ async function tvl_solana(api) { } module.exports = { - methodology: "TVL is calculated from the value of Nest tokens, which represent user shares in vaults backed by yield-generating assets.", + methodology: "TVL is calculated from the value of Nest tokens, which represent user shares in vaults backed by yield-generating assets. Nest tokens held by other Nest vaults are deducted.", ethereum: { tvl: evmTvl("mainnet") }, plume_mainnet: { tvl: evmTvl("plume") }, bsc: { tvl: evmTvl("bsc") }, From 30ab0f0907da8b4aa33eb3fb6aec47a9e062ccae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Tue, 17 Nov 2026 00:37:09 +0530 Subject: [PATCH 772/988] opentrade: count the two avax vaults that predate the factory (+$3.72M) (#22230) --- projects/opentrade/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/projects/opentrade/index.js b/projects/opentrade/index.js index 47bdd60f86a..8350f4904f3 100644 --- a/projects/opentrade/index.js +++ b/projects/opentrade/index.js @@ -30,12 +30,24 @@ const FACTORY = { ], } +// Avax vaults deployed before the factory above, so they have no PoolCreated log. Both were in the +// static list this adapter used before the switch to factory discovery (XTBT) or in fees/opentrade +// (XEVT). At block 100468357: XTBT 567,071 USDC, XEVT 2,858,609 EURC, both with exchangeRate still +// accruing. XRV1 (0xbb9360d57f68075e98d022784c12f2fda082316b) is left out: no token transfer since +// 2025-02-20 and totalAssets() reverts at some blocks. +const PRE_FACTORY_POOLS = { + avax: [ + '0xad6605f4987031fd2d6d6816be53eb7c5b764bf7', // XTBT + '0xbfdef5e389bb403426337081ecd1d05bc5193203', // XEVT + ], +} + const poolCreatedAbi = 'event PoolCreated (address indexed addr)' async function tvl(api) { const factories = FACTORY[api.chain] - const poolSet = new Set() + const poolSet = new Set(PRE_FACTORY_POOLS[api.chain] ?? []) for (const { address, fromBlock } of factories) { const logs = await getLogs2({ api, From c52b6b55d1e0531458dfa43dfd0eb0b241a0eb13 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Mon, 16 Nov 2026 23:46:44 +0400 Subject: [PATCH 773/988] 40acres: count sAERO stakes after the Aero migration (#22232) Co-authored-by: Claude Opus 5.5 --- projects/40acres/helpers.js | 20 ++++++++++++++++++++ projects/40acres/index.js | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/projects/40acres/helpers.js b/projects/40acres/helpers.js index 44d7a786591..0d61a83148a 100644 --- a/projects/40acres/helpers.js +++ b/projects/40acres/helpers.js @@ -37,6 +37,14 @@ const veNftMapping = { blackhole: '0xEac562811cc6abDbB2c9EE88719eCA4eE79Ad763' //veBLACK } } +// Since the 2026-10-22 Aerodrome -> Aero migration, veAERO locks are upgraded into permanent stakes +// (sAERO NFTs) on the Aero VotingEscrow, minted to the same portfolio +const stakeMapping = { + base: { + votingEscrow: '0xBF7977E1521e9a3032bf7243Ee4712f311f13915', // sAERO + token: '0x3f5bF3EdAc59d650D8fDf9657a71F2f904A3a4Ee', // Aero AERO (new token) + }, +} const portfolioManager = "0x40ac2e40acb7bdd6ec83e468143262fe216529ec"; const avaxPortfolioFactory = '0x52d43C377e498980135C8F2E858f120A18Ea96C2'; const paraohVoterModule = "0x34F233F868CdB42446a18562710eE705d66f846b"; @@ -114,6 +122,18 @@ async function getPortfolioVeNftTvl(api) { const tokenIds = await api.multiCall({ abi: SOLIDLY_VE_NFT_ABI.ownerToNFTokenIdList, calls: idCalls, target: veNft }) const locked = await api.multiCall({ abi: SOLIDLY_VE_NFT_ABI.locked, calls: tokenIds, target: veNft }) locked.forEach(i => api.add(baseTokenMapping[chain], i.amount)) + + const stake = stakeMapping[chain] + if (!stake) return + // permitFailure: the VotingEscrow was deployed just before the migration, earlier blocks get empty calls below + const stakeCounts = await api.multiCall({ abi: 'erc20:balanceOf', calls: allPortfolios, target: stake.votingEscrow, permitFailure: true }) + const stakeIdCalls = [] + stakeCounts.forEach((count, i) => { + for (let j = 0; j < +(count ?? 0); j++) stakeIdCalls.push({ params: [allPortfolios[i], j] }) + }) + const stakeIds = await api.multiCall({ abi: SOLIDLY_VE_NFT_ABI.tokenOfOwnerByIndex, calls: stakeIdCalls, target: stake.votingEscrow }) + const staked = await api.multiCall({ abi: 'function staked(uint256) view returns (uint128 amount, uint48 end, bool isPermanent)', calls: stakeIds, target: stake.votingEscrow }) + staked.forEach(i => api.add(stake.token, i.amount)) } module.exports = { diff --git a/projects/40acres/index.js b/projects/40acres/index.js index 0385046331d..1cf19451723 100644 --- a/projects/40acres/index.js +++ b/projects/40acres/index.js @@ -21,7 +21,7 @@ async function borrowed(api) { module.exports = { timetravel: true, start: '2025-01-31', - methodology: `TVL is comprised of tokens deposited to the protocol as collateral and tokens deposited to the vault for lending. Borrowed tokens are not counted towards TVL.`, + methodology: `TVL is comprised of tokens deposited to the protocol as collateral (veNFTs, and the sAERO stakes they migrated into on Base) and tokens deposited to the vault for lending. Borrowed tokens are not counted towards TVL.`, base: { tvl: tvl, borrowed: borrowed }, optimism: { tvl: tvl, borrowed: borrowed }, avax : { tvl: tvl, borrowed: borrowed } From 72464bbcd665dfe0ee25f71e4665346c283bf34d Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 16 Nov 2026 16:02:17 -0400 Subject: [PATCH 774/988] move bp to ownTokens in backpack (#22235) --- projects/backpack/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/projects/backpack/index.js b/projects/backpack/index.js index 4b19201cb79..9894838a456 100644 --- a/projects/backpack/index.js +++ b/projects/backpack/index.js @@ -57,6 +57,10 @@ const CHAIN_BLACKLISTS = { ethereum: [ADDRESSES.ethereum.sUSD_OLD], } +const OWN_TOKENS = { + solana: ['BPxxfRCXkUVhig4HS1Lh7kZqV6SPJhzfEk4x6fVBjPCy'], // BP +} + // 0G native has no entry in coreAssets; tempo native is unpriced and skipped const NATIVE_TOKENS = { '0g': [ADDRESSES.null], @@ -78,7 +82,7 @@ CHAINS.forEach((chain) => { let { owners, fungibleAssets } = entry - const options = { owners, tokens, chain, blacklistedTokens: CHAIN_BLACKLISTS[chain] } + const options = { owners, tokens, chain, blacklistedTokens: [...(CHAIN_BLACKLISTS[chain] || []), ...(OWN_TOKENS[chain] || [])] } switch (chain) { case 'solana': @@ -99,6 +103,15 @@ CHAINS.forEach((chain) => { return sumTokensExport(options)(api) } } + + if (OWN_TOKENS[chain]) { + exportObj[chain].ownTokens = async (api) => { + const config = await _getConfig() + const entry = config[chain] + if (!entry) return {} + return sumTokensExport({ chain, owners: entry.owners, tokens: OWN_TOKENS[chain] })(api) + } + } }) module.exports = exportObj From 4083caf4a37a7ed03da8f3ac907da93521903491 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 01:12:15 +0400 Subject: [PATCH 775/988] rain-one: report RAIN in RAIN markets as staking (#22241) Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- projects/rain-one/index.js | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/projects/rain-one/index.js b/projects/rain-one/index.js index cee24caa221..6759342550d 100644 --- a/projects/rain-one/index.js +++ b/projects/rain-one/index.js @@ -2,20 +2,40 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') const FACTORIES = [ - "0xccCB3C03D9355B01883779EF15C1Be09cf3623F1", // v1 - "0xA8640B62D755e42C9ed6A86d0fc65CE09e31F264", // v2 + { target: "0xccCB3C03D9355B01883779EF15C1Be09cf3623F1", fromBlock: 307025521 }, // v1 + { target: "0xA8640B62D755e42C9ed6A86d0fc65CE09e31F264", fromBlock: 446257605 }, // v2, deployed 2026-03-27 ] const RAIN_RISK_MARKET_RESERVOIR = "0x3783c98C39c48750D92A7086D3EacBD231EF26b5" +const RAIN = "0x25118290e6A5f4139381D072181157035864099d" + +// [baseToken, pool] for every market that has not been finalized yet +async function getOpenPoolTokens(api) { + const block = await api.getBlock() + const pools = [] + for (const { target, fromBlock } of FACTORIES) { + if (block < fromBlock) continue + pools.push(...await api.fetchList({ target, itemAbi: 'allPools', lengthAbi: 'totalPools' })) + } + const finalized = await api.multiCall({ abi: 'bool:poolFinalized', calls: pools }) + const openPools = pools.filter((_, i) => !finalized[i]) + const tokens = await api.multiCall({ abi: 'address:baseToken', calls: openPools }) + return tokens.map((token, i) => [token, openPools[i]]) +} + +const isRain = ([token]) => token.toLowerCase() === RAIN.toLowerCase() async function tvl(api) { - const pools = (await Promise.all(FACTORIES.map(target => api.fetchList({ target, itemAbi: 'allPools', lengthAbi: 'totalPools' })))).flat() - const tokens = await api.multiCall({ abi: 'address:baseToken', calls: pools }) - const tokensAndOwners = tokens.map((token, i) => [token, pools[i]]) + const tokensAndOwners = (await getOpenPoolTokens(api)).filter(i => !isRain(i)) tokensAndOwners.push([ADDRESSES.arbitrum.USDT, RAIN_RISK_MARKET_RESERVOIR]) return sumTokens2({ api, tokensAndOwners, resolveLP: true }) } +async function staking(api) { + const tokensAndOwners = (await getOpenPoolTokens(api)).filter(isRain) + return sumTokens2({ api, tokensAndOwners }) +} + module.exports = { - methodology: "TVL includes all markets created on rain.one platform.", - arbitrum: { tvl }, + methodology: "TVL is the base token held by markets that have not been finalized yet, plus the USDT in the risk market reservoir. Funds left unclaimed in finalized markets are not counted. RAIN held by open RAIN markets is counted as staking.", + arbitrum: { tvl, staking }, } From e7d8e39a7b7454453a796a30a030039a2bdd4a5f Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 10:56:45 +0400 Subject: [PATCH 776/988] current: discover lending markets by type (#22253) Co-authored-by: Claude Opus 5.5 --- projects/current/index.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/projects/current/index.js b/projects/current/index.js index ce25a742658..8c6ac274a4c 100644 --- a/projects/current/index.js +++ b/projects/current/index.js @@ -1,14 +1,11 @@ -const { getObject, getDynamicFieldObjects } = require('../helper/chain/sui') +const { getObjectsByType, getDynamicFieldObjects } = require('../helper/chain/sui') const WAD = 10n ** 18n -const MARKET_OBJECT_IDS = [ - '0x41f3d76aee8b20e53f7d0d395fdc09e241e683c7bc5d0f69674b545ee42549df', // MainMarket - '0x6f5230c346e27132b8d4d92cb3f4f9c7f4e736d5c32b8f0a2b063c97e67d78f7', // AltCoinMarket - '0x8e85c433f791685c65fa66923110b8385e13f955daf8792ef805ce2d47139bbc', // EmberMarket - '0xafe28c816d322a56bdab27b90d4b5e882a0a34ee2d9f02c6a07402a2b69be900', // MatrixGoldMarket - '0xeeef7e9abe201e16c3ca6417b91fa49bec28edcb077eb2fd4a1f126c251e6899', // EthenaMarket -] +// every lending market is a Market object of the protocol package (MainMarket, AltCoinMarket, EmberMarket, +// MatrixGoldMarket, EthenaMarket, Market01 = sUSN Market, ...), and only the AdminCap holder can register one +// (market_admin::register_market), so markets are discovered by type +const MARKET_TYPE = '0xfe1d8929d13b00aaecd7642dec1c6d41cab82882a1b139efa46bf61dfd6380bf::market::Market' function coinTypeFromName(name) { return name.startsWith('0x') ? name : `0x${name}` @@ -19,8 +16,9 @@ let _reserveRowsPromise async function getReserveRows() { if (!_reserveRowsPromise) _reserveRowsPromise = (async () => { const rows = [] - for (const marketId of MARKET_OBJECT_IDS) { - const market = await getObject(marketId) + const markets = await getObjectsByType(MARKET_TYPE) + if (!markets.length) throw new Error('current: no markets found') + for (const market of markets) { const tableId = market.fields.reserves.fields.table.fields.table.fields.id.id const objects = await getDynamicFieldObjects({ parent: tableId }) for (const obj of objects) { @@ -31,7 +29,7 @@ async function getReserveRows() { } } return rows - })() + })().catch(e => { _reserveRowsPromise = undefined; throw e }) return _reserveRowsPromise } @@ -49,6 +47,6 @@ async function borrowed(api) { module.exports = { timetravel: false, - methodology: 'TVL counts on-chain underlying liquidity: for each configured Sui market object, we enumerate reserve entries in the market’s reserve table and sum Reserve.cash per asset. Borrowed counts total outstanding borrows per asset as Reserve.debt.', + methodology: 'TVL counts on-chain underlying liquidity: for each Sui market object (all Market objects of the protocol package), we enumerate reserve entries in the market’s reserve table and sum Reserve.cash per asset. Borrowed counts total outstanding borrows per asset as Reserve.debt.', sui: { tvl, borrowed }, } From 70f59991ba7f4c0fe29b8035979bd14010715cef Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 10:57:07 +0400 Subject: [PATCH 777/988] vesu: discover v2 pools from the pool factory (#22252) Co-authored-by: Claude Opus 5.5 --- projects/vesu/index.js | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/projects/vesu/index.js b/projects/vesu/index.js index 88b16c95e2f..b0257c03868 100644 --- a/projects/vesu/index.js +++ b/projects/vesu/index.js @@ -1,5 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { multiCall, sumTokens } = require("../helper/chain/starknet"); +const { multiCall, sumTokens, getLogs, parseAddress } = require("../helper/chain/starknet"); +const { getSelectorFromName } = require("../helper/utils/starknet"); const { erc20ABI, singletonABI, poolABI } = require("./abi"); const INTERNAL_SCALE = 10 ** 18; @@ -17,14 +18,30 @@ const SINGLETON_POOLS = [ "0x2906e07881acceff9e4ae4d9dacbcd4239217e5114001844529176e1f0982ec", // Alterscope Cornerstone Pool "0x3de03fafe6120a3d21dc77e101de62e165b2cdfe84d12540853bd962b970f99", // Re7 rUSDC Pool ]; -const V2_POOLS = [ - "0x451fe483d5921a2919ddd81d0de6696669bccdacd859f72a4fba7656b97c3b5", // Vesu Prime Pool - "0x2eef0c13b10b487ea5916b54c0a7f98ec43fb3048f60fdeedaf5b08f6f88aaf", // Re7 USDC Prime Pool - "0x3976cac265a12609934089004df458ea29c776d77da423c96dc761d09d24124", // Re7 USDC Core Pool - "0x3a8416bf20d036df5b1cf3447630a2e1cb04685f6b0c3a70ed7fb1473548ecf", // Re7 xBTC Pool - "0x73702fce24aba36da1eac539bd4bae62d4d6a76747b7cdd3e016da754d7a135", // Re7 USDC Stable Core Pool - "0x5c03e7e0ccfe79c634782388eb1e6ed4e8e2a013ab0fcc055140805e46261bd", // Re7 USDC Frontier Pool -]; +// V2 pools are deployed by the pool factory, which emits CreatePool(pool) when it deploys a pool and AddAsset(pool, asset) +// for every asset it lists in a pool +// https://github.com/vesuxyz/vesu-v2/blob/main/deployment.json +const V2_POOL_FACTORY = { target: "0x3760f903a37948f97302736f89ce30290e45f441559325026842b7a6fb388c0", fromBlock: 2367000 }; +const CREATE_POOL = getSelectorFromName("CreatePool"); +const ADD_ASSET = getSelectorFromName("AddAsset"); + +// factory add_asset accepts any contract whose curator() is the caller, so only pools the factory deployed are kept +// each (pool, asset) pair is kept once +async function getV2PoolAssets() { + const [createLogs, addLogs] = await Promise.all([ + getLogs({ ...V2_POOL_FACTORY, topics: [CREATE_POOL] }), + getLogs({ ...V2_POOL_FACTORY, topics: [ADD_ASSET] }), + ]); + const pools = new Set(createLogs.map(({ keys }) => parseAddress(keys[1]))); + const pairs = new Map(); + addLogs.forEach(({ keys }) => { + const pool = parseAddress(keys[1]); + const asset = parseAddress(keys[2]); + if (pools.has(pool)) pairs.set(`${pool}-${asset}`, { pool, asset }); + }); + return [...pairs.values()]; +} + const ASSETS = [ ADDRESSES.starknet.ETH, ADDRESSES.starknet.WBTC, @@ -51,7 +68,9 @@ const ASSETS = [ ]; async function tvl(api) { - return sumTokens({ api, owners: [SINGLETON, ...V2_POOLS], tokens: ASSETS }); + const poolAssetsV2 = await getV2PoolAssets(); + await sumTokens({ api, owner: SINGLETON, tokens: ASSETS }); + return sumTokens({ api, tokensAndOwners: poolAssetsV2.map(({ pool, asset }) => [asset, pool]) }); } const borrowed = async (api) => { @@ -66,7 +85,7 @@ const borrowed = async (api) => { api.add(poolAssets[index].asset, scaledTotalDebt); }); // V2 Pools - const poolAssetsV2 = V2_POOLS.map((pool) => ASSETS.map((asset) => ({ pool, asset }))).flat(); + const poolAssetsV2 = await getV2PoolAssets(); const callsV2 = poolAssetsV2.map(({ pool, asset }) => ({ target: pool, params: [asset] })) const assetStatesV2 = await multiCall({ calls: callsV2, abi: poolABI[0], allAbi: poolABI, permitFailure: true }); assetStatesV2.forEach((res, index) => { @@ -79,6 +98,7 @@ const borrowed = async (api) => { }; module.exports = { + timetravel: false, // the starknet helper calls always read the latest block starknet: { tvl, borrowed, From ad35156b4635f03bb144725e1e38682859092216 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 10:57:29 +0400 Subject: [PATCH 778/988] fix(hyperlane): count xERC20 lockboxes and cross-collateral routers (#22250) Co-authored-by: Claude Opus 5.5 --- projects/connext/index.js | 17 +++++++++++++---- projects/hyperlane/index.js | 22 +++++++++++++++++++--- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/projects/connext/index.js b/projects/connext/index.js index 61bd895eb56..8365eb480fb 100644 --- a/projects/connext/index.js +++ b/projects/connext/index.js @@ -17,13 +17,18 @@ async function getDeployedContractAddress(chainId) { contracts.Connext_DiamondProxy?.address, ].filter(i => i); - // Manually adding Connext-specific xERC20 lockboxes on L1. Don't yet have a programmatic way to retrieve these, so hardcoding the largest lockboxes only for now. - if (chainId === 1) { - result.push("0xC8140dA31E6bCa19b287cC35531c2212763C2059"); // ezETH - } return result; } +// ezETH xERC20 lockbox on L1, counted only while Connext can still mint/burn xezETH. Its limits were set to 0 on +// 2025-01-13, since then the lockbox is bridged over Hyperlane (projects/hyperlane). xezETH has no code before +// XEZETH_DEPLOY_BLOCK, so the lockbox did not exist either; after it, a failed limits read must throw. +const EZETH_LOCKBOX = "0xC8140dA31E6bCa19b287cC35531c2212763C2059" +const XEZETH = "0x2416092f143378750bb29b79eD961ab195CcEea5" +const XEZETH_DEPLOY_BLOCK = 19327270 +const CONNEXT_DIAMOND = "0x8898B472C54c31894e3B9bb83cEA802a5d0e63C6" +const bridgesAbi = 'function bridges(address) view returns ((uint256 timestamp, uint256 ratePerSecond, uint256 maxLimit, uint256 currentLimit) minterParams, (uint256 timestamp, uint256 ratePerSecond, uint256 maxLimit, uint256 currentLimit) burnerParams)' + let getAssetsPromise // Taken from @connext/nxtp-utils async function getAssetIds(chainId) { @@ -44,6 +49,10 @@ async function getAssetIds(chainId) { async function tvl(api) { const chainId = api.chainId const owners = await getDeployedContractAddress(chainId) + if (chainId === 1 && (api.block === undefined || api.block >= XEZETH_DEPLOY_BLOCK)) { + const limits = await api.call({ target: XEZETH, abi: bridgesAbi, params: [CONNEXT_DIAMOND] }) + if (+limits.minterParams.maxLimit > 0 || +limits.burnerParams.maxLimit > 0) owners.push(EZETH_LOCKBOX) + } if (!owners.length) return {} const tokens = await getAssetIds(chainId) diff --git a/projects/hyperlane/index.js b/projects/hyperlane/index.js index c0ec2d18626..209d891579f 100644 --- a/projects/hyperlane/index.js +++ b/projects/hyperlane/index.js @@ -9,6 +9,16 @@ const COLLATERAL_STANDARDS = new Set([ 'EvmHypCollateralFiat', 'EvmHypOwnerCollateral', 'EvmHypRebaseCollateral', + 'EvmHypCrossCollateralRouter', +]) + +// xERC20 lockbox routes: collateralAddressOrDenom is the lockbox, which holds the underlying token +const LOCKBOX_STANDARDS = new Set(['EvmHypXERC20Lockbox', 'EvmHypVSXERC20Lockbox']) + +// a lockbox backs every bridge on its xERC20, these are also live on CCIP and already counted by projects/ccip (getLockbox) +const LOCKBOXES_COUNTED_BY_CCIP = new Set([ + '0x6d265c7dd8d76f25155f1a7687c693fdc1220d12', // oUSDT, ethereum + '0x0797c6f55f5c9005996a55959a341018cf69a963', // oXAUT, ethereum ]) const NATIVE_STANDARDS = new Set(['EvmHypNative']) @@ -58,6 +68,7 @@ async function fetchRegistry() { function getTokensAndOwners(registry, chain) { const tokensAndOwners = [] + const lockboxes = [] for (const route of Object.values(registry)) { for (const token of route.tokens || []) { const registryChain = CHAIN_MAP[token.chainName] || token.chainName @@ -65,17 +76,22 @@ function getTokensAndOwners(registry, chain) { if (COLLATERAL_STANDARDS.has(token.standard) && token.collateralAddressOrDenom) { tokensAndOwners.push([token.collateralAddressOrDenom, token.addressOrDenom]) + } else if (LOCKBOX_STANDARDS.has(token.standard) && token.collateralAddressOrDenom) { + if (!LOCKBOXES_COUNTED_BY_CCIP.has(token.collateralAddressOrDenom.toLowerCase())) lockboxes.push(token.collateralAddressOrDenom) } else if (NATIVE_STANDARDS.has(token.standard)) { tokensAndOwners.push([ADDRESSES.null, token.addressOrDenom]) } } } - return tokensAndOwners + return { tokensAndOwners, lockboxes } } async function tvl(api) { const registry = await fetchRegistry() - const tokensAndOwners = getTokensAndOwners(registry, api.chain) + const { tokensAndOwners, lockboxes: allLockboxes } = getTokensAndOwners(registry, api.chain) + const lockboxes = [...new Set(allLockboxes)] + const lockboxTokens = await api.multiCall({ abi: 'address:ERC20', calls: lockboxes }) + lockboxTokens.forEach((token, i) => tokensAndOwners.push([token, lockboxes[i]])) return sumTokens2({ api, tokensAndOwners }) } @@ -91,7 +107,7 @@ const chains = [ const deadChains = ['mint'] module.exports = { - methodology: 'TVL counts the tokens locked in Hyperlane Warp Route collateral contracts, fetched dynamically from the Hyperlane registry.', + methodology: 'TVL counts the tokens locked in Hyperlane Warp Route collateral contracts and xERC20 lockboxes, fetched dynamically from the Hyperlane registry.', } chains.forEach(chain => { From 268674a4fae6b49f63278111f314ee44bdc3e4b9 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 10:58:01 +0400 Subject: [PATCH 779/988] save: drop stale fully utilized bad-debt reserves from borrowed (#22248) Co-authored-by: Claude Opus 5.5 --- projects/solend/index.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/projects/solend/index.js b/projects/solend/index.js index 2f94efc0389..c71db84a1a2 100644 --- a/projects/solend/index.js +++ b/projects/solend/index.js @@ -1,8 +1,10 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2, decodeAccount, getMultipleAccounts, } = require("../helper/solana"); +const { sumTokens2, decodeAccount, getMultipleAccounts, getConnection, } = require("../helper/solana"); const { getConfig } = require('../helper/cache') const solendConfigEndpoint = "https://api.solend.fi/v1/markets/configs?scope=all&deployment=production"; +// ~30 days at 400ms slots +const STALE_SLOTS = 6_500_000 async function borrowed(api) { const markets = (await getConfig('solend', solendConfigEndpoint)) @@ -13,9 +15,17 @@ async function borrowed(api) { reserves.push(reserve.address) const infos = await getMultipleAccounts(reserves) + const slot = await getConnection().getSlot() infos.forEach(i => { - const { info: { liquidity } } = decodeAccount('reserve', i) + const { info: { liquidity, lastUpdate } } = decodeAccount('reserve', i) const amount = liquidity.borrowedAmountWads.toString() / 1e18 + // a fully utilized reserve nobody has touched in a month (every deposit, borrow, repay and liquidation + // refreshes it), or whose borrow index grew 10x, is bad debt compounding at the max borrow rate, not a + // live loan (the ScarCoin pool's USDC debt reads $93M after its borrow index grew 15,000x) + const utilization = amount / (amount + Number(liquidity.availableAmount.toString())) + const stale = slot - lastUpdate.slot.toNumber() > STALE_SLOTS + const runaway = liquidity.cumulativeBorrowRateWads.toString() / 1e18 > 10 + if (utilization > 0.99 && (stale || runaway)) return api.add(liquidity.mintPubkey.toString(), amount) }) } @@ -58,7 +68,7 @@ module.exports = { }, eclipse: { tvl: eclipseTvl }, methodology: - "TVL consists of deposits made to the protocol and like other lending protocols, borrowed tokens are not counted. Coingecko is used to price tokens.", + "TVL consists of deposits made to the protocol and like other lending protocols, borrowed tokens are not counted. Borrowed excludes fully utilized reserves untouched for a month or whose borrow index grew over 10x; their debt is bad debt that only grows with interest. Coingecko is used to price tokens.", hallmarks: [ ['2021-11-03', "SLND launch"], ['2022-11-07', "FTX collapse, SOL whale liquidated"], From ab20b49e5b1bc7fd6ad9b7284d3d1f10051be4c2 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 10:58:25 +0400 Subject: [PATCH 780/988] euler-v2: cap borrowed at the priced collateral behind each vault (#22247) Co-authored-by: Claude Opus 5.5 --- projects/euler-v2/index.js | 39 ++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/projects/euler-v2/index.js b/projects/euler-v2/index.js index 51574bbb4f8..d4edc8ad7a6 100644 --- a/projects/euler-v2/index.js +++ b/projects/euler-v2/index.js @@ -2,7 +2,7 @@ const { sumTokens2 } = require("../helper/unwrapLPs") const sdk = require('@defillama/sdk') module.exports = { - methodology: `TVL is supply balance minus borrows the euler contract. Borrowed excludes vaults whose underlying or whose accepted collateral vaults' underlyings have no price in coins.llama.fi (treated as worthless/insolvent).`, + methodology: `TVL is supply balance minus borrows the euler contract. Borrowed excludes vaults whose underlying has no price in coins.llama.fi, and caps each vault's borrows at the value held in its priced collateral vaults (collateral with no price is treated as worthless/insolvent).`, hallmarks: [ ['2025-11-04', "Stream finance rug"], ], @@ -74,12 +74,35 @@ Object.keys(config).forEach(chain => { const collatAssets = collatVaults.length ? await api.multiCall({ abi: 'address:asset', calls: collatVaults, permitFailure: true }) : [] + const collatTotalAssets = collatVaults.length + ? await api.multiCall({ abi: 'uint256:totalAssets', calls: collatVaults, permitFailure: true }) + : [] const collatVaultToAsset = {} collatVaults.forEach((v, i) => { if (collatAssets[i]) collatVaultToAsset[v.toLowerCase()] = collatAssets[i] }) const priceTargets = [...tokens, ...Object.values(collatVaultToAsset)] const priceByAddr = await fetchPriceMap(api, priceTargets) const chainHasPrices = Object.keys(priceByAddr).length > 0 + const decimalTargets = [...new Set(priceTargets.map(a => a.toLowerCase()))] + const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: decimalTargets, permitFailure: true }) + const decimalsByAddr = {} + decimalTargets.forEach((a, i) => { if (decimals[i] != null) decimalsByAddr[a] = Number(decimals[i]) }) + // usd value, or undefined when the price, decimals or amount could not be read + const toUsd = (token, amount) => { + const price = priceByAddr[token.toLowerCase()] + const dec = decimalsByAddr[token.toLowerCase()] + if (!price || dec === undefined || amount == null) return + return Number(amount) / 10 ** dec * price.price + } + + // usd value deposited in each collateral vault: 0 when its underlying has no price, + // Infinity (no cap) when it is priced but a read failed + const collatUsd = {} + collatVaults.forEach((v, i) => { + const u = collatVaultToAsset[v.toLowerCase()] + const priced = u && priceByAddr[u.toLowerCase()] + collatUsd[v.toLowerCase()] = priced ? (toUsd(u, collatTotalAssets[i]) ?? Infinity) : 0 + }) vaults.forEach((_, i) => { const token = tokens[i] @@ -90,11 +113,15 @@ Object.keys(config).forEach(chain => { if (!priceByAddr[token.toLowerCase()]) return const ltvList = ltvLists[i] || [] if (ltvList.length) { - const anyPriced = ltvList.some(cv => { - const u = collatVaultToAsset[cv.toLowerCase()] - return u && priceByAddr[u.toLowerCase()] - }) - if (!anyPriced) return + // a healthy debt can't exceed the collateral behind it, so anything above the + // priced collateral these vaults hold is backed by unpriced collateral (bad debt) + const pricedCollatUsd = ltvList.reduce((sum, cv) => sum + (collatUsd[cv.toLowerCase()] || 0), 0) + const borrowUsd = toUsd(token, borrow) + if (borrowUsd !== undefined && !pricedCollatUsd) return + if (borrowUsd !== undefined && borrowUsd > pricedCollatUsd) { + api.add(token, BigInt(Math.floor(Number(borrow) * pricedCollatUsd / borrowUsd)).toString()) + return + } } } api.add(token, borrow) From 1d6309e30b393d3a9f5ffd1ae0de2e1b7e8a9abb Mon Sep 17 00:00:00 2001 From: iamsstef <115187950+iamsstef@users.noreply.github.com> Date: Tue, 17 Nov 2026 07:59:03 +0100 Subject: [PATCH 781/988] feat: add CipherTrade DEX COTI TVL adapter (#22251) Co-authored-by: ccipherx --- projects/ciphertrade-dex/index.js | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 projects/ciphertrade-dex/index.js diff --git a/projects/ciphertrade-dex/index.js b/projects/ciphertrade-dex/index.js new file mode 100644 index 00000000000..83629e637cc --- /dev/null +++ b/projects/ciphertrade-dex/index.js @@ -0,0 +1,51 @@ +// CipherTrade DEX on COTI (CipherDEX Protocol, chain 2632500). +const FACTORIES = [ + { address: '0x1909751000de0d15f81394b47eca1931184d51e0', fromBlock: 9437576 }, // Mode 0 + { address: '0x418df4557ffc1d8f568b3583936a6cfaec543a91', fromBlock: 9886358 }, // transparent Mode 3 +] +const PUBLIC_BOOK = '0xff3372d73131d56f4bc7ad2fc8545b0316d0a1ce' +const BOOK_FROM_BLOCK = 9884872 + +const ABIS = { + allPoolsLength: 'uint256:allPoolsLength', + allPools: 'function allPools(uint256) view returns (address)', + initialized: 'bool:initialized', + token0: 'address:token0', + token1: 'address:token1', + reserves: 'function activeReserves() view returns (uint256 reserve0, uint256 reserve1)', + escrow: 'function totalEscrowed(address token) view returns (uint256)', +} + +async function tvl(api) { + const factories = FACTORIES.filter(({ fromBlock }) => !api.block || api.block >= fromBlock) + const discovered = await Promise.all(factories.map(({ address }) => api.fetchList({ + target: address, lengthAbi: ABIS.allPoolsLength, itemAbi: ABIS.allPools, + }))) + const pools = [...new Set(discovered.flat().map(address => address.toLowerCase()))] + if (!pools.length) return + + const [token0s, token1s, initialized, reserves] = await Promise.all([ + api.multiCall({ abi: ABIS.token0, calls: pools }), + api.multiCall({ abi: ABIS.token1, calls: pools }), + api.multiCall({ abi: ABIS.initialized, calls: pools }), + api.multiCall({ abi: ABIS.reserves, calls: pools }), + ]) + + pools.forEach((_, i) => { + if (!initialized[i]) return // Protected reservations are not yet funded liquidity. + api.add(token0s[i], reserves[i][0]) + api.add(token1s[i], reserves[i][1]) + }) + + if (api.block && api.block < BOOK_FROM_BLOCK) return + // Order-book input escrow, read for every token the factories list. + const tokens = [...new Set([...token0s, ...token1s])] + const escrowed = await api.multiCall({ target: PUBLIC_BOOK, abi: ABIS.escrow, calls: tokens }) + api.add(tokens, escrowed) +} + +module.exports = { + methodology: 'Counts on-chain active reserves in initialized public Mode 0 and transparent private Mode 3 pools, and maker deposits still escrowed in the public matching order book. Excludes protocol fees, unbacked/surplus assets, native execution bounties, and confidential Mode 1/2 pools and private order-book balances.', + start: '2026-09-20', + coti: { tvl }, +} From c73e6048d4e4b5d406e255a9cdc5f7ebf28bd489 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 10:59:27 +0400 Subject: [PATCH 782/988] blast bridge: count the BlastExit claim contracts (+$26M) (#22244) Co-authored-by: Claude Opus 5.5 --- registries/sumTokens/covalent.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/registries/sumTokens/covalent.js b/registries/sumTokens/covalent.js index f3103aeff96..c3af60127f7 100644 --- a/registries/sumTokens/covalent.js +++ b/registries/sumTokens/covalent.js @@ -92,7 +92,9 @@ module.exports = { "owners": [ "0xa230285d5683C74935aD14c446e137c8c8828438", "0x98078db053902644191f93988341E31289E1C8FE", - "0x5F6AE08B8AeB7078cf2F96AFb089D7c9f51DA47d" + "0x5F6AE08B8AeB7078cf2F96AFb089D7c9f51DA47d", + "0x9D31771458B421C7EA8A06CB8D12663E91617869", // BlastExit, shutdown merkle claim contract funded by the Blast admin Safe on 2026-10-31 + "0x23eA8c6ACEb5673BBd712137cE2Aa33db36CB513" // BlastExit2, second claim contract funded by the same Safe on 2026-11-03 ], "fetchCoValentTokens": true }, From b41b10d8e9684fe8260f3d5b1b18f858447445bc Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 11:00:00 +0400 Subject: [PATCH 783/988] OP Stack bridges: count ETH held in the ETHLockbox (Optimism, Unichain, Soneium) (#22242) Co-authored-by: Claude Opus 5.5 --- projects/optimism/index.js | 5 ++++- registries/sumTokens/covalent.js | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/projects/optimism/index.js b/projects/optimism/index.js index 0201cd1f8c2..2a42a23757b 100644 --- a/projects/optimism/index.js +++ b/projects/optimism/index.js @@ -31,7 +31,10 @@ Object.keys(chains).map((chain) => { ].filter((o) => o); if (chain == "ethereum") - owners.push("0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"); + owners.push( + "0xbEb5Fc579115071764c7423A4f12eDde41f106Ed", // OptimismPortal + "0x322b47Ff1FA8D5611F761e3E275C45B71b294D43", // ETHLockbox (OP Stack Upgrade 16), OptimismPortal.ethLockbox() + ); return sumTokens2({ api, tokens, diff --git a/registries/sumTokens/covalent.js b/registries/sumTokens/covalent.js index c3af60127f7..b13c340b22d 100644 --- a/registries/sumTokens/covalent.js +++ b/registries/sumTokens/covalent.js @@ -823,7 +823,8 @@ module.exports = { "ethereum": { "owners": [ "0xeb9bf100225c214Efc3E7C651ebbaDcF85177607", - "0x88e529a6ccd302c948689cd5156c83d4614fae92" + "0x88e529a6ccd302c948689cd5156c83d4614fae92", + "0x67B4de6FfA66EF201Ea6099A89cA397D56622E31" // ETHLockbox (OP Stack Upgrade 16), OptimismPortal.ethLockbox() ], "fetchCoValentTokens": true }, @@ -936,7 +937,8 @@ module.exports = { "ethereum": { "owners": [ "0x81014F44b0a345033bB2b3B21C7a1A308B35fEeA", - "0x0bd48f6B86a26D3a217d0Fa6FfE2B491B956A7a2" + "0x0bd48f6B86a26D3a217d0Fa6FfE2B491B956A7a2", + "0x08bA0023eD60C7Bd040716dD13C45fA0062df5C5" // ETHLockbox (OP Stack Upgrade 16), OptimismPortal.ethLockbox() ], "fetchCoValentTokens": true }, From 380090f799336ca1c645a77b74f0aacf5f8eceab Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 11:00:21 +0400 Subject: [PATCH 784/988] polygon-bridge: count the StakeManager stake as staking, not bridge tvl (#22246) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- registries/sumTokens/covalent.js | 42 ++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/registries/sumTokens/covalent.js b/registries/sumTokens/covalent.js index b13c340b22d..b8b1616e70f 100644 --- a/registries/sumTokens/covalent.js +++ b/registries/sumTokens/covalent.js @@ -700,23 +700,35 @@ module.exports = { }, }, "polygon": { + "methodology": "Counts assets escrowed on Ethereum for Polygon PoS: ERC-20s in the ERC20Predicate, ETH in the EtherPredicate and POL/MATIC in the plasma DepositManager. POL staked by validators and delegators in the StakeManager is reported under staking.", "start": "2020-05-30", "ethereum": { - owners: [ - '0x40ec5B33f54e0E8A33A975908C5BA1c14e5BbbDf', - '0x8484Ef722627bf18ca5Ae6BcF031c23E6e922B30', - '0x401F6c983eA34274ec46f84D70b31C151321188b', - '0x5e3Ef299fDDf15eAa0432E6e66473ace8c13D908', - ], - tokens: [ - ADDRESSES.null, - ADDRESSES.ethereum.MATIC, - ], - "blacklistedTokens": [ - "0x99fe3b1391503a1bc1788051347a1324bff41452" - ], - fetchCoValentTokens: true, - permitFailure: true, + tvl: { + owners: [ + '0x40ec5B33f54e0E8A33A975908C5BA1c14e5BbbDf', + '0x8484Ef722627bf18ca5Ae6BcF031c23E6e922B30', + '0x401F6c983eA34274ec46f84D70b31C151321188b', + ], + tokens: [ + ADDRESSES.null, + ADDRESSES.ethereum.MATIC, + ADDRESSES.ethereum.POL, + ], + "blacklistedTokens": [ + "0x99fe3b1391503a1bc1788051347a1324bff41452" + ], + fetchCoValentTokens: true, + permitFailure: true, + }, + // StakeManager: validator and delegator stake, not bridge escrow + staking: { + owner: '0x5e3Ef299fDDf15eAa0432E6e66473ace8c13D908', + tokens: [ + ADDRESSES.ethereum.MATIC, + ADDRESSES.ethereum.POL, + ], + permitFailure: true, + }, }, }, "polygonZk": { From 89f2a96a43254ff32c40b5529fc8e13e2d077e4a Mon Sep 17 00:00:00 2001 From: Satyam-10124 Date: Tue, 17 Nov 2026 12:32:04 +0530 Subject: [PATCH 785/988] fix(vara-grow-streams): update website URL to growstreams.xyz, X to GrowwStreams, and include V3/desk custody (#22245) Co-authored-by: ccipherx --- projects/vara-grow-streams/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/vara-grow-streams/index.js b/projects/vara-grow-streams/index.js index 73e31ecfdda..d294ef8bc0f 100644 --- a/projects/vara-grow-streams/index.js +++ b/projects/vara-grow-streams/index.js @@ -9,6 +9,8 @@ const TOKEN_VAULT_V2 = '0x20099b7637ae936670f54464c4109d1f028fbb63230e151ea4ef29 const TOKEN_VAULT_V3 = '0x657cf9c4f929aeac97092037826c1117f9e6cd0e3c4edc44e49decc17b840aa9' const WVARA = '0xf5e9cb1d1e46b0cda6578dd1684b30f281a45dfaa390e4945b7bfc8ab3e27f3d' const GVARA = '0x04314af41b7dbac322e3e66920211d2f799719e1cdc3122a99752f72b6ae84ee' +// same program code as GVARA +const GVARA_V3 = '0x086c7257f39302f9346ed8b7d2839ef1c728fc04997b6056581c0b3f396710ee' // twox128("System") ++ twox128("Account") const SYSTEM_ACCOUNT_PREFIX = '26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9' @@ -56,13 +58,13 @@ async function getSpendableNative(addresses, at) { async function tvl(api) { const at = await rpc('chain_getFinalizedHead', []) - const balances = await getSpendableNative([TOKEN_VAULT_V2, TOKEN_VAULT_V3, WVARA, GVARA], at) + const balances = await getSpendableNative([TOKEN_VAULT_V2, TOKEN_VAULT_V3, WVARA, GVARA, GVARA_V3], at) const total = balances.reduce((acc, b) => acc + b, 0n) api.addCGToken('vara-network', Number(total) / VARA_DECIMALS) } module.exports = { - methodology: 'GrowStreams deploys and owns the V2 and V3 token vaults and its wVARA and gVARA wrapper programs. TVL is the combined spendable native VARA held by all four: the vault balances plus the native VARA backing wVARA and gVARA tokens.', + methodology: 'GrowStreams deploys and owns the V2 and V3 token vaults, its wVARA wrapper and two gVARA wrapper deployments. TVL is the combined spendable native VARA held by these five programs: the vault balances plus the native VARA backing wVARA and gVARA tokens.', vara: { tvl }, } From e77412cfdc8c3a749b2a3b5af34988eac9e503db Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 11:02:45 +0400 Subject: [PATCH 786/988] mantle bridge: count ETH and MNT held in the OptimismPortal (+$379M) (#22243) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- registries/sumTokens/covalent.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/registries/sumTokens/covalent.js b/registries/sumTokens/covalent.js index b8b1616e70f..87223150160 100644 --- a/registries/sumTokens/covalent.js +++ b/registries/sumTokens/covalent.js @@ -521,11 +521,27 @@ module.exports = { }, }, "mantle": { + "methodology": "Counts assets escrowed on Ethereum for Mantle's canonical bridge: ETH and MNT in the OptimismPortal and ERC-20s in the L1StandardBridge. MNT is Mantle's own token and is counted under staking.", "ethereum": { - "owners": [ - "0x95fC37A27a2f68e3A647CDc081F0A89bb47c3012" - ], - "fetchCoValentTokens": true + "tvl": { + "owners": [ + "0x95fC37A27a2f68e3A647CDc081F0A89bb47c3012", + "0xc54cb22944F2bE476E02dECfCD7e3E7d3e15A8Fb" // OptimismPortal, holds bridged ETH and MNT since the Tectonic upgrade (2024-03-15) + ], + "blacklistedTokens": [ + "0x3c3a81e81dc49A522A592e7622A7E711c06bf354" // MNT + ], + "fetchCoValentTokens": true + }, + "staking": { + "owners": [ + "0x95fC37A27a2f68e3A647CDc081F0A89bb47c3012", + "0xc54cb22944F2bE476E02dECfCD7e3E7d3e15A8Fb" + ], + "tokens": [ + "0x3c3a81e81dc49A522A592e7622A7E711c06bf354" + ] + } }, }, "megaeth-bridge": { From bdaaca65b9015a303fd5277aad5a667cf841e177 Mon Sep 17 00:00:00 2001 From: tumilet <93296848+tumilet@users.noreply.github.com> Date: Tue, 17 Nov 2026 15:03:47 +0800 Subject: [PATCH 787/988] ethena-pay: add TVL adapter (card accounts on Avalanche) (#22249) --- projects/ethena-pay/index.js | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 projects/ethena-pay/index.js diff --git a/projects/ethena-pay/index.js b/projects/ethena-pay/index.js new file mode 100644 index 00000000000..0b97fc4c8a9 --- /dev/null +++ b/projects/ethena-pay/index.js @@ -0,0 +1,53 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { getAddress, getLogs2 } = require('../helper/cache/getLogs'); + +// Ethena Pay (https://pay.ethena.fi) gives each card user an account on Avalanche C-Chain: a beacon proxy +// (beacon 0xc831ea25deb7654679a438c78c4c5d1c313c8448, owned by the registry). The registry creates them; both of its +// creation events carry the new account in topics[2]. +const REGISTRY = '0xAc66ca9A79fb0D3C64cBa44cd29610CD58602D6f'; +const ACCOUNT_CREATED_TOPICS = [ + '0x26894cd0aa4e77862bb98a9a46a9ff691846b052f0695e107d3cab1788865184', + '0x4c35b713f0d2330199e6e15fa5381c737a9c83f5bc0c9eeb4804a2d71d585d3c', +]; +const FROM_BLOCK = 87687233; // the registry's first creation event, 2026-06-10 + +const USDE = ADDRESSES.avax.USDe; +// Ethena Pay Earn: an Upshift vault that takes USDe and mints pUSDe to the account; shares waiting to be redeemed sit +// in the vault. getSharePrice() gives USDe per pUSDe (18 decimals). +const PUSDE = '0xcb5c7b865da0867769c1263dc80088d93fd3fb79'; +const EARN_VAULT = '0x6aab14c53980b9aa1ce632a7e46a6e5e62e60f55'; +// the vault and pUSDe were deployed together in tx 0xc951045d... at block 93,588,064 (2026-08-24); before it there is no pUSDe +const EARN_START_BLOCK = 93588064; + +async function getAccounts(api) { + const accounts = []; + for (const topic of ACCOUNT_CREATED_TOPICS) { + const logs = await getLogs2({ api, target: REGISTRY, topics: [topic], fromBlock: FROM_BLOCK, extraKey: `ethena-pay-${topic.slice(0, 10)}` }); + logs.forEach(log => accounts.push(getAddress(log.topics[2]))); + } + return [...new Set(accounts)]; +} + +async function tvl(api) { + const accounts = await getAccounts(api); + // what the accounts hold: USDe for card spending, plus AVAX (cashback), USDC and USDT + await api.sumTokens({ owners: accounts, tokens: [USDE, ADDRESSES.null, ADDRESSES.avax.USDC, ADDRESSES.avax.USDt] }); + // pUSDe held by the accounts or queued in the vault, valued in USDe at the vault's share price: together that is the + // whole Earn vault. The vault's own USDe is part of what backs pUSDe, so it is not added again. Queued pUSDe is valued at + // today's share price too, on purpose: it stays in the vault's assets until it is redeemed. + const block = await api.getBlock(); + if (block < EARN_START_BLOCK) return; + const [balances, sharePrice] = await Promise.all([ + api.multiCall({ abi: 'erc20:balanceOf', target: PUSDE, calls: [...accounts, EARN_VAULT] }), + api.call({ abi: 'uint256:getSharePrice', target: EARN_VAULT }), + ]); + const shares = balances.reduce((sum, b) => sum + BigInt(b), 0n); + api.add(USDE, (shares * BigInt(sharePrice) / 10n ** 18n).toString()); +} + +module.exports = { + // USDe is Ethena's own token, already in Ethena's TVL; the Earn vault is already counted by Upshift's listing + doublecounted: true, + methodology: "Tokens held by Ethena Pay accounts (created by the Ethena Pay registry on Avalanche): USDe, AVAX, USDC and USDT, plus pUSDe (Ethena Pay Earn) held by those accounts or queued in the Earn vault, valued in USDe at the vault's share price. Marked double counted: USDe is in Ethena's TVL and the Earn vault in Upshift's.", + avax: { tvl }, +}; From 3d095f52b33c5f1c0032061b0fece93ca130f2e3 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 11:04:13 +0400 Subject: [PATCH 788/988] inverse: stop counting staked INV in firm and frontier tvl (#22240) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/inverse-finance-firm/index.js | 3 ++- projects/inverse/index.js | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/projects/inverse-finance-firm/index.js b/projects/inverse-finance-firm/index.js index b462256614d..30ae7af70dd 100644 --- a/projects/inverse-finance-firm/index.js +++ b/projects/inverse-finance-firm/index.js @@ -154,10 +154,11 @@ async function tvl(api) { api.removeTokenBalance('0x865377367054516e17014ccded1e7d814edc9ce4') // remove DOLA - ownToken api.removeTokenBalance('0xb45ad160634c528Cc3D2926d9807104FA3157305') // remove sDOLA - ownToken + api.removeTokenBalance('0x41D5D79431A913C4aE7d69a668ecdfE5fF9DFB68') // remove INV - ownToken, the INV market escrows stake it in xINV, counted as staking } module.exports = { - methodology: "Get collateral balances from users personal escrows", + methodology: "Counts collateral held in users' personal escrows, unwrapping yvCurve vaults and Curve LP tokens. DOLA and sDOLA are excluded as Inverse's own stablecoin. INV collateral is staked into xINV by its escrows and is reported under staking as the INV held by xINV.", hallmarks: [ ['2024-02-06', "Launch of sDOLA"], ['2024-06-13', "CRV liquidation"] diff --git a/projects/inverse/index.js b/projects/inverse/index.js index 4f1ed55b5fe..4b373873faf 100644 --- a/projects/inverse/index.js +++ b/projects/inverse/index.js @@ -13,6 +13,8 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); // Anchor const anchorStart = 11915867; const comptroller = "0x4dcf7407ae5c07f8681e1659f626e114a7667339"; +// INV staked in the xINV market is counted as staking in inverse-finance-firm +const inv = "0x41D5D79431A913C4aE7d69a668ecdfE5fF9DFB68"; // Stabilizer const stabilizer = "0x7eC0D931AFFBa01b77711C2cD07c76B970795CDd"; @@ -41,7 +43,7 @@ async function stabilizerTVL(api) { } async function tvl(api) { - const compTvl = compoundExports2({ comptroller, cether: ['0x697b4acaa24430f254224eb794d2a85ba1fa1fb8', '0x8e103eb7a0d01ab2b2d29c91934a9ad17eb54b86'], blacklistedTokens: ['0x865377367054516e17014ccded1e7d814edc9ce4']}).tvl + const compTvl = compoundExports2({ comptroller, cether: ['0x697b4acaa24430f254224eb794d2a85ba1fa1fb8', '0x8e103eb7a0d01ab2b2d29c91934a9ad17eb54b86'], blacklistedTokens: ['0x865377367054516e17014ccded1e7d814edc9ce4', inv]}).tvl await Promise.all([ compTvl(api), @@ -52,7 +54,7 @@ async function tvl(api) { } module.exports = { - methodology: "DOLA curve metapool replaced by DOLA", + methodology: "Counts the underlying cash in the Frontier (Anchor) markets, the DAI in the stabilizer and the underlying of the legacy vaults. DOLA and INV are excluded, INV in the xINV market is reported as staking under Inverse Finance FiRM.", hallmarks: [ // ['2022-04-01', "INV price hack"], ['2022-06-16', "Inverse Frontier Deprecated"] From d08f60cf4b3f00eb44c03725fd4130c4634717fe Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 11:23:23 +0400 Subject: [PATCH 789/988] gnosis-dao treasury: track ethereum Safe 0x458c (#22239) Co-authored-by: Claude Opus 5.5 --- projects/treasury/gnosis-dao.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/treasury/gnosis-dao.js b/projects/treasury/gnosis-dao.js index 0e74bedb2dc..4fe37731e70 100644 --- a/projects/treasury/gnosis-dao.js +++ b/projects/treasury/gnosis-dao.js @@ -78,7 +78,7 @@ module.exports = treasuryExports({ "0x9c39809dec7f95f5e0713634a4d0701329b3b4d2", // debt variableDebtWBTC "0xa13a9247ea42d743238089903570127dda72fe44", ], - owners: [treasury, treasury1, treasury2, treasury3, treasury4,], + owners: [treasury, treasury1, treasury2, treasury3, treasury4, treasurygnosis,], // GNO/SAFE/COW/HOPR moved here 2026-07-21 ownTokens: [GNO], resolveUniV3: true, }, From b2c6ad7ae846c9650087799d1f6e434eef585dc1 Mon Sep 17 00:00:00 2001 From: Masha-lla Date: Tue, 17 Nov 2026 08:24:12 +0100 Subject: [PATCH 790/988] Fix double counting of mstETH in Rumpel TVL (#22237) Co-authored-by: Masha --- projects/rumpel/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/rumpel/index.js b/projects/rumpel/index.js index 2c3ae93e12d..7ae51b2de35 100644 --- a/projects/rumpel/index.js +++ b/projects/rumpel/index.js @@ -318,7 +318,6 @@ async function tvl(api) { tokens = [ TOKENS.KWEETH, TOKENS.KUSDE, - TOKENS.MSTETH, TOKENS.RSUSDE, TOKENS.RSTETH, TOKENS.RE7LRT, From 70a3943c63f10e3dd093291770c92136e6e809b9 Mon Sep 17 00:00:00 2001 From: Masha-lla Date: Tue, 17 Nov 2026 08:41:51 +0100 Subject: [PATCH 791/988] Fix Compound V3 historical snapshots with newer markets (#22238) Co-authored-by: Masha Co-authored-by: ccipherx --- projects/helper/compoundV3.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/projects/helper/compoundV3.js b/projects/helper/compoundV3.js index 8c7f2aad872..f4a38f1b14c 100644 --- a/projects/helper/compoundV3.js +++ b/projects/helper/compoundV3.js @@ -15,24 +15,28 @@ module.exports = { }; Object.keys(config).forEach(chain => { - async function resolveMarkets() { + async function resolveMarkets(api) { const set = new Set((config[chain].markets ?? []).map(m => m.toLowerCase())) if (getMarkets) { const dynamic = await getMarkets() ;(dynamic?.[chain] ?? []).forEach(m => set.add(m.toLowerCase())) } - return [...set] + const markets = [...set] + const block = await api.getBlock() + // baseToken() returns empty data from a market deployed after the requested block + const res = await Promise.all(markets.map(to => api.provider.call({ to, data: '0xc55dae63', blockTag: block }))) + return markets.filter((_, i) => res[i] !== '0x') } async function borrowed(api) { - const markets = await resolveMarkets() + const markets = await resolveMarkets(api) const tokens = await api.multiCall({ abi: 'address:baseToken', calls: markets }) const bals = await api.multiCall({ abi: 'uint256:totalBorrow', calls: markets }) api.add(tokens, bals) } async function tvl(api) { - const markets = await resolveMarkets() + const markets = await resolveMarkets(api) const toa = [] for (const m of markets) { const items = await api.fetchList({ lengthAbi: abi.numAssets, itemAbi: abi.getAssetInfo, target: m }) From 91d26b2295fda444d8b651779f31a1d02f4c8f1e Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 11:43:34 +0400 Subject: [PATCH 792/988] treasury: count sAERO stakes after the Aero migration (#22236) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/helper/treasury.js | 5 ++++- projects/helper/unwrapLPs.js | 4 +++- projects/treasury/reserve.js | 8 +++++++- registries/treasury.js | 9 ++++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/projects/helper/treasury.js b/projects/helper/treasury.js index 85a11e46f6f..cb5db6fbf1c 100644 --- a/projects/helper/treasury.js +++ b/projects/helper/treasury.js @@ -57,13 +57,16 @@ function treasuryExports(config) { if (ownTokens.length > 0) { // token auto-discovery must not run here: this bucket is meant to hold ownTokens // only, and anything it finds is already counted in the tvl bucket above - const { solOwners, fetchCoValentTokens, tokenConfig, ...other } = config[chain]; + const { solOwners, fetchCoValentTokens, tokenConfig, solidlyVeNfts = [], ...other } = config[chain]; + // veNft locks are added as their base token whatever `tokens` says, so keep only those locking an own token + const ownTokenSet = new Set(ownTokens.map(i => i.toLowerCase())) const opts = { ...other, owners: [...owners, ...ownTokenOwners], tokens: ownTokens, chain, uniV3WhitelistedTokens: ownTokens, + solidlyVeNfts: solidlyVeNfts.filter(i => ownTokenSet.has(i.baseToken.toLowerCase())), }; exportObj[chain].ownTokens = sumTokensExport(opts); } diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 5f4dc34d6a9..abfe929fa86 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -1383,7 +1383,9 @@ function addUniV3LikePosition({ api, token0, token1, liquidity, tickLower, tickU api.add(token1, amount1) } -async function unwrapSolidlyVeNft({ api, baseToken, veNft, owner, hasTokensOfOwnerAbi = false, isAltAbi = false, lockedAbi, nftIdGetterAbi }) { +async function unwrapSolidlyVeNft({ api, baseToken, veNft, owner, hasTokensOfOwnerAbi = false, isAltAbi = false, lockedAbi, nftIdGetterAbi, fromBlock }) { + // skip blocks before the veNft was deployed + if (fromBlock && (await api.getBlock()) < fromBlock) return let tokenIds const _lockedAbi = lockedAbi || (hasTokensOfOwnerAbi || isAltAbi ? SOLIDLY_VE_NFT_ABI.lockedSimple : SOLIDLY_VE_NFT_ABI.locked) const _nftIdGetterAbi = nftIdGetterAbi || (isAltAbi ? SOLIDLY_VE_NFT_ABI.tokenOfOwnerByIndex : SOLIDLY_VE_NFT_ABI.ownerToNFTokenIdList) diff --git a/projects/treasury/reserve.js b/projects/treasury/reserve.js index 9adf896fdfe..7eb70e39e18 100644 --- a/projects/treasury/reserve.js +++ b/projects/treasury/reserve.js @@ -7,6 +7,9 @@ const reserveTreasury = "0xC6625129C9df3314a4dd604845488f4bA62F9dB8"; const reserveBaseTreasury = "0x6f1D6b86d4ad705385e751e6e88b0FdFDBAdf298"; const AERO = ADDRESSES.base.AERO; const aeroVotingEscrow = "0xebf418fe2512e7e6bd9b87a8f0f294acdc67e6b4"; +// Since the 2026-10-22 Aerodrome -> Aero migration, veAERO locks live on as sAERO stakes on the Aero VotingEscrow +const AERO_V2 = "0x3f5bF3EdAc59d650D8fDf9657a71F2f904A3a4Ee"; +const sAeroVotingEscrow = "0xBF7977E1521e9a3032bf7243Ee4712f311f13915"; module.exports = mergeExports([treasuryExports({ ethereum: { @@ -16,6 +19,9 @@ module.exports = mergeExports([treasuryExports({ }, }), { base: { - tvl: (api) => unwrapSolidlyVeNft({ api, baseToken: AERO, veNft: aeroVotingEscrow, owner: reserveBaseTreasury }), + tvl: async (api) => { + await unwrapSolidlyVeNft({ api, baseToken: AERO, veNft: aeroVotingEscrow, owner: reserveBaseTreasury }) + await unwrapSolidlyVeNft({ api, baseToken: AERO_V2, veNft: sAeroVotingEscrow, owner: reserveBaseTreasury, isAltAbi: true, lockedAbi: 'function staked(uint256) view returns (uint128 amount, uint48 end, bool isPermanent)', fromBlock: 52688150 }) + }, }, }]) diff --git a/registries/treasury.js b/registries/treasury.js index 9fb5c41126d..e5f38421135 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -15,6 +15,11 @@ const bitcoinAddressBook = require('../projects/helper/bitcoin-book/index.js') // Adapters using ohmStaking/ohmTreasury, sumChainTvls, mergeExports, isComplex // with extra custom code, or any logic beyond a single treasuryExports() call // stay as individual files in projects/treasury/. + +// Since the 2026-10-22 Aerodrome -> Aero migration, veAERO (and OP veVELO) locks live on as sAERO stakes +// on the Aero VotingEscrow on Base, owned by the treasury's Base address +const sAERO = { isAltAbi: true, baseToken: '0x3f5bF3EdAc59d650D8fDf9657a71F2f904A3a4Ee', veNft: '0xBF7977E1521e9a3032bf7243Ee4712f311f13915', lockedAbi: 'function staked(uint256) view returns (uint128 amount, uint48 end, bool isPermanent)', fromBlock: 52688150 } + const gmxOwners = [ '0x4bd1cdaab4254fc43ef6424653ca2375b4c94c0e', '0xc6378ddf536410c14666dc59bc92b5ebc0f2f79e', @@ -2986,7 +2991,8 @@ const configs = { ADDRESSES.base.AERO, // AERO ], solidlyVeNfts: [ - { baseToken: ADDRESSES.base.AERO, veNft: "0xeBf418Fe2512e7E6bd9b87a8F0f294aCDC67e6B4" },// veVelo + { baseToken: ADDRESSES.base.AERO, veNft: "0xeBf418Fe2512e7E6bd9b87a8F0f294aCDC67e6B4" },// veAERO + sAERO, ], owners: ['0x586CF50c2874f3e3997660c0FD0996B090FB9764'], ownTokens: [], @@ -3344,6 +3350,7 @@ const configs = { ], solidlyVeNfts: [ { baseToken: ADDRESSES.base.AERO, veNft: '0xebf418fe2512e7e6bd9b87a8f0f294acdc67e6b4' }, + sAERO, ], owners: ['0xa79cd47655156b299762dfe92a67980805ce5a31'], ownTokens: ['0xdcefd8c8fcc492630b943abcab3429f12ea9fea2'], From d05afffdc550b015cfd1b410301a39f3fc63dd52 Mon Sep 17 00:00:00 2001 From: Dani Date: Tue, 17 Nov 2026 09:12:24 +0100 Subject: [PATCH 793/988] loopscale: value collateral on-chain, drop the decompile_mints service (#22255) --- projects/loopscale/index.js | 119 ++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 67 deletions(-) diff --git a/projects/loopscale/index.js b/projects/loopscale/index.js index 47c45903d29..d733e0869ab 100644 --- a/projects/loopscale/index.js +++ b/projects/loopscale/index.js @@ -1,6 +1,7 @@ const { PublicKey } = require('@solana/web3.js') const { Program, AnchorProvider, BN } = require("@coral-xyz/anchor"); -const { getConnection, } = require('../helper/solana'); +const { getConnection, getMultipleAccounts } = require('../helper/solana') +const { addUniV3LikePosition } = require('../helper/unwrapLPs') const loopscaleIdl = { "address": "1oopBoJG58DgkUVKkEzKgyG9dvRmpgeEm1AVjoHkF78", "metadata": {"name": "loopscale", "version": "0.1.0", "spec": "0.1.0", "description": "Created with Anchor"}, @@ -178,28 +179,54 @@ const loopscaleIdl = { ] } -const endpoint = 'https://loopscale-pricing-adapters-109615290061.europe-west2.run.app/v1/decompile_mints' +const WHIRLPOOL_PROGRAM = new PublicKey('whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc') +const WHIRLPOOL_POSITION_SIZE = 216 +const WHIRLPOOL_SIZE = 653 -function parseBigIntStringMap(input) { - const out = Object.create(null); - - for (const [k, v] of Object.entries(input)) { - const s = v.trim(); - - out[k] = BigInt(s); - } - - return out; +function whirlpoolAccountData(account, size, key) { + if (account.data.length !== size) throw new Error(`loopscale: whirlpool account ${key} is ${account.data.length} bytes, expected ${size}`) + return account.data } -function stringifyBigIntMap(input) { - const out = Object.create(null); +// Orca position NFTs posted as collateral are valued from their liquidity at the pool's current tick +async function addWhirlpoolPositions(api, balances) { + const nftMints = Object.keys(balances).filter(mint => balances[mint] === 1n) + const positionKeys = nftMints.map(mint => PublicKey.findProgramAddressSync([Buffer.from('position'), new PublicKey(mint).toBuffer()], WHIRLPOOL_PROGRAM)[0]) + const positionAccounts = await getMultipleAccounts(positionKeys) + if (positionAccounts.length !== nftMints.length) throw new Error('loopscale: position account count mismatch') + + const positions = [] + positionAccounts.forEach((account, i) => { + if (!account || !account.owner.equals(WHIRLPOOL_PROGRAM)) return + const data = whirlpoolAccountData(account, WHIRLPOOL_POSITION_SIZE, positionKeys[i].toString()) + if (new PublicKey(data.subarray(40, 72)).toString() !== nftMints[i]) throw new Error(`loopscale: position ${positionKeys[i]} does not belong to mint ${nftMints[i]}`) + positions.push({ + mint: nftMints[i], + whirlpool: new PublicKey(data.subarray(8, 40)).toString(), + liquidity: data.readBigUInt64LE(72) + (data.readBigUInt64LE(80) << 64n), + tickLower: data.readInt32LE(88), + tickUpper: data.readInt32LE(92), + }) + }) + + const whirlpoolKeys = [...new Set(positions.map(p => p.whirlpool))] + const whirlpoolAccounts = await getMultipleAccounts(whirlpoolKeys) + const whirlpools = {} + whirlpoolAccounts.forEach((account, i) => { + if (!account || !account.owner.equals(WHIRLPOOL_PROGRAM)) throw new Error(`loopscale: whirlpool ${whirlpoolKeys[i]} not found`) + const data = whirlpoolAccountData(account, WHIRLPOOL_SIZE, whirlpoolKeys[i]) + whirlpools[whirlpoolKeys[i]] = { + tick: data.readInt32LE(81), + tokenA: new PublicKey(data.subarray(101, 133)).toString(), + tokenB: new PublicKey(data.subarray(181, 213)).toString(), + } + }) - for (const [k, v] of Object.entries(input)) { - out[k] = v.toString(10); + for (const p of positions) { + const w = whirlpools[p.whirlpool] + addUniV3LikePosition({ api, token0: w.tokenA, token1: w.tokenB, liquidity: Number(p.liquidity), tickLower: p.tickLower, tickUpper: p.tickUpper, tick: w.tick }) } - - return out; + return positions.map(p => p.mint) } const creditbookProgram = (connection) => { @@ -295,7 +322,7 @@ async function getDeposits(connection) { const strats = await getStrategies(connection); const idleCapitalBalances = getIdleCapital(strats); - let rawDeposits = {}; + const rawDeposits = {}; for (const obj of [collateralBalances, idleCapitalBalances]) { for (const [key, value] of Object.entries(obj)) { @@ -303,56 +330,14 @@ async function getDeposits(connection) { } } - rawDeposits = stringifyBigIntMap(Object.fromEntries( - Object.entries(rawDeposits).filter(([key, value]) => value !== 0n) - )); - - return decompileMints(rawDeposits); -} - -// the endpoint fails the whole request if a single mint can't be decompiled, so the mints it -// names in the error are dropped from the request and reported as-is (raw mint, undecompiled) -async function decompileMints(rawBalances) { - const pending = { ...rawBalances }; - const passthrough = {}; - - for (let attempt = 0; attempt < 5; attempt++) { - const response = await fetch(endpoint, { - method: "POST", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify({ - rawBalances: pending - }) - }); - const data = await response.json(); - - if (response.ok && !data.error) { - const parsed = parseBigIntStringMap(data); - for (const [mint, balance] of Object.entries(passthrough)) - parsed[mint] = (parsed[mint] || 0n) + BigInt(balance); - return parsed; - } - - const failedMints = [...String(data.error).matchAll(/ratio\(([1-9A-HJ-NP-Za-km-z]+)\)/g)] - .map(m => m[1]).filter(mint => mint in pending); - if (!failedMints.length) throw new Error(`loopscale decompile_mints failed: ${data.error}`); - - for (const mint of failedMints) { - passthrough[mint] = pending[mint]; - delete pending[mint]; - } - } - - throw new Error('loopscale decompile_mints: still failing after dropping unpriceable mints'); + return rawDeposits; } async function tvl(api) { - const connection = getConnection(); - const balances = await getDeposits(connection); - const data = Object.entries(balances).map(([mint, balance]) => ({ mint, balance })); - api.addTokens(data.map(d => d.mint), data.map(d => d.balance)); + const balances = await getDeposits(getConnection()) + for (const mint of await addWhirlpoolPositions(api, balances)) delete balances[mint] + const mints = Object.keys(balances).filter(mint => balances[mint] !== 0n) + api.addTokens(mints, mints.map(mint => balances[mint])) } async function borrowed(api) { @@ -367,6 +352,6 @@ module.exports = { doublecounted: false, timetravel: false, methodology: - 'TVL is calculated by summing up lending deposits and supplied collateral.', + 'TVL sums idle lender capital in strategies and collateral supplied to loans, read on-chain. Orca position NFTs are valued from their pool liquidity. Collateral with no on-chain value, such as DAWN private-credit deal NFTs, is not counted.', solana: { tvl, borrowed, }, } From ecbccb1a7456ee05053e3333ae72434fae77310a Mon Sep 17 00:00:00 2001 From: Dani Date: Tue, 17 Nov 2026 09:20:19 +0100 Subject: [PATCH 794/988] danogo: read contract utxos from koios, kupo.danogo.io is down (#22258) --- projects/danogo/index.js | 65 +++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/projects/danogo/index.js b/projects/danogo/index.js index 28d4b71055b..722fe5e7693 100644 --- a/projects/danogo/index.js +++ b/projects/danogo/index.js @@ -1,8 +1,10 @@ -const { PromisePool } = require('@supercharge/promise-pool'); -const { get } = require('../helper/http'); +const { get, post } = require('../helper/http'); const DANOGO_GATEWAY_ENDPOINT = 'https://danogo-gateway.api.danogo.io/api/v1' -const KUPO_ENDPOINT = 'https://kupo.danogo.io/matches' +const KOIOS_CREDENTIAL_UTXOS = 'https://api.koios.rest/api/v1/credential_utxos' +// koios serves at most 1000 rows per response +const KOIOS_PAGE_ROWS = 1000; +const KOIOS_MAX_PAGES = 20; const DECODED_PREFIX_LENGTH = 2; const PAYMENT_CREDENTIAL_LENGTH = 56; const REQUEST_TIMEOUT = 30000; @@ -85,16 +87,22 @@ const bech32AddressToPaymentCredential = (address) => { }; const fetchSmartContractAddresses = async () => { - const { data: { addresses } } = await getWithRetry(`${DANOGO_GATEWAY_ENDPOINT}/smartcontract-addresses`); + const { data: { addresses } } = await withRetry(() => get(`${DANOGO_GATEWAY_ENDPOINT}/smartcontract-addresses`, { timeout: REQUEST_TIMEOUT })); // the enterprise and base forms of one script share a payment credential, dedupe so utxos are counted once - return [...new Set(addresses.map(bech32AddressToPaymentCredential))]; + const paymentCredentials = [...new Set(addresses.map(bech32AddressToPaymentCredential))]; + // an empty list would store a zero tvl + if (!paymentCredentials.length) throw new Error('danogo gateway returned no smart contract addresses'); + paymentCredentials.forEach((credential) => { + if (!/^[0-9a-f]+$/.test(credential) || credential.length !== PAYMENT_CREDENTIAL_LENGTH) throw new Error(`invalid payment credential ${credential}`); + }); + return paymentCredentials; } -// kupo drops tls handshakes now and then, a dropped read would zero out the whole adapter -const getWithRetry = async (url, attempts = 4) => { +// a single dropped read fails the whole run, so transient errors get retried +const withRetry = async (request, attempts = 4) => { for (let i = 1; ; i++) { try { - return await get(url, { timeout: REQUEST_TIMEOUT }); + return await request(); } catch (e) { if (i >= attempts) throw e; await new Promise((resolve) => setTimeout(resolve, 400 * i)); @@ -102,28 +110,37 @@ const getWithRetry = async (url, attempts = 4) => { } } -const fetchSmartContractUTXOs = async (paymentCredential) => { - return getWithRetry(`${KUPO_ENDPOINT}/${paymentCredential}/*?unspent`); +// koios matches the payment credential, so utxos at every stake-key variant of a script are included +const fetchSmartContractUTXOs = async (paymentCredentials) => { + const utxos = new Map(); + let offset = 0; + for (let page = 0; page < KOIOS_MAX_PAGES; page++) { + const url = `${KOIOS_CREDENTIAL_UTXOS}?select=tx_hash,tx_index,value,asset_list,is_spent&order=tx_hash.asc,tx_index.asc&offset=${offset}&limit=${KOIOS_PAGE_ROWS}`; + const rows = await withRetry(() => post(url, { _payment_credentials: paymentCredentials, _extended: true }, { timeout: REQUEST_TIMEOUT })); + if (!Array.isArray(rows) || rows.length > KOIOS_PAGE_ROWS) throw new Error('unexpected koios credential_utxos page'); + // stop on an empty page, not a short one, so a lower server row cap cannot truncate the set + if (!rows.length) return [...utxos.values()]; + rows.forEach((utxo) => { + if (utxo.is_spent) throw new Error(`koios returned spent utxo ${utxo.tx_hash}#${utxo.tx_index}`); + // keyed by outpoint, so a utxo shifted across a page boundary is counted once + utxos.set(`${utxo.tx_hash}#${utxo.tx_index}`, utxo); + }); + offset += rows.length; + } + throw new Error(`danogo utxos exceed ${KOIOS_MAX_PAGES} koios pages`); } async function tvl(api) { const paymentCredentials = await fetchSmartContractAddresses(); + const utxos = await fetchSmartContractUTXOs(paymentCredentials); - // kupo drops parallel connections, so the utxo reads have to stay sequential - const { results, errors } = await PromisePool - .withConcurrency(1) - .for(paymentCredentials) - .process(fetchSmartContractUTXOs); - - if (errors.length) throw errors[0]; - - results.flat().forEach((utxo) => { - api.add('lovelace', utxo.value.coins); + utxos.forEach((utxo) => { + api.add('lovelace', utxo.value); - Object.entries(utxo.value.assets ?? {}).forEach(([asset, quantity]) => { + (utxo.asset_list ?? []).forEach(({ policy_id, asset_name, quantity }) => { if (+quantity < MIN_ASSET_QUANTITY) return; - // kupo returns `policyId.assetNameHex`, defillama prices the concatenated unit - const unit = asset.replace('.', ''); + // defillama prices the concatenated `policyId + assetNameHex` unit + const unit = policy_id + (asset_name ?? ''); const bridged = BRIDGED_TOKENS[unit]; if (bridged) api.add(bridged.coingeckoId, quantity / 10 ** bridged.decimals, { skipChain: true }); else api.add(unit, quantity); @@ -133,7 +150,7 @@ async function tvl(api) { module.exports = { timetravel: false, - methodology: 'Sums the ADA and native assets sitting in the unspent utxos of Danogo smart contracts. Contract addresses come from the Danogo gateway, utxos are read from Kupo by payment credential, and every asset is priced by DefiLlama.', + methodology: 'Sums the ADA and native assets sitting in the unspent utxos of Danogo smart contracts. Contract addresses come from the Danogo gateway, utxos are read from Koios by payment credential, and every asset is priced by DefiLlama.', cardano: { tvl }, From 5b26fd52609a36726dfdbf587b7a87df46a4f8a5 Mon Sep 17 00:00:00 2001 From: Dani Date: Tue, 17 Nov 2026 09:30:21 +0100 Subject: [PATCH 795/988] stride: count stToken backing in Osmosis redemption pools after chain halt (#22257) --- projects/stride/index.js | 279 +++++++++++++++------------------------ 1 file changed, 104 insertions(+), 175 deletions(-) diff --git a/projects/stride/index.js b/projects/stride/index.js index 42c35693084..5620bc02add 100644 --- a/projects/stride/index.js +++ b/projects/stride/index.js @@ -1,175 +1,104 @@ -const sdk = require("@defillama/sdk"); -const { get } = require("../helper/http"); - -const chains = { - cosmos: { - chainId: "cosmoshub-4", - denom: "uatom", - coinGeckoId: "cosmos", - }, - - stargaze: { - chainId: "stargaze-1", - denom: "ustars", - coinGeckoId: "stargaze", - }, - - juno: { - chainId: "juno-1", - denom: "ujuno", - coinGeckoId: "juno-network", - }, - - osmosis: { - chainId: "osmosis-1", - denom: "uosmo", - coinGeckoId: "osmosis", - }, - - terra2: { - chainId: "phoenix-1", - denom: "uluna", - coinGeckoId: "terra-luna-2", - }, - - evmos: { - chainId: "evmos_9001-2", - denom: "aevmos", - coinGeckoId: "evmos", - }, - - injective: { - chainId: "injective-1", - denom: "inj", - coinGeckoId: "injective-protocol", - }, - - umee: { - chainId: "injective-1", - denom: "uumee", - coinGeckoId: "umee", - }, - - comdex: { - chainId: "comdex-1", - denom: "ucmdx", - coinGeckoId: "comdex", - }, - - sommelier: { - chainId: "sommelier-3", - denom: "usomm", - coinGeckoId: "sommelier", - }, - - dydx: { - chainId: "dydx-mainnet-1", - denom: "adydx", - coinGeckoId: "dydx-chain", - }, - - celestia: { - chainId: "celestia", - denom: "utia", - coinGeckoId: "celestia", - }, - - dymension: { - chainId: "dymension_1100-1", - denom: "adym", - coinGeckoId: "dymension", - }, - - islm: { - chainId: "haqq_11235-1", - denom: "aISLM", - coinGeckoId: "islamic-coin", - }, - - band: { - chainId: "laozi-mainnet", - denom: "uband", - coinGeckoId: "band-protocol", - } -}; - -// inj uses 1e18 - https://docs.injective.network/learn/basic-concepts/inj_coin#base-denomination -function getCoinDenimals(denom) { - return ["aevmos", "inj", "adydx", "adym", "aISLM"].includes(denom) - ? 1e18 - : 1e6; -} - -function makeTvlFn(chain) { - return async () => { - // Define the URL for host_zone based on chainId - const hostZoneUrl = chain.chainId === "dymension_1100-1" - ? "https://stride-walk-214t-api.polkachu.com//Stride-Labs/stride/stakedym/host_zone" - : `https://stride-walk-214t-api.polkachu.com//Stride-Labs/stride/stakeibc/host_zone/${chain.chainId}`; - - const [{ amount: assetBalances }, { host_zone: hostZone }] = - await Promise.all([ - await get( - `https://stride-walk-214t-api.polkachu.com//cosmos/bank/v1beta1/supply/by_denom?denom=st${chain.denom}` - ), - await get(hostZoneUrl), - ]); - - const assetBalance = assetBalances["amount"]; - - const coinDecimals = getCoinDenimals(chain.denom); - - const amount = assetBalance / coinDecimals; - - const balances = {}; - - sdk.util.sumSingleBalance( - balances, - chain.coinGeckoId, - amount * hostZone.redemption_rate - ); - - return balances; - }; -} - -module.exports = { - timetravel: false, - methodology: "Sum of all the tokens that are liquid staked on Stride", - hallmarks: [ - ['2026-09-29', 'Stride chain shutdown proposed (funding shortfall); redemptions until Oct 12, moving to Osmosis ~Nov 20'], - ], - stride: { - tvl: async () => ({}), // kept so tvl history doesnt disappear - }, -}; // node test.js projects/stride/index.js - -for (const chainName of Object.keys(chains)) { - module.exports[chainName] = { tvl: makeTvlFn(chains[chainName]) }; -} - -// ############### Berachain TVL ############### -// Berachain TVL is calculated differently than the other chains Stride -// supports. -const MANAGER_CONTRACT_ADDRESS = "0xDcc5E38f0207757604c5a4925A870dE9554395b4"; -function makeBerachainTvlFn() { - return async (api) => { - // Get all whitelisted receipt tokens (vaults) - const receipts = await api.call({ - target: MANAGER_CONTRACT_ADDRESS, - abi: 'function receipts() view returns (address[])', - }); - - // For each vault, get the total staked amount - const stakedAmounts = await api.multiCall({ - target: MANAGER_CONTRACT_ADDRESS, - abi: "function totalStakedByReceipt(address receipt) view returns (uint256)", - calls: receipts, - }); - api.add(receipts, stakedAmounts); - }; -} - -module.exports["berachain"] = { - tvl: makeBerachainTvlFn(), -}; +const { sumTokens } = require("../helper/chain/cosmos"); + +// stTokens were minted on these chains' host zones. The Stride chain halted on 2026-11-13, keys kept so tvl history stays +const haltedChains = [ + "stride", "cosmos", "stargaze", "juno", "terra2", "evmos", "injective", "umee", + "comdex", "sommelier", "dydx", "celestia", "dymension", "islm", "band", +]; + +// stToken redemption pools (transmuter v3.2.0, code id 996) funded and administered by Stride's vault osmo1k8c2m5cn322akk5wy8lpt87dd2f4yh9afcd7af +const REDEMPTION_POOLS = [ + "osmo1k49dzwmaq3r99v5gam23vn62akl67n8aye4f34lmw799tlm3l9yqctyf9p", // stATOM + "osmo18tcy9q5mdp05khs0sgyldtjthrlpsdecsxr9w2aqppsuvyaggkxsxawh04", // stATOM.agoric + "osmo1kfw8err6zl8mcf77t5lkgrh2yk0u6nkhaeegyalx4a6xr5f4vv8sk85884", // stATOM.cosmoshub + "osmo1f8ca03ah9yfmsxhj3waxsh8qs7cdj4nnh4lqa0hrk223srmtlheqd938ef", // stATOM.injective + "osmo1t5ulc4wz63sq3fmcfuk92czvd9q0pypsp6232m929aptx7t8kwys04ha3r", // stATOM.neutron + "osmo14aedxwpxefa0vw4uc35nzc58hrjgq94xpvzwlghkunch9asmmfcs7rrswc", // stATOM.secret + "osmo1frf5wzs8fl2vj3p39vn4walkzkwkara440qfk64jf4ckrzuweg4s2u6sgn", // stATOM.terra + "osmo1zhpuj7cc9vxdjwp8wy3d4pugp35hnkysf2l0feudhkv5chr8qehs36ar38", // stBAND + "osmo14h0emmfz7rpfxfd5dj86f24x2fllevmwg57wel8xs0h27cqxfgcshs740n", // stBAND.cosmoshub + "osmo19rjdcr48qrx4megltm6d2w4wv5xqmdlyjypl7m23u5n7h0yx9csqvu3vlq", // stDYDX + "osmo1x99p42xnv78utnkg7sxsnfxfzgfu089gvglprnug8wljkquqzkgqz0d5n7", // stDYDX.cosmoshub + "osmo1apslth04ntm77ywzfzg990ustchweqtjdnnfrcafx4zrjke75d8sd9xuy0", // stINJ + "osmo183v2x64xksqt9szpzkrqwedjt3tl0a9ufaqh9kj9k56nehemdcqq008a5c", // stINJ.cosmoshub + "osmo1tjrrh046kdrk8s6zqfap7wa4tvczw44d7pdf7wcgfrqh6ujxperqpww8ca", // stINJ.injective + "osmo1mg7wgzux33lxgwn5c6hkn95c7s3qs8373hg54chg7erdmlafvknsrq7uqj", // stINJ.secret + "osmo1sj5z3zd3s28nfh8y06ctag8a5h6sn8na7dpl7cqvauyyv6xpg26qyrjp89", // stISLM + "osmo19u4re0amqzz9guukgwf48vkq08tjf0ws0lfk3mqlazhydrq3278qe020cl", // stISLM.haqq + "osmo175cxam9qmqk9qc8rtefmpmcyydle8hfhu2w7rgcec53u3f3xw5cqsnqsda", // stJUNO + "osmo1frx7zjyutdpd0sdzzuz2xhlfg5ywd7e5rcpvjw72unr2ldql3u2q6u4nnu", // stLUNA + "osmo1clll7pq9syppk6dm9a96r72rnnchvhgpylvkpr5zuca8t64nlexsw9xdxv", // stLUNA.terra + "osmo1zlrlj9ejwe9eqsy6rsuwk489vt2trfr3p0486f3y7064wg3d0zrsaughew", // stOSMO + "osmo1xwj3ru737vcp2rrsy8yc39z8ayu8m8mdy9wc0q39l4nwzc8w4l2qayd38c", // stOSMO.cosmoshub + "osmo1lvndmypu0npfvygnsktuegtke6z80x4r7z0xj5v908p8mpg4js9qzwefqe", // stOSMO.secret + "osmo1224vqh0h99cuu32xm2w88zd2lha06y6dukfyngsu9w32zja0ykxqqtuehk", // stSAGA + "osmo15kjrvxz9h59hdv08tpy0u5cgaq3jdc9kd63sqr7eplm83y9h86nq3q4q9t", // stSOMM + "osmo1ru4ncmqln6xyt6rs63y0l4spdc7zm5x5hqma9ew2g6kx8z3seu4qk5da2l", // stTIA + "osmo169qt0zcxcxa0xr5qqanyt2zhd6j9laj2k52n2uc3ljgcd3qm80nq0mad9z", // stTIA.agoric + "osmo10y67eepyunrnm8g5ujtd9csg03ue2mdvexxzfeu9lzlewszqzz5sz4zc7w", // stTIA.celestia + "osmo1fe75mvghgtz4ly0qdtegt4m3wqs2kszqqup60g67nfyuw8tt9zhq654fxc", // stTIA.cosmoshub + "osmo1wefhqc0yywyc36kxas6mjyj3fn540hmzcs2aa30z7rwu095se03s64rs3a", // stTIA.dymension + "osmo1em4u6ryfp6axd7dkdj3gezj7sc6fqd6rs6jqm85rg0tse2ddxg3q3hkjcx", // stTIA.neutron +]; + +// native tokens backing the pools, the stTokens already redeemed into them are not counted +const NATIVE_DENOMS = [ + "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", // ATOM + "ibc/D79E7D83AB399BFFF93433E54FAA480C191248FC556924A2A8351AE2638B3877", // TIA + "ibc/64BA6E31FE887D66C6F8F31C7B1A80C7CA179239677B4088BB55F5EA07DBE273", // INJ + "ibc/69110FF673D70B39904FF056CFDFD58A90BEC3194303F45C32CB91B8B0A738EA", // ISLM + "ibc/831F0B1BBB1D08A2B75311892876D71565478C532967545476DF4C2D7492E48C", // DYDX + "ibc/F867AE2112EFE646EC71A25CD2DFABB8927126AC1E19F1BBF0FF693A4ECA05DE", // BAND + "ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED", // JUNO + "ibc/785AFEC6B3741100D15E7AF01374E3C4C36F24888E96479B1C33F5C71F364EF9", // LUNA + "ibc/9BBA9A1C257E971E38C1422780CE6F0B0686F0A3085E2D61118D904BFE0F5F5E", // SOMM + "ibc/094FB70C3006906F67F5D674073D2DAFAFB41537E7033098F5C752F211E7B6C2", // SAGA + "uosmo", +]; + +async function osmosisTvl(api) { + return sumTokens({ api, owners: REDEMPTION_POOLS, tokens: NATIVE_DENOMS }); +} + +module.exports = { + timetravel: false, + methodology: + "Until the Stride chain halted on 2026-11-13, counted each stToken's supply times its redemption rate. Since the halt, counts the native tokens backing stToken redemptions in the Osmosis transmuter pools owned by Stride's multisig, without the stTokens already redeemed into them. On Berachain, counts the receipt tokens staked in Stride's manager contract.", + hallmarks: [ + ['2026-09-29', 'Stride chain shutdown proposed (funding shortfall); redemptions until Oct 12, moving to Osmosis ~Nov 20'], + ['2026-11-13', 'Stride chain halted, stToken backing moved to Osmosis redemption pools'], + ], + osmosis: { + tvl: osmosisTvl, + }, +}; // node test.js projects/stride/index.js + +for (const chain of haltedChains) { + module.exports[chain] = { tvl: () => ({}) }; +} + +// ############### Berachain TVL ############### +// Berachain TVL is calculated differently than the other chains Stride +// supports. +const MANAGER_CONTRACT_ADDRESS = "0xDcc5E38f0207757604c5a4925A870dE9554395b4"; +function makeBerachainTvlFn() { + return async (api) => { + // Get all whitelisted receipt tokens (vaults) + const receipts = await api.call({ + target: MANAGER_CONTRACT_ADDRESS, + abi: 'function receipts() view returns (address[])', + }); + + // For each vault, get the total staked amount + const stakedAmounts = await api.multiCall({ + target: MANAGER_CONTRACT_ADDRESS, + abi: "function totalStakedByReceipt(address receipt) view returns (uint256)", + calls: receipts, + }); + api.add(receipts, stakedAmounts); + }; +} + +module.exports["berachain"] = { + tvl: makeBerachainTvlFn(), +}; From 2eb52426fc506794474e4445ae6be08a8f9d0790 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 17 Nov 2026 11:42:17 +0100 Subject: [PATCH 796/988] Track Somnia Tokyo integration (#22231) --- projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 7 +++++++ projects/helper/env.js | 3 +++ registries/sumTokens/data3.js | 10 ++++++++++ 4 files changed, 21 insertions(+) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 5fd384b8c74..9ba44da49c6 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -454,6 +454,7 @@ "solana", "sommelier", "somnia", + "somnia_tokyo", "soneium", "songbird", "sonic", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 58ce9995d57..b8246bf3140 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -2738,6 +2738,13 @@ "USDC": "0x28BEc7E30E6faee657a03e19Bf1128AaD7632A00", "WETH": "0x936ab8c674bcb567cd5deb85d8a216494704e9d8" }, + "somnia_tokyo": { + "USDso": "0xcea80aeb6ed4ed526d71f34efed047904c0e387a", + "WETH": "0xd2f22d1d7e3689c79fd8892edaeb2bc1b5aacdd8", + "WBTC": "0xf844a072282e2e715f84c971a5acc4f8e40d8b91", + "USDC": "0xb8cea44875c3d3b84804d6b025faefbd2e8fe3ae", + "USDT": "0xfa58446f441f2feae71272b088f10543e350fd6e" + }, "plasma": { "WXPL": "0x6100e367285b01f48d07953803a2d8dca5d19873", "USDT0": "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb" diff --git a/projects/helper/env.js b/projects/helper/env.js index 19876599a82..10d7faa67a0 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -97,6 +97,9 @@ const DEFAULTS = { // mainnet.telos.net/evm now serves a 404 or an HTML page with HTTP 200, which the sdk treats as a successful call with a null result; rpc1.eu.telos.net hangs TELOS_RPC: 'https://rpc.telos.net,https://rpc1.us.telos.net/evm,https://telos.drpc.org,https://public.1rpc.io/telos/evm', TELOS_RPC_MULTICALL_V3: '0x4E06d6ec4a3A90790edee253C8BF098bbb4F51E5', + // Somnia Tokyo, chainId 50321 - separate mainnet chain from Somnia (5031), not in the SDK providers list + SOMNIA_TOKYO_RPC: 'https://api.tokyo.infra.mainnet.somnia.network', + SOMNIA_TOKYO_RPC_MULTICALL_V3: '0xcA11bde05977b3631167028862bE2a173976CA11', KUSAMA_ASSETHUB_SUBSTRATE_RPC: 'https://kusama-asset-hub-rpc.polkadot.io,https://statemine.api.onfinality.io/public', } diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 049fe05345c..063dbae1bb2 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -530,6 +530,16 @@ module.exports = { "somnia": { "tvl": { "tokensAndOwners": [[ADDRESSES.somnia.USDC,"0x47fD2f18426f67106DBaC82F6d21D446c5F2120b"],[ADDRESSES.somnia.USDC,"0xD53E3F3b73513F2147377ef8f573f649cF60100c"],["0xC5098b3cA516784323872F17235fa074E167D3D2","0x25bfF6B7B5E2243424F38E75de7ab03C0522a5EA"],["0xC5098b3cA516784323872F17235fa074E167D3D2","0xed32F048D6a47923D38eCeD868d6f8b0eB4852bd"],[ADDRESSES.somnia.WETH,"0xa936da11B57b50A344e1293AAaE5232885ea2bDE"],[ADDRESSES.somnia.WETH,"0x9653a7355849B7691802A6AA49fDe18eF5ba633d"]], "owners": ["0x035De7403eac6872787779CCA7CCF1b4CDb61379","0x68c8f6fb1EA19A28F25358Ff00b8Ed8E1216df30","0x47fD2f18426f67106DBaC82F6d21D446c5F2120b","0xD53E3F3b73513F2147377ef8f573f649cF60100c","0x25bfF6B7B5E2243424F38E75de7ab03C0522a5EA","0xed32F048D6a47923D38eCeD868d6f8b0eB4852bd","0xa936da11B57b50A344e1293AAaE5232885ea2bDE","0x9653a7355849B7691802A6AA49fDe18eF5ba633d"], "tokens": ["0x00000022dA000002656c64D9eA6011ea952D008A",ADDRESSES.null] }, }, + // Somnia Tokyo (chainId 50321): spot SpotPools + their SpotStopOrderRegistries. Tokens are the Hyperlane synthetics of the Somnia mainnet assets + "somnia_tokyo": { + "tvl": { "owners": ["0xe2bee2309eec9c67754c306b5e070a158c99773a","0x936c3b93765ac6a930e1057f58eab091ef128238","0x7ff6542baf5afd01aeab8d5eed0f1598ebc33677","0x96466705350c01f4703b8215d4f0cfddbe0902c1","0xdbe4760c5bb086ae15d2bf8cc9b0caf3a22f7902","0xae926350d7759f4c432077bd0bcdba4a6eda8769","0xc517171260d7968ae9e8fec54f71372a7bfb65c6","0x726d757829ea537b777f5a805d9ccf02a1f9451e","0x84e2e5d6d55bd327bc9835441621d657c29826b4","0x9538c6a87328a5388dc5d4a83efac242d0454884"], "tokens": [ADDRESSES.somnia_tokyo.USDso,ADDRESSES.somnia_tokyo.WETH,ADDRESSES.somnia_tokyo.WBTC,ADDRESSES.somnia_tokyo.USDC,ADDRESSES.somnia_tokyo.USDT,ADDRESSES.null] }, + }, + }, + "dreamdex-perps": { + "methodology": "dreamDEX perpetuals on Somnia Tokyo. TVL is the USDso collateral held by the shared MarginBank (trader margin for every perp market) and by the insurance fund.", + "somnia_tokyo": { + "tvl": { "owners": ["0xde96cbc9b72fb7317f8c4f1005fbb41fe8df582a","0x5ea6b16aba789d870c3f282a4998deb72a063400"], "tokens": [ADDRESSES.somnia_tokyo.USDso] }, + }, }, "instrumental": { "methodology": "Instrumental can be LP'ed and LP can be staked or locked (pool2s). Plus STRM itself can be locked against veSTRM (staking). Vaults coming soon.", From 909a45d81ae64a91e3ab3dce1a69ab4ed92dbf34 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 17 Nov 2026 14:16:18 +0100 Subject: [PATCH 797/988] fix: adjust permitFailure logic for token exports based on chain --- projects/helper/cex.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 1f54cd3c14a..b9ec0f67a6e 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -591,7 +591,9 @@ function cexExports(config) { console.log(`Adding ${binanceTokensOnChain.length} Binance tokens on ${chain} to the token list.`) tokens = [...(options.tokens ?? []), ...binanceTokensOnChain] } - const runtimeOptions = { ...options, owners, tokens, permitFailure: true } // while filling historical data, some tokens may not exist on the chain yet, so we permit failure + // while filling historical data, some tokens may not exist on the chain yet, so we permit failure + // not on tron: its rpc rejects whole batches (cpu timeout / rate limit) and permitFailure would turn that into zero balances + const runtimeOptions = { ...options, owners, tokens, permitFailure: chain !== 'tron' } if (chain === 'solana') runtimeOptions.solOwners = owners // hyperliquid owners hold funds both on HyperEVM (summed above) and on HyperCore // (spot + perp margin), which no on-chain lookup sees @@ -606,7 +608,7 @@ function cexExports(config) { exportObj[chain].ownTokens = async (api) => { let owners = typeof options.owners === 'function' ? await options.owners(api) : options.owners if (!owners) owners = [...new Set(tokensAndOwners.map(([, owner]) => owner))] - return sumTokensExport({ chain, owners, tokens: ownTokens, permitFailure: true })(api) + return sumTokensExport({ chain, owners, tokens: ownTokens, permitFailure: chain !== 'tron' })(api) } } }) From 5300bd4ff442a28d6de70fe17efac9ba7d220bdc Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 17:17:07 +0400 Subject: [PATCH 798/988] b14g: flag as doublecounted, its Babylon co-staking BTC is also in babylon-protocol (#22254) Co-authored-by: Claude Opus 5.5 --- projects/b14g/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/b14g/index.js b/projects/b14g/index.js index 5f15eea3a23..3bb42a36200 100644 --- a/projects/b14g/index.js +++ b/projects/b14g/index.js @@ -6,6 +6,8 @@ const {PromisePool} = require("@supercharge/promise-pool"); const CORE_ASSETS = require("../helper/coreAssets.json"); module.exports = { + // Babylon co-staking BTC is also counted by babylon-protocol, see #11992 + doublecounted: true, babylon: { tvl: async function tvl(api) { const marketplace_contract = "bbn1ts0rxh55zha7gwh6a8q0yd224g0lfjlqsm53zrc85knx602k8fvs0y3mlg" From c1f2f29a72813afb6f86c98cfcc9d955c4dc40cd Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 17:25:03 +0400 Subject: [PATCH 799/988] stakewise: count gnosis v3 vaults, skip meta vaults (#22234) Co-authored-by: Claude Opus 5.5 --- projects/stakewise/index.js | 49 +++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/projects/stakewise/index.js b/projects/stakewise/index.js index 8b85c6e291f..b54d9b0a1ad 100644 --- a/projects/stakewise/index.js +++ b/projects/stakewise/index.js @@ -6,11 +6,16 @@ const CONFIG = { rETH2: '0x20BC832ca081b91433ff6c17f85701B6e92486c5', sETH2: '0xFe2e637202056d30016725477c5da089Ab0A043A', factory: '0x3a0008a588772446f6e656133c2d5029cc4fc20e', + fromBlock: 18470078, blacklist: ['0x09e84205df7c68907e619d07afd90143c5763605'] }, xdai: { GNO: ADDRESSES.xdai.GNO, - sGNO: '0xA4eF9Da5BA71Cc0D2e5E877a910A37eC43420445' + rGNO: '0x6aC78efae880282396a335CA2F79863A1e6831D4', + sGNO: '0xA4eF9Da5BA71Cc0D2e5E877a910A37eC43420445', + factory: '0x7d014B3C6ee446563d4e0cB6fBD8C3D0419867cB', + fromBlock: 34778688, + blacklist: [] } } @@ -18,32 +23,46 @@ const topic = { vaultAdded: 'VaultAdded(address,address)' } +// totalAssets of every V3 vault in the registry +const vaultAssets = async (api) => { + const { factory, fromBlock, blacklist } = CONFIG[api.chain] + const logs = await getLogs({ api, target: factory, topic: topic.vaultAdded, fromBlock }) + const vaults = logs + .map(v => "0x" + v.topics[2].slice(26)) + .filter(vault => !blacklist.includes(vault.toLowerCase())) + + // meta vaults hold shares of their sub-vaults, which are registry vaults and already counted. What a meta vault holds itself + // is deposits not yet moved to its sub-vaults (withdrawableAssets) plus assets owed to stakers who already exited, which no + // vault's totalAssets counts + const subVaultsRegistries = await api.multiCall({ calls: vaults, abi: 'address:subVaultsRegistry', permitFailure: true }) + const isMeta = (i) => subVaultsRegistries[i] && subVaultsRegistries[i] !== ADDRESSES.null + const assets = await api.multiCall({ calls: vaults.filter((_, i) => !isMeta(i)), abi: "uint256:totalAssets" }) + const idleAssets = await api.multiCall({ calls: vaults.filter((_, i) => isMeta(i)), abi: "uint256:withdrawableAssets" }) + return assets.concat(idleAssets) +} + const ethTvl = async (api) => { // The v2 solo-staking registry is not counted: every validator ever registered through it // has exited the beacon chain, and each one's stake withdraws to the operator's own address // rather than to StakeWise, so none of it is held here. - const { rETH2, sETH2, factory, blacklist } = CONFIG[api.chain] + const { rETH2, sETH2 } = CONFIG[api.chain] + await api.getBlock() // read the v2 supply and the vaults at the same block const lsBals = await api.multiCall({ abi: 'erc20:totalSupply', calls: [rETH2, sETH2]}) - const vaults = await getLogs({ api, target: factory, topic: topic.vaultAdded, fromBlock: 18470078 }) - - const assets = await api.multiCall({ - calls: vaults - .map(v => ({ target: "0x" + v.topics[2].slice(26) })) - .filter(call => !blacklist.includes(call.target.toLowerCase())), - abi: "uint256:totalAssets" - }) + const assets = await vaultAssets(api) api.add(ADDRESSES.ethereum.WETH, assets.concat(lsBals)) } const xdaiTvl = async (api) => { - const { GNO, sGNO } = CONFIG[api.chain] - const supply = await api.call({ target: sGNO, abi: 'erc20:totalSupply' }) - api.add(GNO, supply) + const { GNO, rGNO, sGNO } = CONFIG[api.chain] + await api.getBlock() // read the v2 supply and the vaults at the same block + const lsBals = await api.multiCall({ abi: 'erc20:totalSupply', calls: [rGNO, sGNO] }) + const assets = await vaultAssets(api) + api.add(GNO, assets.concat(lsBals)) } module.exports = { - methodology: 'Counts ETH staked', + methodology: 'Counts the ETH and GNO staked in StakeWise V3 vaults, plus the V2 rETH2/sETH2 and rGNO/sGNO supply. Meta vaults only count the deposits they have not moved into their sub-vaults yet, since the rest sits in other vaults that are already counted.', ethereum: { tvl: ethTvl }, xdai: { tvl: xdaiTvl } -} \ No newline at end of file +} From 7b9db7220b5bc29f60a032753dc994cef5e64296 Mon Sep 17 00:00:00 2001 From: BrandonL20 <62954565+BrandonL20@users.noreply.github.com> Date: Tue, 17 Nov 2026 21:04:07 +0700 Subject: [PATCH 800/988] feat(panoptic-v2): count vault reserves and SFPM liquidity (#22256) Co-authored-by: FelixBruguera --- projects/panoptic-v2/index.js | 95 ++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/projects/panoptic-v2/index.js b/projects/panoptic-v2/index.js index d9573173f3c..7854e03e388 100644 --- a/projects/panoptic-v2/index.js +++ b/projects/panoptic-v2/index.js @@ -3,69 +3,69 @@ const { getLogs2 } = require('../helper/cache/getLogs') const NULL_ADDRESS = ADDRESSES.null -const methodology = 'Counts assets managed by Panoptic V2 collateral trackers for all PanopticPool contracts deployed by the PanopticFactoryV3 and PanopticFactoryV4 contracts. CollateralTracker.totalAssets() includes tracked deposits, assets deployed into AMM positions, and unrealized interest, so no separate SFPM chunk/subgraph accounting is needed.' +const methodology = 'Counts assets managed by Panoptic V2 collateral trackers for all PanopticPool contracts deployed by the PanopticFactoryV3 and PanopticFactoryV4 contracts, plus the underlying tokens that Panoptic PLP vaults hold idle before depositing them into a collateral tracker. CollateralTracker.totalAssets() includes tracked deposits, assets deployed into AMM positions, and unrealized interest, so no separate SFPM chunk/subgraph accounting is needed.' const abi = { PoolDeployedV3: 'event PoolDeployed(address indexed poolAddress, address indexed uniswapPool, address collateralTracker0, address collateralTracker1, address riskEngine)', PoolDeployedV4: 'event PoolDeployed(address indexed poolAddress, bytes32 indexed idV4, address collateralTracker0, address collateralTracker1, address riskEngine)', } +const factories = [ + { + target: '0x0000000000000aDC9A108591e718F2aee963a2a7', + eventAbi: abi.PoolDeployedV3, + extraKey: 'pool-deployed-v3', + }, + { + target: '0x0000000000000c51d0f8cf4bd9adE7191372a625', + eventAbi: abi.PoolDeployedV4, + extraKey: 'pool-deployed-v4', + }, +] + const config = { ethereum: { startBlock: 25276309, - factories: [ - { - target: '0x0000000000000aDC9A108591e718F2aee963a2a7', - eventAbi: abi.PoolDeployedV3, - extraKey: 'pool-deployed-v3', - }, - { - target: '0x0000000000000c51d0f8cf4bd9adE7191372a625', - eventAbi: abi.PoolDeployedV4, - extraKey: 'pool-deployed-v4', - }, + factories, + // PLP vaults, with the block each one was deployed at + vaults: [ + { address: '0xd4e2c720a760049cc4151bcf61e3a9348db9cd92', fromBlock: 25296736 }, + { address: '0x236d0558f06cd60780b232d4ec4c92d2cb7e4d18', fromBlock: 25296782 }, + { address: '0x779a2aa634a004b3a3f3b322083744869bbc6d66', fromBlock: 24809033 }, + { address: '0x963fe9c93bc353602656ee4051a75114ba74d6c5', fromBlock: 24809057 }, ], }, robinhood: { startBlock: 62901925, - factories: [ - { - target: '0x0000000000000aDC9A108591e718F2aee963a2a7', - eventAbi: abi.PoolDeployedV3, - extraKey: 'pool-deployed-v3', - }, - { - target: '0x0000000000000c51d0f8cf4bd9adE7191372a625', - eventAbi: abi.PoolDeployedV4, - extraKey: 'pool-deployed-v4', - }, + factories, + vaults: [ + { address: '0x08b24123252bd9c4dd473b6573d4cf67196ffc4b', fromBlock: 63972776 }, ], }, } async function tvl(api) { - const { startBlock, factories } = config[api.chain] - const logs = ( - await Promise.all( - factories.map(({ target, eventAbi, extraKey }) => - getLogs2({ - api, - target, - fromBlock: startBlock, - eventAbi, - extraKey, - skipCacheRead: true, - onlyArgs: false, - transform: (log) => ({ - blockNumber: log.blockNumber, - poolAddress: log.args.poolAddress, - collateralTracker0: log.args.collateralTracker0, - collateralTracker1: log.args.collateralTracker1, - }), - }) - ) - ) - ).flat().filter((log) => !api.block || log.blockNumber <= api.block) + const { startBlock, factories, vaults } = config[api.chain] + const block = await api.getBlock() + + const logs = [] + for (const { target, eventAbi, extraKey } of factories) { + const factoryLogs = await getLogs2({ + api, + target, + fromBlock: startBlock, + eventAbi, + extraKey, + skipCacheRead: true, + onlyArgs: false, + transform: (log) => ({ + blockNumber: log.blockNumber, + collateralTracker0: log.args.collateralTracker0, + collateralTracker1: log.args.collateralTracker1, + }), + }) + logs.push(...factoryLogs.filter((log) => log.blockNumber <= block)) + } const collateralTrackers = [ ...new Set( @@ -93,6 +93,11 @@ async function tvl(api) { if (token.toLowerCase() === NULL_ADDRESS) return api.addGasToken(balances[i]) api.add(token, balances[i]) }) + + // The vaults' collateral tracker shares are already in totalAssets() above; this adds what they have not deposited yet + const liveVaults = vaults.filter((vault) => vault.fromBlock <= block).map((vault) => vault.address) + const underlyings = await api.multiCall({ abi: 'address:underlyingToken', calls: liveVaults }) + await api.sumTokens({ tokensAndOwners: liveVaults.map((vault, i) => [underlyings[i], vault]) }) } module.exports = { From c52fca1f906bf652957a89b05a898e0783257a69 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Tue, 17 Nov 2026 18:28:07 +0400 Subject: [PATCH 801/988] linea, metis, taiko, immutable zkevm: count the chain's own token as staking (#22259) Co-authored-by: Claude Opus 5.5 --- registries/sumTokens/covalent.js | 84 ++++++++++++++++++++++++++------ 1 file changed, 70 insertions(+), 14 deletions(-) diff --git a/registries/sumTokens/covalent.js b/registries/sumTokens/covalent.js index 87223150160..144070e7f20 100644 --- a/registries/sumTokens/covalent.js +++ b/registries/sumTokens/covalent.js @@ -445,9 +445,21 @@ module.exports = { }, }, "immutable-zkevm": { + "methodology": "Counts ETH and ERC-20s escrowed on Ethereum in Immutable zkEVM's RootERC20BridgeFlowRate. IMX is Immutable's own token and is counted under staking.", "ethereum": { - "owner": "0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6", - "fetchCoValentTokens": true + "tvl": { + "owner": "0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6", + "blacklistedTokens": [ + "0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF" // IMX + ], + "fetchCoValentTokens": true + }, + "staking": { + "owner": "0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6", + "tokens": [ + "0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF" + ] + } }, }, "injective": { @@ -491,12 +503,29 @@ module.exports = { }, }, "linea": { + "methodology": "Counts assets escrowed on Ethereum for Linea's canonical bridge: ETH in the LineaRollup and ERC-20s in the TokenBridge. LINEA is Linea's own token and is counted under staking.", "ethereum": { - "owners": [ - "0xd19d4B5d358258f05D7B411E21A1460D11B0876F", - "0x051F1D88f0aF5763fB888eC4378b4D8B29ea3319" - ], - "fetchCoValentTokens": true + "tvl": { + "owners": [ + "0xd19d4B5d358258f05D7B411E21A1460D11B0876F", + "0x051F1D88f0aF5763fB888eC4378b4D8B29ea3319" + ], + "blacklistedTokens": [ + "0x1789e0043623282D5DCc7F213d703C6D8BAfBB04" // LINEA + ], + "fetchCoValentTokens": true + }, + "staking": { + "owners": [ + "0xd19d4B5d358258f05D7B411E21A1460D11B0876F", + "0x051F1D88f0aF5763fB888eC4378b4D8B29ea3319" + ], + "tokens": [ + "0x1789e0043623282D5DCc7F213d703C6D8BAfBB04" + ], + // LINEA was deployed at block 23033087 (2025-07-30), after the listing start: earlier reads count 0 instead of throwing + "permitFailure": true + } }, }, "lisk-l2": { @@ -555,9 +584,21 @@ module.exports = { }, }, "metis": { + "methodology": "Counts ETH and ERC-20s escrowed on Ethereum in Metis's L1StandardBridge. METIS is Metis's own token and is counted under staking.", "ethereum": { - "owner": "0x3980c9ed79d2c191A89E02Fa3529C60eD6e9c04b", - "fetchCoValentTokens": true + "tvl": { + "owner": "0x3980c9ed79d2c191A89E02Fa3529C60eD6e9c04b", + "blacklistedTokens": [ + "0x9E32b13ce7f2E80A01932B42553652E053D6ed8e" // METIS + ], + "fetchCoValentTokens": true + }, + "staking": { + "owner": "0x3980c9ed79d2c191A89E02Fa3529C60eD6e9c04b", + "tokens": [ + "0x9E32b13ce7f2E80A01932B42553652E053D6ed8e" + ] + } }, }, "mint-chain": { @@ -947,12 +988,27 @@ module.exports = { }, }, "taiko-bridge": { + "methodology": "Counts assets escrowed on Ethereum for Taiko's canonical bridge: ETH in the Bridge and ERC-20s in the ERC20Vault. TAIKO is Taiko's own token and is counted under staking.", "ethereum": { - "owners": [ - "0xd60247c6848B7Ca29eDdF63AA924E53dB6Ddd8EC", - "0x996282cA11E5DEb6B5D122CC3B9A1FcAAD4415Ab" - ], - "fetchCoValentTokens": true + "tvl": { + "owners": [ + "0xd60247c6848B7Ca29eDdF63AA924E53dB6Ddd8EC", + "0x996282cA11E5DEb6B5D122CC3B9A1FcAAD4415Ab" + ], + "blacklistedTokens": [ + "0x10dea67478c5F8C5E2D90e5E9B26dBe60c54d800" // TAIKO + ], + "fetchCoValentTokens": true + }, + "staking": { + "owners": [ + "0xd60247c6848B7Ca29eDdF63AA924E53dB6Ddd8EC", + "0x996282cA11E5DEb6B5D122CC3B9A1FcAAD4415Ab" + ], + "tokens": [ + "0x10dea67478c5F8C5E2D90e5E9B26dBe60c54d800" + ] + } }, }, "tzwrap": { From e20669979ddfa8b8272483c4ece798ceb766c9b8 Mon Sep 17 00:00:00 2001 From: MB <55466744+token-boss@users.noreply.github.com> Date: Tue, 17 Nov 2026 14:32:17 +0000 Subject: [PATCH 802/988] 3a-dao: add wind-down hallmark and methodology (#22260) --- projects/3a-dao/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/3a-dao/index.js b/projects/3a-dao/index.js index c17b741cd69..8c6e123a1ba 100644 --- a/projects/3a-dao/index.js +++ b/projects/3a-dao/index.js @@ -1,5 +1,10 @@ const { getLogs } = require('../helper/cache/getLogs') +module.exports = { + methodology: 'Collateral held in 3A DAO vaults. The protocol is being wound down: no new loans since 1 Oct 2024; remaining vaults can still be repaid and withdrawn.', + hallmarks: [['2024-09-30', 'Phase-out announced: no new loans from 1 Oct 2024']], +} + const config = { polygon: { factory: '0x4760847023fa0833221ae76E01Db1E483A5D20e0', fromBlock: 49852705 }, linea: { factory: '0x65c6FD9B3a2A892096881e28f07c732ed128893E', fromBlock: 3045954 }, @@ -22,4 +27,4 @@ Object.keys(config).forEach(chain => { return api.sumTokens({ ownerTokens }) } } -}) \ No newline at end of file +}) From 8bab2ef4b0a622e595eb00547bd50bbc7c6ad072 Mon Sep 17 00:00:00 2001 From: Masha-lla Date: Tue, 17 Nov 2026 15:35:45 +0100 Subject: [PATCH 803/988] Fix invalid Avalon Finance adapter export (#22263) Co-authored-by: Masha --- projects/avalon-finance/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/avalon-finance/index.js b/projects/avalon-finance/index.js index be509a553a4..2778dda217c 100644 --- a/projects/avalon-finance/index.js +++ b/projects/avalon-finance/index.js @@ -129,4 +129,3 @@ module.exports = mergeExports( ) module.exports.methodology = methodologies.lendingMarket module.exports.merlin.borrowed = async () => ({}) // is insolvent -module.exports.merlin.pharos = async () => ({}) // is insolvent From 2525866adc49cbe1d9bef9ea9c878d6a751a0b44 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 17 Nov 2026 10:55:29 -0400 Subject: [PATCH 804/988] Add Polydash (#22269) Co-authored-by: Polydash <53627236+PolydashDev@users.noreply.github.com> --- projects/polydash/index.js | 105 +++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 projects/polydash/index.js diff --git a/projects/polydash/index.js b/projects/polydash/index.js new file mode 100644 index 00000000000..b526706e189 --- /dev/null +++ b/projects/polydash/index.js @@ -0,0 +1,105 @@ +// Polydash on Robinhood Chain: Polypad launchpad, tokenized fund vaults, and +// permissionless staking pools. +// +// TVL is ETH in launch contracts and commit vaults, plus ETH, WETH and +// mandate-list tokens in fund vaults, plus the stake-token balance of factory +// pools. Pools that stake POLYDASH are reported under `staking`. Reward tokens +// other than the stake token, virtual ETH on bonding curves, and Uniswap liquidity +// after a launch graduates are excluded (graduated liquidity is already +// tracked by the Uniswap adapters). +const ADDRESSES = require('../helper/coreAssets.json') + +const POLYDASH = '0x319525528f42167ef7fc18b77b889958080568e4' +const WETH = ADDRESSES.robinhood.WETH + +const stakingFactories = [ + '0x0aAEa47d2e7303EC5a809062eafa59e7F011D857', // v1 + '0x904b8F5d95B593b5F4a6Dbb116b58e1d5CBe93f0', // v2 +] + +const launchFactories = [ + '0xfDfD0A095966c8B56639f7eAa13f4B0188Fc08c2', // current + '0x2C84cFCD8d283EF750E09Fbed735d67F67845dB2', // earlier +] + +const commitVaults = [ + '0xF013bF17D511E2f65D0dA4Bd320948646F567Ae4', + '0x8f125c9ec7acd52b9cd39f2a7441085559d84104', +] + +// Phase 1a vaults hold only ETH (no mandateAssetCount). Later factories do. +const fundFactoriesEthOnly = [ + '0x6c0094BA60DaA0467Daf81f4D576d74DD3a08878', // FundFactory (phase 1a) +] +const fundFactoriesWithAssets = [ + '0xd3c6ae470c25989cC8d2876c1855fB570B98894E', // FundFactoryInvest (phase 2) + '0xb9BA453677A6b2C49290CfD4D0713502Ec6bF82B', // FundFactoryPhase3 + '0xB5251BaC3CFE2A057B7703D4477Bf80f10B8154B', // FundFactoryPhase3V3 +] + +const listAbi = (lengthAbi, itemAbi) => ({ lengthAbi, itemAbi }) +const launchList = listAbi('uint256:allLaunchesLength', 'function allLaunches(uint256) view returns (address)') +const fundList = listAbi('uint256:allFundsLength', 'function allFunds(uint256) view returns (address)') +const poolList = listAbi('uint256:poolsLength', 'function allPools(uint256) view returns (address)') + +async function fetchAll(api, targets, abis) { + const out = [] + for (const target of targets) + out.push(...await api.fetchList({ ...abis, target })) + return out +} + +async function getPools(api) { + const pools = await fetchAll(api, stakingFactories, poolList) + if (!pools.length) return [] + const tokens = await api.multiCall({ abi: 'address:stakeToken', calls: pools }) + return pools.map((pool, i) => [tokens[i], pool]) +} + +const isPolydash = ([token]) => token.toLowerCase() === POLYDASH + +async function getFundVaults(api, factories) { + const funds = await fetchAll(api, factories, fundList) + if (!funds.length) return [] + return api.multiCall({ abi: 'address:vault', calls: funds }) +} + +async function tvl(api) { + const pools = await getPools(api) + await api.sumTokens({ tokensAndOwners: pools.filter((pool) => !isPolydash(pool)) }) + + const launches = await fetchAll(api, launchFactories, launchList) + const vaultsEthOnly = await getFundVaults(api, fundFactoriesEthOnly) + const vaultsWithAssets = await getFundVaults(api, fundFactoriesWithAssets) + + const tokens = [ADDRESSES.null, WETH] + if (vaultsWithAssets.length) { + const counts = await api.multiCall({ abi: 'uint256:mandateAssetCount', calls: vaultsWithAssets }) + const assetCalls = [] + vaultsWithAssets.forEach((vault, i) => { + const n = Number(counts[i]) + for (let j = 0; j < n; j++) assetCalls.push({ target: vault, params: [j] }) + }) + if (assetCalls.length) { + const assets = await api.multiCall({ abi: 'function mandateAssets(uint256) view returns (address)', calls: assetCalls }) + assets.forEach((t) => { + if (t && t.toLowerCase() !== POLYDASH) tokens.push(t) + }) + } + } + + await api.sumTokens({ + owners: [...launches, ...commitVaults, ...vaultsEthOnly, ...vaultsWithAssets], + tokens: [...new Set(tokens.map((t) => t.toLowerCase()))], + }) +} + +async function staking(api) { + const pools = await getPools(api) + return api.sumTokens({ tokensAndOwners: pools.filter(isPolydash) }) +} + +module.exports = { + methodology: 'TVL is ETH held by Polypad launch contracts and commit vaults, plus ETH, WETH and mandate-list tokens (except POLYDASH) held by Polydash tokenized fund vaults, plus the stake-token balance of pools from the v1 and v2 staking factories, which includes rewards a pool holds in its own stake token. Pools that stake POLYDASH are counted as staking. Reward tokens other than the stake token, virtual ETH on bonding curves, and Uniswap liquidity after graduation are excluded.', + robinhood: { tvl, staking }, +} From bf66eafa43de79f98de58406dbf0995fa2a80e03 Mon Sep 17 00:00:00 2001 From: simplefarmer69 Date: Tue, 17 Nov 2026 16:19:18 +0100 Subject: [PATCH 805/988] StonkBrokers: count all locked LP legs incl. STONKBROKER (#22262) Co-authored-by: simplefarmer69 Co-authored-by: simplefarmer69 Co-authored-by: Cursor Co-authored-by: FelixBruguera --- projects/stonkbrokers-smart-lp/index.js | 19 ++++++++---- projects/stonkbrokers/index.js | 40 +++++++++++++++++++------ 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/projects/stonkbrokers-smart-lp/index.js b/projects/stonkbrokers-smart-lp/index.js index e0c389baf6f..da6526747bd 100644 --- a/projects/stonkbrokers-smart-lp/index.js +++ b/projects/stonkbrokers-smart-lp/index.js @@ -1,6 +1,6 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { getLogs2 } = require('../helper/cache/getLogs') -const { liveAt } = require('../stonkbrokers/helpers') +const { keepOnlyTokens, liveAt } = require('../stonkbrokers/helpers') // Smart LP (Volatility Farming): immutable concentrated-liquidity vaults on // canonical Uniswap V3 pools, enumerated from a chain-local registry. @@ -9,10 +9,10 @@ const config = { arbitrum: { registry: '0xFB2eA53b16C07011d4390A2e449385180A54eD5e', nftAddress: '0xC36442b4a4522E871399CD717aBDD847Ab11FE88', fromBlock: 505000000 }, } -// The protocol's own token is tracked under stonkbrokers staking, not TVL. +// The protocol's own token is counted under staking, not TVL. const STONKBROKER = '0xe934e36A439C94017B64a3FecE66AF12099aBF50' -async function tvl(api) { +async function vaultBalances(api) { const { registry, nftAddress, fromBlock } = config[api.chain] if (!liveAt(api, fromBlock)) return // all() is the live listing; a delisted vault keeps its position NFT, so @@ -30,13 +30,22 @@ async function tvl(api) { api.multiCall({ abi: 'address:token1', calls: vaults }), ]) await sumTokens2({ api, ownerTokens: vaults.map((vault, i) => [[token0s[i], token1s[i]], vault]) }) +} + +async function tvl(api) { + await vaultBalances(api) if (api.chain === 'robinhood') api.removeTokenBalance(STONKBROKER) } +async function staking(api) { + await vaultBalances(api) + keepOnlyTokens(api, [STONKBROKER]) +} + module.exports = { methodology: - 'TVL is the Smart LP (Volatility Farming) vaults on Robinhood Chain and Arbitrum One: every vault the registry has ever listed, each owning one Uniswap V3 position NFT (both legs counted) plus idle balances held between compounds. STONKBROKER is excluded from TVL and tracked under StonkBrokers staking.', + 'TVL is the Smart LP (Volatility Farming) vaults on Robinhood Chain and Arbitrum One: every vault the registry has ever listed, each owning one Uniswap V3 position NFT (both legs counted) plus idle balances held between compounds. The STONKBROKER leg of the vaults is excluded from TVL and counted under staking.', doublecounted: true, - robinhood: { start: '2026-09-06', tvl }, + robinhood: { start: '2026-09-06', tvl, staking }, arbitrum: { start: '2026-09-15', tvl }, } diff --git a/projects/stonkbrokers/index.js b/projects/stonkbrokers/index.js index 960743e3008..40e29b28e72 100644 --- a/projects/stonkbrokers/index.js +++ b/projects/stonkbrokers/index.js @@ -1,4 +1,4 @@ -const { sumTokens2, unwrapSlipstreamNFT, sumTokensExport } = require('../helper/unwrapLPs') +const { sumTokens2, unwrapSlipstreamNFT } = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') const { addV4Positions, keepOnlyTokens, liveAt } = require('./helpers') @@ -21,9 +21,20 @@ const STONK_ESCROW = '0x799AE26fA515ceF145e8bC8636F7fFF87B05Cf62' const STONKBROKER = '0xe934e36A439C94017B64a3FecE66AF12099aBF50' const ROBINHOOD_CBBTC = '0xCEC185eB182c47d1bA1EFc84e6959e18cd620Be4' const UP_TOKEN = '0x57C0E45cB534413D1C20A4240955d6bB250BB4F1' // up. DEX token, most of its liquidity sits outside the lockers -// Only the quote side of locked positions counts: the other legs are launched -// tokens whose only price source is the locked pool itself. -const QUOTE_TOKENS = [ADDRESSES.null, ADDRESSES.robinhood.WETH, ADDRESSES.robinhood.USDG, ROBINHOOD_CBBTC, UP_TOKEN] +// Only tokens with a broad market outside the lockers count: the other legs +// are launched tokens whose only price source is the locked pool itself. +const TVL_TOKENS = [ + ADDRESSES.null, ADDRESSES.robinhood.WETH, ADDRESSES.robinhood.USDG, ROBINHOOD_CBBTC, UP_TOKEN, + '0x39dbed3a2bd333467115de45665cc57f813c4571', // PONS + '0x020bfc650a365f8bb26819deaabf3e21291018b4', // CASHCAT + // Robinhood stock tokens + '0xaf3d76f1834a1d425780943c99ea8a608f8a93f9', // AAPL + '0x1b0e319c6a659f002271b69db8a7df2f911c153e', // GME + '0x4a0e65a3eccec6dbe60ae065f2e7bb85fae35eea', // SPCX + '0x2e0847e8910a9732eb3fb1bb4b70a580adad4fe3', // GOOGL + '0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec', // NVDA + '0xa30fa36db767ad9ed3f7a60fc79526fb4d56d344', // USO +] const abi = { v4Lock: 'function lockPositions(uint256) view returns (address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks, int24 tickLower, int24 tickUpper, uint128 initialLiquidity, uint128 withdrawnLiquidity, uint64 startUnlock, uint64 finishUnlock, uint8 feeMode, bool closed)', @@ -63,22 +74,33 @@ async function upV2BoxTvl(api) { await sumTokens2({ api, resolveLP: true }) } -async function tvl(api) { +async function lockerBalances(api) { await sumTokens2({ api, owner: V3_BOX_LOCKER, resolveUniV3: true, uniV3ExtraConfig: { nftAddress: UNI_V3_NFPM } }) // Called directly: the slipstream resolver has no Robinhood default NFPM. await unwrapSlipstreamNFT({ api, owner: UP_CL_BOX_LOCKER, nftAddress: UP_SLIPSTREAM_NFPM }) await v4BoxTvl(api) await upV2BoxTvl(api) - // Keep only the quote legs; this also drops STONKBROKER, tracked under staking. - keepOnlyTokens(api, QUOTE_TOKENS) +} + +async function tvl(api) { + await lockerBalances(api) + // Keep only the listed tokens; this also drops STONKBROKER, tracked under staking. + keepOnlyTokens(api, TVL_TOKENS) +} + +// STONKBROKER in the escrow contract plus the STONKBROKER leg of locked positions. +async function staking(api) { + await lockerBalances(api) + await sumTokens2({ api, owner: STONK_ESCROW, tokens: [STONKBROKER] }) + keepOnlyTokens(api, [STONKBROKER]) } module.exports = { methodology: - 'TVL is the liquidity locked in the Safety Deposit Box lockers on Robinhood Chain: Uniswap V3 position NFTs in the V3 box, up. DEX (Slipstream) positions in the up. CL box (including every Stonklauncher / Safe Launch graduation pool, whose raise + LP tax reserve is locked forever at bond), Uniswap v4 PoolManager positions in the V4 box, and up. V2 LP in the up. V2 box. Only the quote side (ETH, WETH, USDG, cbBTC, UP) of each locked position is counted; launched-token legs stay unpriced and STONKBROKER is excluded from TVL. Staking tracks STONKBROKER tokens in the escrow contract.', + 'TVL is the liquidity locked in the Safety Deposit Box lockers on Robinhood Chain: Uniswap V3 position NFTs in the V3 box, up. DEX (Slipstream) positions in the up. CL box (including every Stonklauncher / Safe Launch graduation pool, whose raise + LP tax reserve is locked forever at bond), Uniswap v4 PoolManager positions in the V4 box, and up. V2 LP in the up. V2 box. Only tokens with a broad market outside the lockers are counted (ETH, WETH, USDG, cbBTC, UP, PONS, CASHCAT and Robinhood stock tokens); other launched-token legs stay unpriced and STONKBROKER is excluded from TVL. Staking tracks STONKBROKER tokens in the escrow contract plus the STONKBROKER leg of the locked positions.', doublecounted: true, robinhood: { tvl, - staking: sumTokensExport({ owner: STONK_ESCROW, tokens: [STONKBROKER] }), + staking, }, } From 8d3d2999652c55a49f04f3674c1ff1da9b81ed96 Mon Sep 17 00:00:00 2001 From: atl4so <86980266+atl4so@users.noreply.github.com> Date: Tue, 17 Nov 2026 15:28:18 +0000 Subject: [PATCH 806/988] Add Trestly (#22268) Co-authored-by: FelixBruguera --- registries/sumTokens.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 0d7519ec5d4..8c510b81ea3 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -28335,6 +28335,21 @@ const configs = { ] }, }, + "trestly": { + "methodology": "TVL is the USDT locked in the Trestly vault on Ethereum and BNB Chain, which backs kUSDT on Kaspa 1:1 (it includes bridge fees not yet withdrawn).", + "ethereum": { + "owner": "0xfa9869982542FB20baD929789B252b7b06EeE10e", + "tokens": [ + ADDRESSES.ethereum.USDT + ] + }, + "bsc": { + "owner": "0xfa9869982542FB20baD929789B252b7b06EeE10e", + "tokens": [ + ADDRESSES.bsc.USDT + ] + }, + }, "tribe-run": { "solana": { "solOwners": [ From 3ce5f5a6dd8ab76f103f714ffb41211de553ebd8 Mon Sep 17 00:00:00 2001 From: max <39312833+fritzschoff@users.noreply.github.com> Date: Tue, 17 Nov 2026 18:40:35 +0000 Subject: [PATCH 807/988] fix tvl calculation (#22271) Co-authored-by: FelixBruguera --- projects/helper/coreAssets.json | 3 ++- projects/raydium/index.js | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index b8246bf3140..5692a811998 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -636,7 +636,8 @@ "BNSOL": "BNso1VUJnh4zcfpZa6986Ea66P6TCp59hvtNJ8b1X85", "bbSOL": "Bybit2vBJGhPF52GBdNaQfUJ6ZpThSgHBobjWZpLPb4B", "JitoSOL": "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn", - "PYUSD": "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo" + "PYUSD": "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo", + "USD1": "USD1ttGY1N17NEEHLmELoaybftRBUSErhqYiQzvEmuB" }, "soon": { "USDT": "742wcXVzkhNuEePAot7L3GvPseh93pvYFPgyHLX8mUy9", diff --git a/projects/raydium/index.js b/projects/raydium/index.js index 1173d6ee801..378ade435c8 100644 --- a/projects/raydium/index.js +++ b/projects/raydium/index.js @@ -171,22 +171,30 @@ async function tvlApi(api) { let hasMore = true let page = 1 const pageSize = 1000 + const smallPools = [] do { const { data: { data } } = await get(`https://api-v3.raydium.io/pools/info/list?poolType=all&poolSortField=liquidity&sortType=desc&pageSize=${pageSize}&page=${page}`) const lastItem = data[data.length - 1] hasMore = data.length === pageSize && lastItem.tvl > 1000 api.log('lastItem', lastItem.tvl, page) data.forEach(({ mintA, mintB, mintAmountA, mintAmountB, tvl, }) => { + const token0Bal = mintAmountA * (10 ** mintA.decimals) + const token1Bal = mintAmountB * (10 ** mintB.decimals) + // Raydium's tvl values a token at the price of its own pool, so for the long tail + // (mostly migrated memecoins next to ~20 SOL) count the core side instead of that usd figure if (tvl < 20_000) { - api.addUSDValue(tvl) + smallPools.push({ token0: mintA.address, token0Bal, token1: mintB.address, token1Bal }) return; } - api.add(mintA.address, mintAmountA * (10 ** mintA.decimals)) - api.add(mintB.address, mintAmountB * (10 ** mintB.decimals)) + api.add(mintA.address, token0Bal) + api.add(mintB.address, token1Bal) }) page++ } while (hasMore) + // core side doubled when the other side is not a core asset; pools with no core asset are skipped + api.addBalances(transformDexBalances({ chain: api.chain, data: smallPools, skipUnknownTokens: true })) + api.removeTokenBalance('DS4QiZfkp39PsHXYCRV3NkyDUKV9SpTczp2qnAUg6Nt6') // ZMB api.removeTokenBalance('HDa3zJc12ahykSsBRvgiWzr6WLEByf36yzKKbVvy4gnF') // SOS api.removeTokenBalance('2xaPstY4XqJ2gUA1mpph3XmvmPZGuTuJ658AeqX3gJ6F') // QUP From d9a1e0399e967396328bb99229f0ff3651c2d4e5 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 17 Nov 2026 14:55:06 -0400 Subject: [PATCH 808/988] Add Hitz (#22274) Co-authored-by: Claude --- projects/treasury/hitz-protocol.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/treasury/hitz-protocol.js diff --git a/projects/treasury/hitz-protocol.js b/projects/treasury/hitz-protocol.js new file mode 100644 index 00000000000..ae1923e3bf2 --- /dev/null +++ b/projects/treasury/hitz-protocol.js @@ -0,0 +1,26 @@ +const { getTokenBalance, sumTokens } = require('../helper/chain/stellar') + +// Sovereign Vault: protocol-owned liquidity, seeded by the admin. No LP shares and no withdrawals +const VAULT = 'CDEISYZM526FZJ4PDWNVKD7UHXFO4ATT46K47YTUQAOLWZQV64ANNBWU' +// admin account, also the treasury +const ADMIN = 'GCAETBNBFKVGLYFXKCLMKT6ZVHFXHRSDFSEW7ODIUJYC6R7H2QJ6OKGU' +const HITZ = 'CBAPZAZNNB4X3VPXV2LYA5RMV7XHXIVREES2GG7R5GUXDZ4R4CKOY4EU' +const XLM = 'CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA' +const USDC = 'CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75' + +async function tvl(api) { + for (const token of [XLM, USDC]) + api.add(token, await getTokenBalance(token, VAULT)) + return sumTokens({ api, owner: ADMIN }) +} + +async function ownTokens(api) { + for (const owner of [VAULT, ADMIN]) + api.add(HITZ, await getTokenBalance(HITZ, owner)) +} + +module.exports = { + timetravel: false, + methodology: 'XLM and USDC held by the Sovereign Vault and the admin account. HITZ held by both is reported as ownTokens.', + stellar: { tvl, ownTokens }, +} From 67e0fb1e0e9f4fab35bb315711ae276361dd51b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomislav=20Glava=C5=A1?= <18212907+tomoglava@users.noreply.github.com> Date: Tue, 17 Nov 2026 20:27:24 +0100 Subject: [PATCH 809/988] Add Coffer Protocol (#22264) Co-authored-by: FelixBruguera --- projects/coffer-protocol/index.js | 82 +++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 projects/coffer-protocol/index.js diff --git a/projects/coffer-protocol/index.js b/projects/coffer-protocol/index.js new file mode 100644 index 00000000000..5e2bbc25319 --- /dev/null +++ b/projects/coffer-protocol/index.js @@ -0,0 +1,82 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs } = require('../helper/cache/getLogs') +const { getStakedEthTVL } = require('../helper/utils') + +const FACTORY = '0x619BE899317C58abEe3c0CE3c6D6A605221dD26f' +const FACTORY_DEPLOY_BLOCK = 26106422 + +const abi = { + cofferIssued: 'event CofferIssued(address indexed owner, address indexed cofferAddress, bytes32 indexed publicKeyPart1, bytes16 publicKeyPart2, uint32 interestRate, uint32 minimumDuration, uint32 maximumDuration, uint128 minimumValueToAccept, uint16 issueSizeBufferBps, uint128 issueSize)', + bondBought: 'event BondBought(address indexed holderAddress, uint256 indexed bondId, uint128 indexed bondMaturityValue, uint32 duration, uint128 principal, uint32 interestRate)', + redemptionEscrow: 'address:I_COFFER_REDEMPTION_ESCROW_ADDRESS', + validatorConditions: 'function sValidatorConditions() view returns (uint128 issueSize, uint32 interestRate, uint32 minimumDuration, uint32 maximumDuration, uint128 minimumValueToAccept, uint32 version, uint32 outstandingBonds, uint16 issueSizeBufferBps, bool isActive, bool validatorDefaulted)', + holderConditions: 'function sHolderConditions(uint256 bondId) view returns (uint128 bondMaturityValue, uint32 duration, uint32 startTimestamp)', +} + +// Every Coffer the factory deployed, with its creation block +async function getCoffers(api) { + const logs = await getLogs({ api, target: FACTORY, eventAbi: abi.cofferIssued, fromBlock: FACTORY_DEPLOY_BLOCK, extraKey: 'coffer-issued' }) + return logs.map(({ args, blockNumber }) => ({ + address: args.cofferAddress.toLowerCase(), + fromBlock: blockNumber, + })) +} + +async function tvl(api) { + const coffers = await getCoffers(api) + const escrow = await api.call({ target: FACTORY, abi: abi.redemptionEscrow }) + // beacon-chain balance of the validators whose withdrawal credentials point at a Coffer + await getStakedEthTVL({ withdrawalAddresses: coffers.map(i => i.address) })(api) + // ETH in the Coffers (bond funding, consensus-layer withdrawals) and in the escrow (redeemed bonds awaiting claims) + return api.sumTokens({ owners: [...coffers.map(i => i.address), escrow], tokens: [ADDRESSES.null] }) +} + +// Outstanding bonds at what the validator owes today: principal plus the interest accrued so far. A default +// makes every bond claimable at once, so a defaulted Coffer's bonds count at their full remaining value. +async function borrowed(api) { + const coffers = await getCoffers(api) + const conditions = await api.multiCall({ abi: abi.validatorConditions, calls: coffers.map(i => i.address) }) + const coffersWithBonds = coffers + .map((coffer, i) => ({ ...coffer, defaulted: conditions[i].validatorDefaulted, outstanding: +conditions[i].outstandingBonds })) + .filter(i => i.outstanding > 0) + + const bonds = [] + for (const coffer of coffersWithBonds) { + const purchases = await getLogs({ + api, target: coffer.address, eventAbi: abi.bondBought, fromBlock: coffer.fromBlock, onlyArgs: true, extraKey: 'bond-bought', + }) + purchases.forEach(bond => bonds.push({ coffer, bond })) + } + const live = await api.multiCall({ + abi: abi.holderConditions, + calls: bonds.map(({ coffer, bond }) => ({ target: coffer.address, params: [bond.bondId] })), + }) + + const now = BigInt(api.timestamp ?? Math.floor(Date.now() / 1e3)) + let owed = 0n + bonds.forEach(({ coffer, bond }, i) => { + const remaining = BigInt(live[i].bondMaturityValue) + if (remaining === 0n) return // settled + if (coffer.defaulted) { + owed += remaining + return + } + const principal = BigInt(bond.principal) + const maturityValue = BigInt(bond.bondMaturityValue) + const duration = BigInt(live[i].duration) + const start = BigInt(live[i].startTimestamp) + const elapsed = now > start ? now - start : 0n + const accrued = elapsed >= duration ? maturityValue : principal + (maturityValue - principal) * elapsed / duration + owed += accrued < remaining ? accrued : remaining + }) + api.addGasToken(owed) +} + +module.exports = { + methodology: "TVL is the ETH backing Coffer bonds. It counts the beacon-chain balance of the validators whose withdrawal credentials point at a Coffer contract, plus ETH held by the Coffer contracts and by the redemption escrow awaiting holder claims. Deposits still in the beacon deposit queue are not counted. Bond purchases are paid out to validators, so outstanding bonds are reported as borrowed, valued at principal plus interest accrued to date, or at full remaining value once a Coffer is in default. Protocol fees held by FeeCurve and the marketplace are excluded.", + timetravel: false, // validator balances come from a live beacon node, so past dates can't be recomputed + ethereum: { + tvl, + borrowed, + }, +} From 826a8fbcc036de06935c3c080d10a49faf2ee8ce Mon Sep 17 00:00:00 2001 From: Jack Sisson <65562790+SissonJ@users.noreply.github.com> Date: Tue, 17 Nov 2026 14:43:03 -0500 Subject: [PATCH 810/988] Remove dYdX MegaVault from Gauntlet TVL (#22273) --- projects/gauntlet/index.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/projects/gauntlet/index.js b/projects/gauntlet/index.js index 8c429bf6500..7e3008f93cd 100644 --- a/projects/gauntlet/index.js +++ b/projects/gauntlet/index.js @@ -1,5 +1,4 @@ const { getCuratorExport, kaminoLendVaultTvl } = require("../helper/curators"); -const axios = require('axios'); // const aeraV3 = require('../aera-v3') // excluded till we find a way to exclude deposits from aera-v3 into other gauntlet curated vaults const coreAssets = require('../helper/coreAssets.json') @@ -289,21 +288,9 @@ async function tvl(api) { await kaminoLendVaultTvl(api, { adminAddress: GAUNTLET_ADMIN }) } -async function megavaultTvl(api) { - const url = "https://indexer.dydx.trade/v4/vault/v1/megavault/historicalPnl?resolution=hour"; - const { data } = await axios.get(url, { headers: { 'Accept': 'application/json' } }); - const pnlArr = data.megavaultPnl; - if (!pnlArr || !pnlArr.length) return; - const currentTvl = Number(pnlArr[pnlArr.length - 1].equity); - - // Report as USD Coin using coingecko identifier - api.add(ADDRESSES.ethereum.USDC, (currentTvl * 1e6).toFixed(0)); -} - async function combinedEthereumTvl(api) { const curatorExport = getCuratorExport(configs); if (curatorExport.ethereum?.tvl) await curatorExport.ethereum.tvl(api); - await megavaultTvl(api); // await aeraV3.ethereum.tvl(api); // remove bad debt from Resolv hack From 7d89383a58eca6b841fdaa4867a0f26f0d775c15 Mon Sep 17 00:00:00 2001 From: "Kacper K." Date: Tue, 17 Nov 2026 21:08:13 +0100 Subject: [PATCH 811/988] Team Finance: add vesting and stop counting Blast after the halt (#22267) --- projects/team-finance/api.js | 2 ++ projects/team-finance/index.js | 28 ++++++++++++++- projects/team-finance/vestingConfig.js | 47 ++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 projects/team-finance/vestingConfig.js diff --git a/projects/team-finance/api.js b/projects/team-finance/api.js index 679f675437c..c8173aefa11 100644 --- a/projects/team-finance/api.js +++ b/projects/team-finance/api.js @@ -1,11 +1,13 @@ const { getExports } = require('../helper/heroku-api') const indexExports = require('./index') const chainKeys = Object.keys(indexExports).filter(chain => typeof indexExports[chain] === 'object' && indexExports[chain].tvl) +const vestingChains = chainKeys.filter(chain => indexExports[chain].vesting) module.exports = { misrepresentedTokens: true, timetravel: false, ...getExports("team-finance", chainKeys), + ...getExports("team-finance", vestingChains, ['vesting']), // hallmarks: [ // ['2022-10-27',"$14.5m Exploit"] // ], diff --git a/projects/team-finance/index.js b/projects/team-finance/index.js index b4a1ec67235..6d08a89d8e1 100644 --- a/projects/team-finance/index.js +++ b/projects/team-finance/index.js @@ -2,7 +2,9 @@ const { getCache, setCache, } = require("../helper/cache") const { vestingHelper, } = require("../helper/unknownTokens") const { getCoreAssets, getUniqueAddresses, } = require("../helper/tokenMapping") const { getSqrtPriceX96AtTick, } = require("../helper/utils/tick") +const { getLogs2, } = require("../helper/cache/getLogs") const config = require("./config") +const vestingConfig = require("./vestingConfig") const project = 'bulky/team-finance' @@ -152,6 +154,22 @@ async function addV3Positions({ api, nftAddress, positions, whitelistedTokens, i } } +const vestingCreatedEvent = 'event VestingCreated(address indexed creator, address vestingAddr, address indexed token, bytes32 merkleRoot, uint256 totalAmount, uint256 fee)' +const vestingFactoryV2 = '0x65d22f2b883f4527ba64d6f5123cb4f04cccae98' +const vestingV2CreatedEvent = 'event VestingCreated(address indexed creator, address vestingAddr, address indexed token, bytes32 merkleRoot, uint256 start, uint256 end, uint256 totalAmount, uint256 fee)' + +async function vesting(api) { + const { fromBlock, factories, v2FromBlock, blacklistedTokens = [], } = vestingConfig[api.chain] + const sources = factories.map(factory => ({ factory, eventAbi: vestingCreatedEvent, fromBlock, })) + if (v2FromBlock) sources.push({ factory: vestingFactoryV2, eventAbi: vestingV2CreatedEvent, fromBlock: v2FromBlock, }) + const tokensAndOwners = [] + for (const { factory, eventAbi, fromBlock } of sources) { + const logs = await getLogs2({ api, factory, eventAbi, fromBlock, }) + logs.forEach(({ token, vestingAddr }) => tokensAndOwners.push([token, vestingAddr])) + } + return api.sumTokens({ tokensAndOwners, blacklistedTokens, }) +} + function getPositionAmounts({ tickLower, tickUpper, liquidity }, sqrtPriceX96) { const sp = Number(sqrtPriceX96) / 2 ** 96 const sa = Number(getSqrtPriceX96AtTick(+tickLower)) / 2 ** 96 @@ -166,7 +184,8 @@ module.exports = { methodology: `Counts each LP pair's native token and stable balance, adjusted to reflect locked pair's value. Balances and merged across multiple locker to return sum TVL per chain. - Locked Uniswap V3 style positions count their native token and stable side the same way`, + Locked Uniswap V3 style positions count their native token and stable side the same way. + Vesting counts the tokens still held by vesting contracts deployed through the Team Finance vesting factories`, misrepresentedTokens: true, isHeavyProtocol: true, }; @@ -174,3 +193,10 @@ module.exports = { Object.keys(config).forEach(chain => { module.exports[chain] = { tvl } }) + +const blastHaltedAt = Date.parse('2026-11-17') / 1e3 +module.exports.blast = { tvl: async (api) => !api.timestamp || api.timestamp >= blastHaltedAt ? {} : tvl(api) } + +Object.keys(vestingConfig).forEach(chain => { + module.exports[chain] = { tvl: module.exports[chain]?.tvl ?? (() => ({})), vesting } +}) diff --git a/projects/team-finance/vestingConfig.js b/projects/team-finance/vestingConfig.js new file mode 100644 index 00000000000..873865b3221 --- /dev/null +++ b/projects/team-finance/vestingConfig.js @@ -0,0 +1,47 @@ +const v3 = '0x64d06dcc12fa07e302f052a9f5bc1aa11e29d9e2' +const v4 = '0xd1ebaa101867b3df136640c843d69a4646613fed' + +module.exports = { + ethereum: { + fromBlock: 15368035, v2FromBlock: 15297897, factories: [v3, v4], + blacklistedTokens: [ + '0x3c41c80b966b92d345dc8fc91e5508bc7248da6e', // CST + '0x44a8701fb5c8c22b90d839363e6c2b2c1a58a525', // ANOA + '0x83f4389ccce1cc044dd7441add33c4f28b967434', // DRX + '0x58412ae274f2764b71c66315d97662d47d930d94', // NEX + '0x0f719591e2bcb6fcc3e68b16d2a88c89c6ae0d42', // EVOLVE + '0x1337b164d318234ccafc3b06c726f522314b2799', // BIG + ], + }, + bsc: { + fromBlock: 19909467, v2FromBlock: 20244767, factories: ['0xd5d3d09997e005a05477a52b2eaf98d9276655a7', v3, v4], + blacklistedTokens: [ + '0xb583961e033dfe0fff161952f7ba21c411b6103d', // YOU + '0xdf5c227ab75d309d46fb9df0f7fa043e4534d2ab', // GBCK + '0xad600060a153bc35bd8997cefe959efb19026757', // GAG + '0xf117dfcb241c0003d5e2fc72f288755c17a46980', // SIXP + ], + }, + base: { fromBlock: 2951440, factories: [v3, v4], }, + arbitrum: { fromBlock: 124267770, factories: [v3, v4], }, + polygon: { fromBlock: 30715517, v2FromBlock: 31637453, factories: [v3, v4], }, + avax: { fromBlock: 18393367, v2FromBlock: 18350097, factories: [v3, v4], }, + fantom: { fromBlock: 69441842, v2FromBlock: 46365810, factories: [v3, v4], }, + mantle: { fromBlock: 18080827, factories: [v3, v4], }, + pulse: { fromBlock: 15141503, factories: [v3, '0xf44c89b6846c8a9bc068899513fbf27ac1c23a96'], }, + kava: { fromBlock: 1982214, v2FromBlock: 1912675, factories: ['0xd5d3d09997e005a05477a52b2eaf98d9276655a7', v4], }, + flare: { + fromBlock: 32116891, factories: ['0x6dd27f2b82f78dd8a802a9228f340518280359f1'], + blacklistedTokens: [ + '0x657097cc15fdec9e383db8628b57ea4a763f2ba0', // SPRK + ], + }, + klaytn: { fromBlock: 170539718, factories: ['0x6dd27f2b82f78dd8a802a9228f340518280359f1'], }, + era: { fromBlock: 13265113, factories: ['0xb5ded5774bb01b22a06e58a06917ef1f10b2f61a', '0x2d45b63e04b1fb612e3df1ccd66b81ee10c6a5d5'], }, + lukso: { fromBlock: 4796196, factories: [v4], }, + berachain: { fromBlock: 4083978, factories: [v4], }, + unichain: { fromBlock: 17091208, factories: [v4], }, + monad: { fromBlock: 100676245, factories: ['0x00c6b2512eefea1f56c60f7e504437ad698162de'], }, + robinhood: { fromBlock: 21499903, factories: ['0x49ca925aed111385b09675524ffc047873d3baab'], }, + arc: { fromBlock: 21000052, factories: ['0xdee913d8d3de17a9810fddfe9951caf5d6c55faa'], }, +} From c4c7ae13cb86c658fa34c62053afe64cdec78ba4 Mon Sep 17 00:00:00 2001 From: tyler-tsai <15355143+tyler-tsai@users.noreply.github.com> Date: Wed, 18 Nov 2026 14:58:29 +0800 Subject: [PATCH 812/988] lista-lending: add Robinhood Chain (#22281) --- projects/lista-lending/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/lista-lending/index.js b/projects/lista-lending/index.js index 1bb5789b19e..624bdcbc882 100644 --- a/projects/lista-lending/index.js +++ b/projects/lista-lending/index.js @@ -6,6 +6,7 @@ const MARKET_LIST_URL = 'https://api.lista.org/api/moolah/borrow/marketList?page const config = { bsc: { vault: '0x8F73b65B4caAf64FBA2aF91cC5D4a2A1318E5D8C' }, ethereum: { vault: '0xf820fB4680712CD7263a0D3D024D5b5aEA82Fd70', start: 1758872495 }, // vault deployed at block 23445769 (2025-09-26) + robinhood: { vault: '0xE4153Eb04417bE05b8d6B2222E4Cdd8AE674ee76', start: 1793763789 }, // first markets created at block 105594769 (2026-11-04) } // Curator vaults counted under their own listing; their pro-rata market share is removed here to avoid double counting. From 648c86d537e7389e88f2331ec5660e34e326e687 Mon Sep 17 00:00:00 2001 From: yochabar <126473352+yochabar@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:06:06 +0300 Subject: [PATCH 813/988] Add Xyper Market TVL on Unit Zero (#22275) Co-authored-by: yochabar Co-authored-by: ccipherx --- projects/xyper-market/index.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 projects/xyper-market/index.js diff --git a/projects/xyper-market/index.js b/projects/xyper-market/index.js new file mode 100644 index 00000000000..e5283e2fff0 --- /dev/null +++ b/projects/xyper-market/index.js @@ -0,0 +1,20 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +const config = { + unit0: { factory: '0x6b88edbf234b51da7acea033a4572973f67ea957', fromBlock: 10512200 }, +} + +async function tvl(api) { + const { factory, fromBlock } = config[api.chain] + if (await api.getBlock() < fromBlock) return + const campaigns = await getLogs2({ + api, target: factory, fromBlock, + eventAbi: 'event CampaignCreated(address indexed campaign, address indexed creator, address indexed token, bytes32 campaignUuid, address projectReferrer, uint256 grossDeposit, uint256 protocolFee, uint256 netDeposit, uint16 protocolBps)', + }) + return api.sumTokens({ tokensAndOwners: campaigns.map(({ token, campaign }) => [token, campaign]) }) +} + +module.exports = { + methodology: 'Counts remaining reward-token balances in campaign escrow contracts created by the canonical Xyper Market CampaignFactory. Campaigns are discovered from on-chain CampaignCreated events. Paid rewards, protocol fee recipients, referral and partner distribution vaults, points, and testnets are excluded. Native deposits are wrapped by the factory and counted only as the campaign ERC-20 balance.', + ...Object.fromEntries(Object.keys(config).map(chain => [chain, { tvl }])), +} From 91e9b101ebe105cc9311e199abbf89769a498111 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:14:34 +0400 Subject: [PATCH 814/988] starknet, sonic, adi bridges: own token as staking (#22270) Co-authored-by: Grok 4.7 (Cursor) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/sonic-gateway/index.js | 43 +- registries/sumTokens.js | 993 ++++++++++++++++---------------- registries/txBridge.js | 44 +- 3 files changed, 562 insertions(+), 518 deletions(-) diff --git a/projects/sonic-gateway/index.js b/projects/sonic-gateway/index.js index 66a1430c7cb..56df1c178b7 100644 --- a/projects/sonic-gateway/index.js +++ b/projects/sonic-gateway/index.js @@ -1,30 +1,29 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); const ADDRESSES = require('../helper/coreAssets.json') -module.exports = { - ethereum: { - tvl: async (api) => { - const swapDate = '2025-11-01' - const bridge = '0xa1E2481a9CD0Cb0447EeB1cbc26F1b3fff3bec20' +// FTM locked in the gateway is priced as native S from this date +const swapDate = '2025-11-01' +const bridge = '0xa1E2481a9CD0Cb0447EeB1cbc26F1b3fff3bec20' - // we convert ftm tokens to sonic after the swap date - if (api.timestamp < new Date(swapDate) / 1e3) { - return sumTokens2({ - api, - owner: bridge, - fetchCoValentTokens: true, - }) - } +async function tvl(api) { + return sumTokens2({ + api, + owner: bridge, + blacklistedTokens: [ADDRESSES.ethereum.FTM], + fetchCoValentTokens: true, + }) +} - await sumTokens2({ - api, - owner: bridge, - blacklistedTokens: [ADDRESSES.ethereum.FTM], - fetchCoValentTokens: true, - }) +async function staking(api) { + const ftmBalance = await api.call({ abi: 'erc20:balanceOf', target: ADDRESSES.ethereum.FTM, params: bridge }) + if (api.timestamp < new Date(swapDate) / 1e3) api.add(ADDRESSES.ethereum.FTM, ftmBalance) + else api.add('sonic:' + ADDRESSES.null, ftmBalance, { skipChain: true }) +} - const ftmBalance = await api.call({ abi: 'erc20:balanceOf', target: ADDRESSES.ethereum.FTM, params: bridge }) - api.add('sonic:' + ADDRESSES.null, ftmBalance, { skipChain: true }) - }, +module.exports = { + methodology: "Counts assets escrowed in the Sonic Gateway TokenDeposit on Ethereum. The gateway's FTM is Sonic's own token and is counted under staking, priced as native S from 2025-11-01.", + ethereum: { + tvl, + staking, }, }; diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 8c510b81ea3..9a91626678b 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -26282,501 +26282,508 @@ const configs = { }, }, "starknet": { + "methodology": "Counts assets escrowed on Ethereum in StarkGate token bridges. STRK is Starknet's own token and is counted under staking.", "ethereum": { - "tokensAndOwners": [ - [ - "0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766", - "0xcE5485Cfb26914C5dcE00B9BAF0580364daFC7a4" - ], - [ - ADDRESSES.ethereum.WBTC, - "0x283751A21eafBFcD52297820D27C1f1963D9b5b4" - ], - [ - ADDRESSES.ethereum.USDC, - "0xF6080D9fbEEbcd44D89aFfBFd42F098cbFf92816" - ], - [ - ADDRESSES.ethereum.USDT, - "0xbb3400F107804DFB482565FF1Ec8D8aE66747605" - ], - [ - ADDRESSES.GAS_TOKEN_2, - "0xae0Ee0A63A2cE6BaeEFFE56e7714FB4EFE48D419" - ], - [ - ADDRESSES.ethereum.DAI, - "0xCA14057f85F2662257fd2637FdEc558626bCe554" - ], - [ - ADDRESSES.ethereum.DAI, - "0x9F96fE0633eE838D0298E8b8980E6716bE81388d" - ], - [ - ADDRESSES.ethereum.WSTETH, - "0xBf67F59D2988A46FBFF7ed79A621778a3Cd3985B" - ], - [ - ADDRESSES.ethereum.RETH, - "0xcf58536D6Fab5E59B654228a5a4ed89b13A876C2" - ], - [ - "0x183015a9bA6fF60230fdEaDc3F43b3D788b13e21", - "0xb27d0dCAFd63db302C155c8864886f33BD2a41E5" - ], - [ - ADDRESSES.ethereum.FRAX, - "0xDc687e1E0B85CB589b2da3C47c933De9Db3d1ebb" - ], - [ - ADDRESSES.ethereum.FXS, - "0x66ba83ba3D3AD296424a2258145d9910E9E40B7C" - ], - [ - ADDRESSES.ethereum.sfrxETH, - "0xd8E8531fdD446DF5298819d3Bc9189a5D8948Ee8" - ], - [ - ADDRESSES.ethereum.LUSD, - "0xF3F62F23dF9C1D2C7C63D9ea6B90E8d24c7E3DF5" - ], - [ - ADDRESSES.ethereum.UNI, - "0xf76e6bF9e2df09D0f854F045A3B724074dA1236B" - ], - [ - ADDRESSES.ethereum.tBTC, - "0x2111A49ebb717959059693a3698872a0aE9866b9" - ], - [ - "0x582d872A1B094FC48F5DE31D3B73F2D9bE47def1", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.WETH, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x2AF5D2aD76741191D15Dfe7bF6aC92d4Bd912Ca3", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xaea46A60368A7bD060eec7DF8CBa43b7EF41Ad85", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.POL, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.FDUSD, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.USDe, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x75231F58b43240C9718Dd58B4967c5114342a86c", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.AAVE, - "0x3cDe3eE221aD64d096C92e0F750Feb8A750519A8" - ], - [ - "0xA0b73E1Ff0B80914AB6fe0444E65848C4C34450b", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x6De037ef9aD2725EB40118Bb1702EBb27e4Aeb24", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x3c3a81e81dc49A522A592e7622A7E711c06bf354", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.FTM, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xc944E90C64B2c07662A292be6244BDf05Cda44a7", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x1151CB3d861920e07a38e03eEAd12C32178567F6", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.METH, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x3593D125a4f7849a1B059E64F4517A86Dd60c95d", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xfAbA6f8e4a5E8Ab82F62fe7C39859FA577269BE3", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x4a220E6096B25EADb88358cb44068A3248254675", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x7420B4b9a0110cdC71fB720908340C03F9Bc03EC", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.LIDO, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x163f8C2467924be0ae7B5347228CABF260318753", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xC669928185DbCE49d2230CC9B0979BE6DC797957", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xB0fFa8000886e57F86dd5264b9582b2Ad87b2b91", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xaeDf386B755465871fF874E3E37Af5976E247064", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x62D0A8458eD7719FDAF978fe5929C6D342B0bFcE", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.linea.rzETH, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x57e114B691Db790C35207b2e685D4A43181e6061", - "0xEa90D8aE0Fe18a8aF72E57EFDDfE819aa96f244E" - ], - [ - "0xd1d2Eb1B1e90B638588728b4130137D262C87cae", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x0C10bF8FcB7Bf5412187A595ab97a3609160b5c6", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xBB0E17EF65F82Ab018d8EDd776e8DD940327B28b", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x667102BD3413bFEaa3Dffb48fa8288819E480a88", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x68749665FF8D2d112Fa859AA293F07A622782F38", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x808507121B80c02388fAd14726482e061B8da827", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x3845badAde8e6dFF049820680d1F14bD3903a5d0", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.EIGEN, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x3506424F91fD33084466F402d5D97f05F8e3b4AF", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x0F5D2fB29fb7d3CFeE444a200298f468908cC942", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x467719aD09025FcC6cF6F8311755809d45a5E5f3", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x626E8036dEB333b408Be468F951bdB42433cBF18", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x4d224452801ACEd8B2F0aebE155379bb5D594381", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.SNX, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xb23d80f5FefcDDaa212212F028021B41DEd428CF", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xe53EC727dbDEB9E2d5456c3be40cFF031AB40A55", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xde4EE8057785A7e8e800Db58F9784845A5C2Cbd6", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.SAFE, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x5E8422345238F34275888049021821E8E08CAa1f", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x5283D291DBCF85356A21bA090E6db59121208b44", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x58b6A8A3302369DAEc383334672404Ee733aB239", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.GNO, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x812Ba41e071C7b7fA4EBcFB62dF5F45f6fA853Ee", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x198d14F2Ad9CE69E76ea330B374DE4957C3F850a", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x92D6C1e31e14520e676a687F0a93788B716BEff5", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xc00e94Cb662C3520282E6f5717214004A7f26888", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x6E2a43be0B1d33b726f0CA3b8de60b3482b8b050", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xA9E8aCf069C58aEc8825542845Fd754e41a9489A", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xA35923162C49cF95e6BF26623385eb431ad920D3", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x7A58c0Be72BE218B41C608b7Fe7C5bB630736C71", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x54D2252757e1672EEaD234D27B1270728fF90581", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xE0f63A424a4439cBE457D80E4f4b51aD25b2c56C", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x44ff8620b8cA30902395A7bD3F2407e1A091BF73", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.CRV, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x6c6EE5e31d828De241282B9606C8e98Ea48526E2", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x111111111117dC0aa78b770fA6A738034120C302", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x45804880De22913dAFE09f4980848ECE6EcbAf78", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x1F069f80983c4A5922CaaA69Ce7e1640D29D1557", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xb2606492712D311be8f41d940AFE8CE742A52D44", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.celo.STEUR, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x04C46E830Bb56ce22735d5d8Fc9CB90309317d0f", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x72e364F2ABdC788b7E918bc238B21f109Cd634D7", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x610dBd98A28EbbA525e9926b6aaF88f9159edbfd", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xb23a076D4d6507bb309607026Ce5FdF8b45E155f", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.BNB, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x85F17Cf997934a597031b2E18a9aB6ebD4B9f6a4", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.MATIC, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x6982508145454Ce325dDbE47a25d4ec3d2311933", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.INU, - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xcf0C122c6b73ff809C693DB761e7BaeBe62b6a2E", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x576e2BeD8F7b46D34016198911Cdf9886f78bea7", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xaf8E1AD06Fd19652299CFfd7e39c13e96acA4765", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x96395fa6069e769A852EC6E28cb837da72d145f3", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - ADDRESSES.ethereum.LINK, - "0x9FaDA9F29492Af64A852f35EAfd957b790B7ea7E" - ], - [ - "0x3073f7aAA4DB83f95e9FFf17424F71D4751a3073", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xcb1592591996765Ec0eFc1f92599A19767ee5ffA", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x320623b8E4fF03373931769A31Fc52A4E78B5d70", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e", - "0x9aAA37e5bf214E6446Bb7f1690876410C996860e" - ], - [ - "0x6A9A65B84843F5fD4aC9a0471C4fc11AFfFBce4a", - "0x30A155a161f6b5f4C0226C3744C4d69eEfDbf483" - ], - [ - "0x7A56E1C57C7475CCf742a1832B028F0456652F97", - "0xA86b9b9c58d4f786F8ea89356c9c9Dde9432Ab10" - ], - [ - "0x275bf5c13DE6a96aE1718bBb053AB1ADb006e867", - "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" - ], - [ - "0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110", - "0x6F3229B9056bC42F147f309B10877cC5919EeFd5" - ], - [ - "0x6985884C4392D348587B19cb9eAAf157F13271cd", - "0x52c65B6795216c4D76fAcACdE8B5f4BAd2c9b9d7" - ], - [ - "0x004E9C3EF86bc1ca1f0bB5C7662861Ee93350568", - "0x4ea91eD5A1f5e2Be18791F210C52d0fe285744d5" - ], - [ - "0x2eC37d45FCAE65D9787ECf71dc85a444968f6646", - "0x1febb800fa36938Fdb6131c643C72dfAB91633bb" - ], - [ - ADDRESSES.ethereum.LBTC, - "0x96C8AE2AC9A5cd5fC354e375dB4d0ca75fc0685e" - ], - [ - "0x9FB442d6B612a6dcD2acC67bb53771eF1D9F661A", - "0x7a095101eF5c7a66056f801335F8605d3b2452a5" - ], - [ - "0x76aAb5FD2243d99EAc92d4d9EBF23525d3ACe4Ec", - "0x448Acb9F2e57a409a60Cf8901EA4123b6E2EC253" - ], - [ - "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c", - "0x00b0466f8dC04B0782DbF1A1DfdCe333F0Dd082B" - ], - [ - ADDRESSES.ethereum.DAI, - "0x0437465dfb5B79726e35F08559B0cBea55bb585C" + "tvl": { + "tokensAndOwners": [ + [ + ADDRESSES.ethereum.WBTC, + "0x283751A21eafBFcD52297820D27C1f1963D9b5b4" + ], + [ + ADDRESSES.ethereum.USDC, + "0xF6080D9fbEEbcd44D89aFfBFd42F098cbFf92816" + ], + [ + ADDRESSES.ethereum.USDT, + "0xbb3400F107804DFB482565FF1Ec8D8aE66747605" + ], + [ + ADDRESSES.GAS_TOKEN_2, + "0xae0Ee0A63A2cE6BaeEFFE56e7714FB4EFE48D419" + ], + [ + ADDRESSES.ethereum.DAI, + "0xCA14057f85F2662257fd2637FdEc558626bCe554" + ], + [ + ADDRESSES.ethereum.DAI, + "0x9F96fE0633eE838D0298E8b8980E6716bE81388d" + ], + [ + ADDRESSES.ethereum.WSTETH, + "0xBf67F59D2988A46FBFF7ed79A621778a3Cd3985B" + ], + [ + ADDRESSES.ethereum.RETH, + "0xcf58536D6Fab5E59B654228a5a4ed89b13A876C2" + ], + [ + "0x183015a9bA6fF60230fdEaDc3F43b3D788b13e21", + "0xb27d0dCAFd63db302C155c8864886f33BD2a41E5" + ], + [ + ADDRESSES.ethereum.FRAX, + "0xDc687e1E0B85CB589b2da3C47c933De9Db3d1ebb" + ], + [ + ADDRESSES.ethereum.FXS, + "0x66ba83ba3D3AD296424a2258145d9910E9E40B7C" + ], + [ + ADDRESSES.ethereum.sfrxETH, + "0xd8E8531fdD446DF5298819d3Bc9189a5D8948Ee8" + ], + [ + ADDRESSES.ethereum.LUSD, + "0xF3F62F23dF9C1D2C7C63D9ea6B90E8d24c7E3DF5" + ], + [ + ADDRESSES.ethereum.UNI, + "0xf76e6bF9e2df09D0f854F045A3B724074dA1236B" + ], + [ + ADDRESSES.ethereum.tBTC, + "0x2111A49ebb717959059693a3698872a0aE9866b9" + ], + [ + "0x582d872A1B094FC48F5DE31D3B73F2D9bE47def1", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.WETH, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x2AF5D2aD76741191D15Dfe7bF6aC92d4Bd912Ca3", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xaea46A60368A7bD060eec7DF8CBa43b7EF41Ad85", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.POL, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.FDUSD, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.USDe, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x75231F58b43240C9718Dd58B4967c5114342a86c", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.AAVE, + "0x3cDe3eE221aD64d096C92e0F750Feb8A750519A8" + ], + [ + "0xA0b73E1Ff0B80914AB6fe0444E65848C4C34450b", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x6De037ef9aD2725EB40118Bb1702EBb27e4Aeb24", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x3c3a81e81dc49A522A592e7622A7E711c06bf354", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.FTM, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xc944E90C64B2c07662A292be6244BDf05Cda44a7", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x1151CB3d861920e07a38e03eEAd12C32178567F6", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.METH, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x3593D125a4f7849a1B059E64F4517A86Dd60c95d", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xfAbA6f8e4a5E8Ab82F62fe7C39859FA577269BE3", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x4a220E6096B25EADb88358cb44068A3248254675", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x7420B4b9a0110cdC71fB720908340C03F9Bc03EC", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.LIDO, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x163f8C2467924be0ae7B5347228CABF260318753", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xC669928185DbCE49d2230CC9B0979BE6DC797957", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xB0fFa8000886e57F86dd5264b9582b2Ad87b2b91", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xaeDf386B755465871fF874E3E37Af5976E247064", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x62D0A8458eD7719FDAF978fe5929C6D342B0bFcE", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.linea.rzETH, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x57e114B691Db790C35207b2e685D4A43181e6061", + "0xEa90D8aE0Fe18a8aF72E57EFDDfE819aa96f244E" + ], + [ + "0xd1d2Eb1B1e90B638588728b4130137D262C87cae", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x0C10bF8FcB7Bf5412187A595ab97a3609160b5c6", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xBB0E17EF65F82Ab018d8EDd776e8DD940327B28b", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x667102BD3413bFEaa3Dffb48fa8288819E480a88", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x68749665FF8D2d112Fa859AA293F07A622782F38", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x808507121B80c02388fAd14726482e061B8da827", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x3845badAde8e6dFF049820680d1F14bD3903a5d0", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.EIGEN, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x3506424F91fD33084466F402d5D97f05F8e3b4AF", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x0F5D2fB29fb7d3CFeE444a200298f468908cC942", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x467719aD09025FcC6cF6F8311755809d45a5E5f3", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x626E8036dEB333b408Be468F951bdB42433cBF18", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x4d224452801ACEd8B2F0aebE155379bb5D594381", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.SNX, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xb23d80f5FefcDDaa212212F028021B41DEd428CF", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xe53EC727dbDEB9E2d5456c3be40cFF031AB40A55", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xde4EE8057785A7e8e800Db58F9784845A5C2Cbd6", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.SAFE, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x5E8422345238F34275888049021821E8E08CAa1f", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x5283D291DBCF85356A21bA090E6db59121208b44", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x58b6A8A3302369DAEc383334672404Ee733aB239", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.GNO, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x812Ba41e071C7b7fA4EBcFB62dF5F45f6fA853Ee", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x198d14F2Ad9CE69E76ea330B374DE4957C3F850a", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x92D6C1e31e14520e676a687F0a93788B716BEff5", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xc00e94Cb662C3520282E6f5717214004A7f26888", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x6E2a43be0B1d33b726f0CA3b8de60b3482b8b050", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xA9E8aCf069C58aEc8825542845Fd754e41a9489A", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xA35923162C49cF95e6BF26623385eb431ad920D3", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x7A58c0Be72BE218B41C608b7Fe7C5bB630736C71", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x54D2252757e1672EEaD234D27B1270728fF90581", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xE0f63A424a4439cBE457D80E4f4b51aD25b2c56C", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x44ff8620b8cA30902395A7bD3F2407e1A091BF73", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.CRV, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x6c6EE5e31d828De241282B9606C8e98Ea48526E2", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x111111111117dC0aa78b770fA6A738034120C302", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x45804880De22913dAFE09f4980848ECE6EcbAf78", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x1F069f80983c4A5922CaaA69Ce7e1640D29D1557", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xb2606492712D311be8f41d940AFE8CE742A52D44", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.celo.STEUR, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x04C46E830Bb56ce22735d5d8Fc9CB90309317d0f", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x72e364F2ABdC788b7E918bc238B21f109Cd634D7", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x610dBd98A28EbbA525e9926b6aaF88f9159edbfd", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xb23a076D4d6507bb309607026Ce5FdF8b45E155f", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.BNB, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x85F17Cf997934a597031b2E18a9aB6ebD4B9f6a4", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.MATIC, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x6982508145454Ce325dDbE47a25d4ec3d2311933", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.INU, + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xcf0C122c6b73ff809C693DB761e7BaeBe62b6a2E", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x576e2BeD8F7b46D34016198911Cdf9886f78bea7", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xaf8E1AD06Fd19652299CFfd7e39c13e96acA4765", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x96395fa6069e769A852EC6E28cb837da72d145f3", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + ADDRESSES.ethereum.LINK, + "0x9FaDA9F29492Af64A852f35EAfd957b790B7ea7E" + ], + [ + "0x3073f7aAA4DB83f95e9FFf17424F71D4751a3073", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xcb1592591996765Ec0eFc1f92599A19767ee5ffA", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x320623b8E4fF03373931769A31Fc52A4E78B5d70", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e", + "0x9aAA37e5bf214E6446Bb7f1690876410C996860e" + ], + [ + "0x6A9A65B84843F5fD4aC9a0471C4fc11AFfFBce4a", + "0x30A155a161f6b5f4C0226C3744C4d69eEfDbf483" + ], + [ + "0x7A56E1C57C7475CCf742a1832B028F0456652F97", + "0xA86b9b9c58d4f786F8ea89356c9c9Dde9432Ab10" + ], + [ + "0x275bf5c13DE6a96aE1718bBb053AB1ADb006e867", + "0xF5b6Ee2CAEb6769659f6C091D209DfdCaF3F69Eb" + ], + [ + "0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110", + "0x6F3229B9056bC42F147f309B10877cC5919EeFd5" + ], + [ + "0x6985884C4392D348587B19cb9eAAf157F13271cd", + "0x52c65B6795216c4D76fAcACdE8B5f4BAd2c9b9d7" + ], + [ + "0x004E9C3EF86bc1ca1f0bB5C7662861Ee93350568", + "0x4ea91eD5A1f5e2Be18791F210C52d0fe285744d5" + ], + [ + "0x2eC37d45FCAE65D9787ECf71dc85a444968f6646", + "0x1febb800fa36938Fdb6131c643C72dfAB91633bb" + ], + [ + ADDRESSES.ethereum.LBTC, + "0x96C8AE2AC9A5cd5fC354e375dB4d0ca75fc0685e" + ], + [ + "0x9FB442d6B612a6dcD2acC67bb53771eF1D9F661A", + "0x7a095101eF5c7a66056f801335F8605d3b2452a5" + ], + [ + "0x76aAb5FD2243d99EAc92d4d9EBF23525d3ACe4Ec", + "0x448Acb9F2e57a409a60Cf8901EA4123b6E2EC253" + ], + [ + "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c", + "0x00b0466f8dC04B0782DbF1A1DfdCe333F0Dd082B" + ], + [ + ADDRESSES.ethereum.DAI, + "0x0437465dfb5B79726e35F08559B0cBea55bb585C" + ] ] - ] + }, + "staking": { + "tokensAndOwners": [ + [ + "0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766", // STRK + "0xcE5485Cfb26914C5dcE00B9BAF0580364daFC7a4" // StarknetERC20Bridge + ] + ] + } }, }, "starknet-btc-staking": { diff --git a/registries/txBridge.js b/registries/txBridge.js index ea90025ff30..067f41fab9e 100644 --- a/registries/txBridge.js +++ b/registries/txBridge.js @@ -89,19 +89,50 @@ async function grvtL1Tvl(api) { await grvtCompartmentTvl(api) } +const ZERO_ASSET_ID = '0x' + '0'.repeat(64) + +// chainBalance for specific tokens, including the post-upgrade L1AssetTracker when the vault has one. +// A zero asset id means the token is not registered, so the read is skipped instead of adding a bogus balance. +async function txBridgeTokenBalances(api, { chainId, target = _targetV2, tokens }) { + const assetIds = await api.multiCall({ abi: 'function assetId(address) view returns (bytes32)', calls: tokens, target, permitFailure: true }) + const tokensWithIds = [] + const ids = [] + tokens.forEach((token, i) => { + const id = assetIds[i] + if (id && id !== ZERO_ASSET_ID) { + tokensWithIds.push(token) + ids.push(id) + } + }) + if (!ids.length) return + const chainBalanceAbi = 'function chainBalance(uint256 chainId, bytes32 assetId) view returns (uint256 balance)' + const calls = ids.map(id => ({ params: [chainId, id] })) + const balances = (await api.multiCall({ target, calls, abi: chainBalanceAbi, permitFailure: true })).map(i => i ?? 0) + api.add(tokensWithIds, balances) + const assetTracker = await api.call({ abi: 'address:l1AssetTracker', target, permitFailure: true }) + if (assetTracker && assetTracker !== gasAddress) { + const trackerBalances = (await api.multiCall({ target: assetTracker, calls, abi: chainBalanceAbi, permitFailure: true })).map(i => i ?? 0) + api.add(tokensWithIds, trackerBalances) + } +} + // zkSync-stack (Elastic Chain) forks whose L1 TVL is custodied in the txBridge shared bridge. function txBridgeExportFn(chainConfigs) { const result = {} Object.entries(chainConfigs).forEach(([chain, config]) => { - const { chainId, target, additionalBridges, extraTokens, extraTvl, blacklistedTokens = [] } = config + const { chainId, target, additionalBridges, extraTokens, extraTvl, blacklistedTokens = [], stakingTokens = [] } = config + const tvlBlacklist = blacklistedTokens.concat(stakingTokens) result[chain] = { tvl: async (api) => { await txBridgeTvlV2(api, { chainId, target, additionalBridges, extraTokens }) if (extraTvl) await extraTvl(api) - blacklistedTokens.forEach(token => api.removeTokenBalance(token)) + tvlBlacklist.forEach(token => api.removeTokenBalance(token)) return api.getBalances() }, } + if (stakingTokens.length) { + result[chain].staking = (api) => txBridgeTokenBalances(api, { chainId, target, tokens: stakingTokens }) + } }) return result } @@ -116,7 +147,14 @@ const configs = { 'lens': { ethereum: { chainId: 232 } }, 'openzk': { ethereum: { chainId: 1345 } }, 'treasure': { ethereum: { chainId: 61166 } }, - 'adi-bridge': { ethereum: { chainId: 36900, target: '0x0a0f8912162ff83a036883dbada42eff647a3065' } }, + 'adi-bridge': { + methodology: "Counts assets the shared bridge assigns to ADI chain 36900. ADI is ADI Chain's own gas token, locked in the L1NativeTokenVault, and is counted under staking.", + ethereum: { + chainId: 36900, + target: '0x0a0f8912162ff83a036883dbada42eff647a3065', + stakingTokens: ['0x8b1484d57abbe239bb280661377363b03c89caea'], // ADI + }, + }, 'zero_network': { ethereum: { chainId: 543210 } }, 'sophon': { ethereum: { From 0105d5b84261a0aa4888a15ab14e347e464a744d Mon Sep 17 00:00:00 2001 From: thomas <81407403+thomas-cloud579@users.noreply.github.com> Date: Wed, 18 Nov 2026 15:14:56 +0800 Subject: [PATCH 815/988] gate: track additional listed tokens on EVM chains (#22280) Co-authored-by: ccipherx --- projects/gate-io/index.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index 5aee0a81481..faa71ba8737 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -10,6 +10,13 @@ const { addThetaBalances } = require("../helper/chain/theta.js"); const config = { "ethereum": { + tokens: [ + ...defaultTokens.ethereum, + ADDRESSES.ethereum.sUSDe, // sUSDe (staked USDe) + '0xb98d4c97425d9908e66e53a6fdf673acca0be986', // ABT + '0xe7c6bf469e97eeb0bfb74c8dbff5bd47d4c1c98a', // HSK + '0xa29c9a740de8194e4016747e9a04a84946ada0a5', // NUMI + ], ownTokens: ['0xE66747a101bFF2dBA3697199DCcE5b743b454759'], // GT "owners": [ "0x0d0707963952f2fba59dd06f2b425ace40b492fe", @@ -86,6 +93,10 @@ const config = { ] }, "arbitrum": { + tokens: [ + ...defaultTokens.arbitrum, + '0xd3ea09206d4a76361e369e16b4ff37a89838623d', // FXNW + ], "owners": [ "0x0d0707963952f2fba59dd06f2b425ace40b492fe", "0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c", @@ -101,6 +112,11 @@ const config = { ] }, "polygon": { + tokens: [ + ...defaultTokens.polygon, + '0x98965474ecbec2f532f1f780ee37b0b05f77ca55', // SUT + '0xd60deba014459f07bbcc077a5b817f31dafd5229', // VATRENI + ], "owners": [ "0x0d0707963952f2fba59dd06f2b425ace40b492fe", "0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c", @@ -144,6 +160,20 @@ const config = { ] }, "bsc": { + tokens: [ + ...defaultTokens.bsc, + '0x5d3a12c42e5372b2cc3264ab3cdcf660a1555238', // ARIA + '0xb208063997db51de3f0988f8a87b0aff83a6213f', // BBT + '0xa4b68d48d7bc6f04420e8077e6f74bdef809dea3', // BGSC + '0xfed13d0c40790220fbde712987079eda1ed75c51', // BTR + '0xaa036928c9c0df07d525b55ea8ee690bb5a628c1', // EVAA + '0xd55c9fb62e176a8eb6968f32958fefdd0962727e', // FHE + '0xd5eaaac47bd1993d661bc087e15dfb079a7f3c19', // KOMA + '0x8dedf84656fa932157e27c060d8613824e7979e3', // STBL + '0x9123400446a56176eb1b6be9ee5cf703e409f492', // TRADOOR + '0xe3225e11cab122f1a126a28997788e5230838ab9', // XNY + '0xc51a9250795c0186a6fb4a7d20a90330651e4444', // 我踏马来了 + ], "owners": [ "0x0d0707963952f2fba59dd06f2b425ace40b492fe", "0x1c4b70a3968436b9a0a9cf5205c787eb81bb558c", @@ -257,6 +287,10 @@ const config = { ] }, "base": { + tokens: [ + ...defaultTokens.base, + '0x29cc30f9d113b356ce408667aa6433589cecbdca', // ELSA + ], "owners": [ "0xc882b111a75c0c657fc507c04fbfcd2cc984f071", "0x0d0707963952f2fba59dd06f2b425ace40b492fe", From d50fc80b35e1a40d00f510d1e3ea8585048b2018 Mon Sep 17 00:00:00 2001 From: delz <37193935+ndelzingaro88@users.noreply.github.com> Date: Wed, 18 Nov 2026 02:21:51 -0500 Subject: [PATCH 816/988] Expand Gauntlet Morpho owner discovery across Ethereum, Base, Arc, Morph and X Layer (#22277) --- projects/gauntlet/index.js | 15 +++++++++++---- projects/helper/curators/configs.js | 8 ++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/projects/gauntlet/index.js b/projects/gauntlet/index.js index 7e3008f93cd..e5fa158ac7d 100644 --- a/projects/gauntlet/index.js +++ b/projects/gauntlet/index.js @@ -7,6 +7,7 @@ const configs = { blockchains: { ethereum: { morphoVaultOwners: [ + '0x256DaC8fad2788F4182A42cE8F26029F0DEd7cf9', '0xC684c6587712e5E7BDf9fD64415F23Bd2b05fAec', '0xd79766D2FeC43886e995EA415a2Bf406280B2e2C', '0xB47f11484e19f1914D32fd393b17671221C10F1F', @@ -66,6 +67,7 @@ const configs = { }, base: { morphoVaultOwners: [ + '0x256DaC8fad2788F4182A42cE8F26029F0DEd7cf9', '0x5a4E19842e09000a582c20A4f524C26Fb48Dd4D0', '0xFd144f7A189DBf3c8009F18821028D1CF3EF2428', '0xB47f11484e19f1914D32fd393b17671221C10F1F', @@ -90,6 +92,11 @@ const configs = { '0x94bca6d21907b8275daa3803fe432cd916c4fdd2', ], }, + xlayer: { + morphoVaultOwners: [ + '0xf3b8d49d4c0f6d4c882a1f529504b455f76ea66d', + ], + }, polygon: { morphoVaultOwners: [ '0xC684c6587712e5E7BDf9fD64415F23Bd2b05fAec', @@ -158,13 +165,13 @@ const configs = { ], }, morph: { - morpho: [ - '0x9131eb40bd0bdce73c72755f1bb2cf39a9453341', // Gauntlet USDC Morpho vault + morphoVaultOwners: [ + '0x178fcfe43feeaf3c194f1360d57804040809e88e', ], }, arc: { - morpho: [ - '0xdECcd53BE5453215821184824B519E04C7e00bC7', // Gauntlet USDC Prime (Morpho V2) + morphoVaultOwners: [ + '0x592db4fdaac9d4a0c358aef06f05d918d0415b89', ], }, } diff --git a/projects/helper/curators/configs.js b/projects/helper/curators/configs.js index 999cfd0b3df..e66fc23b027 100644 --- a/projects/helper/curators/configs.js +++ b/projects/helper/curators/configs.js @@ -335,6 +335,14 @@ const MorphoConfigs = { } ] }, + xlayer: { + vaultFactoriesV2: [ + { + address: '0x63d6eac0d16d57dd131d9023adb060277d3237d7', + fromBlock: 73110352, + }, + ], + }, flare: { vaultFactoriesV2: [ { From 9ba4848c619305677496817fc8ffd53697ad31a1 Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:45:14 +0100 Subject: [PATCH 817/988] woofi: add missing WooPP tokens on bsc, monad and hyperliquid (#22283) --- registries/sumTokens/data2.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/registries/sumTokens/data2.js b/registries/sumTokens/data2.js index cc992b51e51..c21184ecc3c 100644 --- a/registries/sumTokens/data2.js +++ b/registries/sumTokens/data2.js @@ -125,12 +125,19 @@ module.exports = { } }, "woofi": { + "methodology": "TVL is the balance of the WooPP pool on each chain in its base and quote tokens, the base tokens are the ones returned by the WOOFi IntegrationHelper (allBaseTokens). Staking counts WOO in the WOOFi staking contracts.", "fantom": { "tvl": { "owner": "0x286ab107c5E9083dBed35A2B5fb0242538F4f9bf", "tokens": [ADDRESSES.fantom.WFTM, "0x74b23882a30290451A17c44f4F05243b6b58C76d", ADDRESSES.fantom.WBTC, "0x6626c47c00F1D87902fc13EECfaC3ed06D5E8D8a", "0x04068da6c83afcfa0e13ba15a6696662335d5b75", "0x049d68029688eabf473097a2fc38ef61633a3c7a"] }, "staking": { "owners": ["0x2Fe5E5D341cFFa606a5d9DA1B6B646a381B0f7ec", "0x1416E1378682b5Ca53F76656549f7570ad0703d9"], "tokens": ["0x6626c47c00f1d87902fc13eecfac3ed06d5e8d8a"] } }, "bsc": { - "tvl": { "owner": "0x5520385bFcf07Ec87C4c53A7d8d65595Dff69FA4", "tokens": [ADDRESSES.bsc.WBNB, ADDRESSES.bsc.ETH, ADDRESSES.bsc.BTCB, "0x4691937a7508860F876c9c0a2a617E7d9E945D4B", ADDRESSES.bsc.USDT, ADDRESSES.bsc.BUSD, ADDRESSES.bsc.CAKE] }, + "tvl": { "owner": "0x5520385bFcf07Ec87C4c53A7d8d65595Dff69FA4", "tokens": [ADDRESSES.bsc.WBNB, ADDRESSES.bsc.ETH, ADDRESSES.bsc.BTCB, "0x4691937a7508860F876c9c0a2a617E7d9E945D4B", ADDRESSES.bsc.USDT, ADDRESSES.bsc.BUSD, ADDRESSES.bsc.CAKE, + "0x02Fca66C1D1aFB4E2A7884261eB00F63598a7436", // NVDAB + "0xbe9D156892E55e7154BcD3cB0FEA677F9D3103E1", // SPCXB + "0x5b1910eAaD6450E50f816082Aa078C41F10C292f", // TSLAB + "0xCA750eF65f295BBECd685Abf54e82CAf297BDB61", // SKHYB + "0x205812CdBed920aFf76C6580abD681a46D11efc7", // QQQB + ] }, "staking": { "owners": ["0x2AEab1a338bCB1758f71BD5aF40637cEE2085076", "0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13"], "tokens": ["0x4691937a7508860f876c9c0a2a617e7d9e945d4b"] } }, "avax": { @@ -175,10 +182,10 @@ module.exports = { "tvl": { "owner": "0x5520385bFcf07Ec87C4c53A7d8d65595Dff69FA4", "tokens": [ADDRESSES.berachain.WBERA, ADDRESSES.berachain.WBTC, ADDRESSES.berachain.WETH, ADDRESSES.berachain.USDC] } }, "hyperliquid": { - "tvl": { "owner": "0x5520385bFcf07Ec87C4c53A7d8d65595Dff69FA4", "tokens": [ADDRESSES.hyperliquid.WHYPE, "0xBe6727B535545C67d5cAa73dEa54865B92CF7907", "0x9FDBdA0A5e284c32744D2f17Ee5c74B284993463", ADDRESSES.hyperliquid.USDT0] } + "tvl": { "owner": "0x5520385bFcf07Ec87C4c53A7d8d65595Dff69FA4", "tokens": [ADDRESSES.hyperliquid.WHYPE, "0xBe6727B535545C67d5cAa73dEa54865B92CF7907", "0x9FDBdA0A5e284c32744D2f17Ee5c74B284993463", ADDRESSES.hyperliquid.USDT0, ADDRESSES.hyperliquid.USDC] } }, "monad": { - "tvl": { "owner": "0x5520385bFcf07Ec87C4c53A7d8d65595Dff69FA4", "tokens": [ADDRESSES.monad.WMON, ADDRESSES.monad.WETH, ADDRESSES.monad.USDC] } + "tvl": { "owner": "0x5520385bFcf07Ec87C4c53A7d8d65595Dff69FA4", "tokens": [ADDRESSES.monad.WMON, ADDRESSES.monad.WETH, ADDRESSES.monad.USDC, ADDRESSES.monad.WBTC, "0xd18B7EC58Cdf4876f6AFebd3Ed1730e4Ce10414b"] } } }, "everclear": { From d2ea5f6f70256ef393ca06cacfb68353ac87c6e3 Mon Sep 17 00:00:00 2001 From: OwlSwapDEX Date: Wed, 18 Nov 2026 12:39:53 +0200 Subject: [PATCH 818/988] Add OwlSwap (#22282) Co-authored-by: ccipherx --- registries/uniswapV3.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 27b63e309fa..9bd0332ec1c 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1988,6 +1988,10 @@ const uniV3Configs = { methodology: 'TVL is the tokens held in StockiumSwap pools, the Uniswap V3 pools created by the StockiumSwap factory on Elysium (found from its PoolCreated events).', elysium: { factory: '0x4F66184A9FFabB7f7071D590C2c48DEDf41676f4', fromBlock: 42214 }, }, + 'owlswap': { + methodology: 'Counts the tokens held by every OwlSwap V3 pool on BSC, discovered from the factory PoolCreated events.', + bsc: { factory: '0x8d33DA172e5A27C9661286Ef1c9740de87Aa2F7B', fromBlock: 130483251 }, + }, } module.exports = buildProtocolExports(uniV3Configs, uniV3Export) From 15d653f4132a2fd1306ea238ef6265179e1be1e6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:53:23 +0100 Subject: [PATCH 819/988] update @defillama/sdk version --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index ef5d4532058..96f2cf72eda 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", - "@defillama/sdk": "5.0.251", + "@defillama/sdk": "5.0.252", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", "@supercharge/promise-pool": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a365a2673e7..193848ae174 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^0.30.1 version: 0.30.1(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) '@defillama/sdk': - specifier: 5.0.251 - version: 5.0.251(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) + specifier: 5.0.252 + version: 5.0.252(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) '@project-serum/anchor': specifier: ^0.26.0 version: 0.26.0(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -269,8 +269,8 @@ packages: peerDependencies: '@solana/web3.js': ^1.68.0 - '@defillama/sdk@5.0.251': - resolution: {integrity: sha512-GpFNpRe4v2WrfVKxlzx5nnVBvgEknciX19TDu+IpbbnS79uoA6SBDzBwJdiXPBDnXBdEYvpLuneYcYqi3zwdmQ==} + '@defillama/sdk@5.0.252': + resolution: {integrity: sha512-xELQcVkNBCHx4I/5zhFs2jSif3si9Pjt5DLvSO9Iw2Grz11s1tS8FXqSOpXCov67oFaKCzK45nkrVnpF1HPtZQ==} peerDependencies: '@solana/web3.js': '>=1.73.0' peerDependenciesMeta: @@ -1942,7 +1942,7 @@ snapshots: bn.js: 5.2.2 buffer-layout: 1.2.2 - '@defillama/sdk@5.0.251(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': + '@defillama/sdk@5.0.252(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': dependencies: '@aws-sdk/client-s3': 3.913.0 '@elastic/elasticsearch': 8.19.1(supports-color@7.2.0) From 6b47d18204bd22851a5e192b17b34d0b5d176ac6 Mon Sep 17 00:00:00 2001 From: bheluga Date: Wed, 18 Nov 2026 12:46:15 +0000 Subject: [PATCH 820/988] fix weso defi tvl (#22287) --- projects/weso-defi/index.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/projects/weso-defi/index.js b/projects/weso-defi/index.js index c5440d5cbe9..4b0cdf77b13 100644 --- a/projects/weso-defi/index.js +++ b/projects/weso-defi/index.js @@ -71,11 +71,8 @@ async function tvl(api) { } }) - // $WESO is a cw20_bonding curve vs native LUNC, not a factory AMM pair. - const curve = await queryContractWithRetries({ contract: WESO, chain: 'terra', data: { curve_info: {} } }) - if (curve?.reserve && curve.reserve !== '0') { - api.add(curve.reserve_denom || 'uluna', curve.reserve) - } + // $WESO is a cw20_bonding curve vs native LUNC, not a factory AMM pair. + await getBalance2({ owner: WESO, chain: 'terra', tokens: ['uluna'], api }) // Wrap banks = circulating 1:1 backing. Skip CWLUNC token amounts in AMM pools above so bank // LUNC is not double-counted with pool CWLUNC. CWUSTC has no AMM inventory, so bank uusd is additive. @@ -85,6 +82,6 @@ async function tvl(api) { module.exports = { timetravel: false, - methodology: 'TVL is AMM pool reserves on the WESO DeFi factory plus the native LUNC locked in the $WESO bonding curve (terra13ryrrlcskwa05cd94h54c8rnztff9l82pp0zqnfvlwt77za8wjjsld36ms), plus native USTC (uusd) in the CWUSTC wrap vault bank (terra1uncwzdhxdktqpx4rj6mkuhl0ekv0raua0058rr7zgnapm9najyyqgtpf6h) and native LUNC (uluna) in the CWLUNC wrap vault bank (terra10fusc7487y4ju2v5uavkauf3jdpxx9h8sc7wsqdqg4rne8t4qyrq8385q6) as circulating 1:1 backing. Wrap/unwrap (token_bonding and converter) pool queries are excluded. CWLUNC token balances inside AMM pools (e.g. JURIS/CWLUNC terra14jed…322v7) are skipped because that CWLUNC is already backed by wrap-bank LUNC; the other pool asset (JURIS) is still counted. Mint-cap token_info.total_supply / curve_info.reserve on wraps are never used.', + methodology: 'TVL is AMM pool reserves on the WESO DeFi factory plus the native LUNC held by the $WESO bonding curve contract (terra13ryrrlcskwa05cd94h54c8rnztff9l82pp0zqnfvlwt77za8wjjsld36ms, bank balance, not curve_info.reserve), plus native USTC (uusd) in the CWUSTC wrap vault bank (terra1uncwzdhxdktqpx4rj6mkuhl0ekv0raua0058rr7zgnapm9najyyqgtpf6h) and native LUNC (uluna) in the CWLUNC wrap vault bank (terra10fusc7487y4ju2v5uavkauf3jdpxx9h8sc7wsqdqg4rne8t4qyrq8385q6) as circulating 1:1 backing. Wrap/unwrap (token_bonding and converter) pool queries are excluded. CWLUNC token balances inside AMM pools (e.g. JURIS/CWLUNC terra14jed…322v7) are skipped because that CWLUNC is already backed by wrap-bank LUNC; the other pool asset (JURIS) is still counted. Mint-cap token_info.total_supply and curve_info.reserve are never used.', terra: { tvl }, } From faaed38ea8648da324fbbc82279c72512317e8d8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 18 Nov 2026 14:00:35 +0100 Subject: [PATCH 821/988] kadena still runs --- projects/cabinet/index.js | 42 +++++++++ projects/chips/index.js | 40 ++++++++ projects/kaddex/index.js | 176 +++++++++++++++++++++++++++++++++++ projects/kdlaunch/index.js | 43 +++++++++ projects/kdswap/index.js | 81 ++++++++++++++++ registries/deadAdapters.json | 44 --------- 6 files changed, 382 insertions(+), 44 deletions(-) create mode 100644 projects/cabinet/index.js create mode 100644 projects/chips/index.js create mode 100644 projects/kaddex/index.js create mode 100644 projects/kdlaunch/index.js create mode 100644 projects/kdswap/index.js diff --git a/projects/cabinet/index.js b/projects/cabinet/index.js new file mode 100644 index 00000000000..71ea003b659 --- /dev/null +++ b/projects/cabinet/index.js @@ -0,0 +1,42 @@ +const { fetchLocal, mkMeta } = require("../helper/pact"); + +const chainId = "5"; +const network = `https://api.chainweb-community.org/chainweb/0.0/mainnet01/chain/${chainId}/pact`; +const GAS_PRICE = 0.00000001; +const creationTime = () => Math.round(new Date().getTime() / 1000) - 10; + + +const getReserve = (tokenData) => { + return parseFloat(tokenData.decimal ? tokenData.decimal : tokenData); +}; + + +const getCabinetTvl = async () => { + const data = await fetchLocal( + { + pactCode: `(coin.get-balance "c:86aaCQXT8uRkyXGXu9k-eNn1kXqV_nNmjTYErKpZ6vE")`, + meta: mkMeta("", chainId, GAS_PRICE, 3000, creationTime(), 600) + }, + network + ); + if (data.result.status === "success") { + return getReserve(data.result.data); + } + throw new Error("Failed do fetch TVL"); + +} + +async function tvl() { + const cabinetTvl = await getCabinetTvl(); + return { + kadena: cabinetTvl, + }; +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + kadena: { + tvl: tvl, + }, +}; diff --git a/projects/chips/index.js b/projects/chips/index.js new file mode 100644 index 00000000000..5e30533c231 --- /dev/null +++ b/projects/chips/index.js @@ -0,0 +1,40 @@ +const { fetchLocal, mkMeta } = require("../helper/pact"); + +const contract = "n_e98a056e3e14203e6ec18fada427334b21b667d8.chips"; +const chainId = "2"; +const network = `https://api.chainweb-community.org/chainweb/0.0/mainnet01/chain/${chainId}/pact`; +const GAS_PRICE = 0.00000001; +const creationTime = () => Math.floor(Date.now() / 1000) - 10; + +async function fetch() { + const { result } = await fetchLocal( + { + pactCode: `(use ${contract}) (get-tvl2)`, + meta: mkMeta("", chainId, GAS_PRICE, 3000, creationTime(), 600), + }, + network + ); + + const balances = result?.data || {}; + let kdaTotal = 0; + + for (const [key, value] of Object.entries(balances)) { + if (key !== "coin") continue; + const amount = value?.decimal || value; + kdaTotal += parseFloat(amount || 0); + } + + return { + kadena: kdaTotal + }; +} + +module.exports = { + timetravel: false, + misrepresentedTokens: false, + methodology: + "TVL tracks the KDA-equivalent value of all locked cTokens and kWATT tokens using on-chain DEX pricing. The contract returns a single 'coin' value in KDA, excluding USD-only fields.", + kadena: { + tvl: fetch, + }, +}; diff --git a/projects/kaddex/index.js b/projects/kaddex/index.js new file mode 100644 index 00000000000..253489de5a5 --- /dev/null +++ b/projects/kaddex/index.js @@ -0,0 +1,176 @@ +const { fetchLocal, mkMeta } = require("../helper/pact"); + +const chainId = "2"; +const network = `https://api.chainweb-community.org/chainweb/0.0/mainnet01/chain/${chainId}/pact`; +const GAS_PRICE = 0.00000001; +const creationTime = () => Math.round(new Date().getTime() / 1000) - 10; + +const getReserve = (tokenData) => { + return parseFloat(tokenData.decimal ? tokenData.decimal : tokenData); +}; + +const pairTokens = { + "coin:runonflux.flux": { + name: "coin:runonflux.flux", + token0: { + name: "KDA", + code: "coin", + }, + token1: { + name: "FLUX", + code: "runonflux.flux", + }, + }, + "coin:hypercent.prod-hype-coin": { + name: "coin:hypercent.prod-hype-coin", + token0: { + name: "KDA", + code: "coin", + }, + token1: { + name: "HYPE", + code: "hypercent.prod-hype-coin", + }, + }, + "coin:mok.token": { + name: "coin:mok.token", + token0: { + name: "KDA", + code: "coin", + }, + token1: { + name: "MOK", + code: "mok.token", + }, + }, + // "coin:lago.kwUSDC": { + // name: "coin:lago.kwUSDC", + // token0: { + // name: "KDA", + // code: "coin", + // }, + // token1: { + // name: "USDC", + // code: "lago.kwUSDC", + // }, + // }, + "coin:kaddex.kdx": { + name: "coin:kaddex.kdx", + token0: { + name: "KDA", + code: "coin", + }, + token1: { + name: "KDX", + code: "kaddex.kdx", + }, + }, + "coin:kdlaunch.token": { + name: "coin:kdlaunch.token", + token0: { + name: "KDA", + code: "coin", + }, + token1: { + name: "KDL", + code: "kdlaunch.token", + }, + }, + "coin:kdlaunch.kdswap-token": { + name: "coin:kdlaunch.kdswap-token", + token0: { + name: "KDA", + code: "coin", + }, + token1: { + name: "KDS", + code: "kdlaunch.kdswap-token", + }, + }, +}; + +const getPairList = async () => { + const pairList = [] + for (const pair of Object.values(pairTokens)) { + let data = await fetchLocal( + { + pactCode: ` + (use kaddex.exchange) + (let* + ( + (p (get-pair ${pair.token0.code} ${pair.token1.code})) + (reserveA (reserve-for p ${pair.token0.code})) + (reserveB (reserve-for p ${pair.token1.code})) + (totalBal (kaddex.tokens.total-supply (kaddex.exchange.get-pair-key ${pair.token0.code} ${pair.token1.code}))) + )[totalBal reserveA reserveB]) + `, + meta: mkMeta("", chainId, GAS_PRICE, 3000, creationTime(), 600), + }, + network + ); + + pairList.push({ + reserves: [ + getReserve(data.result.data[1]), + getReserve(data.result.data[2]), + pair.token0.code, + pair.token1.code, + ], + }); + } + return pairList; +}; + +const getStakedKDXValueInKDA = async (pairList) => { + const stakedData = await fetchLocal( + { + pactCode: `(kaddex.staking.get-pool-state)`, + meta: mkMeta("", chainId, GAS_PRICE, 3000, creationTime(), 600), + }, + network + ); + const stakedValue = getReserve( + (stakedData?.result?.data && stakedData?.result?.data["staked-kdx"]) || 0 + ); + const kdxPool = pairList.find((pair) => pair.reserves[3] === "kaddex.kdx"); + const kdxPrice = kdxPool.reserves[0] / kdxPool.reserves[1] || 0; + const stakedKDXValue = kdxPrice * stakedValue; + return stakedKDXValue; +}; + +const fetchKdaTotal = async (pairList) => { + let totalKda = 0; + for (const pair of pairList) { + const kdaInPool = pair.reserves[0]; + const tokenInPoolInKdaRate = pair.reserves[0] / pair.reserves[1] || 0; + totalKda += + kdaInPool + + tokenInPoolInKdaRate * pair.reserves[1]; /** equal to do (kda*2) */ + } + return totalKda; +}; + +async function tvl() { + const pairList = await getPairList(); + const kdaTotal = await fetchKdaTotal(pairList); + return { + kadena: kdaTotal, + }; +} + +async function staking() { + const pairList = await getPairList(); + const stakedKdxValue = await getStakedKDXValueInKDA(pairList); + return { + kadena: stakedKdxValue, + }; +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + kadena: { + tvl: tvl, + staking: staking + }, +}; diff --git a/projects/kdlaunch/index.js b/projects/kdlaunch/index.js new file mode 100644 index 00000000000..ed64f5a73f7 --- /dev/null +++ b/projects/kdlaunch/index.js @@ -0,0 +1,43 @@ +const { fetchLocal, mkMeta } = require("../helper/pact"); + +const network = (chainId) => `https://api.chainweb-community.org/chainweb/0.0/mainnet01/chain/${chainId}/pact`; +const creationTime = () => Math.round(new Date().getTime() / 1000) - 10; + +const getReserve = (tokenData) => { + return parseFloat(tokenData.decimal ? tokenData.decimal : tokenData); +} + + +const getTotalStakedKdl = async () => { + const chainId = '1'; + let data = await fetchLocal( + { + pactCode: '(kdlaunch.staking.get-staking-stats)', + meta: mkMeta('', chainId, 0.01, 1000, 28800, creationTime()) + }, + network(chainId) + ); + + if (data.result.status === "success") { + return getReserve(data.result.data.totalStaked); + } + + throw new Error("Total KDL stacked failed"); +} + +async function fetchStakingTvl() { + const stakedKdl = await getTotalStakedKdl(); + return { + kdlaunch: stakedKdl + } +} + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + deadFrom: "2026-01-25", + kadena: { + tvl: () => ({}), + staking: fetchStakingTvl, + } +} \ No newline at end of file diff --git a/projects/kdswap/index.js b/projects/kdswap/index.js new file mode 100644 index 00000000000..3263830e9b9 --- /dev/null +++ b/projects/kdswap/index.js @@ -0,0 +1,81 @@ +const { fetchLocal, mkMeta } = require("../helper/pact"); + +const kdsExchangeContract = 'kdlaunch.kdswap-exchange'; +const kdsExchangeTokenContract = 'kdlaunch.kdswap-exchange-tokens'; +const chainId = "1"; +const network = `https://api.chainweb-community.org/chainweb/0.0/mainnet01/chain/${chainId}/pact`; +const GAS_PRICE = 0.00000001; +const creationTime = () => Math.round(new Date().getTime() / 1000) - 10; + +const getReserve = (tokenData) => { + return parseFloat(tokenData.decimal ? tokenData.decimal : tokenData); +}; + +// pair keys ("coin:kdlaunch.token") are read from the exchange's own table, the kdswap api is gone +const getPairKeys = async () => { + const data = await fetchLocal( + { + pactCode: `(keys ${kdsExchangeContract}.pairs)`, + meta: mkMeta("", chainId, GAS_PRICE, 150000, creationTime(), 600), + }, + network + ); + if (data.result.status !== "success") throw new Error("Failed to fetch KDSWAP pair list"); + return data.result.data +} + +const getPairList = async () => { + const pairKeys = await getPairKeys() + const pairList = [] + + for (const pairKey of pairKeys) { + const tokens = pairKey.split(':') + if (tokens.length !== 2 || !tokens.includes('coin')) continue // only KDA pairs can be valued + const token = tokens.find((code) => code !== 'coin') + const data = await fetchLocal( + { + pactCode: ` + (use ${kdsExchangeContract}) + (let* + ( + (p (get-pair coin ${token})) + (reserveA (reserve-for p coin)) + (reserveB (reserve-for p ${token})) + (totalBal (${kdsExchangeTokenContract}.total-supply (${kdsExchangeContract}.get-pair-key coin ${token}))) + )[totalBal reserveA reserveB]) + `, + meta: mkMeta("", chainId, GAS_PRICE, 3000, creationTime(), 600), + }, + network + ); + + if (data.result.status === "success") + pairList.push({ reserves: [getReserve(data.result.data[1]), getReserve(data.result.data[2])] }) + else + pairList.push({ reserves: [0, 0] }) + } + return pairList +}; + +const calculateKdaTotal = (pairList) => pairList.reduce((amount, pair) => amount += pair.reserves[0], 0) + +async function fetch() { + const pairList = await getPairList(); + const kdaTotal = calculateKdaTotal(pairList); + + /* + * value of each pool taken to be twice the value of its KDA + */ + return { + kadena: 2 * kdaTotal + }; +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: "TVL accounts for the liquidity on all KDSWAP AMM pools, with all values calculated in terms of KDA price.", + kadena: { + tvl: fetch, + }, +} \ No newline at end of file diff --git a/registries/deadAdapters.json b/registries/deadAdapters.json index e6686d98785..6f96996f970 100644 --- a/registries/deadAdapters.json +++ b/registries/deadAdapters.json @@ -1328,14 +1328,6 @@ }, "deadFrom": "2025-03-31" }, - "cabinet": { - "timetravel": false, - "misrepresentedTokens": true, - "kadena": { - "tvl": "_f" - }, - "deadFrom": "2026-01-25" - }, "cakedao": { "avax": { "tvl": "_f", @@ -1489,15 +1481,6 @@ }, "deadFrom": "2023-12-12" }, - "chips": { - "timetravel": false, - "misrepresentedTokens": false, - "methodology": "TVL tracks the KDA-equivalent value of all locked cTokens and kWATT tokens using on-chain DEX pricing. The contract returns a single 'coin' value in KDA, excluding USD-only fields.", - "kadena": { - "tvl": "_f" - }, - "deadFrom": "2026-01-25" - }, "chocodoge": { "misrepresentedTokens": true, "dogechain": { @@ -3310,15 +3293,6 @@ "staking": "_f" } }, - "kaddex": { - "timetravel": false, - "misrepresentedTokens": true, - "kadena": { - "tvl": "_f", - "staking": "_f" - }, - "deadFrom": "2026-01-25" - }, "kafefinance": { "misrepresentedTokens": true, "timetravel": false, @@ -3388,24 +3362,6 @@ "staking": "_f" } }, - "kdlaunch": { - "misrepresentedTokens": true, - "timetravel": false, - "kadena": { - "tvl": "_f", - "staking": "_f" - }, - "deadFrom": "2026-01-25" - }, - "kdswap": { - "timetravel": false, - "misrepresentedTokens": true, - "methodology": "TVL accounts for the liquidity on all KDSWAP AMM pools, with all values calculated in terms of KDA price.", - "kadena": { - "tvl": "_f" - }, - "deadFrom": "2026-01-25" - }, "keeper-dao": { "start": "2021-01-30", "ethereum": { From c41de8741ff2265ed2ad27a75a7b33dccb6aed9c Mon Sep 17 00:00:00 2001 From: Nick | Clearstar & 512m <93676606+TheDeGen@users.noreply.github.com> Date: Wed, 18 Nov 2026 15:50:30 +0100 Subject: [PATCH 822/988] clearstar: include missing Morpho vaults on Base, Arbitrum and Arc (#22286) --- registries/curators.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/registries/curators.js b/registries/curators.js index 078841efaa4..3f801d1666f 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -416,6 +416,7 @@ const configs = { '0x30988479C2E6a03E7fB65138b94762D41a733458', '0x829A13850b684A575C0580a83322890e19c5eFaa', '0x40DdCcAC38E4F6f2cB802c09F0a08f39d3dCb48F', // Morpho V2 Noon Ecosystem Vault: owner at creation + '0xf9AC70A7D10F92e6Cc6d98837e0D9656C1eC459F', // Morpho V2 Solana and Tokenized Stocks vaults: owner at creation ], eulerVaultOwners: [ '0xb3CF59A5f12cA319861376C5e63Eef4790a42B44', @@ -479,6 +480,12 @@ const configs = { arbitrum: { morphoVaultOwners: [ '0x30988479C2E6a03E7fB65138b94762D41a733458', + '0xf9AC70A7D10F92e6Cc6d98837e0D9656C1eC459F', // Morpho V2 Core USDG: owner at creation + ], + }, + arc: { + morpho: [ + '0xd45C268Ef9850a00D51d7c05C0aF17fdAd309060', // Morpho V2 Clearstar Core USDC ], }, hemi: { From dbcc80384b639e385c8454b13987d060625a1423 Mon Sep 17 00:00:00 2001 From: max <39312833+fritzschoff@users.noreply.github.com> Date: Wed, 18 Nov 2026 15:23:41 +0000 Subject: [PATCH 823/988] raydium-launchlab: track the quote tokens in the bonding curves (#22288) Co-authored-by: Claude Opus 5.5 --- projects/raydium-launchlab/index.js | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 projects/raydium-launchlab/index.js diff --git a/projects/raydium-launchlab/index.js b/projects/raydium-launchlab/index.js new file mode 100644 index 00000000000..a2efc25eac2 --- /dev/null +++ b/projects/raydium-launchlab/index.js @@ -0,0 +1,35 @@ +const { PublicKey } = require('@solana/web3.js') +const ADDRESSES = require('../helper/coreAssets.json') +const { getConnection } = require('../helper/solana') + +const LAUNCHLAB = new PublicKey('LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj') +const POOL_STATE_DISCRIMINATOR = 'iUE1qg7KXeV' +const STATUS_OFFSET = 17 +const STATUS_TRADING = '1' // base58 of the byte 0: still on the bonding curve, migrated pools are counted under Raydium AMM +const REAL_QUOTE_OFFSET = 61 +const QUOTE_MINT_OFFSET = 237 + +const { SOL, USD1, USDC, USDT } = ADDRESSES.solana + +async function tvl(api) { + const connection = getConnection() + // one scan per quote token, reading only the 8 bytes of real_quote: there are over a million pools + for (const quoteMint of [SOL, USD1, USDC, USDT]) { + const pools = await connection.getProgramAccounts(LAUNCHLAB, { + filters: [ + { memcmp: { offset: 0, bytes: POOL_STATE_DISCRIMINATOR } }, + { memcmp: { offset: STATUS_OFFSET, bytes: STATUS_TRADING } }, + { memcmp: { offset: QUOTE_MINT_OFFSET, bytes: quoteMint } }, + ], + dataSlice: { offset: REAL_QUOTE_OFFSET, length: 8 }, + }) + api.add(quoteMint, pools.reduce((sum, { account }) => sum + account.data.readBigUInt64LE(0), 0n).toString()) + } +} + +module.exports = { + timetravel: false, + isHeavyProtocol: true, + methodology: 'Counts the SOL, USD1, USDC and USDT bought into LaunchLab bonding curves that have not migrated yet. The launched tokens themselves are not counted.', + solana: { tvl }, +} From 3655a53fc9fb427cddfca56bc0e2bc2b3ad1cf57 Mon Sep 17 00:00:00 2001 From: "Kacper K." Date: Wed, 18 Nov 2026 16:51:18 +0100 Subject: [PATCH 824/988] Team Finance: drop LUKSO vesting (#22291) --- projects/team-finance/vestingConfig.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/team-finance/vestingConfig.js b/projects/team-finance/vestingConfig.js index 873865b3221..4259f4670af 100644 --- a/projects/team-finance/vestingConfig.js +++ b/projects/team-finance/vestingConfig.js @@ -38,7 +38,6 @@ module.exports = { }, klaytn: { fromBlock: 170539718, factories: ['0x6dd27f2b82f78dd8a802a9228f340518280359f1'], }, era: { fromBlock: 13265113, factories: ['0xb5ded5774bb01b22a06e58a06917ef1f10b2f61a', '0x2d45b63e04b1fb612e3df1ccd66b81ee10c6a5d5'], }, - lukso: { fromBlock: 4796196, factories: [v4], }, berachain: { fromBlock: 4083978, factories: [v4], }, unichain: { fromBlock: 17091208, factories: [v4], }, monad: { fromBlock: 100676245, factories: ['0x00c6b2512eefea1f56c60f7e504437ad698162de'], }, From 6a7ae24cfeb18fe06c40ef45687fd15d315cb9d4 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 18 Nov 2026 11:55:04 -0400 Subject: [PATCH 825/988] add Enmonetic (#22292) Co-authored-by: levavetisyan --- registries/erc4626.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/registries/erc4626.js b/registries/erc4626.js index 097f8090e7d..74aebe234a1 100644 --- a/registries/erc4626.js +++ b/registries/erc4626.js @@ -560,6 +560,15 @@ const configs = { methodology: 'Counts the USDC value of RWI Vault shares via totalAssets(), which accrues at the on-chain fixed yield rate. Deposits are deployed by the Vault Operator into tokenised onchain and offchain insurance opportunities. Assets are held as Pendle PT-reUSDe, so the same capital is also counted in Re and Pendle TVL.', ethereum: ['0xcAFeAA466736ac01e0AC9Ca72644beF348694731'], }, + 'enmonetic': { + methodology: 'TVL is the totalAssets of the Enmonetic vaults, which allocate deposits to lending markets such as Aave, Compound, Fluid and Morpho.', + start: '2026-09-14', // USDC vault deploy + doublecounted: true, + ethereum: [ + '0x585b8e4160607339ff425baf75b22506c1779fc2', // USDC vault (fUSDC) + '0x91134a0450628846b3853e93444a7cd20a02f4ba', // USDT vault (fUSDT) + ], + }, // --- custom-abi vaults (migrated 2026-10-22) --- 'deq': { ethereum: { vaults: ['0x3742f3Fcc56B2d46c7B8CA77c23be60Cd43Ca80a'], tokenAbi: 'avail', balanceAbi: 'assets' }, From 4eb23c8411f019c5bd32ff7f6e37f60eb07195f8 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 18 Nov 2026 12:27:26 -0400 Subject: [PATCH 826/988] add coderabbit config (#22293) --- .coderabbit.yaml | 145 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 .coderabbit.yaml diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 00000000000..2f0e2e899c5 --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,145 @@ +# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json +language: "en-US" + +reviews: + profile: "quiet" + high_level_summary: true + collapse_walkthrough: true + sequence_diagrams: false + estimate_code_review_effort: false + assess_linked_issues: false + related_issues: false + related_prs: false + suggested_labels: false + suggested_reviewers: false + in_progress_fortune: false + poem: false + + pre_merge_checks: + title: + mode: "off" + description: + mode: "off" + issue_assessment: + mode: "off" + + path_instructions: + - path: "projects/**" + instructions: | + Adapters in this repo are reviewed by maintainers against on-chain data. Only ask for + changes in the cases listed below, plus real bugs that would make the adapter throw or + report a wrong number. Do not comment on style, naming, formatting, comments, missing + tests, missing docs, error handling or refactors. If none of the cases apply, leave no + review comments. + + 1. Helper-only adapters belong in a registry. + Applies to adapter files added in this PR, not to edits of existing ones. If the file + only requires a helper and exports the result of calling it with static config + (addresses, tokens, factories, start blocks), optionally with metadata keys such as + methodology, start, hallmarks, doublecounted or misrepresentedTokens, ask the author to + delete the projects/ file and add an entry under the same key in the matching registry: + - sumTokensExport / sumTokens2 on fixed owners and tokens, optionally with staking() or + pool2() buckets -> registries/sumTokens.js + - only staking() and/or pool2(), with an empty tvl -> registries/stakingOnly.js + - getUniTVL -> registries/uniswapV2.js + - uniV3Export -> registries/uniswapV3.js + - uniV3GraphExport -> registries/uniswapV3Graph.js + - aaveV3Export -> registries/aaveV3.js + - aaveExports / aaveV2Export -> registries/aave.js + - compoundExports2 -> registries/compound.js + - sumERC4626VaultsExport2 -> registries/erc4626.js + - masterchefExports / masterChefExports -> registries/masterchef.js + - getLiquityTvl / getLiquityV2Tvl -> registries/liquity.js + - onChainTvl / v3Tvl / v1Tvl from helper/balancer -> registries/balancer.js + - gmxExports / gmxExportsV2 -> registries/gmx.js + - joeV2Export -> registries/traderJoeV2.js + - getCuratorExport -> registries/curators.js + - getBTCExport -> registries/bitcoin.js + - treasuryExports (projects/treasury/.js) -> registries/treasury.js + Point to a nearby entry in that registry file as the format to copy. Do not ask for this + when the adapter has logic a registry entry cannot express: its own tvl function, calls + to discover contracts, API fetches, or arithmetic on balances. + + 2. The protocol's own token is not TVL. + If the adapter adds the protocol's own governance or native token to `tvl` (the token is + named after the protocol, or matches the "Token address and ticker" field of the PR + description), ask for it to be exported under `staking` instead, and under `pool2` for LP + tokens that pair the own token. This applies whatever the mechanism is: staking contracts, + vaults, lockers, bonding curves or launchpads quoted in the own token. A `tvl` of 0 is + expected and fine for a staking-only listing. See + https://docs.llama.fi/list-your-project/what-to-include-as-tvl#tvl-filters + Do not flag pools or markets found through a DEX or lending helper (getUniTVL, + uniV3Export, aaveV3Export, compoundExports2 and similar) just because the own token is + one of the assets in them. Only flag it when you can tell which token is the protocol's + own; do not guess. + + 3. Keep existing chains and adapters. + If the PR removes a chain key from an existing adapter's exports, ask for it to stay as + `: { tvl: () => ({}) }` so the chain's history is kept in the API. If the PR + deletes or renames an existing adapter file or folder, ask for it to be kept: listings + point at the file path, and name changes are handled through metadata@defillama.com. + Deleting a projects/ file is fine when the same PR adds the same key to a registry. + + 4. Adapters do not price tokens. + An adapter reports token amounts at addresses; prices come from DefiLlama's coins + service. Ask for the token balance to be reported as is when the adapter: + - calls coins.llama.fi or any other price API, + - multiplies a balance by a price or rate from the protocol's own oracle, a pool, or a + hardcoded number, and books the result as USD or as another token, + - converts a wrapper it holds into its underlying (convertToAssets, getRate, + exchangeRate and similar) instead of adding the wrapper token itself, + - falls back to a converted value when a token has no price. + A token without a price shows as 0 until it is priced, which is acceptable; pricing + requests are handled on the coins side, not in the adapter. + + 5. TVL comes from chain data, not from the project's API. + Applies to adapter files added in this PR, and to existing on-chain adapters the PR + switches to an API. If balances or a TVL figure are read from the project's own API or + backend, ask for them to be read on-chain instead. Using an API only to get a list of + contracts, vaults or pools whose balances are then read on-chain is fine; in that case + suggest getConfig from projects/helper/cache.js instead of a bare http get. + + 6. Keep the PR to the adapter. + Ask for these to be removed from the PR: unit test files (*.test.js, *.spec.js), + formatting-only changes to lines the PR does not otherwise need to touch, and changes to + files under projects/helper/ that only reformat code. + + - path: "registries/**" + instructions: | + Registry entries are static config reviewed by maintainers against on-chain data. Only + comment on the cases below, plus errors that would break the registry file (syntax, a + duplicate key, an entry placed outside the config object). Do not comment on style, + ordering, formatting, or the value of `start` / `fromBlock`. + + 1. The protocol's own token is not TVL. If an entry lists the protocol's own governance + or native token in the `tvl` tokens, ask for it to move to the `staking` bucket (`pool2` + for LP tokens that pair the own token). A `tvl` of 0 is expected and fine for a + staking-only listing. Only flag it when you can tell which token is the protocol's own. + + 2. One listing, one place. If the PR adds a registry entry while a projects// + folder or a projects/.js file still exists, ask for it to be removed when the + PR is migrating that listing, and for a different key otherwise. A key must also be + unique across all registry files: a later file silently overwrites an earlier one. If + the key already exists in another registry file, ask for the old entry to be removed + (when the listing is being moved) or for a different key. + + 3. Keep existing chains and entries. If the PR removes an existing entry, or a chain key + from an existing entry, ask for it to stay so its history is kept in the API. A dead + chain keeps its key with the empty form that registry file already uses for other dead + chains, for example `: null` in registries/uniswapV2.js and + `: { tvl: () => ({}) }` in registries/uniswapV3.js. Do not suggest `{}` unless + the file already uses it. + + - path: "package.json" + instructions: | + Adapter PRs must not add npm dependencies or edit package.json, pnpm-lock.yaml or + pnpm-workspace.yaml. If the PR author is not a maintainer, ask for these changes to be + reverted. + + - path: "pnpm-workspace.yaml" + instructions: | + Adapter PRs must not edit pnpm-workspace.yaml. If the PR author is not a maintainer, ask + for this change to be reverted. + +chat: + auto_reply: true From 25128c5a9e2ea8ad240198d62172796703e716d8 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 18 Nov 2026 12:27:40 -0400 Subject: [PATCH 827/988] drop mantle vesting from team finance (#22294) --- projects/team-finance/vestingConfig.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/team-finance/vestingConfig.js b/projects/team-finance/vestingConfig.js index 4259f4670af..adfaa676af3 100644 --- a/projects/team-finance/vestingConfig.js +++ b/projects/team-finance/vestingConfig.js @@ -27,7 +27,6 @@ module.exports = { polygon: { fromBlock: 30715517, v2FromBlock: 31637453, factories: [v3, v4], }, avax: { fromBlock: 18393367, v2FromBlock: 18350097, factories: [v3, v4], }, fantom: { fromBlock: 69441842, v2FromBlock: 46365810, factories: [v3, v4], }, - mantle: { fromBlock: 18080827, factories: [v3, v4], }, pulse: { fromBlock: 15141503, factories: [v3, '0xf44c89b6846c8a9bc068899513fbf27ac1c23a96'], }, kava: { fromBlock: 1982214, v2FromBlock: 1912675, factories: ['0xd5d3d09997e005a05477a52b2eaf98d9276655a7', v4], }, flare: { From abbc7b243f913a57b6811f0f64a69eac45d4fe68 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 18 Nov 2026 18:54:21 +0100 Subject: [PATCH 828/988] fix kaddex --- projects/kaddex/index.js | 180 ++++++++++----------------------------- 1 file changed, 43 insertions(+), 137 deletions(-) diff --git a/projects/kaddex/index.js b/projects/kaddex/index.js index 253489de5a5..ca08d7f9ee9 100644 --- a/projects/kaddex/index.js +++ b/projects/kaddex/index.js @@ -4,171 +4,77 @@ const chainId = "2"; const network = `https://api.chainweb-community.org/chainweb/0.0/mainnet01/chain/${chainId}/pact`; const GAS_PRICE = 0.00000001; const creationTime = () => Math.round(new Date().getTime() / 1000) - 10; +const KDA = "coin"; +const KDX = "kaddex.kdx"; const getReserve = (tokenData) => { return parseFloat(tokenData.decimal ? tokenData.decimal : tokenData); }; -const pairTokens = { - "coin:runonflux.flux": { - name: "coin:runonflux.flux", - token0: { - name: "KDA", - code: "coin", - }, - token1: { - name: "FLUX", - code: "runonflux.flux", - }, - }, - "coin:hypercent.prod-hype-coin": { - name: "coin:hypercent.prod-hype-coin", - token0: { - name: "KDA", - code: "coin", - }, - token1: { - name: "HYPE", - code: "hypercent.prod-hype-coin", - }, - }, - "coin:mok.token": { - name: "coin:mok.token", - token0: { - name: "KDA", - code: "coin", - }, - token1: { - name: "MOK", - code: "mok.token", - }, - }, - // "coin:lago.kwUSDC": { - // name: "coin:lago.kwUSDC", - // token0: { - // name: "KDA", - // code: "coin", - // }, - // token1: { - // name: "USDC", - // code: "lago.kwUSDC", - // }, - // }, - "coin:kaddex.kdx": { - name: "coin:kaddex.kdx", - token0: { - name: "KDA", - code: "coin", - }, - token1: { - name: "KDX", - code: "kaddex.kdx", - }, - }, - "coin:kdlaunch.token": { - name: "coin:kdlaunch.token", - token0: { - name: "KDA", - code: "coin", - }, - token1: { - name: "KDL", - code: "kdlaunch.token", - }, - }, - "coin:kdlaunch.kdswap-token": { - name: "coin:kdlaunch.kdswap-token", - token0: { - name: "KDA", - code: "coin", - }, - token1: { - name: "KDS", - code: "kdlaunch.kdswap-token", - }, - }, -}; - +// Every pool is read from the exchange's own table in one call, so new pools are picked up. +// A pair key is "tokenA:tokenB" and leg0/leg1 hold the reserves in that same order. const getPairList = async () => { - const pairList = [] - for (const pair of Object.values(pairTokens)) { - let data = await fetchLocal( - { - pactCode: ` - (use kaddex.exchange) - (let* - ( - (p (get-pair ${pair.token0.code} ${pair.token1.code})) - (reserveA (reserve-for p ${pair.token0.code})) - (reserveB (reserve-for p ${pair.token1.code})) - (totalBal (kaddex.tokens.total-supply (kaddex.exchange.get-pair-key ${pair.token0.code} ${pair.token1.code}))) - )[totalBal reserveA reserveB]) - `, - meta: mkMeta("", chainId, GAS_PRICE, 3000, creationTime(), 600), - }, - network - ); - - pairList.push({ - reserves: [ - getReserve(data.result.data[1]), - getReserve(data.result.data[2]), - pair.token0.code, - pair.token1.code, - ], - }); - } - return pairList; -}; - -const getStakedKDXValueInKDA = async (pairList) => { - const stakedData = await fetchLocal( + const data = await fetchLocal( { - pactCode: `(kaddex.staking.get-pool-state)`, - meta: mkMeta("", chainId, GAS_PRICE, 3000, creationTime(), 600), + pactCode: ` + (map + (lambda (k) + (let ((p (kaddex.exchange.get-pair-by-key k))) + [k (at 'reserve (at 'leg0 p)) (at 'reserve (at 'leg1 p))])) + (kaddex.exchange.get-pairs)) + `, + meta: mkMeta("", chainId, GAS_PRICE, 150000, creationTime(), 600), }, network ); - const stakedValue = getReserve( - (stakedData?.result?.data && stakedData?.result?.data["staked-kdx"]) || 0 - ); - const kdxPool = pairList.find((pair) => pair.reserves[3] === "kaddex.kdx"); - const kdxPrice = kdxPool.reserves[0] / kdxPool.reserves[1] || 0; - const stakedKDXValue = kdxPrice * stakedValue; - return stakedKDXValue; -}; + if (data?.result?.status !== "success" || !Array.isArray(data.result.data) || !data.result.data.length) + throw new Error("Failed to fetch Kaddex pairs"); -const fetchKdaTotal = async (pairList) => { - let totalKda = 0; - for (const pair of pairList) { - const kdaInPool = pair.reserves[0]; - const tokenInPoolInKdaRate = pair.reserves[0] / pair.reserves[1] || 0; - totalKda += - kdaInPool + - tokenInPoolInKdaRate * pair.reserves[1]; /** equal to do (kda*2) */ + const pairList = []; + for (const [pairKey, reserve0, reserve1] of data.result.data) { + const tokens = pairKey.split(":"); + if (tokens.length !== 2 || !tokens.includes(KDA)) continue; // only KDA pairs can be valued + const kdaIsFirst = tokens[0] === KDA; + pairList.push({ + token: kdaIsFirst ? tokens[1] : tokens[0], + kdaReserve: getReserve(kdaIsFirst ? reserve0 : reserve1), + tokenReserve: getReserve(kdaIsFirst ? reserve1 : reserve0), + }); } - return totalKda; + return pairList; }; async function tvl() { const pairList = await getPairList(); - const kdaTotal = await fetchKdaTotal(pairList); + const kdaInPools = pairList.reduce((total, pair) => total + pair.kdaReserve, 0); + // value of each pool taken to be twice the value of its KDA return { - kadena: kdaTotal, + kadena: 2 * kdaInPools, }; } async function staking() { - const pairList = await getPairList(); - const stakedKdxValue = await getStakedKDXValueInKDA(pairList); + const stakedData = await fetchLocal( + { + pactCode: `(kaddex.staking.get-pool-state)`, + meta: mkMeta("", chainId, GAS_PRICE, 3000, creationTime(), 600), + }, + network + ); + const stakedKdx = getReserve( + (stakedData?.result?.data && stakedData?.result?.data["staked-kdx"]) || 0 + ); + const kdxPool = (await getPairList()).find((pair) => pair.token === KDX); + const kdxPrice = kdxPool.kdaReserve / kdxPool.tokenReserve || 0; return { - kadena: stakedKdxValue, + kadena: kdxPrice * stakedKdx, }; } module.exports = { timetravel: false, misrepresentedTokens: true, + methodology: "TVL accounts for the liquidity on all Kaddex (Mercatus) AMM pools paired with KDA, each valued at twice its KDA side. Staking is the KDX staked in the Kaddex staking pool, priced from the KDA/KDX pool.", kadena: { tvl: tvl, staking: staking From f23d8bc0c76fa8d420074ec8a79643fcb259fdd9 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 18 Nov 2026 19:27:15 +0100 Subject: [PATCH 829/988] kaddex: add refill support --- projects/helper/chain/kadena.js | 45 +++++++++++++++++++++++++++++++++ projects/helper/sumTokens.js | 1 + projects/kaddex/index.js | 37 +++++++++++++++++++++++---- 3 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 projects/helper/chain/kadena.js diff --git a/projects/helper/chain/kadena.js b/projects/helper/chain/kadena.js new file mode 100644 index 00000000000..4210a3add3b --- /dev/null +++ b/projects/helper/chain/kadena.js @@ -0,0 +1,45 @@ +const sdk = require('@defillama/sdk') +const { fetchLocal, mkMeta } = require('../pact') + +// Kadena (community edition since the 2025-11-08 fork): 20 chains, an account holds a separate KDA balance on each +const API = 'https://api.chainweb-community.org/chainweb/0.0/mainnet01' +const CHAIN_COUNT = 20 +const GAS_PRICE = 0.00000001 + +const toNumber = (value) => { + const parsed = Number(value !== null && typeof value === 'object' ? (value.decimal ?? value.int) : value) + if (!Number.isFinite(parsed) || parsed < 0) throw new Error(`kadena: bad balance ${JSON.stringify(value)}`) + return parsed +} + +// KDA balance of every owner on one chain. An account that was never created on that chain has no row, which is a zero balance. +async function getChainBalances(owners, chainId) { + const accounts = owners.map(owner => JSON.stringify(owner)).join(' ') + const data = await fetchLocal({ + pactCode: `(map (lambda (account) (try 0.0 (coin.get-balance account))) [${accounts}])`, + meta: mkMeta('', String(chainId), GAS_PRICE, 150000, Math.round(Date.now() / 1000) - 10, 600), + }, `${API}/chain/${chainId}/pact`) + if (data?.result?.status !== 'success' || !Array.isArray(data.result.data) || data.result.data.length !== owners.length) + throw new Error(`kadena: failed to fetch balances on chain ${chainId}: ${JSON.stringify(data?.result?.error ?? data).slice(0, 200)}`) + return data.result.data.map(toNumber) +} + +async function sumTokens({ balances = {}, owners = [] }) { + owners = [...new Set(owners)] + for (const owner of owners) + if (typeof owner !== 'string' || !/^[\w:.-]+$/.test(owner)) throw new Error(`kadena: unexpected account name ${owner}`) + if (!owners.length) return balances + + let total = 0 + for (let chainId = 0; chainId < CHAIN_COUNT; chainId++) { + const chainBalances = await getChainBalances(owners, chainId) + total += chainBalances.reduce((sum, balance) => sum + balance, 0) + } + + sdk.util.sumSingleBalance(balances, 'coingecko:kadena', total) + return balances +} + +module.exports = { + sumTokens +} diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index 95b9c001131..a0ee81f8fc8 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -26,6 +26,7 @@ const helpers = { "bitcoincash": require("./chain/bitcoincash"), "dash": require("./chain/dash"), "kaspa": require("./chain/kaspa"), + "kadena": require("./chain/kadena"), "bsv": require("./chain/bsv"), "arweave": require("./chain/arweave"), "pi": require("./chain/pi"), diff --git a/projects/kaddex/index.js b/projects/kaddex/index.js index ca08d7f9ee9..85fc5b27a61 100644 --- a/projects/kaddex/index.js +++ b/projects/kaddex/index.js @@ -1,5 +1,7 @@ const { fetchLocal, mkMeta } = require("../helper/pact"); +const { get } = require("../helper/http"); +const STATS_API = "https://dexapi.kadena.fun"; const chainId = "2"; const network = `https://api.chainweb-community.org/chainweb/0.0/mainnet01/chain/${chainId}/pact`; const GAS_PRICE = 0.00000001; @@ -44,16 +46,40 @@ const getPairList = async () => { return pairList; }; -async function tvl() { - const pairList = await getPairList(); - const kdaInPools = pairList.reduce((total, pair) => total + pair.kdaReserve, 0); +// The node can only be read at the current block. For a past date the KDA held by each pool comes +// from the daily history of the stats api the Mercatus app uses (https://www.mercatus.works/analytics). +const isHistorical = (api) => !!api?.timestamp && api.timestamp < Math.floor(Date.now() / 1000 / 86400) * 86400; + +const getHistoricalKdaInPools = async (timestamp) => { + const day = new Date(timestamp * 1000).toISOString().slice(0, 10); + const days = await get(`${STATS_API}/tvl/daily?dateStart=${day}&dateEnd=${day}`); + const pools = Array.isArray(days) ? days.find((item) => item._id === day)?.tvl : undefined; + if (!Array.isArray(pools) || !pools.length) throw new Error(`No Kaddex TVL history for ${day}`); + + let kdaInPools = 0; + for (const pool of pools) { + const kdaReserve = pool.tokenFrom === KDA ? pool.tokenFromTVL : pool.tokenTo === KDA ? pool.tokenToTVL : undefined; + if (kdaReserve === undefined) continue; // only KDA pairs can be valued + if (typeof kdaReserve !== "number" || !Number.isFinite(kdaReserve) || kdaReserve < 0) + throw new Error(`Bad Kaddex TVL history for ${pool.tokenFrom}:${pool.tokenTo} on ${day}`); + kdaInPools += kdaReserve; + } + return kdaInPools; +}; + +async function tvl(api) { + const kdaInPools = isHistorical(api) + ? await getHistoricalKdaInPools(api.timestamp) + : (await getPairList()).reduce((total, pair) => total + pair.kdaReserve, 0); // value of each pool taken to be twice the value of its KDA return { kadena: 2 * kdaInPools, }; } -async function staking() { +async function staking(api) { + // the staking pool has no history source: past dates report no staking, so a tvl refill is not blocked by it + if (isHistorical(api)) return {}; const stakedData = await fetchLocal( { pactCode: `(kaddex.staking.get-pool-state)`, @@ -72,7 +98,8 @@ async function staking() { } module.exports = { - timetravel: false, + timetravel: true, // tvl only, from the stats api history + start: '2022-08-01', misrepresentedTokens: true, methodology: "TVL accounts for the liquidity on all Kaddex (Mercatus) AMM pools paired with KDA, each valued at twice its KDA side. Staking is the KDX staked in the Kaddex staking pool, priced from the KDA/KDX pool.", kadena: { From 0ce8c22a313da07d6ff76d8989cda8c5584d548e Mon Sep 17 00:00:00 2001 From: Walker <71871303+walkermoz@users.noreply.github.com> Date: Wed, 18 Nov 2026 16:16:08 -0500 Subject: [PATCH 830/988] thedeep: count Ink Aegis pools on Uniswap and Calamari (#22297) Co-authored-by: FelixBruguera --- projects/thedeep/index.js | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/projects/thedeep/index.js b/projects/thedeep/index.js index 4c4bb5dfd6a..00bca4fe422 100644 --- a/projects/thedeep/index.js +++ b/projects/thedeep/index.js @@ -1,15 +1,43 @@ -const { getLogs } = require('../helper/cache/getLogs') +const { getLogs, getLogs2 } = require('../helper/cache/getLogs') +const { getHookPools, addUniV4PoolReserves } = require('../helper/uniswapV4') const abi = { "getTotalAmounts": "function getTotalAmounts() view returns (uint256 total0, uint256 total1)", + "getPoolTVL": "function getPoolTVL(address manager, (address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key) view returns ((uint256 coreAmount0, uint256 coreAmount1, uint256 hookReserves0, uint256 hookReserves1, uint256 hookEffective0, uint256 hookEffective1, uint160 sqrtPriceX96, int24 tick, uint128 activeLiquidity, uint256 blockNumber, address statsProvider, uint16 hookPermissions, bool hasCustomAccounting, uint8 statsStatus) result)", } module.exports = { - methodology: "Vault deposits", + methodology: "Vault deposits, plus the liquidity in Uniswap v4 and Calamari v4 pools on Ink that use the Aegis dynamic-fee hook. Pools are found from each PoolManager's Initialize events filtered by the hook, and their reserves are rebuilt on-chain from tick liquidity and the current price, so uncollected fees are not counted. The same pool liquidity is also counted by the Uniswap v4 and Calamari listings.", misrepresentedTokens: true, doublecounted: true, } // node test.js projects/thedeep/index.js +const initializeAbi = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks, uint160 sqrtPriceX96, int24 tick)' + +// Aegis hook pools on Ink. poolManager + fromBlock match the uniswap-v4 and calamari adapters, so the Initialize log cache is shared with them +const inkAegisUniswap = { poolManager: '0x360e68faccca8ca495c1b759fd9eee466db9fb32', fromBlock: 4580556, hook: '0xe449e013004db4a5681e9622ca10c5ba0ea610cc', stateView: '0x76fd297e2d437cd7f76d50f01afe6160f86e9990' } +const inkAegisCalamari = { poolManager: '0x6E4723A612831AfB9f5B2a5aE22723c37aAB9560', fromBlock: 54652108, hook: '0x2f449fa3f078960313749bc45ffcde0987f790cc' } +// Calamari has no StateView, so its pools are read through ReservesLens, which walks the same tick liquidity inside one call +const reservesLens = '0x0000001b173C3bbF3984D417d8614E3eed34865B' + +async function addInkAegisPools(api) { + const uniPools = await getHookPools({ api, ...inkAegisUniswap }) + await addUniV4PoolReserves({ api, pools: uniPools, stateView: inkAegisUniswap.stateView }) + + const { poolManager, fromBlock, hook } = inkAegisCalamari + const logs = await getLogs2({ api, target: poolManager, eventAbi: initializeAbi, fromBlock }) + const pools = logs.filter((log) => log.hooks.toLowerCase() === hook) + const reserves = await api.multiCall({ + target: reservesLens, + abi: abi.getPoolTVL, + calls: pools.map((p) => ({ params: [poolManager, [p.currency0, p.currency1, p.fee, p.tickSpacing, p.hooks]] })), + }) + reserves.forEach((r, i) => { + api.add(pools[i].currency0, r.coreAmount0) + api.add(pools[i].currency1, r.coreAmount1) + }) +} + const eventAbi = 'event ICHIVaultCreated (address indexed sender, address ichiVault, address tokenA, bool allowTokenA, address tokenB, bool allowTokenB, uint24 fee, uint256 count)' const topic = '0xde147f43b6837f282eee187234c866cf001806167325f3ea883e36bed0c16a20' @@ -96,6 +124,8 @@ Object.keys(config).forEach(chain => { }) } + if (chain === 'ink') await addInkAegisPools(api) + return api.getBalances() } } From c21ae75efefe2c47605dfa2d46c050ecb28927f0 Mon Sep 17 00:00:00 2001 From: slasher125 <74533329+slasher125@users.noreply.github.com> Date: Thu, 19 Nov 2026 01:43:34 +0400 Subject: [PATCH 831/988] export cex wallet addresses (#22290) Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- package.json | 1 + projects/binance/index.js | 8 +++++ projects/bitfinex/index.js | 1 + projects/bitget/index.js | 1 + projects/bitrue-cex/index.js | 3 +- projects/bitstamp/index.js | 4 +++ projects/coinex/index.js | 1 + projects/gate-io/index.js | 1 + projects/gemini/index.js | 1 + projects/huobi/index.js | 1 + projects/kucoin/index.js | 1 + projects/okex/index.js | 1 + utils/scripts/exportCexAddresses.js | 45 +++++++++++++++++++++++++++++ 13 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 utils/scripts/exportCexAddresses.js diff --git a/package.json b/package.json index 96f2cf72eda..f2938e2e3ef 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "use-token-labels": "node utils/scripts/useTokenLabels.js", "check-bitcoin-duplicates": "node utils/scripts/checkBTCDupsv2.js", "check-registries-duplicates": "node utils/scripts/checkRegistriesDups.js", + "export-cex-addresses": "node utils/scripts/exportCexAddresses.js", "check-core-assets-refs": "node utils/scripts/checkCoreAssetsRefs.js", "string-timestamp": "node utils/scripts/stringTimestamp.js", "migrate-dead": "node scripts/migrateDeadProjects.js", diff --git a/projects/binance/index.js b/projects/binance/index.js index 27e486ec86c..dff660ddece 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -235,3 +235,11 @@ module.exports.bitcoin = { tvl: bitcoinTvl } async function bitcoinTvl(api) { return sumTokens({ api, owners: await bitcoinAddressBook.binanceFetcher() }) } + +Object.defineProperty(module.exports, '_rawConfig', { + value: { + ...Object.fromEntries([...chains].map((chain) => [chain, { owners: async () => (await getOwners({ chain })).owners }])), + bitcoin: { owners: bitcoinAddressBook.binanceFetcher }, + }, + enumerable: false, +}) diff --git a/projects/bitfinex/index.js b/projects/bitfinex/index.js index 03e70e57c67..8418be32765 100644 --- a/projects/bitfinex/index.js +++ b/projects/bitfinex/index.js @@ -136,3 +136,4 @@ module.exports = mergeExports([ cexExports(config), { ethereum: { tvl: getStakedEthTVL({ withdrawalAddresses: withdrawalAddresses, size: 200, sleepTime: 20_000, proxy: true }) } }, ]) +Object.defineProperty(module.exports, '_rawConfig', { value: config, enumerable: false }) diff --git a/projects/bitget/index.js b/projects/bitget/index.js index e9ae21473f8..e79c84edb93 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -379,3 +379,4 @@ module.exports = mergeExports([ { ethereum: { tvl: getStakedEthTVL({ withdrawalAddresses: withdrawalAddresses, size: 200, sleepTime: 20_000, proxy: true }) } }, { avax: { tvl: avaxX.sumTokensExport({ owners: avaxXChainOwners }) } }, ]) +Object.defineProperty(module.exports, '_rawConfig', { value: { ...config, avax: { ...config.avax, owners: [...config.avax.owners, ...avaxXChainOwners] } }, enumerable: false }) diff --git a/projects/bitrue-cex/index.js b/projects/bitrue-cex/index.js index 98d068f263e..244d33379d1 100644 --- a/projects/bitrue-cex/index.js +++ b/projects/bitrue-cex/index.js @@ -128,4 +128,5 @@ vechain: { module.exports = mergeExports([ cexExports(config), { ethereum: { tvl: getStakedEthTVL({ withdrawalAddress: '0x4fd797f0cC7C87B1b48b0A0db6b66DB63780717d', size: 200, sleepTime: 20_000, proxy: true }) } }, -]) \ No newline at end of file +]) +Object.defineProperty(module.exports, '_rawConfig', { value: config, enumerable: false }) diff --git a/projects/bitstamp/index.js b/projects/bitstamp/index.js index 991459b2837..a705d525b59 100644 --- a/projects/bitstamp/index.js +++ b/projects/bitstamp/index.js @@ -111,3 +111,7 @@ module.exports = mergeExports([ { ethereum: { tvl: getStakedEthTVL({ withdrawalAddresses: withdrawalAddresses, size: 200, sleepTime: 20_000, proxy: true }) } }, ]) +Object.defineProperty(module.exports, '_rawConfig', { + value: Object.fromEntries(chains.map((chain) => [chain, { owners: async () => (await getAllData())[chain]?.owners ?? [] }])), + enumerable: false, +}) diff --git a/projects/coinex/index.js b/projects/coinex/index.js index 0a1e3dd236e..07e244267c0 100644 --- a/projects/coinex/index.js +++ b/projects/coinex/index.js @@ -40,3 +40,4 @@ module.exports = mergeExports([ cexExports(config), { ethereum: { tvl: getStakedEthTVL({ withdrawalAddresses: ['0xafedf06777839d59eed3163cc3e0a5057b514399' , '0x548054687ef6c56c6d82e8269e5fd93d8b88fcb2'], size: 200, sleepTime: 20_000, proxy: true }) } }, ]) +Object.defineProperty(module.exports, '_rawConfig', { value: config, enumerable: false }) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index faa71ba8737..f23bad5844a 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -2333,3 +2333,4 @@ module.exports = mergeExports([ cexExports(config), gateEarnTvl, ]); +Object.defineProperty(module.exports, '_rawConfig', { value: config, enumerable: false }) diff --git a/projects/gemini/index.js b/projects/gemini/index.js index ab6f4cc3931..eda36d8c373 100644 --- a/projects/gemini/index.js +++ b/projects/gemini/index.js @@ -23,3 +23,4 @@ const config = { module.exports = { ...cexExports(config), methodology: 'https://www.gemini.com/trust-center/' } +Object.defineProperty(module.exports, '_rawConfig', { value: config, enumerable: false }) diff --git a/projects/huobi/index.js b/projects/huobi/index.js index 4419c9c8300..4be569a95f0 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -192,3 +192,4 @@ module.exports = mergeExports([ module.exports.methodology = "We added the wallets from here https://github.com/huobiapi/Tool-Node.js-VerifyAddress/blob/main/snapshot/huobi_por_20230701.csv . We are not tracking 3 wallets, 2 on Heco Chain, 1 on BTTC chain. We also count stUSDT."; module.exports.hallmarks = [['2024-08-07', "remove usdd collateral"]]; +Object.defineProperty(module.exports, '_rawConfig', { value: config, enumerable: false }) diff --git a/projects/kucoin/index.js b/projects/kucoin/index.js index 98aadc0b61c..dc9aa856f5d 100644 --- a/projects/kucoin/index.js +++ b/projects/kucoin/index.js @@ -355,3 +355,4 @@ module.exports = mergeExports([ }, }, ]); +Object.defineProperty(module.exports, '_rawConfig', { value: config, enumerable: false }) diff --git a/projects/okex/index.js b/projects/okex/index.js index c1efbf6ab75..91c5a4002ef 100644 --- a/projects/okex/index.js +++ b/projects/okex/index.js @@ -1043,3 +1043,4 @@ module.exports = mergeExports([ }, }, ]); +Object.defineProperty(module.exports, '_rawConfig', { value: { ...config, filecoin: { owners: filecoinOwners } }, enumerable: false }) diff --git a/utils/scripts/exportCexAddresses.js b/utils/scripts/exportCexAddresses.js new file mode 100644 index 00000000000..354475c906b --- /dev/null +++ b/utils/scripts/exportCexAddresses.js @@ -0,0 +1,45 @@ +// Exports every CEX wallet as { exchange, chain, address } rows: the cex registry plus the CEX adapters that expose +// `_rawConfig`, with owner lists fetched at runtime resolved. Any failure fails the run, so a partial list is never stored. +// node utils/scripts/exportCexAddresses.js [--dry] --dry prints the count, writes nothing +require('dotenv').config() +const sdk = require('@defillama/sdk') +const bitcoinBook = require('../../projects/helper/bitcoin-book/index.js') + +const STORE_KEY = 'tvl-adapter-cache/cache/cex-addresses/latest.json' +const ADAPTERS = ['binance', 'bitfinex', 'bitget', 'bitrue-cex', 'bitstamp', 'coinex', 'gate-io', 'gemini', 'huobi', 'kucoin', 'okex'] +const EVM_RE = /^0x[0-9a-fA-F]{40}$/ + +async function run() { + const dry = process.argv.includes('--dry') + // Without R2_CONFIG.private the sdk skips the upload silently. + const hasR2 = Boolean(process.env.R2_CONFIG && JSON.parse(process.env.R2_CONFIG).private) + if (!dry && !hasR2) throw new Error('R2 credentials are not set') + + const configs = { ...require('../../cex/index.js')._rawConfigs } + for (const name of ADAPTERS) configs[name] = require(`../../projects/${name}/index.js`)._rawConfig + + const rows = new Map() + for (const [exchange, config] of Object.entries(configs)) { + for (const [chain, value] of Object.entries(config)) { + // `bitcoin` can name a list in the bitcoin address book instead of listing owners. + const chainConfig = chain === 'bitcoin' && typeof value === 'string' ? { owners: bitcoinBook[value] } : value + const owners = typeof chainConfig?.owners === 'function' ? await chainConfig.owners(new sdk.ChainApi({ chain })) : chainConfig?.owners + for (const owner of owners ?? []) { + const address = EVM_RE.test(owner) ? owner.toLowerCase() : owner + rows.set(`${exchange}:${chain}:${address}`, { exchange, chain, address }) + } + } + } + + const list = [...rows.values()] + console.log(`${list.length} addresses from ${new Set(list.map((row) => row.exchange)).size} exchanges`) + if (dry) return console.log(`--dry: not written to ${STORE_KEY}`) + const written = await sdk.cache.writeCache(STORE_KEY, list, { private: true }) + if (!written) throw new Error(`${STORE_KEY} not written`) + console.log(`wrote ${written.length}B to ${STORE_KEY}`) +} + +run().then(() => process.exit(0), (e) => { + console.error(e) + process.exit(1) +}) From 6468bccd5af5ea1d5df4254d2fb48c826e27b3f2 Mon Sep 17 00:00:00 2001 From: "duke.sol" <77286113+cryptoduke01@users.noreply.github.com> Date: Thu, 19 Nov 2026 06:52:42 +0100 Subject: [PATCH 832/988] Gloam: add BNB Chain (#22300) --- projects/gloam/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/projects/gloam/index.js b/projects/gloam/index.js index 289ccf446f0..b2dd369d2e4 100644 --- a/projects/gloam/index.js +++ b/projects/gloam/index.js @@ -3,9 +3,12 @@ const { getLogs2 } = require('../helper/cache/getLogs') const { sumTokensExport } = require('../helper/unwrapLPs') const { staking } = require('../helper/staking') -// Gloam's shielded pool (ShieldPoolPayments), the same address on every chain except Elysium. +// Gloam's shielded pool (ShieldPoolPayments): one address on Robinhood Chain, Tempo, Base and Ethereum, +// and another, shared by Elysium and BNB Chain. const POOL = '0x39e28cde55cab798874746ac52cb4b5cc99a0194' const ELYSIUM_POOL = '0x89d3042390204f57b8b4f8949d3c2203e4002164' +const BNB_POOL = ELYSIUM_POOL +const BDX_BSC = '0x6ad12e761b438bea3ea09f6c6266556bb24c2181' const GLOAM = '0xDcD885F5c60b3aD49F6D58718696417314e8724d' const OUSD = '0x20c0000000000000000000006a37da5c996874be' const KNTQ = '0xe45a355d9e9cad2ad85f2d03e3ee3102a036acf0' @@ -19,7 +22,7 @@ async function poolAssets(api, fromBlock) { const fromLogs = (fromBlock) => async (api) => api.sumTokens({ owner: POOL, tokens: await poolAssets(api, fromBlock) }) module.exports = { - methodology: 'TVL is the tokens held by the Gloam shielded pool on Robinhood Chain, Tempo, Base, Ethereum and Elysium. On Robinhood Chain, Base and Ethereum the accepted assets are discovered from the pool\'s DepositLimitSet events. $GLOAM held in the pool is the protocol\'s own token and is counted under staking.', + methodology: 'TVL is the tokens held by the Gloam shielded pool on Robinhood Chain, Tempo, Base, Ethereum, Elysium and BNB Chain. On Robinhood Chain, Base and Ethereum the accepted assets are discovered from the pool\'s DepositLimitSet events. $GLOAM held in the pool is the protocol\'s own token and is counted under staking.', start: '2026-10-21', robinhood: { tvl: fromLogs(94194599), @@ -35,4 +38,8 @@ module.exports = { // the Elysium pool also holds native HYPE (address 0) tvl: sumTokensExport({ owner: ELYSIUM_POOL, tokens: [ADDRESSES.null, ADDRESSES.elysium.USDC, KNTQ] }), }, + bsc: { + // the BNB Chain pool also holds native BNB (address 0); USDT and USDC have 18 decimals here + tvl: sumTokensExport({ owner: BNB_POOL, tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT, ADDRESSES.bsc.USDC, BDX_BSC] }), + }, } From 7d1508df2a4c8a0a668df5d857fa078013e18e52 Mon Sep 17 00:00:00 2001 From: Sealkaspa Date: Thu, 19 Nov 2026 00:56:35 -0500 Subject: [PATCH 833/988] Add Kasseal (Kaspa L1 launchpad) (#22298) Co-authored-by: Sealkaspa <345530833+Sealkaspa@users.noreply.github.com> Co-authored-by: ccipherx --- projects/kasseal/index.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 projects/kasseal/index.js diff --git a/projects/kasseal/index.js b/projects/kasseal/index.js new file mode 100644 index 00000000000..4828a0f194a --- /dev/null +++ b/projects/kasseal/index.js @@ -0,0 +1,39 @@ +const sdk = require('@defillama/sdk') +const { get } = require('../helper/http') + +// Kasseal's indexer lists the live curve cells (discovery only), each cell is a P2SH covenant that moves to a new address on every trade +const CELLS = 'https://api.kasseal.com/v1/metrics/cells' +const ATTEMPTS = 3 + +async function liveCurves() { + const { cells } = await get(CELLS) + return new Map(cells.filter((c) => c.kind === 'curve').map((c) => [c.tokenId, c.address])) +} + +async function tvl(api) { + let curves = await liveCurves() + const locked = new Map() // tokenId -> sompi + let pending = [...curves.keys()] + for (let attempt = 1; pending.length; attempt++) { + const balances = await sdk.chains.utxo.getBalances({ chain: 'kaspa', addresses: pending.map((t) => curves.get(t)) }) + const empty = [] + for (const t of pending) { + const sompi = BigInt(balances[curves.get(t)]) + if (sompi > 0n) locked.set(t, sompi) + else empty.push(t) + } + if (!empty.length || attempt === ATTEMPTS) break + const before = curves + curves = await liveCurves() + // an empty curve was traded after the listing: re-read its new address, a token no longer listed has graduated + pending = empty.filter((t) => curves.has(t) && curves.get(t) !== before.get(t)) + } + const sompi = [...locked.values()].reduce((a, b) => a + b, 0n) + api.addCGToken('kaspa', Number(sompi) / 1e8) +} + +module.exports = { + timetravel: false, + methodology: 'TVL is the KAS locked in live Kasseal bonding curves on Kaspa L1. Kasseal\'s indexer lists the live curve cells and each cell\'s KAS balance is read on chain. Token-side reserves are not counted. Graduated tokens move to Kasseal pools, which are listed separately.', + kaspa: { tvl }, +} From d4990b2ef5ca09748630f951436d3c1c95506602 Mon Sep 17 00:00:00 2001 From: paboxolabs Date: Thu, 19 Nov 2026 12:57:41 +0700 Subject: [PATCH 834/988] Paboxo: count the LP NFT collateral of the LP markets (#22299) Co-authored-by: Paboxo <356716720+paboxolabs@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/paboxo/index.js | 42 +++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/projects/paboxo/index.js b/projects/paboxo/index.js index ac63601453f..0183b6dee2f 100644 --- a/projects/paboxo/index.js +++ b/projects/paboxo/index.js @@ -10,15 +10,20 @@ const { sumTokens2 } = require('../helper/unwrapLPs') // per market, created by the LendingPool and announced through the PaboxoEmitter; the Position holds the // collateral. // +// The LP markets take Uniswap v3/v4 LP NFTs as collateral instead. Their Positions are announced by a second +// PaboxoEmitter and hold the NFTs themselves; each Position lists what it holds through nfts(). +// // tvl = USDG held by the vault and by every market it supplies (vault withdraw/supply queues) // + collateral held by every Position contract (PositionCreated logs) +// + the tokens inside every LP NFT held by an LP market Position (unwrapped to its two tokens) // borrowed = totalBorrowAssets of every market router the vault supplies -// -// Not counted yet: Uniswap v3/v4 LP NFTs posted as collateral in the LP markets (their Positions are announced -// by a separate emitter). Their USDG cash and debt are counted, since the same vault supplies them. const VAULT = '0xaF5aE508b2B57587c6cB9704950fa86c4090c634' // Paboxo USDG earn vault const EMITTER = '0xe3463043C6dFda7444E9C133C368740b8C4057d9' // PaboxoEmitter of the stock/WETH markets const FROM_BLOCK = 86793701 // core deployment block +const LP_EMITTER = '0x839CEa352A21791Df87b32bc510deA8AD6FE13f7' // PaboxoEmitter of the LP markets +const LP_FROM_BLOCK = 105975390 // LP deployment block +const UNI_V3_NFT = '0x73991a25C818Bf1f1128dEAaB1492D45638DE0D3' // Uniswap v3 NonfungiblePositionManager +const UNI_V4_NFT = '0x58daec3116aae6D93017bAAea7749052E8a04fA7' // Uniswap v4 PositionManager const abi = { asset: 'function asset() view returns (address)', @@ -32,6 +37,7 @@ const abi = { borrowToken: 'function borrowToken() view returns (address)', totalBorrowAssets: 'function totalBorrowAssets() view returns (uint256)', positionCreated: 'event PositionCreated(address lendingPool, address lendingPoolRouter, address user, address position)', + nfts: 'function nfts() view returns (address[] positionManagers, uint256[] tokenIds)', } async function getMarkets(api) { @@ -57,7 +63,32 @@ async function tvl(api) { logs.forEach((l) => tokensAndOwners.push([collateralOf[l.lendingPoolRouter.toLowerCase()], l.position])) } - return sumTokens2({ api, tokensAndOwners }) + await sumTokens2({ api, tokensAndOwners }) + await addLpCollateral(api) + return api.getBalances() +} + +// The LP NFTs every LP market Position holds, unwrapped into their two tokens at the pool's current price. +async function addLpCollateral(api) { + const logs = await getLogs2({ api, target: LP_EMITTER, eventAbi: abi.positionCreated, fromBlock: LP_FROM_BLOCK }) + const positions = [...new Set(logs.map((l) => l.position.toLowerCase()))] + if (!positions.length) return + const held = await api.multiCall({ abi: abi.nfts, calls: positions }) + + const v3Owners = new Set() + const v4Ids = [] + held.forEach(({ positionManagers, tokenIds }, i) => { + positionManagers.forEach((pm, j) => { + if (pm.toLowerCase() === UNI_V3_NFT.toLowerCase()) v3Owners.add(positions[i]) + else if (pm.toLowerCase() === UNI_V4_NFT.toLowerCase()) v4Ids.push(tokenIds[j]) + else throw new Error(`unknown position manager ${pm} in Paboxo LP position ${positions[i]}`) + }) + }) + + if (v3Owners.size) + await sumTokens2({ api, uniV3nftsAndOwners: [...v3Owners].map((owner) => [UNI_V3_NFT, owner]) }) + if (v4Ids.length) + await sumTokens2({ api, resolveUniV4: true, uniV4ExtraConfig: { nftAddress: UNI_V4_NFT, positionIds: v4Ids } }) } async function borrowed(api) { @@ -70,8 +101,9 @@ async function borrowed(api) { } module.exports = { + doublecounted: true, // LP collateral sits in Uniswap V3/V4 pools methodology: - 'TVL is the USDG held by the Paboxo earn vault and by the lending markets it supplies, plus the stock tokens and WETH that borrowers hold as collateral in their Position contracts (found through PositionCreated events). Borrowed is the outstanding USDG debt of every market. Uniswap LP NFTs posted as collateral in the LP markets are not counted yet.', + 'TVL is the USDG held by the Paboxo earn vault and by the lending markets it supplies, plus the stock tokens and WETH that borrowers hold as collateral in their Position contracts (found through PositionCreated events), plus the tokens inside the Uniswap v3/v4 LP NFTs held as collateral by the LP market Positions. Borrowed is the outstanding USDG debt of every market.', start: '2026-10-12', robinhood: { tvl, borrowed }, } From 1b320f2625ee4d199792587d87eb0d93eff2856b Mon Sep 17 00:00:00 2001 From: Naveen-Arali <79274475+0xminer11@users.noreply.github.com> Date: Thu, 19 Nov 2026 13:55:19 +0530 Subject: [PATCH 835/988] Bima (#22303) --- projects/bima-labs/index.js | 65 ++++++++++++++++++++++++ projects/helper/bitcoin-book/bima-cdp.js | 3 ++ 2 files changed, 68 insertions(+) create mode 100644 projects/bima-labs/index.js create mode 100644 projects/helper/bitcoin-book/bima-cdp.js diff --git a/projects/bima-labs/index.js b/projects/bima-labs/index.js new file mode 100644 index 00000000000..a2fe9415ac3 --- /dev/null +++ b/projects/bima-labs/index.js @@ -0,0 +1,65 @@ +// Bima Credit: fixed-term, collateralised credit vaults. +// Every strategy is created by a CollateralFixedTermFactory, which pairs it with an +// ERC-4626-style vault holding the lent asset. Lenders deposit into the vault; when the +// borrower draws, funds leave the vault and are tracked as the strategy's outstanding principal. + +// CollateralFixedTermFactory per chain +const FACTORIES = { + monad: '0x8731e1caf2b8159c9dbcd496c07211a20b5f277a', + ethereum: '0xcC2Af6B6B3a888D96166205B9bA27d7dba3a67DE', + base: '0xcC2Af6B6B3a888D96166205B9bA27d7dba3a67DE', + bsc: '0xF9a0197f9dB6bd8171EBa53D21cb098597D23871', +} + +// Internal test strategies deployed through the production factories — excluded from TVL. +const EXCLUDED_STRATEGIES = { + monad: [ + '0x017D3dC2f035347A1F5C6896A9Ea3960B0fbC0C7', // SiskinBimaMonadTest + '0xda3fd06AbD7e947B71Ac332Ae81e684c8dDCC99C', // SiskinBimaMonadTest1 + ], + base: [ + '0xc3b59773c1535A70E1c7980ed89cb0608Ed29C43', // SiskinBimaBaseTest1 + '0xf747A93337A37a29A94aa0afFB3e2AA1Ae6F14EF', // SiskinBimaBaseTest3 + ], + bsc: [ + '0x4983eE28ee8eeDa2E04213c4cd18b53898DF69F6', // SiskinBimaBNBTest2 + ], +} + +const LOAN_ABI = 'function loan() view returns ((uint256 minDeposit, uint256 minRedeem, uint256 maxCapacity, uint256 minCapacity, uint256 reserveThreshold, uint256 outstandingPrincipal, uint256 outstandingInterest, uint256 drawableFunds, uint256 interestRate, uint256 lateInterestPenalty, uint256 claimableInterest, uint256 interestInterval, uint256 startTime, uint256 termsSetTime, uint256 termsUpdateTime, uint256 duration, uint256 depositPeriod, uint256 acceptGracePeriod, uint256 withdrawalPeriod, uint256 lateInterestGracePeriod))' + +async function getMarkets(api) { + const FACTORY = FACTORIES[api.chain] + const count = await api.call({ target: FACTORY, abi: 'uint256:getStrategiesCount' }) + const excluded = new Set((EXCLUDED_STRATEGIES[api.chain] || []).map(s => s.toLowerCase())) + const allStrategies = await api.call({ + target: FACTORY, + abi: 'function getStrategiesPaginated(uint256 start, uint256 end) view returns (address[])', + params: [0, count], + }) + const strategies = allStrategies.filter(s => !excluded.has(s.toLowerCase())) + const vaults = await api.multiCall({ target: FACTORY, abi: 'function getStrategyVault(address) view returns (address)', calls: strategies }) + const assets = await api.multiCall({ abi: 'address:asset', calls: vaults }) + return { strategies, vaults, assets } +} + +// Idle lender deposits sitting in the vaults (not yet drawn by borrowers) +async function tvl(api) { + const { vaults, assets } = await getMarkets(api) + return api.sumTokens({ tokensAndOwners2: [assets, vaults] }) +} + +// Principal drawn by borrowers and still outstanding +async function borrowed(api) { + const { strategies, assets } = await getMarkets(api) + const loans = await api.multiCall({ abi: LOAN_ABI, calls: strategies }) + loans.forEach((loan, i) => api.add(assets[i], loan.outstandingPrincipal)) +} + +module.exports = { + methodology: 'TVL is the balance of lent assets held in Bima Credit vaults created by the CollateralFixedTermFactory on each chain. Borrowed is the outstanding principal drawn by borrowers from those vaults.', +} + +Object.keys(FACTORIES).forEach(chain => { + module.exports[chain] = { tvl, borrowed } +}) diff --git a/projects/helper/bitcoin-book/bima-cdp.js b/projects/helper/bitcoin-book/bima-cdp.js new file mode 100644 index 00000000000..7eaabdd3ce5 --- /dev/null +++ b/projects/helper/bitcoin-book/bima-cdp.js @@ -0,0 +1,3 @@ +module.exports = [ + "bc1q8q5ngue8697flt8yc52xrfppecf47jghhlvq8v96ukeaqz694y7q2tzca9" + ] \ No newline at end of file From 2e126c77af4b29f7f4056ebc3d04b583d0ffa96f Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Thu, 19 Nov 2026 11:26:15 +0300 Subject: [PATCH 836/988] Add gmoon (#22302) Co-authored-by: Denis Davydov Co-authored-by: Claude Sonnet 5.5 --- projects/gemoon/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/gemoon/index.js diff --git a/projects/gemoon/index.js b/projects/gemoon/index.js new file mode 100644 index 00000000000..84c24136380 --- /dev/null +++ b/projects/gemoon/index.js @@ -0,0 +1,31 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs2 } = require('../helper/cache/getLogs') + +// Gemoon (gmoon.trade) — meme token launchpad on Uniswap V4, Robinhood Chain. +// Pool liquidity itself sits in the Uniswap V4 PoolManager and is already counted by the +// uniswap-v4 adapter, so only the protocol's own contracts are counted here. +const CONTROLLER = '0x1d05Da4495E57C764229Ec355FCEC1298C6A4AeD' // creates memes (TokenCreated) +const VAULT = '0x1fd8082AC782444EcD013803A18BAD383BFAc0F8' // staked memes, USDG fees, reward assets +const FROM_BLOCK = 104517510 // Controller deployment + +async function tvl(api) { + const logs = await getLogs2({ + api, target: CONTROLLER, fromBlock: FROM_BLOCK, + eventAbi: 'event TokenCreated(address indexed tokenAddress, address indexed creatorAdmin, uint256 indexed positionId, address creatorRewardRecipient, string name, string symbol)', + }) + const memes = logs.map(l => l.tokenAddress) + const usdg = await api.call({ target: VAULT, abi: 'address:usdg' }) + const rewardAssets = await api.call({ target: VAULT, abi: 'address[]:allowedAssets' }) + + // memes staked by users: the amount the Vault tracks, not its raw token balance + const staked = await api.multiCall({ abi: 'function totalStaked(address) view returns (uint256)', target: VAULT, calls: memes }) + api.add(memes, staked) + + return sumTokens2({ api, owner: VAULT, tokens: [usdg, ...rewardAssets] }) +} + +module.exports = { + methodology: 'Counts assets held by the Gemoon Vault: the meme tokens staked by users, USDG swap fees pending distribution, and converted reward assets. The list of memes comes from the TokenCreated events of the controller. The Referrals contract is not counted. Liquidity in the Uniswap V4 pools of the memes is held by the PoolManager and is counted by the Uniswap V4 adapter, not here.', + start: '2026-11-03', + robinhood: { tvl }, +} From fac6adb3d1d5e5f0520fe160060a76e1a27d0e17 Mon Sep 17 00:00:00 2001 From: AndyChan <110432670+AndyChanWeb3@users.noreply.github.com> Date: Thu, 19 Nov 2026 23:37:27 +1100 Subject: [PATCH 837/988] Bitty Vault: add BNB Chain (#22305) Co-authored-by: andy.chan Co-authored-by: Claude Opus 5.5 --- projects/bitty-vaults/index.js | 45 ++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/projects/bitty-vaults/index.js b/projects/bitty-vaults/index.js index 16874148c6f..7b0575f720c 100644 --- a/projects/bitty-vaults/index.js +++ b/projects/bitty-vaults/index.js @@ -3,7 +3,7 @@ // The earlier Bitty lending markets are retired. // // TVL is what the vaults hold: every vault the factory has activated (one CREATE2 address per chain), -// its native ETH plus the guard-listed assets, plus the receipt tokens of its protocol positions +// its native coin (ETH, or BNB on BSC) plus the guard-listed assets, plus the receipt tokens of its protocol positions // (Aave aTokens, Lido stETH, Sky sUSDS). Those positions are also counted by the protocols // themselves, hence doublecounted. Bitty's own fee vault is protocol revenue, not deposits, and is // left out. @@ -128,6 +128,47 @@ const config = { '0x5fc5360d0400a0fd4f2af552add042d716f1d168', // USDG ], }, + bsc: { + fromBlock: 132700666, + tokens: [ + '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c', // WBNB + '0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c', // BTCB + '0x2170ed0880ac9a755fd29b2688956bd959f933f8', // ETH + // Tokenized stocks and ETFs (Ondo Global Markets) + '0x992879cd8ce0c312d98648875b5a8d6d042cbf34', // CRCL + '0xa9ee28c80f960b889dfbd1902055218cba016f75', // NVDA + '0x7313ea16493b2f55054df0131a3a14b043ec8992', // MSTR + '0x091fc7778e6932d4009b087b191d1ee3bac5729a', // GOOGL + '0x2494b603319d4d9f9715c9f4496d9e0364b59d93', // TSLA + '0x8b6acf6041a81567f012ff6a4c6d96d5818d74bf', // MU + '0x0cde6936d305d5b34667fc46425e852efd73559a', // QQQ + '0x390a684ef9cade28a7ad0dfa61ab1eb3842618c4', // AAPL + '0xa528caaa2f96090e379d43f90834c75df54d6e74', // INTC + '0x4553cfe1c09f37f38b12dc509f676964e392f8fc', // AMZN + '0xf8589b526fdd65f7f301c605a6e04f0f1b4b3620', // COIN + '0x6bfe75d1ad432050ea973c3a3dcd88f02e2444c3', // MSFT + '0x52ad57a7ea642e99a892afc79e937b383f1b59e9', // BMNR + '0x8b872732b07be325a8803cdb480d9d20b6f8d11b', // SLV + '0x6a708ead771238919d85930b5a0f10454e1c331a', // SPY + '0xd7df5863a3e742f0c767768cdfcb63f09e0422f6', // META + '0xc37042a7a4fa510d8884a433762ab87257b91965', // TSM + '0xd0a58bc9d88d3ff48c0294cb7e45937d0e41a928', // SPCX + '0x0ed2e3180edf393e6bf8db124bd15ddd54de150a', // AVGO + '0x9f16e46c73b43bdb70861247d537bee4ea18f639', // AMD + '0xfbd4d681c92ead6af0e49950c8b2e47eeacbb2db', // QCOM + '0x19601179a60f55ff6636f5d1a8b6671053bd60a8', // HOOD + '0x9351abd19f42101dd36025e495b98e910b255d78', // PLTR + // Stablecoins + '0x55d398326f99059ff775485246999027b3197955', // USDT + '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', // USDC + // Position receipt tokens (Aave V3 BNB market) + '0x9b00a09492a626678e5a3009982191586c444df9', // aBnbWBNB + '0x56a7ddc4e848ebf43845854205ad71d5d5f72d3d', // aBnbBTCB + '0x2e94171493fabe316b6205f1585779c887771e2f', // aBnbETH + '0xa9251ca9de909cb71783723713b21e4233fbf1b1', // aBnbUSDT + '0x00901a076785e0906d1028c7d6372d247bec7d61', // aBnbUSDC + ], + }, } async function tvl(api) { @@ -138,7 +179,7 @@ async function tvl(api) { } module.exports = { - methodology: 'Counts the native ETH and the tokens held by every Bitty vault the factory has activated, including the receipt tokens of positions a vault opened through Bitty (Aave aTokens, Lido stETH, Sky sUSDS). Bitty\'s own fee vault is excluded.', + methodology: 'Counts the native coin (ETH, or BNB on BNB Chain) and the tokens held by every Bitty vault the factory has activated, including the receipt tokens of positions a vault opened through Bitty (Aave aTokens, Lido stETH, Sky sUSDS). Bitty\'s own fee vault is excluded.', doublecounted: true, } From 24c84f0f6115841819433ce783ec30a7406cc8e6 Mon Sep 17 00:00:00 2001 From: cedex-dev Date: Thu, 19 Nov 2026 14:42:50 +0200 Subject: [PATCH 838/988] Track Cedex Earn multi-token borrowing (#22304) Co-authored-by: v.lushnykov --- projects/cedex-earn/index.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/projects/cedex-earn/index.js b/projects/cedex-earn/index.js index b1dbc89e992..aeabc0a78c4 100644 --- a/projects/cedex-earn/index.js +++ b/projects/cedex-earn/index.js @@ -1,29 +1,30 @@ const { sumTokensExport } = require('../helper/sumTokens') const ADDRESSES = require('../helper/coreAssets.json') -// MultiPool proxy, holds the credit-market accounting (token) read by getCreditInfo below. -const MULTI_POOL = '0x89c5c95118a9E1e563B6ADfEC56Fa82b81DfADDb' -// Deposit pool currently created on ethereum uses USDC. +// MultiPool proxy, holds the credit-market accounting (per token) read by getCreditInfo below. +const MULTI_POOL = '0x974A1f9FA9C59874EA77221c9E52bB5a5Ed03429' const DEPOSIT_VAULT = '0x579C9d3FC77793b14d9b3EC1F11a7fd5C7F9A34D' const CREDIT_VAULT = '0xa75A28189a4E8250A98C347adf1e40fF36207268' +const EURC = '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c' +const TOKENS = [ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, EURC] + const abi = { getCreditInfo: 'function getCreditInfo(address token, address user) view returns (tuple(address token, uint16 creditApr, uint128 totalDeposited, uint128 totalBorrowed, bool paused, tuple(uint128 principalBalance, uint256 pendingCreditInterest, bool isBorrower, tuple(uint32 creditId, uint256 pendingInterest, tuple(uint128 principalBalance, uint128 interestDebt, uint128 accruedInterest) creditLine)[] creditsInfo) userInfo, uint16 avgApr) creditInfo)', } async function borrowed(api) { - const { totalBorrowed } = await api.call({ target: MULTI_POOL, abi: abi.getCreditInfo, params: [ADDRESSES.ethereum.USDC, ADDRESSES.null] }) - api.add(ADDRESSES.ethereum.USDC, totalBorrowed) + const infos = await api.multiCall({ target: MULTI_POOL, abi: abi.getCreditInfo, calls: TOKENS.map(token => ({ params: [token, ADDRESSES.null] })) }) + infos.forEach((info, i) => api.add(TOKENS[i], info.totalBorrowed)) } module.exports = { - methodology: 'Tvl: value of USDC in the vault, borrowed: USDC borrowed by the users', + methodology: 'Tvl: value of USDC, USDT and EURC in the vaults, borrowed: USDC, USDT and EURC borrowed by the users', ethereum: { tvl: sumTokensExport({ owners: [DEPOSIT_VAULT, CREDIT_VAULT], - tokens: [ADDRESSES.ethereum.USDC], + tokens: TOKENS, }), borrowed, }, } - From f8f0492d11a6e0a0a5733813474573d94bda970d Mon Sep 17 00:00:00 2001 From: "0xshubhs.eth" Date: Thu, 19 Nov 2026 20:56:57 +0530 Subject: [PATCH 839/988] getStakedEthTVL: drop the options it ignores, dedupe the addresses (#22308) --- projects/helper/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 44e7fc579d3..fabbc4c7314 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -326,13 +326,13 @@ function once(func) { return wrapped } -function getStakedEthTVL({ withdrawalAddress, withdrawalAddresses, skipValidators = 0, size = 200, sleepTime = 10000, proxy = false }) { +function getStakedEthTVL({ withdrawalAddress, withdrawalAddresses }) { return async (api) => { if (!withdrawalAddress && !withdrawalAddresses?.length) throw new Error('Please provide withdrawalAddress or withdrawalAddresses') - const addresses = withdrawalAddresses ?? [withdrawalAddress] + const addresses = [...new Set((withdrawalAddresses ?? [withdrawalAddress]).map(i => i.toLowerCase()))] api.addGasToken(await beacon.balance(addresses)) return api.getBalances() }; From d2418b38772dd07aeaf07bcd9b9c39e2302396cf Mon Sep 17 00:00:00 2001 From: Sauhard Dubey <143753120+100hard@users.noreply.github.com> Date: Thu, 19 Nov 2026 21:08:25 +0530 Subject: [PATCH 840/988] Add Quotrons Ink TVL and treasury adapters (#22306) Co-authored-by: FelixBruguera --- projects/quotrons/index.js | 39 ++++++++++++++++++++++++++++++++++++++ registries/treasury.js | 7 +++++++ 2 files changed, 46 insertions(+) create mode 100644 projects/quotrons/index.js diff --git a/projects/quotrons/index.js b/projects/quotrons/index.js new file mode 100644 index 00000000000..2c82249805c --- /dev/null +++ b/projects/quotrons/index.js @@ -0,0 +1,39 @@ +const { addUniV3LikePosition } = require('../helper/unwrapLPs') +const { nullAddress } = require('../helper/tokenMapping') + +const FACTORY = '0xbFA531C90FD9e42aC13Af14823B30e40761dd3A2' +const HOOK = '0x8bb4516059F9149Bc3b89018Fc7537f1F14a30cc' +const STATE_VIEW = '0x76fd297e2d437cd7f76d50f01afe6160f86e9990' +const slot0Abi = 'function getSlot0(bytes32) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)' + +async function tvl(api) { + const usdg = await api.call({ abi: 'address:usdg', target: FACTORY }) + const stocks = await api.fetchList({ lengthAbi: 'stockCount', itemAbi: 'allStocks', target: FACTORY }) + const vaults = (await api.multiCall({ abi: 'function vaultOf(address) view returns (address)', target: FACTORY, calls: stocks })).filter(v => v !== nullAddress) + + const poolIds = await api.multiCall({ abi: 'bytes32:poolId', calls: vaults }) + const token0s = await api.multiCall({ abi: 'address:currency0', calls: vaults }) + const token1s = await api.multiCall({ abi: 'address:currency1', calls: vaults }) + const tickLowers = await api.multiCall({ abi: 'int24:tickLower', calls: vaults }) + const tickUppers = await api.multiCall({ abi: 'int24:tickUpper', calls: vaults }) + const liquidities = await api.multiCall({ abi: 'uint128:positionLiquidity', calls: vaults }) + const slot0s = await api.multiCall({ abi: slot0Abi, target: STATE_VIEW, calls: poolIds }) + // unharvested LP fees the hook holds for each vault + const lpPots = await api.multiCall({ abi: 'function lpPot(bytes32) view returns (uint256)', target: HOOK, calls: poolIds }) + + vaults.forEach((_, i) => { + addUniV3LikePosition({ api, token0: token0s[i], token1: token1s[i], liquidity: +liquidities[i], tickLower: +tickLowers[i], tickUpper: +tickUppers[i], tick: +slot0s[i].tick }) + api.add(usdg, lpPots[i]) + }) + // idle stock and harvested LP fees (USDG) held by the vaults + return api.sumTokens({ owners: vaults, tokens: [usdg, ...stocks] }) +} + +module.exports = { + doublecounted: true, + methodology: + 'Tracks the underlying Uniswap V4 LP positions, vault-held idle balances and harvested LP fee entitlements, plus hook-held unharvested LP fee entitlements (lpPot) across all active Quotrons stock LP vaults on Ink.', + ink: { + tvl, + }, +} diff --git a/registries/treasury.js b/registries/treasury.js index e5f38421135..e2f5b90ccf6 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -6788,6 +6788,13 @@ const configs = { owners: ["0x5be4fb908a43d61b1c8086fe62e39ae8ec483926"], }, }, + 'treasury/quotrons': { + ink: { + // Buyback Safe and Growth Sink; the Growth Sink's LP vault shares are counted in the protocol's TVL + owners: ['0x79aF491d1B533A3fcD1c9ab009931aC95701F6ff', '0x73F5111EE91672c114923793C03B5c868d9C5E03'], + tokens: [nullAddress, ADDRESSES.ink.WETH, ADDRESSES.ink.USDT0, ADDRESSES.ink.USDC, '0xe343167631d89B6Ffc58B88d6b7fB0228795491D'], // + USDG + }, + }, } const protocols = {} From 2239347486560886e98890c0b4d8d92a3b87b2f8 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Thu, 19 Nov 2026 21:32:56 +0300 Subject: [PATCH 841/988] =?UTF-8?q?fix:=20update=20VFT=20Manager=20address?= =?UTF-8?q?=20of=20Vara=20=E2=87=8C=20Ethereum=20Bridge=20(#22311)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: FelixBruguera --- projects/vara-ethereum-bridge/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/vara-ethereum-bridge/index.js b/projects/vara-ethereum-bridge/index.js index 72b9cc71a9b..336feb0531d 100644 --- a/projects/vara-ethereum-bridge/index.js +++ b/projects/vara-ethereum-bridge/index.js @@ -2,7 +2,10 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const { post } = require('../helper/http') -const ERC20_MANAGER = '0x16fCff97822fcf3345Fa76D29c229b11C49EaE12'; +const ERC20_MANAGERS = [ + '0x16fCff97822fcf3345Fa76D29c229b11C49EaE12', // used until the Verifier hack (Oct 2026) + '0x53654aEC4171A888d131B5aCab06881cb8f04B9D', +] const VARA_RPC = 'https://rpc.vara.network' const WVARA_VFT = '0x29c42c668012b1ce20720e4615229215023281ef4676fdc77bf047d7fbcb9d17' @@ -17,7 +20,7 @@ const ROUTE = Buffer.concat([scaleStr('Vft'), scaleStr('BalanceOf')]) async function tvl(api) { await sumTokens2({ api, - owners: [ERC20_MANAGER], + owners: ERC20_MANAGERS, tokens: [ ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, From 1f5d1e4d85e12e38ba688f24492bda0ced22f128 Mon Sep 17 00:00:00 2001 From: Justa Date: Fri, 20 Nov 2026 03:11:02 +0800 Subject: [PATCH 842/988] fix(bucket-protocol): read Balance fields for v1 TVL (#22310) Co-authored-by: Claude --- projects/bucket-protocol/index.js | 106 +++--------------------------- 1 file changed, 8 insertions(+), 98 deletions(-) diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js index 38bca636870..bb9685f3991 100644 --- a/projects/bucket-protocol/index.js +++ b/projects/bucket-protocol/index.js @@ -29,7 +29,11 @@ async function calculatehaSuiSuiVaultShares(api, token0, token1, lpAmount) { const vaultObject = await getObject(SUI_HASUI_VAULT_ID) const lpSupply = vaultObject.fields.lp_token_treasury.fields.total_supply.fields.value; const lpRatio = lpAmount / lpSupply - const clmmPosition = vaultObject.fields.positions[0]?.fields?.clmm_postion?.fields + // the position was moved out of the positions vector into a dynamic field + const [position] = vaultObject.fields.positions.length + ? vaultObject.fields.positions + : (await sui.getDynamicFieldObjects({ parent: SUI_HASUI_VAULT_ID })).map((i) => i.fields.value) + const clmmPosition = position?.fields?.clmm_postion?.fields if (!clmmPosition) return // vault currently holds no CLMM position (rebalancing / withdrawn) const liquidity = clmmPosition.liquidity * lpRatio // https://github.com/DefiLlama/DefiLlama-Adapters/pull/13512#issuecomment-2660797053 @@ -119,24 +123,6 @@ const CETABLE_PSM = const STAPEARL_PSM = "0xccdaf635eb1c419dc5ab813cc64c728a9f5a851202769e254f348bff51f9a6dc"; -const afSUI_sLP_ID = - "0x508da82c0b6785653f638b95ebf7c89d720ecffae15c4d0526228a2edae7d429"; - -const vSUI_sLP_ID = - "0xa68124b518290f430f2133bcb679c519e51c99045e622cd6bcb00374c97f6d9d"; - -const haSUI_sLP_ID = - "0xa8993bf1c1e717b7c0f164c51346fa99a4e771c50d90c14e755adc48e39b7768"; - -const navi_sLP_ID = - "0xcbe804c8c334dcadecd4ba05ee10cffa54dad36f279ab4ec9661d67f9372881c"; - -const navi_stSUI_sLP_ID = - "0xd3f6b8f3c92d8f967f7e177e836770421e351b419ffe074ce57911365b4ede56"; - -const navi_sbWBTC_LP_ID = - "0x208628e8800828b272dfc4cf40ef98e1ba137f65d26a28961176a1718c2bdb4c"; - const scallop_sUSDC_LP_ID = "0x7b16192d63e6fa111b0dac03f99c5ff965205455089f846804c10b10be55983c"; @@ -149,32 +135,10 @@ const scallop_sCircleUSDC_LP_ID = const scallop_sSuiBridgeUSDT_LP_ID = "0x8471787fc69ef06f4762cb60863e1c48475d79c804a000e613306adee7b7824a"; -const navi_sCircleUSDC_LP_ID = - "0xb5ed3f2e5c19f425baad3d9a0afffdc84d0550ace2372692cf93325da81e4392"; - -const navi_sSuiBridgeUSDT_LP_ID = - "0x4ae310b93c65e358b6f8beb73f34d0ac7d507947d8aea404159d19883a3b1c6a"; - -const navi_fdUSD_LP_ID = - "0xa2790bbd90275e35214bffd8da3c01742bb5883fde861bf566a9ecfa1b3f5090"; - -const haSUI_Navi_Pond_ID = "0xef1ff1334c1757d8e841035090d34b17b7aa3d491a3cb611319209169617518e" - -const SUI_Navi_Pond_ID = "0xcf887d7201c259496a191348da86b4772a2e2ae3f798ca50d1247194e30b7656"; - -async function getStakingLPAmount(id) { - const stakingLPObject = await sui.getObject(id); - return stakingLPObject.fields.output_volume; -} - +// read the Balance field, not the u64 accounting field (Balance is the real asset amount) async function getScallopsLPAmount(id) { const stakingLPObject = await sui.getObject(id); - return stakingLPObject.fields.coin_balance; -} - -async function getNaviLPAmount(id) { - const stakingLPObject = await sui.getObject(id); - return stakingLPObject.fields.coin_balance; + return stakingLPObject.fields.scoin_balance; } function convertUnderlyingAssets(coin) { @@ -346,52 +310,7 @@ async function tvl(api) { Math.floor(afsuiPercentage * afsuiSuiLpBucketStaked) ); - //Staking LPs - const safSUILPAmount = await getStakingLPAmount(afSUI_sLP_ID); - api.add( - "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI", - safSUILPAmount - ); - - const svSUILPAmount = await getStakingLPAmount(vSUI_sLP_ID); - api.add( - "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", - svSUILPAmount - ); - - const shaSUILPAmount = await getStakingLPAmount(haSUI_sLP_ID); - api.add( - "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI", - shaSUILPAmount - ); - - const snaviLPAmount = await getStakingLPAmount(navi_sLP_ID); - api.add( - "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", - snaviLPAmount - ); - - const snavistSUILPAmount = await getStakingLPAmount(navi_stSUI_sLP_ID); - api.add( - "0xd1b72982e40348d069bb1ff701e634c117bb5f741f44dff91e472d3b01461e55::stsui::STSUI", - snavistSUILPAmount - ); - - const snavisbWBTCLPAmount = await getStakingLPAmount(navi_sbWBTC_LP_ID); - api.add(ADDRESSES.sui.WBTC, snavisbWBTCLPAmount); - - const haSuiNaviPondAmount = await getStakingLPAmount(haSUI_Navi_Pond_ID); - api.add( - "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI", - haSuiNaviPondAmount - ); - - const suiNaviPondAmount = await getStakingLPAmount(SUI_Navi_Pond_ID); - api.add( - SUI, - suiNaviPondAmount - ); - + /// Scallop sCOIN held by the vaults, regarded as underlying assets const scallopUSDC_LPAmount = await getScallopsLPAmount(scallop_sUSDC_LP_ID); api.add(USDC, scallopUSDC_LPAmount); @@ -404,15 +323,6 @@ async function tvl(api) { const scallopSuiBridgeUSDT_LPAmount = await getScallopsLPAmount(scallop_sSuiBridgeUSDT_LP_ID); api.add(ADDRESSES.sui.suiUSDT, scallopSuiBridgeUSDT_LPAmount); - const naviCircleUSDC_LPAmount = await getNaviLPAmount(navi_sCircleUSDC_LP_ID); - api.add(USDC_CIRCLE, naviCircleUSDC_LPAmount); - - const naviSuiBridgeUSDT_LPAmount = await getNaviLPAmount(navi_sSuiBridgeUSDT_LP_ID); - api.add(ADDRESSES.sui.suiUSDT, naviSuiBridgeUSDT_LPAmount); - - const naviFDUSD_LPAmount = await getNaviLPAmount(navi_fdUSD_LP_ID); - api.add(FDUSD, naviFDUSD_LPAmount); - api.removeTokenBalance('0x622345b3f80ea5947567760eec7b9639d0582adcfd6ab9fccb85437aeda7c0d0::scallop_wal::SCALLOP_WAL') // incorrect price, temporarily remove } From 49d525a140ee73ee69dda95dae67e30b2f5e6e31 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 19 Nov 2026 15:29:11 -0400 Subject: [PATCH 843/988] Add Biribi (#22313) Co-authored-by: BiribiNet --- registries/sumTokens/data3.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 063dbae1bb2..36fb7097be7 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1238,6 +1238,16 @@ module.exports = { ] }, }, + "biribi": { + methodology: "TVL counts the USDC and DAI held by the Biribi bankroll vaults on Arbitrum, including locked wagers and reserves. BRB held in the BRB bankroll vault is reported as staking.", + "arbitrum": { + "tvl": { "tokensAndOwners": [ + [ADDRESSES.arbitrum.USDC_CIRCLE, "0x46206b1c1fc631fd6fcf2aa2503f9cb022da96ba"], + [ADDRESSES.arbitrum.DAI, "0x137dd55e422b1881ad1566ce21e2e4f393bb37b2"], + ] }, + "staking": { "tokensAndOwners": [["0x58871cf545f8f0df790443492a80edc414df4504", "0x5f9332b04b2590850c7681850ca445ddf7f64aa9"]] }, // BRB + }, + }, "bb84": { "methodology": "TVL is the USDC, EURC and ETH escrowed in the bb84 rollup's OptimismPortal on Ethereum, which locks the L1 side of every deposit until it is withdrawn from the L2.", "start": "2026-09-30", From 044dce739980653a8fc65867b2037584d31d49fa Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 19 Nov 2026 15:39:52 -0400 Subject: [PATCH 844/988] add new factory to polydash (#22314) --- projects/polydash/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/polydash/index.js b/projects/polydash/index.js index b526706e189..972f7922bc0 100644 --- a/projects/polydash/index.js +++ b/projects/polydash/index.js @@ -15,6 +15,7 @@ const WETH = ADDRESSES.robinhood.WETH const stakingFactories = [ '0x0aAEa47d2e7303EC5a809062eafa59e7F011D857', // v1 '0x904b8F5d95B593b5F4a6Dbb116b58e1d5CBe93f0', // v2 + '0x4C87aff7009DE1c58E052FEe202349a10b28Be9c', // v3 (Nov 2026) ] const launchFactories = [ @@ -100,6 +101,6 @@ async function staking(api) { } module.exports = { - methodology: 'TVL is ETH held by Polypad launch contracts and commit vaults, plus ETH, WETH and mandate-list tokens (except POLYDASH) held by Polydash tokenized fund vaults, plus the stake-token balance of pools from the v1 and v2 staking factories, which includes rewards a pool holds in its own stake token. Pools that stake POLYDASH are counted as staking. Reward tokens other than the stake token, virtual ETH on bonding curves, and Uniswap liquidity after graduation are excluded.', + methodology: 'TVL is ETH held by Polypad launch contracts and commit vaults, plus ETH, WETH and mandate-list tokens (except POLYDASH) held by Polydash tokenized fund vaults, plus the stake-token balance of pools from the staking factories, which includes rewards a pool holds in its own stake token. Pools that stake POLYDASH are counted as staking. Reward tokens other than the stake token, virtual ETH on bonding curves, and Uniswap liquidity after graduation are excluded.', robinhood: { tvl, staking }, } From 43abdc26b87656a48a599d09275ec13575a9d0ca Mon Sep 17 00:00:00 2001 From: Kshitij Kumar <68019904+Kshitijjpd@users.noreply.github.com> Date: Fri, 20 Nov 2026 01:21:03 +0530 Subject: [PATCH 845/988] Add Ibex Market (Canton Network) (#22312) Co-authored-by: FelixBruguera --- projects/ibex/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/ibex/index.js diff --git a/projects/ibex/index.js b/projects/ibex/index.js new file mode 100644 index 00000000000..22bd1f43760 --- /dev/null +++ b/projects/ibex/index.js @@ -0,0 +1,28 @@ +const { get } = require("../helper/http"); + +const API_BASE = "https://api.cctools.network/api/markets/ibex"; + +async function tvl(api) { + const feed = await get(`${API_BASE}/tvl`); + if (!Array.isArray(feed?.assets) || !feed.assets.length) + throw new Error("ibex: CCTools feed returned no assets"); + if (feed.amountsAreScaled !== true) + throw new Error("ibex: CCTools feed amounts are not scaled"); + + for (const asset of feed.assets) { + if (!asset.coingeckoId) + throw new Error(`ibex: no coingecko id for ${asset.symbol}`); + const amount = Number(asset.amount); + if (!Number.isFinite(amount) || amount < 0) + throw new Error(`ibex: invalid amount for ${asset.symbol}`); + // Amounts are already decimal-adjusted token units; pricing is left to DefiLlama. + api.addCGToken(asset.coingeckoId, amount); + } +} + +module.exports = { + timetravel: false, + canton: { tvl }, + methodology: + "TVL is the total value of assets deposited into Ibex Market vaults on Canton Network, sourced via CCTools which republishes Ibex's own API.", +}; From 8e5b34296a16df3fbfb0f0df9984d6b072507e9e Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Thu, 19 Nov 2026 16:04:56 -0400 Subject: [PATCH 846/988] Prevent partial Binance Tron reserve balances (#22266) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/binance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/binance/index.js b/projects/binance/index.js index dff660ddece..8084ea85bd2 100644 --- a/projects/binance/index.js +++ b/projects/binance/index.js @@ -142,6 +142,7 @@ function buildConfig(chain, owners, binanceTokensOnChain, wrappedTokens) { if (wrappedTokens && wrappedTokens.length) blacklistedTokens.push(...wrappedTokens) const options = { ...rest, tokensAndOwners, owners, tokens, chain, blacklistedTokens, permitFailure: true } // while filling historical data, some tokens may not exist on the chain yet, so we permit failure + if (chain === 'tron') Object.assign(options, { sumChunkSize: 40, sumChunkSleep: 0, permitFailure: false }) if (binanceTokensOnChain && binanceTokensOnChain.length) { if (!options.tokens) options.tokens = [] From 8f93674360bbcfd165de5d18bbac2181229efbcf Mon Sep 17 00:00:00 2001 From: OwlSwapDEX Date: Thu, 19 Nov 2026 22:08:04 +0200 Subject: [PATCH 847/988] owlswap: add Optimism, Polygon, Avalanche and Robinhood (#22315) --- registries/uniswapV3.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 9bd0332ec1c..42dda7a26c2 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1989,8 +1989,12 @@ const uniV3Configs = { elysium: { factory: '0x4F66184A9FFabB7f7071D590C2c48DEDf41676f4', fromBlock: 42214 }, }, 'owlswap': { - methodology: 'Counts the tokens held by every OwlSwap V3 pool on BSC, discovered from the factory PoolCreated events.', + methodology: 'Counts the tokens held by every OwlSwap V3 pool on BSC, Optimism, Polygon, Avalanche and Robinhood, discovered from the factory PoolCreated events.', bsc: { factory: '0x8d33DA172e5A27C9661286Ef1c9740de87Aa2F7B', fromBlock: 130483251 }, + optimism: { factory: '0xe243794F0B40C9C98713be5a07F2eEbA61964fCc', fromBlock: 159700584 }, + polygon: { factory: '0xe243794F0B40C9C98713be5a07F2eEbA61964fCc', fromBlock: 97534340 }, + avax: { factory: '0xa03242Dd1e91f54A2104fC6F7D6e6745A9553503', fromBlock: 100681552 }, + robinhood: { factory: '0x67CCfaCA25248cd5cC9efe4c40cDc4AB8a6a49CD', fromBlock: 118454762 }, }, } From 6aecaf94b54714c5b08e7ce8d4a1ac64b9cba25a Mon Sep 17 00:00:00 2001 From: eden Date: Fri, 20 Nov 2026 03:16:56 +0700 Subject: [PATCH 848/988] rotate public projectid (#22316) --- projects/helper/env.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/env.js b/projects/helper/env.js index 10d7faa67a0..17d7b32a578 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -60,7 +60,7 @@ const DEFAULTS = { POLKADOT_RELAY_RPC: 'https://rpc.polkadot.io,https://polkadot-rpc.publicnode.com,https://dot-rpc.stakeworld.io', POLKADOT_ASSETHUB_RPC: 'https://polkadot-asset-hub-rpc.polkadot.io,https://statemint.api.onfinality.io/public', HYDRATION_RPC: 'https://rpc.hydradx.cloud', - BLOCKFROST_PROJECT_ID: 'mai'+'nnetBfkdsCOvb4BS'+'VA6pb1D43ptQ7t3cLt06', + BLOCKFROST_PROJECT_ID: 'mai'+'nnetkI9zWvNxCmBGj2o3'+'afH8b0MYqkmX4xJS', FUEL_CUSTOM_RPC: 'https://mainnet.fuel.network/v1/graphql', TATUM_PUBLIC_API_KEY: "t-" + "698992414f6f4e3435d62161" + "-3d94ca2d70024efdaf3ca6fd", KEETA_RPC: "https://rep1.main.network.api.keeta.com/api", From 7fcf1c1dd80615a8e3e9366f3098d4cfe362c376 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 19 Nov 2026 22:20:07 +0100 Subject: [PATCH 849/988] fix hawksight --- projects/hawksight/index.js | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/projects/hawksight/index.js b/projects/hawksight/index.js index 03b67bf7162..e98dfea99b1 100644 --- a/projects/hawksight/index.js +++ b/projects/hawksight/index.js @@ -16,6 +16,7 @@ const DLMM_EXTRA_BIN_SIZE = 112 const CACHE_PROJECT = 'hawksight' const CACHE_KEY = 'solana-dlmm-empty-owners' const EMPTY_OWNER_RECHECK_SECONDS = 7 * 24 * 3600 +const CHECKPOINT_EVERY = 500 const readU128 = (data, offset) => data.readBigUInt64LE(offset) + (data.readBigUInt64LE(offset + 8) << 64n) @@ -41,25 +42,30 @@ async function getPositionAccounts(connection) { else toCheck.push(owner) } + // One owner at a time: parallel scans get rate-limited (429) by the RPC. + // With a cold cache this is ~25k calls and will not finish in one run, so the empties found so far are saved + // every CHECKPOINT_EVERY owners: a run that is killed still leaves the next one less to check, until one completes. const positionAccounts = [] - await sdk.util.runInPromisePool({ - concurrency: 10, - items: toCheck, - processor: async (owner) => { - // no dataSize filter: resized positions are larger than the base PositionV2 account - const rows = await connection.getProgramAccounts(DLMM_PROGRAM, { - filters: [ - { memcmp: { offset: 0, bytes: bs58.encode(POSITION_V2_DISCRIMINATOR) } }, - { memcmp: { offset: 40, bytes: owner } }, - ], - }) - rows.forEach(({ account }) => positionAccounts.push(account)) - if (rows.length) return + let checked = 0 + for (const owner of toCheck) { + // no dataSize filter: resized positions are larger than the base PositionV2 account + const rows = await connection.getProgramAccounts(DLMM_PROGRAM, { + filters: [ + { memcmp: { offset: 0, bytes: bs58.encode(POSITION_V2_DISCRIMINATOR) } }, + { memcmp: { offset: 40, bytes: owner } }, + ], + }) + for (const { account } of rows) positionAccounts.push(account) + if (!rows.length) { // first-time empties get a random age so the weekly re-checks are spread across runs instead of landing on one const firstSeen = emptyOwners[owner] === undefined stillEmpty[owner] = firstSeen ? now - Math.floor(Math.random() * EMPTY_OWNER_RECHECK_SECONDS) : now - }, - }) + } + if (++checked % CHECKPOINT_EVERY === 0) { + sdk.log(`hawksight: checked ${checked}/${toCheck.length} owners, ${positionAccounts.length} positions so far`) + await setCache(CACHE_PROJECT, CACHE_KEY, { emptyOwners: stillEmpty }) + } + } await setCache(CACHE_PROJECT, CACHE_KEY, { emptyOwners: stillEmpty }) return positionAccounts From 26f59040f1f0185088dca079a6eb878e8cdbd705 Mon Sep 17 00:00:00 2001 From: "expertdefi.eth" Date: Fri, 20 Nov 2026 07:59:56 +0100 Subject: [PATCH 850/988] lint: enable no-dupe-keys and remove the duplicated keys it finds (#22318) Co-authored-by: Claude Co-authored-by: ccipherx --- registries/curators.js | 7 ------- registries/uniswapV2.js | 4 ---- 2 files changed, 11 deletions(-) diff --git a/registries/curators.js b/registries/curators.js index 3f801d1666f..99c5d805359 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -520,9 +520,6 @@ const configs = { hallmarks: [ ['2026-02-10', "Start tracking Vesu V2 vaults on Starknet"], ], - hallmarks: [ - ['2026-02-10', "Start tracking Vesu V2 vaults on Starknet"], - ], }, }, "coinmerce-capital": { @@ -1140,10 +1137,6 @@ const configs = { ['2025-06-01', "Start tracking Vesu V1 vaults on Starknet"], ['2026-02-10', "Start tracking Vesu V2 vaults on Starknet"], ], - hallmarks: [ - ['2025-06-01', "Start tracking Vesu V1 vaults on Starknet"], - ['2026-02-10', "Start tracking Vesu V2 vaults on Starknet"], - ], }, }, "relend": { diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index 66d36a04b4c..b8a268d6391 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -1208,10 +1208,6 @@ const uniV2Configs = { 'LizardExchange': { oasis: '0xefA6861931991CCE372c477a015619A21dfEBE8c', }, - 'lobsterswap': { - bsc: '0xF936CDe5138282eDC6370F9f5ac70d9a1AFC6F78', - ozone: '0xE6E64C926af9ABEc9D819f52c9572AB961CEF6C1', - }, 'lootswap': { hallmarks: [ ['2022-06-23', "Horizon bridge Hack $100m"], From d31c887d41fe589fc6b7b7a20a89a44601359dce Mon Sep 17 00:00:00 2001 From: JuneL <47368962+JuneLXD@users.noreply.github.com> Date: Thu, 19 Nov 2026 23:09:37 -0800 Subject: [PATCH 851/988] Add Defiance (Robinhood Chain) (#22317) --- registries/sumTokens/data1.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/registries/sumTokens/data1.js b/registries/sumTokens/data1.js index 660457eec3a..25fd0b4de41 100644 --- a/registries/sumTokens/data1.js +++ b/registries/sumTokens/data1.js @@ -1205,4 +1205,18 @@ module.exports = { ] } }, + "defiance": { + "methodology": "TVL is the USDG held by the Defiance House, LP vault and redemption queue on Robinhood Chain: trader balances and open stakes in the House, plus the LP capital the vault has funded into the House to back trades.", + "start": "2026-10-24", // V2 contracts deployed at block 97066927 + "robinhood": { + "tvl": { + "owners": [ + "0x84fa704f41bdeedc2090fc0a21c4e5cca860c997", // DefianceHouse: trader cash, open stakes, LP capital funded from the vault + "0xf1e165d50fe333eb41c9e72947d9ffb233d4d069", // DefianceVault (dUSDG, ERC-4626): idle LP cash + "0x42c36ffa2df0bcbad5297a497a23a0df3dc1c242", // DefianceRedemptionQueue: cash set aside for LP exits + ], + "tokens": [ADDRESSES.robinhood.USDG], + }, + }, + }, } From 74ebf6190341741ba5162dd5e5932e21f1831203 Mon Sep 17 00:00:00 2001 From: Dani Date: Fri, 20 Nov 2026 08:27:08 +0100 Subject: [PATCH 852/988] litecoin: fall back to blockbook when litecoinspace and blockchair fail (#22320) --- projects/helper/chain/litecoin.js | 41 ++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/projects/helper/chain/litecoin.js b/projects/helper/chain/litecoin.js index 6f6c2f5d108..dd0870550b5 100644 --- a/projects/helper/chain/litecoin.js +++ b/projects/helper/chain/litecoin.js @@ -1,17 +1,46 @@ const sdk = require('@defillama/sdk') const { PromisePool } = require('@supercharge/promise-pool') -const { utxo } = sdk.chains +const { utxo, rpc } = sdk.chains const CHAIN = 'litecoin' +const TIMEOUT_MS = 15_000 +// keyless blockbook v2 explorers, read when the sdk's litecoinspace and blockchair both fail +const BLOCKBOOK_APIS = ['https://litecoinblockexplorer.net/api/v2', 'https://blockbook.ltc.zelcore.io/api/v2'] -// LTC balance in whole coins +const errorMessage = e => String(e?.message ?? e) + +// confirmed balance in litoshis from the first blockbook that answers for addr +async function getBlockbookBalance(addr) { + const errors = [] + for (const api of BLOCKBOOK_APIS) { + try { + const data = await rpc.httpGet(api, { path: `/address/${addr}`, params: { details: 'basic' }, retries: 2, timeout: TIMEOUT_MS }) + if (data?.address !== addr) throw new Error(`answered for ${data?.address}`) + if (!/^\d+$/.test(data.balance)) throw new Error(`bad balance ${data.balance}`) + return BigInt(data.balance) + } catch (e) { + errors.push(`${api}: ${errorMessage(e)}`) + } + } + throw new Error(`litecoin: all blockbooks failed for ${addr}: ${errors.join(' | ')}`) +} + +// confirmed LTC balance in litoshis async function getBalance(addr) { - const litoshis = await utxo.getBalance({ chain: CHAIN, address: addr }) - return utxo.fromBaseUnits(litoshis, utxo.CHAINS[CHAIN].decimals) + try { + // one attempt per explorer, the sdk already rotates litecoinspace -> blockchair + return BigInt(await utxo.getBalance({ chain: CHAIN, address: addr, retries: 1, timeout: TIMEOUT_MS })) + } catch (sdkError) { + try { + return await getBlockbookBalance(addr) + } catch (e) { + throw new Error(`${errorMessage(sdkError)} | ${errorMessage(e)}`) + } + } } async function sumTokens({ balances = {}, owners = [] }) { - let total = 0 + let total = 0n const { errors } = await PromisePool .withConcurrency(5) @@ -21,7 +50,7 @@ async function sumTokens({ balances = {}, owners = [] }) { total += balance }) if (errors && errors.length) throw errors[0] - sdk.util.sumSingleBalance(balances, 'litecoin', total) + sdk.util.sumSingleBalance(balances, 'litecoin', utxo.fromBaseUnits(total, utxo.CHAINS[CHAIN].decimals)) return balances } From e733fc4bef92b64814bce65d831ae9d57955291b Mon Sep 17 00:00:00 2001 From: "duke.sol" <77286113+cryptoduke01@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:34:02 +0100 Subject: [PATCH 853/988] gloam: BDX on BSC is Beldex's own BEP-20 (#22319) --- projects/gloam/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/gloam/index.js b/projects/gloam/index.js index b2dd369d2e4..6f1b8fe6f10 100644 --- a/projects/gloam/index.js +++ b/projects/gloam/index.js @@ -8,7 +8,7 @@ const { staking } = require('../helper/staking') const POOL = '0x39e28cde55cab798874746ac52cb4b5cc99a0194' const ELYSIUM_POOL = '0x89d3042390204f57b8b4f8949d3c2203e4002164' const BNB_POOL = ELYSIUM_POOL -const BDX_BSC = '0x6ad12e761b438bea3ea09f6c6266556bb24c2181' +const BDX_BSC = '0x9d10a1ec41fe7878429bb457e31f9b050d38c633' const GLOAM = '0xDcD885F5c60b3aD49F6D58718696417314e8724d' const OUSD = '0x20c0000000000000000000006a37da5c996874be' const KNTQ = '0xe45a355d9e9cad2ad85f2d03e3ee3102a036acf0' From 339c61632b3505981a6ad7c5593bbf6d276039b3 Mon Sep 17 00:00:00 2001 From: Eyyub Ensar MERMER <98224771+eyyubmermer@users.noreply.github.com> Date: Fri, 20 Nov 2026 12:26:10 +0300 Subject: [PATCH 854/988] fix(squadswap-thanos): update v4 deployments and add Ethereum (#22322) Co-authored-by: ccipherx --- projects/squadswap-thanos/index.js | 46 ++++++++++++++++++------------ 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/projects/squadswap-thanos/index.js b/projects/squadswap-thanos/index.js index 41723005ec6..c5f07d6c40d 100644 --- a/projects/squadswap-thanos/index.js +++ b/projects/squadswap-thanos/index.js @@ -1,35 +1,43 @@ const { getLogs2 } = require('../helper/cache/getLogs'); const { sumTokens2 } = require('../helper/unwrapLPs'); +// pre-audit deployments first, post-audit redeployments (2026-09-22) after const config = { - bsc: { vault: '0x3754Bd79D88e89F397ed1BfFAD8cdf3E0FDCC37E', clPoolManager: '0x9d3b119EfF69Cd81d324f654062b6fFA3Dd7f405', binPoolManager: '0xd7a5A9Df1719Ee83a4d10749019CaABf137DeBAC', fromBlock: 74380131 }, - base: { vault: '0x126C5D558589788292c33667FBa07E07b4b0990b', clPoolManager: '0xbb07A7bDFC50829cE932aDCCC0498F0E29F49F50', binPoolManager: '0xd243e0C2fC2a91eAce239E0C54023559A47C5f04', fromBlock: 40500004 }, + bsc: [ + { vault: '0x3754Bd79D88e89F397ed1BfFAD8cdf3E0FDCC37E', clPoolManager: '0x9d3b119EfF69Cd81d324f654062b6fFA3Dd7f405', binPoolManager: '0xd7a5A9Df1719Ee83a4d10749019CaABf137DeBAC', fromBlock: 74380131 }, + { vault: '0xb1ba60cdB44C88Ec5366ab94dcB2F992B31f71F2', clPoolManager: '0xb9A52e6b7E98Bf7E80e0BDC8cBEe97D7e1314F22', binPoolManager: '0x7f8E5a02F9007b19408EF731982aDBbA7Ae08eB1', fromBlock: 122889520 }, + ], + base: [ + { vault: '0x126C5D558589788292c33667FBa07E07b4b0990b', clPoolManager: '0xbb07A7bDFC50829cE932aDCCC0498F0E29F49F50', binPoolManager: '0xd243e0C2fC2a91eAce239E0C54023559A47C5f04', fromBlock: 40500004 }, + { vault: '0x8C2eAA0cD1506D9e2e83D350E771Afd180e15bd8', clPoolManager: '0xFeB042baBAbeb8A669897a499d51a8A07F2B260a', binPoolManager: '0xD5727D30Bc1dBb98DC74E34eD535fc570B17Ad27', fromBlock: 51536527 }, + ], + ethereum: [ + { vault: '0xe2682718E44574556f0449722191F1734992D20d', clPoolManager: '0xB930ed3581Aae632bB1788b28777C50BF2C6A85d', binPoolManager: '0xA61093C554d58ee0b0108ad71cDc57c396F04313', fromBlock: 26354460 }, + ], } const clEventAbi = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint160 sqrtPriceX96, int24 tick)' const binEventAbi = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint24 activeId)' Object.keys(config).forEach(chain => { - const { vault, clPoolManager, binPoolManager, fromBlock } = config[chain] module.exports[chain] = { tvl: async (api) => { - const [clLogs, binLogs] = await Promise.all([ - getLogs2({ api, target: clPoolManager, fromBlock, eventAbi: clEventAbi }), - getLogs2({ api, target: binPoolManager, fromBlock, eventAbi: binEventAbi }), - ]) - - const tokenSet = new Set() - - clLogs.concat(binLogs).forEach(log => { - tokenSet.add(String(log.currency0).toLowerCase()) - tokenSet.add(String(log.currency1).toLowerCase()) - }) - - const tokens = Array.from(tokenSet) - - return sumTokens2({ api, tokens, owner: vault }) + const ownerTokens = await Promise.all(config[chain].map(async ({ vault, clPoolManager, binPoolManager, fromBlock }) => { + const [clLogs, binLogs] = await Promise.all([ + getLogs2({ api, target: clPoolManager, fromBlock, eventAbi: clEventAbi }), + getLogs2({ api, target: binPoolManager, fromBlock, eventAbi: binEventAbi }), + ]) + const tokenSet = new Set() + clLogs.concat(binLogs).forEach(log => { + tokenSet.add(String(log.currency0).toLowerCase()) + tokenSet.add(String(log.currency1).toLowerCase()) + }) + return [Array.from(tokenSet), vault] + })) + + return sumTokens2({ api, ownerTokens }) } } }) -module.exports.methodology = 'TVL is the sum of all tokens held in the SquadSwap Thanos (v4) Vault, tokens are discovered from the Initialize events of the CL and Bin pool managers' +module.exports.methodology = 'TVL is the sum of all tokens held in the SquadSwap Thanos (v4) Vaults, both the original and the post-audit redeployments, tokens are discovered from the Initialize events of the CL and Bin pool managers' From 496fbce5ccef4de0ad146a77591d5961eebcf2d5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 20 Nov 2026 11:15:19 +0100 Subject: [PATCH 855/988] cache heavy calls --- projects/alpha-arcade/index.js | 37 ++-- projects/arguspad/index.js | 109 ++++++++-- .../index.js | 74 ++++--- projects/helper/cache/lowValue.js | 74 +++++++ projects/helper/env.js | 3 + projects/krystal/autofarm.js | 202 +++++++++++++----- projects/krystal/index.js | 6 +- projects/krystal/legacy-share-vaults.js | 24 ++- projects/plasma-one/index.js | 29 ++- projects/zyfai/index.js | 162 +++++++++----- test.js | 24 --- 11 files changed, 537 insertions(+), 207 deletions(-) create mode 100644 projects/helper/cache/lowValue.js diff --git a/projects/alpha-arcade/index.js b/projects/alpha-arcade/index.js index 2852db78b8e..49691e0de6d 100644 --- a/projects/alpha-arcade/index.js +++ b/projects/alpha-arcade/index.js @@ -1,15 +1,13 @@ const axios = require('axios') -const { PromisePool } = require('@supercharge/promise-pool') const { getApplicationAddress } = require("../helper/chain/algorandUtils/address"); +const { getLowValueCache } = require('../helper/cache/lowValue') // Market discovery mirrors the official SDK (https://github.com/phara23/alpha-sdk, src/modules/markets.ts): // every market is an application created by the Alpha Arcade market creator address. const MARKET_CREATOR = '5P5Y6HTWUNG2E3VXBQDZN3ENZD3JPAIR5PKT3LOYJAPAUKOLFD6KANYTRY' const USDC = '31566704' -// own client: ~4.5k markets need one indexer call each, the shared 10 req/s limited helper would take ~10 min const indexer = axios.create({ baseURL: 'https://mainnet-idx.algonode.cloud', timeout: 300000 }) -const rethrow = (err) => { throw err } const sleep = (ms) => new Promise(r => setTimeout(r, ms)) async function get(url, params) { @@ -51,21 +49,26 @@ async function tvl(api) { // so yes_supply (== no_supply while unresolved) is the market's USDC balance. Resolved markets have paid out. markets.forEach(m => api.add(USDC, m.yes_supply ?? 0)) - // Open orders: escrow apps created by the market app hold USDC (buy orders) or YES/NO tokens (sell orders) - const escrows = [] - await PromisePool.withConcurrency(5).for(markets).handleError(rethrow).process(async (m) => { - escrows.push(...await getCreatedApps(getApplicationAddress(m.id))) - }) - - await PromisePool.withConcurrency(5).for(escrows).handleError(rethrow).process(async (e) => { - const { account } = await get(`/v2/accounts/${getApplicationAddress(e.id)}`, { 'include-all': true }) - if (account.deleted) return - for (const asset of account.assets ?? []) { - if (asset.deleted || !asset.amount) continue - if (String(asset['asset-id']) === USDC) api.add(USDC, asset.amount) - else api.add(USDC, Math.floor(asset.amount * (e.price ?? 0) / 1e6)) // YES/NO tokens valued at the order's limit price + // Open orders: escrow apps created by the market app hold USDC (buy orders) or YES/NO tokens (sell orders). + // Listing a market's escrows is one indexer call and each escrow is one more, ~6k calls over all markets, while most + // markets have next to nothing on their books. A market whose open orders are worth under $100 is stored with that + // amount, counted from the store, and read again once a week. + const lowValue = await getLowValueCache({ api, project: 'alpha-arcade', key: 'market-open-orders', checkpointEvery: 100 }) + for (const marketId of lowValue.filter(markets.map(m => String(m.id)))) { + const escrows = await getCreatedApps(getApplicationAddress(Number(marketId))) + let openOrders = 0 + for (const escrow of escrows) { + const { account } = await get(`/v2/accounts/${getApplicationAddress(escrow.id)}`, { 'include-all': true }) + if (account.deleted) continue + for (const asset of account.assets ?? []) { + if (asset.deleted || !asset.amount) continue + if (String(asset['asset-id']) === USDC) openOrders += asset.amount + else openOrders += Math.floor(asset.amount * (escrow.price ?? 0) / 1e6) // YES/NO tokens valued at the order's limit price + } } - }) + await lowValue.record([[marketId, { [USDC]: openOrders }]]) + } + await lowValue.save() } module.exports = { diff --git a/projects/arguspad/index.js b/projects/arguspad/index.js index e211d8323cc..5d244448fce 100644 --- a/projects/arguspad/index.js +++ b/projects/arguspad/index.js @@ -1,7 +1,8 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') const { getCache, setCache } = require('../helper/cache') -const { getCreateAddress } = require('ethers') +const { getSqrtPriceX96AtTick } = require('../helper/utils/tick') +const { getCreateAddress, keccak256, AbiCoder } = require('ethers') // ArgusPad launches a tax token and seeds a single concentrated-liquidity position with the whole // supply. The LP NFT is minted to a locker clone created for that launch, and the locker has no @@ -146,26 +147,104 @@ async function getLaunches(api) { return launches } +// There are ~190k v4 launches, each with its own pool, so reading pool key, liquidity and price for +// every one on every run cost ~11.5k eth_calls. Two things cut that down: +// - a locked position never changes: its pool, tick range and liquidity are read once and cached, +// leaving one getSlot0 per position; +// - most launches never trade, and a position whose pool price has not left its starting edge holds +// no quote asset at all. Those are re-checked once a week instead of every run, so the quote side +// of a launch that gets its first buy can be missing for up to a week. +// Cached per positionId as [poolId, quote asset index (-1: the other side is not a quote asset), +// quote is token0 (1/0), tickLower, tickUpper, liquidity, time it was last seen holding no quote (0: holds some)]. +const V4_POSITIONS_CACHE_KEY = 'arc-v4-positions' +const DORMANT_RECHECK_SECONDS = 7 * 24 * 3600 +const V4_ABI = { + poolAndPositionInfo: 'function getPoolAndPositionInfo(uint256 tokenId) view returns ((address token0, address token1, uint24 fee, int24 tickSpacing, address hook), uint256 info)', + positionLiquidity: 'function getPositionLiquidity(uint256 tokenId) view returns (uint128 liquidity)', + slot0: 'function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)', +} +const toInt24 = value => (value & 0x800000) ? value - (1 << 24) : value + +async function addV4Positions(api, launches) { + const cache = await getCache('arguspad', V4_POSITIONS_CACHE_KEY) + const now = Math.floor(Date.now() / 1000) + // dormancy is what is true now, so a run at a past block prices every position and records nothing + const isCurrentRun = !api.timestamp || api.timestamp > now - 3600 + let updated = false + + const missing = launches.filter(([, positionId]) => !cache[positionId]) + if (missing.length) { + const ids = missing.map(([, positionId]) => positionId) + const infos = await api.multiCall({ target: POSITION_MANAGER_V4, abi: V4_ABI.poolAndPositionInfo, calls: ids, permitFailure: true }) + const liquidities = await api.multiCall({ target: POSITION_MANAGER_V4, abi: V4_ABI.positionLiquidity, calls: ids, permitFailure: true }) + missing.forEach(([token, positionId], i) => { + if (!infos[i] || liquidities[i] == null) return + const [key, packed] = infos[i] + const poolId = keccak256(AbiCoder.defaultAbiCoder().encode(['address', 'address', 'uint24', 'int24', 'address'], [key.token0, key.token1, key.fee, key.tickSpacing, key.hook])) + const info = BigInt(packed) + // only the side that is not the launch token can count, and only when it is a quote asset. This also covers + // ARGUS and ARCASH, which were themselves launched here: their own token is the excluded launch side. + const tokenIsToken0 = key.token0.toLowerCase() === token + const quoteIndex = QUOTE_ASSETS.findIndex(asset => asset.toLowerCase() === (tokenIsToken0 ? key.token1 : key.token0).toLowerCase()) + cache[positionId] = [poolId, quoteIndex, tokenIsToken0 ? 0 : 1, toInt24(Number((info >> 8n) & 0xFFFFFFn)), toInt24(Number((info >> 32n) & 0xFFFFFFn)), String(liquidities[i]), 0] + updated = true + }) + } + + const toPrice = [] + for (const [, positionId] of launches) { + const record = cache[positionId] + if (!record || record[1] < 0) continue + if (isCurrentRun && record[6] && now - record[6] < DORMANT_RECHECK_SECONDS) continue + toPrice.push(record) + } + + const slots = await api.multiCall({ target: STATE_VIEW, abi: V4_ABI.slot0, calls: toPrice.map(record => record[0]), permitFailure: true }) + toPrice.forEach((record, i) => { + if (!slots[i]) return + const [, quoteIndex, quoteIsToken0, tickLower, tickUpper, liquidity, dormantSince] = record + // same valuation as the shared v4 helper: priced from sqrtPriceX96 with exact tick edges + const sp = Number(slots[i].sqrtPriceX96) / 2 ** 96 + const sa = Number(getSqrtPriceX96AtTick(tickLower)) / 2 ** 96 + const sb = Number(getSqrtPriceX96AtTick(tickUpper)) / 2 ** 96 + let amount0 = 0 + let amount1 = 0 + if (sp <= sa) amount0 = liquidity * (sb - sa) / (sa * sb) + else if (sp < sb) { + amount0 = liquidity * (sb - sp) / (sp * sb) + amount1 = liquidity * (sp - sa) + } else amount1 = liquidity * (sb - sa) + + const quoteAmount = quoteIsToken0 ? amount0 : amount1 + if (quoteAmount > 0) api.add(QUOTE_ASSETS[quoteIndex], quoteAmount) + if (!isCurrentRun) return + // first-time dormant positions get a random age so the weekly re-checks spread across runs + const nextDormantSince = quoteAmount > 0 ? 0 : dormantSince ? now : now - Math.floor(Math.random() * DORMANT_RECHECK_SECONDS) + if (nextDormantSince !== dormantSince) { + record[6] = nextDormantSince + updated = true + } + }) + + if (updated) await setCache('arguspad', V4_POSITIONS_CACHE_KEY, cache) +} + async function tvl(api) { const launches = await getLaunches(api) + await addV4Positions(api, launches.v4) - // ARGUS and ARCASH were themselves launched on ArgusPad, so their own positions are summed with - // the launch token blacklisted; every other position only has its quote side whitelisted. + // The 59 retired v3 positions go through the shared helper. ARGUS and ARCASH were themselves launched + // on ArgusPad, so their own positions are summed with the launch token blacklisted; every other + // position only has its quote side whitelisted. const groups = {} - for (const version of ['v3', 'v4']) { - for (const [token, positionId] of launches[version]) { - const self = QUOTE_SET.has(token) ? token : '' - groups[self] = groups[self] ?? { v3: [], v4: [] } - groups[self][version].push(positionId) - } + for (const [token, positionId] of launches.v3) { + const self = QUOTE_SET.has(token) ? token : '' + groups[self] = groups[self] ?? [] + groups[self].push(positionId) } - for (const [self, { v3, v4 }] of Object.entries(groups)) { - const config = { api, uniV3WhitelistedTokens: QUOTE_ASSETS, blacklistedTokens: self ? [self] : [] } - if (v3.length) config.uniV3ExtraConfig = { nftAddress: POSITION_MANAGER_V3, positionIds: v3 } - if (v4.length) config.uniV4ExtraConfig = { nftAddress: POSITION_MANAGER_V4, stateViewer: STATE_VIEW, positionIds: v4 } - await sumTokens2(config) - } + for (const [self, positionIds] of Object.entries(groups)) + await sumTokens2({ api, uniV3WhitelistedTokens: QUOTE_ASSETS, blacklistedTokens: self ? [self] : [], uniV3ExtraConfig: { nftAddress: POSITION_MANAGER_V3, positionIds } }) } module.exports = { diff --git a/projects/etherfi-cash-collateral-management/index.js b/projects/etherfi-cash-collateral-management/index.js index e6c655a7975..4fcdf1ee840 100644 --- a/projects/etherfi-cash-collateral-management/index.js +++ b/projects/etherfi-cash-collateral-management/index.js @@ -1,5 +1,5 @@ -const { sliceIntoChunks, sleep, mergeExports } = require('../helper/utils'); -const { PromisePool } = require('@supercharge/promise-pool'); +const { sliceIntoChunks, mergeExports } = require('../helper/utils'); +const { getLowValueCache } = require('../helper/cache/lowValue'); const { aaveV4Export } = require("../helper/aave"); const CONFIG = { @@ -26,44 +26,58 @@ const abi = { const SAFES_PER_CALL = 50 const MULTICALL_SIZE = 3 -const CONCURRENCY = 80 +// ranges are read in groups, one multiCall per group, so the low-value ranges found so far can be saved between groups +const RANGES_PER_GROUP = 600 +const LOW_VALUE_RANGE_USD = 500 +const MAX_FAILED_RANGES = 20 +// The helper only reports collateral for a run of consecutive safes, so a "range" of SAFES_PER_CALL safes is the unit here. +// Most ranges hold next to nothing (all of Scroll since the move to OP Mainnet): a range worth under LOW_VALUE_RANGE_USD is +// stored with its collateral, counted from the store, and read again once a week. const tvl = async (api) => { const { etherFiCashFactory, cashBorrowerHelperContract, multicallSize = MULTICALL_SIZE } = CONFIG[api.chain] const numSafes = (await api.call({ abi: abi.numContractsDeployed, target: etherFiCashFactory })) - 1 - const calls = [] - for (let i = 0; i < numSafes; i += SAFES_PER_CALL) { - calls.push({ target: cashBorrowerHelperContract, params: [i, Math.min(SAFES_PER_CALL, numSafes - i)] }) - } + const starts = [] + for (let i = 0; i < numSafes; i += SAFES_PER_CALL) starts.push(i) + if (!starts.length) return api.getBalances() - const chunks = sliceIntoChunks(calls, multicallSize) - let processed = 0 + const lowValue = await getLowValueCache({ api, project: 'etherfi-cash', key: `${api.chain}-ranges-of-${SAFES_PER_CALL}`, thresholdUSD: LOW_VALUE_RANGE_USD, checkpointEvery: RANGES_PER_GROUP }) + // the last range is still filling up with new safes: it is read every run and never stored + const lastStart = starts.pop() + const toRead = [...lowValue.filter(starts.map(String)).map(Number), lastStart] let failures = 0 - await PromisePool.withConcurrency(CONCURRENCY) - .for(chunks) - .process(async (chunk) => { - let res - for (let attempt = 0; attempt < 3; attempt++) { - try { - res = await api.multiCall({ abi: abi.getTotalCollateralForSafesWithIndex, calls: chunk, permitFailure: true }) - break - } catch (e) { - if (attempt === 2) throw e - await sleep(1000 * (attempt + 1)) - } + const readRanges = (rangeStarts, chunkSize) => api.multiCall({ + abi: abi.getTotalCollateralForSafesWithIndex, target: cashBorrowerHelperContract, chunkSize, permitFailure: true, + calls: rangeStarts.map(start => ({ params: [start, Math.min(SAFES_PER_CALL, numSafes - start)] })), + }) + + for (const group of sliceIntoChunks(toRead, RANGES_PER_GROUP)) { + const res = await readRanges(group, multicallSize) + // The helper call is heavy and RPCs drop whole batches of it under load, while the same range reads fine on its own: + // ranges that came back empty are read again, one range per eth_call, before any of them counts as failed. + for (let attempt = 0; attempt < 3; attempt++) { + const missing = group.map((_, i) => i).filter(i => !res[i]) + if (!missing.length) break + const retried = await readRanges(missing.map(i => group[i]), 1) + missing.forEach((i, j) => res[i] = retried[j]) + } + const results = [] + res.forEach((rangeCollateral, i) => { + if (!rangeCollateral) { + // a failed range is left out of this run only; too many of them and the total is not worth reporting + if (++failures >= MAX_FAILED_RANGES) throw new Error(`Too many sub-call failures (${failures}), aborting to avoid serving incomplete data`) + return } - res.forEach(batchResult => { - if (!batchResult) { - if (++failures >= 20) throw new Error(`Too many sub-call failures (${failures}), aborting to avoid serving incomplete data`) - return - } - batchResult.forEach(({ token, amount }) => api.add(token, amount)) - }) - processed += chunk.length * SAFES_PER_CALL - // api.log(`Processed ${Math.min(processed, numSafes)}/${numSafes} safes (${failures} sub-call failures, ~${failures * SAFES_PER_CALL} safes skipped)`) + const held = {} + rangeCollateral.forEach(({ token, amount }) => held[token] = (BigInt(held[token] ?? 0) + BigInt(amount)).toString()) + if (group[i] === lastStart) Object.entries(held).forEach(([token, amount]) => api.add(token, amount)) + else results.push([String(group[i]), held]) }) + await lowValue.record(results) + } + await lowValue.save() return api.getBalances() } diff --git a/projects/helper/cache/lowValue.js b/projects/helper/cache/lowValue.js new file mode 100644 index 00000000000..33b01d4007a --- /dev/null +++ b/projects/helper/cache/lowValue.js @@ -0,0 +1,74 @@ +const sdk = require('@defillama/sdk') +const { getCache, setCache } = require('../cache') + +const WEEK = 7 * 24 * 3600 + +/** + * For adapters that read many accounts (wallets, vaults, markets, ...) of which most hold next to nothing. + * An account worth less than `thresholdUSD` is stored with the balances it held, and for the next week those + * stored balances are counted instead of reading the account again. Nothing is dropped from TVL: a low-value + * account is only up to a week stale. + * + * const lowValue = await getLowValueCache({ api, project: 'my-project' }) + * const ids = lowValue.filter(allIds) // counts the stored balances of fresh low-value ids, returns the rest + * ...read balances of `ids`... + * await lowValue.record([[id, { [token]: amount }], ...]) // counts them, and stores the low-value ones + * await lowValue.save() + * + * - record() saves every `checkpointEvery` ids, so a run that is killed half way does not lose what it read. + * - An account holding a token with no price is never treated as low value. + * - The first time an account is stored it gets a random age, so the weekly re-reads spread across runs. + * - A run at a past timestamp reads every account and stores nothing: "low value" is only known for now. + */ +async function getLowValueCache({ api, project, key, thresholdUSD = 100, recheckSeconds = WEEK, checkpointEvery = 2000 }) { + const now = Math.floor(Date.now() / 1000) + const isCurrentRun = !api.timestamp || api.timestamp > now - 3600 + const cacheKey = `low-value/${key ?? api.chain}` + const { entries = {} } = isCurrentRun ? await getCache(project, cacheKey) : {} + let unsaved = 0 + + const priceKey = token => `${api.chain}:${/^0x/i.test(token) ? token.toLowerCase() : token}` + const addBalances = balances => Object.entries(balances).forEach(([token, amount]) => api.add(token, amount)) + + function filter(ids) { + return ids.filter(id => { + const entry = entries[id] + if (!entry || now - entry[0] >= recheckSeconds) return true + addBalances(entry[1]) + return false + }) + } + + async function record(results) { + results.forEach(([, balances]) => addBalances(balances)) + if (!isCurrentRun || !results.length) return + + const tokens = new Set() + results.forEach(([, balances]) => Object.entries(balances).forEach(([token, amount]) => { if (+amount) tokens.add(token) })) + const prices = await sdk.coins.getPrices([...tokens].map(priceKey), 'now') + + for (const [id, balances] of results) { + const held = Object.fromEntries(Object.entries(balances).filter(([, amount]) => +amount).map(([token, amount]) => [token, String(amount)])) + let usdValue = 0 + for (const [token, amount] of Object.entries(held)) { + const price = prices[priceKey(token)] + usdValue += price?.price === undefined ? Infinity : amount / 10 ** (price.decimals ?? 0) * price.price + } + if (usdValue < thresholdUSD) entries[id] = [entries[id] ? now : now - Math.floor(Math.random() * recheckSeconds), held] + else delete entries[id] + } + + unsaved += results.length + if (unsaved >= checkpointEvery) await save() + } + + async function save() { + if (!isCurrentRun || !unsaved) return + await setCache(project, cacheKey, { entries }) + unsaved = 0 + } + + return { filter, record, save } +} + +module.exports = { getLowValueCache } diff --git a/projects/helper/env.js b/projects/helper/env.js index 17d7b32a578..5b9ba2c08f5 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -100,6 +100,9 @@ const DEFAULTS = { // Somnia Tokyo, chainId 50321 - separate mainnet chain from Somnia (5031), not in the SDK providers list SOMNIA_TOKYO_RPC: 'https://api.tokyo.infra.mainnet.somnia.network', SOMNIA_TOKYO_RPC_MULTICALL_V3: '0xcA11bde05977b3631167028862bE2a173976CA11', + // Viction: canonical Multicall3 is deployed (since block 87169904) but missing from the SDK deployment map, so every call went out as a single eth_call. + // The SDK map entry is added too; drop this line once that sdk version is in use, the map also knows the deployment block. + TOMOCHAIN_RPC_MULTICALL_V3: '0xcA11bde05977b3631167028862bE2a173976CA11', KUSAMA_ASSETHUB_SUBSTRATE_RPC: 'https://kusama-asset-hub-rpc.polkadot.io,https://statemine.api.onfinality.io/public', } diff --git a/projects/krystal/autofarm.js b/projects/krystal/autofarm.js index ef2123e5671..855d8c5454e 100644 --- a/projects/krystal/autofarm.js +++ b/projects/krystal/autofarm.js @@ -1,6 +1,11 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getLogs } = require('../helper/cache/getLogs') const { sumTokens2, unwrapUniswapV3NFT, unwrapSlipstreamNFT } = require('../helper/unwrapLPs') +const { getLowValueCache } = require('../helper/cache/lowValue') +const { getCache, setCache } = require('../helper/cache') +const { sliceIntoChunks } = require('../helper/utils') + +const VAULTS_PER_GROUP = 2000 // Not counted, in both Autofarm and Community vaults because the position ids cannot be enumerated on chain: Uniswap V4 and // PancakeSwap Infinity positions (their position managers are not ERC721Enumerable), and Aerodrome @@ -124,65 +129,122 @@ const abis = { }, } -// Enumerate CL position ids per vault. `nftIdFetcher` is whichever contract reports ownership: the -// position manager itself for positions sitting in the vault, or a farm that has taken custody of -// the NFT but still credits the vault. Batching every vault into one balanceOf multicall keeps this -// to a handful of RPC round trips per position manager. -async function getPositionIds(api, { nftIdFetcher, owners }) { - const counts = await api.multiCall({ - abi: 'erc20:balanceOf', - target: nftIdFetcher, - calls: owners, - permitFailure: false, +// A vault mints a new position NFT every time it rebalances and keeps the old, emptied one: BSC alone has ~570k position +// NFTs across ~3k vaults, and about 99% of them hold no liquidity. Enumerating and reading every one of them on every +// run is what made this adapter time out. So this is stored per position source and vault: +// [time of the last full read, id at the last index, NFT count, ids with liquidity, ids without, tokens of all its positions] +// and on a run: +// - the NFT count and the id at the last index are read. Both unchanged: the stored list is used and only the positions +// that had liquidity are read. Either changed: the vault's ids are enumerated again, and of those only the ids not +// already known to be empty are read. +// - once a week every vault is read in full again. That also catches what the two checks cannot see: an emptied +// position that got liquidity back, or a mint plus a burn that left the count and the last id as they were. +const POSITIONS_RECHECK_SECONDS = 7 * 24 * 3600 + +// `fetcher` is whichever contract reports ownership: the position manager itself for positions sitting in the vault, +// or a farm that has taken custody of the NFT but still credits the vault. +async function addPositions(api, { nfpm, fetcher, kind, vaults, vaultTokens, withLiquidity, unreadable, stored, now }) { + const counts = await api.multiCall({ abi: 'erc20:balanceOf', target: fetcher, calls: vaults, permitFailure: true }) + + const isFresh = (vault, i) => stored[vault] && stored[vault][2] === +counts[i] && now - stored[vault][0] < POSITIONS_RECHECK_SECONDS + const lastIdChecks = vaults.filter((vault, i) => +counts[i] && isFresh(vault, i)) + const lastIds = await api.multiCall({ abi: abis.tokenOfOwnerByIndex, target: fetcher, calls: lastIdChecks.map(vault => ({ params: [vault, stored[vault][2] - 1] })), permitFailure: true }) + const lastIdOf = {} + lastIdChecks.forEach((vault, i) => lastIdOf[vault] = lastIds[i]) + + const liveIds = [] // { id, vault } + const toEnumerate = [] // { vault, count } + const failed = new Set() // vaults with a failed read from this source: counted with what was read, nothing stored + vaults.forEach((vault, i) => { + if (counts[i] == null) return failed.add(vault) + const count = +counts[i] + if (!count) return delete stored[vault] + const record = stored[vault] + if (isFresh(vault, i) && lastIdOf[vault] != null && +lastIdOf[vault] === record[1]) { + record[3].forEach(id => liveIds.push({ id, vault })) + record[5].forEach(token => vaultTokens[vault].add(token)) + } else toEnumerate.push({ vault, count }) }) - const calls = [] - const callOwners = [] - counts.forEach((count, i) => { - for (let index = 0; index < +(count ?? 0); index++) { - calls.push({ params: [owners[i], index] }) - callOwners.push(owners[i]) - } + const ids = await api.multiCall({ + abi: abis.tokenOfOwnerByIndex, target: fetcher, permitFailure: true, + calls: toEnumerate.flatMap(({ vault, count }) => Array.from({ length: count }, (_, index) => ({ params: [vault, index] }))), }) - if (!calls.length) return [] - const tokenIds = await api.multiCall({ - abi: abis.tokenOfOwnerByIndex, - target: nftIdFetcher, - calls, - permitFailure: false, + const toRead = [] // { id, vault } + const pending = {} + let offset = 0 + for (const { vault, count } of toEnumerate) { + const vaultIds = ids.slice(offset, offset + count) + offset += count + if (vaultIds.some(id => id == null)) failed.add(vault) + const record = stored[vault] + const reuse = record && now - record[0] < POSITIONS_RECHECK_SECONDS + const knownEmpty = new Set(reuse ? record[4] : []) + // a vault read for the first time gets a random age, so the weekly full reads are spread across runs + const checkedAt = reuse ? record[0] : record ? now : now - Math.floor(Math.random() * POSITIONS_RECHECK_SECONDS) + const state = pending[vault] = { ids: vaultIds.filter(id => id != null).map(Number), live: [], empty: [], tokens: new Set(reuse ? record[5] : []), checkedAt } + for (const id of state.ids) { + if (knownEmpty.has(id)) state.empty.push(id) + else toRead.push({ id, vault }) + } + } + + const positions = await api.multiCall({ abi: abis.positions[kind], target: nfpm, calls: toRead.map(({ id }) => id), permitFailure: true }) + positions.forEach((position, i) => { + const { id, vault } = toRead[i] + if (!position) return failed.add(vault) + const state = pending[vault] + // the pair of every position, emptied ones included: a vault that exited a position may still hold its tokens idle + state.tokens.add(position.token0.toLowerCase()) + state.tokens.add(position.token1.toLowerCase()) + if (position.liquidity === '0') return state.empty.push(id) + state.live.push(id) + liveIds.push({ id, vault }) }) - return tokenIds - .map((tokenId, i) => tokenId == null ? null : { tokenId, owner: callOwners[i] }) - .filter(i => i) + for (const { vault } of toEnumerate) { + const state = pending[vault] + state.tokens.forEach(token => vaultTokens[vault].add(token)) + if (failed.has(vault)) delete stored[vault] + else stored[vault] = [state.checkedAt, state.ids[state.ids.length - 1], state.ids.length, state.live, state.empty, [...state.tokens]] + } + failed.forEach(vault => unreadable.add(vault)) + + liveIds.forEach(({ vault }) => withLiquidity.add(vault)) + if (!liveIds.length) return + const positionIds = liveIds.map(({ id }) => id) + const unwrap = kind === 'slipstream' ? unwrapSlipstreamNFT : unwrapUniswapV3NFT + await unwrap({ api, nftAddress: nfpm, positionIds, uniV3ExtraConfig: { positionIds } }) } -async function addPositions(api, { nfpm, nftIdFetcher = nfpm, owners, kind, vaultTokens }) { - const positionIds = await getPositionIds(api, { nftIdFetcher, owners }) - if (!positionIds.length) return +const MULTICALL3 = '0xcA11bde05977b3631167028862bE2a173976CA11' - const tokenIds = positionIds.map(i => i.tokenId) +// Idle balances of the vaults that hold no position with liquidity, read per vault so the low-value ones can be stored. +async function addIdleBalances(api, { vaults, tokensOf, lowValue }) { + if (!vaults.length) return + const native = await api.multiCall({ target: MULTICALL3, abi: 'function getEthBalance(address addr) view returns (uint256 balance)', calls: vaults, permitFailure: true }) + const calls = vaults.flatMap(vault => tokensOf(vault).map(token => ({ target: token, params: vault }))) + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls, permitFailure: true }) - // Attribute each position's pair back to the vault that owns it, so the idle-balance pass below - // only has to check the tokens a vault actually deals in rather than a chain-wide token list. - const positions = await api.multiCall({ abi: abis.positions[kind], target: nfpm, calls: tokenIds, permitFailure: false }) - positions.forEach((position, i) => { - if (!position) return - const tokens = vaultTokens[positionIds[i].owner] - tokens.add(position.token0) - tokens.add(position.token1) + const complete = [] + let offset = 0 + vaults.forEach((vault, i) => { + const held = { [ADDRESSES.null]: native[i] } + for (const token of tokensOf(vault)) held[token] = balances[offset++] + // a failed read is counted as missing for this run only, and the vault is read again next run + if (Object.values(held).some(amount => amount == null)) + Object.entries(held).forEach(([token, amount]) => { if (amount != null) api.add(token, amount) }) + else complete.push([vault, held]) }) - - const unwrap = kind === 'slipstream' ? unwrapSlipstreamNFT : unwrapUniswapV3NFT - await unwrap({ api, nftAddress: nfpm, positionIds: tokenIds, uniV3ExtraConfig: { positionIds: tokenIds } }) + await lowValue.record(complete) } async function tvl(api) { const chainConfig = config[api.chain] if (!chainConfig) return - const { factory, fromBlock, uniV3Nfpms = [], slipstreamNfpms = [], farms = [], idleTokens = [] } = chainConfig + const { factory, fromBlock } = chainConfig const logs = await getLogs({ api, @@ -192,25 +254,53 @@ async function tvl(api) { onlyArgs: true, }) - const vaults = [...new Set(logs.map(i => i.vault.toLowerCase()))] - if (!vaults.length) return + const allVaults = [...new Set(logs.map(i => i.vault.toLowerCase()))] + if (!allVaults.length) return - // Native plus the chain's major assets are checked against every vault: a vault that has exited - // all of its positions still holds real value, and has no position to discover tokens from. - const vaultTokens = {} - vaults.forEach(vault => vaultTokens[vault] = new Set([ADDRESSES.null, ...idleTokens])) + // The stored position lists and low-value vaults are only true for now: a run at a past block reads everything and stores nothing. + const now = Math.floor(Date.now() / 1000) + const isCurrentRun = !api.timestamp || api.timestamp > now - 3600 + const positionsCacheKey = `autofarm-positions/${api.chain}` + const storedPositions = isCurrentRun ? await getCache('krystal', positionsCacheKey) : {} - for (const nfpm of uniV3Nfpms) - await addPositions(api, { nfpm, owners: vaults, kind: 'uniV3', vaultTokens }) + // A vault that holds no position with liquidity and next to no idle balance is stored with its balances and read again + // once a week. Vaults go through in groups and both stores are saved after each group: a run that is cut short + // (this adapter used to be killed before finishing) leaves the next one less to read. + const lowValue = await getLowValueCache({ api, project: 'krystal', key: `autofarm-${api.chain}`, checkpointEvery: 1 }) + for (const vaults of sliceIntoChunks(lowValue.filter(allVaults), VAULTS_PER_GROUP)) { + await addVaults(api, { vaults, chainConfig, lowValue, storedPositions, now }) + if (isCurrentRun) await setCache('krystal', positionsCacheKey, storedPositions) + } + await lowValue.save() +} + +async function addVaults(api, { vaults, chainConfig, lowValue, storedPositions, now }) { + const { uniV3Nfpms = [], slipstreamNfpms = [], farms = [], idleTokens = [] } = chainConfig + + const vaultTokens = {} // pair tokens of each vault's positions, emptied ones included + vaults.forEach(vault => vaultTokens[vault] = new Set()) + const withLiquidity = new Set() + const unreadable = new Set() - // unstaked only - gauge-staked positions are not enumerable, see the note at the top of the file - for (const nfpm of slipstreamNfpms) - await addPositions(api, { nfpm, owners: vaults, kind: 'slipstream', vaultTokens }) + const sources = [ + ...uniV3Nfpms.map(nfpm => ({ nfpm, fetcher: nfpm, kind: 'uniV3' })), + // unstaked only - gauge-staked positions are not enumerable, see the note at the top of the file + ...slipstreamNfpms.map(nfpm => ({ nfpm, fetcher: nfpm, kind: 'slipstream' })), + ...farms.map(({ nfpm, nftIdFetcher }) => ({ nfpm, fetcher: nftIdFetcher, kind: 'uniV3' })), + ] + for (const source of sources) { + const key = source.fetcher.toLowerCase() + storedPositions[key] = storedPositions[key] ?? {} + await addPositions(api, { ...source, vaults, vaultTokens, withLiquidity, unreadable, stored: storedPositions[key], now }) + } - for (const { nfpm, nftIdFetcher } of farms) - await addPositions(api, { nfpm, nftIdFetcher, owners: vaults, kind: 'uniV3', vaultTokens }) + // Native plus the chain's major assets are checked against every vault: a vault that has exited + // all of its positions still holds real value, and has no position to discover tokens from. + const tokensOf = vault => [...new Set([...idleTokens, ...vaultTokens[vault]].map(token => token.toLowerCase()))] + const everyRun = vaults.filter(vault => withLiquidity.has(vault) || unreadable.has(vault)) + await sumTokens2({ api, ownerTokens: everyRun.map(vault => [[ADDRESSES.null, ...tokensOf(vault)], vault]) }) - await sumTokens2({ api, ownerTokens: vaults.map(vault => [[...vaultTokens[vault]], vault]) }) + await addIdleBalances(api, { vaults: vaults.filter(vault => !withLiquidity.has(vault) && !unreadable.has(vault)), tokensOf, lowValue }) } module.exports = { config, tvl } diff --git a/projects/krystal/index.js b/projects/krystal/index.js index 516b0a9f64e..72fdb4a1030 100644 --- a/projects/krystal/index.js +++ b/projects/krystal/index.js @@ -11,10 +11,8 @@ chains.forEach(chain => { module.exports[chain] = { // each returns early on a chain it has no factory on, so the union of chains is safe tvl: async api => { - await Promise.all([ - autofarm.tvl(api), - legacyShareVaults.tvl(api), - ]); + await autofarm.tvl(api); + await legacyShareVaults.tvl(api); }, }; }); diff --git a/projects/krystal/legacy-share-vaults.js b/projects/krystal/legacy-share-vaults.js index 270912495f3..6a69ad03f1e 100644 --- a/projects/krystal/legacy-share-vaults.js +++ b/projects/krystal/legacy-share-vaults.js @@ -1,4 +1,5 @@ const { getLogs } = require('../helper/cache/getLogs') +const { getLowValueCache } = require('../helper/cache/lowValue') // Legacy share vaults - the earlier generation of publicly depositable vaults, created by a series // of vault factories that have since been superseded by SharedVaultFactory (see community.js). @@ -104,15 +105,22 @@ async function tvl(api) { }) } - const [vaultConfigs, vaultTotalValues, customOwnerFeeConfigs, customOwnerFeeTotalValues] = await Promise.all([ - api.multiCall({ abi: abis.getVaultConfig, calls: vaults, permitFailure: false }), - api.multiCall({ abi: abis.getTotalValue, calls: vaults, permitFailure: false }), - api.multiCall({ abi: abis.getVaultConfigWithCustomOwnerFee, calls: vaultsWithCustomOwnerFee, permitFailure: false }), - api.multiCall({ abi: abis.getTotalValue, calls: vaultsWithCustomOwnerFee, permitFailure: false }), - ]) + // vaults worth next to nothing are stored with their value and read again once a week + const lowValue = await getLowValueCache({ api, project: 'krystal', key: `legacy-${api.chain}` }) + await addVaults(api, lowValue, lowValue.filter(vaults), abis.getVaultConfig) + await addVaults(api, lowValue, lowValue.filter(vaultsWithCustomOwnerFee), abis.getVaultConfigWithCustomOwnerFee) + await lowValue.save() +} - api.addTokens(vaultConfigs.map(i => i.principalToken), vaultTotalValues) - api.addTokens(customOwnerFeeConfigs.map(i => i.principalToken), customOwnerFeeTotalValues) +async function addVaults(api, lowValue, vaults, configAbi) { + const configs = await api.multiCall({ abi: configAbi, calls: vaults, permitFailure: true }) + const totalValues = await api.multiCall({ abi: abis.getTotalValue, calls: vaults, permitFailure: true }) + const results = [] + vaults.forEach((vault, i) => { + if (!configs[i] || totalValues[i] == null) return + results.push([vault, { [configs[i].principalToken]: totalValues[i] }]) + }) + await lowValue.record(results) } module.exports = { config, tvl } diff --git a/projects/plasma-one/index.js b/projects/plasma-one/index.js index 0f9732ee4c0..01af16a362c 100644 --- a/projects/plasma-one/index.js +++ b/projects/plasma-one/index.js @@ -1,6 +1,10 @@ const { getAddress, getLogs2 } = require('../helper/cache/getLogs'); const ADDRESSES = require('../helper/coreAssets.json'); const { staking } = require('../helper/staking'); +const { sliceIntoChunks } = require('../helper/utils'); +const { getLowValueCache } = require('../helper/cache/lowValue'); + +const ACCOUNTS_PER_GROUP = 5000; // accounts read per multiCall; the low-value ones found so far are saved after each group const P1USD = "0x1cf1c71440ebd9cc998ce0b1b25ccef275c53d77"; const AAVE_PLASMA_USDT0 = "0x5D72a9d9A9510Cd8cBdBA12aC62593A58930a948"; @@ -32,8 +36,29 @@ async function tvl(api) { getAddress(log.topics[2]), ]); - const owners = [P1USD, ...checkingContracts]; - await api.sumTokens({ tokensAndOwners: owners.flatMap(owner => [[USDT0, owner], [AAVE_PLASMA_USDT0, owner]]) }); + const tokens = [USDT0, AAVE_PLASMA_USDT0]; + await api.sumTokens({ owner: P1USD, tokens }); + + // Most checking accounts hold next to nothing. An account worth under $100 is stored with its balances, + // counted from the store, and read again once a week. + const lowValue = await getLowValueCache({ api, project: 'plasma-one', key: 'checking-accounts', checkpointEvery: ACCOUNTS_PER_GROUP }); + const accounts = lowValue.filter([...new Set(checkingContracts.map(account => account.toLowerCase()))]); + + for (const group of sliceIntoChunks(accounts, ACCOUNTS_PER_GROUP)) { + const calls = group.flatMap(account => tokens.map(token => ({ target: token, params: account }))); + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls, permitFailure: true }); + const results = []; + group.forEach((account, i) => { + const held = {}; + tokens.forEach((token, j) => held[token] = balances[i * tokens.length + j]); + // a failed read is left out of this run only, and the account is read again next run + if (Object.values(held).some(amount => amount == null)) + Object.entries(held).forEach(([token, amount]) => { if (amount != null) api.add(token, amount) }); + else results.push([account, held]); + }); + await lowValue.record(results); + } + await lowValue.save(); } module.exports = { diff --git a/projects/zyfai/index.js b/projects/zyfai/index.js index 6f3d890efd2..2a750559ac5 100644 --- a/projects/zyfai/index.js +++ b/projects/zyfai/index.js @@ -1,5 +1,7 @@ const { allPoolTokens: baseTokens, unpricedVaults: baseUnpricedVaults, makinaPairs, morphoBlueMarkets: baseBlueMarkets } = require('./base'); const { getConfig } = require('../helper/cache'); +const { getLowValueCache } = require('../helper/cache/lowValue'); +const { sliceIntoChunks } = require('../helper/utils'); const { toAssetsDown } = require('../helper/morpoho'); const morphoAbi = require('../helper/abis/morpho.json').morphoBlueFunctions; const { allPoolTokens: ethereumPoolTokens, unpricedVaults: ethereumUnpricedVaults, morphoBlueMarkets: ethereumBlueMarkets } = require('./ethereum'); @@ -55,37 +57,52 @@ const YIELDFI_POOL = { 'yUSD': "0x4772D2e014F9fC3a820C444e3313968e9a5C8121" } -async function beetsTvl(api, owners) { +// Every reader below takes `wallets`: { owners, add(owner, token, amount), fail(owner) }. Balances are collected per +// wallet instead of straight into the api, so that low-value wallets can be stored (see tvl). A failed read marks its +// wallet with fail(): the rest of that wallet is still counted, it is just not stored. +async function beetsTvl(api, wallets) { + const { owners } = wallets; const calls = owners.flatMap(owner => [ { target: BEETS_POOL.deposit, params: [owner] }, { target: BEETS_POOL.stake, params: [owner] }, ]); - const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls }); + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls, permitFailure: true }); - // Process balances in pairs (deposit + stake) for each owner - for (let i = 0; i < balances.length; i += 2) { - const depositBalance = Number(balances[i]); - const stakeBalance = Number(balances[i + 1]); - const totalBalance = depositBalance + stakeBalance; + owners.forEach((owner, i) => { + const depositBalance = balances[2 * i]; + const stakeBalance = balances[2 * i + 1]; + if (depositBalance == null || stakeBalance == null) return wallets.fail(owner); + const totalBalance = BigInt(depositBalance) + BigInt(stakeBalance); // Add the combined balance for both deposit and stake tokens - api.add(calls[i].target, totalBalance); - api.add(calls[i + 1].target, totalBalance); - } + wallets.add(owner, BEETS_POOL.deposit, totalBalance); + wallets.add(owner, BEETS_POOL.stake, totalBalance); + }); } -async function penpieTvl(api, owners) { - const balanceCalls = owners.map(owner => ({ - target: PENPIE_CONTRACT, - params: [PENPIE_MARKET_ADDRESS, owner] - })); +async function penpieTvl(api, wallets) { + const { owners } = wallets; const balances = await api.multiCall({ abi: 'function balance(address,address) view returns (uint256)', - calls: balanceCalls, + calls: owners.map(owner => ({ target: PENPIE_CONTRACT, params: [PENPIE_MARKET_ADDRESS, owner] })), + permitFailure: true, + }); + + owners.forEach((owner, i) => { + if (balances[i] == null) return wallets.fail(owner); + wallets.add(owner, PENPIE_MARKET_ADDRESS, balances[i]); }); +} - balances.forEach(balance => { - api.add(PENPIE_MARKET_ADDRESS, balance); +async function poolTokensTvl(api, wallets, tokens) { + const { owners } = wallets; + tokens = [...new Set(tokens.map(token => token.toLowerCase()))]; // the lists overlap; a token is counted once per wallet + const calls = owners.flatMap(owner => tokens.map(token => ({ target: token, params: [owner] }))); + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls, permitFailure: true }); + balances.forEach((balance, i) => { + const owner = owners[Math.floor(i / tokens.length)]; + if (balance == null) return wallets.fail(owner); + wallets.add(owner, tokens[i % tokens.length], balance); }); } @@ -202,30 +219,37 @@ const TOKENS = { }; // Llama drops these share tokens (no coins.llama.fi price). convertToAssets into the underlying, which is priced. -async function unpricedVaultsTvl(api, owners, vaults) { - const assets = await api.multiCall({ abi: 'address:asset', calls: vaults }); +async function unpricedVaultsTvl(api, wallets, vaults) { + const { owners } = wallets; + const assets = await api.multiCall({ abi: 'address:asset', calls: vaults, permitFailure: true }); const vaultAsset = {}; vaults.forEach((vault, i) => { if (assets[i]) vaultAsset[vault.toLowerCase()] = assets[i]; }); const okVaults = Object.keys(vaultAsset); if (!okVaults.length) return; const calls = owners.flatMap(owner => okVaults.map(vault => ({ target: vault, params: [owner] }))); - const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls }); + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls, permitFailure: true }); const convertCalls = []; - const convertAssets = []; + const converted = []; balances.forEach((balance, i) => { - if (!balance || balance === '0') return; + const owner = owners[Math.floor(i / okVaults.length)]; + if (balance == null) return wallets.fail(owner); + if (balance === '0') return; convertCalls.push({ target: calls[i].target, params: [balance] }); - convertAssets.push(vaultAsset[calls[i].target.toLowerCase()]); + converted.push({ owner, asset: vaultAsset[calls[i].target.toLowerCase()] }); }); if (!convertCalls.length) return; const amounts = await api.multiCall({ abi: 'function convertToAssets(uint256) view returns (uint256)', calls: convertCalls, + permitFailure: true, + }); + amounts.forEach((amount, i) => { + if (amount == null) return wallets.fail(converted[i].owner); + wallets.add(converted[i].owner, converted[i].asset, amount); }); - amounts.forEach((amount, i) => { if (amount) api.add(convertAssets[i], amount); }); } // projects/makina-finance values a share balance with these two calls. lastTotalAum() is the whole @@ -235,69 +259,105 @@ const makinaAbi = { convertToAssets: 'function convertToAssets(uint256 shares) view returns (uint256)', }; -async function makinaSharesTvl(api, owners, pairs) { +async function makinaSharesTvl(api, wallets, pairs) { + const { owners } = wallets; if (!owners.length || !pairs.length) return; const accountings = await api.multiCall({ abi: makinaAbi.accountingToken, calls: pairs.map((pair) => pair.machine), + permitFailure: true, }); const calls = owners.flatMap((owner) => pairs.map((pair) => ({ target: pair.share, params: [owner] }))); - const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls }); + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls, permitFailure: true }); const held = []; balances.forEach((shares, i) => { - if (!shares || BigInt(shares) === 0n) return; + const owner = owners[Math.floor(i / pairs.length)]; const pairIndex = i % pairs.length; - held.push({ machine: pairs[pairIndex].machine, accountingToken: accountings[pairIndex], shares }); + // a machine whose accounting token could not be read cannot be valued: its holders are read again next run + if (shares == null || (!accountings[pairIndex] && BigInt(shares) !== 0n)) return wallets.fail(owner); + if (BigInt(shares) === 0n) return; + held.push({ owner, machine: pairs[pairIndex].machine, accountingToken: accountings[pairIndex], shares }); }); if (!held.length) return; const amounts = await api.multiCall({ abi: makinaAbi.convertToAssets, calls: held.map(({ machine, shares }) => ({ target: machine, params: [shares] })), + permitFailure: true, + }); + held.forEach(({ owner, accountingToken }, i) => { + if (amounts[i] == null) return wallets.fail(owner); + wallets.add(owner, accountingToken, amounts[i]); }); - held.forEach(({ accountingToken }, i) => { if (amounts[i] && amounts[i] !== '0') api.add(accountingToken, amounts[i]); }); } // Morpho Blue supply is not an ERC-20: convert supply shares with the market totals and add the // loan token. Market ids stay out of allPoolTokens. -async function morphoBlueSupplyTvl(api, owners, marketIds) { +async function morphoBlueSupplyTvl(api, wallets, marketIds) { + const { owners } = wallets; if (!owners.length || !marketIds.length) return; - const params = await api.multiCall({ target: MORPHO, abi: morphoAbi.idToMarketParams, calls: marketIds }); - const markets = await api.multiCall({ target: MORPHO, abi: morphoAbi.market, calls: marketIds }); + const params = await api.multiCall({ target: MORPHO, abi: morphoAbi.idToMarketParams, calls: marketIds, permitFailure: true }); + const markets = await api.multiCall({ target: MORPHO, abi: morphoAbi.market, calls: marketIds, permitFailure: true }); const positions = await api.multiCall({ target: MORPHO, abi: morphoAbi.position, calls: owners.flatMap((owner) => marketIds.map((id) => ({ params: [id, owner] }))), + permitFailure: true, }); positions.forEach((position, i) => { + const owner = owners[Math.floor(i / marketIds.length)]; const m = i % marketIds.length; + if (!position || !params[m] || !markets[m]) return wallets.fail(owner); const assets = toAssetsDown(position.supplyShares, markets[m].totalSupplyAssets, markets[m].totalSupplyShares); - api.add(params[m].loanToken, assets.toString()); + wallets.add(owner, params[m].loanToken, assets.toString()); }); } +const WALLETS_PER_GROUP = 500 + +// Every wallet is checked against every pool token (about 95 reads per wallet on Base) while most wallets hold next to +// nothing. A wallet worth under $100 is stored with its balances, counted from the store, and read again once a week. +// Wallets go through in groups and the store is saved after each one, so a run that is cut short keeps what it read. async function tvl(api) { const owners = await getConfig('zyfai/'+api.chain, `https://api.zyf.ai/api/v1/data/active-wallets?chainId=${api.chainId}`); - const cleanOwners = owners.filter(o => o !== ''); + const cleanOwners = [...new Set(owners.filter(o => o !== '').map(o => o.toLowerCase()))]; - if(api.chain == 'sonic') { - await Promise.all([ - beetsTvl(api, cleanOwners), - penpieTvl(api, cleanOwners), - ]); - } + const lowValue = await getLowValueCache({ api, project: 'zyfai', checkpointEvery: 1 }); + for (const group of sliceIntoChunks(lowValue.filter(cleanOwners), WALLETS_PER_GROUP)) { + const held = {}; + group.forEach(owner => held[owner] = {}); + const failed = new Set(); + const wallets = { + owners: group, + fail: owner => failed.add(owner), + add: (owner, token, amount) => { + if (BigInt(amount) === 0n) return; + held[owner][token] = (BigInt(held[owner][token] ?? 0) + BigInt(amount)).toString(); + }, + }; - if (api.chain === 'base') { - await unpricedVaultsTvl(api, cleanOwners, baseUnpricedVaults); - await makinaSharesTvl(api, cleanOwners, makinaPairs); - await morphoBlueSupplyTvl(api, cleanOwners, baseBlueMarkets); - } + if (api.chain == 'sonic') { + await beetsTvl(api, wallets); + await penpieTvl(api, wallets); + } - if (api.chain === 'ethereum') { - await unpricedVaultsTvl(api, cleanOwners, ethereumUnpricedVaults); - await morphoBlueSupplyTvl(api, cleanOwners, ethereumBlueMarkets); - } + if (api.chain === 'base') { + await unpricedVaultsTvl(api, wallets, baseUnpricedVaults); + await makinaSharesTvl(api, wallets, makinaPairs); + await morphoBlueSupplyTvl(api, wallets, baseBlueMarkets); + } - return api.sumTokens({ownerTokens: cleanOwners.map(o => [TOKENS[api.chain], o])}); + if (api.chain === 'ethereum') { + await unpricedVaultsTvl(api, wallets, ethereumUnpricedVaults); + await morphoBlueSupplyTvl(api, wallets, ethereumBlueMarkets); + } + + await poolTokensTvl(api, wallets, TOKENS[api.chain]); + + // a wallet with a failed read is counted with what was read, and read in full again next run + group.filter(owner => failed.has(owner)).forEach(owner => Object.entries(held[owner]).forEach(([token, amount]) => api.add(token, amount))); + await lowValue.record(group.filter(owner => !failed.has(owner)).map(owner => [owner, held[owner]])); + } + await lowValue.save(); } module.exports = { diff --git a/test.js b/test.js index bda606fc732..edb65d7049a 100644 --- a/test.js +++ b/test.js @@ -612,29 +612,5 @@ function buildPricesGetQueries(readKeys, timestamp) { return queries } -async function initCache() { - let currentCache = await sdk.cache.readCache(INTERNAL_CACHE_FILE) - // if (process.env.NO_EXIT_ON_LONG_RUN_RPC) - // sdk.log('cache size:', JSON.stringify(currentCache).length, 'chains:', Object.keys(currentCache).length) - const ONE_WEEK = 60 * 60 * 24 * 31 - if (!currentCache || !currentCache.startTime || (Date.now() / 1000 - currentCache.startTime > ONE_WEEK)) { - currentCache = { - startTime: Math.round(Date.now() / 1000), - } - await sdk.cache.writeCache(INTERNAL_CACHE_FILE, currentCache) - } - sdk.sdkCache.startCache(currentCache) -} - -async function saveSdkInternalCache() { - await sdk.cache.writeCache(INTERNAL_CACHE_FILE, sdk.sdkCache.retriveCache(), { skipR2CacheWrite: true }) -} - async function preExit() { - // try { - // await saveSdkInternalCache() // save sdk cache to r2 - // } catch (e) { - // if (process.env.NO_EXIT_ON_LONG_RUN_RPC) - // sdk.error(e) - // } } From 5056887944b43e8c3b1af031fc9df4cf96a36380 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 20 Nov 2026 09:35:12 -0400 Subject: [PATCH 856/988] Add Aurove (#22330) Co-authored-by: newtmex --- projects/aurove/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/aurove/index.js diff --git a/projects/aurove/index.js b/projects/aurove/index.js new file mode 100644 index 00000000000..f94e32c378e --- /dev/null +++ b/projects/aurove/index.js @@ -0,0 +1,31 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// Aurove AssetLedger (ERC-1155) — canonical claim supply for managed products +const LEDGER = '0x0AF3601f0E15b8E33fEc660fBE515DDb6C54dD3c' + +// Production managed-tranche ids: (variant << 16) | epochs +// veBTC managed sentinel: variant=1, epochs=4 → 65540 +// veMEZO managed sentinel: variant=2, epochs=208 → 131280 +const AVBTCM_TRANCHE_ID = 65540 +const AVMEZOM_TRANCHE_ID = 131280 + +async function tvl(api) { + const [btcSupply, mezoSupply] = await api.multiCall({ + abi: 'function totalSupply(uint256) view returns (uint256)', + calls: [ + { target: LEDGER, params: [AVBTCM_TRANCHE_ID] }, + { target: LEDGER, params: [AVMEZOM_TRANCHE_ID] }, + ], + }) + + // Shares are minted 1:1 with locked underlying (18 decimals on Mezo). + api.add(ADDRESSES.mezo.BTC, btcSupply) + api.add(ADDRESSES.mezo.MEZO, mezoSupply) +} + +module.exports = { + methodology: + "TVL counts the supply of Aurove's avBTCm and avMEZOm receipts, minted 1:1 for BTC and MEZO locked in Mezo Earn's veBTC and veMEZO through Aurove's managed locks. Doublecounted with Mezo Earn.", + doublecounted: true, + mezo: { tvl }, +} From 7125fd866c3d70e6d211b821f71729cdd4a37cc0 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 20 Nov 2026 09:42:02 -0400 Subject: [PATCH 857/988] Mark takotako insolvent and add hallmark (#22331) Co-authored-by: Sergii Bomko <1164492+aquiladev@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 --- registries/aave.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registries/aave.js b/registries/aave.js index 847b59877e9..4d906083f80 100644 --- a/registries/aave.js +++ b/registries/aave.js @@ -84,10 +84,14 @@ const aaveV2Configs = { }, 'takoTako': { methodology, + hallmarks: [ + ["2025-12-05", "Closure announced"], + ], taiko: { registry: '0xD07B62ee683267D4A884453eaE982A151653515E', fromBlock: 381054, blacklistedTokens: ['0xf7fb2df9280eb0a76427dc3b34761db8b1441a49'], + isInsolvent: true, }, }, } From e67311f3de5083801b6c67b59769fa4fc4112b09 Mon Sep 17 00:00:00 2001 From: "expertdefi.eth" Date: Fri, 20 Nov 2026 14:48:14 +0100 Subject: [PATCH 858/988] fix(tokenlon treasury): use the UMA token address on the UMA line (#22327) Co-authored-by: Claude --- projects/treasury/tokenIon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/treasury/tokenIon.js b/projects/treasury/tokenIon.js index 17d29fb2aaf..977cb0738ab 100644 --- a/projects/treasury/tokenIon.js +++ b/projects/treasury/tokenIon.js @@ -26,7 +26,7 @@ module.exports = { '0x0F5D2fB29fb7d3CFeE444a200298f468908cC942', // MANA ADDRESSES.ethereum.LINK, // LINK '0xc944E90C64B2c07662A292be6244BDf05Cda44a7', // GRT - '0xc944E90C64B2c07662A292be6244BDf05Cda44a7', // UMA + '0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828', // UMA ADDRESSES.ethereum.SUSHI, // SUSHI ADDRESSES.ethereum.WETH, // WETH '0xE41d2489571d322189246DaFA5ebDe1F4699F498', // zRX From cf307c619b241c5e1628eb95a750fbbb4fda151a Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 20 Nov 2026 10:30:43 -0400 Subject: [PATCH 859/988] Aad Pylona (#22332) Co-authored-by: Thatcher Peskens Co-authored-by: Claude Opus 5.5 --- projects/pylona/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/pylona/index.js diff --git a/projects/pylona/index.js b/projects/pylona/index.js new file mode 100644 index 00000000000..9a6dfb1689f --- /dev/null +++ b/projects/pylona/index.js @@ -0,0 +1,25 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// Pylona issuer contracts (proxies) on Sonic, one per issuer. +const ISSUER_CONTRACTS = { + energyblocks: '0x211741C81F997ca78966Ec6299Df4118789b2EE5', +} + +// Terms in days. +const TERMS = [30, 60, 90] + +// Investor USDC is forwarded to the issuer's treasury on issuance, so the contracts hold no USDC. +// Borrowed is the outstanding principal: tokens in active positions times the fixed price. +async function borrowed(api) { + for (const contract of Object.values(ISSUER_CONTRACTS)) { + const active = await api.multiCall({ target: contract, abi: 'function activeTokens(uint256) view returns (uint256)', calls: TERMS }) + const price = await api.call({ target: contract, abi: 'uint256:usdcPricePerToken' }) + const tokens = active.reduce((sum, n) => sum + BigInt(n), 0n) + api.add(ADDRESSES.sonic.USDC_e, tokens * BigInt(price)) + } +} + +module.exports = { + methodology: 'Investor USDC is forwarded to the issuer, so nothing is held on-chain and TVL is zero. Borrowed is the outstanding principal from the contract ledger: tokens in active positions times the fixed USDC price. The owner can issue positions for value settled off-chain.', + sonic: { tvl: () => ({}), borrowed }, +} From 01396753ca02a1423b632088b169d5c0b28c7bc1 Mon Sep 17 00:00:00 2001 From: Thomas <124535458+Thomas-Cabrit@users.noreply.github.com> Date: Fri, 20 Nov 2026 23:21:34 +0800 Subject: [PATCH 860/988] Add InoVaults on Cronos (#22324) --- registries/sumTokens.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 9a91626678b..37ab99cdba0 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -16619,6 +16619,18 @@ const configs = { ] }, }, + "inovaults": { + "methodology": "TVL is the value of every VVS V3 concentrated-liquidity position held by the InoVaults vault and custody contracts on Cronos, unwrapped to underlying token amounts at the current pool tick. Those positions are the prize pools: the pool of each open vault, and the pool of a vault already won whose position has not yet been released to its winner. Protocol fees and treasury holdings are not counted.", + "doublecounted": true, + "start": "2026-11-03", + // [VVS V3 Positions NFT-V1, owner]: the vault contract while a vault is funded, the custody contract once it is sealed + "cronos": { + "uniV3nftsAndOwners": [ + ["0xc2ddb059fec2afa593dff9c70fda2cfabe9b4ec8", "0x0F7AA5b029d86596f44875F98EfD9713F9C377B4"], + ["0xc2ddb059fec2afa593dff9c70fda2cfabe9b4ec8", "0xd37b050FDB75230d4029255aFC5B4d41C5F390BF"], + ] + }, + }, "inriswap": { "misrepresentedTokens": true, "methodology": "TVL counts assets held in the official INRISwap iUSD/WINRI pair and the official Liquidity Seeder contract used during the liquidity formation phase. The Seeder holds iUSD and native INRI outside the live pair until the liquidity target is reached.", From db5738cf126a1c0244ee4947b2121486bbcb835e Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 20 Nov 2026 14:00:03 -0400 Subject: [PATCH 861/988] Update Polydash (#22337) Co-authored-by: Polydash <53627236+PolydashDev@users.noreply.github.com> --- projects/polydash/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/polydash/index.js b/projects/polydash/index.js index 972f7922bc0..cd2decb78c1 100644 --- a/projects/polydash/index.js +++ b/projects/polydash/index.js @@ -35,6 +35,7 @@ const fundFactoriesEthOnly = [ const fundFactoriesWithAssets = [ '0xd3c6ae470c25989cC8d2876c1855fB570B98894E', // FundFactoryInvest (phase 2) '0xb9BA453677A6b2C49290CfD4D0713502Ec6bF82B', // FundFactoryPhase3 + '0xe50Da719947E83f316977d9c425DF95672E7B27e', // FundFactoryPhase3V2 (phase 6, agent API default) '0xB5251BaC3CFE2A057B7703D4477Bf80f10B8154B', // FundFactoryPhase3V3 ] From 5a5585a9c727547e7b2733f97c021713116fa638 Mon Sep 17 00:00:00 2001 From: Greg Hill Date: Fri, 20 Nov 2026 18:32:54 +0000 Subject: [PATCH 862/988] bob-gateway: remove TVL (intents protocol, tracked as volume) (#22335) Co-authored-by: Claude Opus 5.5 --- projects/bob-gateway/index.js | 58 +++++------------------------------ 1 file changed, 7 insertions(+), 51 deletions(-) diff --git a/projects/bob-gateway/index.js b/projects/bob-gateway/index.js index c765bb42967..6ac6542282c 100644 --- a/projects/bob-gateway/index.js +++ b/projects/bob-gateway/index.js @@ -1,54 +1,10 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2 } = require("../helper/unwrapLPs"); - -const factories = { - v1: "0x1831d29376eb94bba3ca855af7984db923768b27", - v2: "0x37f330e667208633e1da1cf601d01f0ef8484306", - v3: "0xAE6770a207E86FaE3b191564FA55ce7Bfee0Dde9", - v4: "0xa974EFA9408AC360DDD73b3Ae5d6A1827B307D44", -}; - -const abis = { - v1: { - allOnramps: "function allOnramps() view returns (address[])", - }, - v2: { - allGateways: "function allGateways() view returns (address[])", - }, - v3: { - allGateways: "function allGateways() view returns (address[])", - }, - v4: { - allGateways: "function allGateways() view returns (address[])", - }, -}; - +// BOB Gateway is an intents protocol: a solver fills BTC <-> USDT swaps from its own inventory and +// order escrow is only held for the minutes an order is in flight, so there is no pooled TVL. +// The V1-V4 gateways on BOB that this adapter used to track are retired. +// Activity is tracked as volume in dimension-adapters (dexs/bob-gateway). module.exports = { + methodology: "BOB Gateway holds no pooled liquidity: swaps are filled by a solver and settled on Ethereum. Activity is reported as volume.", bob: { - tvl: async (api) => { - const gateways = (await api.batchCall([ - { abi: abis.v1.allOnramps, target: factories.v1 }, - { abi: abis.v2.allGateways, target: factories.v2 }, - { abi: abis.v3.allGateways, target: factories.v3 }, - { abi: abis.v4.allGateways, target: factories.v4 } - ])).flat(); - - return sumTokens2({ - api, - tokens: [ - ADDRESSES.bob.WBTC, - ADDRESSES.bob.WBTC_OFT, - ADDRESSES.bob.TBTC, - ADDRESSES.bob.SolvBTC, - ADDRESSES.bob.SolvBTC_BBN, - ADDRESSES.bob.FBTC, - ADDRESSES.bob.uniBTC, - ADDRESSES.bob.pumpBTC, - ADDRESSES.bob.LBTC, - ], - owners: gateways, - }); - }, - } + tvl: () => ({}), + }, }; - From f0cb74657f5b467cc8609fc38e57cb40390a80a6 Mon Sep 17 00:00:00 2001 From: "NuWealth.ai" <351920054+nuwealth-ai@users.noreply.github.com> Date: Sat, 21 Nov 2026 02:41:13 +0800 Subject: [PATCH 863/988] Add NuWealth.ai (Hyperliquid vault TVL) (#21993) --- projects/nuwealth-ai/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/nuwealth-ai/index.js diff --git a/projects/nuwealth-ai/index.js b/projects/nuwealth-ai/index.js new file mode 100644 index 00000000000..f56095fcb01 --- /dev/null +++ b/projects/nuwealth-ai/index.js @@ -0,0 +1,17 @@ +const { addHypercoreBalances } = require('../helper/chain/hyperliquid') + +// NuWealth.ai's public Hyperliquid (HyperCore) user vaults +const VAULTS = [ + '0xd321ad79041bdad719ba5ff42fe950e1977df439', // Agent RockSteady +] + +async function tvl(api) { + await addHypercoreBalances({ api, owners: VAULTS }) +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: 'TVL is the account value of NuWealth.ai\'s Hyperliquid vaults on HyperCore: perp margin equity in USDC plus any spot balances, read from Hyperliquid\'s info API. It includes every depositor\'s share and the vault leader\'s own share.', + hyperliquid: { tvl }, +} From ecccb3142163c0e9ab76a59e83db4fed987f6331 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Fri, 20 Nov 2026 16:11:29 -0400 Subject: [PATCH 864/988] Add Own money (#22338) Co-authored-by: Claude --- projects/own-money/index.js | 89 +++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 projects/own-money/index.js diff --git a/projects/own-money/index.js b/projects/own-money/index.js new file mode 100644 index 00000000000..986b24221d3 --- /dev/null +++ b/projects/own-money/index.js @@ -0,0 +1,89 @@ +const { staking } = require('../helper/staking') + +const EUSD = '0x8B84D644CECaeE6d21373F37E1bA00f85eD7CdB7' +const MONEY = '0x0a8B4763C71aC39101b3B8a97e62Da0B81549a4f' +const SMONEY = '0xB6B87Ff4BA072851d1E7E69D39eEb7341b3A5F11' +const PSM = '0xA24A434b7Dae50E24e92B19E0907F8878458CCad' + +// EUSDManager instances, one per collateral risk group, and the collateral each one accepts +const CDP_MANAGERS = { + '0xF9c9a09ef44B9003f4E9CD76C30431389848cbF5': [ // index and gold + '0x117cc2133c37B721F49dE2A7a74833232B3B4C0C', // SPY + '0xD5f3879160bc7c32ebb4dC785F8a4F505888de68', // QQQ + '0xC9a981FEE1F9DEc688bb123ccDeCc63D0deBFC4e', // GLD + ], + '0xbd0A8dea2964C61dBC225dB3C1b4cE341A0c32C2': [ // ETH + '0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73', // WETH + ], + '0x6d491928BBEc0c508A939b103753A3472b63Cc8C': [ // big tech + '0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC', // NVDA + '0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35', // META + '0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3', // GOOGL + '0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9', // AAPL + '0x322F0929c4625eD5bAd873c95208D54E1c003b2d', // TSLA + '0x12f190a9F9d7D37a250758b26824B97CE941bF54', // AMZN + ], + '0x948df8d22c8025f587697D02b4888fE432758d0e': [ // high volatility + '0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa', // SPCX + '0xec262a75e413fAfD0dF80480274532C79D42da09', // MSTR + '0xdF0992E440dD0be65BD8439b609d6D4366bf1CB5', // CRCL + '0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD', // MU + '0x894E1EC2D74FFE5AEF8Dc8A9e84686acCB964F2A', // PLTR + ], +} + +// EUSDLiquidityManager instances: each position is a per-user vault holding an asset/eUSD LP range +const LIQUIDITY_MANAGERS = [ + '0x64bf85F7F55C9c66e42ac70D970e01b9cd163554', // USDG/eUSD + '0x62f482452340E5a4beB2bC910248DFfcF8f59C4b', // SPY/eUSD +] + +// Legacy eUSD manager (mint paused, winding down) holds eSPY, which the PSM ReserveVault backs 1:1 with R.SPY. +// The reserve vault's SPY balance is counted, which covers all eSPY in circulation. +const SPY = '0x117cc2133c37B721F49dE2A7a74833232B3B4C0C' +const ESPY_RESERVE_VAULT = '0x2c47516319B56519ada1433701F2673877f168Ea' + +const POSITION_ABI = 'function getPosition(uint256 poolId, address owner) view returns (tuple(address vault, bool staked, uint256 debt, uint256 feeIndexSnapshot, uint256 feesAccrued))' +const HOLDINGS_ABI = 'function holdings(uint256 price) view returns (uint256 assetAmount, uint256 eusdAmount)' + +async function cdpCollateral(api) { + const tokensAndOwners = Object.entries(CDP_MANAGERS).flatMap(([manager, tokens]) => tokens.map((t) => [t, manager])) + tokensAndOwners.push([SPY, ESPY_RESERVE_VAULT]) + await api.sumTokens({ tokensAndOwners }) +} + +async function psmReserves(api) { + const count = await api.call({ target: PSM, abi: 'uint256:assetCount' }) + const assets = await api.multiCall({ target: PSM, abi: 'function assetAt(uint256) view returns (address)', calls: [...Array(Number(count)).keys()] }) + await api.sumTokens({ owner: PSM, tokens: assets }) +} + +async function lpCollateral(api) { + const poolCounts = await api.multiCall({ calls: LIQUIDITY_MANAGERS, abi: 'uint256:poolCount' }) + const pools = LIQUIDITY_MANAGERS.flatMap((manager, i) => [...Array(Number(poolCounts[i])).keys()].map((poolId) => ({ manager, poolId }))) + const positionCounts = await api.multiCall({ abi: 'function positionCount(uint256) view returns (uint256)', calls: pools.map(({ manager, poolId }) => ({ target: manager, params: [poolId] })) }) + const slots = pools.flatMap((pool, i) => [...Array(Number(positionCounts[i])).keys()].map((index) => ({ ...pool, index }))) + const owners = await api.multiCall({ abi: 'function positionOwnerAt(uint256 poolId, uint256 index) view returns (address)', calls: slots.map(({ manager, poolId, index }) => ({ target: manager, params: [poolId, index] })) }) + const positions = await api.multiCall({ abi: POSITION_ABI, calls: slots.map(({ manager, poolId }, i) => ({ target: manager, params: [poolId, owners[i]] })) }) + const vaults = positions.map((p) => p.vault) + const assets = await api.multiCall({ abi: 'address:asset', calls: vaults }) + const prices = await api.multiCall({ abi: 'uint256:poolPrice', calls: vaults }) + // only the asset side counts: the eUSD side is minted by the manager against this collateral + const holdings = await api.multiCall({ abi: HOLDINGS_ABI, calls: vaults.map((target, i) => ({ target, params: [prices[i]] })) }) + holdings.forEach((h, i) => api.add(assets[i], h.assetAmount)) +} + +async function tvl(api) { + await cdpCollateral(api) + await psmReserves(api) + await lpCollateral(api) + api.removeTokenBalance(EUSD) +} + +module.exports = { + methodology: 'TVL is the collateral backing eUSD: stock tokens and WETH locked in the EUSDManager CDPs, the non-eUSD side (USDG, SPY) of the LP positions in EUSDLiquidityManager vaults, the stablecoins in the eUSD PSM, and the R.SPY held in the PSM reserve vault that backs the legacy eSPY 1:1. eUSD itself is excluded. Staking is $MONEY staked in the sMONEY vault.', + robinhood: { + tvl, + staking: staking(SMONEY, MONEY), + }, +} From 65d9d4f8ed44379c0ec0996028e17153a8f9cf1d Mon Sep 17 00:00:00 2001 From: EscapeHub Date: Sat, 21 Nov 2026 09:50:29 +0300 Subject: [PATCH 865/988] Add EscapeSwap TVL (#22339) Co-authored-by: EscapeHub <225285006+escapehub-ai@users.noreply.github.com> --- projects/escapeswap/index.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 projects/escapeswap/index.js diff --git a/projects/escapeswap/index.js b/projects/escapeswap/index.js new file mode 100644 index 00000000000..999c8f7b5ed --- /dev/null +++ b/projects/escapeswap/index.js @@ -0,0 +1,36 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getProvider, sumTokens2 } = require('../helper/solana') +const { PublicKey } = require('@solana/web3.js') + +const SWAP_PROGRAM = 'EscapeSwCMQocQoabyGaXDyN1BmhCR6orUV7kmxFRmY' +const POOL_STATE_SIZE = 205 +const POOL_STATE_DISCRIMINATOR = 'iUE1qg7KXeV' // f7ede3f5d7c3de46 +const OFFSET_TOKEN_0_VAULT = 8 +const OFFSET_TOKEN_1_VAULT = 40 +const OFFSET_TOKEN_0_MINT = 72 +const OFFSET_TOKEN_1_MINT = 104 + +const readKey = (data, offset) => new PublicKey(data.subarray(offset, offset + 32)).toBase58() + +async function tvl(api) { + const connection = getProvider().connection + const pools = await connection.getProgramAccounts(new PublicKey(SWAP_PROGRAM), { + filters: [ + { dataSize: POOL_STATE_SIZE }, + { memcmp: { offset: 0, bytes: POOL_STATE_DISCRIMINATOR } }, + ], + }) + const tokenAccounts = [] + for (const { account } of pools) { + const data = account.data + if (readKey(data, OFFSET_TOKEN_0_MINT) === ADDRESSES.solana.SOL) tokenAccounts.push(readKey(data, OFFSET_TOKEN_0_VAULT)) + else if (readKey(data, OFFSET_TOKEN_1_MINT) === ADDRESSES.solana.SOL) tokenAccounts.push(readKey(data, OFFSET_TOKEN_1_VAULT)) + } + return sumTokens2({ api, tokenAccounts }) +} + +module.exports = { + timetravel: false, + methodology: 'Counts SOL in EscapeSwap pools (wSOL vault of every pool). Launched tokens are not counted.', + solana: { tvl }, +} From 6bd8b595dcdfb1023e1fa3c639b334618ea9da18 Mon Sep 17 00:00:00 2001 From: qhooks <352651120+qhooks@users.noreply.github.com> Date: Sat, 21 Nov 2026 00:51:32 -0600 Subject: [PATCH 866/988] Add QHooks (#22334) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/qhooks/index.js | 155 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 projects/qhooks/index.js diff --git a/projects/qhooks/index.js b/projects/qhooks/index.js new file mode 100644 index 00000000000..28c12350461 --- /dev/null +++ b/projects/qhooks/index.js @@ -0,0 +1,155 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') +const { addUniV4PoolReserves } = require('../helper/uniswapV4') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// QHooks (https://qhooks.com) launches tokens into Uniswap v4 pools whose hook is the QHooks launch contract itself. +// Each launch contract (QSimpleLaunch generations, and QSaleLaunch for sale-first launches) emits one event per pool. +const QHOOKS = '0x20429af7ca3b0ce4d99edbaa0693f26c5df05195' // protocol token, Robinhood Chain only +const STAKE_VAULT = '0x6248098bfa019b9035a21722a86bdee3f6e9b934' // QHOOKS staking (the timed QStakeLock deposits into it) +const SALE = '0x707d79c32bea8f9773a81569fbacc64ab0502044' // QSaleLaunch, same address on every EVM chain + +const launchedAbi = 'event Launched(bytes32 indexed poolId, address indexed token, address indexed creator, address quote, string name, string symbol, string meta, uint8 style, address blocks, int24 startTick, int24 targetTick, uint256 supply, uint24 fee)' +const settledAbi = 'event Settled(uint256 indexed saleId, address indexed token, bytes32 indexed poolId, uint256 clearPrice, uint256 raised, uint256 sold, uint256 poolTokens)' +const initializeAbi = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks, uint160 sqrtPriceX96, int24 tick)' +const INITIALIZE_TOPIC = '0xdd466e674ea557f56295e2d0218a125ea4b4f0f6f3307b95f85e6110838d6438' + +// fromBlock = the launch contract's deploy block or an earlier one; sale = lower bound for QSaleLaunch on that chain +const config = { + robinhood: { + poolManager: '0x8366a39cc670b4001a1121b8f6a443a643e40951', stateView: '0xf3334192d15450cdd385c8b70e03f9a6bd9e673b', sale: 110156527, + launches: [ + ['0x023623568f41c032ec2f4bba368dbafc123160cc', 108170556], + ['0xfb5a559886fccba6400cc52905ba3aa4658ba0cc', 110156527], + ['0x34ac8c4e6ca3d5b70a5321b648d0db9451c060cc', 110390517], + ['0xefe39a5632212911fe8e3ddcb07f08e5e220e0cc', 110831000], + ['0x3fcf7693f799da31134970787f9f35578d0f60cc', 111223856], + ], + }, + base: { + poolManager: '0x498581ff718922c3f8e6a244956af099b2652b2b', stateView: '0xa3c0c9b65bad0b08107aa264b0f3db444b867a71', sale: 55185578, + launches: [ + ['0xfb5a559886fccba6400cc52905ba3aa4658ba0cc', 55185578], + ['0x34ac8c4e6ca3d5b70a5321b648d0db9451c060cc', 55351284], + ['0x3fcf7693f799da31134970787f9f35578d0f60cc', 55793671], + ], + }, + arbitrum: { + poolManager: '0x360e68faccca8ca495c1b759fd9eee466db9fb32', stateView: '0x76fd297e2d437cd7f76d50f01afe6160f86e9990', sale: 522677810, + launches: [ + ['0xfb5a559886fccba6400cc52905ba3aa4658ba0cc', 522677810], + ['0x34ac8c4e6ca3d5b70a5321b648d0db9451c060cc', 522799540], + ['0x3fcf7693f799da31134970787f9f35578d0f60cc', 523106870], + ], + }, + bsc: { + poolManager: '0x28e2ea090877bf75740558f6bfb36a5ffee9e9df', stateView: '0xd13dd3d6e93f276fafc9db9e6bb47c1180aee0c4', sale: 132585433, + launches: [ + ['0xfb5a559886fccba6400cc52905ba3aa4658ba0cc', 132585433], + ['0x34ac8c4e6ca3d5b70a5321b648d0db9451c060cc', 132660352], + ['0x3fcf7693f799da31134970787f9f35578d0f60cc', 132855010], + ], + }, + ethereum: { + poolManager: '0x000000000004444c5dc75cb358380d2e3de08a90', stateView: '0x7ffe42c4a5deea5b0fec41c94c136cf115597227', sale: 26380174, + launches: [ + ['0x34ac8c4e6ca3d5b70a5321b648d0db9451c060cc', 26380174], + ['0x3fcf7693f799da31134970787f9f35578d0f60cc', 26387450], + ], + }, + elysium: { + poolManager: '0xe2e105d3f7209a9da11f83ccf3e7398a753823f1', stateView: '0x27ed73ae0652fdcf71d6793412a7525f32be9dfe', sale: 3239822, + launches: [ + ['0x8223f9ce8998fb436fc32bdf541cc34d668420cc', 3239822], + ['0xc7faaf2e1b01e5e2cae4f967a020b49b290ca0cc', 3539046], + ['0x9a9d37bca2e9874a1da1a1bab51f242a9d1ca0cc', 4331176], + ], + }, + monad: { + poolManager: '0x188d586ddcf52439676ca21a244753fa19f9ea8e', stateView: '0x77395f3b2e73ae90843717371294fa97cc419d64', + launches: [ + ['0x0f73962ed759b0abdb92cbecbc3ef2bf462a20cc', 121245205], + ], + }, +} + +// Every QHooks pool: one Launched per pool from each launch contract, plus pools opened when a sale settles. +async function registrations(api) { + const { launches, sale } = config[api.chain] + const regs = [] + for (const [target, fromBlock] of launches) { + const logs = await getLogs2({ api, target, eventAbi: launchedAbi, fromBlock, onlyArgs: false, extraKey: 'qhooks-launched' }) + logs.forEach((l) => regs.push({ id: l.args.poolId.toLowerCase(), token: l.args.token.toLowerCase(), hook: target, block: l.blockNumber })) + } + if (sale) { + const logs = await getLogs2({ api, target: SALE, eventAbi: settledAbi, fromBlock: sale, onlyArgs: false, extraKey: 'qhooks-settled' }) + logs.forEach((l) => regs.push({ id: l.args.poolId.toLowerCase(), token: l.args.token.toLowerCase(), hook: SALE, block: l.blockNumber })) + } + return regs +} + +// The pool key comes from the PoolManager Initialize emitted in the same tx as each registration. +async function discoverPools(api) { + const { poolManager } = config[api.chain] + const byId = new Map() + for (const r of await registrations(api)) if (!byId.has(r.id)) byId.set(r.id, r) + const regs = [...byId.values()], pools = [] + for (let i = 0; i < regs.length; i += 10) { + await Promise.all(regs.slice(i, i + 10).map(async (r) => { + const [log] = await getLogs2({ api, target: poolManager, eventAbi: initializeAbi, topics: [INITIALIZE_TOPIC, r.id], fromBlock: r.block, toBlock: r.block + 1, skipCache: true, useIndexer: false }) + if (!log || log.hooks.toLowerCase() !== r.hook) throw new Error(`QHooks: no Initialize with the QHooks hook for ${r.id}`) + pools.push({ id: log.id, token0: log.currency0, token1: log.currency1, spacing: Number(log.tickSpacing) }) + })) + } + if (pools.length !== byId.size) throw new Error(`QHooks: ${byId.size} pools registered but ${pools.length} Initialize events`) + return pools +} + +const quoteAssets = (chain) => new Set([ADDRESSES.null, ...Object.values(ADDRESSES[chain] ?? {})].map((a) => a.toLowerCase())) +const cache = {} + +// Reserves of every QHooks pool by token, shared by tvl and staking. +async function poolBalances(api) { + const key = `${api.chain}-${api.block}` + if (!cache[key]) cache[key] = (async () => { + const pools = await discoverPools(api) + const balances = {} + const recorder = { multiCall: (...args) => api.multiCall(...args), add: (token, amount) => { token = token.toLowerCase(); balances[token] = (balances[token] ?? 0) + Number(amount) } } + await addUniV4PoolReserves({ api: recorder, pools, stateView: config[api.chain].stateView }) + return balances + })() + return cache[key] +} + +async function tvl(api) { + await api.getBlock() + const quotes = quoteAssets(api.chain) + const balances = await poolBalances(api) + // quote side only: launched tokens are not counted, QHOOKS goes to staking + Object.entries(balances).forEach(([token, amount]) => { if (token !== QHOOKS && quotes.has(token)) api.add(token, amount) }) + // quote assets committed to sales that have not settled yet (held by QSaleLaunch) + // sUSD_OLD is an ethereum core asset whose balanceOf reverts + if (config[api.chain].sale) await sumTokens2({ api, owner: SALE, tokens: [...quotes].filter((t) => t !== QHOOKS), blacklistedTokens: [ADDRESSES.ethereum.sUSD_OLD] }) +} + +async function staking(api) { + await api.getBlock() + const balances = await poolBalances(api) + if (balances[QHOOKS]) api.add(QHOOKS, balances[QHOOKS]) + return sumTokens2({ api, owner: STAKE_VAULT, tokens: [QHOOKS] }) +} + +module.exports = { + doublecounted: true, // QHooks pools are Uniswap v4 pools, also counted by the uniswap-v4 adapter + methodology: + 'TVL is the quote-asset side (native coin, WETH, stablecoins and other core assets) of the liquidity in QHooks launch pools: ' + + 'Uniswap v4 pools whose hook is a QHooks launch contract, found from the launch contracts\' Launched and Settled events, plus quote ' + + 'assets committed to QHooks sales that have not settled. Launched tokens are not counted. QHOOKS was launched through QHooks, so the ' + + 'WETH side of its QHOOKS/WETH pool counts as TVL like any other launch. Staking is QHOOKS staked in the QHooks stake vault plus the ' + + 'QHOOKS held in QHooks pools.', +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl } +}) +module.exports.robinhood = { tvl, staking } From b5cd4ca08240a6de3a7cbd0a3c89234257a46006 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Sat, 21 Nov 2026 14:52:06 +0000 Subject: [PATCH 867/988] saturn (#22341) --- projects/hyperithm/index.js | 2 +- projects/saturn-protocol/index.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/projects/hyperithm/index.js b/projects/hyperithm/index.js index c7924fff566..bb89bb49082 100644 --- a/projects/hyperithm/index.js +++ b/projects/hyperithm/index.js @@ -16,7 +16,7 @@ const vaultConfigs = { '0xC56EA16EA06B0a6A7b3B03B2f48751e549bE40fD', '0x16fa314141C76D4a0675f5e8e3CCBE4E0fA22C7c' ], - excludedVaults: ['0xAbe418cc8c06D265E4EB009C02eA4B265eCA7240'], // Saturn USDC vault, counted under saturn-protocol + excludedVaults: ['0xAbe418cc8c06D265E4EB009C02eA4B265eCA7240', '0x7F876BF31089A8D13ccF8F1158Ef7bFecA2dDF94'], // Saturn USDC vault, counted under saturn-protocol euler: [ '0x3cd3718f8f047aA32F775E2cb4245A164E1C99fB', ], diff --git a/projects/saturn-protocol/index.js b/projects/saturn-protocol/index.js index e4a85a3b163..fa2f7cc53c0 100644 --- a/projects/saturn-protocol/index.js +++ b/projects/saturn-protocol/index.js @@ -9,15 +9,20 @@ const M = '0x866a2bf4e572cbcf37d5071a7a58503bfb36be1b'; const PYUSDx = '0xebdb0942ce16386ab90718c7bd10c91cdb66b14d'; const USDC = ADDRESSES.ethereum.USDC; // Saturn USDC Morpho vaults (co-curated with Hyperithm; Hyperithm agreed deposits count as Saturn's). +const CONFIDENTIAL_VAULT = '0x7F876BF31089A8D13ccF8F1158Ef7bFecA2dDF94'; const VAULTS = { - ethereum: ['0xAbe418cc8c06D265E4EB009C02eA4B265eCA7240'], + ethereum: [ + '0xAbe418cc8c06D265E4EB009C02eA4B265eCA7240', + CONFIDENTIAL_VAULT, // Confidential Tokenized Equity Vault + ], monad: ['0x75753e494e5e374C52E1d84fc04EB14B10F2C079'], bsc: ['0x87e01662febb5145ff648c1fa7b73d81519d9c66'], // Lista USDT vault; excluded from lista-lending }; const BSC_VAULT_START = 1788497446; // vault deployed at block 119857679 (2026-09-04) +const CONFIDENTIAL_VAULT_START = 1794471971; // vault deployed at block 26397653 (2026-11-12) async function vaultTvl(api) { - const vaults = VAULTS[api.chain]; + const vaults = VAULTS[api.chain].filter((v) => !(v === CONFIDENTIAL_VAULT && api.timestamp < CONFIDENTIAL_VAULT_START)); const [assets, totals] = await Promise.all([ api.multiCall({ abi: 'address:asset', calls: vaults }), api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }), From fde9252c8a5cf073f04fc8a2526ea4a06ddef950 Mon Sep 17 00:00:00 2001 From: ross <92001561+z0r0z@users.noreply.github.com> Date: Sun, 22 Nov 2026 19:45:17 +0800 Subject: [PATCH 868/988] Tacit: count SPX6900 held in the ConfidentialPool (#22344) --- registries/sumTokens/data3.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/registries/sumTokens/data3.js b/registries/sumTokens/data3.js index 36fb7097be7..e5383a15125 100644 --- a/registries/sumTokens/data3.js +++ b/registries/sumTokens/data3.js @@ -1159,7 +1159,7 @@ module.exports = { } }, "tacit": { - "methodology": "TVL is the assets held by Tacit's contracts: the ETH, USDC, USDT and wstETH wrapped into the ConfidentialPool on Ethereum, the ETH shielded in the TacitEvmPool on Ethereum, Base and Robinhood Chain, and the wstETH escrowed in the CollateralEngine that backs Bitcoin locks. Balances are read from the contracts; Tacit's own token (TAC) is not counted.", + "methodology": "TVL is the assets held by Tacit's contracts: the ETH, USDC, USDT, wstETH and SPX6900 wrapped into the ConfidentialPool on Ethereum, the ETH shielded in the TacitEvmPool on Ethereum, Base and Robinhood Chain, and the wstETH escrowed in the CollateralEngine that backs Bitcoin locks. Balances are read from the contracts; Tacit's own token (TAC) is not counted.", "start": "2026-09-17", "ethereum": { "owners": [ @@ -1171,7 +1171,8 @@ module.exports = { ADDRESSES.null, ADDRESSES.ethereum.WSTETH, ADDRESSES.ethereum.USDC, - ADDRESSES.ethereum.USDT + ADDRESSES.ethereum.USDT, + "0xE0f63A424a4439cBE457D80E4f4b51aD25b2c56C" ] }, "base": { From 1e0791ab18ab632e11f761f0a0c30883cfdb3874 Mon Sep 17 00:00:00 2001 From: sonevibegrok Date: Sun, 22 Nov 2026 06:50:02 -0500 Subject: [PATCH 869/988] SoneVibe: add new BSC factory and keep the existing one (#22345) --- projects/sonevibe/index.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/projects/sonevibe/index.js b/projects/sonevibe/index.js index 27cc6139eba..2c329a363e2 100644 --- a/projects/sonevibe/index.js +++ b/projects/sonevibe/index.js @@ -17,6 +17,12 @@ const dex = { const soneiumNewFactory = '0x77b141dCFDa726e239efF005E3DE7A47AeBFf948' const soneiumNewFactoryStartBlock = 30574105 +// New BSC factory, deployed 2026-11-22 04:31:58 UTC (block 135015600), +// tx 0x6932510372c01bbb24097137f34411ee1b7c4d45a2c308e2e83b5d72ce3823fd. +// The original bsc factory stays in `dex` so historical TVL still reads those pairs. +const bscNewFactory = '0x26b13e7e923e964b0514B3167A90901B49DAe205' +const bscNewFactoryStartBlock = 135015600 + const lending = { // V_Master has no getAllMarkets(), so markets are pinned (from networks.json) // Arbitrum One has an empty master and no cTokens there, so it stays DEX-only. @@ -45,10 +51,20 @@ const soneiumNewExports = { }, } +const bscNewFactoryTVL = getUniTVL({ factory: bscNewFactory, useDefaultCoreAssets: true }) +const bscNewExports = { + bsc: { + tvl: async (api) => { + if (api.block != null && Number(api.block) < bscNewFactoryStartBlock) return {} + return bscNewFactoryTVL(api) + }, + }, +} + const lendingExports = {} Object.entries(lending).forEach(([chain, config]) => { lendingExports[chain] = compoundExports2(config) }) -module.exports = mergeExports([dexExports, soneiumNewExports, lendingExports]) -module.exports.methodology = 'DEX TVL: reserves of all VibeSwap pairs created by the factories (core assets only). On Soneium this includes the original factory 0x06C0b58287794a0bdce20ce768b601CA974618DC, kept for history, and the drain-free factory 0x77b141dCFDa726e239efF005E3DE7A47AeBFf948 from block 30574105 (2026-11-10). Lending TVL: underlying tokens held by SoneVibe cTokens listed by the comptroller; borrowed = total borrows. Arbitrum counts those factory reserves only; that chain has no comptroller or cTokens.' +module.exports = mergeExports([dexExports, soneiumNewExports, bscNewExports, lendingExports]) +module.exports.methodology = 'DEX TVL: reserves of all VibeSwap pairs created by the factories (core assets only). On Soneium this includes the original factory 0x06C0b58287794a0bdce20ce768b601CA974618DC, kept for history, and the drain-free factory 0x77b141dCFDa726e239efF005E3DE7A47AeBFf948 from block 30574105 (2026-11-10). On BSC this includes the original factory 0xaf905e66038EcE89e03D843B35a11D262053B630, kept for history, and the factory 0x26b13e7e923e964b0514B3167A90901B49DAe205 from block 135015600 (2026-11-22). Lending TVL: underlying tokens held by SoneVibe cTokens listed by the comptroller; borrowed = total borrows. Arbitrum counts those factory reserves only; that chain has no comptroller or cTokens.' From 741ec08d8053cc5211c484bd0d73948908f7c25e Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Sun, 22 Nov 2026 07:55:50 -0400 Subject: [PATCH 870/988] Count unstake pool liquid staking tokens (#22333) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> Co-authored-by: FelixBruguera --- projects/thevault-unstake-pool/index.js | 30 ++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/projects/thevault-unstake-pool/index.js b/projects/thevault-unstake-pool/index.js index 41370b562c1..12638f7b906 100644 --- a/projects/thevault-unstake-pool/index.js +++ b/projects/thevault-unstake-pool/index.js @@ -1,21 +1,49 @@ const { PublicKey } = require("@solana/web3.js"); +const { chains: { svm } } = require('@defillama/sdk') const { getStakedSol, sumTokens2 } = require("../helper/solana") +const pool = '9nyw5jxhzuSs88HxKJyDCsWBZMhxj2uNXsFcyHF5KBAb' +// Stake pool programs accepted by the protocol's liquid-unstaker client. +const stakePoolPrograms = [ + 'SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy', + 'SP12tWFxD9oJsVWNavTTBZvMbA6gkAmxtVgxdqvyvhY', + 'SPMBzsVUuoHA4Jm6KunbsotaahvVikZs1JyTW6iJvbn', +] + async function tvl(api) { // Unstake pool: https://docs.thevault.finance/products/unstake-pool // Program: https://solscan.io/account/2rU1oCHtQ7WJUvy15tKtFvxdYNNSc3id7AzUcjeFSddo // Stake account: https://solscan.io/account/9nyw5jxhzuSs88HxKJyDCsWBZMhxj2uNXsFcyHF5KBAb#defiactivities // Liquid stake: https://solscan.io/account/6RLKARrt6oPCyuMCdYdUHmJxd4wUa6ZeyiC8VSMcYxRv - await getStakedSol('9nyw5jxhzuSs88HxKJyDCsWBZMhxj2uNXsFcyHF5KBAb', api); + await getStakedSol(pool, api); await sumTokens2({ api, solOwners: [new PublicKey('6RLKARrt6oPCyuMCdYdUHmJxd4wUa6ZeyiC8VSMcYxRv')] }) + + // The pool receives LSTs in exchange for SOL. Ignore unsolicited non-LST tokens. + const lstMints = new Set() + for (const programId of stakePoolPrograms) { + const stakePools = await svm.getProgramAccounts({ + programId, filters: [{ dataSize: 611 }], dataSlice: { offset: 162, length: 32 }, + }) + for (const { account } of stakePools) + lstMints.add(new PublicKey(Buffer.from(account.data[0], 'base64')).toBase58()) + } + for (const programId of [svm.TOKEN_PROGRAM_ID, svm.TOKEN_2022_PROGRAM_ID]) { + const { value } = await svm.call({ method: 'getTokenAccountsByOwner', params: [pool, { programId }, { encoding: 'jsonParsed' }] }) + for (const { account } of value) { + const { mint, tokenAmount } = account.data.parsed.info + if (lstMints.has(mint)) api.add(mint, tokenAmount.amount) + } + } } module.exports = { timetravel: false, + doublecounted: true, + methodology: 'SOL and stake accounts held by the unstake pool, plus the liquid staking tokens it has received in exchange for SOL. Other tokens sent to the pool are ignored.', solana: { tvl }, From c34bdecc29cf9d6a5ec2ee927665fd8d8b8cb502 Mon Sep 17 00:00:00 2001 From: sasnes2000 Date: Mon, 23 Nov 2026 06:49:24 +0000 Subject: [PATCH 871/988] DeltaUSD: count Venus WBETH/ETH reserves on BNB Chain (#22348) --- projects/deltausd/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/projects/deltausd/index.js b/projects/deltausd/index.js index d43d571a051..17adea88bcb 100644 --- a/projects/deltausd/index.js +++ b/projects/deltausd/index.js @@ -8,6 +8,12 @@ const xlayerAaveOwner = '0xacc5b404eb5b31728e225040830162a9482a81f9' const dUSD = '0x1851302297e318d658829fd94b89d5ae6528cb9e' // dUSD token, also the mint/redeem contract const operator = '0x929c98a6e23721f379b5e27cc694744a2b6d46c2' // dUSD owner +const venusLens = '0xe797804c5d4410777c70ef8769c4eb9c39bef662' +const venusMarkets = { + '0x6cfdec747f37daf3b87a35a1d9c8ad3063a1a8a0': ADDRESSES.bsc.wBETH, + '0xf508fcd89b8bd15579dc79a6827cb4686a3592c8': ADDRESSES.bsc.ETH, +} + // Aave V3-style pool data providers, one per chain where the wallet has positions const aaveDataProviders = { base: '0x0f43731eb8d45a581f4a36dd74f5f358bc90c73a', @@ -47,6 +53,17 @@ async function addAave(api, account = owner) { } async function bsc(api) { + // Venus Core: value supplied vTokens directly and deduct accrued debt in the underlying. + const positions = await api.call({ + target: venusLens, + abi: 'function vTokenBalancesAll(address[] vTokens, address account) returns ((address vToken, uint256 balanceOf, uint256 borrowBalanceCurrent, uint256 balanceOfUnderlying, uint256 tokenBalance, uint256 tokenAllowance)[])', + params: [Object.keys(venusMarkets), owner], + }) + for (const { vToken, balanceOf, borrowBalanceCurrent } of positions) { + api.add(vToken, balanceOf) + api.add(venusMarkets[vToken.toLowerCase()], -BigInt(borrowBalanceCurrent)) + } + return sumTokens2({ api, owners: [dUSD, operator, owner], tokens: [ADDRESSES.bsc.USDT, ADDRESSES.null] }) } From 87f6e839aca31b293fbc002edab55d26eb05e32a Mon Sep 17 00:00:00 2001 From: Dani Date: Mon, 23 Nov 2026 07:57:36 +0100 Subject: [PATCH 872/988] alienbase: staking, DAO treasury, and retired products (#22349) Co-authored-by: Dark Alien Lord <41480689+darkalienlord@users.noreply.github.com> Co-authored-by: Cursor --- projects/alienbase-stableswap/index.js | 14 -------------- registries/deadAdapters.json | 26 ++++++++++++++++++++++++++ registries/treasury.js | 9 +++++++-- registries/uniswapV2.js | 18 ++++++++++++++---- registries/uniswapV3.js | 1 + 5 files changed, 48 insertions(+), 20 deletions(-) delete mode 100644 projects/alienbase-stableswap/index.js diff --git a/projects/alienbase-stableswap/index.js b/projects/alienbase-stableswap/index.js deleted file mode 100644 index 78cab6a8c54..00000000000 --- a/projects/alienbase-stableswap/index.js +++ /dev/null @@ -1,14 +0,0 @@ -const pools = Object.values({ - 'aUsdc-Dai': '0x927860797d07b1C46fbBe7f6f73D45C7E1BFBb27', - 'USDC-Dai': '0x410d28fbcd00c677bae1cce2261546c8db4f6a2d', -}) - -async function tvl(api) { - const tokens = await api.multiCall({ abi: 'address[]:getTokens', calls: pools }) - return api.sumTokens({ ownerTokens: tokens.map((t, i) => [t, pools[i]]) }) -} - -module.exports = { - methodology: `Queries balances of StableSwap pools and sums their total value`, - base: { tvl, } -}; \ No newline at end of file diff --git a/registries/deadAdapters.json b/registries/deadAdapters.json index 6f96996f970..6d358ba3c2c 100644 --- a/registries/deadAdapters.json +++ b/registries/deadAdapters.json @@ -456,6 +456,32 @@ "pool2": "_f" } }, + "alienbase-area51": { + "methodology": "Value of the tokens locked in the liquidity pools.", + "base": { + "tvl": "_f" + }, + "hallmarks": [ + [ + "2026-11-03", + "Product retired" + ] + ], + "deadFrom": "2026-11-03" + }, + "alienbase-stableswap": { + "methodology": "Queries balances of StableSwap pools and sums their total value", + "base": { + "tvl": "_f" + }, + "hallmarks": [ + [ + "2025-12-31", + "Product retired" + ] + ], + "deadFrom": "2025-12-31" + }, "allbridge-core": { "methodology": "All tokens locked in Allbridge Core pool contracts.", "deadFrom": "2026-08-31", diff --git a/registries/treasury.js b/registries/treasury.js index e2f5b90ccf6..12e84a551c8 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -593,8 +593,13 @@ const configs = { }, 'treasury/alienbase': { base: { - owners: ['0x4aB9070B7680f802cBf8322e597a4409902171e5'], - ownTokens: ['0x1dd2d631c92b1aCdFCDd51A0F7145A50130050C4'], + owners: ['0x4aB9070B7680f802cBf8322e597a4409902171e5'], // DAO Multisig (Gnosis Safe 5-of-8; factory owner, feeToSetter) + ownTokens: [ + '0x1b23704e3f4bc7081fb00cec582183e3fe43cef7', // ALB + '0x1dd2d631c92b1aCdFCDd51A0F7145A50130050C4', // legacy ALB + '0x32d9f29170a023794025375df6949f56844e4473', // esALB + '0x7fdb2cbe3dd946b6b4521d4a2cce62296ec1441d', // govALB + ], }, }, 'treasury/alkimiya': { diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index b8a268d6391..e8230549241 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -102,9 +102,6 @@ const uniV2Configs = { base: '0xAf39606bec181887951Ab6912Ac7EA216Bd6E4B4', bsc: '0xAf39606bec181887951Ab6912Ac7EA216Bd6E4B4', }, - 'alienbase-area51': { - base: '0x2d5dd5fa7B8a1BFBDbB0916B42280208Ee6DE51e', - }, 'allinxswap': { bsc: '0xB755953681f0b54f59336294f6758aE9e2E3aB5e', op_bnb: '0xAFcA85A70Bd1C2Bf98DB7F24b2380134F76Af7f1', @@ -2476,7 +2473,20 @@ const uniV2Configs = { bsc: { factory: '0xa098751D407796d773032f5Cc219c3e6889fB893', staking: ["0x259C852834375864b65202375558AB11B2d330fd", "0x5badD826AeFa700446Fa6d784e6ff97eD6eeDca9", "0x1Da189c1BA3d718Cc431a2ed240a3753f89CD47A", "wbnb"] }, }, 'alienbase': { - base: { factory: '0x3E84D913803b02A4a7f027165E8cA42C14C0FdE7', staking: [["0x52eaecac2402633d98b95213d0b473e069d86590", "0x365c6d588e8611125De3bEA5B9280C304FA54113"], "0x1dd2d631c92b1aCdFCDd51A0F7145A50130050C4"] }, + methodology: 'Tokens in Alien Base V2 pairs. Staking is the ALB held by the esALB and govALB escrow contracts, plus legacy ALB still escrowed until migration closes.', + base: { + factory: '0x3E84D913803b02A4a7f027165E8cA42C14C0FdE7', + staking: { + __sumTokens: { + tokensAndOwners: [ + ['0x1B23704e3f4bC7081FB00Cec582183e3fE43cEf7', '0x32D9F29170a023794025375Df6949f56844E4473'], // ALB in esALB + ['0x1B23704e3f4bC7081FB00Cec582183e3fE43cEf7', '0x7fdb2cBe3Dd946b6b4521D4a2CCE62296ec1441D'], // ALB in govALB + ['0x1dd2d631c92b1aCdFCDd51A0F7145A50130050C4', '0x365c6d588e8611125De3bEA5B9280C304FA54113'], // legacy esALB + ['0x1dd2d631c92b1aCdFCDd51A0F7145A50130050C4', '0x52eaeCAC2402633d98b95213d0b473E069D86590'], // legacy masterchef + ], + }, + }, + }, }, 'alienfi': { arbitrum: { factory: '0xac9d019B7c8B7a4bbAC64b2Dbf6791ED672ba98B', staking: { tokensAndOwners: [['0x6740Acb82ac5C63A7ad2397ee1faed7c788F5f8c', '0xCf8D01c1a20dabcC025368607020473cCb119F5C']], lps: ['0xE145A5710Be68C3C9C50c5288909E813c5e92F4e'] } }, diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 42dda7a26c2..67702a07b05 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -138,6 +138,7 @@ const uniV3Configs = { }, }, 'alienbase-v3': { + methodology: 'Token balances in Alien Base V3 pools, including liquidity managed by the vaults.', base: { factory: '0x0Fd83557b2be93617c9C1C1B6fd549401C74558C', fromBlock: 7150708, From ac9c02e7d2d364327ea15ca3d24b373aa7a494d4 Mon Sep 17 00:00:00 2001 From: tidewellfi Date: Mon, 23 Nov 2026 08:05:36 +0100 Subject: [PATCH 873/988] Add Tidewell (#22340) Co-authored-by: ccipherx --- projects/tidewell/index.js | 92 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 projects/tidewell/index.js diff --git a/projects/tidewell/index.js b/projects/tidewell/index.js new file mode 100644 index 00000000000..70d56532e7f --- /dev/null +++ b/projects/tidewell/index.js @@ -0,0 +1,92 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs } = require('../helper/cache/getLogs') +const { staking } = require('../helper/staking') + +// Tidewell: automated Uniswap v3/v4 liquidity vaults on Robinhood Chain (https://tidewellfi.app). +// Every user gets their own vault clone from a factory. A vault holds the user's Uniswap position NFTs +// (one per position, or one per band for shaped positions) plus tokens waiting to be reinvested. +// Contracts: https://github.com/tidewellfi/tidewell-contracts +const FACTORIES = [ + '0xD4015691BCA893a8B4D50A15B4fdA5151b7CAa11', // vaults (single range) + '0x413fC35319A01aE74f14Ad211CCBD907dee2bB02', // shaped vaults (liquidity spread over bands) +] +const SHAPED_FACTORY = FACTORIES[1].toLowerCase() +const FROM_BLOCK = 108830067 +const KIND_V4 = 1 + +const TIDE = '0x5dd89189769deB28E1e24fB8623e28856B6B5300' +const THE_WELL = '0xD5277bae0AdA4ce2FBFD9dd2c6bA4289907fB5fb' // TIDE staking + +const settings = 'tuple(int24 minWidth, int24 maxWidth, uint32 cooldown, uint16 compoundBps, uint16 slippageBps, uint8 rule)' +const shapedSettings = 'tuple(int24 minWidth, int24 maxWidth, uint32 cooldown, uint16 compoundBps, uint16 slippageBps, uint8 rule, uint32 outDelay)' +const poolKey = 'tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)' +const abis = { + vaultCreated: 'event VaultCreated(address indexed user, uint8 kind, address vault)', + positionIds: 'function positionIds() view returns (uint256[])', + v3: `function getPosition(uint256 id) view returns (tuple(uint256 tokenId, address pool, address token0, address token1, uint24 fee, int24 tickSpacing, uint32 lastMove, ${settings}))`, + v4: `function getPosition(uint256 id) view returns (tuple(uint256 tokenId, ${poolKey} key, int24 tickLower, int24 tickUpper, uint32 lastMove, ${settings}))`, + v3Shaped: `function getPosition(uint256 id) view returns (tuple(uint256 tokenId, address pool, address token0, address token1, uint24 fee, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint32 lastMove, uint32 lastCompound, uint8 shape, ${shapedSettings}))`, + v4Shaped: `function getPosition(uint256 id) view returns (tuple(uint256 tokenId, ${poolKey} key, int24 tickLower, int24 tickUpper, uint32 lastMove, uint32 lastCompound, uint8 shape, ${shapedSettings}))`, +} + +// Number of Uniswap positions (bands) behind one shaped position; see Shapes.bands in the contracts. +function bands(shape) { + shape = Number(shape) + if ((shape & 3) === 0) return 1 + const n = shape >> 2 + return n === 0 ? 7 : n +} + +async function vaults(api) { + const out = [] + for (const factory of FACTORIES) { + const logs = await getLogs({ api, target: factory, eventAbi: abis.vaultCreated, onlyArgs: true, fromBlock: FROM_BLOCK }) + logs.forEach(l => out.push({ vault: l.vault, v4: Number(l.kind) === KIND_V4, shaped: factory.toLowerCase() === SHAPED_FACTORY })) + } + return out +} + +async function tvl(api) { + const all = await vaults(api) + const ids = await api.multiCall({ abi: abis.positionIds, calls: all.map(v => v.vault) }) + + const calls = { v3: [], v4: [], v3Shaped: [], v4Shaped: [] } + all.forEach((v, i) => { + const type = (v.v4 ? 'v4' : 'v3') + (v.shaped ? 'Shaped' : '') + for (const id of ids[i]) calls[type].push({ target: v.vault, params: [id] }) + }) + const read = (type) => calls[type].length ? api.multiCall({ abi: abis[type], calls: calls[type] }) : [] + const [p3, p4, p3s, p4s] = await Promise.all([read('v3'), read('v4'), read('v3Shaped'), read('v4Shaped')]) + + // Tokens waiting in the vaults (unplaced amounts, fees not yet reinvested). + const tokensAndOwners = [] + p3.forEach((p, i) => tokensAndOwners.push([p.token0, calls.v3[i].target], [p.token1, calls.v3[i].target])) + p3s.forEach((p, i) => tokensAndOwners.push([p.token0, calls.v3Shaped[i].target], [p.token1, calls.v3Shaped[i].target])) + p4.forEach((p, i) => tokensAndOwners.push([p.key.currency0, calls.v4[i].target], [p.key.currency1, calls.v4[i].target])) + p4s.forEach((p, i) => tokensAndOwners.push([p.key.currency0, calls.v4Shaped[i].target], [p.key.currency1, calls.v4Shaped[i].target])) + + // Uniswap v4 position ids: one per position, or tokenId .. tokenId + bands - 1 for a shaped one. + const v4Ids = [] + p4.forEach(p => v4Ids.push(p.tokenId)) + p4s.forEach(p => { for (let i = 0; i < bands(p.shape); i++) v4Ids.push((BigInt(p.tokenId) + BigInt(i)).toString()) }) + + const v3Owners = all.filter(v => !v.v4).map(v => v.vault) + + await sumTokens2({ + api, + tokensAndOwners, + owners: v3Owners, + resolveUniV3: v3Owners.length > 0, + blacklistedTokens: [TIDE], // own token is not tvl + }) + if (v4Ids.length) await sumTokens2({ api, resolveUniV4: true, uniV4ExtraConfig: { positionIds: v4Ids }, blacklistedTokens: [TIDE] }) +} + +module.exports = { + methodology: 'TVL is the liquidity in every Tidewell vault: the Uniswap v3 and v4 positions each vault holds (one per position, or one per band for shaped positions), valued at the current pool price, plus tokens waiting in the vaults to be reinvested. TIDE is excluded from tvl. Staking is TIDE staked in The Well.', + doublecounted: true, // the liquidity sits in Uniswap pools + robinhood: { + tvl, + staking: staking(THE_WELL, TIDE), + }, +} From e8ba7866adf12f839f50d2eda6d59c463cf186ab Mon Sep 17 00:00:00 2001 From: renry2 Date: Mon, 23 Nov 2026 08:06:12 +0100 Subject: [PATCH 874/988] groypfi: OTC Desk escrow in TVL, milestones, treasury (#22343) Co-authored-by: ccipherx --- projects/groypfi-io/index.js | 88 +++++++++++++++++++++++++++++------- registries/treasury.js | 16 +++++++ 2 files changed, 87 insertions(+), 17 deletions(-) diff --git a/projects/groypfi-io/index.js b/projects/groypfi-io/index.js index 2e738e00f77..a372525c046 100644 --- a/projects/groypfi-io/index.js +++ b/projects/groypfi-io/index.js @@ -1,22 +1,24 @@ /** - * TVL = protocol-owned liquidity on DeDust.io (CPMM v2 pools). + * GroypFi — TVL on TON (DefiLlama/DefiLlama-Adapters -> projects/groypfi-io/index.js) * - * DeDust CPMM v2 does NOT use LP jettons: each liquidity provider owns a - * per-pool `Position` contract, derived from the pool via - * `get_position_address(owner)`. For every (owner, pool) pair in the static - * list below the adapter: - * 1. Resolves the owner's Position contract for that pool and reads its - * `liquidity` via `get_position_data`. - * 2. Reads the pool's `reserve_x` / `reserve_y` / `liquidity` via - * `get_pool_data` and credits the owner's pro-rata share of both sides. + * 1. Protocol-owned liquidity on DeDust.io CPMM v2 pools (unchanged from the live adapter). + * DeDust CPMM v2 has no LP jettons: each liquidity provider owns a per-pool `Position` + * contract, derived from the pool via `get_position_address(owner)`. For every (owner, pool) + * pair in the static list below the owner's `liquidity` is read via `get_position_data` and + * converted into a pro-rata share of the pool's `reserve_x` / `reserve_y` (`get_pool_data`). + * Any RPC failure throws instead of silently under-reporting TVL. + * Owner wallets: UQClgkR0eLgWAR0tZh8YbQyDqa-Jn5wUP1XHPLDB6RmAPySF, UQDu4AiT__JKuqT0Znje0RoXIQMPcj4uIGYZme3UK4hFlE_Q * - * The pool list is static (no transaction scanning), so the adapter's cost is - * constant over time and positions never get undercounted. Any RPC failure - * throws instead of silently under-reporting TVL. + * 2. GroypFi OTC Desk escrow: tokens locked in open sell orders. Every order is its own OtcOrder + * escrow contract, deployed only by an official GroypFi OtcFactory (InitOrder, op 0x4f544332). + * An order turns ACTIVE (status 3) only after the seller deposits exactly the listed amount, and + * `amountLeft` of `jettonMaster` stays locked until bought or cancelled by the seller. Amounts come + * from each order's own get_order_data (never indexer balances), so tokens sent to an order by + * anyone else cannot inflate TVL. + * OtcFactory v3: EQA8rZQmgwZFIrjOjYtsXaIKVhIQigd98h9PvQ-0yu9cp1AY + * OtcFactory v2: 0:d5a966d0bcc9a4685d49dc925236e412f0af3d0bb31ce389c0a17b158f921718 * - * Owner wallets: - * UQClgkR0eLgWAR0tZh8YbQyDqa-Jn5wUP1XHPLDB6RmAPySF - * UQDu4AiT__JKuqT0Znje0RoXIQMPcj4uIGYZme3UK4hFlE_Q + * Website: https://groypfi.io · OTC Desk: https://groypfi.io/otc */ const { get } = require("../helper/http"); @@ -122,7 +124,7 @@ async function safeGet(url, tries = 4) { throw new Error(`groypfi: TonAPI request failed (${url}): ${lastError && lastError.message}`); } -async function tvl(api) { +async function polTvl(api) { for (const [owner, pools] of Object.entries(POSITIONS)) { for (const pool of pools) { const posRes = await safeGet( @@ -168,10 +170,62 @@ async function tvl(api) { } } + +// ---------- GroypFi OTC Desk escrow ---------- + +const { ton } = require('@defillama/sdk').chains +const { getUniqueAddresses, sliceIntoChunks } = require('../helper/utils') + +const OTC_FACTORIES = [ + '0:3cad942683064522b8ce8d8b6c5da20a5612108a077df21f4fbd0fb4caef5ca7', // v3 + '0:d5a966d0bcc9a4685d49dc925236e412f0af3d0bb31ce389c0a17b158f921718', // v2 +] +const OTC_INIT_ORDER_OP = '0x4f544332' +const OTC_START = 1794684130 // first OtcFactory v2 transaction, 2026-11-14 +const OTC_STATUS_ACTIVE = 3 // otc-constants.tolk + +async function otcTvl(api) { + const orders = [] + for (const factory of OTC_FACTORIES) { + const msgs = await ton.getMessages({ source: factory, opcode: OTC_INIT_ORDER_OP, startTimestamp: OTC_START, endTimestamp: api.timestamp + 1, limit: 1000 }) + msgs.forEach((m) => { if (m.destination) orders.push(m.destination) }) + } + const unique = getUniqueAddresses(orders.map((a) => ton.normalizeAddress(a)), api.chain) + + // Only orders that hold a jetton balance can be ACTIVE; their state is then read from chain. + const holders = new Set() + for (const chunk of sliceIntoChunks(unique, 100)) { + const wallets = await ton.getJettonWallets({ owner: chunk, excludeZeroBalance: true }) + wallets.forEach(({ owner }) => holders.add(ton.normalizeAddress(owner))) + } + + const locked = {} // raw jetton master -> units locked in active orders + for (const order of holders) { + // [status, factory, maker, nonce, jettonMaster, feeWallet, jettonWallet, amountTotal, amountLeft, totalPrice, minFill, privateTaker] + const data = await ton.call({ target: order, method: 'get_order_data' }) + if (Number(data[0]) !== OTC_STATUS_ACTIVE) continue + const factory = data[1] + if (!OTC_FACTORIES.some((f) => ton.compareAddress(f, factory))) throw new Error(`groypfi: OTC ${order} reports foreign factory ${factory}`) + const jettonMaster = data[4] + const amountLeft = BigInt(data[8]) + if (!jettonMaster || amountLeft <= 0n) continue + const key = ton.toRawAddress(jettonMaster).toLowerCase() + locked[key] = (locked[key] ?? 0n) + amountLeft + } + + for (const [master, amount] of Object.entries(locked)) api.add(ton.normalizeAddress(master), amount.toString()) +} + +async function tvl(api) { + await polTvl(api) + await otcTvl(api) +} + module.exports = { timetravel: false, doublecounted: true, + hallmarks: [["2026-11-14", "OTC Desk launch"]], methodology: - "TVL counts GroypFi's protocol-owned liquidity on DeDust.io CPMM v2 pools. For each protocol wallet and each pool it provides liquidity to (static list), the wallet's Position contract liquidity is read on-chain and converted into a pro-rata share of the pool's reserves, priced in USD.", + "TVL counts (1) GroypFi's protocol-owned liquidity on DeDust.io CPMM v2 pools: for each protocol wallet and each pool it provides liquidity to (static list), the wallet's Position contract liquidity is read on-chain and converted into a pro-rata share of the pool's reserves; and (2) tokens locked in open GroypFi OTC Desk sell orders: for every escrow order deployed by an official GroypFi OtcFactory that is active, the unsold amount (amountLeft) of the listed token read from the order contract.", ton: { tvl }, }; diff --git a/registries/treasury.js b/registries/treasury.js index 12e84a551c8..bd26ce67685 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -91,6 +91,22 @@ const configs = { owners: ['0x586b9b2F8010b284A0197f392156f1A7Eb5e86e9', '0xfc64382c9ce89ba1c21692a68000366a35ff0336'], }, }, + 'treasury/groypfi': { + ton: { + owners: [ + 'UQDu4AiT__JKuqT0Znje0RoXIQMPcj4uIGYZme3UK4hFlE_Q', // house wallet + $GROYP buybacks (groypfihouse.ton) + 'UQCvlNDUcVJq55xVNV9BvCC1KUaMVUetnUkr_sSovHTLmTsj', // house wallet + 'UQAuMfZUcQoiOt-S4vWJhlT2Qlewgrmi99AQ4ISEjDCAIR-i', // house wallet + 'UQDz_6Hyrq2AgMIWw4S5xPH9OBMcaerRp14y94T-cRJistBx', // house wallet + 'EQCDgsSX3XV1PHIK59-pCcn8GpsqYT7rixgd4EhWGiaKK6Vt', // GroypFi multisig + 'UQCnkAaVs7fNpub-w3NfFVYmQtVUldPc7RZj2_CMiKoXfikn', // GroypFi $GROYP reserve wallet + ], + tokens: [nullAddress, ADDRESSES.ton.USDT], + onlyWhitelistedTokens: true, + useTonApiForPrices: false, + ownTokens: ['EQAtwo6qMNwtr0iTA9eKVZ32cuACFJ0VKd78GrBWOe83-X1P'], + }, + }, 'treasury/hegic': { arbitrum: { tokens: [nullAddress], From fc299a8d9b3c9c86a1ed3ea45916a401204ad781 Mon Sep 17 00:00:00 2001 From: nounyagent Date: Mon, 23 Nov 2026 14:06:59 +0700 Subject: [PATCH 875/988] Add NOUNY (Robinhood Chain) (#22346) Co-authored-by: DERP Co-authored-by: ccipherx --- projects/nouny/index.js | 84 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 projects/nouny/index.js diff --git a/projects/nouny/index.js b/projects/nouny/index.js new file mode 100644 index 00000000000..fa4c38cef17 --- /dev/null +++ b/projects/nouny/index.js @@ -0,0 +1,84 @@ +// NOUNY (nounyagent.com): no-code trading agents, on-chain payroll and hooked Uniswap v4 pools on Robinhood Chain. +// TVL = what users hold in their own NOUNY vaults: +// - AgentVaults (one per wallet, live trading agents): every allowed token held by each vault. Vaults are found +// from the factories' VaultCreated events, and each vault's token list is read on-chain. +// - PayrollVaults (one per wallet): USDG held for salaries. Listed by the PayrollFactory. +// - NounyLPVaults (hooked-pool liquidity): idle tokens in each vault plus the amounts in its Uniswap v4 position. +// Both the current and the previous deployment are counted (the previous one was replaced after a security review). +// Source: github.com/nounyagent/nouny-agent +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const USDG = '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168' + +const AGENT_VAULT_FACTORIES = [ + { address: '0x842dB2d736F66A0132EaB3816C426Bc21bb746Ec', fromBlock: 115989053 }, // current + { address: '0x0315841Ff9eC63321Faa050e937FD8402053C090', fromBlock: 113701344 }, // previous +] +const PAYROLL_FACTORIES = [ + { address: '0x5767a297bdc0083684720fc75580d51cB160DccE', fromBlock: 115989661 }, // current + { address: '0xeD9cE03E385554Bc829879EBa77cCBC1DeDce5bD', fromBlock: 113688874 }, // previous +] +const LP_VAULT_FACTORIES = [ + { address: '0x7823d963A7daB90Ae3D2a71415Dc10182D237c44', fromBlock: 115990202 }, // current + { address: '0x804a52aDbF958FaAd15884C20A2fFE157A94c6eE', fromBlock: 114099412 }, // previous +] + +const abi = { + vaultCreated: 'event VaultCreated(address indexed owner, address vault)', + allowedTokens: 'function allowedTokens() view returns (address[])', + payrollCount: 'uint256:payrollCount', + payrolls: 'function payrolls(uint256 start, uint256 count) view returns (address[])', + vaultCount: 'uint256:vaultCount', + vaults: 'function vaults(uint256 start, uint256 count) view returns (address[])', + poolKey: 'function poolKey() view returns ((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks))', + positionAmounts: 'function positionAmounts() view returns (uint256 amount0, uint256 amount1)', +} + +async function tvl(api) { + const ownerTokens = [] + + // AgentVaults + const agentVaults = [] + for (const { address, fromBlock } of AGENT_VAULT_FACTORIES) { + const logs = await getLogs2({ api, target: address, eventAbi: abi.vaultCreated, fromBlock }) + agentVaults.push(...logs.map((l) => l.vault)) + } + const tokenLists = await api.multiCall({ abi: abi.allowedTokens, calls: agentVaults }) + agentVaults.forEach((vault, i) => ownerTokens.push([tokenLists[i], vault])) + + // factories deployed after this block (historical runs) are skipped, so a failed count read throws + const block = await api.getBlock() + const liveFactories = (list) => list.filter((f) => block >= f.fromBlock).map((f) => f.address) + + // PayrollVaults + const payrollFactories = liveFactories(PAYROLL_FACTORIES) + const payrollCounts = await api.multiCall({ abi: abi.payrollCount, calls: payrollFactories }) + const payrollCalls = payrollFactories.map((target, i) => ({ target, params: [0, payrollCounts[i]] })).filter((c) => +c.params[1] > 0) + const payrolls = (await api.multiCall({ abi: abi.payrolls, calls: payrollCalls })).flat() + payrolls.forEach((payroll) => ownerTokens.push([[USDG], payroll])) + + // NounyLPVaults: idle balances plus the position in the hooked pool + const lpFactories = liveFactories(LP_VAULT_FACTORIES) + const lpCounts = await api.multiCall({ abi: abi.vaultCount, calls: lpFactories }) + const lpCalls = lpFactories.map((target, i) => ({ target, params: [0, lpCounts[i]] })).filter((c) => +c.params[1] > 0) + const lpVaults = (await api.multiCall({ abi: abi.vaults, calls: lpCalls })).flat() + if (lpVaults.length) { + const keys = await api.multiCall({ abi: abi.poolKey, calls: lpVaults }) + const positions = await api.multiCall({ abi: abi.positionAmounts, calls: lpVaults }) + lpVaults.forEach((vault, i) => { + const { currency0, currency1 } = keys[i] + ownerTokens.push([[currency0, currency1], vault]) + api.add(currency0, positions[i].amount0) + api.add(currency1, positions[i].amount1) + }) + } + + return sumTokens2({ api, ownerTokens }) +} + +module.exports = { + methodology: 'Tokens held in users\' own NOUNY vaults on Robinhood Chain: AgentVaults used by live trading agents (all allowed tokens), PayrollVaults (USDG held for salaries) and NounyLPVaults (idle tokens plus their Uniswap v4 hooked-pool positions).', + start: '2026-11-13', + robinhood: { tvl }, +} From 3b5d63c6fc75cbc2fbfb3e46a12c8a8c332136c6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 23 Nov 2026 08:43:03 +0100 Subject: [PATCH 876/988] update gate --- projects/gate-io/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index f23bad5844a..d573fda7f78 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -216,13 +216,13 @@ const config = { "owners": [ "TBA6CypYJizwA9XdC7Ubgc5F1bxrQ7SqPt", "TCYpJ6MMzd9ytoUvD82HnS58iV75QimPh6", - "TDHkXgDHEiK5WhaKTccJenZKRyUMTxoREx", - "TN1K2zNVA399AHbp51yyPPfjaD9JNLfQpo", - "TUt2HuZFZvXAMmF9uh7BqujvMXsZ4F1pif", + // "TDHkXgDHEiK5WhaKTccJenZKRyUMTxoREx", + // "TN1K2zNVA399AHbp51yyPPfjaD9JNLfQpo", + // "TUt2HuZFZvXAMmF9uh7BqujvMXsZ4F1pif", "TCr9697xxWMbZznvpJh8uVQzAQR9cLXZm9", - "TDyR4wBeodpigiKmnwyBQC8UfsCH1T25XF", - "THhVZfr2Q4J3spWK84Je4ALiFyrnnSq6nN", - "TZJNuEg5VaYLR9kdQfjj7WE6jh4vt9JMp2", + // "TDyR4wBeodpigiKmnwyBQC8UfsCH1T25XF", + // "THhVZfr2Q4J3spWK84Je4ALiFyrnnSq6nN", + // "TZJNuEg5VaYLR9kdQfjj7WE6jh4vt9JMp2", "TYAavN2xCDro5Gdip8UU6W9oQmM43rNxzQ", "TLsUUQZCkcrBRxEKqZbpekdq9LWfmnndPg" ] From 0697aab88a4243f82b83f12dc9fca1f788f9f494 Mon Sep 17 00:00:00 2001 From: thomas <81407403+thomas-cloud579@users.noreply.github.com> Date: Mon, 23 Nov 2026 17:43:54 +0800 Subject: [PATCH 877/988] new reserve addresseses (#22352) --- projects/gate-io/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index d573fda7f78..b594a52c90f 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -2210,6 +2210,8 @@ const earnReceiptTokens = { '0xC453E33Ae2d465d36fEA462BfE810cD6ab408916', "0xba622437b70d86EADd6F2f5fB7A5124270c35705", '0x7cce98e315e406a8946acce9768093d37a90372b', // Compound V3 Institutional USDC supplier + '0xFeBF3D13f88B613441B85519A7101dF0b6b41C89', // Aave V3 USDT supplier + '0x0b96F5A83F210181795cd4C63FFC00604ae207ff', // Aave V3 USDT supplier ], tokens: [ '0x23878914efe38d27c4d67ab83ed1b93a74d4086a', // aEthUSDT (Aave v3) From da8326d4098c413ab3fac81666f1f9e013579317 Mon Sep 17 00:00:00 2001 From: max <39312833+fritzschoff@users.noreply.github.com> Date: Mon, 23 Nov 2026 09:44:31 +0000 Subject: [PATCH 878/988] treasury: add the Stellar Development Foundation (#22350) --- .../stellar-development-foundation.js | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 projects/treasury/stellar-development-foundation.js diff --git a/projects/treasury/stellar-development-foundation.js b/projects/treasury/stellar-development-foundation.js new file mode 100644 index 00000000000..4e50c8d5bf9 --- /dev/null +++ b/projects/treasury/stellar-development-foundation.js @@ -0,0 +1,43 @@ +const { sumTokens } = require('../helper/chain/stellar') + +// The accounts the Stellar Development Foundation lists on its mandate page, +// https://stellar.org/foundation/mandate, grouped by SDF as development, growth, +// product and innovation, and assets and liquidity +const OWNERS = [ + 'GB6NVEN5HSUBKMYCE5ZOWSK5K23TBWRUQLZY3KNMXUZ3AQ2ESC4MY4AQ', // Direct Development, Available Funds + 'GATL3ETTZ3XDGFXX2ELPIKCZL7S5D2HY3VK4T7LRPD6DW5JOLAEZSZBA', // Direct Development (Hot 1) + 'GAKGC35HMNB7A3Q2V5SQU6VJC2JFTZB6I7ZW77SJSMRCOX2ZFBGJOCHH', // Direct Development (Hot 2) + 'GAPV2C4BTHXPL2IVYDXJ5PUU7Q3LAXU7OAQDP7KVYHLCNM2JTAJNOQQI', // Direct Development (Hot 3) + 'GC3ITNZSVVPOWZ5BU7S64XKNI5VPTRSBEXXLS67V4K6LEUETWBMTE7IH', // Growth Hot 1 + 'GBEVKAYIPWC5AQT6D4N7FC3XGKRRBMPCAMTO3QZWMHHACLHTMAHAM2TP', // Growth 2 + 'GDUY7J7A33TQWOSOQGDO776GGLM3UQERL4J3SPT56F6YS4ID7MLDERI4', // Growth 1 + 'GCPWKVQNLDPD4RNP5CAXME4BEDTKSSYRR4MMEL4KG65NEGCOGNJW7QI2', // Product and Innovation 1 + 'GDKIJJIKXLOM2NRMPNQZUUYK24ZPVFC6426GZAEP3KUK6KEJLACCWNMX', // Product and Innovation 2 + 'GDWXQOTIIDO2EUK4DIGIBLEHLME2IAJRNU6JDFS5B2ZTND65P7J36WQZ', // Product and Innovation Hot 2 + 'GAMGGUQKKJ637ILVDOSCT5X7HYSZDUPGXSUW67B2UKMG2HEN5TPWN3LQ', // Assets and Liquidity + 'GANII5Y2LABEBK74NWNKS4NREX2T52YTBGQDRDKVBFRIIF5VE4ORYOVY', // Assets and Liquidity (Hot) +] + +// XLM is the Foundation's own token, so it is reported under ownTokens and everything else under tvl +const XLM = 'stellar:XLM' + +async function balances(api) { + return sumTokens({ api, owners: OWNERS }) +} + +async function tvl(api) { + const all = await balances(api) + delete all[XLM] + return all +} + +async function ownTokens(api) { + const all = await balances(api) + return { [XLM]: all[XLM] ?? 0 } +} + +module.exports = { + timetravel: false, + methodology: 'Balances of the 12 accounts listed on the Stellar Development Foundation mandate page (stellar.org/foundation/mandate). XLM is reported as ownTokens; any other asset the accounts hold is reported as tvl.', + stellar: { tvl, ownTokens }, +} From 2af632a00b0d380751287cb032cf679ac6402191 Mon Sep 17 00:00:00 2001 From: Roberto Fajardo Duro <75702301+robertofd31@users.noreply.github.com> Date: Mon, 23 Nov 2026 10:51:34 +0100 Subject: [PATCH 879/988] sodex: mark as doublecounted with SoSoValue Indexes (#22353) --- registries/sumTokens.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 37ab99cdba0..bf4ad82d02b 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -25728,7 +25728,8 @@ const configs = { }, }, "sodex": { - "methodology": "TVL is calculated as the sum of all assets held in SoDex custody addresses across multiple chains. SOSO token holdings are tracked separately as staking.", + "methodology": "TVL is calculated as the sum of all assets held in SoDex custody addresses across multiple chains. SOSO token holdings are tracked separately as staking. Most of the Base TVL is SSI index tokens (MAG7.ssi, sMAG7.ssi, DEFI.ssi, MEME.ssi), whose underlying basket is already counted by SoSoValue Indexes, so the listing is marked as doublecounted.", + "doublecounted": true, "timetravel": false, "bitcoin": { "owners": [ @@ -25831,9 +25832,9 @@ const configs = { "ownerTokens": [ [ [ - // sMAG7.ssi - "0x9e6a46f294bb67c20f1d1e7afb0bbef614403b55", // MAG7.ssi + "0x9e6a46f294bb67c20f1d1e7afb0bbef614403b55", + // sMAG7.ssi "0x3d8f0ddb4bb9332Cb89dEC22d273d9be1a91530b", // DEFI.ssi "0x164ffdaE2fe3891714bc2968f1875ca4fA1079D0", From 6cda435d87aebe1da4f0c38988fa66bef214927f Mon Sep 17 00:00:00 2001 From: max <39312833+fritzschoff@users.noreply.github.com> Date: Mon, 23 Nov 2026 09:59:42 +0000 Subject: [PATCH 880/988] treasury: add Raydium (#22351) Co-authored-by: ccipherx --- registries/treasury.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/registries/treasury.js b/registries/treasury.js index bd26ce67685..02c8c9a3ade 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -5015,6 +5015,15 @@ const configs = { owner: '0x0a39701e5D5BB5A6146aEEba66638297D0947f04' } }, + 'treasury/raydium': { + solana: { + owners: [ + 'GThUX1Atko4tqhN2NaiTazWSeFWMuiUvfFnyJyUghFMJ', // protocol multisig, owns the CLMM/CPMM USDC treasury and pool-creation fee accounts + 'DdHDoz94o2WJmD9myRobHCwtx1bESpHTd4SSPe6VEZaz', // RAY buyback holding + ], + ownTokens: ['4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R'], + }, + }, 'treasury/rarible': { ethereum: { tokens: [ From efc98ac313bc5c80b278d9012a41a18ff9c3b0b5 Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Mon, 23 Nov 2026 11:56:19 +0000 Subject: [PATCH 881/988] fix: update Circle Bitcoin reserve addresses (#22354) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/helper/bitcoin-book/index.js | 105 +++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 4 deletions(-) diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index c16efe93a81..ad33277db68 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -1174,10 +1174,107 @@ module.exports = { "3Pr9uMzcEtmmCLShywSrsHq6Xqy9taEdXh", ], circleBTC: [ - '1JkKmG26nUBcPS99TsCVsReSXvLkEai4ca', - '1KVBNjpYfJvASdzeTAwqNbe9WecpKyugM3', - '1HkJ6hcN4h4PtUYHiSi1hrUEUKQJmedM6z', - '1FXxhAa9yKCG8WgCTrbSsdGKuC6QzN3Gq9', + // Reserve addresses published by Circle: https://www.circle.com/cirbtc + '1F57JXMdM5xMogaiaVGCGqvKQfwMuwBZeb', + '1HEp43tjgTrE21M7PEKrKE4gfkcGrtQ79T', + '16otYETMdosFtbxDqF2ZsHT351z4JCPKqY', + '1C2ZC8LrQ2xBWhmJR32cQoHder6wiypugY', + '1HgRjHVomqR9YUJn6y4JnWbj1GxtzkVHgs', + '1KJuyKvZGCVNXubxs2EgWjWRRRp86jo4gN', + '1PHRTsqJdF9Bb7srt6VNAuA9kyxvCWNtUz', + '1FVCsevyXDG8ccT5fKSjtd7X8Pun5SQMxy', + '18TLL5Bnv86mynLcBHLJ88Cdb8Ty7Da2Ho', + '1STHSYmHMvU2TUEGit56k6XP8h6M9EAqJ', + '1CPiCkLxEioQoBtuXMo7DaePuQGeotW8FC', + '1P2io37HByqDsJzsJyPLRYDWPtyBaGEhpr', + '18xywY3FMurswT4fkJTTLujYWFRTA9kBDb', + '18G5bM1cij8joMq7eGGp4SMEsavJap13rj', + '1LEsF8YPfcmJaRyLXrH8pAJxRMYhYCH4BQ', + '12CDhP8CFnG8jXtb5TiuFewYaDcNNrShiJ', + '19vc3ujZkbiRLpBDDWrLFYdHuVTDp2PifL', + '19kqciPyqDpWRqSih1P78jvLzpc5sThwL4', + '1Ei6WBLivWvwn7zpepRM74eP1dTomzn45i', + '1PamLyUBv2nwt6LFvR5VUz6RwwPmLFdWdp', + '12xQWiLYGcFyRDr2esP2FvAxhiN6dv3EYn', + '1M72G6Cz6SrPLLuZbyYG5LwLtbfb6sPedR', + '1E4ppAoF6wZ5YzwFZ7RNGq57nS9WHrBaDg', + '1FGaHLNa9CsbRuKELjUkitM9ax9xvnJ5V3', + '1G1EqQNm62eMnnTNGDy5Ncm2CsXHEU4ciM', + '1FbdoJxqMZr7ofoSSzVpsM2nPu5qyXJUGo', + '19sW499mu1eRDCuPZUug4S9ePjZgim8dcs', + '144pUn1WtG53Rywg6UTTkbkBqMMfyuAxpQ', + '18JzhLqLU91nJfpeEV8cfS8Wif3Dg2vZZb', + '1AYfEnDs5U3ZnbVQVKtBzvrCc2imNfKXtZ', + '1JKpghjd6XURZ1Gp3szfUaH9qg1Jyt2jJm', + '1ANUqvmEvo11fMRgBTbAkMLbmY5758aqpB', + '16biLBRp4yDbYKtRrZmMSWhKaCUEn7nhVv', + '1GsXiRC19dDoF5K8EvyTHvM1J3Hv56Hxin', + '1FtNfVDjd4JRk8iLJRxUsxMxvHS3upMJoK', + '1Egn2YFQcbVzpgN3ep6x6oZjUygm2ovwWH', + '1KW2b1NJNrvJStEpVo172UjaBXNQBDdj5a', + '1BjzqL6BMKkL8b9uhi4vRbUf3jyjAtwhaU', + '1HbVZyREFLcRgUDeZLyBmDUi9HZjmAMHre', + '18V66rdcaPJuk2iqfAQ5rgCDiuQAEimSSU', + '1KV2tTHEsFMq8PpgcVQLbpjcxCiAcDXazz', + '1KfoQSRHTybVB5m6qMJePCcQLqNjffJjU6', + '1Q4MhRZSac15J6hEP6dGzso5gtaLafhU4p', + '146stYWkMmMXXZenJYCm8uRgz5QKfGsrWE', + '1LBery2qF3NUnYocRWGimHKRdjttGxg5Jk', + '1ExFAxNjKdEFjS91PjVA7T8adwz3CDa8qB', + '1Dk8DkAnwitBQYXmUmtS4oveUAHQXcnAaa', + '18Hh3U121mqgpF1RwqZhp3PNK6LN4vxvN2', + '1PqNrm2zKjm7R4d2GJG7WnEV1Rvza8JdLS', + '1G1cVajv7Lbyyn294AwDYnrX32R1SrNjNA', + '15NEn2U1mDcdLtdxyngCeEjYN5uzWefAu1', + '1GUekr2kr1AjwWozbAkdCNCoCht3uqFqjp', + '1Mx7FztYG1ABnBxCkMmzHWFQZDq9ooqnay', + '1E1Uzaa3JxMFeANvLeipozH1sZ9S3HySNq', + '15qWWRJbtgMNNPuqKbpFbk6NyW63GmKjZ1', + '17XqbGcxKpgZv7uojy1ab1GPRhBz8QKozv', + '1ED6tUES2BHZga9bknXP8KnU8vwuPbneV4', + '1AMhGh4jAmrk9BqYNUGs76kPMCrpGQXuTn', + '18f391Xk6hyvpM3FPkXvRMW9R5FRW6jebn', + '1Jnj5FA7qxNwoGQThB3fAKfYQFcpA8hh4m', + '1BBaYSt47tSKGortVxWWtVYYJRVvEEr5nb', + '18r8zWmXqhv45sYYa5DCzZSQWhZeKJ8E9V', + '17wESz8M3WoFJqsQUiMT7ZZ9rrWUJUtf8v', + '1EQDX92Yxbtac8Z9psKFhm8hcjnSaBFCAi', + '1C4ZCgZTH8yjPsUkf38N2iD52pRPeY34d9', + '1JGmRw1Qxubpi9EXbrkBGLQ3TfREXEE61U', + '16Fown8aeFGStZEp5G8ZnGaw9FHJkg3c24', + '1E6MHEfz9EdKmr2BzQRW8jau3VsYMwDoKm', + '12EvFAboQyAjFhJ38Ab2QirzePaH3iFoFq', + '1LJus5dBiHv8rW99WfDGAbiEaJkVVAzwBS', + '1C7mwSvNWWRVsZVaiqoEtXjQqY1PDB4vdN', + '12HjLKbMEBYmupxBB94rXcrFtUnugYSRjo', + '1A6KhvMzqRT5fZgJaz6Cxm2i5qghoFLeLJ', + '1BpEUZe2J3fRwziUcmeJtMhPUwBuFvTNpe', + '1AatVpJ9Mt2bfWdEJ3tRKBJ4PSuuqSwmrQ', + '1PdmKfmvcRAL8G7Sfivg2aoc6eaB6tQ34i', + '1PUTij5dgHo27RnB7trH8hPTi8FktTMizg', + '137gzPT1Zo8KD6WHYgcy1kXHchs7jWjspa', + '1AUJqDoXcprihXzMdSqWzjuqJB2Zw378mT', + '126UGm5GysitDuubktyAdz3xHQyEzUMC7d', + '1NviDkC3SJGWf9CNw1iHqCLTB2TcJQ74gf', + '1KTVi3vh59yHxNE2xW5VbSbdZtvL8rqRWR', + '1DZzHw8a7nBU9XwmqrySVrpWAkeo5kAak7', + '1NzV1Db8GUSQjHnKujGWE2qjoZydi3rVnu', + '1GihBu7svHrzhK3u7JekVcHoynK7Mkftsr', + '1NNeRfHBGUsA8DDth5ubRbAR18iXiCeeZJ', + '1HEURXUzMns3Xbbwb2sswZ8tey23pRRL68', + '1K4n18PY2a1zdsoGnYzxMBLZSxcRgJLJzh', + '1EZzddu6KJQx3x5xmkPoxMZ2rFD7vsSpJS', + '14qfXVq5UeGJJ4zJFem27DpvwPHuV6P3RT', + '1EVqdVFoXZZ8318KqL2SMxvBUqE3p3Ea6a', + '1KAfR1mMMEQvF3HMb8gafHxndpsEYXcdKa', + '1Jdnr5g4s5PkjH8WfD9n4YGCdR48rUiExu', + '17diuwozfGRLNyLAypwHLV8gF68RsMU6op', + '1DZ2brFm6KWnRyom96vx4EyhAaPtEboQiv', + '1MNci4Kozau7LznawsjcM6xqtiPdymz63p', + '19kG1ruta8TsnxUVzaeEeccgM9yVVZbRis', + '17H9gwbYUvWW1Buxi2e3UCQNthXL9s4VL2', + '1GeX3PW57hm6abouU2p7NwY9hn5Knk8P9j', + '18WuQvwR6gRKW9kvKMfhqCPdxr3G7oXH9K', ], subfrost: [ // The FROST signer set's taproot output keys that hold the BTC backing frBTC. From 05de35ed947045ea57a6376eeb7ed2f44389f69e Mon Sep 17 00:00:00 2001 From: "duke.sol" <77286113+cryptoduke01@users.noreply.github.com> Date: Mon, 23 Nov 2026 16:53:13 +0100 Subject: [PATCH 882/988] gloam: methodology note for Solana (#22357) --- projects/gloam/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/gloam/index.js b/projects/gloam/index.js index 6f1b8fe6f10..ccd94e53899 100644 --- a/projects/gloam/index.js +++ b/projects/gloam/index.js @@ -22,7 +22,7 @@ async function poolAssets(api, fromBlock) { const fromLogs = (fromBlock) => async (api) => api.sumTokens({ owner: POOL, tokens: await poolAssets(api, fromBlock) }) module.exports = { - methodology: 'TVL is the tokens held by the Gloam shielded pool on Robinhood Chain, Tempo, Base, Ethereum, Elysium and BNB Chain. On Robinhood Chain, Base and Ethereum the accepted assets are discovered from the pool\'s DepositLimitSet events. $GLOAM held in the pool is the protocol\'s own token and is counted under staking.', + methodology: 'TVL is the tokens held by the Gloam shielded pool on Robinhood Chain, Tempo, Base, Ethereum, Elysium and BNB Chain. On Robinhood Chain, Base and Ethereum the accepted assets are discovered from the pool\'s DepositLimitSet events. $GLOAM held in the pool is the protocol\'s own token and is counted under staking. Gloam also runs on Solana, on Helius Privacy Rings: that pool is shared with other apps, so Gloam\'s Solana balances cannot be told apart and are not counted.', start: '2026-10-21', robinhood: { tvl: fromLogs(94194599), From 73bb37a9c1d8d4e711b26c27de68f6d875e4cfa5 Mon Sep 17 00:00:00 2001 From: Shan <59776784+shan501@users.noreply.github.com> Date: Mon, 23 Nov 2026 23:57:07 +0800 Subject: [PATCH 883/988] Strike Finance: track staked Cardano custody and new Ethereum collateral (#22356) --- registries/sumTokens.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index bf4ad82d02b..a47cfe8f131 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -27091,7 +27091,8 @@ const configs = { "addr1wy2gch9ua0700a3dg423wxcwx4p886m4ny5u3aqs66sluqcly9uud", "addr1wxzar75lms9547xdz4slxk7r362rs4g4ccurl22g764akngjhjtzp", "addr1w88zvhrrlqj6kl94mel769v348khd5w3jz3av33ksp8wgvss6msuw", - "addr1w9ygqdx9law3waqgm6eamf2xhxs5x83r0pfka928jmydkuc6ykls3" + "addr1w9ygqdx9law3waqgm6eamf2xhxs5x83r0pfka928jmydkuc6ykls3", + "addr1x9ygqdx9law3waqgm6eamf2xhxs5x83r0pfka928jmydkuewpqm665lqq6jx772x2wg4j986v0ejj8g3uts94lrn0dqsz0eas6" ] }, "staking": { @@ -27109,7 +27110,9 @@ const configs = { "tokens": [ ADDRESSES.ethereum.USDC, "0x6A9A65B84843F5fD4aC9a0471C4fc11AFfFBce4a", // enzoBTC - "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c" // aEthUSDC + "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c", // aEthUSDC + ADDRESSES.ethereum.WSTETH, + "0x8F18f2C97d2f5EC0e1d5B91c1D2ce245a9151972" // sUSD1+ ] } } From 791e3f559c1c636708c60f244fa43764efddce13 Mon Sep 17 00:00:00 2001 From: Denaria Team Date: Mon, 23 Nov 2026 20:29:25 +0100 Subject: [PATCH 884/988] denaria: deadFrom for the Linea vAMM TVL, GMX V2 hallmark on the first trade day (#22359) Co-authored-by: Claude Opus 5.5 --- registries/sumTokens.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index a47cfe8f131..746da764343 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -12936,8 +12936,10 @@ const configs = { "denaria": { "methodology": "Counts USDC locked in the vault(s) of Denaria's own vAMM perp engine on Linea (sunset 2026-09-03). On Arbitrum Denaria trades on GMX V2 and holds no user funds: that collateral is counted under GMX V2.", "hallmarks": [ - ["2026-09-14", "Trading moves to GMX V2 on Arbitrum"] + ["2026-09-02", "Trading moves to GMX V2 on Arbitrum"] ], + // Linea vAMM sunset; the vaults only hold a ~$187 residual since the 2026-04-05 exploit + "deadFrom": "2026-09-03", "linea": { "tokensAndOwners": [ [ From 211a7c1f146f436b4794486fdf743184ab95c8c3 Mon Sep 17 00:00:00 2001 From: Wiz <157927828+wizsws@users.noreply.github.com> Date: Mon, 23 Nov 2026 20:08:36 +0000 Subject: [PATCH 885/988] Add realize (TVL + treasury) (#22360) Co-authored-by: Claude Opus 5.5 Co-authored-by: FelixBruguera --- registries/sumTokens.js | 9 +++++++++ registries/treasury.js | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 746da764343..8510f5ef235 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -23808,6 +23808,15 @@ const configs = { "owner": "0xe0eeb0f14dbc2793a1fb701c507f184f6d44f1cee08f83fe3837b8ef41f55818" }, }, + "realize": { + "timetravel": false, + "methodology": "TVL is the SOL held by the realize Launch Reserve vault, a program-owned PDA that holds the SOL supplied by depositors and the house and funds Partner launches on Pump.fun.", + "solana": { + "solOwners": [ + "8Bdjs9bes4z8xs7b2SydS4NPRVRVAEMpTTDU1358wJsg" + ] + }, + }, "redstone-oracles": { "timetravel": true, "ethereum": { diff --git a/registries/treasury.js b/registries/treasury.js index 02c8c9a3ade..69672e85454 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -5038,6 +5038,16 @@ const configs = { ownTokens: ['0xFca59Cd816aB1eaD66534D82bc21E7515cE441CF'], }, }, + 'treasury/realize': { + solana: { + // Revenue Router legs the protocol keeps: buyback vault (40%), operations and security (15%), Builder Rewards (5%) + owners: [ + '5YkYBwNEYZ6dGpLRLetYjcBcanwMB5QbR2mQmEyt1EGp', + 'Ec72a1cXtLWf4BdMmzStGZkip7hAieZ4J38ZVvBnUMee', + 'ABjqEqWP3Pvtnzo2VZXTQRC4zTUCwy2FHutZ8ksDMbdk', + ], + }, + }, 'treasury/realms': { ethereum: { tokens: [ From 3d1e93e6e18780f72e3a2ac1692c90551f53ebcc Mon Sep 17 00:00:00 2001 From: jakubineth Date: Mon, 23 Nov 2026 21:21:25 +0100 Subject: [PATCH 886/988] Add Tapir Protocol (#22358) Co-authored-by: Claude Opus 5.5 --- projects/tapir/index.js | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 projects/tapir/index.js diff --git a/projects/tapir/index.js b/projects/tapir/index.js new file mode 100644 index 00000000000..0b9f7399b6b --- /dev/null +++ b/projects/tapir/index.js @@ -0,0 +1,57 @@ +// Tapir Protocol: depeg-protection marketplace for yield-bearing tokens. +// Each DepegPool holds one base asset as collateral and mints two tranche +// tokens against it: DP (Depeg Protected) and YB (Yield Boosted). +// +// TVL = base asset held by every DepegPool created by the DepegFactory. +// DP / YB tokens and the DP/YB AMM liquidity are claims on that same +// collateral, so they are NOT counted (would double count). +// +// The live base asset is zvUSDC, an ERC-4626 vault share of Zircuit Finance +// (underlying zUSDC). Held tokens are reported as is; pricing is left to the +// coins service. Because the collateral sits inside Zircuit Finance, the +// protocol is flagged doublecounted. + +const config = { + base: { factory: '0xc0C409aEdCE4fE91Fa26971EdF23E7d97C81d1c5' }, // DepegFactory v1.1 +} + +// The factory stores pools in a private array with no length getter; +// getDepegModule(i) reverts past the end, so read indexes in batches until one fails. +const GET_DEPEG_MODULE = + 'function getDepegModule(uint256 index) view returns (tuple(address dpAsset, address ybAsset, address depegPool))' +const BATCH = 20 + +async function getPools(api, factory) { + const pools = [] + for (let start = 0; ; start += BATCH) { + const res = await api.multiCall({ + target: factory, + abi: GET_DEPEG_MODULE, + calls: Array.from({ length: BATCH }, (_, i) => start + i), + permitFailure: true, + }) + for (const m of res) { + if (!m) return pools + pools.push(m.depegPool) + } + } +} + +async function tvl(api) { + const pools = await getPools(api, config[api.chain].factory) + if (!pools.length) return + + const assets = await api.multiCall({ abi: 'address:ASSET', calls: pools }) + return api.sumTokens({ tokensAndOwners2: [assets, pools] }) +} + +module.exports = { + doublecounted: true, + methodology: + 'TVL is the collateral held in Tapir DepegPools. Live collateral is Zircuit Finance zvUSDC (ERC-4626 vault shares on zUSDC), reported as held. DP and YB tranche tokens and their AMM liquidity are claims on the same collateral and are not counted.', + start: '2026-08-03', +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl } +}) From 8380995db94dd172dbe6c90a385d8c7b185970e5 Mon Sep 17 00:00:00 2001 From: sasnes2000 Date: Tue, 24 Nov 2026 06:00:15 +0000 Subject: [PATCH 887/988] DeltaUSD: count Ethereum Morpho USDC vault reserves (#22363) --- projects/deltausd/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/deltausd/index.js b/projects/deltausd/index.js index 17adea88bcb..96932da78c0 100644 --- a/projects/deltausd/index.js +++ b/projects/deltausd/index.js @@ -23,6 +23,7 @@ const aaveDataProviders = { const MORPHO = '0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb' const morphoMarket = '0x2ea32f6f734f87db12a3b72cfe2b7381837f115411eb57171f672e2d03ed7cf7' // SOL loan / JitoSOL collateral +const morphoUsdcVault = '0x36cfe1568461e499391ef0a555300f1ae2da2439' // Api3 dCOMP USDC vault shares on Ethereum const aeroPool = '0xf634058dc94e6bf8e828e27621320c423bc8b18e' const aeroGauge = '0xd424ba8ca9d4e278753de76651a0095451e65cd1' @@ -52,6 +53,10 @@ async function addAave(api, account = owner) { return tokens } +async function ethereum(api) { + return sumTokens2({ api, owner, tokens: [morphoUsdcVault] }) +} + async function bsc(api) { // Venus Core: value supplied vTokens directly and deduct accrued debt in the underlying. const positions = await api.call({ @@ -133,6 +138,7 @@ module.exports = { timetravel: false, doublecounted: true, methodology: 'Counts tracked on-chain DeltaUSD reserve balances and DeFi positions, minus borrowing. Excludes issued dUSD, off-chain assets and untracked positions. DeFi deposits are also counted in the TVL of the protocols used.', + ethereum: { tvl: ethereum }, bsc: { tvl: bsc }, base: { tvl: base }, xlayer: { tvl: xlayer }, From 3a8ace15f1828107b03a16a9971f82c35d27a64b Mon Sep 17 00:00:00 2001 From: zeroptis <33350088+zeroptis@users.noreply.github.com> Date: Tue, 24 Nov 2026 09:02:23 +0300 Subject: [PATCH 888/988] Add Bust (#22362) --- registries/sumTokens.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 8510f5ef235..b71a3bc5338 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -3253,6 +3253,14 @@ const configs = { ] }, }, + "bust": { + "timetravel": false, + "methodology": "TVL is the USDC held by the Bust vault: the house liquidity that takes the other side of every trade, traders' deposited balances and their open margins. Staking is the $BUST held by the stake pool.", + "solana": { + "tvl": { "tokenAccounts": ["E9X2E43n3ad2uQjuQsdnd5uFYXoWTMDS9sZTY3Tee64h"] }, // USDC account of the vault PDA Hj5Kh3RCTNTaCuvdhBY22HuGuS3K967qvn9GhZ3zn27Q + "staking": { "tokenAccounts": ["JEK7DSt2hLqnmhysDDvBHh3TnM8w1pEbfsv2mZKam4rw"] } // $BUST account of the stake pool PDA 5WbABXxurCUqYkFiJo8rC7rJkKd3K9VrcqngY4t2ATVm + }, + }, "butternetwork": { "methodology": "get the amount of token deposited in MOS contract on each supported chain.", "ethereum": { From 56981d6169a44a051314fcb5884d9e2fb5d64147 Mon Sep 17 00:00:00 2001 From: jakubineth Date: Tue, 24 Nov 2026 07:02:43 +0100 Subject: [PATCH 889/988] tapir: fail the run on a failed pool read instead of stopping discovery (#22361) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/tapir/index.js | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/projects/tapir/index.js b/projects/tapir/index.js index 0b9f7399b6b..fcdd97ea017 100644 --- a/projects/tapir/index.js +++ b/projects/tapir/index.js @@ -16,25 +16,38 @@ const config = { } // The factory stores pools in a private array with no length getter; -// getDepegModule(i) reverts past the end, so read indexes in batches until one fails. -const GET_DEPEG_MODULE = - 'function getDepegModule(uint256 index) view returns (tuple(address dpAsset, address ybAsset, address depegPool))' +// getDepegModule(i) reverts with Panic(0x32) past the end. Indexes are read in +// batches through Multicall3 tryAggregate, which returns each call's revert data: +// only the out-of-bounds panic ends the list. Any other revert, or a failed RPC +// call, fails the run instead of returning a partial pool list. +const MULTICALL3 = '0xcA11bde05977b3631167028862bE2a173976CA11' +const TRY_AGGREGATE = + 'function tryAggregate(bool requireSuccess, tuple(address target, bytes callData)[] calls) view returns (tuple(bool success, bytes returnData)[] returnData)' +const GET_DEPEG_MODULE = '0xd09081b7' // getDepegModule(uint256) -> (address dpAsset, address ybAsset, address depegPool) +const PANIC_OUT_OF_BOUNDS = '0x4e487b71' + '32'.padStart(64, '0') // Panic(uint256) with code 0x32 const BATCH = 20 +const MAX_POOLS = 1000 async function getPools(api, factory) { const pools = [] - for (let start = 0; ; start += BATCH) { - const res = await api.multiCall({ - target: factory, - abi: GET_DEPEG_MODULE, - calls: Array.from({ length: BATCH }, (_, i) => start + i), - permitFailure: true, - }) - for (const m of res) { - if (!m) return pools - pools.push(m.depegPool) + for (let start = 0; start < MAX_POOLS; start += BATCH) { + const calls = Array.from({ length: BATCH }, (_, i) => [ + factory, + GET_DEPEG_MODULE + (start + i).toString(16).padStart(64, '0'), + ]) + const res = await api.call({ target: MULTICALL3, abi: TRY_AGGREGATE, params: [false, calls] }) + for (let i = 0; i < res.length; i++) { + const { success, returnData } = res[i] + if (!success) { + if (returnData.toLowerCase() === PANIC_OUT_OF_BOUNDS) return pools + throw new Error(`tapir: getDepegModule(${start + i}) reverted: ${returnData}`) + } + if (start + i === 0 && returnData === '0x') return pools // factory not deployed yet at this block + if (returnData.length !== 2 + 3 * 64) throw new Error(`tapir: getDepegModule(${start + i}) returned ${returnData}`) + pools.push('0x' + returnData.slice(-40)) // depegPool is the last 32-byte word } } + throw new Error(`tapir: more than ${MAX_POOLS} pools, raise MAX_POOLS`) } async function tvl(api) { From 5b30a1571516e8cebd45ac2420a61ca5c752da3a Mon Sep 17 00:00:00 2001 From: eden Date: Tue, 24 Nov 2026 14:43:41 +0700 Subject: [PATCH 890/988] count verified assets for 3jane lending (#22365) --- projects/3jane-lending/index.js | 72 ++++++++++++++++++--------------- projects/helper/env.js | 1 + projects/helper/verified.js | 11 +++++ 3 files changed, 52 insertions(+), 32 deletions(-) create mode 100644 projects/helper/verified.js diff --git a/projects/3jane-lending/index.js b/projects/3jane-lending/index.js index cbc5879e8ec..d8646158835 100644 --- a/projects/3jane-lending/index.js +++ b/projects/3jane-lending/index.js @@ -1,37 +1,45 @@ -const { getLogs } = require("../helper/cache/getLogs"); -const { sumTokens2 } = require('../helper/unwrapLPs') -const abi = require("../helper/abis/morpho.json"); +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokens2 } = require('../helper/unwrapLPs'); +const { getVerifiedProject } = require('../helper/verified'); -const ADDRESSES = require('../helper/coreAssets.json') - -const contract = "0xde6e08ac208088cc62812ba30608d852c6b0ecbc" -const fromBlock = 23214670 - -async function tvl(api) { - const jane3 = '0x056B269Eb1f75477a8666ae8C7fE01b64dD55eCc' - return sumTokens2({ tokens: ["0xd4fa2d31b7968e448877f69a96de69f5de8cd23e", ADDRESSES.ethereum.USDC], owners: [contract, jane3], api }) -} - -const eventAbis = { - createMarket: 'event CreateMarket(bytes32 indexed id, (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv, address creditLine) marketParams)' -} - -async function borrowed(api) { - const logs = await getLogs({ api, target: contract, eventAbi: eventAbis.createMarket, fromBlock, onlyArgs: true }) - const markets = logs.map((i) => i.id.toLowerCase()) - const marketInfos = await api.multiCall({ target: contract, calls: markets, abi: abi.morphoBlueFunctions.idToMarketParams }) - const marketDatas = await api.multiCall({ target: contract, calls: markets, abi: abi.morphoBlueFunctions.market }) - - marketDatas.forEach((data, idx) => { - const { loanToken } = marketInfos[idx]; - api.add(loanToken, data.totalBorrowAssets); - }); -} +const LENDING = '0xde6e08ac208088cc62812ba30608d852c6b0ecbc'; // 3Jane lending contract (Morpho Blue fork) +const USD3 = '0x056B269Eb1f75477a8666ae8C7fE01b64dD55eCc'; // USD3 vault +const WA_ETH_USDC = '0xd4fa2d31b7968e448877f69a96de69f5de8cd23e'; // Wrapped Aave Ethereum USDC module.exports = { - methodology: `We count the tokens on the contract`, + timetravel: false, + misrepresentedTokens: true, // off-chain assets + methodology: "TVL is 3Jane's bank cash, read hourly from the bank api, plus idle USDC and waEthUSDC in the USD3 vault and lending contract. Borrowed is the outstanding principal of off-chain loans, counted from loan originators' reports.", + hallmarks: [ + ['2026-11-24', 'Methodology change: counts off-chain loans and bank cash from verified reports'], + ], ethereum: { - tvl, - borrowed, + tvl: async (api) => { + const data = await getVerifiedProject('3jane'); + const now = Math.floor(Date.now() / 1000); + // balances: category -> bank -> { balanceUsd, timestamp (unix seconds) } + for (const [category, banks] of Object.entries(data.balances)) { + for (const [bank, item] of Object.entries(banks)) { + const age = now - item.timestamp; + // written as !(age <= max) so a missing timestamp (NaN age) also fails + if (!(age <= 3 * 3600)) throw new Error(`3jane balance ${category}/${bank} is stale: timestamp ${item.timestamp}, ${(age / 3600).toFixed(1)}h old, max 3h`); + + api.addUSDValue(item.balanceUsd); + } + } + + // on-chain: idle USDC and waEthUSDC not yet sent to the bank + // on-chain borrowed is not counted, it is the same money as the off-chain loans and bank cash + await sumTokens2({ api, tokens: [ADDRESSES.ethereum.USDC, WA_ETH_USDC], owners: [LENDING, USD3] }); + }, + borrowed: async (api) => { + const data = await getVerifiedProject('3jane'); + for (const item of Object.values(data.loans)) { + for (const value of Object.values(item)) { + api.addUSDValue(value.principalUsd); + } + } + } } -} +}; + diff --git a/projects/helper/env.js b/projects/helper/env.js index 5b9ba2c08f5..b2dc196bc38 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -140,6 +140,7 @@ const ENV_KEYS = [ 'HIRO_API_KEY', 'APTOS_API_KEY', 'CANTON_API', // ?key= + 'LLAMA_VERIFIED_API', ] Object.keys(DEFAULTS).forEach(i => { diff --git a/projects/helper/verified.js b/projects/helper/verified.js new file mode 100644 index 00000000000..b0aaf84d373 --- /dev/null +++ b/projects/helper/verified.js @@ -0,0 +1,11 @@ +const { getEnv } = require("../helper/env"); + +async function getVerifiedProject(projectId) { + const res = await fetch(`${getEnv('LLAMA_VERIFIED_API')}/${projectId}/current`); + const body = await res.json(); + return body.data; +} + +module.exports = { + getVerifiedProject, +} From 6b7b0bedcfe4b5757a1478fd8ea922bd18a991af Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:33:25 +0100 Subject: [PATCH 891/988] optimize --- projects/airpuff/index.js | 32 ++------------------ projects/ethena-pay/index.js | 8 ++--- projects/giza/arma.js | 6 ++-- projects/helper/chain/stellar.js | 8 +++++ projects/helper/env.js | 8 ++++- projects/helper/sablier.js | 51 ++++++++++++++++++++++++++++++++ projects/koo/index.js | 8 +++-- projects/pendle-loop/index.js | 27 +++++++++++++++-- projects/predictstreet/index.js | 3 +- projects/rysk-premium/index.js | 7 +++-- projects/sablier-flow/index.js | 15 ++++------ projects/sablier-lockup/index.js | 17 ++++------- registries/compound.js | 6 +++- registries/treasury.js | 2 ++ 14 files changed, 126 insertions(+), 72 deletions(-) create mode 100644 projects/helper/sablier.js diff --git a/projects/airpuff/index.js b/projects/airpuff/index.js index f34c21b88bb..1de7be8ebf7 100644 --- a/projects/airpuff/index.js +++ b/projects/airpuff/index.js @@ -163,46 +163,20 @@ module.exports = { strategies.forEach(({ vault, pendleAddress }) => tokensAndOwners.push([pendleAddress, vault])); - await api.sumTokens({ tokensAndOwners }); - + // ezETH vaults: the oracle used before (getUnderlyingPrice) reverts now, ezETH is priced directly const ezETH = { vault: "0x497eB27Ca1ed7566653edf811b03d6418a03FC9d", reStakingToken: ADDRESSES.blast.ezETH, - oracle: "0x2BAF3A2B667A5027a83101d218A9e8B73577F117", //Renzo - oracleToken: "0x59e710215d45f584f44c0fee83da6d43d762d857", }; const ezETH1x = { vault: "0x9c96d0Cc5341654167ee35DB4F288ae523fe8779", reStakingToken: ADDRESSES.blast.ezETH, - oracle: "0x2BAF3A2B667A5027a83101d218A9e8B73577F117", //Renzo - oracleToken: "0x59e710215d45f584f44c0fee83da6d43d762d857", }; - const balOfezETH = await api.call({ - abi: contractAbis.balanceOf, - target: ezETH.reStakingToken, - params: [ezETH.vault], - }); - - const balOfezETH1x = await api.call({ - abi: contractAbis.balanceOf, - target: ezETH.reStakingToken, - params: [ezETH1x.vault], - }); - - const priceOfezETH = await api.call({ - target: ezETH.oracle, - abi: contractAbis.getUnderlyingPrice, - params: [ezETH.oracleToken], - }); - - const ezETHBalInETH = (balOfezETH * priceOfezETH) / 1e18; + [ezETH, ezETH1x].forEach(({ vault, reStakingToken }) => tokensAndOwners.push([reStakingToken, vault])); - const ezETH1xBalInETH = (balOfezETH1x * priceOfezETH) / 1e18; - - api.add(ADDRESSES.mode.WETH, ezETHBalInETH); - api.add(ADDRESSES.mode.WETH, ezETH1xBalInETH); + await api.sumTokens({ tokensAndOwners }); }, }, diff --git a/projects/ethena-pay/index.js b/projects/ethena-pay/index.js index 0b97fc4c8a9..85b780afc1b 100644 --- a/projects/ethena-pay/index.js +++ b/projects/ethena-pay/index.js @@ -37,11 +37,9 @@ async function tvl(api) { // today's share price too, on purpose: it stays in the vault's assets until it is redeemed. const block = await api.getBlock(); if (block < EARN_START_BLOCK) return; - const [balances, sharePrice] = await Promise.all([ - api.multiCall({ abi: 'erc20:balanceOf', target: PUSDE, calls: [...accounts, EARN_VAULT] }), - api.call({ abi: 'uint256:getSharePrice', target: EARN_VAULT }), - ]); - const shares = balances.reduce((sum, b) => sum + BigInt(b), 0n); + const balances = await api.multiCall({ abi: 'erc20:balanceOf', target: PUSDE, calls: [...accounts, EARN_VAULT], permitFailure: true }); + const sharePrice = await api.call({ abi: 'uint256:getSharePrice', target: EARN_VAULT }); + const shares = balances.reduce((sum, b) => sum + BigInt(b ?? 0), 0n); api.add(USDE, (shares * BigInt(sharePrice) / 10n ** 18n).toString()); } diff --git a/projects/giza/arma.js b/projects/giza/arma.js index 89d76dd3862..ceee6d064ee 100644 --- a/projects/giza/arma.js +++ b/projects/giza/arma.js @@ -56,10 +56,8 @@ const abi = { }; async function getMergedOwners(api, chainId) { - const [ownersOldRaw, ownersNewRaw] = await Promise.all([ - getConfig(`giza/arma/${api.chain}`, `https://api.arma.xyz/api/v1/${chainId}/smart-accounts`), - getConfig(`giza/arma/gizatech/${api.chain}`, `https://api.gizatech.xyz/api/v1/${chainId}/smart-accounts`), - ]); + const ownersOldRaw = await getConfig(`giza/arma/${api.chain}`, `https://api.arma.xyz/api/v1/${chainId}/smart-accounts`); + const ownersNewRaw = await getConfig(`giza/arma/gizatech/${api.chain}`, `https://api.gizatech.xyz/api/v1/${chainId}/smart-accounts`); const ownersOld = Array.isArray(ownersOldRaw) ? ownersOldRaw : []; const ownersNew = Array.isArray(ownersNewRaw) ? ownersNewRaw : []; diff --git a/projects/helper/chain/stellar.js b/projects/helper/chain/stellar.js index d024b7b9ea7..e3184624b1e 100644 --- a/projects/helper/chain/stellar.js +++ b/projects/helper/chain/stellar.js @@ -41,6 +41,14 @@ async function sumTokens(config) { for (const owner of owners) await sumTokens({ ...rest, owner, api, skiTransform: true }) return transformBalances(api.chain, api.getBalances()) + } else if (owner.startsWith('C')) { + // Soroban contract: it has no Horizon account, its holdings are balances in token contracts (pass them as `tokens`) + const tokens = config.tokens ?? [] + if (!tokens.length) console.log(`[stellar] ${owner} is a contract, pass the token contracts to read as tokens`) + for (const token of tokens) { + const balance = await stellar.callSoroban({ contractId: token, method: 'balance', args: [owner] }) + api.add(token, balance.toString()) + } } else { const balances = await stellar.getAccountBalances({ address: owner }) if (!balances.length) console.log(`[stellar] account ${owner} not found on-chain, skipping`) diff --git a/projects/helper/env.js b/projects/helper/env.js index b2dc196bc38..7d49192740e 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -77,7 +77,9 @@ const DEFAULTS = { // explorer.arc.io/api/eth-rpc answers every programmatic request with HTTP 403. ARC_ARCHIVAL_RPC: 'https://rpc.arc-scan.org,https://rpc.blockdaemon.mainnet.arc.io,https://rpc.nodeflare.app/arc/public', // public archive fallbacks; use <=100k-block log ranges // Arc is not in the SDK Multicall3 deployment map; canonical Multicall3 is deployed there. - ARC_MULTICALL_CHUNK_SIZE: '50', + // 300 calls per batch return the same results as 50 on drpc, rpc.mainnet.arc.io and blockdaemon (3000 x positions()), + // with 6x fewer requests: lift-v1, argus-world and the uniswap v3/v4 listings each sent 1000+ per run at 50. + ARC_MULTICALL_CHUNK_SIZE: '300', // Bitcoin Swap (482120): canonical Multicall3 is not deployed; this is the verified Multicall3 deployment on the chain. BTCWCHAIN_RPC: 'https://rpc.btcw.tech', BTCWCHAIN_RPC_CHAIN_ID: '482120', @@ -85,6 +87,10 @@ const DEFAULTS = { ZILLIQA_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', RLS_ARCHIVAL_RPC: 'https://mainnet-archive.rayls.com', CRONOS_RPC: 'https://evm.cronos.org,https://rpc.vvs.finance,https://cronos.drpc.org,https://cronos.rpc.sentio.xyz,https://evm-cronos.crypto.org', + // the SDK defaults cronos to 50 calls per batch; 300 works now (1500 x allPairs + getReserves, same results) and + // cuts requests 6x for the uni-v2 forks there (VVS, MM Finance: 1300-2800 requests per run). A batch that is + // too heavy is split by the SDK and retried, so this is never worse than 50. + CRONOS_MULTICALL_CHUNK_SIZE: '300', // chains with no provider in the SDK providers list (chainid.network RPCs) AREA_RPC: 'https://mainnet-rpc.areum.network,https://mainnet-rpc2.areum.network', // Areum Network, chainId 463 BCYPHER_RPC: 'https://mainapi.bchscan.io', // BC Hyper Chain, chainId 3030 diff --git a/projects/helper/sablier.js b/projects/helper/sablier.js new file mode 100644 index 00000000000..1cd90e07e50 --- /dev/null +++ b/projects/helper/sablier.js @@ -0,0 +1,51 @@ +const { request } = require('graphql-request') +const { sleep } = require('./utils') + +const ENVIO_ENDPOINT = 'https://indexer.hyperindex.xyz/53b7e25/v1/graphql' +const PAGE_SIZE = 1000 + +// The indexer allows 250 requests per minute, shared by everyone using it. Each adapter used to send one request per +// chain and per export (50+ per run) and kept running into 429s, so all chains are now read with the same few requests. +async function query(payload, variables) { + for (let attempt = 0; ; attempt++) { + try { + return await request(ENVIO_ENDPOINT, payload, variables) + } catch (e) { + if (e?.response?.status !== 429 || attempt >= 5) throw e + // the 429 response says how many seconds are left until the window resets + const reset = +e.response.headers?.get?.('x-ratelimit-reset') + await sleep((reset > 0 && reset <= 60 ? reset + 1 : 30) * 1000) + } + } +} + +async function queryAll(entity, where, fields) { + const payload = `query getAll($offset: Int!) { ${entity}(where: ${where}, order_by: { id: asc }, limit: ${PAGE_SIZE}, offset: $offset) { ${fields} } }` + const items = [] + for (let offset = 0; ; offset += PAGE_SIZE) { + const page = (await query(payload, { offset }))[entity] + items.push(...page) + if (page.length < PAGE_SIZE) break + } + return items +} + +async function fetchEnvioData(category) { + const contracts = await queryAll('Contract', `{ category: { _eq: "${category}" } }`, 'id address chainId') + const assets = await queryAll('Asset', `{ ${category}Streams_aggregate: { count: { predicate: { _gt: 0 } } } }`, 'id chainId symbol') + return { contracts, assets } +} + +const cache = {} + +// contracts and assets (with at least one stream) of a category ('lockup' | 'flow') on one chain +async function getEnvioChainData(category, chainId) { + if (!cache[category]) cache[category] = fetchEnvioData(category).catch(e => { delete cache[category]; throw e }) + const { contracts, assets } = await cache[category] + return { + contracts: contracts.filter(i => +i.chainId === chainId), + assets: assets.filter(i => +i.chainId === chainId), + } +} + +module.exports = { getEnvioChainData } diff --git a/projects/koo/index.js b/projects/koo/index.js index ce51ff43a96..d28678c441a 100644 --- a/projects/koo/index.js +++ b/projects/koo/index.js @@ -8,12 +8,14 @@ const USDC = ADDRESSES.arbitrum.USDC_CIRCLE const aArbUSDCn = '0x724dc807b04555b71ed48a6896b6f41593b8c637' const compoundUSDC = '0x9c4ec768c28520b50860ea7a15bd7213a9ff58bf' +// KFC (KryptoX Finance Coin), the protocol's own token, was added as a supported asset; it is not counted as TVL. +const KFC = '0x2e3ED33859efE1F05BB2952bD44D5146D8ef82D1' + async function tvl(api) { const supported = await api.call({ target: CORE, abi: 'address[]:getSupportedAssets' }) - if (supported.some(asset => asset.toLowerCase() !== USDC.toLowerCase())) - throw new Error('Koo collateral assets changed; update the custody/strategy mapping') + const tokens = supported.filter(asset => asset.toLowerCase() !== KFC.toLowerCase()) - return sumTokens2({ api, owner: CORE, tokens: [USDC, aArbUSDCn, compoundUSDC] }) + return sumTokens2({ api, owner: CORE, tokens: [...new Set([USDC, ...tokens, aArbUSDCn, compoundUSDC])] }) } module.exports = { diff --git a/projects/pendle-loop/index.js b/projects/pendle-loop/index.js index 629b3ca075d..3ca0bd6fd4c 100644 --- a/projects/pendle-loop/index.js +++ b/projects/pendle-loop/index.js @@ -17,6 +17,9 @@ const config = { const abi = { PositionIncreased: 'event PositionIncreased(address indexed owner, bytes32 indexed boxId, bytes32 requestHash, uint256 nonce, uint256 preInBalance, uint256 netPtToMM, uint256 postDebtBalance)', + moneyMarketView: 'function moneyMarketView(address spokeMMBeacon) view returns (address)', + computePositionBox: 'function computePositionBox(address owner, bytes32 boxId) view returns (address box, bytes32 salt, bool deployed)', + moneyMarketBalances: 'function moneyMarketBalances(address box) returns (uint256 mmPtBalance, uint256 mmDebtBalance)', boxData: 'function boxData(bytes32 boxId) view returns ((uint32 hubChainId, uint32 spokeChainId, address hubPt, address hubDebtToken, address spokePt, address spokeDebtToken, address spokeMMBeacon, bytes32 mmPayload))', getAll: 'function getAll(address owner, bytes32 boxId) returns ((uint256 mmPtBalance, uint256 mmDebtBalance, uint256 ltv, uint256 liquidationThreshold, uint256 borrowingLiquidity, uint256 lendingLiquidity, (address token, uint256 claimable)[] borrowingRewards, (address token, uint256 claimable)[] lendingRewards, (uint256 minBorrowing, uint256 maxBorrowing, uint256 minBorrowingForRewards, uint256 minLending, uint256 maxLending, uint256 minLendingForRewards) limits, uint256 borrowingRate, uint256 lendingRate, uint256 ptDebtRateWad))', } @@ -36,11 +39,29 @@ async function tvl(api) { }) const boxIds = [...new Set(positions.map(p => p.boxId))] - const boxes = await api.multiCall({ abi: abi.boxData, target: BOX_FACTORY, calls: boxIds }) + const boxes = await api.multiCall({ abi: abi.boxData, target: BOX_FACTORY, calls: boxIds, permitFailure: true }) const boxById = Object.fromEntries(boxIds.map((id, i) => [id, boxes[i]])) - const balances = await api.multiCall({ abi: abi.getAll, target: LOOPER_VIEW, calls: positions.map(p => ({ params: [p.owner, p.boxId] })) }) - balances.forEach((balance, i) => api.add(boxById[positions[i].boxId].spokePt, balance.mmPtBalance)) + const balances = await api.multiCall({ abi: abi.getAll, target: LOOPER_VIEW, calls: positions.map(p => ({ params: [p.owner, p.boxId] })), permitFailure: true }) + const failed = [] + balances.forEach((balance, i) => { + if (!boxById[positions[i].boxId]) return + if (balance) api.add(boxById[positions[i].boxId].spokePt, balance.mmPtBalance) + else failed.push(positions[i]) + }) + if (!failed.length) return + + // getAll also reads ltv/rates, so it reverts for a whole box when the money market's oracle does (eg. FeedDeviation). + // The collateral balance does not need the oracle: read it from the money market view of the box. + const beacons = [...new Set(failed.map(p => boxById[p.boxId].spokeMMBeacon))] + const mmViews = await api.multiCall({ abi: abi.moneyMarketView, target: LOOPER_VIEW, calls: beacons, permitFailure: true }) + const mmViewByBeacon = Object.fromEntries(beacons.map((beacon, i) => [beacon, mmViews[i]])) + const boxAddresses = await api.multiCall({ abi: abi.computePositionBox, target: BOX_FACTORY, calls: failed.map(p => ({ params: [p.owner, p.boxId] })), permitFailure: true }) + const retry = failed.map((p, i) => ({ ...p, box: boxAddresses[i]?.box, mmView: mmViewByBeacon[boxById[p.boxId].spokeMMBeacon] })).filter(p => p.box && p.mmView) + const mmBalances = await api.multiCall({ abi: abi.moneyMarketBalances, calls: retry.map(p => ({ target: p.mmView, params: [p.box] })), permitFailure: true }) + mmBalances.forEach((balance, i) => { + if (balance) api.add(boxById[retry[i].boxId].spokePt, balance.mmPtBalance) + }) } module.exports = { diff --git a/projects/predictstreet/index.js b/projects/predictstreet/index.js index a099bc036ae..737a886f57e 100644 --- a/projects/predictstreet/index.js +++ b/projects/predictstreet/index.js @@ -20,11 +20,10 @@ async function tvl(api) { const vaults = [...new Set(created.map(l => l.vault))] const marketLogs = await getLogs2({ api, target: NEG_RISK_ADAPTER, eventAbi: MARKET_PREPARED, fromBlock: NEG_RISK_FROM_BLOCK, extraKey: 'MarketPrepared' }) - const wcols = await api.multiCall({ abi: 'function wcolOf(bytes32) view returns (address)', calls: marketLogs.map(l => ({ target: NEG_RISK_ADAPTER, params: [l.marketId] })) }) + const wcols = await api.multiCall({ abi: 'function wcolOf(bytes32) view returns (address)', calls: marketLogs.map(l => ({ target: NEG_RISK_ADAPTER, params: [l.marketId] })), permitFailure: true }) const clones = wcols.filter(a => a && a !== ADDRESSES.null) const owners = [CONDITIONAL_TOKENS].concat(vaults, clones) - console.log(owners.len) // sum idle USDC.e in all vaults, ConditionalTokens, and neg-risk WrappedCollateral clones return sumTokens2({ api, owners, token: ADDRESSES.adi.USDC_e, sumChunkSize: 5000}) // await api.sumTokens({ owners, tokens: [ADDRESSES.adi.USDC_e] }) // USDC.e diff --git a/projects/rysk-premium/index.js b/projects/rysk-premium/index.js index b86551c1b76..4b27ea79d2f 100644 --- a/projects/rysk-premium/index.js +++ b/projects/rysk-premium/index.js @@ -15,8 +15,11 @@ const config = { async function tvl(api) { const { vaultRegistry, marginPools } = config[api.chain] - const vaults = await api.call({ abi: 'function getAllVaults() view returns (address[])', target: vaultRegistry }) - const collaterals = (await api.multiCall({ abi: 'function collateralAsset() view returns (address)', calls: vaults })).map(c => c.toLowerCase()) + const allVaults = await api.call({ abi: 'function getAllVaults() view returns (address[])', target: vaultRegistry }) + // some registered vaults are proxies without a working implementation and do not answer collateralAsset() + const allCollaterals = await api.multiCall({ abi: 'function collateralAsset() view returns (address)', calls: allVaults, permitFailure: true }) + const vaults = allVaults.filter((_, i) => allCollaterals[i]) + const collaterals = allCollaterals.filter(Boolean).map(c => c.toLowerCase()) const uniqueCollaterals = [...new Set(collaterals)] const vaultCalls = vaults.map((vault, i) => ({ target: collaterals[i], params: vault })) diff --git a/projects/sablier-flow/index.js b/projects/sablier-flow/index.js index 5381c727af1..9fc45fc3941 100644 --- a/projects/sablier-flow/index.js +++ b/projects/sablier-flow/index.js @@ -1,6 +1,7 @@ const { isWhitelistedToken } = require('../helper/streamingHelper') const { request } = require("graphql-request"); const sdk = require("@defillama/sdk"); +const { getEnvioChainData } = require('../helper/sablier') const ENVIO_ENDPOINT = 'https://indexer.hyperindex.xyz/53b7e25/v1/graphql'; @@ -46,12 +47,6 @@ const config = { ...SUBGRAPH_ENDPOINTS }; -const envioPayload = ` -query getChainData($chainId: numeric!) { - Contract(where: { _and: { chainId: { _eq: $chainId } , category: {_eq:"flow"}}}) { id address category } - Asset(where: { _and: { chainId: { _eq: $chainId }, flowStreams_aggregate: { count: { predicate: { _gt:0 }}}}}) { id chainId symbol } -} -` const subgraphPayload = ` { contracts { id address } @@ -66,12 +61,12 @@ async function getTokensConfig(api, isVesting) { const isSubgraph = !!SUBGRAPH_ENDPOINTS[api.chain]; const result = isSubgraph ? await request(sdk.graph.modifyEndpoint(endpoint), subgraphPayload) - : await request(ENVIO_ENDPOINT, envioPayload, { chainId: CHAIN_IDS_ENVIO[api.chain] }); + : await getEnvioChainData('flow', CHAIN_IDS_ENVIO[api.chain]); - if (!result || (!isSubgraph && !CHAIN_IDS_ENVIO[api.chain])) return { ownerTokens: [] }; + if (!result) return { ownerTokens: [] }; - const contracts = result.contracts || result.Contract || []; - const assets = result.assets || result.Asset || []; + const contracts = result.contracts || []; + const assets = result.assets || []; const owners = contracts.map(i => i.address); diff --git a/projects/sablier-lockup/index.js b/projects/sablier-lockup/index.js index b1d54d7f231..06aec227e53 100644 --- a/projects/sablier-lockup/index.js +++ b/projects/sablier-lockup/index.js @@ -1,7 +1,7 @@ const { isWhitelistedToken } = require('../helper/streamingHelper') const { request } = require("graphql-request"); const sdk = require("@defillama/sdk"); -const { sumTokens2 } = require('../helper/solana'); +const { getEnvioChainData } = require('../helper/sablier') const ENVIO_ENDPOINT = 'https://indexer.hyperindex.xyz/53b7e25/v1/graphql'; @@ -47,13 +47,6 @@ const config = { ...SUBGRAPH_ENDPOINTS }; -const envioPayload = ` -query getChainData($chainId: numeric!) { - Contract(where: { _and: { chainId: { _eq: $chainId } , category: {_eq:"lockup"}}}) { id address category } - Asset(where: { _and: { chainId: { _eq: $chainId }, lockupStreams_aggregate: { count: { predicate: { _gt:0 }}}}}) { id chainId symbol } -} -` - const subgraphPayload = ` { contracts { id address category } @@ -68,12 +61,12 @@ async function getTokensConfig(api, isVesting) { const isSubgraph = !!SUBGRAPH_ENDPOINTS[api.chain]; const result = isSubgraph ? await request(sdk.graph.modifyEndpoint(endpoint), subgraphPayload) - : await request(ENVIO_ENDPOINT, envioPayload, { chainId: CHAIN_IDS_ENVIO[api.chain] }); + : await getEnvioChainData('lockup', CHAIN_IDS_ENVIO[api.chain]); - if (!result || (!isSubgraph && !CHAIN_IDS_ENVIO[api.chain])) return { ownerTokens: [] }; + if (!result) return { ownerTokens: [] }; - const contracts = result.contracts || result.Contract || []; - const assets = result.assets || result.Asset || []; + const contracts = result.contracts || []; + const assets = result.assets || []; const owners = contracts.map(i => i.address); diff --git a/registries/compound.js b/registries/compound.js index f02ae9632bc..12fee3a99bf 100644 --- a/registries/compound.js +++ b/registries/compound.js @@ -540,7 +540,11 @@ const configs = { // comptroller reverts on getAllMarkets since mid-2026; market list read at merlin block 28744793 markets: ['0xE3b51F15dc086fbA15426B8D42b4CD6FeB46968e', '0x8b180546d38F437273D1B71c4b9cA6Fc44E16425', '0x4409BF9EC77c8c6607Fe00E373df3B99d529A976', '0xF60e9c878FAb7555D30e0AE52Fe5e2870CaF2f23', '0xc3190A4e6A989b84F8a20c84C9ddD7eF5b1D4540', '0xba36B01387eF05C2E77f133366A891721012e338'], }, - { comptroller: '0xe7464Caa3fD31A1A8B458a634e72F94A00695d17' }, + { + comptroller: '0xe7464Caa3fD31A1A8B458a634e72F94A00695d17', + // this comptroller reverts on getAllMarkets too; market list read at merlin block 28744793 + markets: ['0x119ba862B59427a05d2a7157F4b8142CeE2f7Db3', '0xa35FAFDA03705Cf918db97fcB615dEb30E8DCb53', '0x59D62c0Be90210b13AB9B393d4Bf22bA55E4f745', '0xfC9060207617df24d0D42857f2161b24e3cF1639', '0xeAF03Ac94db4AE00a91df86EcB5f3c9dbb9FE433', '0xcb953b765b74f9476ca9Ebc10f3ba8e2EaeCe3f8'], + }, ], }, 'keom': { diff --git a/registries/treasury.js b/registries/treasury.js index 69672e85454..932731cd3be 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -3225,7 +3225,9 @@ const configs = { }, 'treasury/k2-lend': { stellar: { + // the treasury is a Soroban contract, it holds the reserve tokens (PYUSD, SolvBTC, USDC, XLM token contracts) owners: ['CCQ4J5VLQHM2ORP4K7GBVAJJPK5SGG23DH4RD7QEHAZDHTN7JNESNXKZ'], + tokens: ['CCCRWH6Q3FNP3I2I57BDLM5AFAT7O6OF6GKQOC6SSJNDAVRZ57SPHGU2', 'CBIJBDNZNF4X35BJ4FFZWCDBSCKOP5NB4PLG4SNENRMLAPYG4P5FM6VN', 'CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75', 'CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA'], }, }, 'treasury/k9finance': { From 65d803b8102c6e9ba1137af098ad5a2c5bfc2ada Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 24 Nov 2026 09:01:20 +0100 Subject: [PATCH 892/988] optimize --- projects/arcadia-finance-v2/index.js | 99 ++++++++++++------ projects/cian-automation/index.js | 11 +- projects/deeplock/index.js | 73 ++++++++++++- projects/ethena-pay/index.js | 24 +++-- projects/giza/arma.js | 149 +++------------------------ projects/giza/index.js | 16 +-- projects/hedgey/index.js | 63 ++++++----- projects/helper/cache/lowValue.js | 138 ++++++++++++++++++++++++- projects/helper/unwrapLPs.js | 4 +- projects/lift-v1/index.js | 15 +-- projects/noxa-fun/index.js | 8 +- projects/predictstreet/index.js | 10 +- projects/rosswap/index.js | 2 +- projects/thedeep/index.js | 37 +++---- 14 files changed, 397 insertions(+), 252 deletions(-) diff --git a/projects/arcadia-finance-v2/index.js b/projects/arcadia-finance-v2/index.js index a9521e4504d..8ce99486739 100644 --- a/projects/arcadia-finance-v2/index.js +++ b/projects/arcadia-finance-v2/index.js @@ -1,5 +1,6 @@ const { sumTokens2, unwrapSlipstreamNFT } = require("../helper/unwrapLPs"); const utils = require('../helper/utils') +const { getCache, setCache } = require('../helper/cache') const config = { base: { @@ -230,6 +231,33 @@ async function fetchAssetData(accountGroup, chainId) { throw lastError; } +const CACHE_PROJECT = 'arcadia-finance-v2' +const EMPTY_RECHECK_SECONDS = 24 * 3600 +const FRESH_ACCOUNTS = 500 + +/** + * Every account the factory created. The factory's list only grows, so it is stored and only the + * accounts past the stored length are read. + * @param {object} api DefiLlama ChainApi + * @param {string} factory Arcadia factory + * @param {boolean} isCurrentRun false for a run at a past timestamp, which reads the whole list + * @returns {Promise} account addresses, oldest first + */ +async function getAccounts(api, factory, isCurrentRun) { + const count = +(await api.call({ target: factory, abi: 'uint256:allAccountsLength' })) + let { accounts = [] } = isCurrentRun ? await getCache(CACHE_PROJECT, `accounts/${api.chain}`) : {} + if (accounts.length > count) accounts = [] + if (accounts.length === count) return accounts + + const calls = Array.from({ length: count - accounts.length }, (_, i) => accounts.length + i) + const more = await api.multiCall({ target: factory, abi: 'function allAccounts(uint256) view returns (address)', calls, permitFailure: true }) + const complete = more.every(Boolean) + accounts = accounts.concat(more.filter(Boolean)) + // a list with a failed read in it is used for this run only + if (isCurrentRun && complete) await setCache(CACHE_PROJECT, `accounts/${api.chain}`, { accounts }) + return accounts +} + /** * Sums the value of every Arcadia account plus the protocol's own pools on one chain. * @param {object} api DefiLlama ChainApi @@ -248,57 +276,60 @@ async function tvl (api) { await api.sumTokens({ blacklistedTokens: allNfts, tokensAndOwners2: [uTokens, pools] }); } - const accounts = await api.fetchList({ lengthAbi: 'allAccountsLength', itemAbi: 'allAccounts', target: factory, }) + const now = Math.floor(Date.now() / 1000) + // what is stored below describes the present, so a run at a past timestamp reads everything and stores nothing + const isCurrentRun = !api.timestamp || api.timestamp > now - 3600 + const accounts = await getAccounts(api, factory, isCurrentRun) // Account version 1 has a stored state of all assets, and can be fetched using generateAssetData() // Account version 2 has no such stored state, and must be fetched with external api calls. - const versions = await api.multiCall({abi: 'function ACCOUNT_VERSION() view returns (uint256)', calls: accounts,}); + const versions = await api.multiCall({abi: 'function ACCOUNT_VERSION() view returns (uint256)', calls: accounts, permitFailure: true }); const v1Accounts = accounts.filter((_, i) => versions[i] === '1' || versions[i] === '3'); const v2Accounts = accounts.filter((_, i) => versions[i] === '2' || versions[i] === '4'); // This endpoint uses the following logic: - // 1. Uses batches of all v2Accounts (to prevent rate limiting) + // 1. Uses groups of v2Accounts, one request after another (to prevent rate limiting) // 2. calls Arcadia's endpoint to fetch the asset data of a V2 account // 3. verifies onchain that the ownership of the NFTs is indeed correct // 4. Return format is then transformed to be identical to the format of the V1 assetData - + // + // Most v2 accounts are empty, and asking the api about every one of them took 600+ requests per run. An account the + // api reported empty is asked about again a day later (the first time after a random part of a day, so the re-checks + // spread across runs); the newest accounts are always asked about. An old empty account that is funded again can + // therefore be missing for up to a day. const addressesPerRequest = 5; - const parallelRequests = 25; - const accountsPerBatch = addressesPerRequest * parallelRequests; + const emptyCacheKey = `empty-v2-accounts/${api.chain}` + const { seenEmpty = {} } = isCurrentRun ? await getCache(CACHE_PROJECT, emptyCacheKey) : {} + const firstFresh = v2Accounts.length - FRESH_ACCOUNTS + const v2ToFetch = v2Accounts.filter((account, i) => i >= firstFresh || !seenEmpty[account] || now - seenEmpty[account] >= EMPTY_RECHECK_SECONDS) - for (let i = 0; i < v2Accounts.length; i += accountsPerBatch) { - const batchAccounts = v2Accounts.slice(i, i + accountsPerBatch); + for (let i = 0; i < v2ToFetch.length; i += addressesPerRequest) { + const accountGroup = v2ToFetch.slice(i, i + addressesPerRequest); + const assetDataCall = await fetchAssetData(accountGroup, chainId); - // Create sub-batches of 5 addresses each - const requestBatches = []; - for (let j = 0; j < batchAccounts.length; j += addressesPerRequest) { - requestBatches.push(batchAccounts.slice(j, j + addressesPerRequest)); - } - - await Promise.all(requestBatches.map(async (accountGroup) => { - const assetDataCall = await fetchAssetData(accountGroup, chainId); - - // Process each account's data from the batched response - assetDataCall.data.forEach((assetData, index) => { - const account = accountGroup[index]; - if (!assetData || !assetData[0][0] || assetData[0][0].length < 1) return; + // Process each account's data from the batched response + assetDataCall.data.forEach((assetData, index) => { + const account = accountGroup[index]; + if (!assetData || !assetData[0][0] || assetData[0][0].length < 1) { + seenEmpty[account] = seenEmpty[account] ? now : now - Math.floor(Math.random() * EMPTY_RECHECK_SECONDS) + return; + } + delete seenEmpty[account] - ownerTokens.push([assetData[0][0], account]) - if (!assetData[0][0].length || !assetData[0][1].length || assetData[0][1] == "0") return; - ownerIds.push([assetData[0][0], assetData[0][1], account]) - accs.push(account) + ownerTokens.push([assetData[0][0], account]) + if (!assetData[0][0].length || !assetData[0][1].length || assetData[0][1] == "0") return; + ownerIds.push([assetData[0][0], assetData[0][1], account]) + accs.push(account) - for (let i = 0; i < assetData[0][0].length; i++) { - if (assetData[0][0][i] === uniV4NFT) { - uniV4Ids.push(assetData[0][1][i]); - } + for (let i = 0; i < assetData[0][0].length; i++) { + if (assetData[0][0][i] === uniV4NFT) { + uniV4Ids.push(assetData[0][1][i]); } - }); - })); - - api.log(`[arcadia] Processed batch ${Math.ceil((i + accountsPerBatch) / accountsPerBatch)} of ${Math.ceil(v2Accounts.length / accountsPerBatch)} for v2 accounts.`); - + } + }); } + api.log(`[arcadia] asked the api about ${v2ToFetch.length} of ${v2Accounts.length} v2 accounts`); + if (isCurrentRun) await setCache(CACHE_PROJECT, emptyCacheKey, { seenEmpty }) const assetDatasV1 = await api.multiCall({ abi: abi.generateAssetData, calls: v1Accounts, permitFailure: true }) v1Accounts.forEach((account, i) => { diff --git a/projects/cian-automation/index.js b/projects/cian-automation/index.js index 5c8d40498cf..9e0d841ff4f 100644 --- a/projects/cian-automation/index.js +++ b/projects/cian-automation/index.js @@ -4,6 +4,7 @@ module.exports = { const { getLogs } = require('../helper/cache/getLogs') const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensLowValue } = require('../helper/cache/lowValue') const config = { ethereum: { @@ -53,13 +54,13 @@ Object.keys(config).forEach(chain => { } api.log(chain, owners.length, tokens.length) if (chain === 'avax') { - const avaxDebt = await api.multiCall({ abi: 'function borrowBalanceStored(address) view returns (uint256)', calls: owners, target: '0x5C0401e81Bc07Ca70fAD469b451682c0d747Ef1c' }) - const avaxDebtSum = avaxDebt.reduce((acc, borrow) => acc + +borrow, 0) + const avaxDebt = await api.multiCall({ abi: 'function borrowBalanceStored(address) view returns (uint256)', calls: owners, target: '0x5C0401e81Bc07Ca70fAD469b451682c0d747Ef1c', permitFailure: true }) + const avaxDebtSum = avaxDebt.reduce((acc, borrow) => acc + +(borrow ?? 0), 0) api.addGasToken(avaxDebtSum * -1) } - for (const token of tokens) { - await api.sumTokens({ owners, tokens: [token], }) - } + // every account is checked against every token while most accounts hold next to nothing: an account worth + // under $100 is stored with its balances, counted from the store, and read again once a week + await sumTokensLowValue({ api, project: 'cian-automation', owners, tokens }) return api.getBalances() } } diff --git a/projects/deeplock/index.js b/projects/deeplock/index.js index 536a7709cf5..98132bd343b 100644 --- a/projects/deeplock/index.js +++ b/projects/deeplock/index.js @@ -1,9 +1,14 @@ const { pool2s } = require("../helper/pool2"); -const { getUniqueAddresses } = require('../helper/utils') +const sdk = require('@defillama/sdk') +const { getUniqueAddresses, sliceIntoChunks } = require('../helper/utils') const { getCache, setCache, } = require("../helper/cache") const { vestingHelper, } = require("../helper/unknownTokens") +const { getLPList } = require('../helper/cache/sumUnknownTokens') +const { getLowValueCache } = require('../helper/cache/lowValue') +const { getCoreAssets } = require('../helper/tokenMapping') const abi = { + getReserves: "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", depositId: "uint256:depositId", lockedToken: "function lockedToken(uint256) view returns (address tokenAddress, address withdrawalAddress, uint256 tokenAmount, uint256 unlockTime, bool withdrawn)", } @@ -54,6 +59,64 @@ const blacklist = [ '0xf0ee026f572c4a229dc67a692244e90abac29ec2', ].map(i => i.toLowerCase()) +const LPS_PER_GROUP = 5000 + +// The lockers hold 50k+ LP tokens and almost all of them are worth next to nothing, yet each one cost a balance, a +// total supply and a reserves read on every run. For an LP paired with a core asset the vesting helper counts exactly +// (locker balance / total supply) of the pool's core side, twice, so that is what is stored for such an LP when it is +// worth under $100: it is then counted from the store and read again once a week. Every other LP (worth more, paired +// with no core asset, or with a failed read) still goes through the vesting helper on every run. +async function addLockedLPs(api, cache, vault, tokens) { + const coreAssets = new Set(getCoreAssets(api.chain)) + tokens = getUniqueAddresses(tokens).filter(token => !blacklist.includes(token)) + // the helper counts only LP tokens (judged by symbol, stored in `cache`), so the same list is used here + const lps = await getLPList({ lps: tokens, chain: api.chain, block: api.block, cache }) + const lowValue = await getLowValueCache({ api, project: 'deeplock', key: `${api.chain}-${vault.toLowerCase()}`, checkpointEvery: LPS_PER_GROUP }) + const prices = await sdk.coins.getPrices([...coreAssets].map(token => `${api.chain}:${token}`), 'now') + if (!cache.pairData) cache.pairData = {} + const rest = [] + + for (const group of sliceIntoChunks(lowValue.filter(lps), LPS_PER_GROUP)) { + const unknown = group.filter(lp => !cache.pairData[lp]?.token0Address || !cache.pairData[lp]?.token1Address) + const token0s = await api.multiCall({ abi: 'address:token0', calls: unknown, permitFailure: true }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: unknown, permitFailure: true }) + unknown.forEach((lp, i) => { + if (token0s[i] && token1s[i]) cache.pairData[lp] = { token0Address: token0s[i].toLowerCase(), token1Address: token1s[i].toLowerCase() } + }) + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls: group.map(lp => ({ target: lp, params: vault })), permitFailure: true }) + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: group, permitFailure: true }) + const reserves = await api.multiCall({ abi: abi.getReserves, calls: group, permitFailure: true }) + + const results = [] + group.forEach((lp, i) => { + const pair = cache.pairData[lp] + if (balances[i] == null || supplies[i] == null || !reserves[i] || !pair?.token0Address) return rest.push(lp) + if (+balances[i] === 0) return results.push([lp, {}]) // withdrawn + const isCore0 = coreAssets.has(pair.token0Address) + const isCore1 = coreAssets.has(pair.token1Address) + if (!isCore0 && !isCore1) return rest.push(lp) + const ratio = Math.min(1, +supplies[i] > 0 ? +balances[i] / +supplies[i] : 0) + const multiplier = isCore0 && isCore1 ? 1 : 2 + const held = {} + let usdValue = 0 + const add = (token, reserve) => { + const amount = reserve * multiplier * ratio + const price = prices[`${api.chain}:${token}`] + usdValue += price?.price === undefined ? Infinity : amount / 10 ** (price.decimals ?? 0) * price.price + held[token] = BigInt(Math.floor(amount)).toString() + } + if (isCore0) add(pair.token0Address, +reserves[i]._reserve0) + if (isCore1) add(pair.token1Address, +reserves[i]._reserve1) + if (usdValue < 90) results.push([lp, held]) // a margin under the $100 the store keeps, so its own check agrees + else rest.push(lp) + }) + await lowValue.record(results) + } + await lowValue.save() + + if (rest.length) await vestingHelper({ api, cache, useDefaultCoreAssets: true, blacklist, owner: vault, tokens: rest, }) +} + async function tvl(api) { const cache = (await getCache(project, api.chain)) || {} if (!cache.vaults) cache.vaults = {} @@ -70,10 +133,12 @@ async function tvl(api) { for (let id = cCache.lastTotalId; id <= length; id++) calls.push({ target: vault, params: id }) cCache.lastTotalId = length + 1 - const locks = await api.multiCall({ abi: abi.lockedToken, calls }) - cCache.tokens = getUniqueAddresses([...cCache.tokens, ...locks.map(i => i.tokenAddress)]) + const locks = await api.multiCall({ abi: abi.lockedToken, calls, permitFailure: true }) + // a failed read is tried again next run: the ids are only marked as seen when all of them were read + if (locks.some(lock => !lock)) cCache.lastTotalId -= calls.length + cCache.tokens = getUniqueAddresses([...cCache.tokens, ...locks.filter(Boolean).map(i => i.tokenAddress)]) - await vestingHelper({ api, cache, useDefaultCoreAssets: true, blacklist, owner: vault, tokens: cCache.tokens, }) + await addLockedLPs(api, cache, vault, cCache.tokens) } await setCache(project, api.chain, cache) diff --git a/projects/ethena-pay/index.js b/projects/ethena-pay/index.js index 85b780afc1b..87e4479cf61 100644 --- a/projects/ethena-pay/index.js +++ b/projects/ethena-pay/index.js @@ -1,5 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json'); const { getAddress, getLogs2 } = require('../helper/cache/getLogs'); +const { sumTokensLowValue } = require('../helper/cache/lowValue'); // Ethena Pay (https://pay.ethena.fi) gives each card user an account on Avalanche C-Chain: a beacon proxy // (beacon 0xc831ea25deb7654679a438c78c4c5d1c313c8448, owned by the registry). The registry creates them; both of its @@ -31,16 +32,27 @@ async function getAccounts(api) { async function tvl(api) { const accounts = await getAccounts(api); // what the accounts hold: USDe for card spending, plus AVAX (cashback), USDC and USDT - await api.sumTokens({ owners: accounts, tokens: [USDE, ADDRESSES.null, ADDRESSES.avax.USDC, ADDRESSES.avax.USDt] }); + const tokens = [USDE, ADDRESSES.null, ADDRESSES.avax.USDC, ADDRESSES.avax.USDt]; // pUSDe held by the accounts or queued in the vault, valued in USDe at the vault's share price: together that is the // whole Earn vault. The vault's own USDe is part of what backs pUSDe, so it is not added again. Queued pUSDe is valued at // today's share price too, on purpose: it stays in the vault's assets until it is redeemed. const block = await api.getBlock(); - if (block < EARN_START_BLOCK) return; - const balances = await api.multiCall({ abi: 'erc20:balanceOf', target: PUSDE, calls: [...accounts, EARN_VAULT], permitFailure: true }); - const sharePrice = await api.call({ abi: 'uint256:getSharePrice', target: EARN_VAULT }); - const shares = balances.reduce((sum, b) => sum + BigInt(b ?? 0), 0n); - api.add(USDE, (shares * BigInt(sharePrice) / 10n ** 18n).toString()); + const earnLive = block >= EARN_START_BLOCK; + let sharePrice = 0n; + if (earnLive) { + tokens.push(PUSDE); + sharePrice = BigInt(await api.call({ abi: 'uint256:getSharePrice', target: EARN_VAULT })); + const queued = await api.call({ abi: 'erc20:balanceOf', target: PUSDE, params: EARN_VAULT }); + api.add(USDE, (BigInt(queued) * sharePrice / 10n ** 18n).toString()); + } + const usde = USDE.toLowerCase(); + const toUSDe = ({ [PUSDE]: shares, ...balances }) => { + if (shares !== undefined) balances[usde] = (BigInt(balances[usde] ?? 0) + BigInt(shares) * sharePrice / 10n ** 18n).toString(); + return balances; + }; + // There are tens of thousands of accounts and most hold next to nothing: an account worth under $100 is stored with + // its balances, counted from the store, and read again once a week. + await sumTokensLowValue({ api, project: 'ethena-pay', owners: accounts, tokens, transform: toUSDe, freshCount: 2000 }); } module.exports = { diff --git a/projects/giza/arma.js b/projects/giza/arma.js index ceee6d064ee..abe91cab099 100644 --- a/projects/giza/arma.js +++ b/projects/giza/arma.js @@ -1,5 +1,6 @@ const { getConfig } = require('../helper/cache'); const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensLowValue } = require('../helper/cache/lowValue'); // Base chain protocol addresses const BASE_PROTOCOLS = { @@ -70,142 +71,26 @@ async function getMergedOwners(api, chainId) { return [...new Set(owners)]; } -async function baseTvl(api) { - // For Base chain - const owners = await getMergedOwners(api, 8453); +// Every smart account is checked against every protocol token while most accounts hold next to nothing (tens of +// thousands of accounts on Base). An account worth under $100 is stored with its balances, counted from the store, and +// read again once a week. +function armaTvl({ chainId, dataProvider, asset, tokens }) { + return async (api) => { + const owners = await getMergedOwners(api, chainId); - api.log(`[Arma] Found ${owners.length} smart accounts on Base`); + api.log(`[Arma] Found ${owners.length} smart accounts on ${api.chain}`); - // Get aUSDC token from Aave Pool Data Provider - const USDC = ADDRESSES.base.USDC; - const aaveReserveData = await api.call({ - target: BASE_PROTOCOLS.aavePoolDataProvider, - abi: abi.getReserveTokensAddresses, - params: [USDC] - }); + // aToken of the asset, from the Aave V3 (Hyperlend on HyperEVM) Pool Data Provider + const reserveData = await api.call({ target: dataProvider, abi: abi.getReserveTokensAddresses, params: [asset] }); - const allTokens = [ - ...BASE_PROTOCOLS.tokens, - aaveReserveData.aTokenAddress // Add the actual aUSDC token - ]; - - // Build tokensAndOwners array for each token-owner combination - const tokensAndOwners = []; - allTokens.forEach(token => { - owners.forEach(owner => { - tokensAndOwners.push([token, owner]); - }); - }); - - return api.sumTokens({ - tokensAndOwners, - permitFailure: true - }); -} - -async function plasmaTvl(api) { - // For Plasma chain - const owners = await getMergedOwners(api, 9745); - - api.log(`[Arma] Found ${owners.length} smart accounts on Plasma`); - - // Get aUSDT0 token from Aave Pool Data Provider - const USDT0 = ADDRESSES.plasma.USDT0; - const aaveReserveData = await api.call({ - target: PLASMA_PROTOCOLS.aavePoolDataProvider, - abi: abi.getReserveTokensAddresses, - params: [USDT0] - }); - - const allTokens = [ - ...PLASMA_PROTOCOLS.tokens, - aaveReserveData.aTokenAddress // Add the actual aUSDT0 token - ]; - - // Build tokensAndOwners array for each token-owner combination - const tokensAndOwners = []; - allTokens.forEach(token => { - owners.forEach(owner => { - tokensAndOwners.push([token, owner]); - }); - }); - - return api.sumTokens({ - tokensAndOwners, - permitFailure: true - }); -} - -async function arbitrumTvl(api) { - // For Arbitrum chain - const owners = await getMergedOwners(api, 42161); - - api.log(`[Arma] Found ${owners.length} smart accounts on Arbitrum`); - - // Get aUSDC token from Aave Pool Data Provider - const USDC = ADDRESSES.arbitrum.USDC_CIRCLE; - const aaveReserveData = await api.call({ - target: ARBITRUM_PROTOCOLS.aavePoolDataProvider, - abi: abi.getReserveTokensAddresses, - params: [USDC] - }); - - const allTokens = [ - ...ARBITRUM_PROTOCOLS.tokens, - aaveReserveData.aTokenAddress // Add the actual aUSDC token - ]; - - // Build tokensAndOwners array for each token-owner combination - const tokensAndOwners = []; - allTokens.forEach(token => { - owners.forEach(owner => { - tokensAndOwners.push([token, owner]); - }); - }); - - return api.sumTokens({ - tokensAndOwners, - permitFailure: true - }); -} - -async function hyperevmTvl(api) { - // For HyperEVM chain - const owners = await getMergedOwners(api, 999); - - api.log(`[Arma] Found ${owners.length} smart accounts on HyperEVM`); - - // Get aUSDT0 token from Hyperlend Pool Data Provider - const USDT0 = ADDRESSES.hyperliquid.USDT0; - const aaveReserveData = await api.call({ - target: HYPEREVM_PROTOCOLS.hyperlendPoolDataProvider, - abi: abi.getReserveTokensAddresses, - params: [USDT0] - }); - - const allTokens = [ - ...HYPEREVM_PROTOCOLS.tokens, - aaveReserveData.aTokenAddress // Add the actual aUSDT0 token - ]; - - // Build tokensAndOwners array for each token-owner combination - const tokensAndOwners = []; - allTokens.forEach(token => { - owners.forEach(owner => { - tokensAndOwners.push([token, owner]); - }); - }); - - return api.sumTokens({ - tokensAndOwners, - permitFailure: true - }); + await sumTokensLowValue({ api, project: 'giza', key: `arma-${api.chain}`, owners, tokens: [...tokens, reserveData.aTokenAddress] }); + return api.getBalances(); + }; } - module.exports = { - base: { tvl: baseTvl }, - plasma: { tvl: plasmaTvl }, - arbitrum: { tvl: arbitrumTvl }, - hyperliquid: { tvl: hyperevmTvl } + base: { tvl: armaTvl({ chainId: 8453, dataProvider: BASE_PROTOCOLS.aavePoolDataProvider, asset: ADDRESSES.base.USDC, tokens: BASE_PROTOCOLS.tokens }) }, + plasma: { tvl: armaTvl({ chainId: 9745, dataProvider: PLASMA_PROTOCOLS.aavePoolDataProvider, asset: ADDRESSES.plasma.USDT0, tokens: PLASMA_PROTOCOLS.tokens }) }, + arbitrum: { tvl: armaTvl({ chainId: 42161, dataProvider: ARBITRUM_PROTOCOLS.aavePoolDataProvider, asset: ADDRESSES.arbitrum.USDC_CIRCLE, tokens: ARBITRUM_PROTOCOLS.tokens }) }, + hyperliquid: { tvl: armaTvl({ chainId: 999, dataProvider: HYPEREVM_PROTOCOLS.hyperlendPoolDataProvider, asset: ADDRESSES.hyperliquid.USDT0, tokens: HYPEREVM_PROTOCOLS.tokens }) }, }; diff --git a/projects/giza/index.js b/projects/giza/index.js index 84c3ff0b3c6..f1f9bac3ddd 100644 --- a/projects/giza/index.js +++ b/projects/giza/index.js @@ -1,5 +1,6 @@ const arma = require('./arma'); const { getConfig } = require('../helper/cache'); +const { sumTokensLowValue } = require('../helper/cache/lowValue'); // Arbitrum Pendle PT token addresses (all ETH PT tokens) const ARBITRUM_PT_TOKENS = [ @@ -16,18 +17,9 @@ async function arbitrumTvl(api) { api.log(`[Pulse] Found ${owners.length} smart accounts on Arbitrum`); - // Build tokensAndOwners array for each PT token-owner combination - const tokensAndOwners = []; - ARBITRUM_PT_TOKENS.forEach(token => { - owners.forEach(owner => { - tokensAndOwners.push([token, owner]); - }); - }); - - return api.sumTokens({ - tokensAndOwners, - permitFailure: true - }); + // accounts worth under $100 are stored with their balances and read again once a week (see arma.js) + await sumTokensLowValue({ api, project: 'giza', key: 'pulse-arbitrum', owners, tokens: ARBITRUM_PT_TOKENS }); + return api.getBalances(); } const pulse = { arbitrum: { tvl: arbitrumTvl } diff --git a/projects/hedgey/index.js b/projects/hedgey/index.js index 287a5346452..c785ed23f05 100644 --- a/projects/hedgey/index.js +++ b/projects/hedgey/index.js @@ -1,4 +1,6 @@ const { isWhitelistedToken } = require('../helper/streamingHelper') +const { getCache, setCache } = require('../helper/cache') +const { nullAddress } = require('../helper/tokenMapping') const BASE_CONFIG = { tokenVesting: "0x2CDE9919e81b20B4B33DD562a48a84b54C48F00C", @@ -44,37 +46,52 @@ const abis = { }; const cacheData = {}; +const WEEK = 7 * 24 * 3600 +const TAIL = 500 -const fetchVestingData = async (api) => { - const config = CONFIG[api.chain]; - if (!config) return; +// tvl and vesting of a chain run at the same time and need the same data: both wait for one fetch +const fetchVestingData = (api) => { + if (!cacheData[api.chain]) cacheData[api.chain] = _fetchVestingData(api).catch(e => { delete cacheData[api.chain]; throw e }) + return cacheData[api.chain] +} + +// The plans are only read to learn which tokens the contracts hold: tens of thousands of plans for a few dozen tokens. +// The token list is stored. Once a week every plan is read again, and in between only the last TAIL plans of each +// contract are (new plans are appended at the end of the list), so the token of a new plan is found right away. +// A run at a past timestamp reads every plan and stores nothing. +const _fetchVestingData = async (api) => { + const targets = Object.values(CONFIG[api.chain]); + const now = Math.floor(Date.now() / 1000) + const isCurrentRun = !api.timestamp || api.timestamp > now - 3600 + const cache = isCurrentRun ? await getCache('hedgey', api.chain) : {} + const fullScan = !cache.lastFullScan || now - cache.lastFullScan > WEEK - const targets = Object.values(config); + const supplies = await api.multiCall({ abi: abis.totalSupply, calls: targets, permitFailure: true }) + const indexCalls = [] + targets.forEach((target, i) => { + const supply = +(supplies[i] ?? 0) + for (let j = fullScan ? 0 : Math.max(0, supply - TAIL); j < supply; j++) indexCalls.push({ target, params: j }) + }) + const planIds = await api.multiCall({ abi: abis.tokenByIndex, calls: indexCalls, permitFailure: true }) + const planCalls = indexCalls.map(({ target }, i) => ({ target, params: planIds[i] })).filter(call => call.params != null) + const plans = await api.multiCall({ abi: abis.plans, calls: planCalls, permitFailure: true }) - // Single fetchList across all contracts: tokenByIndex -> plans(tokenId).token - const plans = await api.fetchList({ - targets, - lengthAbi: abis.totalSupply, - itemAbi: abis.tokenByIndex, - itemAbi2: abis.plans, - field2: 'token', - permitFailure: true, - }); + const found = plans.filter(plan => plan && plan.token !== nullAddress).map(plan => plan.token.toLowerCase()) + const rawTokens = [...new Set([...(cache.tokens ?? []), ...found])] + if (isCurrentRun && (fullScan || rawTokens.length !== (cache.tokens ?? []).length)) + await setCache('hedgey', api.chain, { lastFullScan: fullScan ? now : cache.lastFullScan, tokens: rawTokens }) - const rawTokens = [...new Set(plans.filter(Boolean).map(t => t.toLowerCase()))] const symbols = await api.multiCall({ calls: rawTokens, abi: 'erc20:symbol', permitFailure: true }) const tokens = rawTokens.map((token, index) => { if (!symbols[index]) return null; return { token, symbol: symbols[index] } }).filter(Boolean) - cacheData[api.chain] = { owners: targets, tokens } - return cacheData[api.chain] + return { owners: targets, tokens } }; const computeBalances = async (api, isVesting) => { - if (!cacheData[api.chain]) return; - const { owners, tokens } = cacheData[api.chain] + const { owners, tokens } = await fetchVestingData(api) const whitelisted = [] const notWhitelisted = [] @@ -92,13 +109,7 @@ const computeBalances = async (api, isVesting) => { Object.keys(CONFIG).forEach((chain) => { module.exports[chain] = { - tvl: async (api) => { - if (!cacheData[api.chain]) await fetchVestingData(api); - await computeBalances(api, false); - }, - vesting: async (api) => { - if (!cacheData[api.chain]) await fetchVestingData(api); - await computeBalances(api, true); - }, + tvl: (api) => computeBalances(api, false), + vesting: (api) => computeBalances(api, true), }; }); \ No newline at end of file diff --git a/projects/helper/cache/lowValue.js b/projects/helper/cache/lowValue.js index 33b01d4007a..a9fa834340f 100644 --- a/projects/helper/cache/lowValue.js +++ b/projects/helper/cache/lowValue.js @@ -1,5 +1,8 @@ const sdk = require('@defillama/sdk') const { getCache, setCache } = require('../cache') +const { sliceIntoChunks } = require('../utils') +const { nullAddress } = require('../tokenMapping') +const uniV3ABI = require('../abis/uniV3.json') const WEEK = 7 * 24 * 3600 @@ -71,4 +74,137 @@ async function getLowValueCache({ api, project, key, thresholdUSD = 100, recheck return { filter, record, save } } -module.exports = { getLowValueCache } +const MULTICALL3 = '0xcA11bde05977b3631167028862bE2a173976CA11' + +/** + * api.sumTokens for a very large list of owners (one account per user), with the low-value store above: + * owners worth less than `thresholdUSD` are counted from the store and read again once a week. + * + * await sumTokensLowValue({ api, project: 'my-project', owners, tokens }) + * + * - `tokens`: erc20s, plus the null address for the gas token (read with Multicall3 getEthBalance). + * - `transform(balances, owner)`: optional, returns the balances to count for an owner (eg. a share token turned into + * its underlying). It gets and returns `{ [token]: amount }`, token addresses in lower case. + * - `freshCount`: for a list that is oldest first (built from event logs), the newest owners are read on every run + * whatever they hold, because a new account starts empty and is funded afterwards. + * - An owner with a failed read is counted with what was read and is not stored, so it is read again next run. + * - `key` separates several owner lists of one project on the same chain. + */ +async function sumTokensLowValue({ api, project, key, owners, tokens, transform, freshCount = 0, groupSize = 2000, thresholdUSD, recheckSeconds }) { + const lowValue = await getLowValueCache({ api, project, key, thresholdUSD, recheckSeconds, checkpointEvery: groupSize }) + tokens = [...new Set(tokens.map(token => token.toLowerCase()))] + const erc20s = tokens.filter(token => token !== nullAddress) + const hasNative = erc20s.length !== tokens.length + owners = [...new Set(owners.map(owner => owner.toLowerCase()))] + const firstFresh = Math.max(0, owners.length - freshCount) + const pending = lowValue.filter(owners.slice(0, firstFresh)).concat(owners.slice(firstFresh)) + + for (const group of sliceIntoChunks(pending, groupSize)) { + const held = group.map(() => ({})) + const failed = new Set() + + if (erc20s.length) { + const calls = group.flatMap(owner => erc20s.map(token => ({ target: token, params: owner }))) + const balances = await api.multiCall({ abi: 'erc20:balanceOf', calls, permitFailure: true }) + balances.forEach((balance, i) => { + const ownerIndex = Math.floor(i / erc20s.length) + if (balance == null) failed.add(ownerIndex) + else held[ownerIndex][erc20s[i % erc20s.length]] = balance + }) + } + if (hasNative) { + const balances = await api.multiCall({ abi: 'function getEthBalance(address) view returns (uint256)', target: MULTICALL3, calls: group, permitFailure: true }) + balances.forEach((balance, i) => { + if (balance == null) failed.add(i) + else held[i][nullAddress] = balance + }) + } + + const results = [] + group.forEach((owner, i) => { + const balances = transform ? transform(held[i], owner) : held[i] + if (failed.has(i)) Object.entries(balances).forEach(([token, amount]) => api.add(token, amount)) + else results.push([owner, balances]) + }) + await lowValue.record(results) + } + await lowValue.save() +} + +const range = (from, to) => Array.from({ length: Math.max(0, to - from) }, (_, i) => from + i) + +// Position ids of an owner that never lets a position go (a locker). ERC721Enumerable keeps the order of such an +// owner's list, so only the indexes past the stored length are read. +async function getLockedPositionIds({ api, project, key, nftAddress, owner }) { + const now = Math.floor(Date.now() / 1000) + const isCurrentRun = !api.timestamp || api.timestamp > now - 3600 + const cacheKey = `position-ids/${key ?? api.chain}` + const count = +(await api.call({ target: nftAddress, abi: 'erc20:balanceOf', params: owner })) + let { ids = [] } = isCurrentRun ? await getCache(project, cacheKey) : {} + if (ids.length > count) ids = [] // a position left the owner after all: the indexes moved, read them all again + if (ids.length === count) return ids + + const more = await api.multiCall({ target: nftAddress, abi: uniV3ABI.tokenOfOwnerByIndex, calls: range(ids.length, count).map(i => ({ params: [owner, i] })), permitFailure: true }) + const complete = more.every(id => id != null) + ids = ids.concat(more.filter(id => id != null).map(String)) + // a list with a failed read in it is used for this run only + if (isCurrentRun && complete) await setCache(project, cacheKey, { ids }) + return ids +} + +/** + * Uniswap V3 NFT positions with the low-value store above, for launchpads and lockers holding tens of thousands of + * positions of which most are worth next to nothing. A position worth less than `thresholdUSD` is stored with its + * balances, counted from the store, and read again once a week. + * + * await sumUniV3PositionsLowValue({ api, project: 'my-project', nftAddress, lockedOwner: locker, whitelistedTokens }) + * + * - `positionIds`, oldest first, or `lockedOwner`: an owner that never lets a position go, whose id list is stored and + * only extended (see getLockedPositionIds). + * - `whitelistedTokens`: only these sides of a position are counted (and decide whether it is low value). + * - `freshCount`: the newest positions are read on every run whatever they are worth, because a new launch starts + * with nothing on its quote side and gains it as it trades. + * - A position with a failed read is left out of this run only and read again next run. + */ +async function sumUniV3PositionsLowValue({ api, project, key, nftAddress, positionIds, lockedOwner, whitelistedTokens = [], freshCount = 2000, groupSize = 5000, thresholdUSD, recheckSeconds }) { + const { addUniV3LikePosition } = require('../unwrapLPs') + if (!positionIds) positionIds = await getLockedPositionIds({ api, project, key, nftAddress, owner: lockedOwner }) + positionIds = positionIds.map(String) + const whitelist = new Set(whitelistedTokens.map(token => token.toLowerCase())) + const factory = await api.call({ target: nftAddress, abi: uniV3ABI.factory }) + + const lowValue = await getLowValueCache({ api, project, key, thresholdUSD, recheckSeconds, checkpointEvery: groupSize }) + const firstFresh = Math.max(0, positionIds.length - freshCount) + const pending = lowValue.filter(positionIds.slice(0, firstFresh)).concat(positionIds.slice(firstFresh)) + + for (const group of sliceIntoChunks(pending, groupSize)) { + const positions = await api.multiCall({ target: nftAddress, abi: uniV3ABI.positions, calls: group, permitFailure: true }) + const poolKey = position => `${position.token0}-${position.token1}-${position.fee}`.toLowerCase() + const byPool = {} + positions.forEach(position => { if (position) byPool[poolKey(position)] = position }) + const keys = Object.keys(byPool) + const pools = await api.multiCall({ target: factory, abi: uniV3ABI.getPool, calls: keys.map(k => ({ params: [byPool[k].token0, byPool[k].token1, byPool[k].fee] })), permitFailure: true }) + const liveKeys = keys.filter((_, i) => pools[i] && pools[i] !== nullAddress) + const slot0s = await api.multiCall({ abi: uniV3ABI.slot0, calls: liveKeys.map(k => pools[keys.indexOf(k)]), permitFailure: true }) + const tickOf = {} + liveKeys.forEach((k, i) => { if (slot0s[i]) tickOf[k] = +slot0s[i].tick }) + + const results = [] + group.forEach((id, i) => { + const position = positions[i] + if (!position || tickOf[poolKey(position)] === undefined) return + const held = {} + const add = (token, amount) => { + token = token.toLowerCase() + if (whitelist.size && !whitelist.has(token)) return + if (amount >= 1) held[token] = BigInt(Math.floor(amount)).toString() + } + addUniV3LikePosition({ api: { add }, token0: position.token0, token1: position.token1, liquidity: position.liquidity, tickLower: +position.tickLower, tickUpper: +position.tickUpper, tick: tickOf[poolKey(position)] }) + results.push([id, held]) + }) + await lowValue.record(results) + } + await lowValue.save() +} + +module.exports = { getLowValueCache, sumTokensLowValue, sumUniV3PositionsLowValue } diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index abfe929fa86..87abfcb1756 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -655,7 +655,9 @@ async function unwrapSlipstreamNFT({ api, balances, owner, positionIds = [], nft } const positionsAbi = isShadow ? shadowV3PositionsABI : slipstreamNftABI.positions - const positions = (await api.multiCall({ abi: positionsAbi, target: nftAddress, calls: positionIds, })) + // positions() reverts for an id that was burned (ids can come from a list that is a little behind the chain): + // such a position is skipped instead of failing every other one + const positions = (await api.multiCall({ abi: positionsAbi, target: nftAddress, calls: positionIds, permitFailure: true, })).filter(Boolean) const lpInfo = {} positions.forEach(position => lpInfo[getKey(position)] = position) diff --git a/projects/lift-v1/index.js b/projects/lift-v1/index.js index c33c7e4dc43..f641eca35ee 100644 --- a/projects/lift-v1/index.js +++ b/projects/lift-v1/index.js @@ -1,5 +1,5 @@ const { getLogs2 } = require('../helper/cache/getLogs') -const { sumTokens2 } = require('../helper/unwrapLPs') +const { sumUniV3PositionsLowValue } = require('../helper/cache/lowValue') // LaunchpadFactory generations; the first no longer launches, its pools still trade const FACTORIES = [ @@ -16,12 +16,15 @@ async function tvl(api) { for (const factory of FACTORIES) launches.push(...await getLogs2({ api, target: factory, eventAbi: TOKEN_LAUNCHED, fromBlock: FROM_BLOCK, extraKey: 'lift-v1-launches' })) - // only the launch positions held by the LpVaults are counted, and only their quote side - return sumTokens2({ - api, - uniV3WhitelistedTokens: [...new Set(launches.map((l) => l.quote))], - uniV3ExtraConfig: { nftAddress: POSITION_MANAGER, positionIds: launches.map((l) => String(l.positionId)) }, + // only the launch positions held by the LpVaults are counted, and only their quote side. + // There are 20k+ of them and most are worth next to nothing: a position worth under $100 is stored with its balance, + // counted from the store, and read again once a week. The newest positions are always read. + await sumUniV3PositionsLowValue({ + api, project: 'lift-v1', nftAddress: POSITION_MANAGER, + positionIds: launches.map((l) => String(l.positionId)), + whitelistedTokens: [...new Set(launches.map((l) => l.quote))], }) + return api.getBalances() } module.exports = { diff --git a/projects/noxa-fun/index.js b/projects/noxa-fun/index.js index ee2e1c195a6..b33717b0bc3 100644 --- a/projects/noxa-fun/index.js +++ b/projects/noxa-fun/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2 } = require('../helper/unwrapLPs') +const { sumUniV3PositionsLowValue } = require('../helper/cache/lowValue') // NOXA Fun launchpad: LP is single-sided Uniswap V3 liquidity locked forever in the Launch Locker. // TVL = value of the whitelisted (pair-token) side of the univ3 NFT positions held by the locker, @@ -51,7 +51,11 @@ Object.keys(config).forEach(chain => { const { locker, nftManager, whitelistedTokens } = config[chain] module.exports[chain] = { tvl: async (api) => { - return sumTokens2({ api, owners: [locker], resolveUniV3: true, uniV3WhitelistedTokens: whitelistedTokens, uniV3ExtraConfig: { nftAddress: nftManager } }) + // The locker holds one position per launch (60k+ on robinhood) and most are worth next to nothing. Nothing ever + // leaves it, so its position list is stored and only extended, and a position worth under $100 is stored with + // its balance, counted from the store, and read again once a week. The newest positions are always read. + await sumUniV3PositionsLowValue({ api, project: 'noxa-fun', nftAddress: nftManager, lockedOwner: locker, whitelistedTokens }) + return api.getBalances() }, } }) diff --git a/projects/predictstreet/index.js b/projects/predictstreet/index.js index 737a886f57e..85aad6f99a6 100644 --- a/projects/predictstreet/index.js +++ b/projects/predictstreet/index.js @@ -1,6 +1,7 @@ const { getLogs2 } = require('../helper/cache/getLogs') const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') +const { sumTokensLowValue } = require('../helper/cache/lowValue') const VAULT_FACTORY = '0xc16B8b190064451c2FeEb2e77c4B2aC4c7009552' const CONDITIONAL_TOKENS = '0xD28B8295Cd57F205e4d080Ff4c6d23C06a9EEe3a' // locks collateral backing open positions @@ -23,10 +24,11 @@ async function tvl(api) { const wcols = await api.multiCall({ abi: 'function wcolOf(bytes32) view returns (address)', calls: marketLogs.map(l => ({ target: NEG_RISK_ADAPTER, params: [l.marketId] })), permitFailure: true }) const clones = wcols.filter(a => a && a !== ADDRESSES.null) - const owners = [CONDITIONAL_TOKENS].concat(vaults, clones) - // sum idle USDC.e in all vaults, ConditionalTokens, and neg-risk WrappedCollateral clones - return sumTokens2({ api, owners, token: ADDRESSES.adi.USDC_e, sumChunkSize: 5000}) - // await api.sumTokens({ owners, tokens: [ADDRESSES.adi.USDC_e] }) // USDC.e + // idle USDC.e in the user vaults. There are 140k+ of them and most are empty: a vault worth under $100 is stored with + // its balance, counted from the store, and read again once a week + await sumTokensLowValue({ api, project: 'predictstreet', key: 'vaults', owners: vaults, tokens: [ADDRESSES.adi.USDC_e], groupSize: 5000, freshCount: 2000 }) + // plus ConditionalTokens and the neg-risk WrappedCollateral clones + return sumTokens2({ api, owners: [CONDITIONAL_TOKENS].concat(clones), token: ADDRESSES.adi.USDC_e }) } module.exports = { diff --git a/projects/rosswap/index.js b/projects/rosswap/index.js index 2b8e8f81032..35b39fa77ef 100644 --- a/projects/rosswap/index.js +++ b/projects/rosswap/index.js @@ -23,7 +23,7 @@ async function tvl(api) { token1Bal: r._reserve1, }) }) - return transformDexBalances({ chain: api.chain, data, }) + return transformDexBalances({ chain: api.chain, data, skipUnknownTokens: true, }) } module.exports = { diff --git a/projects/thedeep/index.js b/projects/thedeep/index.js index 00bca4fe422..380dc6ba5be 100644 --- a/projects/thedeep/index.js +++ b/projects/thedeep/index.js @@ -1,5 +1,4 @@ const { getLogs, getLogs2 } = require('../helper/cache/getLogs') -const { getHookPools, addUniV4PoolReserves } = require('../helper/uniswapV4') const abi = { "getTotalAmounts": "function getTotalAmounts() view returns (uint256 total0, uint256 total1)", @@ -15,27 +14,29 @@ module.exports = { const initializeAbi = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks, uint160 sqrtPriceX96, int24 tick)' // Aegis hook pools on Ink. poolManager + fromBlock match the uniswap-v4 and calamari adapters, so the Initialize log cache is shared with them -const inkAegisUniswap = { poolManager: '0x360e68faccca8ca495c1b759fd9eee466db9fb32', fromBlock: 4580556, hook: '0xe449e013004db4a5681e9622ca10c5ba0ea610cc', stateView: '0x76fd297e2d437cd7f76d50f01afe6160f86e9990' } +const inkAegisUniswap = { poolManager: '0x360e68faccca8ca495c1b759fd9eee466db9fb32', fromBlock: 4580556, hook: '0xe449e013004db4a5681e9622ca10c5ba0ea610cc' } const inkAegisCalamari = { poolManager: '0x6E4723A612831AfB9f5B2a5aE22723c37aAB9560', fromBlock: 54652108, hook: '0x2f449fa3f078960313749bc45ffcde0987f790cc' } -// Calamari has no StateView, so its pools are read through ReservesLens, which walks the same tick liquidity inside one call +// ReservesLens walks a pool's tick liquidity inside one call and takes the pool manager as a parameter, so it reads +// the Uniswap pools as well as the Calamari ones (which have no StateView). Walking the tick bitmap of the ~100 +// Uniswap pools through StateView instead took ~400k calls per run for the same numbers (checked token by token). const reservesLens = '0x0000001b173C3bbF3984D417d8614E3eed34865B' async function addInkAegisPools(api) { - const uniPools = await getHookPools({ api, ...inkAegisUniswap }) - await addUniV4PoolReserves({ api, pools: uniPools, stateView: inkAegisUniswap.stateView }) - - const { poolManager, fromBlock, hook } = inkAegisCalamari - const logs = await getLogs2({ api, target: poolManager, eventAbi: initializeAbi, fromBlock }) - const pools = logs.filter((log) => log.hooks.toLowerCase() === hook) - const reserves = await api.multiCall({ - target: reservesLens, - abi: abi.getPoolTVL, - calls: pools.map((p) => ({ params: [poolManager, [p.currency0, p.currency1, p.fee, p.tickSpacing, p.hooks]] })), - }) - reserves.forEach((r, i) => { - api.add(pools[i].currency0, r.coreAmount0) - api.add(pools[i].currency1, r.coreAmount1) - }) + for (const { poolManager, fromBlock, hook } of [inkAegisUniswap, inkAegisCalamari]) { + const logs = await getLogs2({ api, target: poolManager, eventAbi: initializeAbi, fromBlock }) + const pools = logs.filter((log) => log.hooks.toLowerCase() === hook) + const reserves = await api.multiCall({ + target: reservesLens, + abi: abi.getPoolTVL, + calls: pools.map((p) => ({ params: [poolManager, [p.currency0, p.currency1, p.fee, p.tickSpacing, p.hooks]] })), + permitFailure: true, + }) + reserves.forEach((r, i) => { + if (!r) return + api.add(pools[i].currency0, r.coreAmount0) + api.add(pools[i].currency1, r.coreAmount1) + }) + } } const eventAbi = 'event ICHIVaultCreated (address indexed sender, address ichiVault, address tokenA, bool allowTokenA, address tokenB, bool allowTokenB, uint24 fee, uint256 count)' From 58c1b82b586d954b8f4d4c77ce16d96b32deb5d4 Mon Sep 17 00:00:00 2001 From: Dee Date: Tue, 24 Nov 2026 10:51:47 +0100 Subject: [PATCH 893/988] Add Untarred TVL adapter (Robinhood Chain) (#22367) Co-authored-by: deeakpan Co-authored-by: ccipherx --- projects/untarred/index.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 projects/untarred/index.js diff --git a/projects/untarred/index.js b/projects/untarred/index.js new file mode 100644 index 00000000000..377dca181ad --- /dev/null +++ b/projects/untarred/index.js @@ -0,0 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { USDG } = ADDRESSES.robinhood + +const FUNDS = [ + '0x9319364eddbe1f58ead4b9ba2eef0f91a9c9cd30', // uYLD + '0x7e059e67f50ab876433ab1f9acb0caf836697543', // uCMD + '0xd8ce7a92934c72b53b5abf1476af1ac245bced62', // uSTK +] +const EARN = '0x96f37de93f012fea289a31b9362fbe4f8f075413' +const MAX_HOLDINGS = 50 + +async function tvl(api) { + const counts = await api.multiCall({ abi: 'uint256:holdingsCount', calls: FUNDS }) + const calls = [] + counts.forEach((count, i) => { + if (Number(count) > MAX_HOLDINGS) throw new Error(`untarred: ${FUNDS[i]} has ${count} holdings, cap ${MAX_HOLDINGS}`) + for (let j = 0; j < Number(count); j++) calls.push({ target: FUNDS[i], params: [j] }) + }) + const holdings = await api.multiCall({ abi: 'function holdings(uint256) view returns (address)', calls }) + const tokensAndOwners = holdings.map((token, k) => [token, calls[k].target]) + FUNDS.forEach((fund) => tokensAndOwners.push([USDG, fund])) + tokensAndOwners.push([USDG, EARN]) + return api.sumTokens({ tokensAndOwners }) +} + +module.exports = { + methodology: + 'Counts the USDG and holding tokens (tokenized treasuries, stocks, commodities and USDG vault shares) held by the uYLD, uCMD and uSTK vault funds, plus the USDG held by Untarred Earn. Assets moved to operator wallets or off-chain venues (Lighter hedges, Earn deployments) are not counted.', + start: '2026-11-13', + robinhood: { tvl }, +} From 255fbfaf0f5d9f21206b243a99e147cef0f8c7f1 Mon Sep 17 00:00:00 2001 From: GSNINE Date: Tue, 24 Nov 2026 04:52:33 -0500 Subject: [PATCH 894/988] Add Eloscape staking on Elysium (#22366) Co-authored-by: Bruce <196920955+GSNINE@users.noreply.github.com> Co-authored-by: ccipherx --- registries/sumTokens.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index b71a3bc5338..9adfd2fa145 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -14052,6 +14052,19 @@ const configs = { } }, }, + "eloscape": { + "start": "2026-11-12", + "methodology": "TVL counts the native HYPE held by the Eloscape grid mining contract: HYPE deployed in open rounds, prepaid standing positions and unclaimed winnings. Staking counts the ELO held by the ELO staking contract.", + "elysium": { + "tvl": { + "owner": "0xFa5856b6f352C0E7863D7F5502564130215bf80F", + "tokens": [ADDRESSES.null] + }, + "staking": { + "__staking": ["0x60448a43d96d6050824ab1c55Cb661f7887B7DB0", "0xe107e5D99910F544f88ef961E3cA6d88F06f29DD"] + } + }, + }, "elysiumBridge": { "polygon": { "tokens": [ From 9e0115976929efc6f4d90c53f0c4f5491c97a98c Mon Sep 17 00:00:00 2001 From: Danny Sacks Date: Tue, 24 Nov 2026 01:53:32 -0800 Subject: [PATCH 895/988] aerostrategy: count sAERO stakes and BuyerV2 AERO (#22364) Co-authored-by: Cursor Agent Co-authored-by: Danny Sacks Co-authored-by: ccipherx --- projects/aerostrategy/index.js | 75 ++++++++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 9 deletions(-) diff --git a/projects/aerostrategy/index.js b/projects/aerostrategy/index.js index 1488ff487f8..7c5cab95f63 100644 --- a/projects/aerostrategy/index.js +++ b/projects/aerostrategy/index.js @@ -1,34 +1,91 @@ const ADDRESSES = require('../helper/coreAssets.json') const { unwrapSolidlyVeNft } = require('../helper/unwrapLPs'); +// Legacy veAERO, kept so dates before the 2026-11-06 move to sAERO stay correct. const AERO = ADDRESSES.base.AERO; const veAERO = '0xeBf418Fe2512e7E6bd9b87a8F0f294aCDC67e6B4'; const AEROSTRATEGY_BUYER = '0x047f7B059743EC2552f44F94A901a190b836d99B'; const AUTOPILOT = '0xA7c68a960bA0F6726C4b7446004FE64969E2b4d4'; -const AEROSTRATEGY_veNFT_HOLDER = '0xE839A0356bA10957F9441bf52034Cc6D95FEAf83'; +const AEROSTRATEGY_veNFT_HOLDER = '0xE839A0356bA10957F9441bf52034Cc6D95FEAf83'; // treasury Safe +const AUTOPILOT_LOCK_MANAGER = '0x300D02c0B2b5321ACC4Cb9D067B22e7F48Ba2690'; // aerostrategy contract that held the treasury locks in Autopilot 2025-12-16 to 2026-03-31 +const AUTOPILOT_USERS = [AEROSTRATEGY_veNFT_HOLDER, AUTOPILOT_LOCK_MANAGER]; +const LOCK_MANAGER_OWNER = '0x14Ca8ee755a5FDC9A6a31dfE4B015B59507afe81'; // Safe with OWNER_ROLE on the lock manager, held the 34 locks on 2026-04-01 +const FORTY_ACRES_V1_LOAN = '0x87f18b377e625b62c708D5f6EA96EC193558EFD0'; // held the treasury veAERO as collateral with the Safe as borrower +const FORTY_ACRES_V1_FROM_BLOCK = 43976527; // 2026-03-29 +const FORTY_ACRES_V1_TO_BLOCK = 46093327; // 2026-05-17 +const FORTY_ACRES_V1_MAX_NFTS = 3000; // ~1.4k held in the window +// sAERO stakes on the Aero VotingEscrow, valued as staked new AERO (no sAERO price). +// Deployment blocks: the token and the escrow did not exist before these. +const NEW_AERO = '0x3f5bF3EdAc59d650D8fDf9657a71F2f904A3a4Ee'; +const NEW_AERO_FROM_BLOCK = 52688124; +const SAERO_VOTING_ESCROW = '0xBF7977E1521e9a3032bf7243Ee4712f311f13915'; +const SAERO_FROM_BLOCK = 52688150; +const FORTY_ACRES_SAERO_WALLET = '0xb0d466a3D19B9C059ED81513F900E901D926De5F'; // 40acres account holding the treasury's sAERO +const OLD_FORTY_ACRES_WALLET = '0xa1cf9101dc67fab7c09357ef0d5946111fc481a4'; // earlier 40acres account (held veAERO before the move) +const BUYER_V2 = '0xa8857925b388F9C18814934a56eb6993711c2Dfb'; // reservoir: AERO waiting to buy sAERO +const SAERO_OWNERS = [AEROSTRATEGY_veNFT_HOLDER, FORTY_ACRES_SAERO_WALLET, OLD_FORTY_ACRES_WALLET]; +const SAERO_STAKED_ABI = 'function staked(uint256) view returns (uint128 amount, uint48 end, bool isPermanent)'; + +async function fortyAcresV1Collateral(api) { + const count = await api.call({ target: veAERO, abi: 'erc20:balanceOf', params: FORTY_ACRES_V1_LOAN }); + if (+count > FORTY_ACRES_V1_MAX_NFTS) throw new Error(`40acres v1 holds ${count} veAERO, above ${FORTY_ACRES_V1_MAX_NFTS}`); + const idCalls = [...Array(+count).keys()].map(j => ({ params: [FORTY_ACRES_V1_LOAN, j] })); + const ids = await api.multiCall({ target: veAERO, abi: 'function ownerToNFTokenIdList(address, uint256) view returns (uint256)', calls: idCalls }); + const loans = await api.multiCall({ target: FORTY_ACRES_V1_LOAN, abi: 'function getLoanDetails(uint256) view returns (uint256 balance, address borrower)', calls: ids }); + const treasuryIds = ids.filter((_, i) => loans[i].borrower.toLowerCase() === AEROSTRATEGY_veNFT_HOLDER.toLowerCase()); + return api.multiCall({ target: veAERO, abi: 'function locked(uint256) view returns (int128 amount, uint256 end, bool isPermanent)', calls: treasuryIds }); +} async function tvl(api) { await api.sumTokens({ owner: AEROSTRATEGY_BUYER, token: AERO }); - const totalNftsLocked = await api.call({ + const lockCounts = await api.multiCall({ target: AUTOPILOT, abi: 'function getUserLocksCount(address user) view returns (uint256)', - params: AEROSTRATEGY_veNFT_HOLDER + calls: AUTOPILOT_USERS, }); - const lockedVeNfts = await api.call({ + const userLocks = await api.multiCall({ target: AUTOPILOT, abi: 'function getUserLocks(address user,uint256 offset, uint256 limit) view returns(tuple(uint256 lock_id,uint256 start_snapshot_id,uint256 rewards_snapshot_id, uint256 voting_power,uint256 postponed_rewards)[])', - params: [AEROSTRATEGY_veNFT_HOLDER, 0, +totalNftsLocked] + calls: AUTOPILOT_USERS.map((user, i) => ({ params: [user, 0, +lockCounts[i]] })), }); - lockedVeNfts.forEach(nft => api.add(AERO, nft.voting_power)); + userLocks.flat().forEach(nft => api.add(AERO, nft.voting_power)); + + for (const owner of [AEROSTRATEGY_veNFT_HOLDER, OLD_FORTY_ACRES_WALLET, AUTOPILOT_LOCK_MANAGER, LOCK_MANAGER_OWNER]) + await unwrapSolidlyVeNft({ api, baseToken: AERO, veNft: veAERO, owner }); + + const block = await api.getBlock(); + + if (block >= FORTY_ACRES_V1_FROM_BLOCK && block <= FORTY_ACRES_V1_TO_BLOCK) { + const collateral = await fortyAcresV1Collateral(api); + collateral.forEach(lock => api.add(AERO, lock.amount)); + } + + // Old and new AERO in the BuyerV2 reservoir, not yet used to buy sAERO. + const reservoirTokens = [AERO]; + if (block >= NEW_AERO_FROM_BLOCK) reservoirTokens.push(NEW_AERO); + await api.sumTokens({ owner: BUYER_V2, tokens: reservoirTokens }); + + // Skip blocks from before the escrow existed. After that, a failed call must throw + // rather than drop the stakes. + if (block < SAERO_FROM_BLOCK) return; + + const counts = await api.multiCall({ abi: 'erc20:balanceOf', calls: SAERO_OWNERS, target: SAERO_VOTING_ESCROW }); + const idCalls = []; + counts.forEach((count, i) => { + for (let j = 0; j < +count; j++) idCalls.push({ params: [SAERO_OWNERS[i], j] }); + }); + if (!idCalls.length) return; - await unwrapSolidlyVeNft({ api, baseToken: AERO, veNft: veAERO, owner: AEROSTRATEGY_veNFT_HOLDER }); + const stakeIds = await api.multiCall({ abi: 'function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)', calls: idCalls, target: SAERO_VOTING_ESCROW }); + const staked = await api.multiCall({ abi: SAERO_STAKED_ABI, calls: stakeIds, target: SAERO_VOTING_ESCROW }); + staked.forEach(i => api.add(NEW_AERO, i.amount)); } module.exports = { base: { tvl }, doublecounted: true, - methodology: `TVL includes aerostrategy's veAero locked in autopilot, unlocked veAero and the AERO yet to be allocated to veAero.`, -}; \ No newline at end of file + methodology: `TVL counts AERO held by Aerostrategy: sAERO stakes owned by the treasury and its 40acres accounts (counted as staked AERO), AERO in the BuyerV2 reservoir waiting to buy sAERO, and the treasury's legacy veAERO for dates before the move to sAERO, whether held directly, deposited in Autopilot by the treasury or its lock manager, or posted as 40acres collateral.`, +}; From 14483998125593d178ffc0a1ca141dd9b11faefe Mon Sep 17 00:00:00 2001 From: eden Date: Tue, 24 Nov 2026 17:20:31 +0700 Subject: [PATCH 896/988] improve methodology tvl 3jane-lending (#22368) --- projects/3jane-lending/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/3jane-lending/index.js b/projects/3jane-lending/index.js index d8646158835..f894cf324a4 100644 --- a/projects/3jane-lending/index.js +++ b/projects/3jane-lending/index.js @@ -9,7 +9,7 @@ const WA_ETH_USDC = '0xd4fa2d31b7968e448877f69a96de69f5de8cd23e'; // Wrapped Aav module.exports = { timetravel: false, misrepresentedTokens: true, // off-chain assets - methodology: "TVL is 3Jane's bank cash, read hourly from the bank api, plus idle USDC and waEthUSDC in the USD3 vault and lending contract. Borrowed is the outstanding principal of off-chain loans, counted from loan originators' reports.", + methodology: "Assets are deposited on-chain into the USD3 vault, then moved off-chain to 3Jane's bank account and lent through loan originators. TVL is the bank cash, read hourly from the bank api, plus idle USDC and waEthUSDC still in the USD3 vault and lending contract. Borrowed is the outstanding principal of off-chain loans, counted from loan originators' reports.", hallmarks: [ ['2026-11-24', 'Methodology change: counts off-chain loans and bank cash from verified reports'], ], From 71de0bd8cf24002bf98f0380b39748c0194f276a Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2026 11:13:00 +0000 Subject: [PATCH 897/988] Add X Layer to Morpho Blue TVL adapter (#22369) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- projects/morpho-blue/config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/morpho-blue/config.js b/projects/morpho-blue/config.js index 96f9371a859..9d7fca074a9 100644 --- a/projects/morpho-blue/config.js +++ b/projects/morpho-blue/config.js @@ -159,7 +159,11 @@ const config = { morph: { morphoBlue: "0xAd10d07901Dc3195c3cb5e78E061F4EA8D9B4905", fromBlock: 23180020, - } + }, + xlayer: { + morphoBlue: "0xeb00C490E888286357dC5B0a35D37D9260D11Ab5", + fromBlock: 73110254, + }, } // chains morpho dropped - exported as zero so historical tvl is preserved From f9085d01c96af449f085cc141d46a9223595ac79 Mon Sep 17 00:00:00 2001 From: Anusha Date: Tue, 24 Nov 2026 18:19:44 +0500 Subject: [PATCH 898/988] add bsc support in ember (#22370) Co-authored-by: Claude Opus 5.5 --- projects/ember-protocol/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/ember-protocol/index.js b/projects/ember-protocol/index.js index 5e59ab2289b..1a01aba6bf4 100644 --- a/projects/ember-protocol/index.js +++ b/projects/ember-protocol/index.js @@ -11,6 +11,7 @@ const PHAROS_CHAIN_IDENTIFIER = "pharos"; const BASE_CHAIN_IDENTIFIER = "base"; const MONAD_CHAIN_IDENTIFIER = "monad"; const ARBITRUM_CHAIN_IDENTIFIER = "arbitrum"; +const BSC_CHAIN_IDENTIFIER = "bsc"; // there are only one deposit address const blacklistedVaults = [ @@ -78,5 +79,8 @@ module.exports = { }, arbitrum: { tvl: (api) => evmTvl(api, ARBITRUM_CHAIN_IDENTIFIER), + }, + bsc: { + tvl: (api) => evmTvl(api, BSC_CHAIN_IDENTIFIER), } }; From 65b17764b3e1719cba8ebf94d164754934b8c103 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 24 Nov 2026 12:01:31 -0400 Subject: [PATCH 899/988] optimize uniswap v3 robinhood (#22371) --- projects/helper/uniswapV3.js | 78 +++++++++++++++++++++++++++++++++++- projects/uniswap/index.js | 8 +++- 2 files changed, 83 insertions(+), 3 deletions(-) diff --git a/projects/helper/uniswapV3.js b/projects/helper/uniswapV3.js index c50af4beb01..40af0fee93f 100644 --- a/projects/helper/uniswapV3.js +++ b/projects/helper/uniswapV3.js @@ -1,6 +1,8 @@ const { sumTokens2 } = require('./unwrapLPs') const { getLogs } = require('./cache/getLogs') const { cachedGraphQuery } = require('./cache') +const sdk = require('@defillama/sdk') +const { getCoreAssets } = require('./tokenMapping') const uniswapConfig = { eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool)', @@ -14,17 +16,86 @@ const algebraConfig = { customPoolEventAbi: 'event CustomPool(address indexed deployer, address indexed token0, address indexed token1, address pool)', } +// pool list from the clickhouse instead of the PoolCreated log cache, balances are still pulled on-chain +// for factories with 100k+ pools, where rewriting the log cache on every run takes longer than the run itself +const poolsSql = ` + SELECT DISTINCT + concat('0x', substring(topic1, 27)) AS token0, + concat('0x', substring(topic2, 27)) AS token1, + concat('0x', substring(data, 91, 40)) AS pool + FROM evm_indexer.logs + PREWHERE chain = {chain:UInt64} + AND short_address = {shortAddress:String} + AND short_topic0 = {shortTopic0:String} + AND block_number >= {fromBlock:UInt32} + AND block_number <= {toBlock:UInt32} + AND address = {factory:String} + AND topic0 = {topic0:String}` + +async function getPoolsFromIndexer(api, factory, fromBlock, topic0) { + await api.getBlock() + factory = factory.toLowerCase() + return sdk.queryIndexerSql(poolsSql, { + chain: api.chainId, factory, fromBlock, toBlock: api.block, + shortAddress: factory.slice(0, 10), topic0, shortTopic0: topic0.slice(0, 10), + }) +} + +// for factories flooded with launchpad pools (unpriced token against WETH/stable): read the quote side of every pool, +// and the other side only where the quote balance reaches minQuoteBalances[quoteToken] (raw units) +// the amounts only pick which pools get a second balance call, nothing is valued here +// pools where both tokens are core assets, or neither has a minimum, are always read in full +async function sumAboveQuoteMinimum({ api, logs, minQuoteBalances, blacklistedTokens, blacklistedOwners, ...sumOptions }) { + const minimums = {} + Object.entries(minQuoteBalances).forEach(([token, min]) => minimums[token.toLowerCase()] = BigInt(min)) + const coreAssets = new Set(getCoreAssets(api.chain)) + const skipTokens = new Set(blacklistedTokens.map(i => i.toLowerCase())) + const skipOwners = new Set(blacklistedOwners.map(i => i.toLowerCase())) + + const ownerTokens = [] + const gated = [] + logs.forEach(({ token0, token1, pool }) => { + if (skipOwners.has(pool.toLowerCase())) return + const [t0, t1] = [token0.toLowerCase(), token1.toLowerCase()] + const isGated = t => minimums[t] !== undefined && !skipTokens.has(t) + const isKnown = t => minimums[t] !== undefined || coreAssets.has(t) + if (isGated(t0) && !isKnown(t1)) gated.push({ quote: t0, other: t1, pool }) + else if (isGated(t1) && !isKnown(t0)) gated.push({ quote: t1, other: t0, pool }) + else ownerTokens.push([[token0, token1], pool]) + }) + + const quoteBalances = await api.multiCall({ abi: 'erc20:balanceOf', calls: gated.map(i => ({ target: i.quote, params: i.pool })), permitFailure: true }) + gated.forEach(({ quote, other, pool }, i) => { + const balance = quoteBalances[i] + if (!balance) return + api.add(quote, balance) + if (BigInt(balance) >= minimums[quote]) ownerTokens.push([[other], pool]) + }) + sdk.log(`uniV3Export ${api.chain}: ${gated.length} pools gated on the quote side, ${ownerTokens.length} pools read in full`) + + return sumTokens2({ api, ownerTokens, blacklistedTokens, blacklistedOwners, ...sumOptions }) +} + function uniV3Export(config) { const exports = {} Object.keys(config).forEach(chain => { - let { factory: target, fromBlock, topics, eventAbi, isAlgebra, customPools, blacklistedTokens = [], blacklistedOwners = [], permitFailure, sumChunkSize, filterFn, sumChunkSleep, onlyUseExistingCache, extraKey, } = config[chain] + let { factory: target, fromBlock, topics, eventAbi, isAlgebra, customPools, blacklistedTokens = [], blacklistedOwners = [], permitFailure, sumChunkSize, filterFn, sumChunkSleep, onlyUseExistingCache, extraKey, useIndexerSql, minQuoteBalances, } = config[chain] if (!topics) topics = isAlgebra ? algebraConfig.topics : uniswapConfig.topics if (!eventAbi) eventAbi = isAlgebra ? algebraConfig.eventAbi : uniswapConfig.eventAbi exports[chain] = { tvl: async (api) => { - let logs = await getLogs({ + let logs + // only for the uniswap PoolCreated layout, the algebra Pool event keeps the pool address elsewhere + if (useIndexerSql && !isAlgebra) { + if (sdk.isIndexerSqlEnabled()) + logs = await getPoolsFromIndexer(api, target, fromBlock, topics[0]) + else + sdk.log(`uniV3Export ${chain}: indexer sql is not configured, falling back to getLogs`) + } + + if (!logs) logs = await getLogs({ api, target, topics, @@ -53,6 +124,9 @@ function uniV3Export(config) { blacklistedTokens.push(... await filterFn(api, logs)) + if (minQuoteBalances) + return sumAboveQuoteMinimum({ api, logs, minQuoteBalances, blacklistedTokens, blacklistedOwners, permitFailure: permitFailure ?? logs.length > 2000, sumChunkSize, sumChunkSleep, }) + return sumTokens2({ api, ownerTokens: logs.map(i => [[i.token0, i.token1], i.pool]), blacklistedTokens, blacklistedOwners, permitFailure: permitFailure ?? logs.length > 2000, sumChunkSize, sumChunkSleep, }) } } diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 18fcf9e7521..1f783720c70 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -86,7 +86,13 @@ const uniV3Config = { tempo: { factory: '0x24a3d4757e330890a8b8978028c9e58e04611fd6', fromBlock: 6455886, }, '0g': { factory: '0xcb2436774C3e191c85056d248EF4260ce5f27A9D', fromBlock: 6673868 }, megaeth: { factory: '0x3a5f0cd7d62452b7f899b2a5758bfa57be0de478', fromBlock: 7009646 }, - robinhood: { factory: '0x1f7d7550B1b028f7571E69A784071F0205FD2EfA', fromBlock: 8930 }, + // 450k+ pools, nearly all 1% launchpad token/WETH: rewriting the PoolCreated log cache alone outlasts the run, + // and reading both sides means ~900k balance calls and ~440k tokens to price, of which ~420 have a price + // pools under 0.05 WETH / 100 USDG held ~1.3% of the chain's TVL when this was set, mostly unsold launch supply + robinhood: { + factory: '0x1f7d7550B1b028f7571E69A784071F0205FD2EfA', fromBlock: 8930, useIndexerSql: true, + minQuoteBalances: { [ADDRESSES.robinhood.WETH]: 0.05e18, [ADDRESSES.robinhood.USDG]: 100e6 }, + }, ink: { factory: '0x640887A9ba3A9C53Ed27D0F7e8246A4F933f3424', fromBlock: 284117 }, arc: { factory: '0xf0db7b58379503491d857db50ac9ece64c653918', fromBlock: 1946500 }, elysium: { factory: '0x1707327F626496A7b5b3872e7E4d2879Df7d7a9f', fromBlock: 256055 }, From c2c5bd24195a4b301d36080cbb0b17bb7e9a31e8 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 24 Nov 2026 13:27:23 -0400 Subject: [PATCH 900/988] remove ethena loop from aave v4 (#22373) --- projects/aave-v4/index.js | 13 +++++++++--- projects/helper/aave.js | 42 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/projects/aave-v4/index.js b/projects/aave-v4/index.js index 8ae7e196017..e75eb1efc22 100644 --- a/projects/aave-v4/index.js +++ b/projects/aave-v4/index.js @@ -10,9 +10,16 @@ module.exports = aaveV4Export({ base: [ "0xa4d5947Eb727A052bae69C593FfC84247EC9864E", // Equities Hub ], - avax: [ - "0xd07369fAE4A5BB13c9Ce446B052c7867B1AbDf6e", // Core Hub - ], + avax: { + hubs: [ + "0xd07369fAE4A5BB13c9Ce446B052c7867B1AbDf6e", // Core Hub + ], + // Ethena USDe/USDT loop: the USDT lender (also excluded on aave-v3) and the wallet borrowing it against USDe + blacklistedUsers: [ + "0xb8734a14fbd4aa2d44e6aa830405ffc861ba313c", + "0xe08af7283607f7884012c79fc585763eae5de506", + ], + }, arc: [ "0x17288dfc86205301064577b98B02b81017e6F79C", // Core Hub ], diff --git a/projects/helper/aave.js b/projects/helper/aave.js index 1bd2341d369..79eb0b1a6a6 100644 --- a/projects/helper/aave.js +++ b/projects/helper/aave.js @@ -419,6 +419,12 @@ function aaveV4Export(config) { getAssetUnderlyingAndDecimals: "function getAssetUnderlyingAndDecimals(uint256) view returns (address, uint8)", getAssetTotalOwed: "function getAssetTotalOwed(uint256) view returns (uint256)", getAssetCount: "uint256:getAssetCount", + getSpokeCount: "function getSpokeCount(uint256) view returns (uint256)", + getSpokeAddress: "function getSpokeAddress(uint256, uint256) view returns (address)", + getReserveCount: "uint256:getReserveCount", + getReserve: "function getReserve(uint256) view returns ((address underlying, address hub, uint16 assetId, uint8 decimals, uint24 dynamicConfigKey, uint24 collateralRisk, uint8 flags))", + getUserSuppliedAssets: "function getUserSuppliedAssets(uint256, address) view returns (uint256)", + getUserTotalDebt: "function getUserTotalDebt(uint256, address) view returns (uint256)", } const exports = { @@ -433,6 +439,8 @@ function aaveV4Export(config) { const isInsolvent = chainConfig.isInsolvent || false const blacklistedTokens = chainConfig.blacklistedTokens || [] + const blacklistedUsers = chainConfig.blacklistedUsers || [] + const blacklistedTokenSet = new Set(blacklistedTokens.map(t => t.toLowerCase())) async function getHubAssets(api) { const assetCounts = await api.multiCall({ abi: abi.getAssetCount, calls: hubs }) @@ -441,9 +449,35 @@ function aaveV4Export(config) { return assets.map(([underlying], i) => ({ underlying, hub: calls[i].target, assetId: calls[i].params[0] })) } + // User positions live on the spokes, so walk hub -> spokes -> reserves and read each blacklisted user's supply and debt + async function getBlacklistedPositions(api, hubAssets) { + if (!blacklistedUsers.length) return [] + const hubSet = new Set(hubs.map(h => h.toLowerCase())) + const spokeCounts = await api.multiCall({ abi: abi.getSpokeCount, calls: hubAssets.map(({ hub, assetId }) => ({ target: hub, params: [assetId] })) }) + const spokeCalls = hubAssets.flatMap(({ hub, assetId }, i) => Array.from({ length: spokeCounts[i] }, (_, j) => ({ target: hub, params: [assetId, j] }))) + const spokes = [...new Set(await api.multiCall({ abi: abi.getSpokeAddress, calls: spokeCalls }))] + const reserveCounts = await api.multiCall({ abi: abi.getReserveCount, calls: spokes, permitFailure: true }) + const reserveCalls = spokes.flatMap((spoke, i) => Array.from({ length: reserveCounts[i] || 0 }, (_, reserveId) => ({ target: spoke, params: [reserveId] }))) + const reserves = await api.multiCall({ abi: abi.getReserve, calls: reserveCalls }) + const userCalls = [] + reserves.forEach(({ underlying, hub }, i) => { + if (!hubSet.has(hub.toLowerCase())) return; + if (blacklistedTokenSet.has(underlying.toLowerCase())) return; + blacklistedUsers.forEach(user => userCalls.push({ target: reserveCalls[i].target, params: [reserveCalls[i].params[0], user], underlying })) + }) + const calls = userCalls.map(({ target, params }) => ({ target, params })) + const supplied = await api.multiCall({ abi: abi.getUserSuppliedAssets, calls }) + const debt = await api.multiCall({ abi: abi.getUserTotalDebt, calls }) + return userCalls.map(({ underlying }, i) => ({ underlying, supplied: BigInt(supplied[i]), debt: BigInt(debt[i]) })) + } + async function tvl(api) { const hubAssets = await getHubAssets(api) - return sumTokens2({ api, tokensAndOwners: hubAssets.map(({ underlying, hub }) => [underlying, hub]), blacklistedTokens }) + await sumTokens2({ api, tokensAndOwners: hubAssets.map(({ underlying, hub }) => [underlying, hub]), blacklistedTokens }) + // hub cash = supplies - borrows, so removing a user takes out their supply net of what they borrowed + const positions = await getBlacklistedPositions(api, hubAssets) + positions.forEach(({ underlying, supplied, debt }) => api.add(underlying, debt - supplied)) + return api.getBalances() } async function borrowed(api) { @@ -452,7 +486,11 @@ function aaveV4Export(config) { abi: abi.getAssetTotalOwed, calls: hubAssets.map(({ hub, assetId }) => ({ target: hub, params: [assetId] })), }) - owed.forEach((amount, i) => api.add(hubAssets[i].underlying, amount)) + owed.forEach((amount, i) => { + if (!blacklistedTokenSet.has(hubAssets[i].underlying.toLowerCase())) api.add(hubAssets[i].underlying, amount) + }) + const positions = await getBlacklistedPositions(api, hubAssets) + positions.forEach(({ underlying, debt }) => api.add(underlying, -debt)) return sumTokens2({ api, blacklistedTokens }) } From 94a309c7d05feff95eff418ea2e913e66a925374 Mon Sep 17 00:00:00 2001 From: eden Date: Wed, 25 Nov 2026 01:14:17 +0700 Subject: [PATCH 901/988] count off-chain assets to tvl (#22374) --- projects/3jane-lending/index.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/projects/3jane-lending/index.js b/projects/3jane-lending/index.js index f894cf324a4..0282bd5b523 100644 --- a/projects/3jane-lending/index.js +++ b/projects/3jane-lending/index.js @@ -9,7 +9,7 @@ const WA_ETH_USDC = '0xd4fa2d31b7968e448877f69a96de69f5de8cd23e'; // Wrapped Aav module.exports = { timetravel: false, misrepresentedTokens: true, // off-chain assets - methodology: "Assets are deposited on-chain into the USD3 vault, then moved off-chain to 3Jane's bank account and lent through loan originators. TVL is the bank cash, read hourly from the bank api, plus idle USDC and waEthUSDC still in the USD3 vault and lending contract. Borrowed is the outstanding principal of off-chain loans, counted from loan originators' reports.", + methodology: "Assets are deposited on-chain into the USD3 vault, then moved off-chain to 3Jane's bank account and lent through loan originators. TVL sums the outstanding principal of off-chain loans, the bank cash, and idle USDC and waEthUSDC still in the USD3 vault and lending contract.", hallmarks: [ ['2026-11-24', 'Methodology change: counts off-chain loans and bank cash from verified reports'], ], @@ -28,18 +28,16 @@ module.exports = { } } + // loans: category -> originator -> { principalUsd, reportDate } + for (const originators of Object.values(data.loans)) { + for (const loan of Object.values(originators)) { + api.addUSDValue(loan.principalUsd); + } + } + // on-chain: idle USDC and waEthUSDC not yet sent to the bank // on-chain borrowed is not counted, it is the same money as the off-chain loans and bank cash await sumTokens2({ api, tokens: [ADDRESSES.ethereum.USDC, WA_ETH_USDC], owners: [LENDING, USD3] }); }, - borrowed: async (api) => { - const data = await getVerifiedProject('3jane'); - for (const item of Object.values(data.loans)) { - for (const value of Object.values(item)) { - api.addUSDValue(value.principalUsd); - } - } - } } }; - From 009324cedd798dd34e1a990c7b69cc1bbde4d9ca Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 24 Nov 2026 22:53:43 +0100 Subject: [PATCH 902/988] update @defillama/sdk version --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index f2938e2e3ef..4a325d58123 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", - "@defillama/sdk": "5.0.252", + "@defillama/sdk": "5.0.253", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", "@supercharge/promise-pool": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 193848ae174..8c1c1f32aa8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^0.30.1 version: 0.30.1(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) '@defillama/sdk': - specifier: 5.0.252 - version: 5.0.252(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) + specifier: 5.0.253 + version: 5.0.253(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) '@project-serum/anchor': specifier: ^0.26.0 version: 0.26.0(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -269,8 +269,8 @@ packages: peerDependencies: '@solana/web3.js': ^1.68.0 - '@defillama/sdk@5.0.252': - resolution: {integrity: sha512-xELQcVkNBCHx4I/5zhFs2jSif3si9Pjt5DLvSO9Iw2Grz11s1tS8FXqSOpXCov67oFaKCzK45nkrVnpF1HPtZQ==} + '@defillama/sdk@5.0.253': + resolution: {integrity: sha512-68k79TvTPGgBXK00JjJUZCgZOBNFqdQO/3i1JyjCFt5n4o2Y+9qrXaJ+Vh6zF5WqrngX2f6MWrlc1T4tgVvE1g==} peerDependencies: '@solana/web3.js': '>=1.73.0' peerDependenciesMeta: @@ -1942,7 +1942,7 @@ snapshots: bn.js: 5.2.2 buffer-layout: 1.2.2 - '@defillama/sdk@5.0.252(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': + '@defillama/sdk@5.0.253(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': dependencies: '@aws-sdk/client-s3': 3.913.0 '@elastic/elasticsearch': 8.19.1(supports-color@7.2.0) From debe43e98e2f21cf128af6661d5d216ac448ceff Mon Sep 17 00:00:00 2001 From: eden Date: Wed, 25 Nov 2026 14:05:26 +0700 Subject: [PATCH 903/988] fetch tbtc wallets from new api (#22378) --- projects/helper/bitcoin-book/fetchers.js | 45 ++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/projects/helper/bitcoin-book/fetchers.js b/projects/helper/bitcoin-book/fetchers.js index ab3f9f10e6f..8d694aeca6b 100644 --- a/projects/helper/bitcoin-book/fetchers.js +++ b/projects/helper/bitcoin-book/fetchers.js @@ -21,6 +21,37 @@ function isValidBitcoinAddress(addr) { } } +// P2WPKH (bech32, BIP173) address of a 64 byte uncompressed secp256k1 public key (x || y) +function p2wpkhAddress(pubKey) { + const key = Buffer.from(pubKey.replace(/^0x/, ''), 'hex') + if (key.length !== 64) throw new Error(`unexpected public key length: ${key.length}`) + const compressed = Buffer.concat([Buffer.from([key[63] & 1 ? 3 : 2]), key.subarray(0, 32)]) + const hash160 = crypto.createHash('ripemd160').update(sha256(compressed)).digest() + const words = [0] // witness version 0 + let acc = 0, bits = 0 + for (const byte of hash160) { + acc = (acc << 8) | byte + bits += 8 + while (bits >= 5) { + bits -= 5 + words.push((acc >> bits) & 31) + } + } + const hrp = 'bc' + const values = [...[...hrp].map(c => c.charCodeAt(0) >> 5), 0, ...[...hrp].map(c => c.charCodeAt(0) & 31), ...words, 0, 0, 0, 0, 0, 0] + const GEN = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3] + let chk = 1 + for (const v of values) { + const top = chk >> 25 + chk = ((chk & 0x1ffffff) << 5) ^ v + for (let i = 0; i < 5; i++) if ((top >> i) & 1) chk ^= GEN[i] + } + chk ^= 1 + const checksum = Array.from({ length: 6 }, (_, i) => (chk >> (5 * (5 - i))) & 31) + const CHARSET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l' + return `${hrp}1${[...words, ...checksum].map(i => CHARSET[i]).join('')}` +} + module.exports = { btcfi_cdp: async () => { const target = "0x0000000000000000000000000000000000000100"; @@ -210,9 +241,17 @@ module.exports = { // "bc1qyghykrhmkk5ztn4l5pjaqywpsxkg6e9rdm22mt", // "bc1q04phgdeyx7nneh2ux4ynxhew4vwqfduk3wt6hc" // ] - const API_URL = 'https://api.tbtcscan.com/tbtc/proof-of-funds' - const { wallets } = await getConfig('tbtc/wallets', API_URL) - return wallets.filter(i => +i.walletBitcoinBalance > 0).map(wallet => wallet.walletBitcoinAddress) + // api.tbtcscan.com was retired, each wallet registry group of the Threshold subgraph is a tBTC wallet + return getConfig('tbtc/subgraph-wallets', undefined, { + fetcher: async () => { + const query = `query { randomBeaconGroups(first: 1000, orderBy: createdAt, orderDirection: desc) { id isWalletRegistry groupPublicKey { pubKey } } }` + const { data, errors } = await post('https://api.threshold.network/subgraph/mainnet', { query }) + const groups = data?.randomBeaconGroups + if (errors?.length || !groups?.length) throw new Error('tbtc: bad subgraph response') + if (groups.length >= 1000) throw new Error('tbtc: 1000 groups reached, add pagination') + return groups.filter(i => i.isWalletRegistry).map(i => p2wpkhAddress(i.groupPublicKey.pubKey)) + } + }) }, exsatBridge: async () => { const API_URL = 'https://raw.githubusercontent.com/exsat-network/exsat-defillama/refs/heads/main/bridge-bitcoin.json' From 3bd55a54eb6db8b20b6794fc938a51ad08a7ee8e Mon Sep 17 00:00:00 2001 From: Dani Date: Wed, 25 Nov 2026 08:34:15 +0100 Subject: [PATCH 904/988] verus-market: read basket reserves from the verus rpc (#22379) --- projects/verus-market/index.js | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/projects/verus-market/index.js b/projects/verus-market/index.js index 6b08dad2ff9..c714e98927f 100644 --- a/projects/verus-market/index.js +++ b/projects/verus-market/index.js @@ -1,10 +1,32 @@ -const { get } = require('../helper/http') +const { post } = require('../helper/http') const { transformDexBalances } = require('../helper/portedTokens') +const RPC_URL = 'https://api.verus.services' +const RPC_TIMEOUT_MS = 60_000 +const FRACTIONAL_OPTION = 0x01 // basket flag +const SYSTEM_TYPES = ['local', 'imported'] // imported = PBaaS bridge baskets + +async function getBaskets() { + const baskets = [] + for (const systemtype of SYSTEM_TYPES) { + const { result, error } = await post(RPC_URL, { jsonrpc: '1.0', id: 'defillama', method: 'listcurrencies', params: [{ systemtype }] }, { timeout: RPC_TIMEOUT_MS }) + if (error || !Array.isArray(result)) throw new Error(`verus: listcurrencies ${systemtype} failed: ${JSON.stringify(error)}`) + for (const { currencydefinition, bestcurrencystate } of result) { + if (!(currencydefinition.options & FRACTIONAL_OPTION) || !bestcurrencystate?.reservecurrencies) continue + const tokens = bestcurrencystate.reservecurrencies.map(({ currencyid, reserves }) => { + if (!Number.isFinite(reserves) || reserves < 0) throw new Error(`verus: bad reserves ${reserves} of ${currencyid} in ${currencydefinition.currencyid}`) + return { i_address: currencyid, reserves } + }) + baskets.push({ lp_address: currencydefinition.currencyid, tokens }) + } + } + if (baskets.length === 0) throw new Error('verus: listcurrencies returned no baskets') + return baskets +} // verus bridge address? https://etherscan.io/address/0x71518580f36feceffe0721f06ba4703218cd7f63 async function tvl(api) { - const { data: { results } } = await get("https://marketapi.verus.services/getdefichaininfo") + const results = await getBaskets() const blacklist = new Set(results.map(i => i.lp_address)) const processed = new Set() @@ -35,7 +57,8 @@ async function tvl(api) { } module.exports = { + methodology: 'Counts the reserves held by Verus DeFi basket currencies, read from the Verus daemon (listcurrencies). Basket currencies held as reserves of other baskets are skipped so they are not counted twice.', verus: { tvl }, timetravel: false, misrepresentedTokens: true, -} \ No newline at end of file +} From f2c052d0cb652a5cd9a75108c037940b1a7f4578 Mon Sep 17 00:00:00 2001 From: Dung Truong <49335463+JstD@users.noreply.github.com> Date: Wed, 25 Nov 2026 02:59:56 -0500 Subject: [PATCH 905/988] spine-finance: discover vaults from factory, add ethereum and monad (#22376) Co-authored-by: Claude Fable 5.2 --- projects/spine-finance/index.js | 62 +++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/projects/spine-finance/index.js b/projects/spine-finance/index.js index 32d0d0ef35e..d9c677e453e 100644 --- a/projects/spine-finance/index.js +++ b/projects/spine-finance/index.js @@ -1,30 +1,56 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') const { sumTokens2 } = require('../helper/unwrapLPs') -const SPINE_VAULT = '0x38cc0dae2c4305c16f3d702f9a0260599e14654f' -const BORROW_CONTROLLER = '0xce1d096e3bd08b3114a23d916a45c7cf8966d6ea' -const DEBT_TOKEN = ADDRESSES.robinhood.USDG // USDG -const COLLATERAL_TOKEN = '0x4bcb25fce9618e62e9f9fba8d65af50cf867b812' // PT-NVDA-15OCT2026 +// Every SpineVault is deployed by SpineVaultFactory, which emits SpineVaultCreated. Each vault deploys +// its own BorrowController in its constructor, so the vault list is all that needs to be discovered. +const config = { + ethereum: { factory: '0xbCbA400103641B25Cc76D27825a9dd252b6586d2', fromBlock: 25766715 }, + monad: { factory: '0x0502D0E22EBA522dD65AA118Bc7605Eb43EccFBE', fromBlock: 101952810 }, + robinhood: { factory: '0x0502D0E22EBA522dD65AA118Bc7605Eb43EccFBE', fromBlock: 60826700 }, +} + +const abi = { + vaultCreated: 'event SpineVaultCreated(address indexed spineVaultAddress)', + borrowConfigs: 'function borrowConfigs(uint256) view returns (address collateralToken, uint32 maturity, uint16 interestRate, uint16 earlyExitPenalty, uint32 gracePeriod, uint256 borrowLimit, uint256 borrowMinAmount, uint256 currentBorrowed)', + subVaults: 'function subVaults(uint256) view returns (address vault, uint64 weight, bool active)', +} + +async function getVaults(api) { + const { factory, fromBlock } = config[api.chain] + const logs = await getLogs2({ api, factory, fromBlock, eventAbi: abi.vaultCreated }) + const vaults = logs.map(i => i.spineVaultAddress) + const [assets, controllers] = await Promise.all([ + api.multiCall({ abi: 'address:asset', calls: vaults }), + api.multiCall({ abi: 'address:borrowController', calls: vaults }), + ]) + return { vaults, assets, controllers } +} async function tvl(api) { - const subVaults = await api.fetchList({ lengthAbi: 'subVaultsLength', itemAbi: 'function subVaults(uint256) view returns (address vault, uint64 weight, bool active)', target: SPINE_VAULT }) - return sumTokens2({ - api, ownerTokens: [ - [[DEBT_TOKEN, ...subVaults.map(v => v.vault)], SPINE_VAULT], // idle USDG + sub-vault shares - [[COLLATERAL_TOKEN], BORROW_CONTROLLER], // posted collateral - ] + const { vaults, assets, controllers } = await getVaults(api) + const subVaults = await api.fetchList({ lengthAbi: 'subVaultsLength', itemAbi: abi.subVaults, calls: vaults, groupedByInput: true }) + // a controller's collateral tokens are the ones its borrow configs (collateral, maturity, rate) reference + const borrowConfigs = await api.fetchList({ lengthAbi: 'configCount', itemAbi: abi.borrowConfigs, calls: controllers, groupedByInput: true }) + + const ownerTokens = [] + vaults.forEach((vault, i) => { + ownerTokens.push([[assets[i], ...subVaults[i].map(v => v.vault)], vault]) // idle debt token + sub-vault shares + ownerTokens.push([[...new Set(borrowConfigs[i].map(c => c.collateralToken))], controllers[i]]) // posted collateral }) + return sumTokens2({ api, ownerTokens }) } async function borrowed(api) { - api.add(DEBT_TOKEN, await api.call({ abi: 'uint256:totalDebt', target: BORROW_CONTROLLER })) + const { assets, controllers } = await getVaults(api) + const debts = await api.multiCall({ abi: 'uint256:totalDebt', calls: controllers }) + api.add(assets, debts) } module.exports = { doublecounted: true, - methodology: 'TVL is the idle USDG in the Spine vault, the vault\'s deposits in its ERC-4626 sub-vaults (currently Steakhouse USDG on Morpho), and the collateral posted in the borrow controller. Outstanding USDG loans are reported as borrowed.', - robinhood: { - tvl, - borrowed, - }, -} \ No newline at end of file + methodology: 'Spine vaults are discovered from the SpineVaultFactory SpineVaultCreated events. TVL is each vault\'s idle debt token, its deposits in its ERC-4626 sub-vaults (e.g. Steakhouse USDG on Morpho), and the collateral posted in its borrow controller. Outstanding loans are reported as borrowed.', +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl, borrowed } +}) From d86f00839a89c6171767b75750f7cc9a7ce39208 Mon Sep 17 00:00:00 2001 From: qhooks <352651120+qhooks@users.noreply.github.com> Date: Wed, 25 Nov 2026 02:02:16 -0600 Subject: [PATCH 906/988] QHooks: add Solana TVL (#22377) Co-authored-by: Randall Holt Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/qhooks/index.js | 44 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/projects/qhooks/index.js b/projects/qhooks/index.js index 28c12350461..7a364ad4bcf 100644 --- a/projects/qhooks/index.js +++ b/projects/qhooks/index.js @@ -2,6 +2,8 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getLogs2 } = require('../helper/cache/getLogs') const { addUniV4PoolReserves } = require('../helper/uniswapV4') const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConnection } = require('../helper/solana') +const { PublicKey } = require('@solana/web3.js') // QHooks (https://qhooks.com) launches tokens into Uniswap v4 pools whose hook is the QHooks launch contract itself. // Each launch contract (QSimpleLaunch generations, and QSaleLaunch for sale-first launches) emits one event per pool. @@ -9,6 +11,19 @@ const QHOOKS = '0x20429af7ca3b0ce4d99edbaa0693f26c5df05195' // protocol token, R const STAKE_VAULT = '0x6248098bfa019b9035a21722a86bdee3f6e9b934' // QHOOKS staking (the timed QStakeLock deposits into it) const SALE = '0x707d79c32bea8f9773a81569fbacc64ab0502044' // QSaleLaunch, same address on every EVM chain +// Solana launches are Meteora Dynamic Bonding Curve pools under the configs whose fee claimer is the QHooks wallet. +// Migrated pools are excluded because their liquidity is counted by Meteora DAMM v2. +const DBC_PROGRAM = new PublicKey('dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN') +const QHOOKS_FEE_CLAIMER = 'Coqq8o1uYxrAFggNtLCcUcGZWDUF3aUPkaFEMezCMwHh' // created configs AFBWu… (11-11) and 9898n… (11-21) +const POOL_CONFIG_DISC = '5RKzUGPpkkA' +const CONFIG_QUOTE_MINT_OFFSET = 8 +const CONFIG_FEE_CLAIMER_OFFSET = 40 +const VIRTUAL_POOL_DISC = 'cmrfVvtHrjd' +const VIRTUAL_POOL_CONFIG_OFFSET = 72 +const VIRTUAL_POOL_QUOTE_RESERVE_OFFSET = 240 +const VIRTUAL_POOL_MIGRATED_OFFSET = 305 +const NOT_MIGRATED = '1' // base58 encoding of a zero byte + const launchedAbi = 'event Launched(bytes32 indexed poolId, address indexed token, address indexed creator, address quote, string name, string symbol, string meta, uint8 style, address blocks, int24 startTick, int24 targetTick, uint256 supply, uint24 fee)' const settledAbi = 'event Settled(uint256 indexed saleId, address indexed token, bytes32 indexed poolId, uint256 clearPrice, uint256 raised, uint256 sold, uint256 poolTokens)' const initializeAbi = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks, uint160 sqrtPriceX96, int24 tick)' @@ -139,6 +154,31 @@ async function staking(api) { return sumTokens2({ api, owner: STAKE_VAULT, tokens: [QHOOKS] }) } +async function solanaTvl(api) { + const connection = getConnection() + const configs = await connection.getProgramAccounts(DBC_PROGRAM, { + filters: [ + { memcmp: { offset: 0, bytes: POOL_CONFIG_DISC } }, + { memcmp: { offset: CONFIG_FEE_CLAIMER_OFFSET, bytes: QHOOKS_FEE_CLAIMER } }, + ], + dataSlice: { offset: CONFIG_QUOTE_MINT_OFFSET, length: 32 }, + }) + if (!configs.length) throw new Error(`QHooks: no DBC configs with fee claimer ${QHOOKS_FEE_CLAIMER}`) + for (const { pubkey, account } of configs) { + const quoteMint = new PublicKey(account.data).toBase58() + const pools = await connection.getProgramAccounts(DBC_PROGRAM, { + filters: [ + { memcmp: { offset: 0, bytes: VIRTUAL_POOL_DISC } }, + { memcmp: { offset: VIRTUAL_POOL_CONFIG_OFFSET, bytes: pubkey.toBase58() } }, + { memcmp: { offset: VIRTUAL_POOL_MIGRATED_OFFSET, bytes: NOT_MIGRATED } }, + ], + dataSlice: { offset: VIRTUAL_POOL_QUOTE_RESERVE_OFFSET, length: 8 }, + }) + // quote_reserve excludes the unclaimed fees that sit in the same quote vault + for (const { account: { data } } of pools) api.add(quoteMint, data.readBigUInt64LE(0).toString()) + } +} + module.exports = { doublecounted: true, // QHooks pools are Uniswap v4 pools, also counted by the uniswap-v4 adapter methodology: @@ -146,10 +186,12 @@ module.exports = { 'Uniswap v4 pools whose hook is a QHooks launch contract, found from the launch contracts\' Launched and Settled events, plus quote ' + 'assets committed to QHooks sales that have not settled. Launched tokens are not counted. QHOOKS was launched through QHooks, so the ' + 'WETH side of its QHOOKS/WETH pool counts as TVL like any other launch. Staking is QHOOKS staked in the QHooks stake vault plus the ' + - 'QHOOKS held in QHooks pools.', + 'QHOOKS held in QHooks pools. On Solana, TVL is the quote reserve in non-migrated Meteora DBC pools created under the QHooks configs; ' + + 'graduated pools move to DAMM v2 and are counted by the Meteora adapter, as with other DBC launchpads.', } Object.keys(config).forEach((chain) => { module.exports[chain] = { tvl } }) module.exports.robinhood = { tvl, staking } +module.exports.solana = { tvl: solanaTvl } From f36c8ba1a1eb4c67c6acfc0679a73dec35f7418c Mon Sep 17 00:00:00 2001 From: asuka Date: Wed, 25 Nov 2026 08:05:05 +0000 Subject: [PATCH 907/988] Add Riptide (Ink) (#22375) Co-authored-by: ccipherx --- projects/tsunami/index.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/projects/tsunami/index.js b/projects/tsunami/index.js index c1d1918dab2..74cda01a595 100644 --- a/projects/tsunami/index.js +++ b/projects/tsunami/index.js @@ -1,9 +1,13 @@ const FACTORY = '0x5934a5C377309453746EE8aa5194F671930c09fa' +const ACCOUNT_FACTORY = '0xAA549CB621d3cc411B0029610dbE3E2E08A3A8FF' // Riptide creator agent accounts +const ACCOUNT_FACTORY_BLOCK = 58867078 const abi = { getLaunchedTokens: 'function getLaunchedTokens() view returns (address[])', tokenCurves: 'function tokenCurves(address) view returns (address)', tokenQuotes: 'function tokenQuotes(address) view returns (address)', + accountCount: 'function accountCount(address) view returns (uint256)', + accountAt: 'function accountAt(address, uint256) view returns (address)', } async function tvl(api) { @@ -12,12 +16,27 @@ async function tvl(api) { api.multiCall({ target: FACTORY, abi: abi.tokenCurves, calls: tokens }), api.multiCall({ target: FACTORY, abi: abi.tokenQuotes, calls: tokens }), ]) + const tokensAndOwners = curves.map((curve, i) => [quotes[i], curve]) - return api.sumTokens({ tokensAndOwners: curves.map((curve, i) => [quotes[i], curve]) }) + if (await api.getBlock() >= ACCOUNT_FACTORY_BLOCK) { + const counts = await api.multiCall({ target: ACCOUNT_FACTORY, abi: abi.accountCount, calls: tokens }) + const calls = [] + const accountQuotes = [] + counts.forEach((count, i) => { + for (let j = 0; j < Number(count); j++) { + calls.push({ params: [tokens[i], j] }) + accountQuotes.push(quotes[i]) + } + }) + const accounts = await api.multiCall({ target: ACCOUNT_FACTORY, abi: abi.accountAt, calls }) + accounts.forEach((account, i) => tokensAndOwners.push([accountQuotes[i], account])) + } + + return api.sumTokens({ tokensAndOwners }) } module.exports = { - methodology: 'TVL is the quote currency (ETH or an approved ERC20) held by the bonding curve of every token launched through the Tsunami factory on Ink. A curve that graduates forwards its raise into a Calamari v4 pool, so it stops being counted here.', + methodology: 'TVL is the quote currency (ETH or an approved ERC20) held by the bonding curve of every token launched through the Tsunami factory on Ink, plus the quote creators deposit into their Riptide agent accounts, which only the creator can withdraw. A curve that graduates forwards its raise into a Calamari v4 pool, so it stops being counted here. The Riptide vault trades platform capital and is not counted.', start: '2026-08-31', ink: { tvl }, } From 9e89e4d2ea378c7af6ce7ba8f8bcb40368d6e4ef Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 25 Nov 2026 11:34:02 +0100 Subject: [PATCH 908/988] update @defillama/sdk version --- package.json | 2 +- pnpm-lock.yaml | 29 ++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 4a325d58123..b0a66f3367b 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", - "@defillama/sdk": "5.0.253", + "@defillama/sdk": "5.0.254", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", "@supercharge/promise-pool": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8c1c1f32aa8..129c94d8af2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^0.30.1 version: 0.30.1(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) '@defillama/sdk': - specifier: 5.0.253 - version: 5.0.253(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) + specifier: 5.0.254 + version: 5.0.254(@opentelemetry/api@1.9.0)(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10) '@project-serum/anchor': specifier: ^0.26.0 version: 0.26.0(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -269,8 +269,8 @@ packages: peerDependencies: '@solana/web3.js': ^1.68.0 - '@defillama/sdk@5.0.253': - resolution: {integrity: sha512-68k79TvTPGgBXK00JjJUZCgZOBNFqdQO/3i1JyjCFt5n4o2Y+9qrXaJ+Vh6zF5WqrngX2f6MWrlc1T4tgVvE1g==} + '@defillama/sdk@5.0.254': + resolution: {integrity: sha512-lzKuN27giTCEYIjQSY0piAWUj+kbip2EIMxyFWqsZU0eiWtiVe204D5+GFUuMRJL9QfuPkSkFCp5FXJS4vktDw==} peerDependencies: '@solana/web3.js': '>=1.73.0' peerDependenciesMeta: @@ -380,6 +380,18 @@ packages: resolution: {integrity: sha512-Nq+COIjE1135T7qfnOHEn7E0q39bQTgXLFk837/rgFe6Hkew9WML7eHsS+lSYD2p3OJaTiUOHTAq1lHy36oIqQ==} engines: {node: '>=11'} + '@redis/client@6.3.1': + resolution: {integrity: sha512-masbfVKULdoAofwddepZxRhWa4w6zvBHn6TRn90TRPrRkVIlGCur3pFqwWaCbMxtYI9twepkz63e/T/tEH8GjA==} + engines: {node: '>= 20.0.0'} + peerDependencies: + '@node-rs/xxhash': ^1.1.0 + '@opentelemetry/api': '>=1 <2' + peerDependenciesMeta: + '@node-rs/xxhash': + optional: true + '@opentelemetry/api': + optional: true + '@scure/base@1.2.6': resolution: {integrity: sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==} @@ -1942,10 +1954,11 @@ snapshots: bn.js: 5.2.2 buffer-layout: 1.2.2 - '@defillama/sdk@5.0.253(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': + '@defillama/sdk@5.0.254(@opentelemetry/api@1.9.0)(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10))(bufferutil@4.0.9)(debug@4.4.3(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)(utf-8-validate@5.0.10)': dependencies: '@aws-sdk/client-s3': 3.913.0 '@elastic/elasticsearch': 8.19.1(supports-color@7.2.0) + '@redis/client': 6.3.1(@opentelemetry/api@1.9.0) '@supercharge/promise-pool': 2.4.0 axios: 1.12.2(debug@4.4.3(supports-color@7.2.0)) ethers: 6.15.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) @@ -1957,6 +1970,8 @@ snapshots: '@solana/web3.js': 1.98.4(bufferutil@4.0.9)(typescript@5.9.3)(utf-8-validate@5.0.10) transitivePeerDependencies: - '@75lb/nature' + - '@node-rs/xxhash' + - '@opentelemetry/api' - aws-crt - bufferutil - debug @@ -2094,6 +2109,10 @@ snapshots: - typescript - utf-8-validate + '@redis/client@6.3.1(@opentelemetry/api@1.9.0)': + optionalDependencies: + '@opentelemetry/api': 1.9.0 + '@scure/base@1.2.6': {} '@scure/bip32@1.7.0': From c6aebba9e37a24acd0f5e1a50068a6569a71855c Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 25 Nov 2026 07:34:35 -0400 Subject: [PATCH 909/988] blacklist pool in bdex v2 (#22387) --- registries/uniswapV2.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index e8230549241..80124329954 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -222,7 +222,10 @@ const uniV2Configs = { ham: '0x7304e5751973113fA7c4FFf677871B926258f27e', }, 'bdex-v2': { - bot: '0x117115f3B72C8d1989178089A67D0C26f8EE0AA3', + _options: { + blacklistedPools: ['0xF513CAB4C84516b3bb47Ad9A28C9FB964a9F4737'], // USDT/SOLEN: single-wallet pool, the LP holds the whole SOLEN supply and made the only swap + }, + bot:'0x117115f3B72C8d1989178089A67D0C26f8EE0AA3', }, 'beam-swap': { beam: '0x662b526FB70EBB508962f3f61c9F735f687C8fA5', From 6edd1d911f1e05f88d7c6eef0ca94f9ea919823d Mon Sep 17 00:00:00 2001 From: "alpacai[bot]" <319316472+alpacai[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 18:39:01 +0530 Subject: [PATCH 910/988] fix(bitunix): add missing reserve wallets (#22380) Co-authored-by: alpacai[bot] <319316472+alpacai[bot]@users.noreply.github.com> --- cex/index.js | 14 ++++++++++++-- projects/helper/bitcoin-book/index.js | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cex/index.js b/cex/index.js index 341630d9a63..274c5cf9f22 100644 --- a/cex/index.js +++ b/cex/index.js @@ -421,7 +421,8 @@ const configs = { "0x0988533bCB2e747351F08a365b33E46456C965A1", "0x76B0aB5067B3be922ef4698390Ca8bd5812A5080", "0x6Fe39F2831caF58529779EFDB73341Aa64df50Ab", - "0x431CA183bD6c2fd4a160ac28363D1719f3F12779" + "0x431CA183bD6c2fd4a160ac28363D1719f3F12779", + "0x044f8A217ed77f89f6Cf2081fB10338Ce44fEee9" ] }, ripple: { @@ -434,7 +435,16 @@ const configs = { tron: { owners: [ "TGxnRqZTkpVk53djTt4ptzTagJe5t7c4jV", - "TBNafQuxJYNR2zoF2i6KQoKV86x66XwgSa" + "TBNafQuxJYNR2zoF2i6KQoKV86x66XwgSa", + "THoW5StbzYdfhh9XUopYYhPJbJWJehoCjo", + "TDcgiw8HxnhHEhwPf7PYu5RUMpP7EygAXr", + "THgxDnzzGJYhZXnKKXm6cg1594vhLzmTGx", + "TRLEKU5ySBEoCSAFUuzYyZN5wxbx2Ho2jt", + "TG3NXULKi8WVUFtw7Lg7RM6ahGyvY5mhC2", + "TAS4yce3Jh5Rrk94SrViMq9mER3NXkqUXi", + "TVUuCWs6mUVvMrB527mVspe6nfh4nUdDWR", + "TFmCzjvmDN3Juk5VbLPctbZ3gx2ziK8ui4", + "TRkR8FnSr18tdd1cTXPVhvAUwqLyXFfFtw" ] }, arbitrum: { diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js index ad33277db68..91c374d56f1 100644 --- a/projects/helper/bitcoin-book/index.js +++ b/projects/helper/bitcoin-book/index.js @@ -459,6 +459,7 @@ module.exports = { "3D7pZri6kLqXDQMbf5G8De39K36eBaNKBG", "bc1qhx6x3c3nhyh4d2fsujjcaatc27xslyg6zju8p5", "bc1qdg5fr2zq0w0r8l3hggm25uhdc7rjqs5r0az508", + "bc1qqvh272ufc4mnpdhlruk09d24wq6fc72m683ey9", ], bitvenus: [ // '3FdoFGYYcD1EU7ekrt2x2u2mFrjmxouMJG', From d52134d006a5457cff6c11740f63dc028e237b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Wed, 25 Nov 2026 19:20:22 +0530 Subject: [PATCH 911/988] stfil: mark dead from 2024-04-03 (#22385) --- projects/stfil/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/stfil/index.js b/projects/stfil/index.js index 2fd958767c1..39b5a9df83f 100644 --- a/projects/stfil/index.js +++ b/projects/stfil/index.js @@ -10,6 +10,13 @@ const tvl = async (api) => { module.exports = { methodology: 'stFIL tokens are minted upon filecoin deposit at 1:1 ratio', + // The team was detained on 2024-04-02 and the pool's FIL was moved to an address under police + // control from 2024-04-03; lessors have not been able to withdraw since. Depositors are being + // repaid by the Hanshou police off-chain. See https://hub.fil.org/stfil-news + deadFrom: '2024-04-03', + hallmarks: [ + ['2024-04-03', 'Team detained, pool FIL moved to an address under police control'], + ], filecoin: { tvl, }, From 129cf368c4e3bfe5ed5d1589be9d89f0cfb61e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Wed, 25 Nov 2026 19:30:37 +0530 Subject: [PATCH 912/988] acryptos: throw when the api snapshot is stale (#22381) Co-authored-by: FelixBruguera --- projects/acryptos/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/acryptos/index.js b/projects/acryptos/index.js index d611082ee1e..f509aa44418 100644 --- a/projects/acryptos/index.js +++ b/projects/acryptos/index.js @@ -20,6 +20,10 @@ function fetchallchain(chainId) { module.exports = { timetravel: false, + deadFrom: '2026-11-08', + hallmarks: [ + ['2026-11-08', 'Vaults exploited, protocol deprecated'], + ], methodology: "Acryptos TVL is the USD value of token within the vault and farm contracts", misrepresentedTokens: true, ethereum: { From c872b002a70ff7cd0213fdeecdfc2d5936f2093f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Wed, 25 Nov 2026 20:30:11 +0530 Subject: [PATCH 913/988] metapool-eth: count spETH instead of the exploited mpETH supply (#22382) Co-authored-by: FelixBruguera --- projects/metapool-eth/index.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/projects/metapool-eth/index.js b/projects/metapool-eth/index.js index 6ff3945c3ed..cc38f17fdf2 100644 --- a/projects/metapool-eth/index.js +++ b/projects/metapool-eth/index.js @@ -1,14 +1,28 @@ const ADDRESSES = require('../helper/coreAssets.json') -const token = '0x48afbbd342f64ef8a9ab1c143719b63c2ad81710' + +// mpETH was exploited on 2025-06-17: ERC4626 mint() let 9,785 mpETH be minted without any ETH +// (txs 0x4f43fc6d... and 0x57ee419a...). Meta Pool reissued the 814.29 pre-exploit mpETH as spETH +// in block 22776239 (2025-06-24) and the backing now sits in spETH. mpETH supply is frozen at +// 10,527 and its totalAssets is derived from that inflated supply, so it is no longer counted. +const MPETH = '0x48afbbd342f64ef8a9ab1c143719b63c2ad81710' +const SPETH = '0xd06f6a56c5f599cb375b616df306f32b7f6f4a0e' +const SPETH_LAUNCH_BLOCK = 22776239 async function tvl(api) { - const supply = await api.call({ abi: 'uint256:totalSupply', target: token, }); - api.add(ADDRESSES.null, supply) + const block = await api.getBlock() + if (block < SPETH_LAUNCH_BLOCK) { + const supply = await api.call({ abi: 'uint256:totalSupply', target: MPETH, }) + api.add(ADDRESSES.null, supply) + return + } + const assets = await api.call({ abi: 'uint256:totalAssets', target: SPETH, }) + api.add(ADDRESSES.null, assets) } module.exports = { - methodology: 'Retrieve the total underlying ETH supply', + methodology: 'ETH staked in Meta Pool, read as spETH totalAssets. Before spETH launched (2025-06-24) it is the mpETH supply.', + hallmarks: [['2025-06-17', 'mpETH free-mint exploit']], ethereum: { tvl } -} \ No newline at end of file +} From 1335da15e32f5af32253e76a9135ae920aff6dff Mon Sep 17 00:00:00 2001 From: Dee Date: Wed, 25 Nov 2026 16:21:18 +0100 Subject: [PATCH 914/988] Untarred: add Base vaults TVL (#22384) Co-authored-by: Cursor --- projects/untarred/index.js | 45 ++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/projects/untarred/index.js b/projects/untarred/index.js index 377dca181ad..ef475ea2bb9 100644 --- a/projects/untarred/index.js +++ b/projects/untarred/index.js @@ -1,32 +1,45 @@ const ADDRESSES = require('../helper/coreAssets.json') const { USDG } = ADDRESSES.robinhood +const { USDC } = ADDRESSES.base -const FUNDS = [ +const ROBINHOOD_FUNDS = [ '0x9319364eddbe1f58ead4b9ba2eef0f91a9c9cd30', // uYLD '0x7e059e67f50ab876433ab1f9acb0caf836697543', // uCMD '0xd8ce7a92934c72b53b5abf1476af1ac245bced62', // uSTK ] -const EARN = '0x96f37de93f012fea289a31b9362fbe4f8f075413' +const ROBINHOOD_EARN = '0x96f37de93f012fea289a31b9362fbe4f8f075413' + +const BASE_FUNDS = [ + '0x5986cc4e4c5980f134dce5375468b9660206fcbf', // uCMD + '0xa336327045966cc03b0baf5fde165065e73b7089', // uNVDA + '0x49aaa2a06d34c3015e9273d6f638fb65972d4fd9', // uGOOGL + '0x5efd938f34bf47fecdc8149d29dfa6a78b6afc3a', // uMU + '0x7e059e67f50ab876433ab1f9acb0caf836697543', // uSTK (paused) +] +const BASE_EARN = '0xe0c2d64c8c7eda3abbb217d46f01d0ef383f6f8f' const MAX_HOLDINGS = 50 -async function tvl(api) { - const counts = await api.multiCall({ abi: 'uint256:holdingsCount', calls: FUNDS }) - const calls = [] - counts.forEach((count, i) => { - if (Number(count) > MAX_HOLDINGS) throw new Error(`untarred: ${FUNDS[i]} has ${count} holdings, cap ${MAX_HOLDINGS}`) - for (let j = 0; j < Number(count); j++) calls.push({ target: FUNDS[i], params: [j] }) - }) - const holdings = await api.multiCall({ abi: 'function holdings(uint256) view returns (address)', calls }) - const tokensAndOwners = holdings.map((token, k) => [token, calls[k].target]) - FUNDS.forEach((fund) => tokensAndOwners.push([USDG, fund])) - tokensAndOwners.push([USDG, EARN]) - return api.sumTokens({ tokensAndOwners }) +function makeTvl(funds, cash, earn) { + return async function tvl(api) { + const counts = await api.multiCall({ abi: 'uint256:holdingsCount', calls: funds }) + const calls = [] + counts.forEach((count, i) => { + if (Number(count) > MAX_HOLDINGS) throw new Error(`untarred: ${funds[i]} has ${count} holdings, cap ${MAX_HOLDINGS}`) + for (let j = 0; j < Number(count); j++) calls.push({ target: funds[i], params: [j] }) + }) + const holdings = await api.multiCall({ abi: 'function holdings(uint256) view returns (address)', calls }) + const tokensAndOwners = holdings.map((token, k) => [token, calls[k].target]) + funds.forEach((fund) => tokensAndOwners.push([cash, fund])) + tokensAndOwners.push([cash, earn]) + return api.sumTokens({ tokensAndOwners }) + } } module.exports = { methodology: - 'Counts the USDG and holding tokens (tokenized treasuries, stocks, commodities and USDG vault shares) held by the uYLD, uCMD and uSTK vault funds, plus the USDG held by Untarred Earn. Assets moved to operator wallets or off-chain venues (Lighter hedges, Earn deployments) are not counted.', + 'Counts cash (USDG on Robinhood Chain, USDC on Base) and holding tokens (tokenized treasuries, stocks, commodities and yield vault shares) held by Untarred vault funds, plus cash held by Untarred Earn. Assets moved to operator wallets or off-chain venues (Lighter hedges, Earn deployments) are not counted.', start: '2026-11-13', - robinhood: { tvl }, + robinhood: { tvl: makeTvl(ROBINHOOD_FUNDS, USDG, ROBINHOOD_EARN) }, + base: { tvl: makeTvl(BASE_FUNDS, USDC, BASE_EARN) }, } From db501f1a53d6c246fe8379689b703b053927be9b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 25 Nov 2026 17:16:15 +0100 Subject: [PATCH 915/988] track theorem markets --- registries/uniswapV3.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 67702a07b05..22699362803 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -1970,6 +1970,11 @@ const uniV3Configs = { methodology: 'Value of the tokens held in the Camelot V4 (Algebra Integral) pools on Arbitrum, discovered from the factory Pool events.', arbitrum: { factory: '0xBefC4b405041c5833f53412fF997ed2f697a2f37', fromBlock: 391829824, isAlgebra: true }, }, + 'theorem': { + // https://app.theorem.markets/markets, Algebra Integral fork; all pools come from the factory Pool event (no custom-deployer pools) + methodology: 'Value of the tokens held in the Theorem (Algebra Integral) pools on Ethereum, discovered from the factory Pool events.', + ethereum: { factory: '0xd265f57c36AC60d3F7931eC5c7396966F0C246A7', fromBlock: 24924425, isAlgebra: true }, + }, 'vectaswap': { arbitrum: { factory: '0xe84FA17C2Ea423E0dea3C986EE3E1560D684bb2d', fromBlock: 518470299}, base: { factory: '0xe84FA17C2Ea423E0dea3C986EE3E1560D684bb2d', fromBlock: 53245146} From 579fe76063b56fab778f2835dc550bad880e9a56 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 25 Nov 2026 18:53:36 +0100 Subject: [PATCH 916/988] track curve stellar --- projects/curve-stellar/index.js | 24 ++++++++++++++++++++++++ projects/helper/chain/stellar.js | 4 +++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 projects/curve-stellar/index.js diff --git a/projects/curve-stellar/index.js b/projects/curve-stellar/index.js new file mode 100644 index 00000000000..fcaf004aec4 --- /dev/null +++ b/projects/curve-stellar/index.js @@ -0,0 +1,24 @@ +const { callSoroban } = require('../helper/chain/stellar') + +// https://stellar.curve.finance/dex/stellar/pools +// StableSwap factory: every pool is registered under a permanent 0-based index +const FACTORY = 'CC2DWZ5RDSC5BZKEDQ5BABNUATX5EFJ4GCOENDXULEDVBHH2OKXFKYS5' + +async function tvl(api) { + const poolCount = Number(await callSoroban(FACTORY, 'pool_count')) + for (let i = 0; i < poolCount; i++) { + const registration = await callSoroban(FACTORY, 'pool_registration', [i]).catch(() => null) + if (!registration?.pool) continue + // active reserves owned by LPs, in coin order (uncollected protocol fees are kept apart in admin_balances) + const balances = await callSoroban(registration.pool, 'get_balances').catch(() => null) + if (!balances) continue + registration.coins.forEach((coin, j) => api.add(coin, balances[j].toString())) + } +} + +module.exports = { + timetravel: false, + start: '2026-10-21', + methodology: 'Token reserves of every pool deployed by the Curve StableSwap factory on Stellar, read from each pool contract. Uncollected protocol fees are not counted.', + stellar: { tvl }, +} diff --git a/projects/helper/chain/stellar.js b/projects/helper/chain/stellar.js index e3184624b1e..5ec3c045412 100644 --- a/projects/helper/chain/stellar.js +++ b/projects/helper/chain/stellar.js @@ -79,7 +79,9 @@ async function getContractEvents({ contractId, topic, lookbackLedgers = 100_000, if (topic && topics[0] !== topic) continue events.push({ ...ev, topics, data: stellar.parseScVal(ev.value) }) } - if (page.length < limit) break + // one request scans a limited span of ledgers (10,000) and returns a cursor at the end of it, so a short or empty + // page is not the end: follow the cursor ("-", ledger = high 32 bits of the toid) up to the chain tip + if (!res.cursor || Number(BigInt(String(res.cursor).split('-')[0]) >> 32n) >= res.latestLedger) break params = { filters, pagination: { limit, cursor: res.cursor } } } return events From dd1520ca44b98a4449d9cc475e5ea8c2c9542e27 Mon Sep 17 00:00:00 2001 From: vikramarun <33469661+vikramarun@users.noreply.github.com> Date: Wed, 25 Nov 2026 12:55:55 -0600 Subject: [PATCH 917/988] fix(superform): include V2 vaults on Katana, Flare and Robinhood (#22393) Co-authored-by: Vikram Arun --- projects/superform/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/projects/superform/index.js b/projects/superform/index.js index 23115a38c86..9621bbbe81f 100644 --- a/projects/superform/index.js +++ b/projects/superform/index.js @@ -72,6 +72,9 @@ const tvl = async (api) => { }) +} + +const v2Tvl = async (api) => { // SuperVault v2 TVL const superVaults = await api.call({ abi: 'function getAllSuperVaults() view returns (address[])', target: SUPERVAULT_AGGREGATOR, permitFailure: true }) if (superVaults && superVaults.length > 0) { @@ -96,4 +99,13 @@ module.exports = { }; -Object.keys(CONFIG).forEach(chain => module.exports[chain] = { tvl }) \ No newline at end of file +Object.keys(CONFIG).forEach(chain => module.exports[chain] = { + tvl: async (api) => { + await tvl(api) + await v2Tvl(api) + }, +}) + +module.exports.katana = { tvl: v2Tvl } +module.exports.flare = { tvl: v2Tvl } +module.exports.robinhood = { tvl: v2Tvl } From c26dcdf1b348160117ab0aea0f65963a55b23ce2 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Wed, 25 Nov 2026 15:43:13 -0400 Subject: [PATCH 918/988] add more vaults to stellar defi hub (#22394) --- projects/stellarDefiHub/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/stellarDefiHub/index.js b/projects/stellarDefiHub/index.js index 451c7045108..ff53fb0a693 100644 --- a/projects/stellarDefiHub/index.js +++ b/projects/stellarDefiHub/index.js @@ -9,7 +9,10 @@ const vaults = [ // share vaults: total_assets includes funds deployed to subaccounts const shareVaults = [ - 'CALFCZ4TY2CLHDHNJWCZX6JKYGUPV7P3GNQ3UVABXNE5JCV2E774APUM', // Evergreen vault + // Evergreen vaults + 'CALFCZ4TY2CLHDHNJWCZX6JKYGUPV7P3GNQ3UVABXNE5JCV2E774APUM', // USDC + 'CAY66YC6UHJVYN2UZJSTT3N6EKAXEWGLUDRVFVCUDKXIIF62I4SZFFNJ', // XLM + 'CDUUKPCCGY5NAGCYWEBXVAGVUEDGICB4QLBQMLJTOE4F62AKOEVQPQTH', // PYUSD ] async function tvl(api) { From b014d17d907143a47a3a3396da4b06a1196f1a74 Mon Sep 17 00:00:00 2001 From: UT-Loam Date: Thu, 26 Nov 2026 02:54:55 +0700 Subject: [PATCH 919/988] Add Tine on Ethereum (#22389) Co-authored-by: FelixBruguera --- registries/sumTokens.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 9adfd2fa145..19d26f17c1a 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -28116,6 +28116,19 @@ const configs = { ] }, }, + "tine": { + "doublecounted": true, + "start": "2026-11-25", + "methodology": "Counts the wstETH held by the Tine savings contract.", + "ethereum": { + "tokensAndOwners": [ + [ + "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0", + "0x9d0d94339707b8Ad977A68d9322Df81791643B7E" + ] + ] + }, + }, "tokenfi": { "methodology": "We count the FLOKI on 0xb8D2471E35eE033Db509e0456c8eFc4135f4EE43", "ethereum": { From 8706bc53833e9f146aac825ccf378eaf9b4baffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Thu, 26 Nov 2026 02:01:55 +0530 Subject: [PATCH 920/988] davincigraph: compute locked liquidity from chain state (#22392) Co-authored-by: FelixBruguera --- projects/davincigraph/index.js | 46 +++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/projects/davincigraph/index.js b/projects/davincigraph/index.js index 0b157e00043..f46e9df5f87 100644 --- a/projects/davincigraph/index.js +++ b/projects/davincigraph/index.js @@ -1,16 +1,50 @@ -const { fetchURL } = require("../helper/utils") +const { get } = require("../helper/http") +const { getConfig } = require("../helper/cache") -const URL = 'https://locker.davincigraph.io/api/v3/statistics' +const MIRROR = 'https://mainnet-public.mirrornode.hedera.com' +const CONTRACTS_API = 'https://locker.davincigraph.io/api/v3/contracts' +const SAUCERSWAP_POOLS = 'https://api.saucerswap.finance/pools/' +// Hedera ids (0.0.x) map to long-zero EVM addresses, which is how coreAssets/coins key HTS tokens +const toEvm = (id) => '0x' + BigInt(id.split('.')[2]).toString(16).padStart(40, '0') + +async function getTokenBalances(accountId) { + const balances = [] + let next = `/api/v1/accounts/${accountId}/tokens?limit=100` + while (next) { + const res = await get(MIRROR + next) + res.tokens.forEach(({ token_id, balance }) => { if (+balance > 0) balances.push({ token_id, balance }) }) + next = res.links?.next + } + return balances +} + +// SaucerSwap V1 LP tokens held by the Token Locker and Black Hole contracts, unwrapped into the +// pool's two tokens pro rata to lpTokenReserve (the LP token's total supply). const tvl = async (api) => { - const { data } = await fetchURL(URL) - return api.addUSDValue(Math.round(data.values.liquidity.total)) + const contracts = Object.values(await getConfig('davincigraph/contracts', CONTRACTS_API)) + .filter(({ type }) => type === 'LOCKER' || type === 'BLACKHOLE') + .map(({ contractId }) => contractId) + if (!contracts.length) throw new Error('davincigraph: no locker contracts returned') + + const pools = {} + for (const pool of await get(SAUCERSWAP_POOLS)) pools[pool.lpToken.id] = pool + + for (const contract of contracts) { + for (const { token_id, balance } of await getTokenBalances(contract)) { + const pool = pools[token_id] + if (!pool || !+pool.lpTokenReserve) continue + const share = BigInt(balance) + const supply = BigInt(pool.lpTokenReserve) + api.add(toEvm(pool.tokenA.id), (BigInt(pool.tokenReserveA) * share / supply).toString()) + api.add(toEvm(pool.tokenB.id), (BigInt(pool.tokenReserveB) * share / supply).toString()) + } + } } module.exports = { timetravel: false, doublecounted: true, - misrepresentedTokens: true, - methodology: "The displayed value represents the Total Value Locked (TVL) in USD of all assets secured within the davincigraph token lockers, burners and vesting smart contracts, accessible at https://davincigraph.io/locks/contracts, /vestings/contracts and /burns/contracts.", + methodology: "Liquidity locked in the davincigraph Token Locker and burned through its Black Hole contracts: SaucerSwap V1 LP tokens held by those contracts, unwrapped into the pool's underlying tokens. Contracts are listed at https://davincigraph.io/locks/contracts and /burns/contracts.", hedera: { tvl } }; From c46f7136800f88ae18590806680865ee4c93563d Mon Sep 17 00:00:00 2001 From: soiazhou-cmyk Date: Thu, 26 Nov 2026 17:56:40 +0800 Subject: [PATCH 921/988] add kucoin new wallet addresses (#22391) Co-authored-by: ccipherx --- projects/kucoin/index.js | 852 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 848 insertions(+), 4 deletions(-) diff --git a/projects/kucoin/index.js b/projects/kucoin/index.js index dc9aa856f5d..ad19837d8b5 100644 --- a/projects/kucoin/index.js +++ b/projects/kucoin/index.js @@ -131,6 +131,9 @@ const config = { "WBI5LT2BQ7FFYBXW2PEDVB6KBX2F3C77WXBJ2FPVERBXXBUV6SC7XXPGWM", "YXDKDH5XHXL6OYMH2HYCJCXOZWPOBEUNK5ICFVJRFW3JVQXZ6HQ6QPVQVA", "T6MXHXMGXURKJ7AD5NCB4IYPLWXYXKKFLLO5KAPJ56GKS7BFXHNHOODZCM", + "W2UJN6OSBIKS6KZSUWAEEUTVIFE6Z7WWQU2EX5NGXQL6HFJCTWQG57DKZM", + "3CIPOIS4KLKSA3XOCIRKX2TVUJ2V3F5A4P525VGMFCPGN7QFKDDYUABYOY", + "VRMYO3NMIQSYZZPLMIL4RRC6GTKGPGTE5N52LJ3VNUNHE64BPFZJUYGBBM", ], }, kcc: { @@ -141,6 +144,8 @@ const config = { "0xb8e6d31e7b212b2b7250ee9c26c56cebbfbe6b23", "0xd6216fc19db775df9774a6e33526131da7d19a2c", "0x2677c4c8757da1857cc7cc4071e0e0dd32ccb975", + "0x17a30350771d02409046a683b18fe1c13ccfc4a8", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", ], }, near: { @@ -148,10 +153,18 @@ const config = { "kucoinc.near", "e589457354361489a89039b8be6737cbc2db4d13919b6ccf23889a60f3b0d8f3", "7b865db190b966fe6ea30d0e7cc44ce42c4ea4f159a4b0b937122f166fc3ae28", + "403c128749a4cec73405adff535426c783ee65b1a2e4eac4965d0ae81ce51413", ], }, eos: { - owners: ["qlwzviixzm1h", "kucoinrise11", "kucoinatwarm"], + owners: [ + "qlwzviixzm1h", + "kucoinrise11", + "kucoinatwarm", + "kucoinrise12", + "kucoinsscwc1", + "kucoinstake1", + ], }, optimism: { owners: [ @@ -159,6 +172,9 @@ const config = { "0xebb8ea128bbdff9a1780a4902a9380022371d466", "0xd6216fc19db775df9774a6e33526131da7d19a2c", "0x2677c4c8757da1857cc7cc4071e0e0dd32ccb975", + "0xb8e6d31e7b212b2b7250ee9c26c56cebbfbe6b23", + "0xc1274c580c5653cdf8246695c2e0112492a99d6f", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", ], }, solana: { @@ -190,6 +206,7 @@ const config = { "rPjmhP2WK4mfTZX9Ywoqz3eMPzfWj2vezU", "rAnqRGVpsS6XaUbQjwpQmoE4y1MthZhT9", "rp73u3gCNorHW3AmNtvDok8WWFA9BsFptW", + "rsf5FAyMDnTiA5Rm63xvEKnSy5MxHUnZvA", ], }, bsc: { @@ -207,6 +224,13 @@ const config = { "0x69be413d648ae00f0fbd9856f1355e22b36ee5e0", "0x6d6cc65e2060d0a280fcd47b6c22ec5636797fec", "0x8dac80ce96f69f9762bc450faa4d7fbd5891ae18", + "0xcded3bb9d2dc98f6e4e772095b48051acfb84df9", + "0x635308e731a878741bfec299e67f5fd28c7553d9", + "0x2d964ee844c35a72c6a9d498d54c8a9910cf6914", + "0x46d85c2e20c4eaa7f60c5e64f8134091cb1b9679", + "0xdc1ffc87ec47736d6211295d7468e335d226b2b8", + "0x32f29dc6d8da9d264f2f4ee270bafb5321e1f224", + "0x7b403c20adb5674e31fbbc040945999739a874c8", ], }, kava: { @@ -214,11 +238,18 @@ const config = { "0x1dd9319a115d36bd0f71c276844f67171678e17b", "0xd6216fc19db775df9774a6e33526131da7d19a2c", "0xfb6a733bf7ec9ce047c1c5199f18401052eb062d", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0x2db219b373f3513d3bedc49bbf73e0bfaa07eba7", + "0x1e427a44864acee6bac9b1b56235a7a0aac755a8", + "0x168f3952620abdb1074cf0f23caab7bc9a1c0a3e", ], }, starknet: { owners: [ "0x0566ec9d06c79b1ca32970519715a27f066e76fac8971bbd21b96a50db826d90", + "0x06262a22f80cc8b4fa73f7a38c5ea437c0a6d2f0c24ea27061ff032386ea294f", + "0x04c19907a16f39d242ec1297e67fab4e76bfdbdb161078c846e5bbc5b4a70dab", + "0x01b2bb0e7b4821d4dec4201056262a748bcb4fa5ee3d44105f0901dfbc8d7c11", ], }, aptos: { @@ -226,6 +257,8 @@ const config = { "0xaa0090c74e4976834ff1b9b9ef945e1c4b6cdb49cccf37c2554ef026081312f1", "0x7cab5cb050630b957e54f0a9e757cd57fac5b64f64860559930f22e008560cfd", "0xbb74f7a3f369c84e7d9bf60aeb778c91be8e63d08ad91583340cc8f46d313f72", + "0xb95a4e7393a621b9dc19a255651cebec45b5deb257a81416a253100b67e3209d", + "0xc52580799129af2ff331a808b19be7189a209100e0fa8027a00b3e639560fcd4", ], }, base: { @@ -257,6 +290,7 @@ const config = { "addr1q9h4f2vhh5vnqgnsejan3psw6mj3a504fxlqm2eh3262qufesdvfs83ulr22vprsv9mwnt0vgkfwxlflxkns32twqzdqjpq2na", "addr1x86wkztx2pqvvh9nlqclpfn3lc43gh8gjgqe258hp7fflr05avykv5zqcewt87p37zn8rl3tz3ww3yspj4g0wrujn7xsn3ekxy", "addr1x8z7n429sfah3edwj5cgle7hjur5ge6z20shr644lrxe9l79a825tqnm0rj6a9fs3lna09c8g3n5y5lpw84tt7xdjtlslelrez", + "addr1qywgh46dqu7lq6mp5c6tzldpmzj6uwx335ydrpq8k7rru4q6yhkfqn5pc9f3z76e4cr64e5mf98aaeht6zwf8xl2nc9qr66sqg", ], }, sui: { @@ -281,7 +315,9 @@ const config = { "0xdc46d78750022e3b9b6c3a9e96c4ce046344eb876192f5c6bca2ca68bca261a9", "0xe53c0bb62fd140bb87055c6c838089badaf217f812d989f9c105f16e177c7505", "0xdc46d78750022e3b9b6c3a9e96c4ce046344eb8761929cd005e86415de46a5b4", - "0xe53c0bb62fd140bb87055c6c838089badaf217f812d9515b8d8e2f7efb77a932" + "0xe53c0bb62fd140bb87055c6c838089badaf217f812d9515b8d8e2f7efb77a932", + "0x69c6fe69c6a68a8c001157b9ef807dc0ef9f929e1214928390d78df06f46628e", + "0xff93d227e7a8022201889c8e8528ca27d4eeb841f557efe708b7e2422ea4ffd0", ], }, ton: { @@ -322,22 +358,830 @@ const config = { // "EQB4tenLXVbU58tFHcXEWY4UCldJBYx2hRa9aioMvLP74isO", // "EQCoXkxpimacDL-4KgoxVlc4cRzga3M1_oTapjTGO80S9MXC", "EQDyoucGvxKV-mOI4wqZxDHOKUrvACcnlG0BOoXfwVVDF57R", + "EQA7hl8xdtMpwYKAuzZHei7OSnJpVaznO7JwFLVYjY4At9Ol", + "EQBbQJe23kk5H77ruxpwPNbnZRArUiWTNt8Qorqti_ICFdsi", ], }, polygon: { - owners: ["0x2933782B5A8D72F2754103D1489614F29BFA4625"], + owners: [ + "0x2933782B5A8D72F2754103D1489614F29BFA4625", + "0xfe5bf6a8beb26d9cfbce4c5ad3fec8ea844b5bc9", + "0x17a30350771d02409046a683b18fe1c13ccfc4a8", + "0x9ac5637d295fea4f51e086c329d791cc157b1c84", + "0xb8e6d31e7b212b2b7250ee9c26c56cebbfbe6b23", + "0xe58c8d45477d894bb9a1501bb0d0a32af8419eda", + "0xd6216fc19db775df9774a6e33526131da7d19a2c", + ], }, polkadot: { owners: ["165tzcxR1o2EUkpZVr17DxQsdJwtEkB6HAh69hQubmKGL93f"], }, doge: { - owners: ["A4pFXcvnZdCm7Z3iZR1u12NozWTHk1avAg", "AEn5XzY4vpLfqGTouwsB33BHnhxURWzrg4"], + owners: [ + "A4pFXcvnZdCm7Z3iZR1u12NozWTHk1avAg", + "AEn5XzY4vpLfqGTouwsB33BHnhxURWzrg4", + "9y6mxqRstcQ9pdFupqwFGGajEEsq8BxtwK", + "9rgFNXJnwN9Zfq1EU7z9gMDDTQMXjarFoA", + "DEthb6RcyXPRwhfzWhmE3FngsXzctSHxkT", + "DAXQys85qfyeccsQY3zoseQGDHp31rvMQQ", + "AEwDT5YDwbx7wNGddDc9hWXyFamkpz1PRw", + "DEZpQPv5E9fPQhZDVuWtL2aB3y2e1iojiR", + "DN5Hp2kCkvCsdwr5SPmwHpiJgjKnC5wcT7", + ], }, avax: { owners: [ "0xD6216FC19DB775DF9774A6E33526131DA7D19A2C", "0x2933782B5A8D72F2754103D1489614F29BFA4625", "0x2677c4c8757da1857cc7cc4071e0e0dd32ccb975", + "0xb8e6d31e7b212b2b7250ee9c26c56cebbfbe6b23", + "0x17a30350771d02409046a683b18fe1c13ccfc4a8", + "0x4e75e27e5aa74f0c7a9d4897dc10ef651f3a3995", + "0x58a1c909c5ec6cbf9c1df9ab3e9e2301ff707b6b", + "X-avax1pnpgcx4asflpjc0zphfn62hxdf34kc6w8csetz", + "X-avax1pjnumf4drnej0ckzx3vn48m3alr4cf5sq44xc2", + "X-avax1qva4ag025lkgfd8yv4ggvykg84l70ayl32emt7", + ], + }, + "0g": { + owners: [ + "0xf5c1603357290383dbdc8626ef6e17327e0e9cd1", + "0x8c720d168270f31baa7124598bc1c9c0900e798c", + ], + }, + akash: { + owners: [ + "akash1n55cksydqdza62cm8v5m2k9mgyvcq52x8g0thx", + "akash1d5rp4gj69wc8fa458m76vt8eyneuf25ayn4sr5", + "akash1mdqlr9kcmd4hlg7nktqcyyelypg75kcyseznnu", + "akash1kcqwyej33fwzl03pflvf0qlvjmmtt0aaqz69fl", + "akash10fkghnsujk99ppjy69pcjwrzt4c5pencpsxx7x", + "akash15y4gsk32lxm934j8gp65qte0juygd248tetjvd", + ], + }, + allora: { + owners: [ + "allo19ft78008cd9qazuy330wr4fwswzk6vxsrt0z23", + "allo16lzzcl3v8crnny2c9784ns0jcpumsrx352k70p", + ], + }, + arc: { + owners: [ + "0x68d1efc18975bd2bb295904470864b1b2b59586e", + "0x220c2d49baa852bb884b97b09b07a6fe724f8e6d", + ], + }, + arweave: { + owners: [ + "z4JRWSHoznLO5IFO7Lj4r5cQy7sfoicVas7saN2juAo", + "gYGBLqKXosHnTeJ0s3dIOjFDvrxM94O1fi8bAc7lAUk", + "fOi4a7qPXPfYySObiJxJGp_rsHk6FAow98WTJpHT9Yc", + ], + }, + astar: { + owners: [ + "bMfFyiKK1RKNjPDXjP6g8jiqvvApWzwtVUTZJkU4TzeZ72k", + "b1rL5BjqJLmjuaVLfVejaVoZLw2qPYLibtX7TLECdZcmAap", + "b2CHafRwFPsG3qt2WQE7TjzrjfMWfKhDsTkE7dQv3Hhjzct", + ], + }, + aurora: { + owners: [ + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0x14122052dcc241a94d547a363392033640165663", + "0x82e4b25d83aab29b3ecea80e8589944583ca8437", + ], + }, + babylon: { + owners: [ + "bbn1x2gksg2ejkrkmpxqqxtrshwpv234c37dqckhpq", + "bbn1jdnhn4g3lff2gu08wrsq92x92wpf997kep8wsv", + ], + }, + band: { + owners: [ + "band18u5p25k7lx42uh3aym07jlu3rs6rmktk3kcg05", + "band1upv4l7res8y85egh7h9nuvl328wakqpugay4en", + "band18wpvqfu9g0n8x3ysu72fcdtwz025tvg7q0s7x5", + ], + }, + berachain: { + owners: [ + "0x38285671612d6f0ef7c3483f500d39fa71d66a1c", + "0xf8f36a4eeba637982c2881a4ec2b7e37b842da00", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + bifrost: { + owners: [ + "eq3o5bWjjWQuuYQeyTanCyfUFJLkiNpjrfpLNc6nA5u1QhV", + "eGEwXgAJx7gRVY8CuFZJc13DRCkzPftzsoPcAeW1C5AXCMh", + "byJbeggQ1YZ1pmamJbeXJjnEDMz5Kr9CLWWCdyX9pTR6P8D", + "gxjdLbmSp51ZxpdiX7LXyFGUfL3hpBZ4YmX3j3h5TxYzNPL", + "hFuy2wokwKCKKrEstGaB8equAYfE5kj1K3Ua167tN4xckjW", + "cBuLbnTyhs4f7Di9PB9vJ5Buo3UsjxDbw7TTYJSy2CC5tmj", + "gorYaCqKYGbR7FLw3HFVN1RWDoeZqxDQp1sqoGiNttC2FHL", + ], + }, + bitcoincash: { + owners: [ + "bitcoincash:pqdr4k2ys7z553d47fj7nuwgsc52drxmlqpxs0adc8", + "bitcoincash:pz2vdhznjsxcsn45jq32298lz027c5ddjsv6a56rp5", + "bitcoincash:qr5ahla9trzyl8l7l8tlcsc24d5lhcxj6ywnemc6ye", + "bitcoincash:qzd9yxl925kqyc9ymcnxrqjyvpcqnnsjwc5dz6q6uz", + "bitcoincash:pr8yw0v8c79h8sv2csd4cevjjdupynkwrgh88hk30r", + "bitcoincash:qq3df5p96lhcp9hudgpl382d5ylpzgtwnsrdc7x3l0", + ], + }, + bitgert: { + owners: [ + "0x2c1ef88eb06a617b14d0c30248543004748da672", + "0x4413e5043d4dc332b28cf80ada3d18dd2a1c5ebd", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + bittensor: { + owners: [ + "5H9brHhMA1km3Dp3YCx75oaimgxEYScxCfxbzQRZ3gHk9x3L", + "5FZiuxCBt8p6PFDisJ9ZEbBaKNVKy6TeemVJd1Z6jscsdjib", + "5DxcqzHjknv1gUReoRVYg1R6XjGgPMRD1ww4koTQND7ZLJsP", + "5FpKrxHg1CAFcNRkK1fZPWJUQJP5xCh9CcWVMYYKbLwSBq5X", + ], + }, + bsv: { + owners: [ + "1P4t7z8SwnajLpSap3eRpWMXtYBPpnjW9t", + "17d6fvZv5j34htM1LnWUVjJuKR4uEkkzuS", + "1A6QakGTRESTadCMGvPfLMiMf7ioVAMbWN", + ], + }, + btr: { + owners: [ + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0x5d9b0341ea8d57f9bf877521fb2f97fc152158b5", + "0x4c7e754f2276af250e4f622ea5a72985e37df0c9", + ], + }, + canton: { + owners: [ + "kucoin-rise-2::1220c1e463ef7c6bc238ac966e74b954529bf97803305ad8ade8b17211fedd638529", + "kucoin-rise-1::122036691a90ef385785ec9bd5308ff16e34eb90b4228d788dc5ca45b23aee0945ab", + "kucoin-rise-3::122051dc4fbea0ac2e7e06952e79761ad7225e38c3c1e08300a040117c8015ca3e5b", + ], + }, + casper: { + owners: [ + "020213b8c1def10e37107576a2372b378532d19329548ba885e853b29868ed15349b", + "0202ed20f3a93b5386bc41b6945722b2bd4250c48f5fa0632adf546e2f3ff6f4ddee", + "02028db941961b1366bc0e625afa51d1c9720cd1c53d2b300b3e96cd1806295e29fc", + ], + }, + celestia: { + owners: [ + "celestia15uvuxtjgr0s9e6yf02j4zuhfsm5ds52s8hplkk", + "celestia1ytrpc9lqtzrfsjye9r6lvj9nlfp0n3t36z9kem", + "celestia14jl20hdhyd6hy7ew069jggdq37w93jd9xc0k07", + "celestia19ntz0ned39k7uvx0w5an5lnukf2fnptuer0xq4", + "celestia1wzgak3rd4euyuujssp8lm7mkv6jylsjutahsmz", + "celestia18wpvqfu9g0n8x3ysu72fcdtwz025tvg7g2pvy3", + ], + }, + celo: { + owners: [ + "0x17a30350771d02409046a683b18fe1c13ccfc4a8", + "0xb8e6d31e7b212b2b7250ee9c26c56cebbfbe6b23", + "0xa5c739df3d8e58ca79a77ec34cfd4d7bea0b8e25", + "0x1e32760a3285550278aeafa776e5641bc581c845", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + conflux: { + owners: [ + "cfx:aaprbgcd6ycy6rnavxj6nc3f3eyn9a5bja10t8s1ec", + "cfx:aarupjjhhw4r59x9tccz8wc0k4y5jhy7c26ufnggxv", + "cfx:aampx35e3hf4ujyxb81n59wxy2nsdhn0zy6khw503n", + "cfx:aajjvc8v4hkfxppenvcpxezvmrptp5b9xpx7yjdtdr", + ], + }, + constellation: { + owners: [ + "DAG6cStT1VYZdUhpoME23U5zbTveYq78tj7EihFV", + "DAG5yqn4JRkW5oAMthhBayBtkZzfAvRQnkH1dCG4", + "DAG3WnpWbwnnKBLtu8FvBp3VUkmxJgdcs41dTHg5", + "DAG8xxL12vUzgeiCXkH8uC76spbRuVofaAkovyL2", + ], + }, + cosmos: { + owners: [ + "cosmos1nx33kngg9e4w50zl623wc8zp2gwfvnlrqjsylt", + "cosmos1zysr0j5j4cawn05mxw8xhesjq0fl599mej6ncg", + "cosmos1xam9ddvyj9fxertqq5kg2avdum882pqzrlmgzm", + "cosmos1uer4mwcq2vlt8l23ncwyjj70mug5pzx82cvlyw", + "cosmos1qml5yxnfgdhcywp2w2lpvuj9fazzeylg2gdaeq", + "cosmos1epr6n0xr4z9tjlh5z04nec9hs9rwrtclpqxy2f", + "cosmos1605flsh03s9gkep660797z30m49le90ypgvd3a", + "cosmos15jcsvlsh7wpegkv4eaypxv30zmwn07g54u96ww", + ], + }, + coti: { + owners: [ + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0x6f32781172e339c529067bc3f2219532041612a8", + "0x1c020941d0963187819b162c149141f95a3978fc", + "0x2c0ab7bc8316bd02dd8898ad1b6216041996cc9f", + "0x59e9f9bfdf84e0745aaa30193117e4f87fc3679e", + "0x4d9fb15de9188f0b170282a8f61b8ebd189cbbaa", + ], + }, + dash: { + owners: [ + "7UU2TWnsSr4BQvPE3ARdzHiYA8GsfXJ1dV", + "7k3jd6bjB7MrUetyoNH5mACspUTfu9tMfX", + "XpKrCFXtEezuWD4NT2qZajxVPnhJkhdEiE", + "XvkxruHxW7pyHauVyfMakD6HWTECPLP1qv", + "XcyX5zusdQcLgcB984nMrHKuNBck7RZHtY", + "7cKSWUMGAAt2jLN19WKskb92TUZ5gqEkMW", + ], + }, + decred: { + owners: [ + "Dsd9B1PvFteME2kfADfNyGtksLxuVpZ12ay", + "DsYUjT7d83oQTdMTTc9KpcHJkDd392pqi7g", + ], + }, + dydx: { + owners: [ + "dydx10fjf0cutvhexg78g8pd4ufppe6fggchwptvdhs", + "dydx1h9umhaefhu3k4dvrynyjf2mcz33fhdxsmfx2cc", + "dydx10hda3xyelp2js0am8z6xaeu2ut4lgndppwl4ha", + "dydx1fwupmm5uh7qnvnlnjyq462ynfnkz9tw8s3ldl0", + "dydx1sdtq905q4apjvjue5te0chefdzdj8q40wgkdjy", + "dydx1m0p3yg04c9tx8s490xtcvd0ywwn7q2uxlu8ugd", + ], + }, + etn: { + owners: [ + "0x92f0bac0f513ccafc2b4101365e2d1afcf9874e4", + "0x9c3c93bdf307a3bb531f69395614bbbc959b2265", + "0x3267162a6fc09196d15626181b7bc00166bf0afb", + "0x4c012b57902363589f2cd271c528aa6e489c0122", + "0x3dd39bb9846eb18fa3cbe419f10734157e40fb28", + ], + }, + elrond: { + owners: [ + "erd1ty4pvmjtl3mnsjvnsxgcpedd08fsn83f05tu0v5j23wnfce9p86snlkdyy", + "erd15ku2r2j6smlwumftumlpw0mfpqxy32wyt4ewxzyhs3ugsjee8stq2xh84e", + ], + }, + era: { + owners: [ + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0xf3977e6307eb0220e7ea9c54bc557136a49b19af", + "0xd65103d6a92a591bab6919bb02f945f1316a5e9f", + "0xd6216fc19db775df9774a6e33526131da7d19a2c", + ], + }, + ergo: { + owners: [ + "9fpUtN7d22jS3cMWeZxBbzkdnHCB46YRJ8qiiaVo2wRCkaBar1Z", + ], + }, + ethereumclassic: { + owners: [ + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0xfa63926440fb35fe899cd433a0456230de2cf0fa", + "0xa7ef184c8095ee633d508fa36dc3f43012a0e87d", + ], + }, + ethpow: { + owners: [ + "0x88bd4d3e2997371bceefe8d9386c6b5b4de60346", + "0xa649ffc455ac7c5acc1bc35726fce54e25eb59f9", + "0xd6216fc19db775df9774a6e33526131da7d19a2c", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + etlk: { + owners: [ + "0x5fd02ec3949dab9965f91cca6dcd5a1b8b846b10", + "0x69caf8339852cc43198dcebbe64d2cd72f1e1a72", + ], + }, + filecoin: { + owners: [ + "f1jkvf3b6hirnonrmfzgjs4rmqsh2wrk75amd63oa", + "f1yunaigmcwiksxr6jipl4xwtga2fcxvb5ibtzrqq", + "f1f7cvdtqshczlrb4r6s3dcnfoyp76sz2e4nblyoa", + ], + }, + flare: { + owners: [ + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0x22dc53fc2ed383e4bf849b1054f1b86c127fde3e", + "0xf9ed457b149ad27fe2ad2eb734482a425fd6faae", + "0x761fff168e8eb498b0df381240c2f3178a043903", + "0x0e6d0c14f90cf7f3e3559cdf1f7652b8cd4cf503", + "0xeaafa733f774fbdd8776ba8fac6cc79eb0cb497c", + ], + }, + flux: { + owners: [ + "t1bVAMF4KUxcyVZa3X3sPB4Tx5jmdgS876X", + "t1g7QCktktwReoHgwWtAgNBVvzzboQVZy19", + "t1gorwQHhWsvfgSEE3YzBZFnyewfGaimUbF", + ], + }, + fogo: { + owners: ["DoXaGk7gxKXkVrSuicCAQL8g8M86hJHAT3tEc1pCxurw"], + }, + hedera: { + owners: [ + "0.0.7315658", + "0.0.1686716", + "0.0.1686714", + "0.0.10962820", + ], + }, + hsk: { + owners: [ + "0xa55b695fc61da177fafd81986be2998df2049561", + "0xb5560ce9d76590165e21035cbd982d50a25ce45a", + ], + }, + hyperliquid: { + owners: [ + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0xd0a8fc7f6e08691b39bea04ac01538d4c9eaaa91", + "0x156fdf14cdb80c9623b5eb06a164a799aa719119", + "0x716bd8d3337972db99995dda5c4b34d954a61d95", + "0xd6e34467c052563cd773ad20ad36be7b61f96e90", + "0x2db219b373f3513d3bedc49bbf73e0bfaa07eba7", + "0xbadb123089fe03787f907a9ffea7707278bd61f0", + "0x628b72cceb9df77e8a845aa35a7d75ca4b0ec6c4", + "0xd18d7ec1c12b8a88f1cc3c7d7b7f4af6f8a94e4a", + "0xf447ff9a69a5df096669a4369d43ecf2a2ed45ac", + ], + }, + icp: { + owners: [ + "195a08e392e6f6694a43ea535d676822ce95e212ad4cd15bca6c9bcee080b5b6", + "00c3df112e62ad353b7cc7bf8ad8ce2fec8f5e633f1733834bf71e40b250c685", + ], + }, + initia: { + owners: ["init1xt4ggu8tqvzj5mt0xlftdnuq6cw8ax8lp593zf"], + }, + injective: { + owners: [ + "inj1tuqc6yft0ac3m62g4ruwqc28gjg36hmz4xpfnw", + "inj1s6wmtyl66g2jp87ye407mdeh22gdwgahg4rt4y", + "inj1n9cztn8x5m8mwk0kckrvaj9m7rmkrk6nhd47t5", + "inj1ts6zpkyfpgq4yfd2846qnkn0rnsj7hms9syl6p", + "inj19kgkz9hugys7y3swssmtvrfrdz6lgp2gty3stz", + "inj1umfy44dhenpyjsgnpkp08wz8yld30u5gvfyu2l", + ], + }, + iota: { + owners: [ + "0xf1b15744168d00661fe0ca19095b5b79405a6dcf2414896fdb5f11d7d1327e61", + "0x96af1639b31210ff22641fb2e19085a4fae0a5c6d8a282b9452208427cd04f9f", + "0xc2e0c96a5d1139af04516650328b4b087522c1f6c2d51f665a45967d4c2caee1", + ], + }, + iotex: { + owners: ["0x9b54d815deb1d4eb3fc2e564277c061b9cb7fddd"], + }, + kaspa: { + owners: [ + "kaspa:qzadxjufntvckxrvy76pyhvtkuu8lg5ryz252aglmhlyv27pxqplksshzuu9m", + "kaspa:qq3k4du6wf2g26j7ds6fqmgtgavgm3zy676wntp2e52nsuns2n4s6xkndmx0y", + "kaspa:qpq94ntnvy8p9q6wrdwtn37xtspgashrydc0kuu8ctpyxulmh0wlxh2807zdh", + ], + }, + klaytn: { + owners: [ + "0xc1cd6702480632349d6e9da4c3d4a13e1a65b972", + "0x8f644e25016077d0552d31288d45ae47de0813b6", + "0xc1fecb8bd82bceef9d2b55fee5f4e0e644ea2e9a", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + linea: { + owners: [ + "0xe73d4b73eff834fef9a0276298c996c5f3b08274", + "0x5a7899599709686e38e65a5e94aadf9edf40e57a", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + litecoin: { + owners: [ + "MJQXeUK6vdzwmPiCCjpcbaEJggkJrMBHNw", + "MPHYdgqmdxn3au7SCDuEEKc1Bh4ba24bmN", + "ltc1qv7wsvsmx6tqxjz9l750n0pj524na4lmqrjhyz9", + "ltc1qwuz760c95wq5faj0z0dtdy6j2mvt6z2hmuretl", + "ltc1q902mja788zak65ev9qw8zre7fnrj6rvc0z8yme", + "MDvws4C5uM1r6QBbJDj9y7yhhEhR4SF6t5", + "MV1mxEj3zh1kuFcPE4JZCUCSki4eH3SLwL", + ], + }, + lukso: { + owners: [ + "0x17a30350771d02409046a683b18fe1c13ccfc4a8", + "0xb8e6d31e7b212b2b7250ee9c26c56cebbfbe6b23", + "0x0ee651e673092610cbca44e532178d74de57818c", + "0x418f7dd598c53a6a3a5d94cf93548ab66619da6e", + "0xae09e2cd52fdf645c8357d65ffbd464648d5808c", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + manta: { + owners: [ + "0xd7991e8d7db089f26017eb2046496bc7b6d6b454", + "0x446e4acf5ffee9ce9facbbe5b78f8e6f5fde1b76", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0xd6216fc19db775df9774a6e33526131da7d19a2c", + ], + }, + mantle: { + owners: [ + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0x7345b723e174e57eb76b85b155ccc362bd9e25dd", + "0xae09e2cd52fdf645c8357d65ffbd464648d5808c", + "0x168f3952620abdb1074cf0f23caab7bc9a1c0a3e", + "0xab7ac8b30e93ad72766f12090bdc4e639d77ae73", + ], + }, + mantra: { + owners: [ + "mantra1jvs3gf3ym28w7pt6mgdjfcyq9c7mc7z6zmytju", + "mantra1am0v3rtkf7c4z9fsptapu26wy0w3cm468kp5k2", + "mantra18wpvqfu9g0n8x3ysu72fcdtwz025tvg7jt6cax", + "mantra1z6wlzxmga6esclstc08uj5gz22q9keh6zzw3sv", + "mantra10xx0vxfmfwkndrghtp3src0xv2tfdmfqzdmzhg", + ], + }, + matchain: { + owners: [ + "0x00589d0b7e7b7f9b44076cd2de422818a2c674b5", + "0x9ee56b1f9686b6b1b6747069fe8ba96c63957815", + ], + }, + megaeth: { + owners: [ + "0xc2cc15728b677343b7c330ca147b8b635d9b08c4", + "0xedf1f15771bcdb9154e52128ddb9360b1e440667", + ], + }, + merlin: { + owners: [ + "0x656c6c7ed2363b0be8878b2e329be50f987e8721", + "0x9a447c495426d64cb77832c30cd7c8d4a3f306f1", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0xd6216fc19db775df9774a6e33526131da7d19a2c", + ], + }, + metis: { + owners: [ + "0x17a30350771d02409046a683b18fe1c13ccfc4a8", + "0xe7f7f1e591c198a394335a4905d931457faf9332", + "0xc519c75cf9de75311e6797cb3a3c641a01bdb1d5", + "0xb8e6d31e7b212b2b7250ee9c26c56cebbfbe6b23", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + mina: { + owners: [ + "B62qk9CasT3zwAUnTXYxjAaPcrn4Byx4zAC6Sjib3u3inPBALtENkme", + "B62qmVNxJomFScVmeE4WaiBunJsGJPboHTrDTwZNqvQTWHUyLunLbyj", + "B62qp9vk2jHCqKotH8j9kJeHL56tB2n2bfMMiyqn5RAqwLLugMU53jG", + ], + }, + monad: { + owners: [ + "0x52f107c0d956c0e417dd8814455984c45cfe1a18", + "0x2677c4c8757da1857cc7cc4071e0e0dd32ccb975", + "0xdb2ac3b16f3877b478ad0bfb3d265d9c9be3f254", + "0x17a30350771d02409046a683b18fe1c13ccfc4a8", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + neo3: { + owners: [ + "NdtNKmNHWPsMRj6utkWkpn1KR1VM8BWQQu", + "NdMAf2ASVvS1LHnsQE8uLefWvVRSNeb6fA", + "NWKquhHc1uwjr97jZrY2Jnar7mBa3otVbN", + "NQs33i3SrPLmsSCTM63mFFJkhdU6iG2t7C", + ], + }, + nervos: { + owners: [ + "ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq238c5e34lfkzag3r9mnzxkw2j5kv3dd9qm83gxr", + "ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqgzgak4nyyfjzlcnx6lel86kkl9wmn8cmqg5mv52", + "ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqg7amrm9saduc4acdzlerezh8x02rnlhpgctv0fh", + ], + }, + nibiru: { + owners: [ + "nibi1chy0rqw3zrj47ghzrydy5e9szlp7hwe00e9k6t", + "nibi1n3xqlxxrc4kj4gle2qya9466je64jf3ya4sdqw", + "nibi18wpvqfu9g0n8x3ysu72fcdtwz025tvg7w959h0", + ], + }, + oasis: { + owners: [ + "oasis1qp7qc2fvaj6h5x5mca9zqlmpuczz6n02xs0rle3k", + "oasis1qq03n9m557tsulxpdlknrhlvtm6wunhj0vzv0jnx", + "oasis1qqfj6vsvfq8mlwlluzhx4lctwgw6ny4l3vgcqn9h", + ], + }, + ontology: { + owners: [ + "AJQ1XhE349gvkAtdYrACmhAzcAw37Vc7n7", + "AddKsL9koDSgK76KwrKz91bxmratLqUVND", + ], + }, + orai: { + owners: [ + "orai1qgk2pw8kd2u5rup4zszej2rk6kng4lendgvkn8", + "orai1sksdw8qx0xmgllfha0rzgjw8qy3jrkegvqr568", + "orai18wpvqfu9g0n8x3ysu72fcdtwz025tvg72nxll0", + "orai1pqe2j4znxd5c3hy56cc6hskt4kejrp43td5ja0", + "orai1906ngejrrhxlj4fygj2pr233hv573h7n92wt0e", + ], + }, + osmosis: { + owners: [ + "osmo12320efq3ns5sms0dq8wh0ljf6kzq57076xc9kk", + "osmo10p7dg5nh8kwjhfucq0uxjppg6wkevzmg67c4hx", + "osmo18wpvqfu9g0n8x3ysu72fcdtwz025tvg73mrvgw", + ], + }, + peaq: { + owners: [ + "0x706145b9639e4f3d5cf8b851ec36fdfda103579e", + "0xbc7dbbd20b5416967bcea28bf4f09d4c66107175", + "0x48d61d92e23c22a77131558470716831346d92d7", + "0xeb98a1e0059c89bf5938e87b14c6cc92269feadc", + ], + }, + persistence: { + owners: [ + "persistence14nqzsy36gua04ye2qdyvx2eyrgzd3f5vmrxwar", + "persistence16uazp0svz66y32pddvvxf2aj29x2js93xyaz28", + "persistence18wpvqfu9g0n8x3ysu72fcdtwz025tvg7hvk0sc", + "persistence1lctnzd6gky9eq0rkzvtr6anuy7p8tpysckczv9", + ], + }, + plasma: { + owners: [ + "0xb8e6d31e7b212b2b7250ee9c26c56cebbfbe6b23", + "0x99594065a27ce2905fef66d12dc09ea41e364f9e", + "0xc9586c986649c3b5722724a239965b4bdd92744e", + "0x17a30350771d02409046a683b18fe1c13ccfc4a8", + "0x2677c4c8757da1857cc7cc4071e0e0dd32ccb975", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + proton: { + owners: [ + "kucoinrise21", + "kucoinrise15", + "kucoinrise25", + "kucoinrise23", + "kucoinsscwc1", + "kucoinwarm1", + ], + }, + radixdlt: { + owners: [ + "account_rdx168m6px4dqaqtpyqhgr35f2zw54f80mtmxpzggvr2gwpx6l38uxlpge", + "account_rdx16x4ryh2tnlfxw3ezwuuktczgp7wekhy89szxgkqanqvf4ygpy0rley", + "account_rdx16xvsegdgs5u7jggrvekcmcle7mrcxntlk879qwntvw525dww0qnpnx", + "account_rdx169z44u9avlmqfkshpeav32p8sg955zsa4d8vs2qsy3ruey2p3xer7g", + ], + }, + robinhood: { + owners: [ + "0x88d25c861938a91af4ad57ad964a8fcc6c6351d3", + "0xd0a1f16bf2010985d861671293420d61f1d9130a", + ], + }, + ronin: { + owners: ["0xc5d17e2ce4f4abf69b4459a76c29b53039ddd3af"], + }, + scroll: { + owners: [ + "0xc968424cc26ba4e4a72f5754b17dac2474e42a6c", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + secret: { + owners: [ + "secret1vn87zv6qwmxmqpf6mzlskp9pkp8dh0zxd23sj7", + "secret1n2y70u8za3gl505zlsjavdve88xr5ehdfkkhre", + "secret18mtxm24tr3puw2jug2xw75xag9c4zdk6pk7ttp", + "secret18wpvqfu9g0n8x3ysu72fcdtwz025tvg7m9y4rq", + "secret1uer4mwcq2vlt8l23ncwyjj70mug5pzx8gackej", + ], + }, + sei: { + owners: [ + "0x40c1d64abc82a57c744bc501a9e1ed6053723d4e", + "0xd25b428933ee92223e54fa53fbc87c7079efa5cd", + "0x2403384a45edc33582ca845867828f2394987bde", + "0x151a38d1cbbd06656c01d15d40c6c99d68ea0624", + "0xe11aea8b65b5b8b381fde8131b074fc6cf7c60cc", + ], + }, + somnia: { + owners: [ + "0xdb8aeaaca68689bdbb78419810788a3efc596e53", + "0x1f083d6648a5d8e10bde3d3c4a864f7449e82915", + "0xb8e6d31e7b212b2b7250ee9c26c56cebbfbe6b23", + "0x17a30350771d02409046a683b18fe1c13ccfc4a8", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + sonic: { + owners: [ + "0x2677c4c8757da1857cc7cc4071e0e0dd32ccb975", + "0x17a30350771d02409046a683b18fe1c13ccfc4a8", + "0xfad35b5b1fc6733c78a0899623dd5951bf35b8e3", + "0xb8e6d31e7b212b2b7250ee9c26c56cebbfbe6b23", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0xd6216fc19db775df9774a6e33526131da7d19a2c", + ], + }, + stable: { + owners: [ + "0x7989056f8d7572548718ad9ed948ca6b32fa7255", + "0xa88efc5803b68fc619267bd300feeb777728cbcc", + "0x86f015821e62e954d75786bf19de585dcf9cf2d9", + "0xfb5b76d76d11a88497cc58d539e384c8a7a5748c", + "0xc88b2bd041809a79abbecd04037f3c0570cffb1e", + ], + }, + stacks: { + owners: [ + "SM35H18GNE8MEB1TS3QS09Y2ESQY6GM2219GG670S", + "SP2KC7WYC3JF2DAE4NE3SWZBMTYGZC35WREHAGTQM", + "SM24DPG06S2Y51E95X3PH0VXN5TRT3C5Y32YVRZ4E", + "SP307BHDXSX759Z2XFAM405REWVFJK05HKG7BWRQB", + "SPGZRPG97X81CZE5AJAN4PYS4NFDG1Z1K4Z2RXNT", + "SP3VQ46Q89ASA5994CES2P0SQDK4BQZ6EKG0845CX", + "SP2G4JFB3WWBWPVGEDNBTMEVJB6DNDR468G0S03AX", + ], + }, + stellar: { + owners: [ + "GCUAZB7ELECT4IVTNXYIDL4BVTJCNBAMX7MZLV4SOQ52Y6XOFVMOHBTB", + "GDD6POABV35RYNBQJK2CPJV2XZR6VXZ2F3KSRGVKIKQOKZO4NIRZP226", + "GCXZDLDI4BO3RHIYBS22RZXB5LGRRLTZUSPG6ANQQ36TVL2ASHC4ONZO", + "GA7DVZITWRP3RE2FC42H4WGJKOF6JF2PZIDNCRFS62CB6JJRWFFUNDH5", + "GCI6IKZN5OK64U5J5CC3A3QGILRROJIOK3LTQS7V2UHT7PKJ2NJSFCDB", + "GBBTDPPE5K7PHVAZZQOT6JME4AYZ4UQM2QK2UJTDIANC6EDPACWBHIU6", + ], + }, + stratis: { + owners: [ + "0xd6cfb64017339cb97c4b931586da506854826661", + "0xc02b236723c8d4883804fc961db3740c7d562947", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + sty: { + owners: [ + "0x5ba37d2e7fc5e408726a29c7373d5eb0e7095bb0", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + supra: { + owners: [ + "0xa1e2b590380d05d419fa5780dcc9ec3b4f6c5c1f4569178d2e66a84ac6576fb7", + "0x1a8340ee9c1cff5a061142b35faa7014e9890f4ab7122b175f457be56754f924", + ], + }, + taiko: { + owners: [ + "0xe8f41d2b3ef5216db410ddefdeeec6fcb20fcaff", + "0x89611a78176571bad8081159a2e048f91cf7ac83", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0xd6216fc19db775df9774a6e33526131da7d19a2c", + ], + }, + telos: { + owners: [ + "0xe66ed8d0709f6a3481b40293b03c9512464c2481", + "0x48db238b9ceb0a030ad8c0b8ac159cf4565fe586", + "0xd6216fc19db775df9774a6e33526131da7d19a2c", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + terra: { + owners: [ + "terra1chq5ps8yya004gsw4xz62pd4psr5hafe7kdt6d", + "terra1xv8sr6u5pxpqq5pw6k0w34cn8gsqdr2k9svg67", + "terra1v74a5u6qsjuj4gu6at9yn4p35uctcz82f02fau", + "terra1zeu0zc22mssqtd9jp9cxrr8du8tuulxjearh5v", + "terra1hmlj3nx00ntk8ja0lj6et9uxq2mxnzzvasrg3p", + ], + }, + terra2: { + owners: [ + "terra1wkzypd82gk7azdrxrj7xml0gr8sf3lzwlsja37", + "terra172frnpllrra3855emkrmdusmravgr3mvp290ca", + "terra1hkax4gqc4jx95ukafnsyyw720c26p82cmrmgny", + "terra1zwu8mhagk935ad9pfqnqrggrrt26mmqspj7rxz", + "terra1tr2l367x265yl8weqakdkjvgpwdpm69zv2xpnl", + "terra1chq5ps8yya004gsw4xz62pd4psr5hafe7kdt6d", + "terra1ew8srns90g9lnqm3kf2u9zgn5jzunwz9ulgmx0", + ], + }, + tezos: { + owners: [ + "tz1bysy7fby4rdaptXPYc7XP3C7EpqVVVWo5", + "tz1Q7RpsRvbozbY5zuhv5AaXuoqeXrcFAtgF", + "tz1csYsqZ6Bp3PFuuPvd1kSdtw7zNM2TWhbQ", + ], + }, + theta: { + owners: [ + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + "0x5a722d3c43e5e5cec5dd91391594309829ae0a24", + "0x019f29ad016ae793607a3dff0f1b9f01fb793378", + ], + }, + thorchain: { + owners: [ + "thor1xngk03ck0u960nlepy9256e0q7r7l43mnd5thk", + "thor17nswsvke389v582ec9navcpyylfdssds67u6ul", + "thor1q4p5gq9xp52jyqma0tvgn5dt47trs8um8zcr35", + "thor13zye660dphuvcnuwwwjwcdx9mz83peteek7s75", + "thor1vm7duapvw48hcat699858sykmsk9dxltjdqyly", + ], + }, + vana: { + owners: ["0x68a0e55a076bcdbcbf38ee70b4e6f6f6f45d7c31"], + }, + vechain: { + owners: [ + "0x1729b0db1bb51bc568a6a8d53711abfb2cdc4716", + "0x930f4c41078e0bde990073a1d6b1e4c09145870f", + "0x0452042e4f2f41ca85cc463ea9a9e452214f2beb", + "0x3fb604a9b40e4c1abf0eb91a67bb90fc06dfb27e", + ], + }, + wc: { + owners: [ + "0x1ab66b75cf4a326168f2780bd354222faef9b9a2", + "0x538f4c206853212c5681512957018a153578ab42", + ], + }, + wemix: { + owners: [ + "0x5b389714c274c2c1fe0aaf9760f9415fedc3eb36", + "0x0d55f8d93c69aaf5bd361ec75f1ac53180d19609", + "0xd6216fc19db775df9774a6e33526131da7d19a2c", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + xdc: { + owners: [ + "0xdab9de282d519165326fad804f6acf6fd0e61840", + "0xbc7dbbd20b5416967bcea28bf4f09d4c66107175", + "0xf418bc9c19a1d78fb0a7a26935c2068cce50d7fd", + "0x4e5d2ddf1c5060a64d70eec1731710f49a76d2bf", + "0x68aeda45a5c9307b8fcb6919dd17ff64840c1e94", + ], + }, + xion: { + owners: ["xion1gfv29l274e8dy9dkur6aqh9ert96gfxqwdexp0"], + }, + zcash: { + owners: [ + "t3U4CFPtnLoAjL9fSsQE2PMc49RAGbmfn5n", + "t1YjihZAttWbUQJYGgwhEvdGJLbTVcVGGez", + "t1YQV51DKzKP63xJcynXuRfryMjfmgTJ7Jc", + "t1f4ohjSbYLpXHGMVs5hyPrNXkU8aCaRXf4", + ], + }, + zeta: { + owners: [ + "0x1870897f168ec0acdbd326cc6a76b1bdc4b6b670", + "0x2933782b5a8d72f2754103d1489614f29bfa4625", + ], + }, + zigchain: { + owners: [ + "zig1455xp0cwksuug8jclrajrt3x0yzf6v08dpx0nf", + "zig1lg7n0dh387mcv8zvhyyuaha4dm47fnq34vpz40", + ], + }, + zilliqa: { + owners: [ + "0xc59b1517779c68776e5b126ccfc8738ab409a29f", + "0xcfd030ef4c58fc573a61668fa3c8e295738c9a1b", ], }, }; From 2e9f4cbe32356bec070146961afc0918a13319d1 Mon Sep 17 00:00:00 2001 From: guanacofi Date: Thu, 26 Nov 2026 06:57:19 -0300 Subject: [PATCH 922/988] Add Guanaco TVL on Bitcoin Cash (#22395) Co-authored-by: guanacofi <329703330+guanacofi@users.noreply.github.com> Co-authored-by: ccipherx --- projects/guanaco/index.js | 439 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 439 insertions(+) create mode 100644 projects/guanaco/index.js diff --git a/projects/guanaco/index.js b/projects/guanaco/index.js new file mode 100644 index 00000000000..525706eb581 --- /dev/null +++ b/projects/guanaco/index.js @@ -0,0 +1,439 @@ +const WebSocket = require('ws') +const crypto = require('crypto') + +const GRAPHQL_ENDPOINTS = [ + 'https://gql.chaingraph.pat.mn/v1/graphql', + 'https://demo.chaingraph.cash/v1/graphql', +] + +const ROSTRUM_ENDPOINTS = [ + 'wss://cashnode.bch.ninja:50004', + 'wss://fulcrum.greyh.at:50004', + 'wss://electrum.imaginary.cash:50004', + 'wss://bch.imaginary.cash:50004', + 'wss://bch.loping.net:50004', + 'wss://fulcrum.cashpeak.net', +] + +// This identifies the Guanaco pool protocol, not the GUA token. Every +// Guanaco CashToken market is included (GUA, PUSD, MUSD, and future tokens). +const GUANACO_PREFIX = '6a064755414e4143' +const GUANACO_GENESIS_BLOCK = 869145 +// GUA, the protocol token, is counted under staking +const GUA_KEY = 'bitcoincash:742a7585d0d5cb35b2a45d26425e23b059b72e82d7036dd97e85da5ab57a8d6c' +const PAGE_SIZE = 1000 +const REQUEST_TIMEOUT_MS = 15000 + +// Guanaco v1 has four public fee-level covenant variants. The genesis +// OP_RETURN contains the creator PKH; the P2SH32 output is accepted only when +// its hash matches one of these current contracts. This excludes legacy +// pre-v1 contracts that can still appear in GUANAC-marked transactions. +const GUANACO_REDEEM_TEMPLATES = [ + '746376a914{creator}88ac67c0d1c0ce88c25288c0cdc0c788c0c6c0cc949002102796765a96c48cc09476cc5279a269cd1976a914748e3dffdc1ab726e8d7d8d381e56034871fe62388ac8894c0c6c0d095c0cc527994c0d395a17768', + '746376a914{creator}88ac67c0d1c0ce88c25288c0cdc0c788c0c6c0cc9490559502102796765a96c48cc09476cc5279a269cd1976a914748e3dffdc1ab726e8d7d8d381e56034871fe62388ac8894c0c6c0d095c0cc527994c0d395a17768', + '746376a914{creator}88ac67c0d1c0ce88c25288c0cdc0c788c0c6c0cc9490539502e80396765a96c48cc09476cc5279a269cd1976a914748e3dffdc1ab726e8d7d8d381e56034871fe62388ac8894c0c6c0d095c0cc527994c0d395a17768', + '746376a914{creator}88ac67c0d1c0ce88c25288c0cdc0c788c0c6c0cc9490016496765a96c48cc09476cc5279a269cd1976a914748e3dffdc1ab726e8d7d8d381e56034871fe62388ac8894c0c6c0d095c0cc527994c0d395a17768', +] + +const POOL_GENESIS_QUERY = ` + query GuanacoGenesis( + $prefixFilter: String! + $fromBlock: bigint! + $limit: Int! + $offset: Int! + ) { + search_output_prefix( + args: { locking_bytecode_prefix_hex: $prefixFilter } + where: { + transaction: { + block_inclusions: { + block: { + accepted_by: { node: { name: { _regex: "mainnet" } } } + height: { _gt: $fromBlock } + } + } + } + } + limit: $limit + offset: $offset + ) { + transaction { hash encoded_hex } + } + } +` + +function timeoutPromise(promise, label) { + let timer + const timeout = new Promise((_, reject) => { + timer = setTimeout(() => reject(new Error(`${label} timed out`)), REQUEST_TIMEOUT_MS) + }) + return Promise.race([promise, timeout]).finally(() => clearTimeout(timer)) +} + +async function postGraphql(endpoint, variables) { + const response = await timeoutPromise( + fetch(endpoint, { + method: 'POST', + headers: { 'content-type': 'application/json' }, + body: JSON.stringify({ query: POOL_GENESIS_QUERY, variables }), + }), + `Chaingraph request to ${endpoint}` + ) + + if (!response.ok) throw new Error(`Chaingraph returned HTTP ${response.status}`) + const payload = await response.json() + if (payload.errors?.length) { + throw new Error(payload.errors.map((error) => error.message).join(', ')) + } + const rows = payload.data?.search_output_prefix + if (!Array.isArray(rows)) throw new Error('Missing genesis query results') + return rows +} + +async function discoverGenesisTransactions() { + for (const endpoint of GRAPHQL_ENDPOINTS) { + const transactions = new Map() + try { + for (let offset = 0; ; offset += PAGE_SIZE) { + const page = await postGraphql(endpoint, { + prefixFilter: GUANACO_PREFIX, + fromBlock: GUANACO_GENESIS_BLOCK, + limit: PAGE_SIZE, + offset, + }) + + for (const entry of page) { + const transaction = entry.transaction + if (transaction?.hash && transaction.encoded_hex) { + transactions.set(transaction.hash, transaction.encoded_hex) + } + } + + if (page.length < PAGE_SIZE) break + } + + if (transactions.size > 0) return [...transactions.values()] + } catch (_) { + // Try the next public Chaingraph endpoint. + } + } + + throw new Error('Unable to discover Guanaco genesis transactions') +} + +function normalizeHex(value) { + return String(value).replace(/^0x/i, '').replace(/\\x/gi, '').replace(/[^0-9a-f]/gi, '').toLowerCase() +} + +function readVarInt(hex, offset) { + const first = Number.parseInt(hex.slice(offset, offset + 2), 16) + if (first < 0xfd) return [first, offset + 2] + const bytes = first === 0xfd ? 2 : first === 0xfe ? 4 : 8 + let value = 0n + for (let index = 0; index < bytes; index++) { + value |= BigInt(Number.parseInt(hex.slice(offset + 2 + index * 2, offset + 4 + index * 2), 16)) << BigInt(index * 8) + } + return [Number(value), offset + 2 + bytes * 2] +} + +function extractOutputScripts(transactionHex) { + const hex = normalizeHex(transactionHex) + let offset = 8 // version + let inputCount + ;[inputCount, offset] = readVarInt(hex, offset) + for (let index = 0; index < inputCount; index++) { + offset += 72 // previous outpoint + let scriptLength + ;[scriptLength, offset] = readVarInt(hex, offset) + offset += scriptLength * 2 + 8 // scriptSig + sequence + } + + let outputCount + ;[outputCount, offset] = readVarInt(hex, offset) + const scripts = [] + for (let index = 0; index < outputCount; index++) { + offset += 16 // value + let scriptLength + ;[scriptLength, offset] = readVarInt(hex, offset) + scripts.push(hex.slice(offset, offset + scriptLength * 2)) + offset += scriptLength * 2 + } + return scripts +} + +function doubleSha256(hex) { + const first = crypto.createHash('sha256').update(Buffer.from(hex, 'hex')).digest() + return crypto.createHash('sha256').update(first).digest('hex') +} + +function isCurrentGuanacoContract(hash, creator) { + return GUANACO_REDEEM_TEMPLATES.some((template) => { + const redeemScript = template.replace('{creator}', creator) + return doubleSha256(redeemScript) === hash + }) +} + +function convertBits(data, fromBits, toBits, pad = true) { + let accumulator = 0 + let bits = 0 + const output = [] + const maxValue = (1 << toBits) - 1 + const maxAccumulator = (1 << (fromBits + toBits - 1)) - 1 + + for (const value of data) { + if (value < 0 || value >> fromBits) throw new Error('Invalid CashAddr data') + accumulator = ((accumulator << fromBits) | value) & maxAccumulator + bits += fromBits + while (bits >= toBits) { + bits -= toBits + output.push((accumulator >> bits) & maxValue) + } + } + + if (pad) { + if (bits > 0) output.push((accumulator << (toBits - bits)) & maxValue) + } else if (bits >= fromBits || ((accumulator << (toBits - bits)) & maxValue)) { + throw new Error('Invalid CashAddr padding') + } + + return output +} + +function polymod(values) { + const generators = [ + 0x98f2bc8e61, + 0x79b76d99e2, + 0xf33e5fb3c4, + 0xae2eabe2a8, + 0x1e4f43e470, + ] + let checksum = 1n + for (const value of values) { + const top = checksum >> 35n + checksum = ((checksum & 0x07ffffffffn) << 5n) ^ BigInt(value) + for (let index = 0; index < generators.length; index++) { + if ((top >> BigInt(index)) & 1n) checksum ^= BigInt(generators[index]) + } + } + return checksum +} + +function prefixExpand(prefix) { + return [...prefix].map((character) => character.charCodeAt(0) & 31).concat(0) +} + +function encodeCashAddress(hash256) { + const prefix = 'bitcoincash' + // Rostrum's include_tokens method requires the token-aware CashAddr form. + // CashTokens adds 0x10 to the normal P2SH32 version (0x0b), yielding 0x1b. + // The version byte is converted together with the hash, as required by the + // CashAddr bit-grouping rules. + const version = 0x1b + const payload = convertBits([version, ...Buffer.from(hash256, 'hex')], 8, 5) + const checksum = [] + const values = prefixExpand(prefix).concat(payload, [0, 0, 0, 0, 0, 0, 0, 0]) + const mod = polymod(values) ^ 1n + for (let index = 0; index < 8; index++) { + checksum.push(Number((mod >> BigInt(5 * (7 - index))) & 31n)) + } + const charset = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l' + return `${prefix}:${[...payload, ...checksum].map((value) => charset[value]).join('')}` +} + +function extractPoolAddresses(encodedTransaction) { + const scripts = extractOutputScripts(encodedTransaction) + const marker = '6a064755414e4143' + const markerOutput = scripts.find((script) => script.startsWith(marker)) + const creator = markerOutput?.startsWith(`${marker}14`) + ? markerOutput.slice(marker.length + 2, marker.length + 2 + 40) + : null + if (!creator) return [] + + const addresses = new Set() + + // A CashToken P2SH32 pool output contains the canonical script: + // OP_HASH256 PUSH32 OP_EQUAL (aa20...87). + for (const script of scripts) { + for (let offset = 0; offset + 70 <= script.length; offset += 2) { + if (script.slice(offset, offset + 4) !== 'aa20') continue + const hash = script.slice(offset + 4, offset + 68) + if (script.slice(offset + 68, offset + 70) !== '87') continue + if (offset + 70 !== script.length || !isCurrentGuanacoContract(hash, creator)) continue + addresses.add(encodeCashAddress(hash)) + } + } + + return [...addresses] +} + +function connectRostrum(endpoint) { + return new Promise((resolve, reject) => { + const ws = new WebSocket(endpoint) + let isDone = false + const timer = setTimeout(() => { + if (!isDone) { + isDone = true + ws.terminate?.() || ws.close?.() + reject(new Error(`Rostrum connection to ${endpoint} timed out`)) + } + }, REQUEST_TIMEOUT_MS) + + const onOpen = () => { + if (!isDone) { + isDone = true + clearTimeout(timer) + ws.setMaxListeners?.(0) + resolve(ws) + } + } + + const onError = (error) => { + if (!isDone) { + isDone = true + clearTimeout(timer) + reject(error) + } + } + + if (ws.once) { + ws.once('open', onOpen) + ws.once('error', onError) + } else if (ws.addEventListener) { + ws.addEventListener('open', onOpen, { once: true }) + ws.addEventListener('error', onError, { once: true }) + } else { + ws.onopen = onOpen + ws.onerror = onError + } + }) +} + +function electrumRequest(ws, method, params, id) { + return new Promise((resolve, reject) => { + let timer + + function cleanup() { + clearTimeout(timer) + if (ws.off) { + ws.off('message', onMessage) + ws.off?.('error', onError) + ws.off?.('close', onClose) + } else if (ws.removeEventListener) { + ws.removeEventListener('message', onMessage) + ws.removeEventListener('error', onError) + ws.removeEventListener('close', onClose) + } + } + + timer = setTimeout(() => { + cleanup() + reject(new Error(`${method} timed out`)) + }, REQUEST_TIMEOUT_MS) + + function onMessage(event) { + const data = event?.data !== undefined ? event.data : event + let response + try { + response = JSON.parse(data.toString()) + } catch (_) { + return + } + if (response.id !== id) return + cleanup() + if (response.error) reject(new Error(JSON.stringify(response.error))) + else resolve(response.result) + } + + function onError(err) { + cleanup() + reject(err) + } + + function onClose() { + cleanup() + reject(new Error(`WebSocket closed during ${method}`)) + } + + if (ws.on) { + ws.on('message', onMessage) + ws.once?.('error', onError) + ws.once?.('close', onClose) + } else if (ws.addEventListener) { + ws.addEventListener('message', onMessage) + ws.addEventListener('error', onError, { once: true }) + ws.addEventListener('close', onClose, { once: true }) + } + ws.send(JSON.stringify({ jsonrpc: '2.0', id, method, params }) + '\n') + }) +} + +async function fetchPoolUtxos(addresses) { + let lastError + for (const endpoint of ROSTRUM_ENDPOINTS) { + let ws + try { + ws = await connectRostrum(endpoint) + const responses = await Promise.all( + addresses.map((address, index) => + electrumRequest(ws, 'blockchain.address.listunspent', [address, 'include_tokens'], index + 1) + ) + ) + return responses.flatMap((result) => (Array.isArray(result) ? result : result?.unspent || [])) + } catch (error) { + lastError = error + } finally { + ws?.close() + } + } + throw lastError || new Error('Unable to query Guanaco pool UTXOs') +} + +async function poolBalances() { + const genesisTransactions = await discoverGenesisTransactions() + // Do not filter by token category here: this is the TVL of the whole DEX, + // not only the GUA/BCH market. + const addresses = [ + ...new Set(genesisTransactions.flatMap(extractPoolAddresses)), + ] + if (addresses.length === 0) throw new Error('No Guanaco P2SH32 pool addresses found') + + const utxos = await fetchPoolUtxos(addresses) + const livePoolUtxos = new Map() + for (const utxo of utxos) { + const token = utxo.token_data + if (!token || BigInt(token.amount || 0) <= 0n) continue + if (token.nft || token.capability || token.commitment) continue + livePoolUtxos.set(`${utxo.tx_hash}:${utxo.tx_pos}`, utxo) + } + + let bchReserveSats = 0n + const tokenAmounts = new Map() + for (const utxo of livePoolUtxos.values()) { + const { category, amount } = utxo.token_data + if (!/^[a-f0-9]{64}$/.test(category)) throw new Error('Invalid CashToken category') + const key = `bitcoincash:${category}` + tokenAmounts.set(key, (tokenAmounts.get(key) || 0n) + BigInt(amount)) + bchReserveSats += BigInt(utxo.value) + } + const balances = { 'bitcoin-cash': Number(bchReserveSats) / 1e8 } + for (const [key, amount] of tokenAmounts) balances[key] = amount.toString() + return balances +} + +async function tvl() { + const balances = await poolBalances() + delete balances[GUA_KEY] + return balances +} + +async function staking() { + const balances = await poolBalances() + return balances[GUA_KEY] ? { [GUA_KEY]: balances[GUA_KEY] } : {} +} + +module.exports = { + methodology: + 'TVL counts the BCH and fungible CashToken reserves held by live Guanaco v1 pool UTXOs. Pools are found from GUANAC-marked pool genesis transactions and their balances are read from Electrum (Fulcrum/Rostrum) servers. GUA held in the pools is counted under staking.', + start: '2025-09-08', + bitcoincash: { tvl, staking }, +} From 86a74a53638d97c1cc3712c2a3b99dad5274f912 Mon Sep 17 00:00:00 2001 From: madeinzp <118499429+madeinzp@users.noreply.github.com> Date: Thu, 26 Nov 2026 11:57:49 +0200 Subject: [PATCH 923/988] Add POPULAR (Sui launchpad) TVL adapter (#22397) Co-authored-by: ccipherx --- projects/popular/index.js | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 projects/popular/index.js diff --git a/projects/popular/index.js b/projects/popular/index.js new file mode 100644 index 00000000000..3c8757f9032 --- /dev/null +++ b/projects/popular/index.js @@ -0,0 +1,61 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sui = require('../helper/chain/sui') + +// POPULAR, a memecoin launchpad on Sui: https://popularsui.xyz (contracts and data: https://popularsui.xyz/data/integrators) +// Type origins (the package that first defined each type; later upgrades keep these ids). +const CURVE = '0x918d32f8a0b349584e96113ec425708374161d4798f8c28d63362602831b33ef::curve::Curve' // SUI bonding curves +const QCURVE = '0xfe9f27187eff1c0d1bb236166df360d0c12be4c0bd99d40ce1d3a51771cbe428::qcurve::QCurve' // curves priced in USDC, wBTC, ETH, XAUM +const LEND = '0xed3220b79cb14da863fe5cb746a3a69a47c1be4080ddc60b63c1defdff98f8c3' // lending vaults and loans + +const typeArgs = (type) => sui.parseStructTag(type).typeParams + +// Quote coins raised on curves that have not graduated yet. A graduated curve's liquidity sits in a Cetus pool with its +// LP position burned, so it is counted by Cetus, not here; the launched tokens themselves are not counted. +async function curves(api) { + const sCurves = await sui.getObjectsByType(CURVE) + sCurves.forEach(i => api.add(ADDRESSES.sui.SUI, i.fields.sui_reserve)) + const qCurves = await sui.getObjectsByType(QCURVE) + qCurves.forEach(i => api.add(typeArgs(i.type)[1], i.fields.quote_reserve)) +} + +// POPULAR's own token. It is never TVL: POP held by the lending contracts is reported under staking instead. +const POP = '0xf37a4ca45f2e1f14352c24485aa774888ccb6ac969cde3ef3443ba7d9e957bba::pop::POP' +const isPop = (type) => type.replace(/^0x0*/, '') === POP.replace(/^0x0*/, '') + +// Lending: cash idle in the vaults, plus the collateral locked in open loans: peer-to-peer loans (`loan::Loan`) and +// the vaults' own loans and shorts (`safe::SafeLoan`). What is lent out is reported as borrowed. +// `pop` false adds every coin but POP, true adds POP only (for staking). +async function lending(api, pop) { + const add = (type, amount) => { if (isPop(type) === pop) api.add(type, amount) } + const vaults = await sui.getObjectsByType(`${LEND}::vault::Vault`) + vaults.forEach(i => add(typeArgs(i.type)[0], i.fields.cash)) + const loans = await sui.getObjectsByType(`${LEND}::loan::Loan`) + loans.forEach(i => add(typeArgs(i.type)[0], i.fields.collateral)) + const safeLoans = await sui.getObjectsByType(`${LEND}::safe::SafeLoan`) + safeLoans.forEach(i => add(typeArgs(i.type)[0], i.fields.collateral)) + // p2p market: lender funds in open offers, borrower collateral in open requests + const offers = await sui.getObjectsByType(`${LEND}::market::Offer`) + offers.forEach(i => add(typeArgs(i.type)[1], i.fields.funds)) + const requests = await sui.getObjectsByType(`${LEND}::market::Request`) + requests.forEach(i => add(typeArgs(i.type)[0], i.fields.collateral)) +} + +async function tvl(api) { + await curves(api) + await lending(api, false) +} + +async function staking(api) { + await lending(api, true) +} + +async function borrowed(api) { + const vaults = await sui.getObjectsByType(`${LEND}::vault::Vault`) + vaults.forEach(i => { const type = typeArgs(i.type)[0]; if (!isPop(type)) api.add(type, i.fields.lent) }) +} + +module.exports = { + timetravel: false, + methodology: 'TVL counts the quote coins (SUI, USDC and others) held by bonding curves that have not graduated yet, the cash in the lending vaults, the collateral locked in open loans (peer-to-peer and vault loans), and the funds and collateral in open peer-to-peer offers and requests. Graduated tokens trade in Cetus pools whose LP is burned, counted under Cetus. Borrowed is the principal lent out by the lending vaults. POP, the project\'s own token, is never TVL: POP in the lending contracts is reported as staking.', + sui: { tvl, borrowed, staking }, +} From 04d59c70880158479f159b003f55a6acfc14c8af Mon Sep 17 00:00:00 2001 From: maker lee <90006549+makerlee0x@users.noreply.github.com> Date: Thu, 26 Nov 2026 03:58:24 -0600 Subject: [PATCH 924/988] Add DISCIPLE (Robinhood Chain) TVL adapter (#22398) Co-authored-by: ccipherx --- projects/disciple/index.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 projects/disciple/index.js diff --git a/projects/disciple/index.js b/projects/disciple/index.js new file mode 100644 index 00000000000..82eeab955e6 --- /dev/null +++ b/projects/disciple/index.js @@ -0,0 +1,38 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { addUniV4PoolReserves, chainConfig } = require('../helper/uniswapV4') + +// https://disciple.vip/docs/reference/contracts +const LAUNCHPAD = '0xe43F360DC65C9Ba1B7a835BDaa10Fb31f6DC52E5' +const LOCKED_LP = '0xe3F8FeefF2ad0d6f4055cD90f91518C1331E1c4D' +const MIGRATION = '0x0fCD7FE98Eed9234A1d1c2aAb6AEec210809747b' +const TICK_SPACING = 60 // Migration.TICK_SPACING +const FROM_BLOCK = 118816228 + +const LAUNCHED = 'event Launched(address indexed token, address indexed curve, address indexed creator, address quote, string name, string ticker, uint256 creatorTaxBps)' +const MIGRATED = 'event Migrated(address indexed token, address indexed quote, bytes32 poolId, uint256 tokenAmount, uint256 quoteAmount, uint160 sqrtPriceX96)' + +async function tvl(api) { + const launches = await getLogs2({ api, target: LAUNCHPAD, eventAbi: LAUNCHED, fromBlock: FROM_BLOCK }) + const tokensAndOwners = launches.map((l) => [l.quote, l.curve]) + const quotes = [...new Set(launches.map((l) => l.quote.toLowerCase()))] + quotes.forEach((q) => tokensAndOwners.push([q, LOCKED_LP])) + await api.sumTokens({ tokensAndOwners }) + + const migrations = await getLogs2({ api, target: MIGRATION, eventAbi: MIGRATED, fromBlock: FROM_BLOCK }) + const pools = migrations.map((m) => { + const [token0, token1] = BigInt(m.token) < BigInt(m.quote) ? [m.token, m.quote] : [m.quote, m.token] + return { id: m.poolId, token0, token1, spacing: TICK_SPACING } + }) + // graduated pools: quote side only, launched coins are not counted + const launched = new Set(launches.map((l) => l.token.toLowerCase())) + const quoteSide = { multiCall: (...args) => api.multiCall(...args), add: (token, amount) => { if (!launched.has(token.toLowerCase())) api.add(token, amount) } } + await addUniV4PoolReserves({ api: quoteSide, pools, stateView: chainConfig.robinhood.stateView }) +} + +module.exports = { + doublecounted: true, // graduated pools sit in the Uniswap v4 PoolManager, also counted by uniswap-v4 + methodology: + 'Counts the quote tokens (USDG or the coin\'s pair token) held by every DISCIPLE bonding curve, found from Launchpad Launched events, plus quote held by LockedLP before it is added to a pool. For graduated coins it counts the quote side of their Uniswap v4 pools, found from Migration Migrated events. Launched coins are not counted.', + start: '2026-11-20', + robinhood: { tvl }, +} From ec056c43e4b08aa578e813542aab63a1c5f18b62 Mon Sep 17 00:00:00 2001 From: WEEX-BR <167861813+WEEX-BR@users.noreply.github.com> Date: Thu, 26 Nov 2026 18:15:29 +0800 Subject: [PATCH 925/988] Add eight WEEX reserve wallet entries across seven chains (#22400) --- cex/weex-cex.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cex/weex-cex.js b/cex/weex-cex.js index b0abbf75807..f9c9ddc92f1 100644 --- a/cex/weex-cex.js +++ b/cex/weex-cex.js @@ -2,6 +2,8 @@ module.exports = { ethereum: { ownTokens: ['0x1b66474c8eca3827f16202907f41f63785579716'], // WXT owners: [ + "0x7cBb29a07D63853EC09B84b41B6525354b2771b6", + "0x4dd41d72d53a7ccc240a00017673996e734b2f7f", "0x7bceb96a8757114d79c7dcd6b52c460202f17d13", "0xc3b77c3f5a733986558c91e0faf95f1659b1b9b6", "0x425c91fbde3d472279b914b7c4c9142266d35004", @@ -55,6 +57,7 @@ module.exports = { }, bsc: { owners: [ + "0x7cBb29a07D63853EC09B84b41B6525354b2771b6", "0xc3b77c3f5a733986558c91e0faf95f1659b1b9b6", "0x7cb8e2896234cbc8494f858e05be30b13ad5ddb7", "0xf7e38e6aa48ce79efa7694a1b9c5bb178253bd98", @@ -79,6 +82,7 @@ module.exports = { }, arbitrum: { owners: [ + "0x7cBb29a07D63853EC09B84b41B6525354b2771b6", "0xc3b77c3f5a733986558c91e0faf95f1659b1b9b6", "0x0b2b7edbdb241f11ce0a47374836a2a8643a7cf0", "0x9f6d65052ad5818768fcbac3b799a67f2b8e7170", @@ -103,6 +107,7 @@ module.exports = { }, tron: { owners: [ + "TKDQfaPfJ4crtk8hSz4N4zwefb5ApYf8y5", "TMyVbp3jMTdXpcjjxMZy7Xv4FeXTp4xXTf", "TLivLCvVQrUfSQcddhg23JDgM58ML91mQf", "TRqwFyiNwEnMUM85qC9tQqKDZh6dwo6yKd", @@ -120,6 +125,7 @@ module.exports = { }, solana: { owners: [ + "B6mPsnnuF8Kg5MxLLcGh5SheLkL1X8XFr4xjBSkud9ZM", "eKfAkykrMPx2CqhcbywnbTkpGAyfkppNvXQ2VPNiQWL", "Dw4JrqHdzh489rkQqf5RaATpyLBSJABwBb2C3PAYDQgX", "BCGzwLX1MmAosKrfMH1NauCSB6pej7uojeuNZrZCR9BL", @@ -160,4 +166,10 @@ module.exports = { op_bnb: { owners: ["0x1a715fddeef8cea02b5bcc451fc8913fe2781698"], }, + robinhood: { + owners: ["0x54e6741a081b107a713f87340c4e85d913429545"], + }, + linea: { + owners: ["0x66147b98457f3ccf04eb00eefbf88c7b21b24a9c"], + }, } From 4fe279a13648553f0ac1c55c86378a702733506d Mon Sep 17 00:00:00 2001 From: mrstark25 <69469600+mrstark25@users.noreply.github.com> Date: Thu, 26 Nov 2026 17:18:41 +0530 Subject: [PATCH 926/988] fix(sablier-lockup): exclude sparsely priced REG from xdai vesting (#21873) (#22401) --- projects/sablier-lockup/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/sablier-lockup/index.js b/projects/sablier-lockup/index.js index 06aec227e53..1f8eff9656e 100644 --- a/projects/sablier-lockup/index.js +++ b/projects/sablier-lockup/index.js @@ -47,6 +47,13 @@ const config = { ...SUBGRAPH_ENDPOINTS }; +// Tokens whose price feed is too sparse to value reliably: they only show up on the days a price exists, causing spikes +const blacklistedTokens = { + xdai: [ + '0x0aa1e96d2a46ec6beb2923de1e61addf5f5f1dce', // REG (RealToken Ecosystem Governance), 50M locked, see #21873 + ], +}; + const subgraphPayload = ` { contracts { id address category } @@ -70,9 +77,11 @@ async function getTokensConfig(api, isVesting) { const owners = contracts.map(i => i.address); + const blacklist = blacklistedTokens[api.chain] || []; const tokens = assets .filter(asset => isWhitelistedToken(asset.symbol, asset.id, isVesting)) - .map(asset => asset.id.split('-')[2]); + .map(asset => asset.id.split('-')[2]) + .filter(token => !blacklist.includes(token.toLowerCase())); const ownerTokens = owners.map(owner => [tokens, owner]); return { ownerTokens }; From 044634857d0fc4d969aff9ef796a97d9b833acb2 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Thu, 26 Nov 2026 08:43:45 -0400 Subject: [PATCH 927/988] add sentora hub to aave v4 (#22408) --- projects/aave-v4/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/aave-v4/index.js b/projects/aave-v4/index.js index e75eb1efc22..bf3047c946f 100644 --- a/projects/aave-v4/index.js +++ b/projects/aave-v4/index.js @@ -6,6 +6,7 @@ module.exports = aaveV4Export({ "0x06002e9c4412CB7814a791eA3666D905871E536A", // Plus Hub "0x943827DCA022D0F354a8a8c332dA1e5Eb9f9F931", // Prime Hub "0x62d63197660c080236193CA60b70E49A08E90368", // Global Dollar Hub + "0xD138FcB0E8C52fDbB2Ac4573FA4d8925cf11e9c2", // Sentora Hub ], base: [ "0xa4d5947Eb727A052bae69C593FfC84247EC9864E", // Equities Hub From 8c18bdf6ef2cb0227f82a83462a7552539ce8518 Mon Sep 17 00:00:00 2001 From: bheluga Date: Thu, 26 Nov 2026 15:30:58 +0000 Subject: [PATCH 928/988] track pear vaults tvl (#22410) --- projects/pear-vaults/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/pear-vaults/index.js diff --git a/projects/pear-vaults/index.js b/projects/pear-vaults/index.js new file mode 100644 index 00000000000..82848d40c06 --- /dev/null +++ b/projects/pear-vaults/index.js @@ -0,0 +1,12 @@ +const factory = '0x038b9e0eef0f926682d3a9b1918611efec9cc741' + +async function tvl(api) { + const vaults = await api.fetchList({ lengthAbi: 'uint256:getVaultCount', itemAbi: 'function getVault(uint256) view returns (address)', target: factory }) + return api.erc4626Sum({ calls: vaults, isOG4626: true, permitFailure: true }) +} + +module.exports = { + methodology: 'Sum of totalAssets() across all Pear vaults deployed by the vault factory on HyperEVM. Deposited USDC is moved to HyperCore trading accounts and valued on-chain by the vault contract.', + doublecounted: true, // idle USDC in the HyperCore trading accounts is supplied to Hyperliquid Earn + hyperliquid: { tvl }, +} From ea9fe7efd2bbdd0e3ad31adae0eb4e9a12ff9293 Mon Sep 17 00:00:00 2001 From: stoxesfun Date: Thu, 26 Nov 2026 15:32:17 +0000 Subject: [PATCH 929/988] Add Stoxes.fun TVL (BSC launchpad) (#22404) Co-authored-by: Cursor Agent Co-authored-by: stoxesfun Co-authored-by: FelixBruguera --- projects/stoxes-fun/index.js | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 projects/stoxes-fun/index.js diff --git a/projects/stoxes-fun/index.js b/projects/stoxes-fun/index.js new file mode 100644 index 00000000000..bbc06572b1c --- /dev/null +++ b/projects/stoxes-fun/index.js @@ -0,0 +1,41 @@ +// Stoxes.fun bonding-curve launchpad on BNB Chain (https://stoxes.fun) +// Deployments, from the deployment registry in the stoxes.fun frontend bundle. +// Current Portal source (verified): https://sourcify.dev/server/v2/contract/56/0x5515ec89047e91ed6f639f23fddf784293cdfcb5 +const { sumTokens2 } = require('../helper/unwrapLPs') + +const deployments = [ + { factory: '0xdfb1afc6dabcbc23e5a3fd09c8a0137112f58f96', portal: '0xbe446b5baaaa003121b1196b01a1476a1ccaacc0' }, // legacy, launches closed + { factory: '0x9b8b27cbfde73289f1e65065df4712e91241588f', portal: '0x5515ec89047e91ed6f639f23fddf784293cdfcb5' }, // current +] +// (kind, quoteToken, graduated, finalized, sold, quoteReserve). BNB-quoted tokens report WBNB as quote. +const tokenStateAbi = 'function tokenState(address) view returns (uint8 kind, address quoteToken, bool graduated, bool finalized, uint256 sold, uint256 quoteReserve)' + +// The factories expose allTokens(uint256) with no length getter, so read in batches until a call reverts +async function getAllTokens(api, factory) { + const tokens = [] + const BATCH = 50 + for (let i = 0; ; i += BATCH) { + const res = await api.multiCall({ target: factory, abi: 'function allTokens(uint256) view returns (address)', calls: Array.from({ length: BATCH }, (_, j) => i + j), permitFailure: true }) + const found = res.filter(Boolean) + tokens.push(...found) + if (found.length < BATCH) break + } + return tokens +} + +async function tvl(api) { + const tokensAndOwners = [] + for (const { factory, portal } of deployments) { + const tokens = await getAllTokens(api, factory) + const states = await api.multiCall({ target: portal, abi: tokenStateAbi, calls: tokens }) + // tokenState is only used to discover the quote tokens; the Portal's balance of each is what is counted + states.forEach((s) => tokensAndOwners.push([s.quoteToken, portal])) + } + return sumTokens2({ api, tokensAndOwners }) +} + +module.exports = { + methodology: 'Counts the quote tokens (BNB and Binance tokenized stocks such as BNCB, NVDAB, SPCXB) held by the Stoxes.fun Portals. Quote tokens are discovered from Portal.tokenState for every token the factories have launched. Graduated liquidity on PancakeSwap and launched-token inventory are excluded.', + start: '2026-10-20', + bsc: { tvl }, +} From 083b6ba57b321d18ccef4ed0cd2ad69d2e3483a5 Mon Sep 17 00:00:00 2001 From: mrstark25 <69469600+mrstark25@users.noreply.github.com> Date: Thu, 26 Nov 2026 23:49:54 +0530 Subject: [PATCH 930/988] fix(layer-zero): exclude WPAY and COCA full-supply escrows on polygon (#22402) (#22409) --- projects/layer-zero/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/layer-zero/index.js b/projects/layer-zero/index.js index 99be00f4617..ebcf3089d1c 100644 --- a/projects/layer-zero/index.js +++ b/projects/layer-zero/index.js @@ -53,6 +53,15 @@ const WRAPPER_ESCROWS = new Set([ 'hyperliquid:0x904861a24f30ec96ea7cfc3be9ea4b476d237e98', // USDT0.s ]) +// Tokens whose issuer moved (nearly) the whole supply into its own OFT escrow. There is no circulating +// float or market behind them, so counting the escrow balance books the token's full FDV as TVL (#22402). +const BLACKLISTED_TOKENS = { + polygon: [ + '0x7abe9edf5c544a04da83e9110cf46dbc4759170c', // WPAY, 99.7% of supply in escrow 0xf168376569850ab69501e8b13b42f261917a02c3 + '0x7b12598e3616261df1c05ec28de0d2fb10c1f206', // COCA, 99.6% of supply in escrow 0x283fba7a6e3a2fcf3a887f22ff6bdf202d446f5f + ], +} + function getEscrows(meta, chain) { const tokens = meta[CHAIN_MAP[chain] || chain]?.tokens || {} const escrows = [] @@ -94,7 +103,7 @@ async function tvl(api) { tokensAndOwners.push([underlying, proxy]) } - await sumTokens2({ api, tokensAndOwners }) + await sumTokens2({ api, tokensAndOwners, blacklistedTokens: BLACKLISTED_TOKENS[api.chain] }) } async function tronTvl(api) { From e22b86975126cbd25b00c1de9d9ea25021c4deb5 Mon Sep 17 00:00:00 2001 From: jilee1212 <129253463+jilee1212@users.noreply.github.com> Date: Fri, 27 Nov 2026 04:53:11 +0900 Subject: [PATCH 931/988] add Lumina Perps (bsc) (#22412) --- projects/lumina-perps/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/lumina-perps/index.js diff --git a/projects/lumina-perps/index.js b/projects/lumina-perps/index.js new file mode 100644 index 00000000000..8aba7e0ad29 --- /dev/null +++ b/projects/lumina-perps/index.js @@ -0,0 +1,18 @@ +// Lumina Perps (BNB Chain) +// TVL = USDT held by the trader margin vault, the LP vault (LLP) and every leader vault created by the factory. +// The fee collector balance is protocol revenue, not user funds, and is left out. +const ADDRESSES = require('../helper/coreAssets.json') + +const VAULT = '0x9430B44187c0C6cd4DabD3c3be89B5c6B9f22272' // LuminaVault (trader margin) +const LLP = '0xf91b7467974692E5dB27D1a99Ab7cd6dc6356438' // LuminaLPVault (counterparty liquidity) +const FACTORY = '0xf184306a92c8d2744eaCB8acD08d1298d4b6607E' // VaultFactory (leader vaults) + +async function tvl(api) { + const leaderVaults = await api.call({ target: FACTORY, abi: 'function getAllVaults() view returns (address[])' }) + return api.sumTokens({ owners: [VAULT, LLP, ...leaderVaults], tokens: [ADDRESSES.bsc.USDT] }) +} + +module.exports = { + methodology: 'USDT held on-chain by the Lumina Perps margin vault, the LP vault (LLP) and leader vaults on BNB Chain.', + bsc: { tvl }, +} From 150eddee187a821429bb33848e9f6ac77ff12a0e Mon Sep 17 00:00:00 2001 From: Nicolas Chamo Date: Thu, 26 Nov 2026 17:06:53 -0300 Subject: [PATCH 932/988] fix(zk-money): count Aztec Tierra portals via PortalFactory events (#22411) Co-authored-by: FelixBruguera --- projects/zk-money/index.js | 41 +++++++++++++++++++++++++++++++++++ registries/sumTokens/data1.js | 5 ----- 2 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 projects/zk-money/index.js diff --git a/projects/zk-money/index.js b/projects/zk-money/index.js new file mode 100644 index 00000000000..37947dfb8ae --- /dev/null +++ b/projects/zk-money/index.js @@ -0,0 +1,41 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') + +// Each source resolves to (token, portal) pairs. Keep old sources while their portals hold funds. +const PORTAL_SOURCES = [ + // Aztec Alpha v5 + fixed({ token: ADDRESSES.ethereum.DAI, portal: '0xdf410ad448A0f7165181FBdB32f8896f4a0d9449' }), + fixed({ token: ADDRESSES.ethereum.sUSDS, portal: '0xd7ae00b91ba0b8e0240b22cd75fe447d177c260f' }), + + // Aztec Tierra (Alpha v6) + portalFactory({ factory: '0xceae64c7211a2208affc4f396add1d46996cd2a2', fromBlock: 26276689 }), +] + +function fixed({ token, portal }) { + return async () => [[token, portal]] +} + +function portalFactory({ factory, fromBlock }) { + return async (api) => { + const logs = await getLogs2({ + api, + factory, + fromBlock, + eventAbi: 'event PortalDeployed(address indexed portal, address indexed underlying, bytes32 l2Token, (uint128 txAmountCap, uint256 rate, uint256 globalLimit) caps)', + }) + return logs.map(({ underlying, portal }) => [underlying, portal]) + } +} + +async function tvl(api) { + const tokensAndOwners = [] + for (const source of PORTAL_SOURCES) tokensAndOwners.push(...(await source(api))) + return api.sumTokens({ tokensAndOwners }) +} + +module.exports = { + start: '2026-09-25', + methodology: + "TVL is the tokens (DAI, sUSDS, steakUSDC) held by zk.money's Ethereum portals, which back private balances on Aztec.", + ethereum: { tvl }, +} diff --git a/registries/sumTokens/data1.js b/registries/sumTokens/data1.js index 25fd0b4de41..478964c83b5 100644 --- a/registries/sumTokens/data1.js +++ b/registries/sumTokens/data1.js @@ -327,11 +327,6 @@ module.exports = { "start": "2026-04-10", "ethereum": { "owner": "0x57C3571f10767E49C9d7b60feb6c67804783B7aE", "tokens": ["0x27f6c8289550fCE67f6B50BeD1F519966aFE5287"] }, }, - "zk-money": { - "start": "2026-09-25", - "methodology": "TVL is the DAI held in zk.money's Ethereum portal, which backs private DAI balances on Aztec. USDC and USDT deposits are swapped to DAI before entering the portal.", - "ethereum": { "owner": "0xdf410ad448A0f7165181FBdB32f8896f4a0d9449", "tokens": [ADDRESSES.ethereum.DAI] }, - }, "aeva-bridge": { "methodology": "TVL counts the USDG locked in the Aeva bridge's Hyperlane collateral router on Robinhood Chain, which backs aeUSD on Aeva Mainnet. $AEVA locked in the AEVA router is Aeva's own token and is counted under staking.", "start": "2026-09-28", From d148a34232324413d9618cdcc301ef50a7bef3dc Mon Sep 17 00:00:00 2001 From: Ben Mannathara <120158476+nanami-senpei@users.noreply.github.com> Date: Fri, 27 Nov 2026 14:10:14 +0530 Subject: [PATCH 933/988] Propbase: add the Lend pool to TVL and report borrowed (#22415) Co-authored-by: Claude Opus 5.5 Co-authored-by: ccipherx --- projects/propbase/index.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/projects/propbase/index.js b/projects/propbase/index.js index 9e18e5c1f51..c3c4ada56b2 100644 --- a/projects/propbase/index.js +++ b/projects/propbase/index.js @@ -11,19 +11,22 @@ const getData = () => getConfig('propbase/config', `https://contractaddress.prop module.exports = { timetravel: false, misrepresentedTokens: true, - methodology: `TVL includes USDC tokens deposited in Nova pools (RWA) and Rental pools. + methodology: `TVL includes USDC tokens deposited in Nova pools (RWA), Rental pools and the Lend pool. RWA assets are paired with USDC in on - chain liquidity pools built on Trader Joe’s CLMM contracts, which allows users to buy and sell property tokens directly against USDC. Redemption is AMM- based and depends on pool liquidity and active price bins, - not a guaranteed 1: 1 stablecoin redemption.PROPS tokens are reported separately under staking.`, + not a guaranteed 1: 1 stablecoin redemption.PROPS tokens are reported separately under staking. + Lend: TVL counts the USDC held by the Lend contract (lender deposits not yet lent out, plus the interest reserve). + USDC lent to borrowers is reported under borrowed. Property tokens pledged as collateral stay in the + borrower's wallet and are already counted in the RWA value, so they are not counted again.`, aptos: { tvl: async (api) => { const chain = "aptos"; const data = await getData(); - // --- RWA (Nova) and Rental pools hold plain USDC: one indexer query covers every pool --- - api.addBalances(await sumTokens({ api, owners: [...data.NOVA_POOLS, ...data.RENTAL_POOLS], tokens: [USDC_FA] })) + // --- RWA (Nova), Rental and Lend pools hold plain USDC: one indexer query covers every pool --- + api.addBalances(await sumTokens({ api, owners: [...data.NOVA_POOLS, ...data.RENTAL_POOLS, ...data.LEND_POOLS], tokens: [USDC_FA] })) // ---- RWA assets current values in USDC --- for (const pool of data.RWA_POOLS) { @@ -71,5 +74,17 @@ module.exports = { const balances = await sumTokens({ api, owners: data.STAKING_POOLS, tokens: [PROPS_COIN] }) api.add(PROPS_FA, balances[`aptos:${PROPS_COIN}`] ?? 0) }, + + borrowed: async (api) => { + const data = await getData(); + // get_pool_utilization returns [pool value, borrowed, cash] in raw USDC + for (const lendPool of data.LEND_POOLS) { + const [, borrowed] = await function_view({ + functionStr: `${lendPool}::propbase_lend::get_pool_utilization`, + chain: "aptos", + }); + api.add(USDC_FA, borrowed); + } + }, }, }; From bfcc1d7e45157b909c44c193f5a7f7b81f47edfe Mon Sep 17 00:00:00 2001 From: thomas <81407403+thomas-cloud579@users.noreply.github.com> Date: Fri, 27 Nov 2026 16:41:24 +0800 Subject: [PATCH 934/988] Gate new Reserve addresses (#22414) Co-authored-by: ccipherx --- projects/gate-io/index.js | 49 +++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index b594a52c90f..1e7ae6a70dc 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -234,7 +234,8 @@ const config = { "addr1qyzppj9mh28q9d7x070j7aphnn6dx5lsh203zukzs7q68jqf08fcmxg8h9tvx8m529hjjnm9g3pt8vlkh95em7nup32sm78295", "addr1q9lqxlvk2dk8sffhr56gc4c4lckpv56l4r7wwh474caywurve9ssnt966vmezsfsppfm5sxgu5sqxacp8t7kpjzp9yxqn24ckj", "addr1q9lxym523pnns50dyymdv3n8vktyc0nkedr54c8d2prgxsumfyd8qtrg9yr4lqadjtczu6y94rtevjua36rv75v0qsnstezggc", - "addr1qyxuqrcjfyyz99yx4s307x33tu45944j607cywzvh3ykxw8c0cqknc77ed7uu7v465ufhkuu73ve6x7r9emq8vfkhxts23pyk4" + "addr1qyxuqrcjfyyz99yx4s307x33tu45944j607cywzvh3ykxw8c0cqknc77ed7uu7v465ufhkuu73ve6x7r9emq8vfkhxts23pyk4", + "addr1qxnu2g740my0f0k7g9fvmcfhp0q24gxwxmng97njernasd2f0z5l064c94kzhxwnvlhd88rtaaeewe3ulaqqwx36eq5sg4ezxv" ] }, "solana": { @@ -257,7 +258,8 @@ const config = { "DevD35PrcsJfg9CwpypmrD7GsYMRQpZQx6rfeSbkVtFp", "5zzEaL86dT4cTz6reodbz6Rg9Wvet18216DTiWGEVLFG", "J2f6waBNipqqn2k6d9uw3bwpbapGr2pLKZd9mDczCgfz", - "82KzHDyeqYckpoppcby7ZyWvWUyEwHLxDWfCTSMG6dn9" + "82KzHDyeqYckpoppcby7ZyWvWUyEwHLxDWfCTSMG6dn9", + "BmDYcavQw3hKZAvXQt5QMkj5dBtpmhCCGJkH26SRkPxA" ] }, "ripple": { @@ -282,7 +284,8 @@ const config = { "owners": [ "BVMEUTF37WNEQ6GYCZISRFHGLEMOKT5OCPPTTJXVED6JBSXKF6YJJRZRI4", "7BL55CRKRASIQI263JQ5H5A4JJQFSHL7RWXMCKM6YDZAIJVEZQ76SXF2S4", - "4EHCQSBDXQDSR4MFASDP2TGNKVDCJEKA5FUCHLAJ7FVTANR42JISNPV6UU" + "4EHCQSBDXQDSR4MFASDP2TGNKVDCJEKA5FUCHLAJ7FVTANR42JISNPV6UU", + "T7UJYD2LY7JDRVMEYMSZLMICTFZIUR3NDG3KFTFTEFQBLVCNNQXXALU7ZE" // "YGR5VO4VWBTWPWZKXBPNBPUGCM5BLP7DVAH2AF6LXAZBM5QKQGAXY5IXII" // getting account not found error ] }, @@ -348,7 +351,8 @@ const config = { // "123tA7zfH9XdqHX5v9W4mB4VfmrjE95yJvdvMbpWv5V851rX", // "15NtvAi8CGHrbaUBvXdki8GXc5YfHM9yTv6HGmaYDetLH2ob", "15dZTKqG6YZiQNiisMZP1DT4J6J9bmEEC4Bkz24nMC1ccRe2", // Gate Earn - "15FWs1pcTz8NbjGvBAMzmqUdWPnaLhBPwDNsJEVoAG4jc22n" // Gate Earn, nominator + "15FWs1pcTz8NbjGvBAMzmqUdWPnaLhBPwDNsJEVoAG4jc22n", // Gate Earn, nominator + "14cfiN47RHaKnMiW77pATFmjTpBijv8SzKgRgv7Ct1QmA8cA" ] }, "scroll": { @@ -492,7 +496,8 @@ const config = { "aptos": { "owners": [ "0x0cf869189c785beaaad2f5c636ced4805aeae9cbf49070dc93aed2f16b99012a", - "0x664208180d23956463ab9bf0a8f2a8f095bca2e27ac9c60623a4e22e78456d3f" + "0x664208180d23956463ab9bf0a8f2a8f095bca2e27ac9c60623a4e22e78456d3f", + "0x92db577132c7e9540bbedbff16f81c46cf2f5a81ba4bba3f53f4ca5c0322a77c" // address not found // "0x8b88f330e9ee14c6571d6707c48858bdd126d715c5df145eee58f4f4f6217898", // "0x107ffec1dd5c5faa26dbff442253ae9fc2cb026e3e9b55a6613c10cc90904a40" @@ -527,7 +532,8 @@ const config = { "WEo9Gi7T28niGb3pTwcHFDgGW4PjKDQvcS1stTxa68v73nQ", "bYvGgqKmEkmQKEm7P4oYFRsfrteAzksqKqRyT82mx2iWSZt", "Zk6pJF3cE67Eo15g7BSqtGMv3XC2T8xBHggq8ZFAPnpnpnY", - "aKCD8R97ifVNsVWTC2sbdbeqWG8ZGJaQcrwMBo3XvrmgR4N" + "aKCD8R97ifVNsVWTC2sbdbeqWG8ZGJaQcrwMBo3XvrmgR4N", + "ZYy1Km8LjwxZejpdnDHLm6rhEuC1qH3w2T5mLKiCHPCZoAA" ] }, "aura": { @@ -576,7 +582,8 @@ const config = { "c2TQGFWqK1WsKzWizpdf9V6uzCgnVqw7Yz9Va7G2wjQPHTY", "hLaXgNj9XdVZNeE1uwpv9hJKM2wEBPQ2GPZb8mLEodCnpB2", "fXm5HnSzWxqPrQYae4UDnXnZXfV5dmUNEEpSpCYdFPK4z69", - "g6rU7xYW1YDXvtyMiutyXs5UzQRcSw6bZR4xsSLznTFxfxW" + "g6rU7xYW1YDXvtyMiutyXs5UzQRcSw6bZR4xsSLznTFxfxW", + "14cfiN47RHaKnMiW77pATFmjTpBijv8SzKgRgv7Ct1QmA8cA" ] }, "binance": { @@ -654,7 +661,8 @@ const config = { "5HgKqPsEz17fBVCvd5cgWbGbapBXCn48p8LHjjvAub2kvVyd", "5FsWP1GxpzT11xyFBojKpE75pzp54ESDA6BYbRMPJ2nsCZE5", "5GSbmqT4LV2PA3TfxtakZySNkTZ1b3bqPRMo7UbBfZrp6d8k", - "5H9nqVMLfYWN6MiiCLrWjR1ADjR7V7FcBEenBY66NiHeKucE" + "5H9nqVMLfYWN6MiiCLrWjR1ADjR7V7FcBEenBY66NiHeKucE", + "5FgNa2o3ZWJrLphz9UmAK6wacCC53caJupwwXd7rKvPEyksF" ] }, "bittorrent": { @@ -938,7 +946,8 @@ const config = { "owners": [ "erd1p4vy5n9mlkdys7xczegj398xtyvw2nawz00nnfh4yr7fpjh297cqtsu7lw", "erd1lptaaz323qjgsg67mfsa8aquffs9j8tl3khvz2v7creqgf4yeslsf2u99c", - "erd1cx3a4wu4kpnk0ke2hp0dp05xzvapt0lr4q86q97thqepvas2sxqsnh0533" + "erd1cx3a4wu4kpnk0ke2hp0dp05xzvapt0lr4q86q97thqepvas2sxqsnh0533", + "erd1nl5fcr6tclfr34vycvjetvgzn9eg53mdrxm29n9ny9spt4zddshs73yd0p" ] }, "elys": { @@ -1079,7 +1088,8 @@ const config = { }, "fogo": { "owners": [ - "u6PJ8DtQuPFnfmwHbGFULQ4u4EgjDiyYKjVEsynXq2w" + "u6PJ8DtQuPFnfmwHbGFULQ4u4EgjDiyYKjVEsynXq2w", + "BmDYcavQw3hKZAvXQt5QMkj5dBtpmhCCGJkH26SRkPxA" ] }, "flow": { @@ -1219,6 +1229,7 @@ const config = { "owners": [ "8fe706db7b08f957a15199e07761039a7718937aabcc0fe48bc380a4daf9afb0", "8f079b740ca593e6741e8a552f06352d0e6c844f6fd75533e3bd575ec76cb147", + "573a384c7d283958ca27961db4052e791f40b83693bb202e2424c22f4dc76f29", // "6463450788218283a2959d7cf4e1bfbaf422753e5c4596b593ed9d3f4cf20497" ] }, @@ -1263,7 +1274,8 @@ const config = { "owners": [ "k:0d584a4cbbfd9a4878d816512894e65918e54fae13df39a6f520fc90caea2fb0", "k:f857de8a2a882488235eda61d3f41c4a60591d7f8daec1299ec0f20426a4cc3f", - "k:c1a3dabb95b06767db2ab85ed0be86133a15bfe3a80fa017cbb83216760a8181" + "k:c1a3dabb95b06767db2ab85ed0be86133a15bfe3a80fa017cbb83216760a8181", + "k:9fe89c0f4bc7d238d584c32595b10299728a476d19b6a2ccb3216015d44d6c2f" ] }, "kardia": { @@ -1460,7 +1472,8 @@ const config = { "f857de8a2a882488235eda61d3f41c4a60591d7f8daec1299ec0f20426a4cc3f", // "c1a3dabb95b06767db2ab85ed0be86133a15bfe3a80fa017cbb83216760a8181", // account was never created on near, the rpc rejects it with UNKNOWN_ACCOUNT "e10e284823bc0728f1850486fd4ccd5546249140e96823ac09f96b30363cd251", - "bc02e51d5f4c03611ef28d8fdbdba01b237f5a870fad7670d0a17a1a14934b97" + "bc02e51d5f4c03611ef28d8fdbdba01b237f5a870fad7670d0a17a1a14934b97", + "9fe89c0f4bc7d238d584c32595b10299728a476d19b6a2ccb3216015d44d6c2f" ] }, "neo": { @@ -1523,7 +1536,8 @@ const config = { "owners": [ "oasis1qppfyeugxmxdx5m4gpasg4xqg296zcdndy0k2zsg", "oasis1qqz86qv538ff9y4exy6g3j724mq68wj7pu55rgwt", - "oasis1qp8f5gh8zgad5t47hc40ayw37ptcszrtsq6eh5de" + "oasis1qp8f5gh8zgad5t47hc40ayw37ptcszrtsq6eh5de", + "oasis1qqvzwa6ng59mhqv04txhqw3wewmrd2gh0g9nqvap" ] }, "okexchain": { @@ -1802,7 +1816,8 @@ const config = { }, "supra": { "owners": [ - "0x0cf869189c785beaaad2f5c636ced4805aeae9cbf49070dc93aed2f16b99012a" + "0x0cf869189c785beaaad2f5c636ced4805aeae9cbf49070dc93aed2f16b99012a", + "0x92db577132c7e9540bbedbff16f81c46cf2f5a81ba4bba3f53f4ca5c0322a77c" ] }, "syscoin": { @@ -1849,7 +1864,8 @@ const config = { "KT18yTsDxUbVrenxZsbFSx6Ai72hRHod9pHV", "tz1RRVLD5LEu8iaoTMGc5L1NiyiEGuSUtAwX", "KT1PuUGWvCypTrNu7yweWCzpX6zyuy6nq6Wu", - "tz1fw6VKhBZ8N7HAvCwvXSkTvQ7YcUk3w9AK" + "tz1fw6VKhBZ8N7HAvCwvXSkTvQ7YcUk3w9AK", + "tz1fydt3ABnDwzvP48214yVLAkGhSyvydBDw" ] }, "theta": { @@ -1899,6 +1915,8 @@ const config = { "UQDQSAWWKRBUm0VnUrny-9Ni_deobis0aC6XpEtalxxl_eUa", "UQCalNyv57ob7KK1r7nsVaY4VivZu712RTlqiEYAffoM3kJ-", "EQC0lrj3O0af8GotieYsTXChA_wijIIVN7Sd_wkgYLwoH07q", + "0:49e7838ee420b32591abf09335187e164acf1a9d8fda1d2d43fb106ad55b4433", + "UQB_TpoybtDzJ9Iy10b5bB4evodZZDa7-k2eDaV7CFa_9Cfv", ], // default TON whitelist + EVAA (EVAA Protocol), held in Gate's TON reserve wallet UQDQSAWW... tokens: [...defaultTokens.ton, 'EQBKMfjX_a_dsOLm-juxyVZytFP7_KKnzGv6J01kGc72gVBp'], @@ -2077,6 +2095,7 @@ const config = { owners: [ "J5VsgNemdBg2bfvHresAtBZdxE67WrS656Caup3MgsBE2y7", "CspNJ5uJ9WcF6Nf6sJY9YRQL3dWZmKrMnmd2qY4BXMTGEgi", + "GBzEM8vBsKn6UXRvBaDD4JaknUJrHPVNCngvHPooibjivdk", ] }, initia: { From 375acebfd43c56ccfb19c39c4b190eef087a4b0c Mon Sep 17 00:00:00 2001 From: sudotx Date: Fri, 27 Nov 2026 19:18:58 +0100 Subject: [PATCH 935/988] Curveball: track redeployed RISE launchpad (#22419) Co-authored-by: Claude Opus 5.5 --- registries/sumTokens.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 19d26f17c1a..5a4b093b345 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -12488,7 +12488,7 @@ const configs = { "curveball": { methodology: 'Counts the WETH held by the Curveball launchpad, which backs its active bonding curves. Liquidity that has graduated into Icarus pools is not counted.', start: '2026-11-09', - rise: { owner: '0xCD07f89C29E1FAE77EC1a342b5D47D9008E9a72d', tokens: ['0x4200000000000000000000000000000000000006'] }, + rise: { owner: '0xC2C337301303d8bE4803042425aA5A325d30e6d7', tokens: ['0x4200000000000000000000000000000000000006'] }, }, "curves": { "methodology": "We count the ETH locked in the Curves trading contracts (0xEad4138380B508949Ccd48B97AD930bd89aAb719, 0x88c7484d19E49B09233484824698a5214d81f866)", From 615ea65813772017137e84b4fc1d82b0d3825ed8 Mon Sep 17 00:00:00 2001 From: Marien Date: Fri, 27 Nov 2026 19:25:19 +0100 Subject: [PATCH 936/988] gami-labs: add Gami USDC High Yield Lagoon vault (Ethereum) (#22417) Co-authored-by: Claude Opus 5.5 --- registries/curators.js | 1 + 1 file changed, 1 insertion(+) diff --git a/registries/curators.js b/registries/curators.js index 99c5d805359..42e18eb123e 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -699,6 +699,7 @@ const configs = { erc4626: [ // Lagoon "0xdae854d0896ad2fee335689a3f7b4a95fd1a3e46", // Lagoon - Gami USDC + "0x9ff1883ec71d6f6990cb50575cce8ee83f9b8fed", // Lagoon - Gami USDC High Yield (ghUSDC) "0x33e1339567c183fbadcb43f72d11c47229d468ab", // Lagoon - Gami Stake DAO USDC "0x57e6824a8b15b709cefb4ccef644ba1349057e77", // Lagoon - xBTCY (cbBTC) "0x2a676c2744421b4fae65ce86b47adacb620047d4", // Lagoon - Gami hemiBTC From 8332e9f40ef29fe8fe7738dc5da8e4e8080a10bb Mon Sep 17 00:00:00 2001 From: vsiskin-accountable Date: Fri, 27 Nov 2026 19:27:47 +0100 Subject: [PATCH 937/988] accountable: exclude unapproved strategies from TVL (#22418) --- projects/accountable/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/projects/accountable/index.js b/projects/accountable/index.js index 1c7137a7dd1..26545fbb444 100644 --- a/projects/accountable/index.js +++ b/projects/accountable/index.js @@ -67,6 +67,15 @@ const EXCLUDED_STRATEGIES = { '0x8a5afc1d1efccf72cbb6daa885112f36da2682b4', '0xc3edd8b28c41749eed38c2a33a78e3e046dfb876', '0xb072cb45e87bb8704c38297b9f6ad02f8acc82a7', + '0x4dd0b9f9776eb782b3803af18bdd22e0d710d049', + '0xd080ce7f88acef0879c7fa6495d9c880fb0461d6', + '0x6f055f7b883e9cb929885263b8779393bf7e394b', + '0x2a0e9dbd3e7dd64fdb74e7099cb1c3260846d58c', + '0xf3cb1521472b1c4cae6e7fc792f63a28370f02ad', + '0xa02e30b7f8c5bfd03d97e346d653c78a88c878a8', + '0xd4f6eb93b039951a3bc65d5a9a55fef3056ddbd5', + '0x90902fa4cb06b46c0808f90d069c3b13f3868b17', + '0xc4f741479d2403ce87c81a615789737411937f6d', ], monad: [ '0xb66adea8a43d5c1d2f962a8c69f67a859425c293', @@ -75,6 +84,28 @@ const EXCLUDED_STRATEGIES = { '0x0d58d3a21adc8f60c81c00c13e7363cc56c6e061', '0xa783b87047dcdaf5d84f4843fae85a6c9e3343af', '0x33ca98cfca7f25735d8719e67f616fcc44d7771e', + '0xf9b3f6e4e21bffc54b97ca7cbe8e3c1b7a573a51', + '0x98794d4519996a4b661f83278b24a91bcfc7e91d', + '0xa62cbcd904e95ff552699276b111a1c3a79e4907', + '0xdf5e1fe08d1f248e623c108499624e133cd5627e', + '0xbf0d141a2da86dabc7aeddfbb5ca6c9678ef33aa', + '0x22334d08b4528cfdea75c21ee6b53c1d8b514744', + '0xcf654036ef5085eef133eeb8efb53d35e7883e2e', + '0x9736748fa9498b42ec6e1a47215f679c92707a2f', + '0xa43e8d2aa50e14704603d07394f80c93e76ae85f', + '0xb22eae5c20bb41d8bd604b0e95a4f7aac091901e', + '0xf1fdad937f12072a7cb700b874c449c015a2730a', + '0x2554f1c6b93c0b87ffacf8ca1e477074093e09cb', + '0xf5e7d3b685bbcc26ab9b7dfcf3e0198e2a2d4de2', + '0xeee62e5b2b8d2ada52dc5b0302a5da0bc0f5dd18', + '0x1fffe9320afe3b7a8ff11ad08fb30affdcedfdfb', + ], + base: [ + '0x7a0a0428f34661dd4d2130791e2c70ff96e28150', + '0xf747a93337a37a29a94aa0affb3e2aa1ae6f14ef', + ], + robinhood: [ + '0xad4ab78af9d9f566c38197f2b41910ea7bcea21a', ], } From 7aa199a5b3eb62832ce3f205d19f85e833ffa089 Mon Sep 17 00:00:00 2001 From: "gosuto.eth" Date: Fri, 27 Nov 2026 19:34:53 +0100 Subject: [PATCH 938/988] Add Frontier Finance (frontier-fi) (#22416) --- registries/balancer.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/registries/balancer.js b/registries/balancer.js index fa6f7b0b59a..f60a09b5982 100644 --- a/registries/balancer.js +++ b/registries/balancer.js @@ -166,6 +166,14 @@ const configs = { '0x440e339a46eaa3bE8d723c2cBED2A30af74536D5', // SPRING, the parent protocol's token ] }, }, + 'frontier-fi': { + _options: { helperType: 'v3' }, + methodology: 'TVL is the total value of tokens held in the Frontier Finance Balancer V3 Vault across all registered pools.', + start: '2026-11-12', // Base vault deployed 2026-11-12 + ethereum: { vault: '0xFF00009C1A83Ec25434522ef355b99e9a70000FF', fromBlock: 26444019 }, + base: { vault: '0xFF00009C1A83Ec25434522ef355b99e9a70000FF', fromBlock: 56621235 }, + monad: { vault: '0xFF00009C1A83Ec25434522ef355b99e9a70000FF', fromBlock: 124803594 }, + }, // ===== Balancer V1 (v1Tvl) ===== 'valueliquid': { From df1daf81ac4037260d6ef06a6f759b7ef5dac364 Mon Sep 17 00:00:00 2001 From: sonevibegrok Date: Sat, 28 Nov 2026 06:02:58 -0500 Subject: [PATCH 939/988] SoneVibe: retire Astar and update listing metadata (#22423) Co-authored-by: FelixBruguera --- projects/sonevibe/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/sonevibe/index.js b/projects/sonevibe/index.js index 2c329a363e2..5737d71fd3b 100644 --- a/projects/sonevibe/index.js +++ b/projects/sonevibe/index.js @@ -6,9 +6,10 @@ const { mergeExports } = require('../helper/utils') const dex = { soneium: '0x06C0b58287794a0bdce20ce768b601CA974618DC', - astar: '0x1b404A1e41cCe5f98DC9CBF0c1372F8b68e2588c', bsc: '0xaf905e66038EcE89e03D843B35a11D262053B630', arbitrum: '0xA95107ebE4e54480bA755061eF3207c3421150f0', + // Astar 0x1b404A1e41cCe5f98DC9CBF0c1372F8b68e2588c was retired 2026-11-23. + // Historical TVL already stored on DefiLlama is left untouched. } // Drain-free Soneium factory, deployed 2026-11-10 03:56:01 UTC (block 30574105), @@ -27,14 +28,13 @@ const lending = { // V_Master has no getAllMarkets(), so markets are pinned (from networks.json) // Arbitrum One has an empty master and no cTokens there, so it stays DEX-only. soneium: { comptroller: '0x1126859aB6911Fc3b4f86f2F65E7B6F2eEDe5185', markets: ['0x7CA06966B0c07C5e35aA180643E98bB3057EBb27', '0xDB3e66b87c42C7F3599fbdcBFe08DfF0689A6D77', '0x96ae93Df119c131469b38e3d558899F23678dCFb'] }, - astar: { comptroller: '0x4B07FedD55C65373Dec9d983EA279D7d65259ec7', markets: ['0x40f4bFA1e152Ac5a9b066C0BEc5BD83227F8520A', '0xA7f41D0f41ec8aeb5d57c0E5850F0dB28Ca68E54', '0xe5cE001dD3439A198b2A19567D5F3CD6cd30e61f'] }, } const dexExports = {} Object.entries(dex).forEach(([chain, factory]) => { dexExports[chain] = { tvl: getUniTVL({ factory, useDefaultCoreAssets: true }) } }) -// Chain start only. A root start would hide Soneium, Astar, and BSC history. +// Chain start only. A root start would hide Soneium and BSC history. // Factory creation: block 521383212, 2026-11-05T05:04:30Z, // tx 0xd2cebb74373f703a9b8ca8e1d2cc059f33fabd40713701dfc46c374079e6635d. // Block lookup may land up to 5 minutes early, so this start is 05:09:30Z. @@ -67,4 +67,6 @@ Object.entries(lending).forEach(([chain, config]) => { }) module.exports = mergeExports([dexExports, soneiumNewExports, bscNewExports, lendingExports]) -module.exports.methodology = 'DEX TVL: reserves of all VibeSwap pairs created by the factories (core assets only). On Soneium this includes the original factory 0x06C0b58287794a0bdce20ce768b601CA974618DC, kept for history, and the drain-free factory 0x77b141dCFDa726e239efF005E3DE7A47AeBFf948 from block 30574105 (2026-11-10). On BSC this includes the original factory 0xaf905e66038EcE89e03D843B35a11D262053B630, kept for history, and the factory 0x26b13e7e923e964b0514B3167A90901B49DAe205 from block 135015600 (2026-11-22). Lending TVL: underlying tokens held by SoneVibe cTokens listed by the comptroller; borrowed = total borrows. Arbitrum counts those factory reserves only; that chain has no comptroller or cTokens.' +// Astar deployment retired 2026-11-23; empty export keeps its history +module.exports.astar = { tvl: () => ({}), borrowed: () => ({}) } +module.exports.methodology = 'DEX TVL: reserves of all VibeSwap pairs created by the factories (core assets only). On Soneium this includes the original factory 0x06C0b58287794a0bdce20ce768b601CA974618DC, kept for history, and the drain-free factory 0x77b141dCFDa726e239efF005E3DE7A47AeBFf948 from block 30574105 (2026-11-10). On BSC this includes the original factory 0xaf905e66038EcE89e03D843B35a11D262053B630, kept for history, and the factory 0x26b13e7e923e964b0514B3167A90901B49DAe205 from block 135015600 (2026-11-22). Lending TVL: underlying tokens held by SoneVibe cTokens listed by the comptroller; borrowed = total borrows. Arbitrum counts those factory reserves only; that chain has no comptroller or cTokens. Astar was retired on 2026-11-23 and is no longer counted in new snapshots; historical TVL already stored is left untouched.' From 4fdba47b0328975d8d027e45f6179c1151cb13f0 Mon Sep 17 00:00:00 2001 From: Anton <1749874@gmail.com> Date: Sat, 28 Nov 2026 19:15:09 +0800 Subject: [PATCH 940/988] stacks: read stacked STX from pox-5 (#22427) Co-authored-by: takinanton <191816639+takinanton@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 --- projects/stacks/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stacks/api.js b/projects/stacks/api.js index 09d42e9d3d5..9c59bb160b2 100644 --- a/projects/stacks/api.js +++ b/projects/stacks/api.js @@ -6,7 +6,7 @@ module.exports = { } async function tvl() { - const target = 'SP000000000000000000002Q6VF78.pox-4' + const target = 'SP000000000000000000002Q6VF78.pox-5' const currentCycle = await call({ target, abi: 'current-pox-reward-cycle' }) const stakedAmount = await call({ target, abi: 'get-total-ustx-stacked', inputArgs: [{ type: 'number', value: +(currentCycle.toString()) }] }) return { From 51ec5f10f85a0bbf9635141482c9d3a953871110 Mon Sep 17 00:00:00 2001 From: Ravenhood Date: Sat, 28 Nov 2026 12:22:31 +0100 Subject: [PATCH 941/988] Ravenhood treasury: add DAO Uniswap V4 hook positions (#22422) Co-authored-by: dev256lag --- projects/treasury/ravenhood.js | 39 +++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/projects/treasury/ravenhood.js b/projects/treasury/ravenhood.js index d4d6fbd520b..1576c293a2b 100644 --- a/projects/treasury/ravenhood.js +++ b/projects/treasury/ravenhood.js @@ -1,6 +1,8 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const { sumTokensExport, unwrapSlipstreamNFT, unwrapUniswapV3NFT } = require('../helper/unwrapLPs') +const ethers = require('ethers') +const { sumTokensExport, sumTokens2, unwrapSlipstreamNFT, unwrapUniswapV3NFT } = require('../helper/unwrapLPs') +const { getLogs2 } = require('../helper/cache/getLogs') // RavenhoodVault — permanently locked, protocol-owned RVH/WETH Uniswap V3 position const VAULT = '0x5e1485137E025bf7774F52DE4E33fa6E498f6ede' @@ -41,6 +43,39 @@ const VELUTE_NFT = '0xc1a79e3A7b04c3f21C6409a78Ab58A8C822bE7dC' const VELUTE_STATE_ABI = 'function getNftState(uint256 tokenId) view returns (tuple(tuple(int128 amount,uint256 end,bool isPermanentLocked) locked,bool isVoted,bool isAttached,uint256 lastTranferBlock,uint256 pointEpoch))' +// Uniswap V4 positions (most of them in pools with Ravenhood's own hooks). +// The V4 PositionManager has no tokenOfOwnerByIndex and there is no V4 +// subgraph for Robinhood Chain, so discover the DAO's position NFTs from +// Transfer logs into the DAO wallet and keep the ones it still owns. +const V4_POSITION_MANAGER = '0x58daec3116aae6d93017baaea7749052e8a04fa7' +const V4_FROM_BLOCK = 4813836 // first V4 position NFT received by the DAO wallet +const V4_TRANSFER_ABI = 'event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)' + +async function getV4PositionIds(api) { + const transfers = await getLogs2({ + api, target: V4_POSITION_MANAGER, eventAbi: V4_TRANSFER_ABI, fromBlock: V4_FROM_BLOCK, extraKey: 'ravenhood-dao-v4-in', + topics: [ethers.id('Transfer(address,address,uint256)'), null, ethers.zeroPadValue(DAO_WALLET.toLowerCase(), 32)], + }) + const ids = [...new Set(transfers.map((i) => i.tokenId.toString()))] + if (!ids.length) return [] + const owners = await api.multiCall({ abi: 'function ownerOf(uint256) view returns (address)', target: V4_POSITION_MANAGER, calls: ids, permitFailure: true }) + return ids.filter((_, i) => owners[i] && owners[i].toLowerCase() === DAO_WALLET.toLowerCase()) +} + +async function v4Tvl(api) { + const positionIds = await getV4PositionIds(api) + if (positionIds.length) + await sumTokens2({ api, resolveUniV4: true, uniV4ExtraConfig: { positionIds, nftAddress: V4_POSITION_MANAGER, blacklistedTokens: [RVH_TOKEN] } }) + return api.getBalances() +} + +async function v4OwnTokens(api) { + const positionIds = await getV4PositionIds(api) + if (positionIds.length) + await sumTokens2({ api, resolveUniV4: true, uniV4ExtraConfig: { positionIds, nftAddress: V4_POSITION_MANAGER, whitelistedTokens: [RVH_TOKEN] } }) + return api.getBalances() +} + const lower = (v) => v.toLowerCase() function shouldAdd(token, blacklistedTokens = [], whitelistedTokens = []) { @@ -176,12 +211,14 @@ module.exports = { (api) => alandaleCl({ api, blacklistedTokens: [RVH_TOKEN] }), (api) => alandaleV2({ api, blacklistedTokens: [RVH_TOKEN] }), veLuteTvl, + v4Tvl, ]), ownTokens: sdk.util.sumChainTvls([ univ3OwnTokens, updexOwnTokens, (api) => alandaleCl({ api, whitelistedTokens: [RVH_TOKEN] }), (api) => alandaleV2({ api, whitelistedTokens: [RVH_TOKEN] }), + v4OwnTokens, ]), }, } From 38e99211275bdcf2180b421db74ac8e1d383a10e Mon Sep 17 00:00:00 2001 From: greencifer Date: Sat, 28 Nov 2026 04:28:00 -0700 Subject: [PATCH 942/988] Add Memetics Finance (Solana AMM, a fork of Raydium cp-swap) (#22424) Co-authored-by: fomotsar-commits Co-authored-by: Claude Fable 5.2 --- projects/memetics-finance/index.js | 81 ++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 projects/memetics-finance/index.js diff --git a/projects/memetics-finance/index.js b/projects/memetics-finance/index.js new file mode 100644 index 00000000000..25c7b779b4d --- /dev/null +++ b/projects/memetics-finance/index.js @@ -0,0 +1,81 @@ +const { PublicKey } = require('@solana/web3.js') +const { getConnection, getTokenAccountBalances } = require('../helper/solana') +const { transformDexBalances } = require('../helper/portedTokens') + +// Memetics Finance (https://memetics.finance): a constant-product AMM on Solana, a fork of +// Raydium cp-swap (Apache-2.0) deployed under its own program id. Anyone can open a pool. +// Source: https://github.com/fomotsar-commits/tegridy-farms/tree/mvp-launch/solana/tegridy-amm +const MEMETICS_AMM_PROGRAM = 'EKS4C6xvV9A5DMWaWtVnFvi7ru78EhqRAoddEMpQ2BtT' + +// Anchor discriminator of the account: sha256("account:PoolState")[0..8] +const POOL_STATE_DISCRIMINATOR = Buffer.from([247, 237, 227, 245, 215, 195, 222, 70]) +const POOL_STATE_SIZE = 637 + +// PoolState layout (zero-copy, packed), the same as upstream cp-swap. Offsets from the start +// of the account (programs/cp-swap/src/states/pool.rs). +const OFFSET_TOKEN_0_VAULT = 72 +const OFFSET_TOKEN_1_VAULT = 104 +const OFFSET_TOKEN_0_MINT = 168 +const OFFSET_TOKEN_1_MINT = 200 +// Fees that have accrued in the vaults but belong to the protocol owner, the fund owner or +// the pool's creator, not to the liquidity: u64 each, [token 0, token 1]. +const OFFSETS_ACCRUED_FEES = [ + [341, 349], // protocol_fees_token_0 / _1 + [357, 365], // fund_fees_token_0 / _1 + [397, 405], // creator_fees_token_0 / _1 +] +const SLICE_START = OFFSET_TOKEN_0_VAULT +const SLICE_LENGTH = 413 - SLICE_START + +async function tvl(api) { + const connection = getConnection() + const pools = await connection.getProgramAccounts(new PublicKey(MEMETICS_AMM_PROGRAM), { + filters: [ + { dataSize: POOL_STATE_SIZE }, + { memcmp: { offset: 0, bytes: POOL_STATE_DISCRIMINATOR.toString('base64'), encoding: 'base64' } }, + ], + dataSlice: { offset: SLICE_START, length: SLICE_LENGTH }, + }) + if (!pools.length) return + + const readPubkey = (data, offset) => new PublicKey(data.subarray(offset - SLICE_START, offset - SLICE_START + 32)).toString() + const readU64 = (data, offset) => data.readBigUInt64LE(offset - SLICE_START) + + const vaults = pools.flatMap(({ account }) => [ + readPubkey(account.data, OFFSET_TOKEN_0_VAULT), + readPubkey(account.data, OFFSET_TOKEN_1_VAULT), + ]) + const vaultBalances = await getTokenAccountBalances(vaults, { individual: true }) + + const data = [] + pools.forEach(({ pubkey, account }, i) => { + const reserves = [0, 1].map((side) => { + const vault = vaultBalances[2 * i + side] + if (vault?.amount === undefined) return null + const accruedFees = OFFSETS_ACCRUED_FEES.reduce((sum, offsets) => sum + readU64(account.data, offsets[side]), 0n) + const reserve = BigInt(vault.amount) - accruedFees + return reserve < 0n ? null : reserve.toString() + }) + // A pool whose vault could not be read, or that would owe more fees than its vault holds + // (the program does not allow it), is left out instead of failing every other pool. + if (reserves.includes(null)) { + api.log(`memetics-finance: skipped pool ${pubkey}, its vault balances could not be used`) + return + } + data.push({ + token0: readPubkey(account.data, OFFSET_TOKEN_0_MINT), + token1: readPubkey(account.data, OFFSET_TOKEN_1_MINT), + token0Bal: reserves[0], + token1Bal: reserves[1], + }) + }) + + return transformDexBalances({ api, data }) +} + +module.exports = { + timetravel: false, // getProgramAccounts reads the current state only + methodology: + 'TVL is the liquidity in every Memetics Finance pool: the balance of the pool\'s two token vaults minus the trading fees that have accrued in them for the protocol owner, the fund owner and the pool\'s creator. A pool that pairs a token with SOL or another major asset is valued at twice that side, since most tokens here have little market outside these pools; a pool of two major assets counts both sides.', + solana: { tvl }, +} From 66022bfcc80a85845a4b93f9717a7fd0a2244c78 Mon Sep 17 00:00:00 2001 From: Block Date: Sat, 28 Nov 2026 05:36:37 -0600 Subject: [PATCH 943/988] Add Perma (#22426) Co-authored-by: imblocksavvy --- projects/perma/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/perma/index.js diff --git a/projects/perma/index.js b/projects/perma/index.js new file mode 100644 index 00000000000..5dda934bf3e --- /dev/null +++ b/projects/perma/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// Perma (https://perma.trade): BTC leverage on HyperEVM with no liquidation price (everlasting options). +// One pool takes the other side of every position and hedges on Hyperliquid perps. Its USDC sits partly on +// HyperEVM and partly on the pool's own HyperCore account; coreAssets() is that Core account's value in USDC (6 dp). +const POOL = '0x6f43b8C0a44B7154923ea4Dae9f1187676348c51' + +async function tvl(api) { + await api.sumTokens({ owner: POOL, tokens: [ADDRESSES.hyperliquid.USDC] }) + const core = await api.call({ target: POOL, abi: 'function coreAssets() view returns (int256)' }) + if (+core > 0) api.add(ADDRESSES.hyperliquid.USDC, core) +} + +module.exports = { + methodology: 'USDC held by the Perma pool on HyperEVM plus the value of the pool\'s HyperCore account, which holds the margin for its Hyperliquid hedge.', + start: '2026-11-26', + hyperliquid: { tvl }, +} From 011bdf20a4784023a8718294f6434d3f938170b6 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Sat, 28 Nov 2026 07:36:48 -0400 Subject: [PATCH 944/988] Deep update (#22429) Co-authored-by: OxForged <270251360+OxForged@users.noreply.github.com> --- projects/deep-launchpad/index.js | 52 ++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/projects/deep-launchpad/index.js b/projects/deep-launchpad/index.js index cd29dbe382c..ad68ff13d82 100644 --- a/projects/deep-launchpad/index.js +++ b/projects/deep-launchpad/index.js @@ -3,10 +3,13 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getConnection } = require('../helper/solana') // DEEP launchpad: the Deep Curve bonding-curve program. Every launched token has one -// BondingCurve account (PDA ["curve", mint]) that holds the SOL buyers paid in. -// At graduation the SOL moves to a DeepSwap pool (counted by the deepswap adapter) and the +// BondingCurve account (PDA ["curve", mint]) that holds what buyers paid in, in the curve's +// quote asset: SOL, or an approved SPL token such as DEEP (a token pair). +// At graduation the quote moves to a DeepSwap pool (counted by the deepswap adapter) and the // program sets real_sol_reserves to 0, so a graduated curve adds nothing here. const DEEP_CURVE_PROGRAM = '7czURwVLkQpcF1HVhhZU5GGzvPA8YniogZY1BhZHCDtA' +// The protocol's own token: reserves of DEEP-quoted curves are reported as staking, not tvl. +const DEEP_MINT = 'DpyVL7crxmDAgKuCZ6heGVkPzGAWyx7fkRDRrASadeep' // Anchor discriminator of the account: sha256("account:BondingCurve")[0..8] const BONDING_CURVE_DISCRIMINATOR = Buffer.from([23, 183, 248, 55, 96, 216, 172, 96]) @@ -14,24 +17,55 @@ const BONDING_CURVE_DISCRIMINATOR = Buffer.from([23, 183, 248, 55, 96, 216, 172, // BondingCurve layout (borsh, after the 8-byte discriminator): mint 32 | creator 32 | // virtual_sol_reserves u64 | virtual_token_reserves u64 | real_sol_reserves u64 @88 | ... // The account has only ever grown by appended fields, so this offset holds for every version. +// A SOL curve is 196 bytes. A token-paired curve is 236 bytes: the same fields, whose `*_sol_*` +// amounts are in the quote token's base units, then quote_mint (32 bytes @196) and +// rent_quote_spent (u64 @228: quote already spent on the graduation rent, no longer held). const OFFSET_REAL_SOL_RESERVES = 88 +const OFFSET_QUOTE_MINT = 196 +const OFFSET_RENT_QUOTE_SPENT = 228 +const TOKEN_CURVE_SIZE = 236 +const SLICE_LENGTH = TOKEN_CURVE_SIZE - OFFSET_REAL_SOL_RESERVES -async function tvl(api) { +async function getReservesByQuote() { const connection = getConnection() + // The slice is cut short to the account's own length, so a SOL curve returns 108 bytes. const curves = await connection.getProgramAccounts(new PublicKey(DEEP_CURVE_PROGRAM), { filters: [{ memcmp: { offset: 0, bytes: BONDING_CURVE_DISCRIMINATOR.toString('base64'), encoding: 'base64' } }], - dataSlice: { offset: OFFSET_REAL_SOL_RESERVES, length: 8 }, + dataSlice: { offset: OFFSET_REAL_SOL_RESERVES, length: SLICE_LENGTH }, }) - let lamports = 0n - for (const { account } of curves) lamports += account.data.readBigUInt64LE(0) + const byQuote = {} + for (const { account } of curves) { + const data = account.data + let quote = ADDRESSES.solana.SOL + let amount = data.readBigUInt64LE(0) + if (data.length >= SLICE_LENGTH) { + const mint = data.subarray(OFFSET_QUOTE_MINT - OFFSET_REAL_SOL_RESERVES, OFFSET_QUOTE_MINT - OFFSET_REAL_SOL_RESERVES + 32) + // the default key (all zero bytes) is native SOL + if (mint.some((b) => b !== 0)) quote = new PublicKey(mint).toString() + const spent = data.readBigUInt64LE(OFFSET_RENT_QUOTE_SPENT - OFFSET_REAL_SOL_RESERVES) + amount = amount > spent ? amount - spent : 0n + } + byQuote[quote] = (byQuote[quote] ?? 0n) + amount + } + + return byQuote +} + +async function tvl(api) { + const byQuote = await getReservesByQuote() + for (const [quote, amount] of Object.entries(byQuote)) + if (quote !== DEEP_MINT) api.add(quote, amount.toString()) +} - api.add(ADDRESSES.solana.SOL, lamports.toString()) +async function staking(api) { + const byQuote = await getReservesByQuote() + if (byQuote[DEEP_MINT]) api.add(DEEP_MINT, byQuote[DEEP_MINT].toString()) } module.exports = { timetravel: false, // getProgramAccounts reads the current state only methodology: - 'TVL is the SOL that buyers have paid into the bonding curves of tokens that have not graduated yet: the sum of real_sol_reserves over every BondingCurve account of the Deep Curve program. Not counted: the curve\'s virtual reserves (a pricing parameter, not assets), the launched tokens still held by a curve (they have no market outside their own curve), trading fees and creator or holder rewards that sit on a curve account until they are claimed, and graduated tokens, whose liquidity is in a DeepSwap pool.', - solana: { tvl }, + 'TVL is what buyers have paid into the bonding curves of tokens that have not graduated yet, in each curve\'s quote asset (SOL, or an approved token such as DEEP): the sum of real_sol_reserves over every BondingCurve account of the Deep Curve program, less the quote a token-paired curve has already spent on its graduation rent, grouped by quote asset. Reserves of curves quoted in DEEP, the protocol\'s own token, are reported under staking instead of TVL. Not counted: the curve\'s virtual reserves (a pricing parameter, not assets), the launched tokens still held by a curve (they have no market outside their own curve), trading fees and creator or holder rewards that sit on a curve account until they are claimed, and graduated tokens, whose liquidity is in a DeepSwap pool.', + solana: { tvl, staking }, } From 252be3cec51ea275127cac78284f27427a6b9e48 Mon Sep 17 00:00:00 2001 From: jaimealefmoney-commits Date: Sat, 28 Nov 2026 09:12:20 -0500 Subject: [PATCH 945/988] Add ALEF fund protocol (#22421) Co-authored-by: J.A. Bettencourt Co-authored-by: FelixBruguera --- registries/treasury.js | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/registries/treasury.js b/registries/treasury.js index 932731cd3be..f3ed751a233 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -6837,6 +6837,62 @@ const configs = { tokens: [nullAddress, ADDRESSES.ink.WETH, ADDRESSES.ink.USDT0, ADDRESSES.ink.USDC, '0xe343167631d89B6Ffc58B88d6b7fB0228795491D'], // + USDG }, }, + 'treasury/alef': { + // Reserve addresses published on alef.money. The EVM address is a Safe used on both chains. + ethereum: { + owners: ['0xfB6b384a64BA407Ee964DF70bf48A6Ef993B1Fd4'], + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.WETH, + '0x45804880de22913dafe09f4980848ece6ecbaf78', // PAXG + '0x68749665ff8d2d112fa859aa293f07a622782f38', // XAUt + '0x6c3ea9036406852006290770bedfcaba0e23a0e8', // PYUSD + '0xa45cd7ac9865b9539166ebaf2abc362df4736580', // TQQQon + '0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf', // cbBTC + // Aave V3 aTokens + '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c', // aEthUSDC + '0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a', // aEthUSDT + '0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8', // aEthWETH + '0x5Ee5bf7ae06D1Be5997A1A72006FE6C607eC6DE8', // aEthWBTC + '0x0C0d01AbF3e6aDfcA0989eBbA9d6e85dD58EaB1E', // aEthPYUSD + ], + }, + bsc: { + owners: ['0xfB6b384a64BA407Ee964DF70bf48A6Ef993B1Fd4'], + tokens: [ + nullAddress, + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.USDC, + '0x02fca66c1d1afb4e2a7884261eb00f63598a7436', // NVDAB + '0x5b1910eaad6450e50f816082aa078c41f10c292f', // TSLAB + '0x7425889fe94f9d693e8daefe88bcced6acfef4c0', // METAB + '0x3f53de71c126bdabae20f9cd64848d317f6c3238', // GOOGLB + '0x8b872732b07be325a8803cdb480d9d20b6f8d11b', // SLVon + // Venus vTokens + '0xA07c5b74C9B40447a954e1466938b865b6BBea36', // vBNB + '0xfd5840cd36d94d7229439859c0112a4185bc0255', // vUSDT + '0xeca88125a5adbe82614ffc12d0db554e2e2867c8', // vUSDC + ], + }, + solana: { + owners: [ + '9W22wgpcSsbcAjoGvGQfcvVUns5q7LMuWNPCnM4eVXse', + '9JRZdE4rcSUQRDRUTqNrqsFtxm7caT4GfyiNxFJqBHUe', + ], + ownTokens: ['FBHd9upXFkeWSwe9qEdcgRLa4Y6uzsLCSawrpfPkQZGg'], // ALEF + }, + tron: { + owners: ['TFMDSKrH2FJx3pdGACb5oHoKPJRzaH8dKv'], + tokens: [nullAddress, ADDRESSES.tron.USDT], + }, + bitcoin: { + owners: ['bc1qmqcggscd9mfddzywukrxksrrfamx5mevr5jr40llmf6ggtdmwyeqcaekt4'], + tokens: [nullAddress], + }, + }, } const protocols = {} From 36e9d04b9b079440b0aec035d0a1cf8254cc36bb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 28 Nov 2026 18:08:40 +0100 Subject: [PATCH 946/988] fix adapters --- projects/belt/index.js | 9 ++++++--- projects/helper/env.js | 4 ++++ projects/helper/masterchef.js | 2 ++ projects/helper/rujira/fin.js | 4 +++- projects/helper/rujira/query.js | 6 +++++- projects/helper/unknownTokens.js | 4 +++- registries/masterchef.js | 3 ++- 7 files changed, 25 insertions(+), 7 deletions(-) diff --git a/projects/belt/index.js b/projects/belt/index.js index f56166c7ffa..6504a3b2de1 100644 --- a/projects/belt/index.js +++ b/projects/belt/index.js @@ -9,9 +9,12 @@ const abi = { } const tvl = async (api) => { - const tokens = await api.multiCall({ calls: CONFIG[api.chain], abi: abi.token }) - const suppliesInToken = await api.multiCall({ calls: CONFIG[api.chain], abi: abi.calcPoolValueInToken }) - api.add(tokens, suppliesInToken) + const tokens = await api.multiCall({ calls: CONFIG[api.chain], abi: abi.token, permitFailure: true }) + const suppliesInToken = await api.multiCall({ calls: CONFIG[api.chain], abi: abi.calcPoolValueInToken, permitFailure: true }) + // a vault whose valuation call reverts (two of the klaytn KLAY vaults) is skipped, the rest are still counted + tokens.forEach((token, i) => { + if (token && suppliesInToken[i]) api.add(token, suppliesInToken[i]) + }) } const staking = async (api) => { diff --git a/projects/helper/env.js b/projects/helper/env.js index 7d49192740e..7573dd3c1b8 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -109,6 +109,10 @@ const DEFAULTS = { // Viction: canonical Multicall3 is deployed (since block 87169904) but missing from the SDK deployment map, so every call went out as a single eth_call. // The SDK map entry is added too; drop this line once that sdk version is in use, the map also knows the deployment block. TOMOCHAIN_RPC_MULTICALL_V3: '0xcA11bde05977b3631167028862bE2a173976CA11', + // evm.mantrachain.io pruned its block results ("height N is not available, lowest height is 19.7M"), so logs before that only come from the archive node + MANTRA_ARCHIVAL_RPC: 'https://evm.archive.mantrachain.io,https://blockscout.mantrascan.io/api/eth-rpc', + // Elysium (chainId 99901): the SDK only knows rpc.elysium.kinetiq.xyz, which answers 429 to a single adapter run + ELYSIUM_RPC: 'https://elysium.drpc.org,https://rpc.elysium.kinetiq.xyz', KUSAMA_ASSETHUB_SUBSTRATE_RPC: 'https://kusama-asset-hub-rpc.polkadot.io,https://statemine.api.onfinality.io/public', } diff --git a/projects/helper/masterchef.js b/projects/helper/masterchef.js index 9b4045776f2..99f3614bdde 100644 --- a/projects/helper/masterchef.js +++ b/projects/helper/masterchef.js @@ -163,6 +163,8 @@ function masterChefExports(masterChef, chain, stakingTokenRaw, tokenIsOnCoingeck await Promise.all(symbols.output.map(async (symbol, idx) => { const balance = tokenBalances.output[idx].output; const token = symbol.input.target.toLowerCase(); + // the balance call is made with permitFailure: a pool token that is not an ERC20 has no balance, skip that pool + if (balance === null || balance === undefined) return; if (token === stakingToken) { sdk.util.sumSingleBalance(balances.staking, transformAddress(token), balance) } else if (isLP(symbol.output, symbol.input.target, chain)) { diff --git a/projects/helper/rujira/fin.js b/projects/helper/rujira/fin.js index f4544e3670c..8d2a04a9c6b 100644 --- a/projects/helper/rujira/fin.js +++ b/projects/helper/rujira/fin.js @@ -154,7 +154,9 @@ async function getFinOrders(address, height, version, excludedOwners = []) { try { return await getCurrentFinOrders(address, height) } catch (error) { - if (!error.message.includes('out of gas')) throw error + // the paged all-orders query can run out of gas, or panic inside the contract on one market + // ("attempt to subtract with overflow"); both are read per owner from raw state instead + if (!error.message.includes('out of gas') && !error.message.includes('Error calling the VM')) throw error } } return getOrdersByRawOwners(address, height, version, excluded) diff --git a/projects/helper/rujira/query.js b/projects/helper/rujira/query.js index 0e87466321c..2bd013dd995 100644 --- a/projects/helper/rujira/query.js +++ b/projects/helper/rujira/query.js @@ -18,6 +18,8 @@ const OMITTED_CONTRACTS = new Set([ 'thor1ycnr44val8v9rexn0qa06m920gr4rrrnldkcnf3pah5nr0lkdsxsnxnwsm', // retired Ghost cbBTC vault ]) +const HEAD_LAG_BLOCKS = 10 + const blockCache = new Map() const contractCache = new Map() const contractStateCache = new Map() @@ -177,7 +179,9 @@ async function findBlock(timestamp) { const status = (await getWithRetry(`${THORCHAIN_RPC}/status`)).result.sync_info const latest = Number(status.latest_block_height) const latestTimestamp = Math.floor(Date.parse(status.latest_block_time) / 1000) - if (!timestamp || timestamp >= latestTimestamp - 600) return latest + // the gateway balances over several nodes: stay a few blocks (about 1 minute) behind the head one of them + // reported, or a node that is slightly behind rejects the query with "cannot query with height in the future" + if (!timestamp || timestamp >= latestTimestamp - 600) return latest - HEAD_LAG_BLOCKS // THORChain's post-hard-fork chain begins here; every Rujira deployment is later. let low = Math.max(4_786_560, Number(status.earliest_block_height) || 4_786_560) diff --git a/projects/helper/unknownTokens.js b/projects/helper/unknownTokens.js index 66ce8efc20f..a2caf222d78 100644 --- a/projects/helper/unknownTokens.js +++ b/projects/helper/unknownTokens.js @@ -178,7 +178,9 @@ function masterchefExports({ chain, masterchef, coreAssets = [], nativeTokens = }) const tokens = data.map(({ output }) => getToken(output).toLowerCase()) - const tokenLPs = [...tokens].filter(i => !nativeTokens.includes(i)) + // blacklisted tokens are left out of the balances below, so they must not be probed as LPs either + const blacklistedSet = new Set(blacklistedTokens.map(i => i.toLowerCase())) + const tokenLPs = [...tokens].filter(i => !nativeTokens.includes(i) && !blacklistedSet.has(i)) const tempBalances = await sumTokens2({ chain, block, owner: masterchef, tokens, transformAddress: a => a, blacklistedTokens, skipFixBalances: true, permitFailure: true, }) nativeTokens.forEach(nativeToken => { if (tempBalances[nativeToken]) sdk.util.sumSingleBalance(balances.staking, transform(nativeToken), tempBalances[nativeToken]) diff --git a/registries/masterchef.js b/registries/masterchef.js index e8c3b2dbe6b..abc3ab9ef3f 100644 --- a/registries/masterchef.js +++ b/registries/masterchef.js @@ -747,7 +747,8 @@ const configs = { 'tenet': { misrepresentedTokens: true, ethereum: { masterchef: '0xdA842fad0BDb105c88399e845aD4D00dE3AEb911', nativeToken: '0x74159651a992952e2bf340d7628459aa4593fc05', poolInfoABI: 'function poolSettingInfo(uint256) view returns (address lpToken, address tokenAddr, address projectAddr, uint256 tokenAmount, uint256 startBlock, uint256 endBlock, uint256 tokenPerBlock, uint256 tokenBonusEndBlock, uint256 tokenBonusMultipler)' }, - bsc: { masterchef: '0x3F4c79EB1220BeBBf5eF4B3e7c59E5cf38200b62', nativeToken: '0xdFF8cb622790b7F92686c722b02CaB55592f152C', poolInfoABI: 'function poolSettingInfo(uint256) view returns (address lpToken, address tokenAddr, address projectAddr, uint256 tokenAmount, uint256 startBlock, uint256 endBlock, uint256 tokenPerBlock, uint256 tokenBonusEndBlock, uint256 tokenBonusMultipler)' }, + // blacklisted: three pool lp tokens whose contracts no longer answer token0/token1 + bsc: { masterchef: '0x3F4c79EB1220BeBBf5eF4B3e7c59E5cf38200b62', nativeToken: '0xdFF8cb622790b7F92686c722b02CaB55592f152C', blacklistedTokens: ['0x452a8ee77407d004fad12b8a4a19fe73ef82c481', '0xdbd99e9978efb8b9869207fbaf27f4945081d008', '0x1bbeb29a6e602c89411a40a32fe82c1ddcbd2594'], poolInfoABI: 'function poolSettingInfo(uint256) view returns (address lpToken, address tokenAddr, address projectAddr, uint256 tokenAmount, uint256 startBlock, uint256 endBlock, uint256 tokenPerBlock, uint256 tokenBonusEndBlock, uint256 tokenBonusMultipler)' }, }, 'salem': { misrepresentedTokens: true, From e5eae7a45f409315650218467b33a8038bc6e6bb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 28 Nov 2026 18:48:44 +0100 Subject: [PATCH 947/988] alphalend is paused --- projects/bluefin-alphalend/index.js | 9 +++------ .../{bluefin-alphalend => lending-by-alphafi}/core.js | 0 projects/lending-by-alphafi/index.js | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) rename projects/{bluefin-alphalend => lending-by-alphafi}/core.js (100%) diff --git a/projects/bluefin-alphalend/index.js b/projects/bluefin-alphalend/index.js index 61d5122ed43..ec5ab271d30 100644 --- a/projects/bluefin-alphalend/index.js +++ b/projects/bluefin-alphalend/index.js @@ -1,13 +1,10 @@ -const { tvl, borrowed, SWITCH_TS } = require('./core'); - -// TVL attributed to bluefin until partnership ended 2026-05-17 -const gate = (fn) => async (api) => api.timestamp >= SWITCH_TS ? {} : fn(api); module.exports = { sui: { - tvl: gate(tvl), - borrowed: gate(borrowed), + tvl: () => ({}), + borrowed: () => ({}), }, + deadFrom: "2026-05-17", hallmarks: [ ['2025-05-07', 'AlphaLend Launched'], ['2026-05-17', 'AlphaFi Partnership Ended'], diff --git a/projects/bluefin-alphalend/core.js b/projects/lending-by-alphafi/core.js similarity index 100% rename from projects/bluefin-alphalend/core.js rename to projects/lending-by-alphafi/core.js diff --git a/projects/lending-by-alphafi/index.js b/projects/lending-by-alphafi/index.js index d36e6cd6b68..9e326156e4c 100644 --- a/projects/lending-by-alphafi/index.js +++ b/projects/lending-by-alphafi/index.js @@ -1,4 +1,4 @@ -const { tvl, borrowed, SWITCH_TS } = require('../bluefin-alphalend/core'); +const { tvl, borrowed, SWITCH_TS } = require('./core'); // TVL attributed to bluefin until partnership ended 2026-05-17 const gate = (fn) => async (api) => api.timestamp < SWITCH_TS ? {} : fn(api); From 97a855f15aae2f06b677d0124e650f93a7657b9e Mon Sep 17 00:00:00 2001 From: guanacofi Date: Sun, 29 Nov 2026 08:22:58 -0300 Subject: [PATCH 948/988] Guanaco: value both sides of liquidity pools (#22430) Co-authored-by: Guanaco Team <329703330+guanacofi@users.noreply.github.com> --- projects/guanaco/index.js | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/projects/guanaco/index.js b/projects/guanaco/index.js index 525706eb581..ae706f64b3d 100644 --- a/projects/guanaco/index.js +++ b/projects/guanaco/index.js @@ -19,8 +19,6 @@ const ROSTRUM_ENDPOINTS = [ // Guanaco CashToken market is included (GUA, PUSD, MUSD, and future tokens). const GUANACO_PREFIX = '6a064755414e4143' const GUANACO_GENESIS_BLOCK = 869145 -// GUA, the protocol token, is counted under staking -const GUA_KEY = 'bitcoincash:742a7585d0d5cb35b2a45d26425e23b059b72e82d7036dd97e85da5ab57a8d6c' const PAGE_SIZE = 1000 const REQUEST_TIMEOUT_MS = 15000 @@ -388,7 +386,7 @@ async function fetchPoolUtxos(addresses) { throw lastError || new Error('Unable to query Guanaco pool UTXOs') } -async function poolBalances() { +async function tvl() { const genesisTransactions = await discoverGenesisTransactions() // Do not filter by token category here: this is the TVL of the whole DEX, // not only the GUA/BCH market. @@ -407,33 +405,19 @@ async function poolBalances() { } let bchReserveSats = 0n - const tokenAmounts = new Map() for (const utxo of livePoolUtxos.values()) { - const { category, amount } = utxo.token_data - if (!/^[a-f0-9]{64}$/.test(category)) throw new Error('Invalid CashToken category') - const key = `bitcoincash:${category}` - tokenAmounts.set(key, (tokenAmounts.get(key) || 0n) + BigInt(amount)) + if (!/^[a-f0-9]{64}$/.test(utxo.token_data.category)) throw new Error('Invalid CashToken category') bchReserveSats += BigInt(utxo.value) } - const balances = { 'bitcoin-cash': Number(bchReserveSats) / 1e8 } - for (const [key, amount] of tokenAmounts) balances[key] = amount.toString() - return balances -} - -async function tvl() { - const balances = await poolBalances() - delete balances[GUA_KEY] - return balances -} -async function staking() { - const balances = await poolBalances() - return balances[GUA_KEY] ? { [GUA_KEY]: balances[GUA_KEY] } : {} + // At each 50/50 AMM pool's reserve-implied price, both sides have equal value. + return { 'bitcoin-cash': Number(bchReserveSats * 2n) / 1e8 } } module.exports = { methodology: - 'TVL counts the BCH and fungible CashToken reserves held by live Guanaco v1 pool UTXOs. Pools are found from GUANAC-marked pool genesis transactions and their balances are read from Electrum (Fulcrum/Rostrum) servers. GUA held in the pools is counted under staking.', + 'TVL estimates both sides of live Guanaco v1 BCH/CashToken AMM pools, including GUA/BCH. Pools are discovered from GUANAC-marked genesis transactions and reserves are read from Electrum. The BCH side is doubled to value each 50/50 pool at its implied CashToken price, using the same approach as Cauldron.', start: '2025-09-08', - bitcoincash: { tvl, staking }, + misrepresentedTokens: true, + bitcoincash: { tvl }, } From 18896dce798fea98898b1cd287ecc0fa77b7c278 Mon Sep 17 00:00:00 2001 From: WEEX-BR <167861813+WEEX-BR@users.noreply.github.com> Date: Mon, 30 Nov 2026 15:40:11 +0800 Subject: [PATCH 949/988] Add WEEX reserve wallets on BSC and Polygon (#22445) --- cex/weex-cex.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cex/weex-cex.js b/cex/weex-cex.js index f9c9ddc92f1..8c64ba925fc 100644 --- a/cex/weex-cex.js +++ b/cex/weex-cex.js @@ -57,6 +57,7 @@ module.exports = { }, bsc: { owners: [ + "0x24E17e780cE976536eC7ba2F033C1535BD0D9337", "0x7cBb29a07D63853EC09B84b41B6525354b2771b6", "0xc3b77c3f5a733986558c91e0faf95f1659b1b9b6", "0x7cb8e2896234cbc8494f858e05be30b13ad5ddb7", @@ -75,6 +76,7 @@ module.exports = { }, polygon: { owners: [ + "0x515b4F28F17a3558695e744bCCB8CB84FbFaf899", "0xc3b77c3f5a733986558c91e0faf95f1659b1b9b6", "0x41b8ce8fce54a418d4a523205a6cc50f0c5beff8", "0x091ae4113d0cdfa7877bda4064bd1d19662170fc", From 79a1669a56cf7477b3be9f243ab52a1c15bc0fd8 Mon Sep 17 00:00:00 2001 From: adamgpeters <55671033+adamgpeters@users.noreply.github.com> Date: Mon, 30 Nov 2026 02:40:46 -0500 Subject: [PATCH 950/988] Add HadronFi (Solana prop AMM) TVL adapter (#22443) --- projects/hadronfi/index.js | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/hadronfi/index.js diff --git a/projects/hadronfi/index.js b/projects/hadronfi/index.js new file mode 100644 index 00000000000..f934c441331 --- /dev/null +++ b/projects/hadronfi/index.js @@ -0,0 +1,42 @@ +const { PublicKey } = require("@solana/web3.js"); +const { getConnection, sumTokens2, getAssociatedTokenAddress } = require("../helper/solana"); + +// HadronFi pool Config account (no discriminator). Both deployments share this prefix: +// state u8 @0 (4 = Closed), mint_x @41, mint_y @73, token_program_x @184, token_program_y @216 +// Each pool's two vaults are the Config PDA's associated token accounts for mint_x / mint_y. +const PROGRAMS = [ + // current program (June 2026 onwards), Config = 724 bytes + { program: "HADRoNbLovyqhCsocfYQYB7QdfCAAinN9HTePvBCVDQ8", configSize: 724 }, + // first deployment (Feb-Jun 2026), Config = 248 bytes + { program: "Q72w4coozA552keKDdeeh2EyQw32qfMFsHPu6cbatom", configSize: 248 }, +]; +const STATE_CLOSED = 4; + +async function tvl(api) { + const connection = getConnection(); + const tokenAccounts = []; + + for (const { program, configSize } of PROGRAMS) { + const configs = await connection.getProgramAccounts(new PublicKey(program), { + filters: [{ dataSize: configSize }], + dataSlice: { offset: 0, length: 248 }, + }); + + for (const { pubkey, account } of configs) { + const data = account.data; + if (data[0] === STATE_CLOSED) continue; + const key = (offset) => new PublicKey(data.subarray(offset, offset + 32)); + tokenAccounts.push(getAssociatedTokenAddress(key(41), pubkey, key(184))); + tokenAccounts.push(getAssociatedTokenAddress(key(73), pubkey, key(216))); + } + } + + return sumTokens2({ api, tokenAccounts }); +} + +module.exports = { + timetravel: false, + methodology: + "Counts the SPL and Token-2022 balances in both token vaults of every HadronFi pool that is not closed. Pools are discovered on-chain from the HadronFi programs' pool Config accounts, and each vault is the pool Config PDA's associated token account for that mint.", + solana: { tvl }, +}; From aefc79a9ca224c63af4ab0289b40680b7f7580a3 Mon Sep 17 00:00:00 2001 From: Anton <1749874@gmail.com> Date: Mon, 30 Nov 2026 15:41:21 +0800 Subject: [PATCH 951/988] hydration: read from rpcs that answer (#22447) Co-authored-by: takinanton <191816639+takinanton@users.noreply.github.com> Co-authored-by: Claude Fable 5.2 --- projects/helper/env.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/env.js b/projects/helper/env.js index 7573dd3c1b8..ce322370003 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -59,7 +59,7 @@ const DEFAULTS = { SORA_RPC: 'https://mof2.sora.org', POLKADOT_RELAY_RPC: 'https://rpc.polkadot.io,https://polkadot-rpc.publicnode.com,https://dot-rpc.stakeworld.io', POLKADOT_ASSETHUB_RPC: 'https://polkadot-asset-hub-rpc.polkadot.io,https://statemint.api.onfinality.io/public', - HYDRATION_RPC: 'https://rpc.hydradx.cloud', + HYDRATION_SUBSTRATE_RPC: 'https://hydration-rpc.n.dwellir.com,https://rpc.sin.hydration.cloud', // rpc.hydradx.cloud answers 521 BLOCKFROST_PROJECT_ID: 'mai'+'nnetkI9zWvNxCmBGj2o3'+'afH8b0MYqkmX4xJS', FUEL_CUSTOM_RPC: 'https://mainnet.fuel.network/v1/graphql', TATUM_PUBLIC_API_KEY: "t-" + "698992414f6f4e3435d62161" + "-3d94ca2d70024efdaf3ca6fd", From 6201c09f53e4ffd8cd1702f042b8f4eb76b0eb1b Mon Sep 17 00:00:00 2001 From: Aaron Elijah Mars <61592645+aaronjmars@users.noreply.github.com> Date: Mon, 30 Nov 2026 02:41:56 -0500 Subject: [PATCH 952/988] treasury: add Aeon (#22444) Co-authored-by: aaronjmars Co-authored-by: ccipherx --- registries/treasury.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/registries/treasury.js b/registries/treasury.js index f3ed751a233..cd2642ba3e4 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -495,6 +495,19 @@ const configs = { owners: ['0xd16d904b68429b93f1dfcd837f61aedcd224e8f4'], }, }, + 'treasury/aeon': { + base: { + owners: [ + '0xf1e958db7d1e4c074377946018ad645db4fb158e', // Treasury Safe (3-of-3) + '0x67976cebb5266b50a08c0dcb676e03baf305e3a2', // deployer wallet, receives the swap fee + ], + ownTokens: ['0xbf8e8f0e8866a7052f948c16508644347c57aba3'], // AEON + tokens: [nullAddress, ADDRESSES.base.WETH, ADDRESSES.base.USDC, '0x4e65fE4DbA92790696d040ac24Aa414708F5c0AB'], // aBasUSDC + }, + solana: { + owners: ['8mjMdpdLLt8TPtBtghZmMGnVDAvDmsJZhkBypyDusnCY', 'E3WDuSNakCyA24hnFiqJQohZw4kehcSjxj2HpFSNycQn'], + }, + }, 'treasury/aimstrong': { base: { tokens: [nullAddress], From 71e3b5544356e796b2f296115f994d0f373a7a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Mon, 30 Nov 2026 13:12:28 +0530 Subject: [PATCH 953/988] citrea: track the bridge's BTC after the 11-24 address rotation (#22440) --- registries/sumTokens/data1.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/registries/sumTokens/data1.js b/registries/sumTokens/data1.js index 478964c83b5..f8db1424e39 100644 --- a/registries/sumTokens/data1.js +++ b/registries/sumTokens/data1.js @@ -90,7 +90,8 @@ module.exports = { [ADDRESSES.ethereum.WBTC, "0x2c01390E10e44C968B73A7BcFF7E4b4F50ba76Ed"], ] }, // 2026-10-10 the bridge moved its 110 BTC from the first address to the second, via 11 x 10 BTC hops - "bitcoin": { "owners": ["bc1pl7grnght2uhp75wm03djde5a56syp06ssdjf7ucm4wkq0tetpqas5e20e9", "bc1pclvn3v74l2u8kmw5z9dqcr3ahq54ka74cx4tv8vv2khra7n0ta0qxkrkyv"] }, + // 2026-11-24 it moved them again, from the second address to the third, the same way + "bitcoin": { "owners": ["bc1pl7grnght2uhp75wm03djde5a56syp06ssdjf7ucm4wkq0tetpqas5e20e9", "bc1pclvn3v74l2u8kmw5z9dqcr3ahq54ka74cx4tv8vv2khra7n0ta0qxkrkyv", "bc1p3z2uzu2uuhupu72qwp9eszfmx4u6yhyle406ly0xgwerezkn6yyqq9zsxv"] }, }, "darkness": { "cronos": { From 2d529f9a65e440cae44dd2a5587a46d8c420ec4d Mon Sep 17 00:00:00 2001 From: TesselDev Date: Mon, 30 Nov 2026 15:43:29 +0800 Subject: [PATCH 954/988] Add Tessel TVL adapter (Robinhood Chain) (#22441) Co-authored-by: TesselDev <361755801+TesselDev@users.noreply.github.com> Co-authored-by: ccipherx --- projects/tessel/index.js | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 projects/tessel/index.js diff --git a/projects/tessel/index.js b/projects/tessel/index.js new file mode 100644 index 00000000000..22a8e1a91c7 --- /dev/null +++ b/projects/tessel/index.js @@ -0,0 +1,45 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +// TesselHub deploys and registers every pool: bin pools (tokenX/tokenY) and range pools (token0/token1) hold their own reserves. +const HUB = '0x75F5CcF1891167a96f338A850E3D92DeB766f38c' +// TesselHub.Kind enum values. +const KIND_BIN = 1 +const KIND_RANGE = 2 +// Private withdraw: fixed-amount USDG pools (10, 100 and 1,000 USDG deposits). +const SHIELDED_POOLS = [ + '0xfd4F5caDEa8318370a9e3c7118a121EE06e7d994', + '0xcB66209a2F3078CBc1498d21DCD599581EdB9637', + '0xd3537374eDdAA4f724aA1614f2a1F46677312C3A', +] +// Dark Pool (TesselPrivateLP) v1 (paused) and v2 allow only USDG and WETH. +// Positions it opens sit in hub pools (counted there) or in Uniswap v3 pools (Uniswap TVL). +const DARK_POOLS = ['0x9B14c7BE025329924c0B8874ace64d7deB9e13a3', '0xD41F68CB682057Bd87111C8e3E6aEC6B0AF9066E'] + +async function poolTokens(api, pools, abiA, abiB) { + const tokensA = await api.multiCall({ abi: abiA, calls: pools }) + const tokensB = await api.multiCall({ abi: abiB, calls: pools }) + return pools.flatMap((pool, i) => [[tokensA[i], pool], [tokensB[i], pool]]) +} + +async function tvl(api) { + const pools = await api.fetchList({ lengthAbi: 'uint256:poolCount', itemAbi: 'function allPools(uint256) view returns (address)', target: HUB }) + const kinds = (await api.multiCall({ target: HUB, abi: 'function poolKind(address) view returns (uint8)', calls: pools })).map(Number) + const binPools = pools.filter((_, i) => kinds[i] === KIND_BIN) + const rangePools = pools.filter((_, i) => kinds[i] === KIND_RANGE) + if (binPools.length + rangePools.length !== pools.length) throw new Error('tessel: hub pool of unknown kind') + + const tokensAndOwners = [ + ...(await poolTokens(api, binPools, 'address:tokenX', 'address:tokenY')), + ...(await poolTokens(api, rangePools, 'address:token0', 'address:token1')), + ] + SHIELDED_POOLS.forEach((pool) => tokensAndOwners.push([ADDRESSES.robinhood.USDG, pool])) + DARK_POOLS.forEach((pool) => tokensAndOwners.push([ADDRESSES.robinhood.USDG, pool], [ADDRESSES.robinhood.WETH, pool])) + return api.sumTokens({ tokensAndOwners }) +} + +module.exports = { + methodology: + 'Counts the token balances of every bin and range pool registered in TesselHub, the USDG held by the Private withdraw pools and the USDG and WETH held by the Dark Pool. Dark Pool positions in Tessel pools are counted once, in the pool, and its Uniswap v3 positions are left to Uniswap.', + start: '2026-11-25', + robinhood: { tvl }, +} From f2a59af76a26ce6bd6d161b6f940348d1ba883e0 Mon Sep 17 00:00:00 2001 From: gsprotocol <357894092+gsprotocol@users.noreply.github.com> Date: Mon, 30 Nov 2026 07:44:10 +0000 Subject: [PATCH 955/988] Add Gold Standard Protocol (GSUSD) TVL adapter (#22442) Co-authored-by: ccipherx --- projects/gold-standard/index.js | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 projects/gold-standard/index.js diff --git a/projects/gold-standard/index.js b/projects/gold-standard/index.js new file mode 100644 index 00000000000..94b3a0614d1 --- /dev/null +++ b/projects/gold-standard/index.js @@ -0,0 +1,41 @@ +// Gold Standard Protocol: GSUSD, a stablecoin minted against tokenized gold. + +// GoldVault wires the oracle, silo factory and stability pool, and governance can rotate each. +const GOLD_VAULT = '0x9BDd28CEF1DFf26ce2401aD2A33eb521afa32146' + +async function tvl(api) { + const [oracle, siloFactory, stabilityPool] = await api.batchCall([ + { target: GOLD_VAULT, abi: 'address:oracle' }, + { target: GOLD_VAULT, abi: 'address:siloFactory' }, + { target: GOLD_VAULT, abi: 'address:stabilityPool' }, + ]) + const tokens = await api.call({ target: oracle, abi: 'address[]:getSupportedTokens' }) + + // Vault collateral sits in silos, a growing list per token. + const counts = await api.multiCall({ + target: siloFactory, + abi: 'function getSiloCount(address token) view returns (uint256)', + calls: tokens, + }) + const siloCalls = [] + tokens.forEach((token, i) => { + for (let index = 0; index < Number(counts[i]); index++) siloCalls.push({ token, params: [token, index] }) + }) + const silos = await api.multiCall({ + target: siloFactory, + abi: 'function getSilo(address token, uint256 index) view returns (address)', + calls: siloCalls.map(({ params }) => ({ params })), + }) + + const tokensAndOwners = siloCalls.map(({ token }, i) => [token, silos[i]]) + for (const token of tokens) tokensAndOwners.push([token, stabilityPool]) + + return api.sumTokens({ tokensAndOwners }) +} + +module.exports = { + methodology: + 'Tokenized gold (PAXG, and XAUT once activated) posted as vault collateral in the protocol silos, plus gold seized by the stability pool that depositors have not yet claimed. Protocol-owned gold in the Gold Stability Reserve and the surplus buffer is not counted. GSUSD itself is not counted.', + start: '2026-11-27', + ethereum: { tvl }, +} From e1c7ccc5db3b97ec2d47fe4a5064c2f0afbe5b07 Mon Sep 17 00:00:00 2001 From: Dani Date: Mon, 30 Nov 2026 08:45:37 +0100 Subject: [PATCH 956/988] Lista: add Lista Launchpool Staking, stop counting it in Lista CDP (resolves #22448) (#22450) Co-authored-by: tyler-tsai <15355143+tyler-tsai@users.noreply.github.com> --- projects/helio-money/index.js | 5 ++++- registries/sumTokens.js | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/projects/helio-money/index.js b/projects/helio-money/index.js index aab9d3e286d..7012c738423 100644 --- a/projects/helio-money/index.js +++ b/projects/helio-money/index.js @@ -1,6 +1,9 @@ const { getConfig } = require("../helper/cache"); const { staking } = require("../helper/staking"); +// slisBNB staked for Binance Launchpool, counted in lista-launchpool-staking +const SLISBNB_PROVIDER = "0xfD31e1C5e5571f8E7FE318f80888C1e6da97819b".toLowerCase(); + const lisLPs = [ "0xe8f4644637f127aFf11F9492F41269eB5e8b8dD2", // Lista LP Stable-LP "0xFf5ed1E64aCA62c822B178FFa5C36B40c112Eb00", // Lista LP aSnBNB-WBNB @@ -34,7 +37,7 @@ module.exports = { bsc: { tvl: async (api) => { const { data: tokensAndOwners } = await getConfig('helio/vaults', 'https://api.lista.org/api/defiLlama/cdp-vault-list'); - return api.sumTokens({ tokensAndOwners }) + return api.sumTokens({ tokensAndOwners: tokensAndOwners.filter(([, owner]) => owner.toLowerCase() !== SLISBNB_PROVIDER) }) }, pool2, staking: staking('0xd0C380D31DB43CD291E2bbE2Da2fD6dc877b87b3', '0xFceB31A79F71AC9CBDCF853519c1b12D379EdC46') diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 5a4b093b345..0b6ea6c455b 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -17698,6 +17698,16 @@ const configs = { ] }, }, + "lista-launchpool-staking": { + "methodology": "slisBNB held by the Lista SlisBNBProvider and staked for Binance Launchpool eligibility. It is not collateral and borrows nothing. It was moved out of the Lista CDP on 2026-11-27, and the Lista CDP adapter no longer counts it.", + "start": "2026-11-27", + "bsc": { + "owner": "0xfD31e1C5e5571f8E7FE318f80888C1e6da97819b", + "tokens": [ + "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B" + ] + }, + }, "livara": { "methodology": "TVL is the total USDT locked in the LivaraPoolsEscrow smart contract on Polygon, representing funds held across all open prediction pools awaiting settlement.", "polygon": { From 2d73e70e6c6a4c1bc5bd559afecfd0b9719ba778 Mon Sep 17 00:00:00 2001 From: Anton-Manuilov Date: Mon, 30 Nov 2026 14:46:05 +0700 Subject: [PATCH 957/988] Add BasketCoin TVL adapter (Base) (#22438) Co-authored-by: Anton-Manuilov <318130466+Anton-Manuilov@users.noreply.github.com> Co-authored-by: ccipherx --- registries/sumTokens.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index 0b6ea6c455b..af4bbd71e2f 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -1918,6 +1918,14 @@ const configs = { ] }, }, + "basketcoin": { + start: '2026-11-19', + methodology: 'Counts the USDC and USDT held by BasketVault, the collateral users deposit to mint BKT and receive back when they redeem.', + base: { + owner: '0xf1CA2eee2ab96290C799Df2006E41197B71244c9', + tokens: [ADDRESSES.base.USDC, ADDRESSES.base.USDT], + }, + }, "basis-market": { "methodology": "TVL for basis market is staking for now", "solana": { From 668c1699c88d9bd8c089025afdd6e6dd17791d68 Mon Sep 17 00:00:00 2001 From: mriusd <129206706+mriusd@users.noreply.github.com> Date: Mon, 30 Nov 2026 09:46:34 +0200 Subject: [PATCH 958/988] Add Arizal Exchange (Prediction Market, Arbitrum) (#22437) Co-authored-by: ccipherx --- registries/sumTokens.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index af4bbd71e2f..d0d5ceb35a6 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -1446,6 +1446,11 @@ const configs = { ] }, }, + "arizal": { + methodology: 'Total USDC collateral and open market escrow held in the immutable Arizal Exchange contract on Arbitrum One.', + start: '2026-11-27', + arbitrum: { owner: '0xdAafA03dE2D4aC854AbB7Ec7b3D05060F3f6cb3d', tokens: [ADDRESSES.arbitrum.USDC_CIRCLE] }, + }, "arkadiko": { "stacks": { "owners": [ From d13cce34191bc06a67885efca54f692a10e7096b Mon Sep 17 00:00:00 2001 From: Son of Adam <86789882+Son-of-Adam7@users.noreply.github.com> Date: Mon, 30 Nov 2026 02:52:56 -0500 Subject: [PATCH 959/988] Add Goldstein Group (TVL + treasury) (#22446) Co-authored-by: Claude Fable 5.2 Co-authored-by: ccipherx --- projects/goldstein/index.js | 103 +++++++++++++++++++++++++++++++++ projects/treasury/goldstein.js | 37 ++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 projects/goldstein/index.js create mode 100644 projects/treasury/goldstein.js diff --git a/projects/goldstein/index.js b/projects/goldstein/index.js new file mode 100644 index 00000000000..54107850ea8 --- /dev/null +++ b/projects/goldstein/index.js @@ -0,0 +1,103 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs2 } = require('../helper/cache/getLogs') +const { ethers } = require('ethers') + +const GLDSTN = '0xfCE34D21A92069100E3226638140706cF03a266E' +const USDG = ADDRESSES.robinhood.USDG + +// G-Funds: each FundVault is the share token; its assets sit in an ownerless FundBook (vault.book()), +// pending USDG creations sit in the vault's CreationEscrow (vault.escrow()). +// lpRewards = the fund pool's LP rewards contract (Uniswap v4 position NFTs are staked into it). +const FUNDS = [ + { vault: '0x0a4Be7073bc336e451082502D768E8D644CA780c', lpRewards: '0x1b52C934954bc3B4Aa29D07fd422779C47F9fa61', fromBlock: 100084618 }, // gAIX + { vault: '0x5BE5B092ad0D1f0C81f394F0E00086196115779c', lpRewards: '0xdc7C3a8bd003cE645EEB01b33456fb36B29af20a', fromBlock: 100084639 }, // gHOOD + { vault: '0x6097C97446606F4D916286F73D381D032cDE7757', lpRewards: '0x6ee47D99Ba3975EF2c4312C838306E771c1a43C5', fromBlock: 113546476 }, // gsHOOD +] +const FUND_SHARES = FUNDS.map(f => f.vault) + +const STAKING = '0xd1b722B4A16491c7240e6ad9AB63ae1eA520fb83' // GoldsteinStaking +const BOOSTER = '0x6CDcd4BEeeD9Ef4eD9D961ACb51e5486B1339016' // StakingBooster (also holds the unstreamed reward budget) +const VESTING = [ + '0x3060aDe79732e760eE3C7FbB1342e38387838339', // PulseVestedStake (vesting airdrop allocations) + '0x6a63bBde70f9BdDD0a5F1ce7baA68da9477de22B', // TeamVestedStake +] + +// The protocol-owned GLD/GLDSTN positions are treasury, counted in projects/treasury/goldstein.js +const V4_POSITION_MANAGER = '0x58daec3116aae6D93017bAAea7749052E8a04fA7' + +const liveFunds = async (api) => { + const block = await api.getBlock() + return FUNDS.filter(f => f.fromBlock < block) +} + +// gsHOOD engines post USDG as collateral in their own Morpho Blue instance (not the one projects/morpho-blue tracks) +async function addEngineCollateral(api, engines) { + const morphos = await api.multiCall({ abi: 'address:MORPHO', calls: engines }) + const markets = await api.multiCall({ abi: 'function marketParams() view returns (address, address, address, address, uint256)', calls: engines }) + const ids = markets.map(m => ethers.keccak256(ethers.AbiCoder.defaultAbiCoder().encode(['address', 'address', 'address', 'address', 'uint256'], [...m]))) + const positions = await api.multiCall({ abi: 'function position(bytes32, address) view returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral)', calls: engines.map((engine, i) => ({ target: morphos[i], params: [ids[i], engine] })) }) + positions.forEach((p, i) => { + if (BigInt(p.collateral) === 0n) return + if (markets[i][1].toLowerCase() !== USDG.toLowerCase()) throw new Error(`engine ${engines[i]} collateral is not USDG`) + api.add(USDG, p.collateral) + }) +} + +async function tvl(api) { + const vaults = (await liveFunds(api)).map(f => f.vault) + const books = await api.multiCall({ abi: 'address:book', calls: vaults }) + const escrows = await api.multiCall({ abi: 'address:escrow', calls: vaults }) + const listed = await api.multiCall({ abi: 'address[]:everListedAssets', calls: vaults }) + + const calls = listed.flatMap((tokens, i) => tokens.map(token => ({ target: token, params: books[i] }))) + const tokens = calls.map(c => c.target) + // probe: only the gsHOOD short engines are ERC-4626, plain tokens revert on asset() + const underlyings = await api.multiCall({ abi: 'address:asset', calls: tokens, permitFailure: true }) + const engines = [...new Set(tokens.filter((_, i) => underlyings[i]))] + await addEngineCollateral(api, engines) + + // idle USDG: pending creations (escrow), the vault itself and the engines + await api.sumTokens({ owners: [...escrows, ...vaults, ...engines], tokens: [USDG] }) + const plain = calls.filter((_, i) => !underlyings[i]) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: plain }) + api.add(plain.map(c => c.target), bals) +} + +async function staking(api) { + await api.sumTokens({ owner: STAKING, tokens: [GLDSTN] }) + // Booster: staked + cooling down + rewards already owed to stakers; the unstreamed reward budget is left out + for (const abi of ['uint256:totalBooster', 'uint256:totalUnstaking', 'uint256:totalPending']) + api.add(GLDSTN, await api.call({ abi, target: BOOSTER })) +} + +async function vesting(api) { + return api.sumTokens({ owners: VESTING, tokens: [GLDSTN] }) +} + +// keep only the unique staked position ids, not every Staked log +const stakedIds = ({ cache, logs }) => { + cache.logs = [...new Set([...(cache.logs ?? []), ...logs.map(l => l.tokenId.toString())])] +} + +async function pool2(api) { + // fund pools: positions staked in each fund's LP rewards contract + const candidates = [] + for (const { lpRewards, fromBlock } of await liveFunds(api)) { + const ids = await getLogs2({ api, target: lpRewards, fromBlock, eventAbi: 'event Staked(uint256 indexed tokenId, address indexed owner, uint128 liquidity, uint256 weight)', extraKey: 'staked-ids', customCacheFunction: stakedIds }) + ids.forEach(id => candidates.push({ id, holder: lpRewards })) + } + + // burned positions revert on ownerOf + const owners = await api.multiCall({ abi: 'function ownerOf(uint256) view returns (address)', target: V4_POSITION_MANAGER, calls: candidates.map(c => c.id), permitFailure: true }) + const positionIds = candidates.filter((c, i) => owners[i] && owners[i].toLowerCase() === c.holder.toLowerCase()).map(c => c.id) + if (!positionIds.length) return {} + + // fund shares are left out: their underlying is already in tvl. Only the USDG side of fund pools is counted. + return sumTokens2({ api, resolveUniV4: true, uniV4ExtraConfig: { positionIds }, blacklistedTokens: FUND_SHARES }) +} + +module.exports = { + methodology: 'TVL is the underlying assets of the G-Funds: every token held in each fund\'s book plus idle USDG awaiting creation. For the gsHOOD short fund, the USDG its engine holds and posts as collateral in its Morpho Blue market is counted. Fund share tokens are not counted. Staking is GLDSTN in the staking contract and the GLDSTN staked, unstaking or owed as rewards in the Booster. Vesting is GLDSTN in the vested-stake contracts. Pool2 is the Uniswap v4 positions staked in the fund pools\' LP rewards contracts (USDG side only, the fund-share side is already in TVL). The protocol-owned GLD/GLDSTN positions are treasury and are counted in the treasury adapter, not here.', + robinhood: { tvl, staking, vesting, pool2 }, +} diff --git a/projects/treasury/goldstein.js b/projects/treasury/goldstein.js new file mode 100644 index 00000000000..2b72ee6fa06 --- /dev/null +++ b/projects/treasury/goldstein.js @@ -0,0 +1,37 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +// Goldstein Group treasury: the protocol-owned GLD/GLDSTN Uniswap v4 positions, held by the LP custodian. +// The V4 PositionManager has no tokenOfOwnerByIndex, so the custodian's own arrivals list names the positions; +// only those it still owns are counted. +const LP_CUSTODIAN = '0xdfA6d045DBB3F538A7Dcca549e262Ae549514744' +const GLDSTN = '0xfCE34D21A92069100E3226638140706cF03a266E' +const V4_POSITION_MANAGER = '0x58daec3116aae6D93017bAAea7749052E8a04fA7' + +async function getPositionIds(api) { + const ids = (await api.fetchList({ lengthAbi: 'arrivalsCount', itemAbi: 'function arrivals(uint256) view returns (uint256)', target: LP_CUSTODIAN })) + .map(id => id.toString()) + if (!ids.length) return [] + // burned positions revert on ownerOf + const owners = await api.multiCall({ abi: 'function ownerOf(uint256) view returns (address)', target: V4_POSITION_MANAGER, calls: ids, permitFailure: true }) + return ids.filter((_, i) => owners[i] && owners[i].toLowerCase() === LP_CUSTODIAN.toLowerCase()) +} + +// the non-GLDSTN side of the positions (GLD) +async function tvl(api) { + const positionIds = await getPositionIds(api) + if (positionIds.length) + await sumTokens2({ api, resolveUniV4: true, uniV4ExtraConfig: { positionIds, nftAddress: V4_POSITION_MANAGER, blacklistedTokens: [GLDSTN] } }) + return api.getBalances() +} + +// the GLDSTN side of the positions +async function ownTokens(api) { + const positionIds = await getPositionIds(api) + if (positionIds.length) + await sumTokens2({ api, resolveUniV4: true, uniV4ExtraConfig: { positionIds, nftAddress: V4_POSITION_MANAGER, whitelistedTokens: [GLDSTN] } }) + return api.getBalances() +} + +module.exports = { + robinhood: { tvl, ownTokens }, +} From 0b91cae461345774685d621af4a8d4cb2cb03c77 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 30 Nov 2026 11:03:08 +0000 Subject: [PATCH 960/988] univ4 usdb (#22456) --- projects/uniswap-v4/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/uniswap-v4/index.js b/projects/uniswap-v4/index.js index 7bb5bafd66d..500651e0ee6 100644 --- a/projects/uniswap-v4/index.js +++ b/projects/uniswap-v4/index.js @@ -72,6 +72,7 @@ const subgraphs = { '0xbc33b4d48f76d17a1800afcb730e8a6aaada7fe5', // vDOT was hacked '0x570b1533f6daa82814b25b62b5c7c4c55eb83947', // BOBO is mispriced '0x454f8c3f1fc79a98363db6104a20ac59a02a3133', // GPX: 99.9% of supply sits unsold in hook 0x4519e2b0, ~$516M phantom TVL + '0x9c1450eb79317fba40772e7db5911a3f4be2ff88', // USDB: ~353M one-sided vs <=$13M USDC, ~$355M phantom TVL ] }, } From 47113307a57fdd7773016849a631d4d3266da48a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=82=BFhari?= <152027898+BhariGowda@users.noreply.github.com> Date: Mon, 30 Nov 2026 17:02:32 +0530 Subject: [PATCH 961/988] sideshift: count XAI held by svXAI, not the svXAI share supply (#22432) --- projects/sideshift/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/sideshift/index.js b/projects/sideshift/index.js index 958bbba9a95..566fb5154a6 100644 --- a/projects/sideshift/index.js +++ b/projects/sideshift/index.js @@ -1,15 +1,15 @@ const xaiAddress = "0x35e78b3982e87ecfd5b3f3265b601c046cdbe232"; const svxaiAddress = "0x3808708e761b988d23ae011ed0e12674fb66bd62"; -async function tvl(api) { - const supply = await api.call({ abi:'erc20:totalSupply' , target: svxaiAddress }) - api.add(xaiAddress, supply) +// svXAI is an ERC4626 vault over XAI, so its share supply understates the XAI it holds +async function staking(api) { + return api.sumTokens({ owner: svxaiAddress, tokens: [xaiAddress] }) } module.exports = { - methodology: "Sum of XAI tokens held by stakers", + methodology: "Sum of XAI tokens held by the svXAI staking vault", ethereum: { tvl: () => ({}), - staking: tvl, + staking, }, }; From 1e503c5fcf734fa545a99cd0b61a925e4149e977 Mon Sep 17 00:00:00 2001 From: Andrew Sharapov Date: Mon, 30 Nov 2026 14:49:35 +0300 Subject: [PATCH 962/988] Add ZEUS ZLP TVL on Base (#22431) Co-authored-by: FelixBruguera --- registries/gmx.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registries/gmx.js b/registries/gmx.js index 5e7aa5ee44c..ed6e4f73fc7 100644 --- a/registries/gmx.js +++ b/registries/gmx.js @@ -121,6 +121,10 @@ const configs = { 'yyex': { btr: '0x16Aa605Ca2cBE921AAC6C4838c1109b3cf9d444F', }, + 'zeustrade': { + start: '2026-04-27', + base: '0xEAC80C1722E8990AAFeB2Ea3bcF040D29f722bd9', + }, // === gmxExports (v1) with staking === 'amped': { From 7afeb458b4b19587ffbad0c0c8c8d5312312982a Mon Sep 17 00:00:00 2001 From: OxForged Date: Mon, 30 Nov 2026 04:13:02 -0800 Subject: [PATCH 963/988] PeddleSwap: add BNB Chain and Elysium (#22449) --- registries/uniswapV2.js | 4 +++- registries/uniswapV3.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/registries/uniswapV2.js b/registries/uniswapV2.js index 80124329954..4fb318a3903 100644 --- a/registries/uniswapV2.js +++ b/registries/uniswapV2.js @@ -28,11 +28,13 @@ function uniV2ExportFn(chainConfigs, options = {}) { const uniV2Configs = { 'peddleswap-v2': { start: '2026-09-12', - methodology: 'Value of reserves in PeddleSwap V2 pools on Robinhood Chain, Base, Arc and Anubis, discovered from each factory. Uses the standard core-asset reserve valuation.', + methodology: 'Value of reserves in PeddleSwap V2 pools on Robinhood Chain, Base, Arc, Anubis, BNB Chain and Elysium, discovered from each factory. Uses the standard core-asset reserve valuation.', robinhood: '0x5612aEAE68a31f5dD1fb995e2d47B795fEDe8779', base: '0x0fC7E9BB0b2F84b33a16F6b985F8e99c4E104cd9', arc: '0x4dcBA0BD291e68D9A3A64A8900C4A67Cd1B149d3', anubi: '0x3ca4C9F740003bCd7fEbF5d4C7c2956E5860D803', + bsc: '0x0482B678A56c65Bb96Aa82576d8B50a178a35613', + elysium: '0x0482B678A56c65Bb96Aa82576d8B50a178a35613', }, 'pentaswap': { pentagonchain: '0xC75C7E9352bC1475d7c308E65C0a21969DcEdEe7' }, 'bbbfi-swap-v2': { diff --git a/registries/uniswapV3.js b/registries/uniswapV3.js index 22699362803..1bd0f260342 100644 --- a/registries/uniswapV3.js +++ b/registries/uniswapV3.js @@ -5,11 +5,13 @@ const { buildProtocolExports } = require('./utils') const uniV3Configs = { 'peddleswap-v3': { start: '2026-09-12', - methodology: 'Token balances in PeddleSwap V3 pools on Robinhood Chain, Base, Arc and Anubis, discovered from factory PoolCreated events.', + methodology: 'Token balances in PeddleSwap V3 pools on Robinhood Chain, Base, Arc, Anubis, BNB Chain and Elysium, discovered from factory PoolCreated events.', robinhood: { factory: '0xd0E25fD59A18f9728E11A04a24CaF0982231cf95', fromBlock: 61044184 }, base: { factory: '0x8f5890e843C89a7f963ecdEFF84D0900518AE106', fromBlock: 51852483 }, arc: { factory: '0x94C0883ec4A24BD69610bdD408Fd8263119827A2', fromBlock: 23924352 }, anubi: { factory: '0xE645978542a389697c235763DacD2eb960295656', fromBlock: 18380937 }, + bsc: { factory: '0xe16e255745B1403991D892DF4002ec668a1FE429', fromBlock: 136324000 }, + elysium: { factory: '0xe16e255745B1403991D892DF4002ec668a1FE429', fromBlock: 12498620 }, }, 'bbbfi-swap-v3': { methodology: 'Token balances in BBBFi-owned V3 pools on XDC and BSC, discovered from factory PoolCreated events. Tokens retain their original chain and address for DefiLlama pricing. Staked position NFTs are not counted a second time; reward budgets and bridge reserves are excluded.', From 82a493b75deda1d8092b20280f94cb09d157e3c2 Mon Sep 17 00:00:00 2001 From: Kevin Mehrabi <4044328+KevinMehrabi@users.noreply.github.com> Date: Mon, 30 Nov 2026 07:17:45 -0500 Subject: [PATCH 964/988] Add TEZEX TVL Adapter (#22433) Co-authored-by: FelixBruguera --- registries/sumTokens.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index d0d5ceb35a6..c006741e029 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -28044,6 +28044,19 @@ const configs = { "logCalls": true }, }, + "tezex": { + "methodology": "Counts native XTZ and token balances held by TEZEX liquidity pool contracts on Tezos, including unclaimed fees held in the pools. Excludes Sirius and other third-party pools accessible through the TEZEX interface.", + "start": "2025-12-18", + "timetravel": false, + "tezos": { + "owners": [ + "KT1VqphtqcszFRi9gzhLTgMBopDw1xQ1UzBd", + "KT1C9RPUSsF4pYuMWBCUM7UReuCqdivWqsMM", + "KT19FfCZgzcAuRxXxNRgAJ5i4pRtvBWFtGKH" + ], + "includeTezos": true + }, + }, "tezos-baking": { "methodology": "Liquidity on tezos' tzBTC-XTZ pair", "tezos": { From 6115ff756be5175e14ca26a66579a7de7337fe2c Mon Sep 17 00:00:00 2001 From: Bartlomiej Tarczynski <51199571+b-tarczynski@users.noreply.github.com> Date: Mon, 30 Nov 2026 13:58:59 +0100 Subject: [PATCH 965/988] Update Spark Liquidity Layer allocations (#22455) --- projects/spark-liquidity-layer/index.js | 63 ++++++++++++++++++------- 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/projects/spark-liquidity-layer/index.js b/projects/spark-liquidity-layer/index.js index df2db0272d3..ceb8c05b985 100644 --- a/projects/spark-liquidity-layer/index.js +++ b/projects/spark-liquidity-layer/index.js @@ -25,11 +25,15 @@ const almProxyFreezable = { const pauAlmProxies = { ethereum: { - spusdc: '0x8D719A830b00e5571db00D173505CD56c0Ec224a' + spusdc: '0x8D719A830b00e5571db00D173505CD56c0Ec224a', + spusdt: '0x982e90885e21cfDE0557A96bac1a65Fdafc0D29b', + }, + arbitrum: { + spusdt: '0x6172A812bd36a7C21733bFc99991250E81768aaf', }, xlayer: { - spusdc: '0xe6D5d041Fc5e7fDD0A53C13e78a1cc7e4ffCb667' - } + spusdc: '0xe6D5d041Fc5e7fDD0A53C13e78a1cc7e4ffCb667', + }, } const mainnetAllocatorToTokens = { @@ -45,28 +49,40 @@ const mainnetAllocatorToTokens = { ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDG, + '0x9f6F3991D525015a6F8CaF062C83b62fD3AC4436', // OUSD '0x09AA30b182488f769a9824F15E6Ce58591Da4781', // aEthLidoUSDS '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c', // aEthUSDC '0x32a6268f9Ba3642Dda7892aDd74f1D34469A4259', // aEthUSDS + '0x23878914efe38d27c4d67ab83ed1b93a74d4086a', // aaveCoreUsdt '0x6a9DA2D710BB9B700acde7Cb81F10F1fF8C89041', // BUIDL-I '0x43415eB6ff9DB7E26A15b704e7A3eDCe97d31C4e', // USTB - '0x8c213ee79581Ff4984583C6a801e5263418C4b86', // JTSRY + '0x8c213ee79581Ff4984583C6a801e5263418C4b86', // JTRSY '0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b', // syrupUSDC '0x356B8d89c1e1239Cbbb9dE4815c39A1474d5BA7D', // syrupUSDT '0x779224df1c756b4EDD899854F32a53E8c2B2ce5d', // spPYUSD '0xe7dF13b8e3d6740fe17CBE928C7334243d86c92f', // spUSDT '0x377C3bd93f2a2984E1E7bE6A5C22c525eD4A4815', // spUSDC + '0x59275Fb72c8004F44BA44432e25082932Fd677f1', // spRLUSD + '0x6f335538257ef440F3c51e925a5C820f722a1F9F', // spUSDG '0x56A76b428244a50513ec81e225a293d128fd581D', // morpho Spark Blue Chip USDC Vault '0xc7CDcFDEfC64631ED6799C95e3b110cd42F2bD22', // morpho Spark Blue Chip USDT Vault v1 '0xb0c424116172B55CbB6dD3136F5989F7959e5B91', // morpho Spark Blue Chip USDT Vault v2 '0x14d60E7FDC0D71d8611742720E4C50E7a974020c', // Superstate's USCC '0x6c3ea9036406852006290770BEdFcAbA0e23A0e8', // pyUSD '0x8292bb45bf1ee4d140127049757c2e0ff06317ed', // rlUSD - '0x23878914efe38d27c4d67ab83ed1b93a74d4086a', // aaveCoreUsdt ], [pauAlmProxies.ethereum.spusdc]: [ ADDRESSES.ethereum.USDC, - ] + '0x377C3bd93f2a2984E1E7bE6A5C22c525eD4A4815', // spUSDC + '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c', // aEthUSDC + '0x56A76b428244a50513ec81e225a293d128fd581D', // morpho Spark Blue Chip USDC Vault + ], + [pauAlmProxies.ethereum.spusdt]: [ + ADDRESSES.ethereum.USDT, + '0xe7dF13b8e3d6740fe17CBE928C7334243d86c92f', // spUSDT + '0x23878914efe38d27c4d67ab83ed1b93a74d4086a', // aaveCoreUsdt + '0xb0c424116172B55CbB6dD3136F5989F7959e5B91', // morpho Spark Blue Chip USDT Vault v2 + ], } const baseAllocatorToTokens = { @@ -80,8 +96,13 @@ const baseAllocatorToTokens = { } const arbitrumAllocatorToTokens = { - [almProxy.arbitrum]: [ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.USDT], + [almProxy.arbitrum]: [ + ADDRESSES.arbitrum.USDC_CIRCLE, + ADDRESSES.arbitrum.USDT, + '0x724dc807b04555b71ed48a6896b6F41593b8C637', // aArbUSDC + ], '0x2B05F8e1cACC6974fD79A673a341Fe1f58d27266': [ADDRESSES.arbitrum.USDC_CIRCLE], + [pauAlmProxies.arbitrum.spusdt]: [ADDRESSES.arbitrum.USDT], } const optimismAllocatorToTokens = { @@ -105,9 +126,14 @@ const robinhoodAllocatorToTokens = { [almProxy.robinhood]: [ADDRESSES.robinhood.USDG], } +const XLAYER_USDC = '0xB6CEceAB302E2E4948951eE7843FC24E92933061' + const xlayerAllocatorToTokens = { - [almProxy.xlayer]: [ADDRESSES.xlayer.USDT], - [pauAlmProxies.xlayer.spusdc]: [ADDRESSES.xlayer.USDC] + [almProxy.xlayer]: [ADDRESSES.xlayer.USDT0, XLAYER_USDC], + [pauAlmProxies.xlayer.spusdc]: [ + XLAYER_USDC, + '0xDb6C283f8026a2D1D69b90464011baFB0A1090F4', // morpho Spark Blue Chip USDC Vault v2 + ], } const CONFIG = { @@ -151,7 +177,7 @@ async function tvl(api) { } } -module.exports.methodology = 'Counts the assets held by the Spark Liquidity Layer allocators (ALM Proxy, freezable ALM Proxy and PSM3) on each chain. Sky-minted USDS, sUSDS and DAI are excluded, and their SparkLend and Morpho positions are counted only to the extent third parties have borrowed against them; other supplied assets such as PYUSD, USDT and USDC are counted in full. spWETH is excluded as it backs Spark Savings ETH, which is counted under spark-savings. The Anchorage custody allocation is sourced off-chain.' +module.exports.methodology = 'Counts the assets held by the Spark Liquidity Layer allocators (ALM Proxy, freezable ALM Proxy, PAU ALM Proxies and PSM3) on each chain. Sky-minted USDS, sUSDS and DAI are excluded, and their SparkLend and Morpho positions are counted only to the extent third parties have borrowed against them; other supplied assets such as PYUSD, USDT and USDC are counted in full. spWETH is excluded as it backs Spark Savings ETH, which is counted under spark-savings. The Anchorage custody allocation is sourced off-chain.' Object.keys(CONFIG).forEach((chain) => { module.exports[chain] = { tvl } @@ -278,14 +304,14 @@ async function addMorphoBalances(api) { }) const totals = marketsData.reduce( - (sum, current) => ({ - borrowed: sum.borrowed + Number(current.totalBorrowAssets), - supplied: sum.supplied + Number(current.totalSupplyAssets), - }), - { - borrowed: 0, - supplied: 0, - }, + (sum, current) => ({ + borrowed: sum.borrowed + Number(current.totalBorrowAssets), + supplied: sum.supplied + Number(current.totalSupplyAssets), + }), + { + borrowed: 0, + supplied: 0, + }, ) const utilization = totals.borrowed / totals.supplied @@ -381,6 +407,7 @@ async function addUniswapV4Balances(api) { api, owner: almProxy.ethereum, resolveUniV4: true, + blacklistedTokens: [ADDRESSES.ethereum.USDS, ADDRESSES.ethereum.sUSDS, ADDRESSES.ethereum.DAI], }) } From 17a7ce1925c329f4bbccd1a3145e0c494c5c7744 Mon Sep 17 00:00:00 2001 From: Jasper <104004836+j-vp@users.noreply.github.com> Date: Mon, 30 Nov 2026 14:26:02 +0100 Subject: [PATCH 966/988] fix(arcadia-finance-v2): count version 5 margin accounts (#10) (#22458) --- projects/arcadia-finance-v2/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/arcadia-finance-v2/index.js b/projects/arcadia-finance-v2/index.js index 8ce99486739..857377a8b3b 100644 --- a/projects/arcadia-finance-v2/index.js +++ b/projects/arcadia-finance-v2/index.js @@ -281,10 +281,10 @@ async function tvl (api) { const isCurrentRun = !api.timestamp || api.timestamp > now - 3600 const accounts = await getAccounts(api, factory, isCurrentRun) - // Account version 1 has a stored state of all assets, and can be fetched using generateAssetData() - // Account version 2 has no such stored state, and must be fetched with external api calls. + // Margin accounts (versions 1, 3 and 5) have a stored state of all assets, and can be fetched using generateAssetData() + // Spot accounts (versions 2 and 4) have no such stored state, and must be fetched with external api calls. const versions = await api.multiCall({abi: 'function ACCOUNT_VERSION() view returns (uint256)', calls: accounts, permitFailure: true }); - const v1Accounts = accounts.filter((_, i) => versions[i] === '1' || versions[i] === '3'); + const v1Accounts = accounts.filter((_, i) => versions[i] === '1' || versions[i] === '3' || versions[i] === '5'); const v2Accounts = accounts.filter((_, i) => versions[i] === '2' || versions[i] === '4'); // This endpoint uses the following logic: From c4a3ec60cc877415c2ab5bf68dbe752637e9fd87 Mon Sep 17 00:00:00 2001 From: zlp <326275259+zlp-fi@users.noreply.github.com> Date: Mon, 30 Nov 2026 08:40:11 -0500 Subject: [PATCH 967/988] Add ZLP (Base v4 Liquidity Manager) (#22434) Co-authored-by: ZLP <0x@zlp.fi> Co-authored-by: FelixBruguera --- projects/zlp/index.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 projects/zlp/index.js diff --git a/projects/zlp/index.js b/projects/zlp/index.js new file mode 100644 index 00000000000..e90c86309ed --- /dev/null +++ b/projects/zlp/index.js @@ -0,0 +1,41 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2, unwrapSlipstreamNFT } = require('../helper/unwrapLPs') + +const META_VAULTS = [ + '0x36662a82b9EB4217BD5E10e1899822b59Df4dA75', // zlpETHBTC + '0x7AFB6443859Db39E42139657B30846089097016b', // zlpUSDC +] + +const CORE_VAULTS = [ + '0xCa9381F7603A416CDe61440ef4b184e7d1f1c3cA', // zlpCORE-EB-1 (WETH/cbBTC CL1) + '0x9EdD724e9B412ea6f522F4Dec8A93f9111763033', // zlpCORE-EB-10 (WETH/cbBTC CL10) + '0xC02e2cF26E5E04C10A6CbA5aa5fB53a613294E99', // zlpCORE-EU-50 (WETH/USDC CL50) + '0x81Af5b60616fD80023AE16234d7457d79bCbf470', // zlpCORE-EU-100 (WETH/USDC CL100) + '0x3C048138eAA7BdA7DF130b424f831A1b7116D3CA', // zlpCORE-BU-50 (cbBTC/USDC CL50) + '0x2599Cc223cF7e7Ef9D45Cce5a426e22B9f3e0CBe', // zlpCORE-BU-100 (cbBTC/USDC CL100) +] + +// Aerodrome Slipstream position manager the core vaults' gauges use +const SLIPSTREAM_NFT = '0x4857DB576eE0e45F10525eC59527BfD10beeC60b' + +const TOKENS = [ADDRESSES.base.WETH, ADDRESSES.base.USDC, ADDRESSES.base.cbBTC] + +async function tvl(api) { + // each core vault stakes its Slipstream position in the pool's gauge + const gauges = await api.multiCall({ abi: 'address:GAUGE', calls: CORE_VAULTS }) + const stakedIds = await api.multiCall({ + abi: 'function stakedValues(address) view returns (uint256[])', + calls: CORE_VAULTS.map((vault, i) => ({ target: gauges[i], params: vault })), + }) + await unwrapSlipstreamNFT({ api, positionIds: stakedIds.flat(), nftAddress: SLIPSTREAM_NFT }) + + // idle balances held by the core vaults and the meta vaults + return sumTokens2({ api, owners: [...CORE_VAULTS, ...META_VAULTS], tokens: TOKENS }) +} + +module.exports = { + methodology: 'Counts the WETH, cbBTC and USDC in the Aerodrome Slipstream positions that the ZLP core vaults stake in their gauges, plus idle balances held by the core vaults and the two meta vaults. Meta vault holdings of core vault shares are not counted a second time.', + doublecounted: true, + start: '2026-11-27', + base: { tvl }, +} From 63e3bf2fcce28f2879c134fc358df27357976fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Murrell?= Date: Mon, 30 Nov 2026 14:56:17 +0100 Subject: [PATCH 968/988] Peridot: add Avalanche markets (#22454) Co-authored-by: FelixBruguera --- projects/peridot/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/peridot/index.js b/projects/peridot/index.js index ca4f4ae91fb..1454f7d17b8 100644 --- a/projects/peridot/index.js +++ b/projects/peridot/index.js @@ -29,10 +29,12 @@ async function stellarBorrowed(api) { } module.exports = { - methodology: 'TVL is the underlying held by the protocol and not lent out: on BSC, Monad and Robinhood Chain the underlying balance of every Peridot market listed on the comptroller, on Stellar the available liquidity of each cash market (USDC, XLM, PYUSD, EURC). Outstanding debt is reported separately as borrowed.', + methodology: 'TVL is the underlying held by the protocol and not lent out: on BSC, Monad, Robinhood Chain and Avalanche the underlying balance of every Peridot market listed on the comptroller, on Stellar the available liquidity of each cash market (USDC, XLM, PYUSD, EURC). Outstanding debt is reported separately as borrowed.', bsc: compoundExports2({ comptroller: '0x6fC0c15531CB5901ac72aB3CFCd9dF6E99552e14' }), monad: compoundExports2({ comptroller: '0x6D208789f0a978aF789A3C8Ba515749598940716', blacklistedMarkets: ['0xf8255935e62aa000c89de46a97d2f00bfff147e7'], cether: '0x2FB2861402A22244464435773dd1C6951735CdF7' }), // USDG / NVDA lending markets behind the isolated-margin product; margin collateral is pUSDG, so it is in the market cash. robinhood: compoundExports2({ comptroller: '0x6148183676e304dbe63a85c350c208da3ceac39c' }), + // bpPHAR-USDC holds shares of Peridot's Pharaoh DLMM vault (pdUSDC), which count once the share token is priced. + avax: compoundExports2({ comptroller: '0xbE938cD7C25E0E4d0604Fa3F9f0a8b5b67b3D51A' }), stellar: { tvl: stellarTvl, borrowed: stellarBorrowed }, } From cdf20b26eac5249129769cc70b58a2e82e6e4405 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 30 Nov 2026 14:01:52 +0000 Subject: [PATCH 969/988] zyfai: count USDC/SOL, USDC/WETH, Pendle HY USDC, and DETH (#22459) Co-authored-by: Cursor --- projects/zyfai/base.js | 2 ++ projects/zyfai/ethereum.js | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/projects/zyfai/base.js b/projects/zyfai/base.js index ea5c3f652d6..09c5ca83106 100644 --- a/projects/zyfai/base.js +++ b/projects/zyfai/base.js @@ -131,6 +131,8 @@ const MORPHO_BLUE_MARKETS = [ '0xd7520ad198b497b6eb75bc690268f4597630dbc12e305e9d4105843bab36e41d', // USDC/cbADA '0xe458a501c1103ca3b256f2bcb45d223263fb34b6349d82675494ce3a94ce1327', // USDC/cbZEC '0x76629002c9fdb20fb2092053a4f22c5c65e04a81887218b9546f2a2d82b4c0a8', // USDC/cbHYPE + '0x7dc02ff6c536b1d49d7fba770438d79f5bd1f1c78884629b7d1aaee19675782b', // USDC/SOL + '0x8793cf302b8ffd655ab97bd1c695dbd967807e8367a65cb2f4edaf1380ba1bda', // USDC/WETH ]; const AUTOFINANCE_POOLS = { diff --git a/projects/zyfai/ethereum.js b/projects/zyfai/ethereum.js index 25031f3f727..b5411259cc2 100644 --- a/projects/zyfai/ethereum.js +++ b/projects/zyfai/ethereum.js @@ -72,6 +72,7 @@ const COMPOUND_POOLS = { 'Keyrock USDC V2': '0x04422053aDDbc9bB2759b248B574e3FCA76Bc145', 'KPK ETH Prime': '0xBb50A5341368751024ddf33385BA8cf61fE65FF9', 'Pendle Ecosystem USDC V2': '0x55C1B6e461a6334B567bAF0FEb5D728715446f05', + 'Pendle Ecosystem High Yield USDC': '0xcf609F8327E68b42AF54F9D529b9f65d68038435', 'KPK USDT Prime': '0x870F0BF29A25A40E7CC087cD5C53e70C11F2C8A8', 'UltraYield USDT Core': '0x85F3d81a39dF458E45d5EA20f9EB937fAafd282f', 'Kabu USDC': '0x54210d3f1A066413891AF9E17210E787d5C6e3f4', @@ -127,6 +128,11 @@ const COMPOUND_POOLS = { WETH: '0x3A43AEC53490CB9Fa922847385D82fe25d0E9De7', }; + // Share is priced on Llama (DETH). The Machine address is not. + const MAKINA_POOLS = { + DETH: '0x871aB8E36CaE9AF35c6A3488B049965233DeB7ed', + }; + // Aave V4 spokes that coins.llama.fi already prices. Counted like every other receipt token. const AAVE_V4_POOLS = { 'Core USDC': '0x531E90a2376902DE8915789Fcc1075e3B0c153E7', @@ -137,6 +143,7 @@ const COMPOUND_POOLS = { const allPoolTokens = [ ...Object.values(AAVE_POOLS), ...Object.values(AAVE_V4_POOLS), + ...Object.values(MAKINA_POOLS), ...Object.values(COMPOUND_POOLS), ...Object.values(SPARK_POOLS), ...Object.values(ETHEREUM_MORPHO_POOLS), From e17cec12e43f5c22b8c8c5ff3bc7bf1b1368c0b9 Mon Sep 17 00:00:00 2001 From: Samster91 <37342443+samster91@users.noreply.github.com> Date: Mon, 30 Nov 2026 15:05:01 +0100 Subject: [PATCH 970/988] Track missing FalconX vaults in the Pareto adapter (#22460) Co-authored-by: Samster91 --- projects/pareto/index.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/projects/pareto/index.js b/projects/pareto/index.js index 68c6dd67917..ca337807a76 100644 --- a/projects/pareto/index.js +++ b/projects/pareto/index.js @@ -21,6 +21,10 @@ const contracts = { "0x14B8E918848349D1e71e806a52c13D4e0d3246E0", // Adaptive Frontier "0x433D5B175148dA32Ffe1e1A37a939E1b7e79be4d", // FalconX ], + creditDeploymentBlocks: { + '0x804eDB2e28338425c3e8f8CD60672237E286a5b2': 26039706, // FalconX WETH + '0xa74a5E8652a15d627d0bD16d3579D2F041383995': 26075047, // FalconX cbBTC + }, }, polygon: { credits: [ @@ -39,6 +43,11 @@ const contracts = { credits: [ "0x3919396Cd445b03E6Bb62995A7a4CB2AC544245D" // Bastion Credit Vault ] + }, + base: { + creditDeploymentBlocks: { + '0x9363B905036db51e80DA3C55Cc166149C7984103': 49524161, // FalconX USDC + }, } } @@ -69,9 +78,16 @@ async function getUspResidual(api, usp, credits) { } async function getCreditVaults(api) { - const { credits = [], excludeVaultsAfterTimestamp = {}, factory } = contracts[api.chain] + const { credits = [], excludeVaultsAfterTimestamp = {}, factory, creditDeploymentBlocks } = contracts[api.chain] const vaults = [...credits] + if (creditDeploymentBlocks) { + const block = await api.getBlock() + for (const [vault, deploymentBlock] of Object.entries(creditDeploymentBlocks)) { + if (block >= deploymentBlock) vaults.push(vault) + } + } + if (factory) { const logs = await getLogs({ api, @@ -83,7 +99,10 @@ async function getCreditVaults(api) { }) const known = new Set(vaults.map(addr => addr.toLowerCase())) logs.forEach(l => { - if (!known.has(l.proxy.toLowerCase())) vaults.push(l.proxy) + const key = l.proxy.toLowerCase() + if (known.has(key)) return + known.add(key) + vaults.push(l.proxy) }) } @@ -95,6 +114,7 @@ async function getCreditVaults(api) { async function getCreditVaultData(api) { const vaults = await getCreditVaults(api) + if (!vaults.length) return [] const [tokens, strategies, contractValue] = await Promise.all([ 'address:token', 'address:strategy', From b95ba26c7e2217233695c42401f717a6c6ba81c1 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Mon, 30 Nov 2026 10:10:08 -0400 Subject: [PATCH 971/988] Add XTEN to Extended (#22462) Co-authored-by: Dmitrii Krasovskikh --- registries/sumTokens/data1.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/registries/sumTokens/data1.js b/registries/sumTokens/data1.js index f8db1424e39..6c4dd6012d4 100644 --- a/registries/sumTokens/data1.js +++ b/registries/sumTokens/data1.js @@ -764,15 +764,26 @@ module.exports = { ] }, "arc": { - "owners": [ - "0x4445AACaCC2dE174B77b37Eb27529ce0B36bC580", - "0x89103959Eef431bEa308027b8A5073c5ddc867A2" - ], - "tokens": [ - ADDRESSES.arc.USDC, - ADDRESSES.arc.WETH, - ADDRESSES.arc.cirBTC - ] + "tvl": { + "owners": [ + "0x4445AACaCC2dE174B77b37Eb27529ce0B36bC580", + "0x89103959Eef431bEa308027b8A5073c5ddc867A2" + ], + "tokens": [ + ADDRESSES.arc.USDC, + ADDRESSES.arc.WETH, + ADDRESSES.arc.cirBTC + ] + }, + "staking": { + "owners": [ + "0x4445AACaCC2dE174B77b37Eb27529ce0B36bC580", + "0x89103959Eef431bEa308027b8A5073c5ddc867A2" + ], + "tokens": [ + "0x10DEDcBc9601aeC2A941EDbB4D13FcA7Fc820f38" // XTEN, Extended's own token + ] + } } }, "Duality": { From e2181cefa280d5671e4e36dc47dc154fcf9eacda Mon Sep 17 00:00:00 2001 From: Ahmed Tawfeeq Date: Mon, 30 Nov 2026 14:16:25 +0000 Subject: [PATCH 972/988] =?UTF-8?q?Add=20Armitage=E2=80=99s=20curated=20St?= =?UTF-8?q?ock=20SuperVaults=20on=20Base=20(#22457)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- registries/curators.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/registries/curators.js b/registries/curators.js index 42e18eb123e..3c6fb636b81 100644 --- a/registries/curators.js +++ b/registries/curators.js @@ -247,13 +247,25 @@ const configs = { blockchains: { ethereum: { morpho: [ - '0x5dc53a23AdC9f2Bed98de6F59F7F309a7c71FF2B', - '0xA2EAaD0D586cF9FD73bb2c09cF6A7E3e187D68cd', - '0x55C1B6e461a6334B567bAF0FEb5D728715446f05', - '0xBf29043164660C60A2a72Cd15FFe2304e87B6838', - '0x500aE64100D7DbDb640531085C2F5d40cDC8930D', - '0x3d5EcCb62974178236A768A7ef14D3ce468Fbe91', - '0xcf609F8327E68b42AF54F9D529b9f65d68038435', + '0x5dc53a23AdC9f2Bed98de6F59F7F309a7c71FF2B', // Wintermute USDC Prime + '0xA2EAaD0D586cF9FD73bb2c09cF6A7E3e187D68cd', // Wintermute USDC Select + '0x55C1B6e461a6334B567bAF0FEb5D728715446f05', // Pendle Ecosystem USDC + '0xBf29043164660C60A2a72Cd15FFe2304e87B6838', // Wintermute USDT Prime + '0x500aE64100D7DbDb640531085C2F5d40cDC8930D', // Wintermute USDT Select + '0x3d5EcCb62974178236A768A7ef14D3ce468Fbe91', // Wintermute Confidential WBTC + '0xcf609F8327E68b42AF54F9D529b9f65d68038435', // Pendle Ecosystem High Yield USDC + ], + }, + base: { + erc4626: [ + '0x4855B2756910b7525d5b466292c394669eE74E7e', // Amazon SuperVault + '0xC63374bf46d7a9654A96B14A3Dc363C92B26d5a3', // Meta SuperVault + '0x7778192c7e2c22A27c63D63485699888148d5919', // Microsoft SuperVault + '0x301a1CEB684d62833101B373Ab6c395349B24033', // Apple SuperVault + '0x02b12a394f0A98b80E53d85F6831041932F1b621', // SpaceX SuperVault + '0xaF0EdF09eC7f9357292F6bc6445a09Aa84a31FA7', // Tesla SuperVault + '0x363600AC7173e8D91BcfEe68D711bb93E992c110', // Alphabet SuperVault + '0xC441A2cc3a528B6312740448a70cC4D40F4d7BfC', // NVIDIA SuperVault ], }, }, From d16b8bce25476499983bc09b3031ad6c2f2ebf83 Mon Sep 17 00:00:00 2001 From: Samster91 <37342443+samster91@users.noreply.github.com> Date: Mon, 30 Nov 2026 19:16:54 +0100 Subject: [PATCH 973/988] Discover Pareto credit vaults from deployed factories (#22464) Co-authored-by: Samster91 --- projects/pareto/index.js | 75 ++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 42 deletions(-) diff --git a/projects/pareto/index.js b/projects/pareto/index.js index ca337807a76..a6f03650240 100644 --- a/projects/pareto/index.js +++ b/projects/pareto/index.js @@ -1,6 +1,9 @@ const BigNumber = require("bignumber.js"); const ADDRESSES = require('../helper/coreAssets.json') -const { getLogs } = require('../helper/cache/getLogs') +const { getLogs2 } = require('../helper/cache/getLogs') + +const legacyDeployment = 'event CreditVaultDeployed(address vault)' +const v3Deployment = 'event CreditVaultDeployed(address vault, address strategy, address queue, address programmableBorrower, address keyringWhitelist, address writeOffEscrow)' // Pareto credit vaults are Idle CDOs whose strategy lends the whole deposit to a single // borrower (Fasanara, Bastion, FalconX, ...). getContractValue() is the vault's accounting @@ -11,20 +14,17 @@ const { getLogs } = require('../helper/cache/getLogs') const contracts = { ethereum: { usp: '0x97cCC1C046d067ab945d3CF3CC6920D3b1E54c88', // USP - factory: { - block: 22938055, - address: '0x59aabdad8fdabd227cc71543b128765f93906626', - }, + factories: [ + { target: '0x59aabdad8fdabd227cc71543b128765f93906626', fromBlock: 22938055, eventAbi: legacyDeployment }, + { target: '0xa8da4580dc0f1bb5b6761677184b58e611736cd5', fromBlock: 24669729, eventAbi: legacyDeployment }, + { target: '0xd6C6f31091Bf6E4a6a48C91cfA4C341f1BaB44ff', fromBlock: 25144298, eventAbi: v3Deployment }, + ], credits: [ "0xf6223C567F21E33e859ED7A045773526E9E3c2D5", // Fasanara Yield vault, "0x4462eD748B8F7985A4aC6b538Dfc105Fce2dD165", // Bastion "0x14B8E918848349D1e71e806a52c13D4e0d3246E0", // Adaptive Frontier "0x433D5B175148dA32Ffe1e1A37a939E1b7e79be4d", // FalconX ], - creditDeploymentBlocks: { - '0x804eDB2e28338425c3e8f8CD60672237E286a5b2': 26039706, // FalconX WETH - '0xa74a5E8652a15d627d0bD16d3579D2F041383995': 26075047, // FalconX cbBTC - }, }, polygon: { credits: [ @@ -36,18 +36,21 @@ const contracts = { "0xD2c0D848aA5AD1a4C12bE89e713E70B73211989B", // FalconX ], excludeVaultsAfterTimestamp: { - '0xD2c0D848aA5AD1a4C12bE89e713E70B73211989B': 1756936799 + '0xd2c0d848aa5ad1a4c12be89e713e70b73211989b': 1756936799 } }, arbitrum: { + factories: [ + { target: '0xbe73A30E9B9aE208Dfe615889bb4eff32a0e9208', fromBlock: 522666203, eventAbi: v3Deployment }, + ], credits: [ "0x3919396Cd445b03E6Bb62995A7a4CB2AC544245D" // Bastion Credit Vault ] }, base: { - creditDeploymentBlocks: { - '0x9363B905036db51e80DA3C55Cc166149C7984103': 49524161, // FalconX USDC - }, + factories: [ + { target: '0x4220714A44EAF70810AB8742a8875FAcEe2De004', fromBlock: 49481557, eventAbi: v3Deployment }, + ], } } @@ -78,42 +81,28 @@ async function getUspResidual(api, usp, credits) { } async function getCreditVaults(api) { - const { credits = [], excludeVaultsAfterTimestamp = {}, factory, creditDeploymentBlocks } = contracts[api.chain] - const vaults = [...credits] + const { credits = [], excludeVaultsAfterTimestamp = {}, factories = [] } = contracts[api.chain] + const vaults = new Set(credits.map(vault => vault.toLowerCase())) - if (creditDeploymentBlocks) { + if (factories.length) { const block = await api.getBlock() - for (const [vault, deploymentBlock] of Object.entries(creditDeploymentBlocks)) { - if (block >= deploymentBlock) vaults.push(vault) - } - } - - if (factory) { - const logs = await getLogs({ + const activeFactories = factories.filter(({ fromBlock }) => fromBlock <= block) + const deployments = await Promise.all(activeFactories.map(factory => getLogs2({ api, - target: factory.address, - topics: ['0x22d236b886e994153ab139e04b213355a725846284c6018c26c6af0988bd58d7'], - eventAbi: 'event CreditVaultDeployed(address proxy)', + ...factory, + toBlock: block, onlyArgs: true, - fromBlock: factory.block, - }) - const known = new Set(vaults.map(addr => addr.toLowerCase())) - logs.forEach(l => { - const key = l.proxy.toLowerCase() - if (known.has(key)) return - known.add(key) - vaults.push(l.proxy) - }) + }))) + for (const [vault] of deployments.flat()) vaults.add(vault.toLowerCase()) } - return vaults.filter(addr => { + return [...vaults].filter(addr => { const cutoff = excludeVaultsAfterTimestamp[addr] return !cutoff || !api.timestamp || Number(cutoff) > Number(api.timestamp) }) } -async function getCreditVaultData(api) { - const vaults = await getCreditVaults(api) +async function getCreditVaultData(api, vaults) { if (!vaults.length) return [] const [tokens, strategies, contractValue] = await Promise.all([ 'address:token', @@ -139,19 +128,21 @@ async function getCreditVaultData(api) { } async function tvl(api) { - const { usp, credits = [] } = contracts[api.chain] + const { usp } = contracts[api.chain] + const vaults = await getCreditVaults(api) if (usp) { - const residual = await getUspResidual(api, usp, credits) + const residual = await getUspResidual(api, usp, vaults) api.add(ADDRESSES[api.chain].USDC, residual) } - const vaultData = await getCreditVaultData(api) + const vaultData = await getCreditVaultData(api, vaults) vaultData.forEach(({ token, held }) => api.add(token, held)) } async function borrowed(api) { - const vaultData = await getCreditVaultData(api) + const vaults = await getCreditVaults(api) + const vaultData = await getCreditVaultData(api, vaults) vaultData.forEach(({ token, held, receivable }) => { const lent = receivable - held if (lent > 0n) api.add(token, lent) From 93f650d96c21257b8810e28a1ca99ebff0202b9f Mon Sep 17 00:00:00 2001 From: Reinvote Date: Mon, 30 Nov 2026 21:53:26 +0330 Subject: [PATCH 974/988] Add Reinvote (Arbitrum) (#22463) Co-authored-by: FelixBruguera --- registries/sumTokens.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/registries/sumTokens.js b/registries/sumTokens.js index c006741e029..28a63540a95 100644 --- a/registries/sumTokens.js +++ b/registries/sumTokens.js @@ -23890,6 +23890,16 @@ const configs = { "token": ADDRESSES.ethereum.WETH }, }, + "reinvote": { + "methodology": "TVL is the ETH held in the Reinvote AllocationPool contract: shares bought in open rounds plus prizes not yet claimed.", + "start": 1793923200, + "arbitrum": { + "owner": "0x92eD7756Ce4eF5171f1e6FEC32CE548e432787D8", + "tokens": [ + ADDRESSES.null + ] + } + }, "relayChain": { "ethereum": { "tokens": [ From 53225c9e3c7ede727bd1c58786d95217ef730994 Mon Sep 17 00:00:00 2001 From: max <39312833+fritzschoff@users.noreply.github.com> Date: Mon, 30 Nov 2026 18:28:24 +0000 Subject: [PATCH 975/988] treasury: add Pendle (#22465) Co-authored-by: Claude Opus 5.5 --- registries/treasury.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/registries/treasury.js b/registries/treasury.js index cd2642ba3e4..3570f7df23a 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -4545,6 +4545,18 @@ const configs = { ownTokens: [], }, }, + // Safes Pendle names in its docs (docs.pendle.finance, Tokenomics). Left out: the Team multisig + // 0x918cf6b1... (fully vested team allocation), the fee wallets (80% of fees go to buybacks for + // sPENDLE holders), and vePENDLE / sPENDLE / the buyback contract (user funds) + 'treasury/pendle': { + ethereum: { + owners: [ + '0x399be606db281a054e359eb709df9f21e922ec9a', // Ecosystem Fund + '0x8119ec16f0573b7dac7c0cb94eb504fb32456ee1', // Governance multisig + ], + ownTokens: ['0x808507121b80c02388fad14726482e061b8da827'], // PENDLE + }, + }, 'treasury/perion': { ethereum: { tokens: [ From 5359395d2d8412a8ba88112bd3d638e180b49e94 Mon Sep 17 00:00:00 2001 From: max <39312833+fritzschoff@users.noreply.github.com> Date: Mon, 30 Nov 2026 18:35:00 +0000 Subject: [PATCH 976/988] treasury: add ether.fi (#22466) Co-authored-by: Claude Opus 5.5 --- registries/treasury.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/registries/treasury.js b/registries/treasury.js index 3570f7df23a..5ccb64aff95 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -2061,6 +2061,22 @@ const configs = { owners: ['0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae', '0x9fC3dc011b461664c835F2527fffb1169b3C213e'], }, }, + // addresses ether.fi publishes: the Treasury allocation wallets (etherfi.gitbook.io/gov/ethfi-allocations), + // the Foundation wallet (etherfi.gitbook.io/gov/ethfi-buyback-program) and the core protocol Treasury + // (etherfi.gitbook.io/etherfi/developers/contracts-and-integrations/deployed-contracts) + 'treasury/etherfi': { + ethereum: { + owners: [ + '0x7D4bBE471369a066186c18bAF33622796A08d5Cd', // Treasury allocation (Ecosystem Fund) + '0x7A6A41F353B3002751d94118aA7f4935dA39bB53', // Treasury allocation (Ecosystem Fund) + '0x5f0E7A424d306e9E310be4f5Bb347216e473Ae55', // Treasury allocation (Ecosystem Fund) + '0xD022d6bb8B6C1C357ec77D930Dc6A0aD40FFC90b', // Treasury allocation (Ecosystem Fund) + '0x2f5301a3D59388c509C65f8698f521377D41Fd0F', // Foundation wallet, runs the ETHFI buybacks + '0x0c83EAe1FE72c390A02E426572854931EefF93BA', // core protocol Treasury, receives protocol fees + ], + ownTokens: ['0xFe0c30065B384F05761f15d0CC899D4F9F9Cc0eB'], // ETHFI + }, + }, 'treasury/ethglobal': { optimism: { tokens: [ From e1fbe33da2bf8055a2e600098e4104f057a8ad94 Mon Sep 17 00:00:00 2001 From: max <39312833+fritzschoff@users.noreply.github.com> Date: Mon, 30 Nov 2026 18:38:40 +0000 Subject: [PATCH 977/988] treasury: add Orca (#22467) Co-authored-by: Claude Opus 5.5 --- projects/helper/treasury.js | 4 ++-- registries/treasury.js | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/projects/helper/treasury.js b/projects/helper/treasury.js index cb5db6fbf1c..2be7bf72cee 100644 --- a/projects/helper/treasury.js +++ b/projects/helper/treasury.js @@ -56,8 +56,8 @@ function treasuryExports(config) { if (ownTokens.length > 0) { // token auto-discovery must not run here: this bucket is meant to hold ownTokens - // only, and anything it finds is already counted in the tvl bucket above - const { solOwners, fetchCoValentTokens, tokenConfig, solidlyVeNfts = [], ...other } = config[chain]; + // only, and anything it finds is already counted in the tvl bucket above (staked SOL included) + const { solOwners, fetchCoValentTokens, tokenConfig, includeStakedSol, solidlyVeNfts = [], ...other } = config[chain]; // veNft locks are added as their base token whatever `tokens` says, so keep only those locking an own token const ownTokenSet = new Set(ownTokens.map(i => i.toLowerCase())) const opts = { diff --git a/registries/treasury.js b/registries/treasury.js index 5ccb64aff95..d459e030090 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -4456,6 +4456,18 @@ const configs = { ownTokens: [], }, }, + // wallets from docs.orca.so/governance/treasury. Left out: the Climate Fund (DrhE25wu..., set aside + // for donations), the undistributed fee account (CTgympSD...) and the initial ORCA source wallet (GjKxauMr...) + 'treasury/orca': { + solana: { + owners: [ + 'DWo8SNtdBDuebAEeVDf7cWBQ6DUvoDbS7K4QTrQvYS1S', // Fee Treasury, most of its SOL is in stake accounts + 'GwH3Hiv5mACLX3ufTw1pFsrhSPon5tdw252DBs4Rx4PV', // Community ORCA Treasury + ], + includeStakedSol: true, + ownTokens: ['orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE'], // ORCA + }, + }, 'treasury/ovr': { ethereum: { owners: ['0x8c19cF0135852BA688643F57d56Be72bB898c411'], From ca5c2e6d222b1600d78fad3faa6ff6c4fd254442 Mon Sep 17 00:00:00 2001 From: max <39312833+fritzschoff@users.noreply.github.com> Date: Mon, 30 Nov 2026 18:43:38 +0000 Subject: [PATCH 978/988] treasury: add Sanctum (#22468) Co-authored-by: Claude Opus 5.5 --- registries/treasury.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/registries/treasury.js b/registries/treasury.js index d459e030090..5baa5e4916b 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -5493,6 +5493,20 @@ const configs = { ownTokens: ['0x0110B0c3391584Ba24Dbf8017Bf462e9f78A6d9F'], }, }, + // Squads vaults and Strategic Reserve wallets Sanctum lists on investors.sanctum.so (data/treasury.json, data/cloud.json). + // Left out: the Magna vesting contract How2rJVQ... (team and investor vesting) + 'treasury/sanctum': { + solana: { + owners: [ + '8JS6XsMPo2u3EyeeY3p2jvzHEhdUtCKgarHpJ3PAonyv', // Squads v4 vault A + 'EeQmNqm1RcQnee8LTyx6ccVG9FnR8TezQuw2JXq2LC1T', // Squads v3 vault + '8VE2uJkoheDbJd9rCyKzfXmiMqAS4o1B3XGshEh86BGk', // Squads v4 vault B, Strategic Reserve wallet 1 + 'DEnpgmzoAGKXjRCGoLTALm91XMAw88q6npDHPRAmMQj1', // Strategic Reserve wallet 2 + ], + ownTokens: ['CLoUDKc4Ane7HeQcPpE3YHnznRxhMimJ4MyaUqyHFzAu'], // SANC (formerly CLOUD) + blacklistedTokens: ['mcCLDanVw8RtbmzyCVpVx29xiGuRyN4mTpN3rZXRdxq'], // unidentified token with a live mint authority, not part of the treasury Sanctum reports + }, + }, 'treasury/sandclock': { ethereum: { tokens: [ From e442c2d26f8810d0b0083e54822ef7b8d6556fc1 Mon Sep 17 00:00:00 2001 From: max <39312833+fritzschoff@users.noreply.github.com> Date: Mon, 30 Nov 2026 18:45:27 +0000 Subject: [PATCH 979/988] treasury: add Jito (#22469) Co-authored-by: Claude Opus 5.5 --- registries/treasury.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/registries/treasury.js b/registries/treasury.js index 5baa5e4916b..f33b3942dea 100644 --- a/registries/treasury.js +++ b/registries/treasury.js @@ -3206,6 +3206,18 @@ const configs = { owners: ['0x02944e3fb72aa13095d7cebd8389fc74bec8e48e', '0xd012A9C8159b0E7325448eD30B1499FddDAc0F40'] } }, + 'treasury/jito': { + solana: { + owners: [ + // JTO DAO native treasury PDA (github.com/jito-foundation/jto-proposal-verifier README), also the JitoSOL fee recipient + '5eosrve6LktMZgVNszYzebgmmC7BjLK8NoWyRQtcmGTF', + // DAO-funded Foundation multisigs: the incentive budget (JIP-13) and the bug bounty fund (JIP-5) + '8sjM83a4u2M8YZYshLGKzYxh1VHFfbgtaytwaoEg4bUJ', + 'GX9tT4x7bVbGMbvFWNnfsQdo5dkoouPjGoUWN9da8B2C', + ], + ownTokens: ['jtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL'], // JTO + }, + }, 'treasury/jonesdao': { arbitrum: { tokens: [ From b4d507cdb02c9fd3776a70add7c48e0f4b5f9ebe Mon Sep 17 00:00:00 2001 From: max <39312833+fritzschoff@users.noreply.github.com> Date: Mon, 30 Nov 2026 18:51:12 +0000 Subject: [PATCH 980/988] orca-wavebreak: track the quote tokens in the bonding curves (#22470) Co-authored-by: Claude Opus 5.5 --- projects/orca-wavebreak/index.js | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/orca-wavebreak/index.js diff --git a/projects/orca-wavebreak/index.js b/projects/orca-wavebreak/index.js new file mode 100644 index 00000000000..ba0880f8eea --- /dev/null +++ b/projects/orca-wavebreak/index.js @@ -0,0 +1,42 @@ +const { PublicKey } = require('@solana/web3.js') +const { getConnection } = require('../helper/solana') + +// layout from Orca's SDK (orca_wavebreak crate, src/generated/accounts/bonding_curve.rs): a 1 byte account type, then the curve +const WAVEBREAK = new PublicKey('waveQX2yP3H1pVU8djGvEHmYg8uamQ84AuyGtpsrXTF') +const BONDING_CURVE_SIZE = 2048 +const BONDING_CURVE_TYPE = '3' // base58 of the account type byte 2 +const QUOTE_MINT = 33 +const QUOTE_AMOUNT = 208 +const GRADUATION_TARGET = 240 +const GRADUATION_TIME = 248 +const GRADUATION_METHODS = 284 // 8 entries of 128 bytes, `graduated` flag at +1 +const GRADUATION_METHOD_SIZE = 128 +const SLICE_START = QUOTE_MINT +const SLICE_END = GRADUATION_METHODS + 8 * GRADUATION_METHOD_SIZE + +async function tvl(api) { + const accounts = await getConnection().getProgramAccounts(WAVEBREAK, { + filters: [{ dataSize: BONDING_CURVE_SIZE }, { memcmp: { offset: 0, bytes: BONDING_CURVE_TYPE } }], + dataSlice: { offset: SLICE_START, length: SLICE_END - SLICE_START }, + }) + const now = BigInt(api.timestamp) + for (const { account: { data } } of accounts) { + const at = (offset) => offset - SLICE_START + const quoteAmount = data.readBigUInt64LE(at(QUOTE_AMOUNT)) + const graduationTarget = data.readBigUInt64LE(at(GRADUATION_TARGET)) + const graduationTime = data.readBigInt64LE(at(GRADUATION_TIME)) + // same status rule as Orca's SDK examples; graduated curves seed a Whirlpool, which is counted under Orca DEX + if (quoteAmount >= graduationTarget) continue + if (graduationTime > 0n && graduationTime <= now) continue + let graduated = false + for (let i = 0; i < 8; i++) if (data[at(GRADUATION_METHODS + i * GRADUATION_METHOD_SIZE + 1)]) graduated = true + if (graduated) continue + api.add(new PublicKey(data.subarray(at(QUOTE_MINT), at(QUOTE_MINT) + 32)).toString(), quoteAmount.toString()) + } +} + +module.exports = { + timetravel: false, + methodology: 'Counts the quote tokens (SOL, USDC) raised in Wavebreak bonding curves that have not graduated yet. The launched tokens are not counted, and graduated curves are counted under Orca DEX.', + solana: { tvl }, +} From 78b5d716712152ef5a4237db7c15623745f50710 Mon Sep 17 00:00:00 2001 From: papahaba2 <87782889+papahaba2@users.noreply.github.com> Date: Mon, 30 Nov 2026 22:44:01 +0300 Subject: [PATCH 981/988] Add Blueberry Matrix TVL adapter (#22461) Co-authored-by: papahaba Co-authored-by: FelixBruguera --- registries/erc4626.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/registries/erc4626.js b/registries/erc4626.js index 74aebe234a1..31cb02cb38d 100644 --- a/registries/erc4626.js +++ b/registries/erc4626.js @@ -569,6 +569,15 @@ const configs = { '0x91134a0450628846b3853e93444a7cd20a02f4ba', // USDT vault (fUSDT) ], }, + 'blueberry-matrix': { + methodology: 'Counts underlying assets deposited in the Blueberry WFUSE and USDC auto-rebalancing ERC-4626 vaults on Fuse.', + start: '2026-11-29', + doublecounted: true, + fuse: [ + '0xf1227c2419f3535d918B0174b7Df5AbC602d718e', // bbWFUSE + '0x1d8E8039BB0579AbAD230f4B9Cc05dF8815c8b52', // bbUSDC + ], + }, // --- custom-abi vaults (migrated 2026-10-22) --- 'deq': { ethereum: { vaults: ['0x3742f3Fcc56B2d46c7B8CA77c23be60Cd43Ca80a'], tokenAbi: 'avail', balanceAbi: 'assets' }, From 2e679286372306b2cd5f71d66df75c5b47018d9e Mon Sep 17 00:00:00 2001 From: Jordy Date: Mon, 30 Nov 2026 20:55:58 +0100 Subject: [PATCH 982/988] Nysa: count RWA Prime vault at full AUM, like other Kamino Earn curators (#22471) Co-authored-by: Claude Opus 5.5 --- projects/nysa/index.js | 74 +++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/projects/nysa/index.js b/projects/nysa/index.js index 820cd6579f8..0020544779a 100644 --- a/projects/nysa/index.js +++ b/projects/nysa/index.js @@ -7,7 +7,7 @@ const kvaultIdl = require('../gauntlet/kvault-idl.json') const PROGRAM = 'KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD' const VAULT_PROGRAM = 'KvauGMspG5k6rtzrqqn7WNn3oZdyKqLKwK2XWQ8FLjd' const MARKET = 'F4uLsGZT4YnHDcemtoYDz2LBZKLmwTB1wzkwS6oqygvy' -// Live market and vault configuration: https://github.com/Nysa-Finance/nysa-frontend/blob/main/src/config.js +// Live market and vault configuration: https://github.com/Nysa-Finance/nysa-frontend/blob/main/shared/config.js const RESERVES = [ ['rpTGWR3JDjjPfXLCg5Fx1GpSdUxPt1pxW7fwXGUT6js', 'A1KLoBrKBde8Ty9qtNQUtq3C2ortoC3u7twggz7sEto6'], // USDY ['GQr5hXuRgHAmguh6EqcpeJXrMyqCQch4P6XkSvawwNk2', ADDRESSES.solana.USDC], @@ -16,14 +16,14 @@ const RESERVES = [ const VAULTS = [ ['2Qxsj1hi95avkp7sANDmbVT5TwqRPGsutuvJasJK9xL7', ADDRESSES.solana.USDC], // RWA Prime ] -const EMPTY_ALLOCATION = '11111111111111111111111111111111' +const Q60 = 1n << 60n const coder = new BorshAccountsCoder(kaminoIdl) const vaultCoder = new BorshAccountsCoder(kvaultIdl) /** * Load Nysa's reserves and reject missing or mismatched on-chain accounts. * @param {object} api DefiLlama chain API used for Solana account reads. - * @returns {Promise} Decoded reserves with verified program, market, and mint. + * @returns {Promise} Decoded reserves with verified program, market, and mint, in RESERVES order. */ async function getReserves(api) { const accounts = await getMultipleAccounts(RESERVES.map(([address]) => address), { api }) @@ -58,30 +58,19 @@ async function getVaults(api) { } /** - * Collect vault positions in reserves outside Nysa's market. Positions in Nysa's own reserves are skipped, - * because those reserves' supply vaults and debt are already counted. + * Load reserves and vaults, with the vaults' cToken balance in each of Nysa's reserves. * @param {object} api DefiLlama chain API used for Solana account reads. - * @param {object[]} vaults Decoded vault states. - * @returns {Promise<{ reserve: object, ctokens: bigint }[]>} External reserves with the vaults' combined cToken balance. + * @returns {Promise<{ reserves: { reserve: object, vaultCtokens: bigint }[], vaults: object[] }>} Decoded accounts. */ -async function getExternalAllocations(api, vaults) { - const own = new Set(RESERVES.map(([address]) => address)) +async function load(api) { + const [reserves, vaults] = await Promise.all([getReserves(api), getVaults(api)]) const ctokens = {} for (const vault of vaults) for (const { reserve, ctokenAllocation } of vault.vaultAllocationStrategy) { const address = reserve.toString() - if (address === EMPTY_ALLOCATION || own.has(address) || ctokenAllocation.isZero()) continue ctokens[address] = (ctokens[address] ?? 0n) + BigInt(ctokenAllocation.toString()) } - - const addresses = Object.keys(ctokens) - const accounts = await getMultipleAccounts(addresses, { api }) - return addresses.map((address, i) => { - const account = accounts[i] - if (!account) throw new Error(`Nysa: missing vault reserve ${address}`) - if (account.owner.toString() !== PROGRAM) throw new Error(`Nysa: unexpected program owner for vault reserve ${address}`) - return { reserve: coder.decode('Reserve', account.data), ctokens: ctokens[address] } - }) + return { reserves: reserves.map((reserve, i) => ({ reserve, vaultCtokens: ctokens[RESERVES[i][0]] ?? 0n })), vaults } } /** @@ -89,11 +78,11 @@ async function getExternalAllocations(api, vaults) { * @param {bigint} amount Reserve amount in raw token units. * @param {bigint} ctokens cToken balance. * @param {object} reserve Decoded reserve. - * @returns {string} Share in raw token units, truncated. + * @returns {bigint} Share in raw token units, truncated. */ function share(amount, ctokens, reserve) { const supply = BigInt(reserve.collateral.mintTotalSupply.toString()) - return supply > 0n ? (amount * ctokens / supply).toString() : '0' + return supply > 0n ? amount * ctokens / supply : 0n } /** @@ -102,39 +91,50 @@ function share(amount, ctokens, reserve) { * @returns {bigint} Outstanding debt. */ function debtOf(reserve) { - return BigInt(reserve.liquidity.borrowedAmountSf.toString()) / (1n << 60n) + return BigInt(reserve.liquidity.borrowedAmountSf.toString()) / Q60 } /** - * Sum underlying tokens held in the reserves' liquidity supply vaults, plus vault tokens not deployed into them. + * Vault AUM plus the market's supply vault balances, counting vault deposits into the market once. * @param {object} api DefiLlama chain API receiving raw token balances. - * @returns {Promise} Vault balances, excluding borrowed-out tokens. + * @returns {Promise} Token balances. */ async function tvl(api) { - const [reserves, vaults] = await Promise.all([getReserves(api), getVaults(api)]) - // Idle vault tokens by the vault's own accounting, which leaves out reward tokens not yet paid into the vault. - vaults.forEach(vault => api.add(vault.tokenMint.toString(), vault.tokenAvailable.toString())) - for (const { reserve, ctokens } of await getExternalAllocations(api, vaults)) - api.add(reserve.liquidity.mintPubkey.toString(), share(BigInt(reserve.liquidity.availableAmount.toString()), ctokens, reserve)) - return sumTokens2({ api, tokenAccounts: reserves.map(reserve => reserve.liquidity.supplyVault.toString()) }) + const { reserves, vaults } = await load(api) + // Vault AUM by the vault's own accounting (prevAumSf), as DefiLlama's curator helper counts Kamino Earn vaults: + // idle tokens plus deposits in Kamino reserves, including the part lent to borrowers. + const aum = {} + for (const vault of vaults) { + const mint = vault.tokenMint.toString() + aum[mint] = (aum[mint] ?? 0n) + BigInt(vault.prevAumSf.toString()) / Q60 + } + // The vaults' share of unborrowed liquidity in Nysa's reserves sits in the supply vaults counted below: leave it out of AUM. + for (const { reserve, vaultCtokens } of reserves) { + const mint = reserve.liquidity.mintPubkey.toString() + if (aum[mint] === undefined) continue + aum[mint] -= share(BigInt(reserve.liquidity.availableAmount.toString()), vaultCtokens, reserve) + } + for (const [mint, amount] of Object.entries(aum)) + if (amount > 0n) api.add(mint, amount.toString()) + return sumTokens2({ api, tokenAccounts: reserves.map(({ reserve }) => reserve.liquidity.supplyVault.toString()) }) } /** - * Add outstanding debt in raw token units, including the vaults' share of debt in external reserves. + * Add debt in Nysa's market funded by suppliers other than the vaults, whose lent-out deposits are already in TVL. * @param {object} api DefiLlama chain API receiving borrowed token balances. * @returns {Promise} Resolves after adding debt for each validated reserve. */ async function borrowed(api) { - const [reserves, vaults] = await Promise.all([getReserves(api), getVaults(api)]) - for (const reserve of reserves) - api.add(reserve.liquidity.mintPubkey.toString(), debtOf(reserve).toString()) - for (const { reserve, ctokens } of await getExternalAllocations(api, vaults)) - api.add(reserve.liquidity.mintPubkey.toString(), share(debtOf(reserve), ctokens, reserve)) + const { reserves } = await load(api) + for (const { reserve, vaultCtokens } of reserves) { + const debt = debtOf(reserve) + api.add(reserve.liquidity.mintPubkey.toString(), (debt - share(debt, vaultCtokens, reserve)).toString()) + } } module.exports = { doublecounted: true, // DefiLlama confirmed these deposits overlap Kamino Lend TVL. timetravel: false, - methodology: 'Counts USDY collateral and unborrowed USDC held in the liquidity supply vaults of Nysa\'s curated Kamino market on Solana, plus USDC in Nysa\'s curated Kamino Earn vault (RWA Prime) that is not deployed into that market: idle vault USDC and the vault\'s share of unborrowed liquidity in any other Kamino reserve. Vault deposits into Nysa\'s own market are counted once, through the market. Outstanding debt, including the vault\'s share of debt in other reserves, is reported separately as borrowed. Collateral receipt tokens, vault shares, undistributed incentives, and Farm Points are not added to TVL. These deposits overlap Kamino TVL, so the adapter is marked doublecounted.', + methodology: 'Counts the AUM of Nysa\'s curated Kamino Earn vault (RWA Prime) as DefiLlama counts other Kamino Earn curators: USDC held by the vault plus its deposits in Kamino reserves, including the part lent to borrowers. Adds USDY collateral and unborrowed USDC in the liquidity supply vaults of Nysa\'s curated Kamino market on Solana, leaving out the vault\'s own share so its deposits into the market are counted once. Borrowed reports outstanding debt in Nysa\'s market funded by suppliers other than the vault. Collateral receipt tokens, vault shares, undistributed incentives, and Farm Points are not added to TVL. These deposits overlap Kamino TVL, so the adapter is marked doublecounted.', solana: { tvl, borrowed }, } From cba3e04a304ec66a7b84934a7ed0e3a0c942fdda Mon Sep 17 00:00:00 2001 From: zlp <326275259+zlp-fi@users.noreply.github.com> Date: Tue, 1 Dec 2026 06:38:14 -0500 Subject: [PATCH 983/988] Add ZLP v5 (Multi-DEX Aerodrome + Uniswap v3 + Aave v3 Shelter) (#22473) --- projects/zlp/index.js | 79 +++++++++++++++++++++++++++++++------------ 1 file changed, 58 insertions(+), 21 deletions(-) diff --git a/projects/zlp/index.js b/projects/zlp/index.js index e90c86309ed..cb6427a550e 100644 --- a/projects/zlp/index.js +++ b/projects/zlp/index.js @@ -1,41 +1,78 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2, unwrapSlipstreamNFT } = require('../helper/unwrapLPs') +const { sumTokens2, unwrapSlipstreamNFT, unwrapUniswapV3NFT } = require('../helper/unwrapLPs') -const META_VAULTS = [ - '0x36662a82b9EB4217BD5E10e1899822b59Df4dA75', // zlpETHBTC - '0x7AFB6443859Db39E42139657B30846089097016b', // zlpUSDC +const V4_META_VAULTS = [ + '0x36662a82b9EB4217BD5E10e1899822b59Df4dA75', // zlpETHBTC v4 + '0x7AFB6443859Db39E42139657B30846089097016b', // zlpUSDC v4 ] -const CORE_VAULTS = [ - '0xCa9381F7603A416CDe61440ef4b184e7d1f1c3cA', // zlpCORE-EB-1 (WETH/cbBTC CL1) - '0x9EdD724e9B412ea6f522F4Dec8A93f9111763033', // zlpCORE-EB-10 (WETH/cbBTC CL10) - '0xC02e2cF26E5E04C10A6CbA5aa5fB53a613294E99', // zlpCORE-EU-50 (WETH/USDC CL50) - '0x81Af5b60616fD80023AE16234d7457d79bCbf470', // zlpCORE-EU-100 (WETH/USDC CL100) - '0x3C048138eAA7BdA7DF130b424f831A1b7116D3CA', // zlpCORE-BU-50 (cbBTC/USDC CL50) - '0x2599Cc223cF7e7Ef9D45Cce5a426e22B9f3e0CBe', // zlpCORE-BU-100 (cbBTC/USDC CL100) +const V5_META_VAULTS = [ + '0x9d5a9a4d58ef900060D8eb91B5043dAe1F37F780', // zlpETHBTC v5 + '0xA6145ff995FCaf6112D053255Bf8B3F278750FEC', // zlpUSDC v5 +] + +const META_VAULTS = [...V4_META_VAULTS, ...V5_META_VAULTS] + +// Deduplicated Aerodrome Slipstream CoreVaults across ZLP v4 & v5 +const AERO_CORE_VAULTS = [ + '0xCa9381F7603A416CDe61440ef4b184e7d1f1c3cA', // zlpCORE-EB-1 (WETH/cbBTC CL1) + '0x9EdD724e9B412ea6f522F4Dec8A93f9111763033', // zlpCORE-EB-10 (WETH/cbBTC CL10) + '0xC02e2cF26E5E04C10A6CbA5aa5fB53a613294E99', // zlpCORE-EU-50 (WETH/USDC CL50 v4) + '0x81Af5b60616fD80023AE16234d7457d79bCbf470', // zlpCORE-EU-100 (WETH/USDC CL100) + '0x3C048138eAA7BdA7DF130b424f831A1b7116D3CA', // zlpCORE-BU-50 (cbBTC/USDC CL50 v4) + '0x2599Cc223cF7e7Ef9D45Cce5a426e22B9f3e0CBe', // zlpCORE-BU-100 (cbBTC/USDC CL100) + '0x5c0CBcfB741123756E64a90d6f34A3719EDd7584', // zlpCORE-EU-50-15 (WETH/USDC CL50 v5) + '0x55352E95973FbB6B2f8aBCf9C91e641AbC9C4c35', // zlpCORE-BU-50-15 (cbBTC/USDC CL50 v5) +] + +// ZLP v5 Uniswap v3 CoreVaults +const UNI_CORE_VAULTS = [ + '0xFEA3CcC465692e631b31d8cd6E5Cb414Ce19Ea83', // zlpCORE-UNI-EU30 (UniV3 WETH/USDC 0.30%) + '0x08a49C48bf81C446B4d534Fc96083cD4F830807e', // zlpCORE-UNI-BU05 (UniV3 cbBTC/USDC 0.05%) + '0xe6d248C5DB2a509D9ae3C8b1D549779D5404BECa', // zlpCORE-UNI-EB05 (UniV3 WETH/cbBTC 0.05%) ] -// Aerodrome Slipstream position manager the core vaults' gauges use const SLIPSTREAM_NFT = '0x4857DB576eE0e45F10525eC59527BfD10beeC60b' +const UNI_V3_NFT = '0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1' -const TOKENS = [ADDRESSES.base.WETH, ADDRESSES.base.USDC, ADDRESSES.base.cbBTC] +// Spot underlying + Base Aave v3 aTokens held by v5 MetaVaults in Storm Shelter mode +const TOKENS = [ + ADDRESSES.base.WETH, + ADDRESSES.base.USDC, + ADDRESSES.base.cbBTC, + '0x4e65fE4DbA92790696d040ac24Aa414708F5c0AB', // aBasUSDC + '0xD4a0e0b9149BCee3C920d2E00b5dE09138fd8bb7', // aBasWETH + '0xBdb9300b7CDE636d9cD4AFF00f6F009fFBBc8EE6', // aBascbBTC +] async function tvl(api) { - // each core vault stakes its Slipstream position in the pool's gauge - const gauges = await api.multiCall({ abi: 'address:GAUGE', calls: CORE_VAULTS }) + await api.getBlock() + + // 1. Aerodrome Slipstream staked positions across all v4 & v5 Aero CoreVaults + const gauges = await api.multiCall({ abi: 'address:GAUGE', calls: AERO_CORE_VAULTS }) const stakedIds = await api.multiCall({ abi: 'function stakedValues(address) view returns (uint256[])', - calls: CORE_VAULTS.map((vault, i) => ({ target: gauges[i], params: vault })), + calls: AERO_CORE_VAULTS.map((vault, i) => ({ target: gauges[i], params: vault })), }) - await unwrapSlipstreamNFT({ api, positionIds: stakedIds.flat(), nftAddress: SLIPSTREAM_NFT }) + const allStakedIds = stakedIds.flat() + if (allStakedIds.length) { + await unwrapSlipstreamNFT({ api, positionIds: allStakedIds, nftAddress: SLIPSTREAM_NFT }) + } + + // 2. Uniswap v3 positions held directly by ZLP v5 UniV3 CoreVaults + await unwrapUniswapV3NFT({ api, owners: UNI_CORE_VAULTS, nftAddress: UNI_V3_NFT }) - // idle balances held by the core vaults and the meta vaults - return sumTokens2({ api, owners: [...CORE_VAULTS, ...META_VAULTS], tokens: TOKENS }) + // 3. Idle spot balances and Aave v3 Storm Shelter aTokens held by core and meta vaults + return sumTokens2({ + api, + owners: [...AERO_CORE_VAULTS, ...UNI_CORE_VAULTS, ...META_VAULTS], + tokens: TOKENS, + }) } module.exports = { - methodology: 'Counts the WETH, cbBTC and USDC in the Aerodrome Slipstream positions that the ZLP core vaults stake in their gauges, plus idle balances held by the core vaults and the two meta vaults. Meta vault holdings of core vault shares are not counted a second time.', + methodology: 'Counts WETH, cbBTC, and USDC across ZLP v4 and v5 Aerodrome Slipstream staked positions, ZLP v5 Uniswap v3 positions, ZLP v5 Aave v3 Storm Shelter aToken reserves, and idle token balances held by the core and meta vaults. Meta vault holdings of core vault shares are not counted a second time.', doublecounted: true, start: '2026-11-27', base: { tvl }, -} +} \ No newline at end of file From c2b2957779ef0baf0f6dbbc41528765044617eae Mon Sep 17 00:00:00 2001 From: Kinlend finance Date: Tue, 1 Dec 2026 22:12:19 +0700 Subject: [PATCH 984/988] Add Kinlend (Elysium lending on Morpho Blue) (#22475) Co-authored-by: builder Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- projects/kinlend/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/kinlend/index.js diff --git a/projects/kinlend/index.js b/projects/kinlend/index.js new file mode 100644 index 00000000000..975cd765c73 --- /dev/null +++ b/projects/kinlend/index.js @@ -0,0 +1,31 @@ +const { getLogs2 } = require("../helper/cache/getLogs") +const abi = require("../helper/abis/morpho.json") +const { sumTokens2 } = require("../helper/unwrapLPs") + +// Kinlend deployed and operates its own Morpho Blue singleton on Elysium; no other curator uses it, +// so every token it holds belongs to Kinlend markets. Its balances are loan-asset cash +// (supplied minus borrowed) plus borrower collateral. Kinlend's MetaMorpho vaults supply into these +// same markets, so they are not added again. +const MORPHO = "0x8410eD2fCec62F4B314B15697F9c5e5524763A10" +const FROM_BLOCK = 13772683 +const createMarket = "event CreateMarket(bytes32 indexed id, (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams)" + +const getMarkets = (api) => getLogs2({ api, target: MORPHO, eventAbi: createMarket, fromBlock: FROM_BLOCK, onlyArgs: true, extraKey: 'kinlend-createMarket' }) + +async function tvl(api) { + const logs = await getMarkets(api) + const tokens = logs.flatMap((i) => [i.marketParams.loanToken, i.marketParams.collateralToken]) + return sumTokens2({ api, owner: MORPHO, tokens, permitFailure: true }) +} + +async function borrowed(api) { + const logs = await getMarkets(api) + const data = await api.multiCall({ target: MORPHO, abi: abi.morphoBlueFunctions.market, calls: logs.map((i) => i.id) }) + logs.forEach((l, i) => api.add(l.marketParams.loanToken, data[i].totalBorrowAssets)) +} + +module.exports = { + methodology: "Counts tokens held by Kinlend's Morpho Blue deployment on Elysium: USDC supplied by lenders and vaults that has not been borrowed, plus collateral posted by borrowers. Outstanding USDC loans are reported under borrowed.", + start: '2026-11-30', + elysium: { tvl, borrowed }, +} From 5ed5631e73e909319220de64157fd2bca6437e01 Mon Sep 17 00:00:00 2001 From: PUNZI Date: Tue, 1 Dec 2026 10:20:44 -0500 Subject: [PATCH 985/988] Add PUNZI WARS TVL adapter (#22477) --- projects/punzi-wars/index.js | 60 ++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 projects/punzi-wars/index.js diff --git a/projects/punzi-wars/index.js b/projects/punzi-wars/index.js new file mode 100644 index 00000000000..06f057163ec --- /dev/null +++ b/projects/punzi-wars/index.js @@ -0,0 +1,60 @@ +const ADDRESSES = require('../helper/coreAssets.json') + + +// Each market is its own bonding-curve token contract. Two factories on each chain created them: +// one for native-coin collateral and one for ERC-20 collateral. fromBlock is the block each factory was deployed in. +// Factory addresses (the same on every chain): github.com/PUNZIWARS/punzi, VERIFICATION.md +const config = { + ethereum: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 26483513 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 26483516 } }, + optimism: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 159952684 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 159952696 } }, + flare: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 75265368 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 75265430 } }, + cronos: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 107733760 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 107733844 } }, + bsc: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 135418197 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 135418281 } }, + xdai: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 49440723 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 49440729 } }, + polygon: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 97887945 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 97888016 } }, + monad: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 124943816 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 124943944 } }, + sonic: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 83052537 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 83052546 } }, + hyperliquid: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 52090691 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 52090752 } }, + sei: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 245067659 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 245067708 } }, + ronin: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 64018034 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 64018047 } }, + mantle: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 103686742 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 103686766 } }, + klaytn: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 233299158 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 233299252 } }, + base: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 61569535 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 61569643 } }, + plasma: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 38550920 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 38550957 } }, + arbitrum: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 527047684 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 527047778 } }, + celo: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 83603722 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 83603743 } }, + avax: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 101236632 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 101236656 } }, + linea: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 32696043 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 32696049 } }, + berachain: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 29244815 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 29244826 } }, + plume_mainnet: { native: { factory: '0x4799cdcb8d9635aebfeccd691ce2fc0553bada55', fromBlock: 107832837 }, erc20: { factory: '0x2acf1148e206fb9608529ea9afa540eb75bada55', fromBlock: 107832903 } }, +} + +// A factory's markets at the block being read; none before the factory was deployed. +async function listMarkets(api, { factory, fromBlock }) { + if ((await api.getBlock()) < fromBlock) return [] + return api.call({ target: factory, abi: 'address[]:allInstances' }) +} + +async function tvl(api) { + const { native, erc20 } = config[api.chain] + + // Native-collateral markets hold the chain's native coin. + const nativeMarkets = await listMarkets(api, native) + if (nativeMarkets.length) await api.sumTokens({ owners: nativeMarkets, tokens: [ADDRESSES.null] }) + + // ERC-20-collateral markets hold their collateral token. + const erc20Markets = await listMarkets(api, erc20) + if (erc20Markets.length) { + const tokens = await api.multiCall({ abi: 'address:collateralToken', calls: erc20Markets }) + await api.sumTokens({ tokensAndOwners: tokens.map((token, i) => [token, erc20Markets[i]]) }) + } +} + +module.exports = { + methodology: 'Counts the collateral held by the PUNZI WARS bonding-curve token contracts: the native coin in each native-collateral contract and the collateral token in each ERC-20-collateral contract. The contracts are listed from the two factory contracts on each chain.', + start: '2026-11-24', +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl } +}) From 954f413f17e9a7f60f9f9763d7de88879d05a6b4 Mon Sep 17 00:00:00 2001 From: FelixBruguera Date: Tue, 1 Dec 2026 11:32:19 -0400 Subject: [PATCH 986/988] Add Comfy (#22483) Co-authored-by: Doga Oztuzun Co-authored-by: AytuncYildizli --- projects/comfy-dex/index.js | 7 +++ projects/comfy-launchpad/index.js | 7 +++ projects/comfy-launchpad/pools.js | 82 +++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 projects/comfy-dex/index.js create mode 100644 projects/comfy-launchpad/index.js create mode 100644 projects/comfy-launchpad/pools.js diff --git a/projects/comfy-dex/index.js b/projects/comfy-dex/index.js new file mode 100644 index 00000000000..ff576f2c31c --- /dev/null +++ b/projects/comfy-dex/index.js @@ -0,0 +1,7 @@ +const { addPoolBalances, isLaunchPool, start } = require('../comfy-launchpad/pools') + +module.exports = { + start, + methodology: 'Tokens held by liquidity positions in Comfy\'s listed pairs, such as iAI/0G and USDZ/0G: the PancakeSwap Infinity pools on 0G that do not use Comfy\'s launch hook. Includes uncollected LP fees.', + '0g': { tvl: (api) => addPoolBalances(api, (pool) => !isLaunchPool(pool)) }, +} diff --git a/projects/comfy-launchpad/index.js b/projects/comfy-launchpad/index.js new file mode 100644 index 00000000000..1ee9e0ab8e6 --- /dev/null +++ b/projects/comfy-launchpad/index.js @@ -0,0 +1,7 @@ +const { addPoolBalances, isLaunchPool, start } = require('./pools') + +module.exports = { + start, + methodology: 'Tokens held by liquidity positions in Comfy launch pools: the PancakeSwap Infinity pools on 0G that use Comfy\'s launch hook, one per launched token, each paired with native 0G. Launched tokens count only where DefiLlama has a price. Includes uncollected LP fees.', + '0g': { tvl: (api) => addPoolBalances(api, isLaunchPool) }, +} diff --git a/projects/comfy-launchpad/pools.js b/projects/comfy-launchpad/pools.js new file mode 100644 index 00000000000..0de0f307caf --- /dev/null +++ b/projects/comfy-launchpad/pools.js @@ -0,0 +1,82 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { getSqrtPriceX96AtTick } = require('../helper/utils/tick') + +// Comfy runs its own PancakeSwap Infinity deployment on 0G. All pools live in this CLPoolManager. +// https://chainscan.0g.ai/address/0xaabd31f24914b48daea998e69683225e289d08b0 +const manager = '0xaabd31f24914b48daea998e69683225e289d08b0' +// Every token launched on Comfy trades in a pool with this hook. Other pools are listed pairs. +// https://chainscan.0g.ai/address/0x809acd73ac30b4e2d2dfd7d35b1fda850dcd4334 +const launchHook = '0x809acd73ac30b4e2d2dfd7d35b1fda850dcd4334' +const fromBlock = 45552804 +const start = 1790588777 // 2026-09-28, manager deployment +const Q96 = 2n ** 96n + +const isLaunchPool = (pool) => pool.hooks.toLowerCase() === launchHook + +function amountsForLiquidity(sqrtPrice, sqrtLower, sqrtUpper, liquidity) { + if (sqrtPrice <= sqrtLower) return [liquidity * Q96 * (sqrtUpper - sqrtLower) / sqrtLower / sqrtUpper, 0n] + if (sqrtPrice >= sqrtUpper) return [0n, liquidity * (sqrtUpper - sqrtLower) / Q96] + return [liquidity * Q96 * (sqrtUpper - sqrtPrice) / sqrtPrice / sqrtUpper, liquidity * (sqrtPrice - sqrtLower) / Q96] +} + +const MAX_UINT256 = 2n ** 256n +const Q128 = 2n ** 128n +const sub256 = (a, b) => (a - b + MAX_UINT256) % MAX_UINT256 + +// Adds the tokens held by liquidity positions in the pools that `include` selects: principal plus +// uncollected LP fees, the same funds the Vault holds for those pools. +async function addPoolBalances(api, include) { + const block = await api.getBlock() + if (block < fromBlock) return + const logs = (eventAbi, extraKey) => getLogs2({ api, target: manager, fromBlock, eventAbi, extraKey }) + + const pools = new Map() + for (const pool of await logs('event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, address hooks, uint24 fee, bytes32 parameters, uint160 sqrtPriceX96, int24 tick)', 'init')) + if (include(pool)) pools.set(pool.id.toLowerCase(), pool) + if (!pools.size) return + + // A position is keyed by pool, owner, range and salt. Its owner is the ModifyLiquidity sender. + const positions = new Map() + for (const { id, sender, tickLower, tickUpper, salt } of await logs('event ModifyLiquidity(bytes32 indexed id, address indexed sender, int24 tickLower, int24 tickUpper, int256 liquidityDelta, bytes32 salt)', 'modify')) { + if (!pools.has(id.toLowerCase())) continue + const position = { id: id.toLowerCase(), owner: sender, tickLower: Number(tickLower), tickUpper: Number(tickUpper), salt } + positions.set(`${position.id}:${sender}:${tickLower}:${tickUpper}:${salt}`.toLowerCase(), position) + } + const ids = [...pools.keys()] + const tickKeys = [...new Set([...positions.values()].flatMap((p) => [`${p.id}:${p.tickLower}`, `${p.id}:${p.tickUpper}`]))] + + const slots = await api.multiCall({ target: manager, calls: ids, abi: 'function getSlot0(bytes32 id) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)' }) + const globals = await api.multiCall({ target: manager, calls: ids, abi: 'function getFeeGrowthGlobals(bytes32 id) view returns (uint256 feeGrowthGlobal0x128, uint256 feeGrowthGlobal1x128)' }) + const ticks = await api.multiCall({ + target: manager, calls: tickKeys.map((key) => key.split(':')).map(([id, tick]) => ({ params: [id, tick] })), + abi: 'function getPoolTickInfo(bytes32 id, int24 tick) view returns ((uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128))', + }) + const infos = await api.multiCall({ + target: manager, calls: [...positions.values()].map((p) => ({ params: [p.id, p.owner, p.tickLower, p.tickUpper, p.salt] })), + abi: 'function getPosition(bytes32 id, address owner, int24 tickLower, int24 tickUpper, bytes32 salt) view returns ((uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128))', + }) + const state = new Map(ids.map((id, i) => [id, { sqrtPrice: BigInt(slots[i].sqrtPriceX96), tick: Number(slots[i].tick), global: [BigInt(globals[i][0]), BigInt(globals[i][1])], amounts: [0n, 0n] }])) + const outside = new Map(tickKeys.map((key, i) => [key, [BigInt(ticks[i].feeGrowthOutside0X128), BigInt(ticks[i].feeGrowthOutside1X128)]])) + + ;[...positions.values()].forEach((p, i) => { + const liquidity = BigInt(infos[i].liquidity) + if (liquidity === 0n) return + const pool = state.get(p.id) + const principal = amountsForLiquidity(pool.sqrtPrice, getSqrtPriceX96AtTick(p.tickLower), getSqrtPriceX96AtTick(p.tickUpper), liquidity) + const lower = outside.get(`${p.id}:${p.tickLower}`) + const upper = outside.get(`${p.id}:${p.tickUpper}`) + const last = [BigInt(infos[i].feeGrowthInside0LastX128), BigInt(infos[i].feeGrowthInside1LastX128)] + for (const k of [0, 1]) { + const below = pool.tick >= p.tickLower ? lower[k] : sub256(pool.global[k], lower[k]) + const above = pool.tick < p.tickUpper ? upper[k] : sub256(pool.global[k], upper[k]) + const inside = sub256(sub256(pool.global[k], below), above) + pool.amounts[k] += principal[k] + liquidity * sub256(inside, last[k]) / Q128 + } + }) + for (const [id, { amounts }] of state) { + api.add(pools.get(id).currency0, amounts[0]) + api.add(pools.get(id).currency1, amounts[1]) + } +} + +module.exports = { addPoolBalances, isLaunchPool, start } From a0e1ff0ecd9efd8062fc930c577a03eeb1b602ea Mon Sep 17 00:00:00 2001 From: Norce Date: Tue, 1 Dec 2026 22:47:20 +0700 Subject: [PATCH 987/988] Add Norce (Elysium) (#22481) Co-authored-by: norceagent Co-authored-by: FelixBruguera --- projects/norce/index.js | 53 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 projects/norce/index.js diff --git a/projects/norce/index.js b/projects/norce/index.js new file mode 100644 index 00000000000..118dfc603ee --- /dev/null +++ b/projects/norce/index.js @@ -0,0 +1,53 @@ +// Norce (https://norceagent.com): a no-code trading agent on Elysium. Every user gets their own vault from Norce's factories: +// - NorceVaultFactory: one spot vault per user, holding USDC and the listed tokens the agent trades (WHYPE) +// - NorceLPVaultFactory (one per pool): LP vaults that keep a concentrated-liquidity position in a Ramses V3 pool and rebalance it +// TVL is what sits in those vaults: idle tokens plus the tokens behind each vault's LP position. +// Contracts: https://github.com/norceagent/norceagent + +const VAULT_FACTORY = '0x081Bb8b812849760F13e1211E8b49a339432a377' +// One LP vault factory per Ramses V3 pool. +const LP_FACTORIES = [ + '0x25220e0f0658F190c733cc10a558298BD7F1C1BD', // HYPE/USDC + '0xcA12ef1318F19c46C85c042af086C811c1Dc6f25', // MONTRA/WHYPE + '0x42838076e39b3F1f56F1DEb9675fE74D14375472', // LiquidV/WHYPE +] + +async function tvl(api) { + await api.getBlock() // read spot and LP balances at one block + // Spot vaults: every token the factory lists, plus USDC. + const vaults = await api.fetchList({ lengthAbi: 'uint256:vaultCount', itemAbi: 'function allVaults(uint256) view returns (address)', target: VAULT_FACTORY }) + if (vaults.length) { + const listed = await api.call({ target: VAULT_FACTORY, abi: 'function tokens() view returns ((address token, address feed, uint32 maxStaleness, uint24 feeTier)[])' }) + const stable = await api.call({ target: VAULT_FACTORY, abi: 'address:stable' }) + const tokens = [...listed.map((t) => t.token), stable] + await api.sumTokens({ owners: vaults, tokens }) + } + + // LP vaults: the amounts behind the position plus what is idle in the vault. + const counts = await api.multiCall({ calls: LP_FACTORIES, abi: 'uint256:vaultCount' }) + const vaultCalls = LP_FACTORIES + .map((target, i) => ({ target, count: Number(counts[i]) })) + .filter((f) => f.count > 0) + .map((f) => ({ target: f.target, params: [0, f.count] })) + if (!vaultCalls.length) return + const lists = await api.multiCall({ abi: 'function vaults(uint256 start, uint256 count) view returns (address[])', calls: vaultCalls }) + const lpVaults = lists.flat() + if (!lpVaults.length) return + const token0s = await api.multiCall({ calls: lpVaults, abi: 'address:token0' }) + const token1s = await api.multiCall({ calls: lpVaults, abi: 'address:token1' }) + const positions = await api.multiCall({ calls: lpVaults, abi: 'function positionAmounts() view returns (uint256 amount0, uint256 amount1)' }) + const idles = await api.multiCall({ calls: lpVaults, abi: 'function idle() view returns (uint256 amount0, uint256 amount1)' }) + lpVaults.forEach((_, i) => { + api.add(token0s[i], BigInt(positions[i].amount0) + BigInt(idles[i].amount0)) + api.add(token1s[i], BigInt(positions[i].amount1) + BigInt(idles[i].amount1)) + }) +} + +module.exports = { + methodology: + 'TVL is the USDC and tokens held in each user\'s Norce spot vault, plus the tokens behind each Norce LP vault\'s Ramses V3 ' + + 'position and what the LP vault holds idle. Perps that Norce agents trade in users\' own Hyperliquid accounts are not counted.', + doublecounted: true, + start: '2026-12-01', + elysium: { tvl }, +} From b425ce7061af533f89f126aa2a7752f9560229d3 Mon Sep 17 00:00:00 2001 From: Bhargava Sai Macha Date: Tue, 1 Dec 2026 23:50:03 +0530 Subject: [PATCH 988/988] Value DAWN deal collateral from its on-chain Beam USD price map (#2) --- projects/loopscale/index.js | 43 ++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/projects/loopscale/index.js b/projects/loopscale/index.js index d733e0869ab..b75163a8251 100644 --- a/projects/loopscale/index.js +++ b/projects/loopscale/index.js @@ -182,6 +182,42 @@ const loopscaleIdl = { const WHIRLPOOL_PROGRAM = new PublicKey('whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc') const WHIRLPOOL_POSITION_SIZE = 216 const WHIRLPOOL_SIZE = 653 +const DAWN_BEAM = new PublicKey('H84M3es89eLfGRDhUFxo7xgTQmhzAx4h2oBexU7WNiGN') +const BEAM_PROGRAM = new PublicKey('beamVVkNmKeXcuZ6zLpC9eM5YgVyAn4Z9xdPrz3gCW2') +const BEAM_DISCRIMINATOR = Buffer.from('f32dd19543bfbd92', 'hex') +const PRICE_NODES_OFFSET = 120 +const PRICE_NODE_SIZE = 152 +const MAX_PRICE_ENTRIES = 255 + +async function addDawnCollateral(api, connection, collateral) { + const account = await connection.getAccountInfo(DAWN_BEAM) + if (!account || !account.owner.equals(BEAM_PROGRAM)) throw new Error('loopscale: missing DAWN Beam account') + const { data } = account + if (data.length < PRICE_NODES_OFFSET + MAX_PRICE_ENTRIES * PRICE_NODE_SIZE || + !data.subarray(0, 8).equals(BEAM_DISCRIMINATOR) || data[8] !== 1 || data.toString('ascii', 41, 49) !== 'USD ') + throw new Error('loopscale: unexpected DAWN Beam account format or currency') + + // BeamAccount v1: the price map starts at byte 88. Its Sokoban tree has a 32-byte + // header and 255 one-based nodes. Follow the child links to skip freed entries. + const stack = [data.readUInt32LE(88)] + const visited = new Set() + let totalUsdScaled = 0n + while (stack.length) { + const index = stack.pop() + if (index === 0) continue + if (index > MAX_PRICE_ENTRIES || visited.has(index)) throw new Error('loopscale: invalid DAWN Beam price tree') + visited.add(index) + const node = PRICE_NODES_OFFSET + (index - 1) * PRICE_NODE_SIZE + stack.push(data.readUInt32LE(node), data.readUInt32LE(node + 4)) + const mint = new PublicKey(data.subarray(node + 16, node + 48)).toBase58() + if (collateral[mint] !== 1n) continue // Each deal has one indivisible NFT. + + // BeamPricingData begins with unit_spot_price, an 18-decimal little-endian u192. + totalUsdScaled += bytesToBigIntLE(data.subarray(node + 48, node + 72)) + delete collateral[mint] + } + api.addUSDValue(Number(totalUsdScaled) / 1e18) +} function whirlpoolAccountData(account, size, key) { if (account.data.length !== size) throw new Error(`loopscale: whirlpool account ${key} is ${account.data.length} bytes, expected ${size}`) @@ -315,9 +351,10 @@ function getIdleBalanceForStrategy(strategy) { return amountExternallySupplied + amountHeldByStrategy; } -async function getDeposits(connection) { +async function getDeposits(connection, api) { const loans = await getLoans(connection); const collateralBalances = getCollateralValuesForLoans(loans); + await addDawnCollateral(api, connection, collateralBalances); const strats = await getStrategies(connection); const idleCapitalBalances = getIdleCapital(strats); @@ -334,7 +371,7 @@ async function getDeposits(connection) { } async function tvl(api) { - const balances = await getDeposits(getConnection()) + const balances = await getDeposits(getConnection(), api) for (const mint of await addWhirlpoolPositions(api, balances)) delete balances[mint] const mints = Object.keys(balances).filter(mint => balances[mint] !== 0n) api.addTokens(mints, mints.map(mint => balances[mint])) @@ -352,6 +389,6 @@ module.exports = { doublecounted: false, timetravel: false, methodology: - 'TVL sums idle lender capital in strategies and collateral supplied to loans, read on-chain. Orca position NFTs are valued from their pool liquidity. Collateral with no on-chain value, such as DAWN private-credit deal NFTs, is not counted.', + 'TVL sums idle lender capital in strategies and collateral supplied to loans, read on-chain. Orca position NFTs are valued from their pool liquidity. DAWN private-credit deal NFTs are valued at the USD spot price recorded for their mint in the DAWN Beam account.', solana: { tvl, borrowed, }, }