diff --git a/package-lock.json b/package-lock.json index bce92f9967..b2a77fb276 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,9 +51,9 @@ } }, "node_modules/@adraffy/ens-normalize": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", - "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" }, "node_modules/@aws-crypto/crc32": { "version": "3.0.0", @@ -886,9 +886,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "5.0.69", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.69.tgz", - "integrity": "sha512-IYdT4P5vG9xt14tM9RuT1+uBUyD8oL6fdTWC3iwOlwATjWKA1kwOhucCXNFE8sc2KKugwTUfQuGp8Q3fHDxAfw==", + "version": "5.0.71", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.71.tgz", + "integrity": "sha512-5hZ8TdYIrFa/f4hxb2ADzARmXxeuG5P8yukuQwNbiO8EnLcrDNPKwv5JXNaslWkMexlaeVy1m+EMLnTlbzeQSw==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@elastic/elasticsearch": "^8.13.1", @@ -2648,9 +2648,9 @@ } }, "node_modules/ethers": { - "version": "6.9.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.9.2.tgz", - "integrity": "sha512-YpkrtILnMQz5jSEsJQRTpduaGT/CXuLnUIuOYzHA0v/7c8IX91m2J48wSKjzGL5L9J/Us3tLoUdb+OwE3U+FFQ==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.1.tgz", + "integrity": "sha512-hdJ2HOxg/xx97Lm9HdCWk949BfYqYWpyw4//78SiwOLgASyfrNszfMUNB2joKjvGUdwhHfaiMMFFwacVVoLR9A==", "funding": [ { "type": "individual", @@ -2662,13 +2662,13 @@ } ], "dependencies": { - "@adraffy/ens-normalize": "1.10.0", + "@adraffy/ens-normalize": "1.10.1", "@noble/curves": "1.2.0", "@noble/hashes": "1.3.2", "@types/node": "18.15.13", "aes-js": "4.0.0-beta.5", "tslib": "2.4.0", - "ws": "8.5.0" + "ws": "8.17.1" }, "engines": { "node": ">=14.0.0" @@ -3144,9 +3144,9 @@ "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" }, "node_modules/jayson/node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "engines": { "node": ">=8.3.0" }, @@ -3963,15 +3963,15 @@ "dev": true }, "node_modules/ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "utf-8-validate": ">=5.0.2" }, "peerDependenciesMeta": { "bufferutil": { diff --git a/projects/SecuredFinance/index.js b/projects/SecuredFinance/index.js index 927411c5dd..d8b7edaf73 100644 --- a/projects/SecuredFinance/index.js +++ b/projects/SecuredFinance/index.js @@ -6,6 +6,7 @@ const config = { tokenVault: '0x0896AC8B9e2DC3545392ff65061E5a8a3eD68824', currencyController: '0x9E1254292195F241FA2DF1aA51af23796627A74B', }, + filecoin: {} }; Object.keys(config).forEach(chain => { diff --git a/projects/agentfi/index.js b/projects/agentfi/index.js index 3b0f57a84c..7f9e0ce4fb 100644 --- a/projects/agentfi/index.js +++ b/projects/agentfi/index.js @@ -3,6 +3,7 @@ const { getTvlForLooperWithOrbit } = require('./strategies/looper') const { getTvlForDexBalancer } = require('./strategies/dex-balancer') const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); const { getAllAgent } = require("./utils"); +const { getTvlForBladeSwapCLM } = require("./strategies/bladeswap"); async function tvl(api) { @@ -10,6 +11,7 @@ async function tvl(api) { const allAgentsAddress = allAgents.map(i => i.agentAddress) const dexBalancerAgents = allAgents.filter(i => i.moduleType === "DexBalancer") const concentratedLiquidityAgents = allAgents.filter(i => i.moduleType === "ConcentratedLiquidity") + const bladeSwapConcentratedLiquidityAgentAddresses = allAgents.filter(i => i.moduleType === "BladeSwapLiquidityManager").map(i => i.agentAddress) const looperAgentsAddresses = allAgents.filter(i => i.moduleType === "Looper").map(i => i.agentAddress) @@ -23,7 +25,8 @@ async function tvl(api) { await getTvlForDexBalancer(dexBalancerAgents.map(i => i.agentAddress), api) - await getTvlForLooperWithOrbit(looperAgentsAddresses, api) + await getTvlForLooperWithOrbit(looperAgentsAddresses, api) + await getTvlForBladeSwapCLM(bladeSwapConcentratedLiquidityAgentAddresses, api) await sumTokens2({ tokensAndOwners: [ ...thrusterv2, diff --git a/projects/agentfi/strategies/bladeswap.js b/projects/agentfi/strategies/bladeswap.js new file mode 100644 index 0000000000..704752bafa --- /dev/null +++ b/projects/agentfi/strategies/bladeswap.js @@ -0,0 +1,56 @@ +async function getTvlForBladeSwapCLM(agentAddresses, api) { + const calls = agentAddresses.map(agent => ({ + target: agent, params: [] + })) + + const safelyGetStateOfAMMPromise = api.multiCall({ + abi: 'function safelyGetStateOfAMM() view returns (uint160 sqrtPrice, int24 tick, uint16 lastFee, uint8 pluginConfig, uint128 activeLiquidity, int24 nextTick, int24 previousTick)', + calls: calls, + withMetadata: true, + permitFailure: true, + }) + const positionPromise = api.multiCall({ + abi: 'function position() view returns (uint96 nonce, address operator, address token0, address token1, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', + calls: calls, + withMetadata: true, + permitFailure: true, + }) + const [positionData, safelyGetStateOfAMMData] = await Promise.all([positionPromise, safelyGetStateOfAMMPromise]) + agentAddresses.forEach((address) => { + const positionResult = positionData.find(b => b.input.target === address) + const safelyGetStateOfAMMResult = safelyGetStateOfAMMData.find(b => b.input.target === address) + if (safelyGetStateOfAMMResult.success && positionResult.success) { + const position = positionResult.output + const safelyGetStateOfAMM = safelyGetStateOfAMMResult.output + const tickToPrice = (tick) => 1.0001 ** tick + const token0 = position.token0 + const token1 = position.token1 + const liquidity = position.liquidity + const bottomTick = +position.tickLower + const topTick = +position.tickUpper + const tick = safelyGetStateOfAMM.tick + const sa = tickToPrice(bottomTick / 2) + const sb = tickToPrice(topTick / 2) + let amount0 = 0 + let amount1 = 0 + if (tick < bottomTick) { + amount0 = liquidity * (sb - sa) / (sa * sb) + } else if (tick < topTick) { + const price = tickToPrice(tick) + const sp = price ** 0.5 + + amount0 = liquidity * (sb - sp) / (sp * sb) + amount1 = liquidity * (sp - sa) + } else { + amount1 = liquidity * (sb - sa) + } + + api.add(token0, amount0) + api.add(token1, amount1) + } + }) +} + +module.exports = { + getTvlForBladeSwapCLM +} diff --git a/projects/agentfi/strategies/dex-balancer.js b/projects/agentfi/strategies/dex-balancer.js index ecbbd4cca0..db3b650f4b 100644 --- a/projects/agentfi/strategies/dex-balancer.js +++ b/projects/agentfi/strategies/dex-balancer.js @@ -57,8 +57,8 @@ async function getTvlForDexBalancer(agentAddresses, api) { const reserve1BigN = BigNumber(reserve1) const token0Balance = lpBalanceBigN.times(reserve0BigN).div(totalBigN) const token1Balance = lpBalanceBigN.times(reserve1BigN).div(totalBigN) - api.add(RingTokenMappings[address0], token0Balance.toFixed(0)) - api.add(RingTokenMappings[address1], token1Balance.toFixed(0)) + api.add(RingTokenMappings[address0.toLowerCase()], token0Balance.toFixed(0)) + api.add(RingTokenMappings[address1.toLowerCase()], token1Balance.toFixed(0)) } const hyperlocklpBalance = hyperlocklpBalances.find(b => b.input.params[0] === address) if (hyperlocklpBalance.success) { diff --git a/projects/agentfi/utils.js b/projects/agentfi/utils.js index b96518f17f..d9e24955e3 100644 --- a/projects/agentfi/utils.js +++ b/projects/agentfi/utils.js @@ -62,7 +62,13 @@ async function getAllAgent(api) { const DexBalancerModules = ["0x7e8280f5Ee5137f89d09FA61B356fa322a93415a", "0x35a4B9B95bc1D93Bf8e3CA9c030fc15726b83E6F", "0x067299A9C3F7E8d4A9d9dD06E2C1Fe3240144389"] const MultioliooorModule = ["0x54D588243976F7fA4eaf68d77122Da4e6C811167"] const ConcentratedLiquidityModule = ["0x10C02a975a748Db5B749Dc420154dD945e2e8657", "0x41D68d86545D6b931c1232f1E0aBB5844Ada4967", "0xa11D4dcD5a9ad75c609E1786cf1FD88b53C83A5E"] - const Looper = ["0x6A9D21A09A76808C444a89fE5fCc0a5f38dc0523", "0xe5fe6f280CEadc5c4DDE69eF2DF6234dd7Bd82E2"] + const BladeSwapConcentratedLiquidityModule = [ + "0x5dBC01F3F1310E36454C43cA1d2c84F44b8094F2", + "0xa28299bfbf44450CbA73a1eAdcE461AF62181a02", + "0xD18eD95286316a359291b21d02e8d46C59986302", + ] + const pacLooperModule = '0x5E38765FF50D9b8932441Cd668c1fDA365D358b5' + const Looper = ["0x6A9D21A09A76808C444a89fE5fCc0a5f38dc0523", "0xe5fe6f280CEadc5c4DDE69eF2DF6234dd7Bd82E2", "0x8220512520db5D3295EA41308601FD0974405975", pacLooperModule] if (modules.some(i => DexBalancerModules.includes(i))) { return { ...i, @@ -78,6 +84,11 @@ async function getAllAgent(api) { ...i, moduleType: "ConcentratedLiquidity" } + } else if (modules.some(i => BladeSwapConcentratedLiquidityModule.includes(i))) { + return { + ...i, + moduleType: "BladeSwapLiquidityManager" + } } else if (modules.some(i => Looper.includes(i))) { return { ...i, diff --git a/projects/ainnswap/index.js b/projects/ainnswap/index.js new file mode 100644 index 0000000000..4efe43244e --- /dev/null +++ b/projects/ainnswap/index.js @@ -0,0 +1,10 @@ +const { iziswapExport } = require('../helper/iziswap') + +const poolHelpers = { + 'ailayer': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], +} // iziswap 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/airdao-hera-pool/index.js b/projects/airdao-hera-pool/index.js new file mode 100644 index 0000000000..d14949b826 --- /dev/null +++ b/projects/airdao-hera-pool/index.js @@ -0,0 +1,11 @@ +async function tvl(api) { + const totalStake = await api.call({abi: 'uint256:totalStake', target: '0x0E051C8C1cd519d918DB9b631Af303aeC85266BF'}) + api.addCGToken('amber', totalStake/1e18) +} + +module.exports = { + methodology: `TVL counts deposits made to Hera pool on AirDAO.`, + airdao: { + tvl + } +} diff --git a/projects/airpuff/index.js b/projects/airpuff/index.js index 66bec24faf..f2189acf57 100644 --- a/projects/airpuff/index.js +++ b/projects/airpuff/index.js @@ -13,31 +13,54 @@ const contractAbis = { getUnderlyingPrice: "function getUnderlyingPrice(address cToken) view returns (uint256)", getUniswapPrice: "function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 observationCardinalityNext, uint8 observationCardinalityNext)", + getMantleBalance: "function balances(address) view returns (uint256)", }; module.exports = { misrepresentedTokens: true, + mantle: { + tvl: async (api) => { + const mantle = { + vault: "0xf9B484901BCA34A8615c90E8C4933f1Bd553B639", + lending: "0x08ccF72358B44D9d45438Fc703962A0a2FD5c978", + staking: "0x9f39dC8eA0a73ab462d23104699AFAE9c30d1E4f", + }; + + const stakedBalance = await api.call({ + abi: contractAbis.getMantleBalance, + target: mantle.staking, + params: [mantle.vault], + }); + + api.add(ADDRESSES.mantle.WMNT, stakedBalance); + + await api.sumTokens({ + tokensAndOwners: [[ADDRESSES.mantle.WMNT, mantle.lending]], + }); + }, + }, + karak: { tvl: async (api) => { const KUSDC = { vault: "0x4c18E80b801AA24066D8B1C6E65ee245497Cb741", - token: ADDRESSES.karak.USDC, + token: "0xa415021bC5c4C3b5B989116DC35Ae95D9C962c8D", }; const KWETH = { vault: "0x9a9631F7BEcE5C6E0aBA1f73f0e5796c534dc4db", - token: ADDRESSES.optimism.WETH_1, + token: "0x4200000000000000000000000000000000000006", }; const wethLending = { vault: "0xd6034F9147CF7528e857403Dea93bc45743295eb", - token: ADDRESSES.optimism.WETH_1, + token: "0x4200000000000000000000000000000000000006", }; const usdcLending = { vault: "0x475820E4bCE0E3d233Ad7f6A8c9DD1f66974c5d6", - token: ADDRESSES.karak.USDC, + token: "0xa415021bC5c4C3b5B989116DC35Ae95D9C962c8D", }; const KarakUSDCBal = await api.call({ target: KUSDC.vault, abi: contractAbis.getTotalSupply }); diff --git a/projects/aktionariat/index.js b/projects/aktionariat/index.js index aa12406051..44ba41bf2c 100644 --- a/projects/aktionariat/index.js +++ b/projects/aktionariat/index.js @@ -4,6 +4,7 @@ const { cachedGraphQuery } = require('../helper/cache') const graphs = { ethereum: sdk.graph.modifyEndpoint('2ZoJCp4S7YP7gbYN2ndsYNjPeZBV1PMti7BBoPRRscNq'), optimism: sdk.graph.modifyEndpoint('3QfEXbPfP23o3AUzcmjTfRtUUd4bfrFj3cJ4jET57CTX'), + polygon: sdk.graph.modifyEndpoint('7camBLZckE5TLKha372tqawpDs8Lkez6yYiri7PykRak'), } function tvlPaged(chain) { @@ -29,7 +30,7 @@ module.exports = { timetravel: false, hallmarks: [] } -const chains = ['ethereum', 'optimism'] +const chains = ['ethereum', 'optimism', 'polygon'] chains.forEach(chain => { module.exports[chain] = { diff --git a/projects/allstake/idls/strategy_manager.json b/projects/allstake/idls/strategy_manager.json new file mode 100644 index 0000000000..c543451595 --- /dev/null +++ b/projects/allstake/idls/strategy_manager.json @@ -0,0 +1,82 @@ +{ + "version": "0.1.0", + "name": "strategy_manager", + "instructions": [], + "accounts": [ + { + "name": "StrategyManager", + "type": { + "kind": "struct", + "fields": [ + { + "name": "data", + "type": { + "defined": "VersionedStrategyManager" + } + } + ] + } + } + ], + "types": [ + { + "name": "StrategyManagerV1", + "type": { + "kind": "struct", + "fields": [ + { + "name": "owner", + "docs": [ + "owner of strategy manager program" + ], + "type": "publicKey" + }, + { + "name": "strategyMints", + "docs": [ + "list of supported strategies' mint address" + ], + "type": { + "array": [ + "publicKey", + 32 + ] + } + }, + { + "name": "strategyMintsLen", + "docs": [ + "size of the list above" + ], + "type": "u8" + }, + { + "name": "minWithdrawDelay", + "docs": [ + "min withdraw queueing delay length in seconds" + ], + "type": "i64" + } + ] + } + }, + { + "name": "VersionedStrategyManager", + "type": { + "kind": "enum", + "variants": [ + { + "name": "V1", + "fields": [ + { + "defined": "StrategyManagerV1" + } + ] + } + ] + } + } + ], + "events": [], + "errors": [] +} \ No newline at end of file diff --git a/projects/allstake/index.js b/projects/allstake/index.js new file mode 100644 index 0000000000..a685108ede --- /dev/null +++ b/projects/allstake/index.js @@ -0,0 +1,56 @@ +const { getUniqueAddresses } = require('../helper/utils'); +const { call, sumTokens } = require('../helper/chain/near'); +const { sumTokens2, getProvider } = require('../helper/solana'); +const { Program } = require('@coral-xyz/anchor'); +const { PublicKey } = require('@solana/web3.js'); + +const ALLSTAKE_NEAR_CONTRACT = 'allstake.near'; +const ALLSTAKE_SOLANA_PROGRAM = new PublicKey('a11zL6Uxue6mYG3JD3APmnVhS4RVjGTJZbENY7L6ZfD'); +const ALLSTAKE_SOLANA_PROGRAM_IDL = require('./idls/strategy_manager.json'); + +async function nearTvl() { + const strategies = await call(ALLSTAKE_NEAR_CONTRACT, 'get_strategies', {}); + const tokens = getUniqueAddresses(strategies.map(s => s.underlying_token)); + return sumTokens({ + owners: [ALLSTAKE_NEAR_CONTRACT], + tokens, + }); +} + +async function solanaTvl() { + const provider = getProvider(); + const programId = ALLSTAKE_SOLANA_PROGRAM; + // const idl = await Program.fetchIdl(programId, provider) + const program = new Program(ALLSTAKE_SOLANA_PROGRAM_IDL, programId, provider); + const state = await program.account.strategyManager.all(); + const strategyManager = state[0].account.data.v1[0]; + const tokens = getUniqueAddresses(strategyManager.strategyMints.slice(0, strategyManager.strategyMintsLen).map(mint => mint.toBase58()), true); + + const tokensAndOwners = []; + for (const token of tokens) { + const pubKey = new PublicKey(token); + const owner = PublicKey.findProgramAddressSync( + [ + Buffer.from('STRATEGY'), + pubKey.toBuffer(), + ], + ALLSTAKE_SOLANA_PROGRAM + )[0].toBase58(); + tokensAndOwners.push([token, owner]); + } + + return sumTokens2({ + tokensAndOwners + }); +} + +module.exports = { + near: { + tvl: nearTvl, + }, + solana: { + tvl: solanaTvl, + }, + timetravel: false, + methodology: 'Summed up all the tokens deposited in the contract', +} diff --git a/projects/alpha-homora/v2.js b/projects/alpha-homora/v2.js index d7aa9b9814..ab58294362 100644 --- a/projects/alpha-homora/v2.js +++ b/projects/alpha-homora/v2.js @@ -10,40 +10,40 @@ const { getConfig } = require('../helper/cache') const chainParams = { optimism: { safeBoxApi: "https://api.homora.alphaventuredao.io/v2/10/safeboxes", - latestAlphaHomoraV2GraphUrl: `https://api.thegraph.com/subgraphs/name/mintcnn/optimism`, + latestAlphaHomoraV2GraphUrl: sdk.graph.modifyEndpoint('B3g98fbbStVKtff6QUY6iMUqp7rxqrdDyGdrXAmcWG6B'), poolsJsonUrl: "https://api.homora.alphaventuredao.io/v2/10/pools", instances: [ ] }, avax: { safeBoxApi: "https://homora-api.alphafinance.io/v2/43114/safeboxes", - latestAlphaHomoraV2GraphUrl: `https://api.thegraph.com/subgraphs/name/alphafinancelab/alpha-homora-v2-avax`, + latestAlphaHomoraV2GraphUrl: sdk.graph.modifyEndpoint('8zVTsZBmd8CU7vnmonPr7qex4A69yM7NSzxKCpGHw6Q6'), poolsJsonUrl: "https://homora-api.alphafinance.io/v2/43114/pools", instances: [ { wMasterChefAddress: "0xb41de9c1f50697cc3fd63f24ede2b40f6269cbcb", wLiquidityGauge: "0xf1f32c8eeb06046d3cc3157b8f9f72b09d84ee5b", // wrong poolsJsonUrl: "https://homora-api.alphafinance.io/v2/43114/pools", - graphUrl: `https://api.thegraph.com/subgraphs/name/alphafinancelab/alpha-homora-v2-avax`, + graphUrl: sdk.graph.modifyEndpoint('8zVTsZBmd8CU7vnmonPr7qex4A69yM7NSzxKCpGHw6Q6'), }, ] }, fantom: { safeBoxApi: "https://homora-api.alphafinance.io/v2/250/safeboxes", - latestAlphaHomoraV2GraphUrl: `https://api.thegraph.com/subgraphs/name/alphafinancelab/alpha-homora-v2-fantom`, + latestAlphaHomoraV2GraphUrl: sdk.graph.modifyEndpoint('H4Q15YbQxRWw14HaABfWiTptSwRzanXNwyACY8MCRqVS'), poolsJsonUrl: "https://homora-api.alphafinance.io/v2/250/pools", instances: [ { wMasterChefAddress: "0x5FC20fCD1B50c5e1196ac790DADCfcDD416bb0C7", wLiquidityGauge: "0xf1f32c8eeb06046d3cc3157b8f9f72b09d84ee5b", // wrong poolsJsonUrl: "https://homora-api.alphafinance.io/v2/43114/pools", - graphUrl: `https://api.thegraph.com/subgraphs/name/alphafinancelab/alpha-homora-v2-fantom`, + graphUrl: sdk.graph.modifyEndpoint('H4Q15YbQxRWw14HaABfWiTptSwRzanXNwyACY8MCRqVS'), }, ] }, ethereum: { safeBoxApi: "https://homora-api.alphafinance.io/v2/1/safeboxes", coreOracleAddress: "0x6be987c6d72e25f02f6f061f94417d83a6aa13fc", - latestAlphaHomoraV2GraphUrl: `https://api.thegraph.com/subgraphs/name/hermioneeth/alpha-homora-v2-mainnet`, + latestAlphaHomoraV2GraphUrl: sdk.graph.modifyEndpoint('CnfAARjTUna6ZVo7RjJvQmm44e7uWx6kbaRm4Xh5MR5N'), instances: [ { // Current @@ -53,7 +53,7 @@ const chainParams = { wStakingRewardIndex: "0x011535fd795fd28c749363e080662d62fbb456a7", wStakingRewardPerp: "0xc4635854480fff80f742645da0310e9e59795c63", poolsJsonUrl: "https://homora-api.alphafinance.io/v2/1/pools", - graphUrl: `https://api.thegraph.com/subgraphs/name/hermioneeth/alpha-homora-v2-relaunch`, + graphUrl: sdk.graph.modifyEndpoint('37CbUUxwQC7uTqQquQXtQQF8b2bU7L3VBrkEntiHxf4r'), }, { // Legacy @@ -64,7 +64,7 @@ const chainParams = { wStakingRewardPerp: "0xc4635854480fff80f742645da0310e9e59795c63", poolsJsonUrl: "local", - graphUrl: `https://api.thegraph.com/subgraphs/name/hermioneeth/alpha-homora-v2-mainnet`, + graphUrl: sdk.graph.modifyEndpoint('CnfAARjTUna6ZVo7RjJvQmm44e7uWx6kbaRm4Xh5MR5N'), } ] } diff --git a/projects/alta-finance/index.js b/projects/alta-finance/index.js index 8a7a0128c0..ed7d6ec0e9 100644 --- a/projects/alta-finance/index.js +++ b/projects/alta-finance/index.js @@ -5,7 +5,7 @@ module.exports = { const config = { polygon: { investments: ['0xcf152E9f60E197A44FAdce961c6B822Dcb6c9dcc'], debts: [], token: ADDRESSES.polygon.USDC }, - base: { investments: ['0xF36d1AdDA798Ea9340069207806dcBB137d31212'], debts: [], token: ADDRESSES.base.USDC } + base: { investments: [], debts: [], token: ADDRESSES.base.USDC } } Object.keys(config).forEach(chain => { diff --git a/projects/ambient-finance/index.js b/projects/ambient-finance/index.js index 4ac8955c98..4739b3da09 100644 --- a/projects/ambient-finance/index.js +++ b/projects/ambient-finance/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { sumTokens2 } = require('../helper/unwrapLPs'); const { cachedGraphQuery, getConfig } = require("../helper/cache"); @@ -13,7 +14,7 @@ const subgraphs = { scroll: 'https://ambindexer.net/scroll-gcgo/pool_list?chainId=0x82750', blast: 'https://ambindexer.net/blast-gcgo/pool_list?chainId=0x13e31', canto: "https://ambient-graphcache.fly.dev/gcgo/pool_list?chainId=0x1e14", - ethereum: `https://api.thegraph.com/subgraphs/name/crocswap/croc-mainnet` + ethereum: sdk.graph.modifyEndpoint('DyHaLYK1keqcv3YD3VczKGYvxQGfGgV6bGTbZLMj5xME') } async function tvl(api) { diff --git a/projects/apex-omni/index.js b/projects/apex-omni/index.js new file mode 100644 index 0000000000..74ecad0c41 --- /dev/null +++ b/projects/apex-omni/index.js @@ -0,0 +1,31 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require('../helper/unwrapLPs'); + +const tokens = [ + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, +]; + +const walletAddresses = { + bsc: ['0xb8d9f005654b7b127b34dae8f973ba729ca3a2d9'], + ethereum: ['0x35D173cdfE4d484BC5985fDa55FABad5892c7B82'], + arbitrum: ['0x3169844a120c0f517b4eb4a750c08d8518c8466a'] + +}; + +const tokenAddress = { + bsc: [ADDRESSES.bsc.USDT], + arbitrum: [ADDRESSES.arbitrum.USDT], +} + +module.exports = { + ethereum: { + tvl: sumTokensExport({ owners: walletAddresses.ethereum, tokens }), + }, + bsc: { + tvl: sumTokensExport({ owners: walletAddresses.bsc, tokens: tokenAddress.bsc }), + }, + arbitrum: { + tvl: sumTokensExport({ owners: walletAddresses.arbitrum, tokens: tokenAddress.arbitrum }), + }, +}; \ No newline at end of file diff --git a/projects/arcadia-finance-v2/index.js b/projects/arcadia-finance-v2/index.js index 9cbaf0aebf..52ab1570d3 100644 --- a/projects/arcadia-finance-v2/index.js +++ b/projects/arcadia-finance-v2/index.js @@ -1,4 +1,4 @@ -const { sumTokens2 } = require('../helper/unwrapLPs') +const { sumTokens2, } = require("../helper/unwrapLPs"); const config = { base: { @@ -7,21 +7,62 @@ const config = { wethPool: "0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2", usdcPool: "0x3ec4a293Fb906DD2Cd440c20dECB250DeF141dF1", }, - uniNFT: '0x03a520b32c04bf3beef7beb72e919cf822ed34f1', - slipNFT: '0x827922686190790b37229fd06084350e74485b72' + uniNFT: "0x03a520b32c04bf3beef7beb72e919cf822ed34f1", + slipNFT: "0x827922686190790b37229fd06084350e74485b72", + wAeroNFT: "0x17B5826382e3a5257b829cF0546A08Bd77409270".toLowerCase(), + sAeroNFT: "0x9f42361B7602Df1A8Ae28Bf63E6cb1883CD44C27".toLowerCase(), }, +}; + +async function unwrapArcadiaAeroLP({ api, ownerIds, }) { + const { wAeroNFT, sAeroNFT } = config[api.chain] + const wAERONFTIds = [] + const sAERONFTIds = [] + + // for each asset address owned by an account + // check if the asset is the wrapped or staked aero asset module + // if so, fetch the amount of lp wrapped or staked + // create object with aerodrome v1 (=univ2) lp tokens + for (const ownerId of ownerIds) { + const [nftAddresses, ids] = ownerId; + for (let i = 0; i < nftAddresses.length; i++) { + const nftAddress = nftAddresses[i].toLowerCase() + switch (nftAddress) { + case wAeroNFT: + wAERONFTIds.push(ids[i]); + break; + case sAeroNFT: + sAERONFTIds.push(ids[i]); + break; + } + } + } + + const wrappedData = await api.multiCall({ abi: abi.wrappedAeroPositionState, calls: wAERONFTIds, target: wAeroNFT, }); + const stakedData = await api.multiCall({ abi: abi.stakedAeroPositionState, calls: sAERONFTIds, target: sAeroNFT, }); + wrappedData.forEach((data) => api.add(data.pool, data.amountWrapped)); + stakedData.forEach((data) => api.add(data.pool, data.amountStaked)); } async function tvl(api) { - let { factory, pools, uniNFT, slipNFT, } = config[api.chain]; + let { factory, pools, uniNFT, slipNFT, wAeroNFT, sAeroNFT } = + config[api.chain]; pools = Object.values(pools); - const uTokens = await api.multiCall({ abi: "address:asset", calls: pools }) - await api.sumTokens({ tokensAndOwners2: [uTokens, pools] }) + const uTokens = await api.multiCall({ abi: "address:asset", calls: pools }); + await api.sumTokens({ tokensAndOwners2: [uTokens, pools] }); const accounts = await api.fetchList({ lengthAbi: 'allAccountsLength', itemAbi: 'allAccounts', target: factory, }); const assetData = await api.multiCall({ abi: abi.assetData, calls: accounts, }); const ownerTokens = accounts.map((account, i) => [assetData[i].assets, account]) - await api.sumTokens({ ownerTokens, blacklistedTokens: [uniNFT, slipNFT] }) + const ownerIds = accounts.map((account, i) => [ + assetData[i][0], + assetData[i][1], + account, + ]); + await api.sumTokens({ ownerTokens, blacklistedTokens: [uniNFT, slipNFT, wAeroNFT, sAeroNFT], }); + + await unwrapArcadiaAeroLP({ api, ownerIds }); + return sumTokens2({ api, owners: accounts, resolveUniV3: true, resolveSlipstream: true }) } @@ -36,5 +77,10 @@ module.exports = { }; const abi = { - "assetData": "function generateAssetData() view returns (address[] assets, uint256[], uint256[])", -} \ No newline at end of file + assetData: + "function generateAssetData() view returns (address[] assets, uint256[], uint256[])", + wrappedAeroPositionState: + "function positionState(uint256 tokenId) view returns ((uint128 fee0PerLiquidity, uint128 fee1PerLiquidity, uint128 fee0, uint128 fee1, uint128 amountWrapped, address pool))", + stakedAeroPositionState: + "function positionState(uint256 tokenId) view returns ((address pool, uint128 amountStaked, uint128 lastRewardPerTokenPosition, uint128 lastRewardPosition))", +}; diff --git a/projects/arcana/index.js b/projects/arcana/index.js index cdcf40739f..e5705c741f 100644 --- a/projects/arcana/index.js +++ b/projects/arcana/index.js @@ -1,11 +1,9 @@ - module.exports = { misrepresentedTokens: true, real: { tvl } } async function tvl(api) { - const supply = await api.call({ abi: 'uint256:circulatingSupply', target: '0xaec9e50e3397f9ddc635c6c429c8c7eca418a143'}) - api.addCGToken('tether', supply/1e18) - + const supply = await api.call({ abi: 'uint256:circulatingSupply', target: '0xaec9e50e3397f9ddc635c6c429c8c7eca418a143' }) + api.addCGToken('tether', supply / 1e18) } \ No newline at end of file diff --git a/projects/ayin/index.js b/projects/ayin/index.js index dc66dfeb53..33c05f2320 100644 --- a/projects/ayin/index.js +++ b/projects/ayin/index.js @@ -5,9 +5,13 @@ const Addresses = { alphUsdtPool: '2A5R8KZQ3rhKYrW7bAS4JTjY9FCFLJg6HjQpqSFZBqACX', alphWethPool: 'yXMFxdoKcE86W9NAyajc8Z3T3k2f5FGiHqHtuA69DYT1', ayinUsdtPool: '21NEBCk8nj5JBKpS7eN8kX6xGJoLHNqTS3WBFnZ7q8L9m', + alphWbtcPool: '28XY326TxvSekaAwiWDLFg2QBRfacSga8dyNJCYGUYNbq', + usdtUsdcPool: '27C75V9K5o9CkkGTMDQZ3x2eP82xnacraEqTYXA35Xuw5', usdt: 'zSRgc7goAYUgYsEBYdAzogyyeKv3ne3uvWb3VDtxnaEK', weth: 'vP6XSUyjmgWCB2B9tD5Rqun56WJqDdExWnfwZVEqzhQb', - ayin: 'vT49PY8ksoUL6NcXiZ1t2wAmC7tTPRfFfER8n3UCLvXy' + ayin: 'vT49PY8ksoUL6NcXiZ1t2wAmC7tTPRfFfER8n3UCLvXy', + wbtc: 'xUTp3RXGJ1fJpCGqsAY6GgyfRQ3WQ1MdcYR1SiwndAbR', + usdc: '22Nb9JajRpAh9A2fWNgoKt867PA6zNyi541rtoraDfKXV' } const XAyinAddress = 'zst5zMzizEeFYFis6DNSknY5GCYTpM85D3yXeRLe2ug3' @@ -15,13 +19,15 @@ const XAyinAddress = 'zst5zMzizEeFYFis6DNSknY5GCYTpM85D3yXeRLe2ug3' const TokenIds = { usdt: alephium.contractIdFromAddress(Addresses.usdt), weth: alephium.contractIdFromAddress(Addresses.weth), - ayin: alephium.contractIdFromAddress(Addresses.ayin) + ayin: alephium.contractIdFromAddress(Addresses.ayin), + wbtc: alephium.contractIdFromAddress(Addresses.wbtc), + usdc: alephium.contractIdFromAddress(Addresses.usdc) } async function ayinTvlForXAyin() { const results = await alephium.contractMultiCall([ { group: 0, address: XAyinAddress, methodIndex: 3 }, - { group: 0, address: XAyinAddress, methodIndex: 11} + { group: 0, address: XAyinAddress, methodIndex: 11 } ]) const totalSupply = results[0].returns[0].value @@ -35,21 +41,24 @@ async function tvl() { ].map(poolAddress => alephium.getAlphBalance(poolAddress))) const alphTvl = alphTvls.reduce((tvl, res) => tvl + Number(res.balance), 0) const tokensTvls = await Promise.all([ - Addresses.alphAyinPool, Addresses.alphUsdtPool, Addresses.alphWethPool, Addresses.ayinUsdtPool + Addresses.alphAyinPool, Addresses.alphUsdtPool, Addresses.alphWethPool, Addresses.ayinUsdtPool, + Addresses.alphWbtcPool, Addresses.usdtUsdcPool ].map(poolAddress => alephium.getTokensBalance(poolAddress))) const tokensTvl = tokensTvls.reduce((res, tokenTvls) => { tokenTvls.forEach(tokenTvl => { - if (res[tokenTvl.tokenId] !== undefined) { - res[tokenTvl.tokenId] = Number(res[tokenTvl.tokenId]) + Number(tokenTvl.balance) - } + if (res[tokenTvl.tokenId] !== undefined) { + res[tokenTvl.tokenId] = Number(res[tokenTvl.tokenId]) + Number(tokenTvl.balance) + } }); return res - }, {[TokenIds.ayin]: 0, [TokenIds.usdt]: 0, [TokenIds.weth]: 0}) + }, { [TokenIds.ayin]: 0, [TokenIds.usdt]: 0, [TokenIds.weth]: 0, [TokenIds.wbtc]: 0, [TokenIds.usdc]: 0 }) return { - alephium: alphTvl / 1e18, + alephium: alphTvl / 1e18, ayin: tokensTvl[TokenIds.ayin] / 1e18, weth: tokensTvl[TokenIds.weth] / 1e18, - tether: tokensTvl[TokenIds.usdt] / 1e6 + tether: tokensTvl[TokenIds.usdt] / 1e6, + usdc: tokensTvl[TokenIds.usdc] / 1e6, + bitcoin: tokensTvl[TokenIds.wbtc] / 1e8 } } diff --git a/projects/banx/index.js b/projects/banx/index.js index 8bc4c0a7fa..02c5ddea41 100644 --- a/projects/banx/index.js +++ b/projects/banx/index.js @@ -22,7 +22,7 @@ async function getData() { bondOffers, bondTradeTxn, ] = await Promise.all([ - getFilteredAccounts(program, 'bondOfferV2', bondOfferOffset, [5, 7,]), + getFilteredAccounts(program, 'bondOfferV3', bondOfferOffset, [5, 7,]), getFilteredAccounts(program, 'bondTradeTransactionV3', bondTradeTxnOffset, [2, 6, 9]), ]) diff --git a/projects/beefy/index.js b/projects/beefy/index.js index 45d85b14ce..57cd2993ee 100644 --- a/projects/beefy/index.js +++ b/projects/beefy/index.js @@ -39,6 +39,7 @@ const chains = { fuse: 122, heco: 128, polygon: 137, + manta: 169, fantom: 250, fraxtal: 252, era: 324, diff --git a/projects/bit-reserve/index.js b/projects/bit-reserve/index.js index 10191c1208..580a2ea6a9 100644 --- a/projects/bit-reserve/index.js +++ b/projects/bit-reserve/index.js @@ -1,4 +1,4 @@ -const rBTC_CONTRACT = '0xBf4df43f72d27a7b1D2fC295aeca58e0853f922F'; +const rBTC_CONTRACT = '0x473286faD076c050FB48a449c77d7434d947cE00'; async function tvl(api) { const tokens = await api.fetchList({ lengthAbi: 'approvedTokens', itemAbi: 'approvedRestakedLSTs', target: rBTC_CONTRACT }) @@ -11,4 +11,4 @@ module.exports = { core: { tvl } -} \ No newline at end of file +} diff --git a/projects/bitflow/index.js b/projects/bitflow/index.js index e593034ac1..16de10f164 100644 --- a/projects/bitflow/index.js +++ b/projects/bitflow/index.js @@ -9,6 +9,8 @@ const PAIRS = [ `${BITFLOW_ADDRESS}.stableswap-abtc-xbtc-v-1-2`, `${BITFLOW_ADDRESS}.stableswap-aeusdc-susdt-v-1-2`, `${BITFLOW_ADDRESS}.stableswap-usda-aeusdc-v-1-2`, + `${BITFLOW_ADDRESS}.stableswap-usda-aeusdc-v-1-4`, + `SM1793C4R5PZ4NS4VQ4WMP7SKKYVH8JZEWSZ9HCCR.xyk-pool-stx-aeusdc-v-1-1`, ]; module.exports = { diff --git a/projects/bitlen/index.js b/projects/bitlen/index.js index 0dc80f0a05..418bdaf206 100644 --- a/projects/bitlen/index.js +++ b/projects/bitlen/index.js @@ -10,13 +10,14 @@ const CORE_POOL = '0xfE345fF60ACB262848FBf3Cb11bf5811c8293Aa9'; const COREBTC_POOL = '0x95fBbAf7Ad1DB1Ee6D1Ee2ea9ddca2cda23af832'; const CORE_USDT_POOL = '0xeC225F71C065E2abD06C5C69BF0FB06C857E46cB'; const CORE_USDC_POOL = '0x514C4876e239a248dD6d40F54491Cc1C7b2D044A'; +const CORE_ABTC_POOL = '0xeC81EBCEb627120FeF942e53587940277f764E93' const config = { bsquared: { pools: [WBTC_POOL, USDT_POOL, USDC_POOL,UBTC_POOL] }, core: { - pools: [CORE_POOL, COREBTC_POOL, CORE_USDT_POOL, CORE_USDC_POOL] + pools: [CORE_POOL, COREBTC_POOL, CORE_USDT_POOL, CORE_USDC_POOL, CORE_ABTC_POOL] } } diff --git a/projects/bitswap/index.js b/projects/bitswap/index.js deleted file mode 100644 index b3b7004b20..0000000000 --- a/projects/bitswap/index.js +++ /dev/null @@ -1,8 +0,0 @@ -const { getUniTVL } = require("../helper/unknownTokens") - -module.exports={ - misrepresentedTokens: true, - bitchain:{ - tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x357F77c780c3423d62c203B72383C77A58a92a4F' }), - }, -} \ No newline at end of file diff --git a/projects/bitu/index.js b/projects/bitu/index.js new file mode 100644 index 0000000000..1e7f88e794 --- /dev/null +++ b/projects/bitu/index.js @@ -0,0 +1,55 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { request, gql } = require("graphql-request"); +const BigNumber = require("bignumber.js"); +const { sumUnknownTokens } = require("../helper/unknownTokens"); + +const graphUrl = "https://api.studio.thegraph.com/query/70783/bitu-protocol/version/latest"; +const graphQuery = gql` + query GET_COLLAERTAL_ASSETS { + collateralAssets(first: 100) { + id + symbol + name + decimals + totalValueLocked + bituLiquidated + } + } +`; + +const USDT = ADDRESSES.bsc.USDT; + +module.exports = { + bsc: { + tvl: async (api) => { + const { collateralAssets } = await request(graphUrl, graphQuery); + + let liquidated = new BigNumber(0); + + for (const item of collateralAssets) { + if (item.id.toLocaleLowerCase() !== USDT.toLocaleLowerCase()) liquidated = liquidated.plus(item.bituLiquidated); + } + + const nativeToken = collateralAssets.find((p) => p.id === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"); + + const erc20Tokens = collateralAssets + .filter((p) => p.id !== "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") + .map((p) => { + if (p.id.toLocaleLowerCase() === USDT.toLocaleLowerCase()) { + p.totalValueLocked = liquidated.plus(p.totalValueLocked).multipliedBy(Math.pow(10, p.decimals)).toString(); + } else { + p.totalValueLocked = new BigNumber(p.totalValueLocked).multipliedBy(Math.pow(10, p.decimals)).toString(); + } + + return p; + }); + api.addTokens( + erc20Tokens.map((p) => p.id), + erc20Tokens.map((p) => p.totalValueLocked) + ); + if (nativeToken) { + api.add("coingecko:binancecoin", parseInt(nativeToken.totalValueLocked), { skipChain: true }); + } + }, + }, +}; diff --git a/projects/blastoff/index.js b/projects/blastoff/index.js index 82fc8af05e..3a253451e7 100644 --- a/projects/blastoff/index.js +++ b/projects/blastoff/index.js @@ -1,5 +1,6 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking') const LOCKED_STAKING = "0xd95773e5b1eedc7ff302a70acd0eb370927397d2"; const NONLOCK_STAKING = "0xd9747a98624f0B64B4412632C420672E16432334"; @@ -7,6 +8,7 @@ const NONLOCK_STAKING = "0xd9747a98624f0B64B4412632C420672E16432334"; module.exports = { blast: { tvl: sumTokensExport({ owners: [LOCKED_STAKING, NONLOCK_STAKING], tokens: [ADDRESSES.null, ADDRESSES.blast.USDB] }), + staking: staking('0xC9B6c67af496E92F64b1C136B3FaD15e3b02cbb4', '0xD55eDfc79c0d14084260D16f38BdA75e28AbFb6A') }, methodology: "counts the amount of USDB and ETH locked in 2 staking contracts", }; diff --git a/projects/bridgers-ai/index.js b/projects/bridgers-ai/index.js new file mode 100644 index 0000000000..69af52189a --- /dev/null +++ b/projects/bridgers-ai/index.js @@ -0,0 +1,183 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, sumTokensExport, } = require('../helper/sumTokens') + +const getBridgeContract = (chain) => { + switch (chain) { + case 'ethereum': + return '0x92e929d8b2c8430bcaf4cd87654789578bb2b786'; + case 'bsc': + return '0x1ed5685f345b2fa564ea4a670de1fde39e484751'; + case 'heco': + return '0xaeAE2CBb1E024E27e80cc61eE9A8B300282209B4'; + case 'okexchain': + return '0x37809F06F0Daf8f1614e8a31076C9bbEF4992Ff9'; + case 'polygon': + return '0x242Ea2A8C4a3377A738ed8a0d8cC0Fe8B4D6C36E'; + case 'fantom': + return '0x8f957ed3f969d7b6e5d6df81e61a5ff45f594dd1'; + case 'arbitrum': + return '0x8f957ed3f969d7b6e5d6df81e61a5ff45f594dd1'; + case 'tron': + return 'TEorZTZ5MHx8SrvsYs1R3Ds5WvY1pVoMSA'; + case 'solana': + return 'AL89We2CN1RdEJhUAtUs8ZhdQhkdECg6WX6qq7QntoWH'; + case 'base': + return '0xa18968cc31232724f1dbd0d1e8d0b323d89f3501'; + case 'sui': + return '0x5b64222ecff7e41abe28d48667fe81b13afa526d2490324080db9430f053052e'; + case 'aptos': + return '0x4512ba8a4862edcb20d5027a8d1b47129299d4bed9e41a8a727b78808d6faef4'; + case 'ton': + return 'EQBueUEMhTXyX4ugA_sJ-sCchXU29W9VIwW2hNIlDQkUE8xq'; + case 'era': + return '0x2042ecdc71f9ffb2eb9cda7f801eccc5c6c8b7eb'; + case 'linea': + return '0x8159891dfe9de7fc3bf1b665eb1adda60f2acd0e'; + case 'optimism': + return '0x8f957ed3f969d7b6e5d6df81e61a5ff45f594dd1'; + case 'avax': + return '0x8f957ed3f969d7b6e5d6df81e61a5ff45f594dd1'; + default: + throw new Error('Missing bridgers contract'); + } +} + +const tokensConf = { + ethereum: { + ETH: nullAddress, + BUSD: ADDRESSES.ethereum.BUSD, + USDC: ADDRESSES.ethereum.USDC, + USDT: ADDRESSES.ethereum.USDT, + DAI: ADDRESSES.ethereum.DAI, + WBTC: ADDRESSES.ethereum.WBTC, + WETH: ADDRESSES.ethereum.WETH, + AAVE: ADDRESSES.ethereum.AAVE, + // SWFTC: "0x0bb217e40f8a5cb79adf04e1aab60e5abd0dfc1e", + HT: "0x6f259637dcd74c767781e37bc6133cd6a68aa161", + PEPE: "0x6982508145454Ce325dDbE47a25d4ec3d2311933", + WLD: "0x163f8C2467924be0ae7B5347228CABF260318753", + }, + bsc: { + BNB: nullAddress, + BUSD: ADDRESSES.bsc.BUSD, + USDC: ADDRESSES.bsc.USDC, + USDT: ADDRESSES.bsc.USDT, + DAI: "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3", + WBNB: ADDRESSES.bsc.WBNB, + BTCB: ADDRESSES.bsc.BTCB, + ETH: ADDRESSES.bsc.ETH, + // SWFTC: "0xe64e30276c2f826febd3784958d6da7b55dfbad3", + DOGE: "0xba2ae424d960c26247dd6c32edc70b295c744c43", + }, + /*heco: { + HT: nullAddress, + USDC: ADDRESSES.heco.USDC_HECO, + USDT: ADDRESSES.heco.USDT, + HUSD: "0x0298c2b32eae4da002a15f36fdf7615bea3da047", + ETH: "0x64ff637fb478863b7468bc97d30a5bf3a428a1fd", + // SWFTC: "0x329dda64Cbc4DFD5FA5072b447B3941CE054ebb3", + },*/ + okexchain: { + OKT: nullAddress, + USDC: ADDRESSES.okexchain.USDC, + USDT: ADDRESSES.okexchain.USDT, + ETH: ADDRESSES.okexchain.ETHK, + OKB: ADDRESSES.okexchain.OKB, + }, + polygon: { + MATIC: nullAddress, + USDC: ADDRESSES.polygon.USDC, + USDT: ADDRESSES.polygon.USDT, + WMATIC: ADDRESSES.polygon.WMATIC_2, + DAI: ADDRESSES.polygon.DAI, + }, + fantom: { + FTM: nullAddress, + USDC: ADDRESSES.fantom.USDC, + USDT: ADDRESSES.fantom.fUSDT, + DAI: ADDRESSES.fantom.DAI, + WETH: "0x74b23882a30290451A17c44f4F05243b6b58C76d", + }, + arbitrum: { + ETH: nullAddress, + ARB: ADDRESSES.arbitrum.ARB, + USDC_CIRCLE: ADDRESSES.arbitrum.USDC_CIRCLE, + USDC: ADDRESSES.arbitrum.USDC, + USDT: ADDRESSES.arbitrum.USDT, + }, + tron: { + TRX: nullAddress, + USDT: ADDRESSES.tron.USDT, + USDC: ADDRESSES.tron.USDC, + USDD: ADDRESSES.tron.USDD, + BUSD: ADDRESSES.tron.BUSD, + TUSD: ADDRESSES.tron.TUSD, + USDJ: ADDRESSES.tron.USDJ, + BTT: ADDRESSES.tron.BTT, + JST: ADDRESSES.tron.JST, + }, + solana: { + SOL: ADDRESSES.solana.SOL, + USDT: ADDRESSES.solana.USDT, + USDC: ADDRESSES.solana.USDC, + BONK: ADDRESSES.solana.BONK, + }, + base: { + ETH: nullAddress, + WETH: ADDRESSES.base.WETH, + USDT: ADDRESSES.base.USDbC, + USDC: ADDRESSES.base.USDC, + }, + sui: { + SUI: ADDRESSES.sui.SUI, + USDT: ADDRESSES.sui.USDT, + USDC: ADDRESSES.sui.USDC, + // SSWP: '0x361dd589b98e8fcda9a7ee53b85efabef3569d00416640d2faa516e3801d7ffc::TOKEN::TOKEN', + }, + aptos: { + APT: ADDRESSES.aptos.APT, + }, + ton: { + TON: ADDRESSES.ton.TON, + USDT: ADDRESSES.ton.USDT, + USDC: ADDRESSES.ton.USDC, + NOT: 'EQAvlWFDxGF2lXm67y4yzC17wYKD9A0guwPkMs1gOsM__NOT', + }, + era: { + ETH: nullAddress, + USDT: ADDRESSES.era.USDT, + USDC: ADDRESSES.era.USDC, + }, + linea: { + ETH: nullAddress, + USDT: ADDRESSES.linea.USDT, + USDC: ADDRESSES.linea.USDC, + }, + optimism: { + ETH: nullAddress, + OP: ADDRESSES.optimism.OP, + USDC_CIRCLE: ADDRESSES.optimism.USDC_CIRCLE, + USDT: ADDRESSES.optimism.USDT, + USDC: ADDRESSES.optimism.USDC, + }, + avax: { + AVAX: nullAddress, + USDt: ADDRESSES.avax.USDt, + USDC: ADDRESSES.avax.USDC, + USDT_e: ADDRESSES.avax.USDT_e, + USDC_e: ADDRESSES.avax.USDC_e, + DAI: ADDRESSES.avax.DAI, + ETH: '0xf20d962a6c8f70c731bd838a3a388d7d48fa6e15', + }, +}; + +module.exports = { + methodology: "Assets staked in the pool and trading contracts", +} +for (const network of Object.keys(tokensConf)) { + const owner = getBridgeContract(network) + const tokens = Object.values(tokensConf[network]) + module.exports[network] = { + tvl: sumTokensExport({ owner, tokens }), + }; +} diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js index 3e1f1899d5..040f879c68 100644 --- a/projects/bucket-protocol/index.js +++ b/projects/bucket-protocol/index.js @@ -50,6 +50,34 @@ 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 scallop_sUSDC_LP_ID = + "0x7b16192d63e6fa111b0dac03f99c5ff965205455089f846804c10b10be55983c"; + +const scallop_sUSDT_LP_ID = + "0x6b68b42cbb4efccd9df30466c21fff3c090279992c005c45154bd1a0d87ac725"; + +async function getStakingLPAmount(id) { + const stakingLPObject = await sui.getObject(id); + return stakingLPObject.fields.output_volume; +} + +async function getScallopsLPAmount(id) { + const stakingLPObject = await sui.getObject(id); + return stakingLPObject.fields.coin_balance; +} + async function tvl(api) { const protocolFields = await sui.getDynamicFieldObjects({ parent: MAINNET_PROTOCOL_ID, @@ -184,6 +212,37 @@ async function tvl(api) { `0x${afsuiSuiTokenNames[1]}`, 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 scallopUSDC_LPAmount = await getScallopsLPAmount(scallop_sUSDC_LP_ID); + api.add(USDC, scallopUSDC_LPAmount); + + const scallopUSDT_LPAmount = await getScallopsLPAmount(scallop_sUSDT_LP_ID); + api.add(USDT, scallopUSDT_LPAmount); } module.exports = { diff --git a/projects/camelot-v2/index.js b/projects/camelot-v2/index.js index 736a4682aa..6fea9e552a 100644 --- a/projects/camelot-v2/index.js +++ b/projects/camelot-v2/index.js @@ -10,4 +10,17 @@ const export2 = uniV3Export({ arbitrum: { factory: '0x1a3c9B1d2F0529D97f2afC5136Cc23e58f1FD35B', fromBlock: 75633510, isAlgebra: true, }, }) -module.exports = mergeExports([export1, export2]); \ No newline at end of file +const export3 = uniV3Export({ + sanko: { factory: '0xcF8d0723e69c6215523253a190eB9Bc3f68E0FFa', fromBlock: 51, isAlgebra: true} +}) + +const export4 = uniV3Export({ + xai: { factory: '0xD8676fBdfa5b56BB2298D452c9768f51e80e34AE', fromBlock: 2398999, isAlgebra: true} +}) + +const export5 = uniV3Export({ + rari: { factory: '0xcF8d0723e69c6215523253a190eB9Bc3f68E0FFa', fromBlock: 340548, isAlgebra: true} +}) + + +module.exports = mergeExports([export1, export2, export3, export4, export5]); \ No newline at end of file diff --git a/projects/camelot/index.js b/projects/camelot/index.js index 060254dd45..87e43be12c 100644 --- a/projects/camelot/index.js +++ b/projects/camelot/index.js @@ -6,4 +6,13 @@ module.exports = { arbitrum: { tvl: getUniTVL({ factory: '0x6EcCab422D763aC031210895C81787E87B43A652', useDefaultCoreAssets: true,}), }, + sanko: { + tvl: getUniTVL({factory: '0x7d8c6B58BA2d40FC6E34C25f9A488067Fe0D2dB4', useDefaultCoreAssets: true}) + }, + xai: { + tvl: getUniTVL({factory: '0x18E621B64d7808c3C47bccbbD7485d23F257D26f', useDefaultCoreAssets: true}) + }, + rari: { + tvl: getUniTVL({factory: '0x7d8c6B58BA2d40FC6E34C25f9A488067Fe0D2dB4', useDefaultCoreAssets: true}) + } }; \ No newline at end of file diff --git a/projects/chaingpt/index.js b/projects/chaingpt/index.js index c0df864050..fab8d065e0 100644 --- a/projects/chaingpt/index.js +++ b/projects/chaingpt/index.js @@ -8,57 +8,89 @@ const stakingpool2 = "0x62A402DEf6Ca37E9CA7a544bE34954748088CCEE"; const stakingpool3 = "0x6eE8D743Eb8bEc665AaCdb535f2F100f040Ca6C5"; const config = { - ethereum: { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 17003869 }, - polygon: { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 45136100 }, - bsc: { factory: '0xc263365D628568C23d61BDDa24C8EB27CEF4E917', fromBlock: 30004999 }, - arbitrum: { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 111699000 }, - avax: { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 32665049 } + ethereum: [ + { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 17003869 }, + { factory: '0xa433b2748d718108323316f460F449453C36420E', fromBlock: 19003869 }, + ], + polygon: [ + { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 45136100 }, + { factory: '0x9A6f649e421398eeab450b164D9b81Cc4A55A0eA', fromBlock: 57562100 }, + ], + bsc: [ + { factory: '0xc263365D628568C23d61BDDa24C8EB27CEF4E917', fromBlock: 30004999 }, + { factory: '0x5fC22396a063cabb5E09BA6ba449C9646155Ed3f', fromBlock: 39171504 }, + ], + arbitrum: [ + { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 111699000 }, + { factory: '0xFB5cd8426FBC3b1f2ea4B113A5A37752B3098C79', fromBlock: 216556000 }, + ], + avax: [ + { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 32665049 }, + { factory: '0x2D47310bB0C6A9D4ae2a1d6625eC0BEe4F473Bb6', fromBlock: 46082883 }, + ], + core: [ + { factory: '0x9840652DC04fb9db2C43853633f0F62BE6f00f98', fromBlock: 15191500 }, + ], + base: [ + { factory: '0xFB5cd8426FBC3b1f2ea4B113A5A37752B3098C79', fromBlock: 15137100 }, + ], + xlayer: [ + { factory: '0x9840652DC04fb9db2C43853633f0F62BE6f00f98', fromBlock: 2353300 }, + ], + linea: [ + { factory: '0xFB5cd8426FBC3b1f2ea4B113A5A37752B3098C79', fromBlock: 5006600 }, + ], + era: [ + { factory: '0xf25F7c9522cdCD839697F1644CFCA1312306885C', fromBlock: 37458600 }, + ] } async function tvl(api) { - const { factory, fromBlock } = config[api.chain] - - const logs2 = await getLogs({ - api, - target: factory, - eventAbi: 'event PresalePoolCreated (address registedBy, address indexed token, address indexed pool, uint256 poolId)', - fromBlock: fromBlock, - - }) - const pools = [] - const poolFromBlocks = {} - logs2.forEach((i) => { - pools.push(i.args.pool) - poolFromBlocks[i.args.pool] = i.blockNumber - }) - + const chainConfigs = config[api.chain] const ownerTokens = [] const poolTokenMapping = {} - await PromisePool - .withConcurrency(7) - .for(pools) - .process(async pool => { - const fromBlock = poolFromBlocks[pool] - if (!fromBlock) return; - const logs = await getLogs({ - api, - target: pool, - eventAbi: 'event PresalePoolCreated (address token, uint256 openTime, uint256 closeTime, address offeredCurrency, uint256 offeredCurrencyDecimals, uint256 offeredCurrencyRate, address wallet, address owner)', - fromBlock, - }) - logs.forEach(({ args: i }) => { - const key = i.token + '-' + i.owner - if (!poolTokenMapping[key]) poolTokenMapping[key] = [] - poolTokenMapping[key].push(i.offeredCurrency) - }) + for (const chainConfig of chainConfigs) { + const { factory, fromBlock } = chainConfig + + const logs2 = await getLogs({ + api, + target: factory, + eventAbi: 'event PresalePoolCreated (address registedBy, address indexed token, address indexed pool, uint256 poolId)', + fromBlock: fromBlock, + + }) + const pools = [] + const poolFromBlocks = {} + logs2.forEach((i) => { + pools.push(i.args.pool) + poolFromBlocks[i.args.pool] = i.blockNumber }) + await PromisePool + .withConcurrency(7) + .for(pools) + .process(async pool => { + const fromBlock = poolFromBlocks[pool] + if (!fromBlock) return; + const logs = await getLogs({ + api, + target: pool, + eventAbi: 'event PresalePoolCreated (address token, uint256 openTime, uint256 closeTime, address offeredCurrency, uint256 offeredCurrencyDecimals, uint256 offeredCurrencyRate, address wallet, address owner)', + fromBlock, + }) + logs.forEach(({ args: i }) => { + const key = i.token + '-' + i.owner + if (!poolTokenMapping[key]) poolTokenMapping[key] = [] + poolTokenMapping[key].push(i.offeredCurrency) + }) + }) - logs2.forEach(({ args: i }) => { - const key = i.token + '-' + i.registedBy - if (!poolTokenMapping[key]) return; + logs2.forEach(({ args: i }) => { + const key = i.token + '-' + i.registedBy + if (!poolTokenMapping[key]) return; - ownerTokens.push([poolTokenMapping[key], i.pool]) - }) + ownerTokens.push([poolTokenMapping[key], i.pool]) + }) + } return api.sumTokens({ ownerTokens }) } diff --git a/projects/chiliz-governance-staking/index.js b/projects/chiliz-governance-staking/index.js new file mode 100644 index 0000000000..02b9552918 --- /dev/null +++ b/projects/chiliz-governance-staking/index.js @@ -0,0 +1,9 @@ +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); +const STAKING_CONTRACT = '0x0000000000000000000000000000000000001000'; + +module.exports = { + methodology: 'Total CHZ Locked in Staking System Contract.', + chz: { + tvl: sumTokensExport({ owner: STAKING_CONTRACT, tokens: [nullAddress] }), + } +} \ No newline at end of file diff --git a/projects/cian-lst/index.js b/projects/cian-lst/index.js index 426b6bedf8..aba79f5118 100644 --- a/projects/cian-lst/index.js +++ b/projects/cian-lst/index.js @@ -1,23 +1,25 @@ const config = { ethereum: [ - '0xcDd374F491fBF3f4FcF6E9023c99043774005137', - '0xB8c0c50D255B93f5276549cbA7F4bf78751A5D34', - '0x88508306E43FCe43F7f2c1e7D73c88cf6a523f6C', + "0xcDd374F491fBF3f4FcF6E9023c99043774005137", + "0xB8c0c50D255B93f5276549cbA7F4bf78751A5D34", + "0x88508306E43FCe43F7f2c1e7D73c88cf6a523f6C", + "0xD34f59E172cF3915f56C96A3037Ac554A7399D77", ], - optimism: ['0x907883da917ca9750ad202ff6395C4C6aB14e60E'], - bsc: ['0xEa5f10A0E612316A47123D818E2b597437D19a17'], - arbitrum: ['0xE946Dd7d03F6F5C440F68c84808Ca88d26475FC5'], - base: ['0x9B2316cfe980515de7430F1c4E831B89a5921137'], -} + optimism: ["0x907883da917ca9750ad202ff6395C4C6aB14e60E"], + bsc: ["0xEa5f10A0E612316A47123D818E2b597437D19a17"], + arbitrum: ["0xE946Dd7d03F6F5C440F68c84808Ca88d26475FC5", "0xED5f727107BdAC99443bAE317E0eF38239719e87"], + base: ["0x9B2316cfe980515de7430F1c4E831B89a5921137"], + scroll: ["0xEa5f10A0E612316A47123D818E2b597437D19a17"], +}; module.exports = { doublecounted: true, }; -Object.keys(config).forEach(chain => { +Object.keys(config).forEach((chain) => { module.exports[chain] = { tvl: async (api) => { - return api.erc4626Sum({ calls: config[chain], isOG4626: true }) - } - } -}) + return api.erc4626Sum({ calls: config[chain], isOG4626: true }); + }, + }; +}); diff --git a/projects/compound-v3/index.js b/projects/compound-v3/index.js index 7932a5dde4..7735d0402b 100644 --- a/projects/compound-v3/index.js +++ b/projects/compound-v3/index.js @@ -11,6 +11,7 @@ module.exports = compoundV3Exports({ markets: [ '0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA', // USDC.e Market '0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf', // USDC Market + '0x6f7D514bbD4aFf3BcD1140B7344b32f063dEe486', // WETH Market ], }, polygon: { @@ -27,6 +28,9 @@ module.exports = compoundV3Exports({ markets: ['0xB2f97c1Bd3bf02f5e74d13f02E3e26F93D77CE44'], // USDC Market }, optimism: { - markets: ['0x2e44e174f7D53F0212823acC11C01A11d58c5bCB'], // USDC Matket + markets: [ + '0x2e44e174f7D53F0212823acC11C01A11d58c5bCB', // USDC Market + '0x995E394b8B2437aC8Ce61Ee0bC610D617962B214', // USDT Market + ], } }) diff --git a/projects/concentrator/abis/AladdinRUSD.json b/projects/concentrator/abis/AladdinRUSD.json new file mode 100644 index 0000000000..cdfb2cd32c --- /dev/null +++ b/projects/concentrator/abis/AladdinRUSD.json @@ -0,0 +1,3 @@ +{ + "getTotalAssets": "uint256:getTotalAssets" +} diff --git a/projects/concentrator/index.js b/projects/concentrator/index.js index 47e722850c..10500adb55 100644 --- a/projects/concentrator/index.js +++ b/projects/concentrator/index.js @@ -1,61 +1,77 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require("../helper/coreAssets.json"); const sdk = require("@defillama/sdk"); -const abi = require('./abis/abi.json') +const abi = require("./abis/abi.json"); const { default: BigNumber } = require("bignumber.js"); -const AladdinConvexVaultABI = require('./abis/AladdinConvexVault.json') -const AladdinCRVABI = require('./abis/AladdinCRV.json') -const AladdinAFXSABI = require('./abis/AladdinAFXS.json') -const AladdinCVXABI = require('./abis/AladdinCVX.json') -const AladdinSdCRVABI = require('./abis/AladdinSdCRV.json') -const { farmConfig } = require('./config.js'); +const AladdinConvexVaultABI = require("./abis/AladdinConvexVault.json"); +const AladdinCRVABI = require("./abis/AladdinCRV.json"); +const AladdinAFXSABI = require("./abis/AladdinAFXS.json"); +const AladdinCVXABI = require("./abis/AladdinCVX.json"); +const AladdinSdCRVABI = require("./abis/AladdinSdCRV.json"); +const AladdinRUSDABI = require("./abis/AladdinRUSD.json"); +const { farmConfig } = require("./config.js"); - -const concentratorVault = '0xc8fF37F7d057dF1BB9Ad681b53Fa4726f268E0e8'; -const concentratorAcrv = '0x2b95A1Dcc3D405535f9ed33c219ab38E8d7e0884'; -const concentratorAFXS = '0xDAF03D70Fe637b91bA6E521A32E1Fb39256d3EC9'; +const concentratorVault = "0xc8fF37F7d057dF1BB9Ad681b53Fa4726f268E0e8"; +const concentratorAcrv = "0x2b95A1Dcc3D405535f9ed33c219ab38E8d7e0884"; +const concentratorAFXS = "0xDAF03D70Fe637b91bA6E521A32E1Fb39256d3EC9"; const concentratorAFrxETH = "0xb15Ad6113264094Fd9BF2238729410A07EBE5ABa"; const cvxcrvAddress = ADDRESSES.ethereum.cvxCRV; -const concentratorAbcCVXAddress = '0xDEC800C2b17c9673570FDF54450dc1bd79c8E359'; -const concentratorAsdCRVAddress = "0x43E54C2E7b3e294De3A155785F52AB49d87B9922" +const concentratorAbcCVXAddress = "0xDEC800C2b17c9673570FDF54450dc1bd79c8E359"; +const concentratorAsdCRVAddress = "0x43E54C2E7b3e294De3A155785F52AB49d87B9922"; const aladdinCVXAddress = "0xb0903Ab70a7467eE5756074b31ac88aEBb8fB777"; +const arUSDAddress = "0x549716F858aefF9CB845d4C78c67A7599B0Df240"; +const arUSD4626Address = "0x07D1718fF05a8C53C8F05aDAEd57C0d672945f9a"; +const rUSDAddress = "0x65D72AA8DA931F047169112fcf34f52DbaAE7D18"; -const concentratorNewVault = '0x3Cf54F3A1969be9916DAD548f3C084331C4450b5'; -const concentratorAfxsVault = '0xD6E3BB7b1D6Fa75A71d48CFB10096d59ABbf99E1'; -const concentratorAfrxETHVault = '0x50B47c4A642231dbe0B411a0B2FBC1EBD129346D'; +const concentratorNewVault = "0x3Cf54F3A1969be9916DAD548f3C084331C4450b5"; +const concentratorAfxsVault = "0xD6E3BB7b1D6Fa75A71d48CFB10096d59ABbf99E1"; +const concentratorAfrxETHVault = "0x50B47c4A642231dbe0B411a0B2FBC1EBD129346D"; const concentratorAsdCRVVault = "0x59866EC5650e9BA00c51f6D681762b48b0AdA3de"; const usdtAddress = ADDRESSES.ethereum.USDT; -const aladdinBalancerLPGauge = '0x33e411ebE366D72d058F3eF22F1D0Cf8077fDaB0'; -const clevCVXAddress = "0xf05e58fCeA29ab4dA01A495140B349F8410Ba904" -const clevCVXCVXAddress = "0xF9078Fb962A7D13F55d40d49C8AA6472aBD1A5a6" -const sdCRVAddress = '0xD1b5651E55D4CeeD36251c61c50C889B36F6abB5' +const aladdinBalancerLPGauge = "0x33e411ebE366D72d058F3eF22F1D0Cf8077fDaB0"; +const clevCVXAddress = "0xf05e58fCeA29ab4dA01A495140B349F8410Ba904"; +const clevCVXCVXAddress = "0xF9078Fb962A7D13F55d40d49C8AA6472aBD1A5a6"; +const sdCRVAddress = "0xD1b5651E55D4CeeD36251c61c50C889B36F6abB5"; const cvxAddress = ADDRESSES.ethereum.CVX; -const chain = 'ethereum'; +const chain = "ethereum"; async function getBalancerLpTvl(balances, block) { - const ctrLpTotalSupply = (await sdk.api.abi.call({ - target: aladdinBalancerLPGauge, - block, - abi: 'erc20:totalSupply', - params: [] - })).output; - sdk.util.sumSingleBalance(balances, usdtAddress, (BigNumber(ctrLpTotalSupply).shiftedBy(-12)).toFixed(0)) + const ctrLpTotalSupply = ( + await sdk.api.abi.call({ + target: aladdinBalancerLPGauge, + block, + abi: "erc20:totalSupply", + params: [], + }) + ).output; + sdk.util.sumSingleBalance( + balances, + usdtAddress, + BigNumber(ctrLpTotalSupply).shiftedBy(-12).toFixed(0) + ); } async function getFarmLpTvl(balances, block) { - const farmData = farmConfig[0] - const ctrLpTotalSupply = (await sdk.api.abi.call({ - target: farmData.addresses.gauge, - block, - abi: 'erc20:totalSupply', - params: [] - })).output; - sdk.util.sumSingleBalance(balances, farmData.addresses.lpToken, ctrLpTotalSupply, chain) + const farmData = farmConfig[0]; + const ctrLpTotalSupply = ( + await sdk.api.abi.call({ + target: farmData.addresses.gauge, + block, + abi: "erc20:totalSupply", + params: [], + }) + ).output; + sdk.util.sumSingleBalance( + balances, + farmData.addresses.lpToken, + ctrLpTotalSupply, + chain + ); } async function tvl(api) { - const block = api.block - let balances = {} + const block = api.block; + let balances = {}; await Promise.all([ getBalancerLpTvl(balances, block), getFarmLpTvl(balances, block), @@ -64,39 +80,44 @@ async function tvl(api) { getAbcCVXInfo(balances, block), getAsdCRVInfo(balances, block), getAladdinCVXInfo(balances, block), - getVaultInfo('old', balances, block), - getVaultInfo('New', balances, block), - getVaultInfo('afxs', balances, block), - getVaultInfo('afrxETH', balances, block), + getAladdinRUSDInfo(balances, block), + getVaultInfo("old", balances, block), + getVaultInfo("New", balances, block), + getVaultInfo("afxs", balances, block), + getVaultInfo("afrxETH", balances, block), getVaultInfo("asdCRV", balances, block), addACRVbalance(balances, api), - ]) - return balances + ]); + return balances; } async function addACRVbalance(balances, api) { const acrvTotalUnderlying = await api.call({ target: concentratorAcrv, abi: AladdinCRVABI.totalUnderlying, - }) - sdk.util.sumSingleBalance(balances, cvxcrvAddress, acrvTotalUnderlying, api.chain) - + }); + sdk.util.sumSingleBalance( + balances, + cvxcrvAddress, + acrvTotalUnderlying, + api.chain + ); } async function getVaultInfo(type, balances, block) { let _target = concentratorVault; let _abi = AladdinConvexVaultABI.poolInfo; switch (type) { - case 'old': + case "old": _target = concentratorVault; break; - case 'New': + case "New": _target = concentratorNewVault; break; - case 'afxs': + case "afxs": _target = concentratorAfxsVault; break; - case 'afrxETH': + case "afrxETH": _target = concentratorAfrxETHVault; _abi = AladdinConvexVaultABI.afraxETHPoolInfo; break; @@ -105,63 +126,114 @@ async function getVaultInfo(type, balances, block) { _abi = AladdinConvexVaultABI.asdCRVPoolInfo; break; } - let poolInfo = await sdk.api2.abi.fetchList({ chain, block, lengthAbi: abi.poolLength, itemAbi: _abi, target: _target }) + let poolInfo = await sdk.api2.abi.fetchList({ + chain, + block, + lengthAbi: abi.poolLength, + itemAbi: _abi, + target: _target, + }); poolInfo.forEach((item) => { - if (type == 'afrxETH' || type == 'asdCRV') { - sdk.util.sumSingleBalance(balances, item.strategy.token, item.supply.totalUnderlying, chain) + if (type == "afrxETH" || type == "asdCRV") { + sdk.util.sumSingleBalance( + balances, + item.strategy.token, + item.supply.totalUnderlying, + chain + ); } else { - sdk.util.sumSingleBalance(balances, item.lpToken, item.totalUnderlying, chain) + sdk.util.sumSingleBalance( + balances, + item.lpToken, + item.totalUnderlying, + chain + ); } - }) + }); } async function getAFXSInfo(balances, block) { const cvxfxsCrvInfo = { - lpToken: '0xF3A43307DcAFa93275993862Aae628fCB50dC768' - } - const aFXSTotalUnderlying = (await sdk.api.abi.call({ - target: concentratorAFXS, - block, - abi: AladdinAFXSABI.totalAssets, - })).output; + lpToken: "0xF3A43307DcAFa93275993862Aae628fCB50dC768", + }; + const aFXSTotalUnderlying = ( + await sdk.api.abi.call({ + target: concentratorAFXS, + block, + abi: AladdinAFXSABI.totalAssets, + }) + ).output; - sdk.util.sumSingleBalance(balances, cvxfxsCrvInfo.lpToken, aFXSTotalUnderlying, chain) + sdk.util.sumSingleBalance( + balances, + cvxfxsCrvInfo.lpToken, + aFXSTotalUnderlying, + chain + ); } async function getAfrxETHInfo(balances, block) { const ethFrxETHCrvInfo = { - lpToken: '0xf43211935C781D5ca1a41d2041F397B8A7366C7A' - } - const aFrxETHTotalUnderlying = (await sdk.api.abi.call({ - target: concentratorAFrxETH, - block, - abi: AladdinAFXSABI.totalAssets, - })).output; - sdk.util.sumSingleBalance(balances, ethFrxETHCrvInfo.lpToken, aFrxETHTotalUnderlying, chain) + lpToken: "0xf43211935C781D5ca1a41d2041F397B8A7366C7A", + }; + const aFrxETHTotalUnderlying = ( + await sdk.api.abi.call({ + target: concentratorAFrxETH, + block, + abi: AladdinAFXSABI.totalAssets, + }) + ).output; + sdk.util.sumSingleBalance( + balances, + ethFrxETHCrvInfo.lpToken, + aFrxETHTotalUnderlying, + chain + ); } async function getAbcCVXInfo(balances, block) { - const totalClevCVXAmount = (await sdk.api.abi.call({ - target: concentratorAbcCVXAddress, - block, - abi: AladdinCVXABI.totalDebtToken, - })).output; - const totalCurveLpTokenAmount = (await sdk.api.abi.call({ - target: concentratorAbcCVXAddress, - block, - abi: AladdinCVXABI.totalCurveLpToken, - })).output; - sdk.util.sumSingleBalance(balances, clevCVXAddress, totalClevCVXAmount, chain) - sdk.util.sumSingleBalance(balances, clevCVXCVXAddress, totalCurveLpTokenAmount, chain) + const totalClevCVXAmount = ( + await sdk.api.abi.call({ + target: concentratorAbcCVXAddress, + block, + abi: AladdinCVXABI.totalDebtToken, + }) + ).output; + const totalCurveLpTokenAmount = ( + await sdk.api.abi.call({ + target: concentratorAbcCVXAddress, + block, + abi: AladdinCVXABI.totalCurveLpToken, + }) + ).output; + sdk.util.sumSingleBalance( + balances, + clevCVXAddress, + totalClevCVXAmount, + chain + ); + sdk.util.sumSingleBalance( + balances, + clevCVXCVXAddress, + totalCurveLpTokenAmount, + chain + ); } async function getAsdCRVInfo(balances, block) { - const asdCRVTotalUnderlying = (await sdk.api.abi.call({ - target: concentratorAsdCRVAddress, - block, - abi: AladdinSdCRVABI.totalAssets, - })).output; - sdk.util.sumSingleBalance(balances, sdCRVAddress, asdCRVTotalUnderlying, chain) + const asdCRVTotalUnderlying = ( + await sdk.api.abi.call({ + target: concentratorAsdCRVAddress, + block, + abi: AladdinSdCRVABI.totalAssets, + }) + ).output; + sdk.util.sumSingleBalance( + balances, + sdCRVAddress, + asdCRVTotalUnderlying, + chain + ); } async function getAladdinCVXInfo(balances, block) { @@ -180,9 +252,25 @@ async function getAladdinCVXInfo(balances, block) { ); } +async function getAladdinRUSDInfo(balances, block) { + const aladdinRUSDTotalUnderlying = ( + await sdk.api.abi.call({ + target: arUSDAddress, + block, + abi: AladdinRUSDABI.getTotalAssets, + }) + ).output; + sdk.util.sumSingleBalance( + balances, + rUSDAddress, + aladdinRUSDTotalUnderlying, + chain + ); +} + module.exports = { doublecounted: true, ethereum: { - tvl - } -} \ No newline at end of file + tvl, + }, +}; diff --git a/projects/credbull/index.js b/projects/credbull/index.js index 963e7702c7..aeeb7c6c6b 100644 --- a/projects/credbull/index.js +++ b/projects/credbull/index.js @@ -20,4 +20,5 @@ async function borrowed(api) { module.exports = { methodology: 'TVL consist of the sum of every deposit of all vaults for a given asset.', btr: { tvl, borrowed, }, + arbitrum: { tvl, borrowed }, }; diff --git a/projects/deribit/index.js b/projects/deribit/index.js index 0cc893762a..eb71c2aab7 100644 --- a/projects/deribit/index.js +++ b/projects/deribit/index.js @@ -12,6 +12,11 @@ const config = { "1MdrdcEzfiJdvs6eVSwUx6bWboPX8if5U3", "35WHp4Hid61peyH4tuhNunwRj2gtNB41Lo", "34ZHV8dd6uucEUABUydWpKi6F4qKQntEUf", + //added on the 26/06/2024 + "bc1qzwhw94uldd3c8736lsxrda6t6x56030f8zk8nr", + "bc1qrmuxak470z7zch5f3gz05dc6h4ngwqdq4wx80w", + "bc1qf6lm99tp5p27hsmyskve236nsv32lnfwt4h8wk", + "14HeA1YRUiJGb95HVpVTBuavMUBYGk6y7R", ], }, ethereum:{ @@ -26,18 +31,36 @@ const config = { "0xA0F6121319a34f24653fB82aDdC8dD268Af5b9e1", "0x904cC2B2694FFa78F04708D6F7dE205108213126", "0x63F41034871535ceE49996Cc47719891Fe03dff9", + //added on the 26/06/2024 + "0x58F56615180A8eeA4c462235D9e215F72484B4A3", + "0x1baE874af9f81B8F93315b27F080260Da4702D3a", + "0x2563328d58AC7eE9e930E89C29Ce96046a291207", + "0x866c9a77d8Ab71d2874703e80cb7aD809b301e8e", + "0xCf2027AAB22980820F0767d9f214CDBD2AA2428D" ] }, solana: { owners:[ "H8z2yZcrKo7ngiMz3Vsuw823nYo11qdCqs3sJDDjeTdD", - "A5ANHizfayJUDBSwV5Cm7CNXCj6E6AAda49wzzdYPons" + "A5ANHizfayJUDBSwV5Cm7CNXCj6E6AAda49wzzdYPons", + //added on the 26/06/2024 + "BZo9RRbgsWaLMxyaYiJK9D27j2FAVgHrhMJBvAj7GiyG", + "DL165xn6SrdupXGA2MW6woz35B3ssVqpYfwS1xAKdyx" ] }, ethpow: { owners:[ "0x77021d475E36b3ab1921a0e3A8380f069d3263de", ] + }, + ripple: { + owners:[ + //added on the 26/06/2024 + "rpFXRE1LPyS48a4LMqyksG2sjDg8wmQD5e", + "rE4y6xhfo9QUV2oAxpHtnVkMmGEk632T7R", + "rK6enCZ6sMs84wMhTUgLhnPr9eyrTTNA6W", + "rKK7VZnnqovrh5Gka1ANartX9Usx2aBAZd", + ] } } diff --git a/projects/desyn/index.js b/projects/desyn/index.js index a7d43249a7..8afa051332 100644 --- a/projects/desyn/index.js +++ b/projects/desyn/index.js @@ -1,11 +1,14 @@ const { getLogs } = require('../helper/cache/getLogs') module.exports = { - methodology: 'RWA STBT is an investment portfolio that focuses on US short-term treasury bond digital assets and operates in a fully decentralized manner.', + doublecounted: true, + methodology: 'TVL: RWA STBT, issued by Matrixdock (part of Matrixport), is an investment portfolio that focuses on US short-term treasury bond digital assets and operates in a fully decentralized manner.', } const config = { ethereum: { factory: '0x01a38B39BEddCD6bFEedBA14057E053cBF529cD2', fromBlock: 17335174}, + arbitrum: { factory: '0xdE6b117384452b21F5a643E56952593B88110e78', fromBlock: 175985457}, + merlin: { factory: '0x790b4ee7998A93702f29e56f8b615eF35BE5af43', fromBlock: 11260440}, } Object.keys(config).forEach(chain => { diff --git a/projects/dinari/index.js b/projects/dinari/index.js index 97ec8bf169..829e3dbfcf 100644 --- a/projects/dinari/index.js +++ b/projects/dinari/index.js @@ -1,25 +1,26 @@ const config = { arbitrum: { factory: "0xB4Ca72eA4d072C779254269FD56093D3ADf603b8", - getTokensAbi: "function getDShares() external view returns (address[] memory, address[] memory)", usdplus: "0xfc90518D5136585ba45e34ED5E1D108BD3950CFa" }, ethereum: { factory: "0x60B5E7eEcb2AEE0382db86491b8cFfA39347c747", - getTokensAbi: "function getDShares() external view returns (address[] memory, address[] memory)", usdplus: "0x98C6616F1CC0D3E938A16200830DD55663dd7DD3" }, blast: { factory: "0x6Aa1BDa7e764BC62589E64F371A4022B80B3c72a", - getTokensAbi: "function getDShares() external view returns (address[] memory, address[] memory)" + }, + kinto: { + factory: "0xE4Daa69e99F48AD0C4D4843deF4447253248A906", + usdplus: "0x6F086dB0f6A621a915bC90295175065c9e5d9b8c" } } -async function getTokens(api, chain) { +async function getTokens(api) { + const abi = config[api.chain].getTokensAbi ?? "function getDShares() external view returns (address[] memory, address[] memory)" return (await api.call({ - chain: chain, - target: config[chain].factory, - abi: config[chain].getTokensAbi + target: config[api.chain].factory, + abi }))[0]; } diff --git a/projects/dorian/index.js b/projects/dorian/index.js new file mode 100644 index 0000000000..bea9b6756b --- /dev/null +++ b/projects/dorian/index.js @@ -0,0 +1,18 @@ +const { aaveV2Export } = require("../helper/aave"); +const { staking } = require("../helper/staking"); +const methodologies = require("../helper/methodologies"); + +const LPConfiguratorContract = "0x29604bF5D09bcb714D13549f98CC4Bb49c2Ff672"; +const StakingContract = "0x3C57d20A70d4D34331d442Cd634B0ccAF6Ad89A4"; +const TokenContract = "0x6191F90724cD0aa791B7476e804ae00146618Ab6"; + +module.exports = { + core: { + ...aaveV2Export(LPConfiguratorContract, { + fromBlock: 15251455, + }), + staking: staking(StakingContract, TokenContract), + }, +}; + +module.exports.methodology = methodologies.lendingMarket; diff --git a/projects/dusa/index.js b/projects/dusa/index.js new file mode 100644 index 0000000000..8729b65d47 --- /dev/null +++ b/projects/dusa/index.js @@ -0,0 +1,33 @@ +const { queryKey, u8ArrayToString, getTokenBalances, } = require('../helper/chain/massa.js'); +const { sumTokens2 } = require('../helper/unwrapLPs') + +const factoryAddress = 'AS1rahehbQkvtynTomfoeLmwRgymJYgktGv5xd1jybRtiJMdu8XX' + +const getPairAddress = async (factoryAddress) => { + const transform = val => { + let poolAddresses = u8ArrayToString(val) + if (poolAddresses.startsWith(":")) + poolAddresses = poolAddresses.substring(1); + + const pools = poolAddresses.split(":"); + return pools + } + return (await queryKey([factoryAddress], "ALL_PAIRS", transform))[0] +} + +async function tvl(api) { + const pools = await getPairAddress(factoryAddress) + const tokenXs = await queryKey(pools, "TOKEN_X") + const tokenYs = await queryKey(pools, "TOKEN_Y") + const tokenXBalances = await getTokenBalances(tokenXs, pools) + const tokenYBalances = await getTokenBalances(tokenYs, pools) + api.add(tokenXs, tokenXBalances) + api.add(tokenYs, tokenYBalances) + return sumTokens2({ api }) +} + +module.exports = { + timetravel: false, + massa: { tvl, } +}; + diff --git a/projects/dyad/index.js b/projects/dyad/index.js index c7e27744d3..95297e64b1 100644 --- a/projects/dyad/index.js +++ b/projects/dyad/index.js @@ -5,6 +5,7 @@ const vaults = [ "0x4fde0131694ae08c549118c595923ce0b42f8299", "0x7e5f2b8f089a4cd27f5b6b846306020800df45bd", // "0xf3768D6e78E65FC64b8F12ffc824452130BD5394", // Kerosene is own token + "0x3D72f7Fc3A9537e1fcC6FBF91AF55CcF2c5C4ed0", ] async function tvl(api) { @@ -18,4 +19,4 @@ module.exports = { ethereum: { tvl, }, -} \ No newline at end of file +} diff --git a/projects/electrowizy/index.js b/projects/electrowizy/index.js new file mode 100644 index 0000000000..3abb551ff0 --- /dev/null +++ b/projects/electrowizy/index.js @@ -0,0 +1,7 @@ +const { sumERC4626VaultsExport } = require('../helper/erc4626') + +module.exports = { + polygon: { + tvl: sumERC4626VaultsExport({ vaults: ['0x41692d4141A98401F3F0CB729D4886AcBD811a66'], balanceAbi: 'uint256:totalStaked', tokenAbi: 'address:stakingToken' }), + } +} \ No newline at end of file diff --git a/projects/fountain.js b/projects/fountain.js deleted file mode 100644 index 41f47558ed..0000000000 --- a/projects/fountain.js +++ /dev/null @@ -1,13 +0,0 @@ -const ADDRESSES = require('./helper/coreAssets.json') -const { compoundExports } = require("./helper/compound"); - -module.exports = { - oasis: { - ...compoundExports( - '0xA7684aE7e07Dac91113900342b3ef25B9Fd1D841', - 'oasis', - '0xD7d588bAbFb99E82Cd6dd0cA7677A5599AA678B5', - ADDRESSES.oasis.wROSE, - ) - }, -}; // node test.js projects/fountain.js \ No newline at end of file diff --git a/projects/fusefi-lending/index.js b/projects/fusefi-lending/index.js index 79b5685fc1..dacc669eb4 100644 --- a/projects/fusefi-lending/index.js +++ b/projects/fusefi-lending/index.js @@ -11,11 +11,11 @@ const olalending = usdCompoundExports(unitroller_fuse, "fuse", "0x025B0ff0920298 module.exports = { fuse:{ tvl: olalending.tvl, - borrowed: async function(timestamp, ...otherParams){ - if(timestamp >= 1648684800){ + borrowed: async function(api){ + if(api.timestamp >= 1648684800){ return {} } - return olalending.borrowed(timestamp, ...otherParams) + return olalending.borrowed(api) } }, hallmarks: [ diff --git a/projects/garden/index.js b/projects/garden/index.js new file mode 100644 index 0000000000..a5244db1cc --- /dev/null +++ b/projects/garden/index.js @@ -0,0 +1,33 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require("../helper/sumTokens"); +const sdk = require("@defillama/sdk"); + +const SEED_TOKEN_ADDRESS = "0x86f65121804D2Cdbef79F9f072D4e0c2eEbABC08"; // SEED TOKEN (Garden's Governance Token) Address +const STAKING_CONTRACT_ADDRESS = "0xe2239938Ce088148b3Ab398b2b77Eedfcd9d1AfC"; + +const BTC_LIQUIDITY_ADDRESS = "bc1qhww67feqfdf6xasjat88x5stqa6vzx0c6fgtnj"; +const WBTC_LIQUIDITY_ADDRESS = "0x9DD9C2D208B07Bf9A4eF9CA311F36d7185749635"; + +module.exports = { + bitcoin: { + tvl: sdk.util.sumChainTvls([ + sumTokensExport({ owners: [BTC_LIQUIDITY_ADDRESS] }), + ]), + }, + ethereum: { + tvl: sumTokensExport({ + owners: [WBTC_LIQUIDITY_ADDRESS], + tokens: [ADDRESSES.ethereum.WBTC], + }), + }, + arbitrum: { + tvl: sumTokensExport({ + owners: [WBTC_LIQUIDITY_ADDRESS], + tokens: [ADDRESSES.arbitrum.WBTC], + }), + staking: sumTokensExport({ + owners: [STAKING_CONTRACT_ADDRESS], + tokens: [SEED_TOKEN_ADDRESS], + }), + }, +}; diff --git a/projects/gearbox/index.js b/projects/gearbox/index.js index b492d66e14..c524bc3bd5 100644 --- a/projects/gearbox/index.js +++ b/projects/gearbox/index.js @@ -3,7 +3,7 @@ ** ** ** This file has been generated from source code in https://github.com/Gearbox-protocol/defillama repo - ** Binary release: https://github.com/Gearbox-protocol/defillama/releases/tag/v1.3.1 + ** Binary release: https://github.com/Gearbox-protocol/defillama/releases/tag/v1.3.2 ** ** ** @@ -355,6 +355,11 @@ var v3Abis = { "function getCreditManagersV3List() view returns (tuple(address addr, string name, uint256 cfVersion, address creditFacade, address creditConfigurator, address underlying, address pool, uint256 totalDebt, uint256 totalDebtLimit, uint256 baseBorrowRate, uint256 minDebt, uint256 maxDebt, uint256 availableToBorrow, address[] collateralTokens, tuple(address targetContract, address adapter)[] adapters, uint256[] liquidationThresholds, bool isDegenMode, address degenNFT, uint256 forbiddenTokenMask, uint8 maxEnabledTokensLength, uint16 feeInterest, uint16 feeLiquidation, uint16 liquidationDiscount, uint16 feeLiquidationExpired, uint16 liquidationDiscountExpired, tuple(address token, uint16 rate, uint16 quotaIncreaseFee, uint96 totalQuoted, uint96 limit, bool isActive)[] quotas, tuple(address interestModel, uint256 version, uint16 U_1, uint16 U_2, uint16 R_base, uint16 R_slope1, uint16 R_slope2, uint16 R_slope3, bool isBorrowingMoreU2Forbidden) lirm, bool isPaused)[])", getCreditAccountsByCreditManager: "function getCreditAccountsByCreditManager(address creditManager, (address token, bytes callData)[] priceUpdates) returns ((bool isSuccessful, address[] priceFeedsNeeded, address addr, address borrower, address creditManager, string cmName, address creditFacade, address underlying, uint256 debt, uint256 cumulativeIndexLastUpdate, uint128 cumulativeQuotaInterest, uint256 accruedInterest, uint256 accruedFees, uint256 totalDebtUSD, uint256 totalValue, uint256 totalValueUSD, uint256 twvUSD, uint256 enabledTokensMask, uint256 healthFactor, uint256 baseBorrowRate, uint256 aggregatedBorrowRate, (address token, uint256 balance, bool isForbidden, bool isEnabled, bool isQuoted, uint256 quota, uint16 quotaRate, uint256 quotaCumulativeIndexLU)[] balances, uint64 since, uint256 cfVersion, uint40 expirationDate, address[] activeBots)[])", + creditAccounts: "function creditAccounts() view returns (address[])", + collateralTokensCount: + "function collateralTokensCount() view returns (uint8)", + getTokenByMask: + "function getTokenByMask(uint256 tokenMask) view returns (address token)", }; // src/adapter/v3/index.ts @@ -385,22 +390,65 @@ async function getCreditManagersV3(dc300, block, api) { }); } async function getV3CAs(dc300, creditManager, block, api) { + try { + const accs = await api.call({ + // IDataCompressorV3_00__factory.createInterface().getFunction("getCreditAccountsByCreditManager").format(ethers.utils.FormatTypes.full) + target: dc300, + abi: v3Abis["getCreditAccountsByCreditManager"], + params: [creditManager, []], + block, + }); + const result = []; + for (const acc of accs) { + for (const { balance, token } of acc.balances) { + if (balance !== "0" && balance !== "1") { + result.push({ + addr: acc.addr, + bal: balance, + token, + }); + } + } + } + return result; + } catch (e) { + return getV3CAsWithoutCompressor(creditManager, block, api); + } +} +async function getV3CAsWithoutCompressor(creditManager, block, api) { const accs = await api.call({ - // IDataCompressorV3_00__factory.createInterface().getFunction("getCreditAccountsByCreditManager").format(ethers.utils.FormatTypes.full) - target: dc300, - abi: v3Abis["getCreditAccountsByCreditManager"], - params: [creditManager, []], + target: creditManager, + abi: v3Abis["creditAccounts"], + params: [], + block, + }); + const collateralTokensCount = await api.call({ + target: creditManager, + abi: v3Abis["collateralTokensCount"], + }); + const bitMasks = []; + for (let i = 0; i < collateralTokensCount; i++) { + bitMasks.push(1 << i); + } + const collateralTokens = await api.multiCall({ + abi: v3Abis["getTokenByMask"], + calls: bitMasks.map((bm) => ({ + target: creditManager, + params: [bm], + })), block, }); const result = []; - for (const acc of accs) { - for (const { balance, token } of acc.balances) { - if (balance !== "0" && balance !== "1") { - result.push({ - addr: acc.addr, - bal: balance, - token, - }); + for (const token of collateralTokens) { + const balances = await api.multiCall({ + abi: "erc20:balanceOf", + calls: accs.map((owner) => ({ target: token, params: [owner] })), + permitFailure: true, + }); + for (let i = 0; i < balances.length; i++) { + const bal = balances[i]; + if (bal) { + result.push({ token, addr: accs[i], bal }); } } } diff --git a/projects/grace/index.js b/projects/grace/index.js index 46ed6066e7..49c598bd59 100644 --- a/projects/grace/index.js +++ b/projects/grace/index.js @@ -1,15 +1,18 @@ -const CORE_CONTRACT = '0x1522ad0a3250eb0f64e0acfe090ca40949330cc1'; +const CORE_CONTRACTS = { + base:'0x1522ad0a3250eb0f64e0acfe090ca40949330cc1', + ethereum:'0x164dd1f4174020642967bea521e56fc776742b49' +} async function tvl(api) { - const pools = await api.fetchList({ lengthAbi: 'poolCount', itemAbi: 'poolList', target: CORE_CONTRACT }) - const collaterals = await api.fetchList({ lengthAbi: 'collateralCount', itemAbi: 'collateralList', target: CORE_CONTRACT }) + const pools = await api.fetchList({ lengthAbi: 'poolCount', itemAbi: 'poolList', target: CORE_CONTRACTS[api.chain] }) + const collaterals = await api.fetchList({ lengthAbi: 'collateralCount', itemAbi: 'collateralList', target: CORE_CONTRACTS[api.chain] }) const poolUnderlyings = await api.multiCall({ abi: 'address:asset', calls: pools }) const collateralUnderlyings = await api.multiCall({ abi: 'address:asset', calls: collaterals }) return api.sumTokens({ tokensAndOwners2: [[...poolUnderlyings, ...collateralUnderlyings], [...pools, ...collaterals]] }) } async function borrowed(api) { - const pools = await api.fetchList({ lengthAbi: 'poolCount', itemAbi: 'poolList', target: CORE_CONTRACT }) + const pools = await api.fetchList({ lengthAbi: 'poolCount', itemAbi: 'poolList', target: CORE_CONTRACTS[api.chain] }) const poolUnderlyings = await api.multiCall({ abi: 'address:asset', calls: pools }) const borrowed = await api.multiCall({ abi: 'uint256:totalDebt', calls: pools }) api.add(poolUnderlyings, borrowed) @@ -20,5 +23,8 @@ module.exports = { start: 14684731, base: { tvl, borrowed - } + }, + ethereum: { + tvl, borrowed + }, }; \ No newline at end of file diff --git a/projects/hashkey-exchange/index.js b/projects/hashkey-exchange/index.js new file mode 100644 index 0000000000..2786278e13 --- /dev/null +++ b/projects/hashkey-exchange/index.js @@ -0,0 +1,40 @@ +const { cexExports } = require("../helper/cex"); + +const config = { + avax: { + owners: [ + "0xb016ebc8a1440aff7bf098b8f165af65eb898738", + "0xa108b99c315c22673f7f5b5ca172a21628cf8334", + ], + }, + bitcoin: { + owners: [ + "bc1qqe394jlqq86muq23d4vrnhzzvcv8jnepgt8lx7", + "1NfJSiqBw4fb74KgVQrPsk5W5aqitAD1Xv", + // "bc1qlrawqecuwgpzzwh04pkhtfsqsk33kald22ds3c", // bosera funds https://www.bosera.com/english/index.html + "18oxobhCNKnHjb7nEFDmPdXbCZthFWezrm", + ], + }, + ethereum: { + owners: [ + "0x7ffbafdc1e4f0a4b97130b075fb4a25f807a1807", //cold + "0xffe15ff598e719d29dfe5e1d60be1a5521a779ae", + // "0x7269bc4a66c755b951f068626201090f0c3098e9", // bosera funds https://www.bosera.com/english/index.html + "0x48ee4a557e291c2a48d227e8a8dbe2217a825682", + ], + }, + litecoin: { + owners: [ + "ltc1qh6w8epz4ycm2smpmnhfauqach28qr4ge6jffyv", + "LSNjwQ1RGR5rbVDzCwrWiMQF8rdqVRGcPu", + ], + }, + polygon: { + owners: [ + "0xecd094b51bafbd7bffdf1f4fef067c5d197a1b75", + "0xee4f6df29617f00b12f85ee56c68962cbeac16aa", + ], + }, +}; + +module.exports = cexExports(config); diff --git a/projects/helio-money/index.js b/projects/helio-money/index.js index 29f1e90b66..a780961f14 100644 --- a/projects/helio-money/index.js +++ b/projects/helio-money/index.js @@ -2,7 +2,7 @@ const ADDRESSES = require("../helper/coreAssets.json"); const { sumTokensExport } = require("../helper/unknownTokens"); module.exports = { - methodology: "count the amount of ankr BNB in the vault", + methodology: "The TVL is calculated by summing the values of tokens held in the specified vault addresses", hallmarks: [ [1669939200, "aBNBc exploit"], //[1670544000,"aBNBc to AnkrBNB swap & HAY buyback"] diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 81bd5add7d..2d945389ef 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -106,6 +106,7 @@ const defaultTokens = { '0x3a856d4effa670c54585a5d523e96513e148e95d', //trias '0x1495bc9e44af1f8bcb62278d2bec4540cf0c05ea', //deia '0x4cff49d0a19ed6ff845a9122fa912abcfb1f68a6', //wtk + "0x23878914efe38d27c4d67ab83ed1b93a74d4086a", //aEthUSDT ], tron: [ nullAddress, diff --git a/projects/helper/chain/massa.js b/projects/helper/chain/massa.js new file mode 100644 index 0000000000..fb514c5ff2 --- /dev/null +++ b/projects/helper/chain/massa.js @@ -0,0 +1,106 @@ +const axios = require("axios"); + +// 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 }); + +async function request(method, params) { + params.forEach((param) => { + if (param.key) + param.key = convertUnit8ArrayToNumberArray(param.key); + }) + + const response = await client.post("/", { + jsonrpc: "2.0", + method, + params: [params], + id: 1, + }) + + return response.data.result; + + function convertUnit8ArrayToNumberArray(unit8Array) { + return Array.from(unit8Array, (byte) => byte) + } +} + +function u8ArrayToString(array) { + let str = ""; + for (const byte of array) { + str += String.fromCharCode(byte); + } + return str; +} + +function strToBytes(str) { + if (!str.length) { + return new Uint8Array(0); + } + return new Uint8Array(Buffer.from(str, 'utf-8')); +} + + +/** + * Converts a Uint8Array into an unsigned 64-bit integer (u64) BigInt. + * + * @param arr - The array to convert + * @param offset - The optional offset in the Uint8Array at which to start reading the u64 value (default: 0) + * + * @returns The deserialized u64 BigInt value + * + */ +function bytesToU64(arr, offset = 0) { + if (!arr?.length) return '0' + arr = new Uint8Array(arr); + const view = new DataView(arr.buffer); + return view.getBigUint64(offset, true); +} + +/** + * Converts a Uint8Array into an unsigned 256-bit integer (u256) BigInt. + * + * @param arr - The array to convert + * @param offset - The optional offset in the Uint8Array at which to start reading the u256 value (default: 0) + * + * @returns The deserialized u256BigInt value + * + */ +function bytesToU256(arr, offset = 0) { + if (!arr?.length) return '0' + arr = new Uint8Array(arr); + const view = new DataView(arr.buffer, offset); + const p0 = view.getBigUint64(0, true); + const p1 = view.getBigUint64(8, true); + const p2 = view.getBigUint64(16, true); + const p3 = view.getBigUint64(24, true); + return (p3 << 192n) | (p2 << 128n) | (p1 << 64n) | p0; +} + + +async function queryKey(addresses, key, transform = val => u8ArrayToString(val)) { + const res = await request('get_datastore_entries', addresses.map((address) => ({ address, key: strToBytes(key) }))) + return res.map((entry) => transform(entry.candidate_value)); +} + +const bytesToBigInt = (bytes) => { + try { + return bytesToU256(bytes); + } catch (e) { + return bytesToU64(bytes); + } +}; + +async function getTokenBalances(tokenAddresses, ownerAddresses) { + const params = tokenAddresses.map((tokenAddress, i) => ({ + address: tokenAddress, + key: strToBytes(`BALANCE${ownerAddresses[i]}`) + })) + const res = await request('get_datastore_entries', params) + return res.map((entry) => bytesToBigInt(entry.candidate_value).toString()); +} + +module.exports = { + queryKey, + u8ArrayToString, + getTokenBalances, +}; \ No newline at end of file diff --git a/projects/helper/chain/sui.js b/projects/helper/chain/sui.js index e688c0d2d8..01b1749635 100644 --- a/projects/helper/chain/sui.js +++ b/projects/helper/chain/sui.js @@ -4,7 +4,7 @@ const sdk = require('@defillama/sdk') const http = require('../http') const { getEnv } = require('../env') const { transformDexBalances } = require('../portedTokens') -const { sliceIntoChunks } = require('../utils') +const { sliceIntoChunks, getUniqueAddresses } = require('../utils') //https://docs.sui.io/sui-jsonrpc @@ -20,13 +20,13 @@ async function getObject(objectId) { async function queryEvents({ eventType, transform = i => i }) { let filter = {} - if (eventType) filter.MoveEventType = eventType + if (eventType) filter.MoveEventType = eventType const items = [] let cursor = null do { - const { data , nextCursor, hasNextPage } = await call('suix_queryEvents', [filter, cursor], { withMetadata: true, }) - cursor = hasNextPage ? nextCursor : null - items.push(...data) + const { data, nextCursor, hasNextPage } = await call('suix_queryEvents', [filter, cursor], { withMetadata: true, }) + cursor = hasNextPage ? nextCursor : null + items.push(...data) } while (cursor) return items.map(i => i.parsedJson).map(transform) } @@ -70,11 +70,12 @@ async function getDynamicFieldObjects({ parent, cursor = null, limit = 48, items return getDynamicFieldObjects({ parent, cursor: nextCursor, items, limit, idFilter, addedIds }) } -async function call(method, params, { withMetadata = false} = {}) { +async function call(method, params, { withMetadata = false } = {}) { if (!Array.isArray(params)) params = [params] const { result } = await http.post(endpoint(), { jsonrpc: "2.0", id: 1, method, params, }) + if (['suix_getAllBalances'].includes(method)) return result return withMetadata ? result : result.data } @@ -130,6 +131,14 @@ function dexExport({ } } + +async function sumTokens({ balances = {}, owners = [], blacklistedTokens = [], tokens = [], api }) { + owners = getUniqueAddresses(owners, true) + const bals = await call('suix_getAllBalances', owners) + bals.forEach(i => api.add(i.coinType, i.totalBalance)) + return api.getBalances() +} + module.exports = { endpoint: endpoint(), call, @@ -140,4 +149,5 @@ module.exports = { getDynamicFieldObject, getDynamicFieldObjects, dexExport, + sumTokens, }; diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 5fe8d95cb3..65579e65b7 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -2,6 +2,7 @@ "acala", "ace", "aelf", + "ailayer", "airdao", "alephium", "algorand", @@ -101,6 +102,7 @@ "equilibrium", "era", "ergo", + "etlk", "ethereum", "ethereumclassic", "ethf", @@ -175,6 +177,7 @@ "lukso", "lung", "manta", + "massa", "manta_atlantic", "mantle", "map", @@ -187,6 +190,7 @@ "migaloo", "milkomeda", "milkomeda_a1", + "mint", "mixin", "mode", "moonbeam", @@ -242,6 +246,7 @@ "quasar", "quicksilver", "radixdlt", + "rari", "real", "reef", "regen", @@ -322,5 +327,7 @@ "zksync", "zora", "zyx", - "joltify" -] \ No newline at end of file + "joltify", + "sanko", + "ox_chain" +] diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 59139d4120..c8778875c4 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1269,7 +1269,8 @@ "RETH": "0x0319111a5037cbec2b3e638cc34a3474e2d2608299f3e62866e9cc683208c610", "UNO": "0x0719b5092403233201aa822ce928bd4b551d0cdb071a724edd7dc5e5f57b7f34", "NSTSTRK": "0x04619e9ce4109590219c5263787050726be63382148538f3f936c22aa87d2fc2", - "ZEND": "0x00585c32b625999e6e5e78645ff8df7a9001cf5cf3eb6b80ccdd16cb64bd3a34" + "ZEND": "0x00585c32b625999e6e5e78645ff8df7a9001cf5cf3eb6b80ccdd16cb64bd3a34", + "NSTR": "0x00c530f2c0aa4c16a0806365b0898499fba372e5df7a7172dc6fe9ba777e8007" }, "ton": { "TON": "0x0000000000000000000000000000000000000000", @@ -1658,7 +1659,8 @@ "fwUSDB": "0x866f2c06b83df2ed7ca9c2d044940e7cd55a06d6", "WETH": "0x4300000000000000000000000000000000000004", "ezETH": "0x2416092f143378750bb29b79eD961ab195CcEea5", - "weETH": "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A" + "weETH": "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A", + "BLAST": "0xb1a5700fA2358173Fe465e6eA4Ff52E36e88E2ad" }, "chz": { "WCHZ": "0x721ef6871f1c4efe730dce047d40d1743b886946" @@ -1797,6 +1799,8 @@ }, "taiko": { "USDC": "0x07d83526730c7438048D55A4fc0b850e2aaB6f0b", + "USDT": "0x2def195713cf4a606b49d07e520e22c17899a736", + "USDC_e": "0x19e26b0638bf63aa9fa4d14c6baf8d52ebe86c5c", "WETH": "0xA51894664A773981C6C112C43ce576f315d5b1B6" }, "stellar": { @@ -1812,5 +1816,17 @@ "USDC": "0xff00000000000000000000000000000000000003", "ETH": "0xff00000000000000000000000000000000000001", "DUSD": "0xff0000000000000000000000000000000000000f" + }, + "ailayer": { + "ABTC": "0x1470a4831F76954686BfB4dE8180F7469EA8dE6F" + }, + "mint": { + "WETH": "0x4200000000000000000000000000000000000006", + "USDC": "0xb62F35B9546A908d11c5803ecBBA735AbC3E3eaE", + "USDT": "0x05D032ac25d322df992303dCa074EE7392C117b9", + "WBTC": "0x03C7054BCB39f7b2e5B2c7AcB37583e32D70Cfa3" + }, + "fraxtal": { + "WETH": "0xA8a59D73388D0c4344a7b0Ba287ddb654227c38a" } -} +} \ No newline at end of file diff --git a/projects/helper/env.js b/projects/helper/env.js index 91c86eb67f..7441f69bc5 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -26,6 +26,12 @@ const DEFAULTS = { LUKSO_RPC: 'https://rpc.lukso.sigmacore.io', HAM_RPC: 'https://rpc.ham.fun', HAM_RPC_MULTICALL: '0xB7c3Ea932649fBD594C881aDCb3F19415e2EA2d5', + SANKO_RPC_MULTICALL: '0xB32d192e07727A0F6f48e721791aa4e02cd292e1', + AILAYER_RPC: "https://mainnet-rpc.ailayer.xyz", + OX_CHAIN_RPC: "https://rpc.oxscan.io", + OX_CHAIN_RPC_MULTICALL: "0xcA11bde05977b3631167028862bE2a173976CA11", + ETLK_RPC_MULTICALL: "0xcA11bde05977b3631167028862bE2a173976CA11", + MINT_RPC_MULTICALL: "0xf8ac4BEB2F75d2cFFb588c63251347fdD629B92c", } const ENV_KEYS = [ @@ -33,6 +39,7 @@ const ENV_KEYS = [ ...Object.keys(DEFAULTS), 'GETBLOCK_KEY', 'LOFTY_API', + 'SOLANA_RPC_CLIENT', 'OLYMPUS_GRAPH_API_KEY', 'SUMMER_HISTORY_ENDPOINT', 'SUMMER_AJNA_ENDPOINT', diff --git a/projects/helper/http.js b/projects/helper/http.js index 327b3436e7..e682d45ac4 100644 --- a/projects/helper/http.js +++ b/projects/helper/http.js @@ -73,6 +73,7 @@ async function blockQuery(endpoint, query, { api, blockCatchupLimit = 500, }) { const results = await graphQLClient.request(query, { block }) return results } catch (e) { + e.chain = api.chain if (!block) throw e const errorString = e.toString() const isBlockCatchupIssue = /Failed to decode.*block.number.*has only indexed up to block number \d+/.test(errorString) diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index 10b8ee84c3..d45aca7a97 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -109,6 +109,7 @@ async function getChainTransform(chain) { if (chain === 'tezos' && addr.startsWith('KT1')) return chainStr if (chain === 'terra2' && addr.startsWith('terra1')) return chainStr if (chain === 'aura' && addr.startsWith('aura')) return chainStr + if (chain === 'massa' && addr.startsWith('AS1')) return chainStr if (chain === 'algorand' && /^\d+$/.test(addr)) return chainStr if (addr.startsWith('0x') || ['solana', 'kava', 'renec'].includes(chain)) return chainStr return addr diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 6abf0c7c33..ba993179ed 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -24,7 +24,11 @@ const blacklistedTokens_default = [ let connection, provider -const endpoint = () => getEnv('SOLANA_RPC') +const endpoint = (isClient) => { + if (isClient) return getEnv('SOLANA_RPC_CLIENT') ?? getEnv('SOLANA_RPC') + return getEnv('SOLANA_RPC') +} + const renecEndpoint = () => getEnv('RENEC_RPC') const endpointMap = { solana: endpoint, @@ -32,7 +36,7 @@ const endpointMap = { } function getConnection(chain = 'solana') { - if (!connection) connection = new Connection(endpointMap[chain]()) + if (!connection) connection = new Connection(endpointMap[chain](true)) return connection } diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js index c973223ba4..c376231260 100644 --- a/projects/helper/sumTokens.js +++ b/projects/helper/sumTokens.js @@ -13,6 +13,7 @@ const helpers = { "cosmos": require("./chain/cosmos"), "solana": require("./solana"), "aptos": require("./chain/aptos"), + "sui": require("./chain/sui"), "tezos": require("./chain/tezos"), "zilliqa": require("./chain/zilliqa"), "near": require("./chain/near"), diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 333373831e..f7663c5cad 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -19,7 +19,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', 'aura', 'xpla', 'bostrom', 'joltify'] -const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge', 'stellar', ] +const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge', 'stellar', 'massa', ] const transformTokens = { // Sample Code @@ -37,7 +37,7 @@ const ibcMappings = { const fixBalancesTokens = { ftn: { - '0x0000000000000000000000000000000000000000': { coingeckoId: 'fasttoken', decimals: 18 }, + [ADDRESSES.null]: { coingeckoId: 'fasttoken', decimals: 18 }, '0x4084ab20f8ffca76c19aaf854fb5fe9de6217fbb': { coingeckoId: 'fasttoken', decimals: 18 }, '0x498d1cf9ad2d66144c98057a5880ee16e801e2f7': { coingeckoId: 'fasttoken', decimals: 18 }, }, @@ -66,12 +66,19 @@ const fixBalancesTokens = { [nullAddress]: { coingeckoId: "endurance", decimals: 18 }, '0x85119527cf38f6ccf7b1b8f8fad05145358aaa81': { coingeckoId: "endurance", decimals: 18 }, }, + massa: { + 'AS12U4TZfNK7qoLyEERBBRDMu8nm5MKoRzPXDXans4v9wdATZedz9': { coingeckoId: 'wrapped-massa', decimals: 9 }, + 'AS1hCJXjndR4c9vekLWsXGnrdigp4AaZ7uYG3UKFzzKnWVsrNLPJ': { coingeckoId: 'massa-bridged-usdc-massa', decimals: 6 }, + 'AS1ZGF1upwp9kPRvDKLxFAKRebgg7b3RWDnhgV7VvdZkZsUL7Nuv': { coingeckoId: 'massa-bridged-dai-massa', decimals: 18 }, + 'AS124vf3YfAJCSCQVYKczzuWWpXrximFpbTmX4rheLs5uNSftiiRY': { coingeckoId: 'wrapped-ether-massa', decimals: 18 }, + }, // Sample Code ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, scroll: { [ADDRESSES.mode.STONE]: { coingeckoId: "ethereum:0x7122985656e38bdc0302db86685bb972b145bd3c", decimals: 0 }, + '0x3ba89d490ab1c0c9cc2313385b30710e838370a4': { coingeckoId: "solv-btc", decimals: 18 }, }, tezos: { "KT1PnUZCp3u2KzWr93pn4DD7HAJnm3rWVrgn": { coingeckoId: "tezos", decimals: 6 }, @@ -99,6 +106,7 @@ const fixBalancesTokens = { [ADDRESSES.optimism.WETH_1]: { coingeckoId: 'ethereum', decimals: 18 }, }, blast: { + '0x0000000000000000000000000000000000000001': { coingeckoId: 'ethereum', decimals: 18 }, '0xf7bc58b8d8f97adc129cfc4c9f45ce3c0e1d2692': { coingeckoId: "wrapped-bitcoin", decimals: 8 }, '0x9e0d7d79735e1c63333128149c7b616a0dc0bbdb': { coingeckoId: "weth", decimals: 18 }, //pirex eth '0xde55b113a27cc0c5893caa6ee1c020b6b46650c0': { coingeckoId: "deus-finance-2", decimals: 18 }, // deus @@ -149,8 +157,11 @@ const fixBalancesTokens = { '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd': { coingeckoId: 'mountain-protocol-usdm', decimals: 18 }, }, taiko: { + [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, [ADDRESSES.taiko.WETH]: { coingeckoId: 'ethereum', decimals: 18 }, [ADDRESSES.taiko.USDC]: { coingeckoId: 'usd-coin', decimals: 6 }, + [ADDRESSES.taiko.USDC_e]: { coingeckoId: 'usd-coin', decimals: 6 }, + [ADDRESSES.taiko.USDT]: { coingeckoId: 'tether', decimals: 6 }, }, sei: { '0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1': { coingeckoId: 'usd-coin', decimals: 6 }, @@ -171,7 +182,43 @@ const fixBalancesTokens = { }, zeta: { "0x1e4bF3CaBD7707089138dD5a545B077413FA83Fc": { coingeckoId: 'pufeth', decimals: 18 }, - } + }, + etlk: { + '0xc9b53ab2679f573e480d01e0f49e2b5cfb7a3eab': { coingeckoId: 'tezos', decimals: 18 }, + }, + sanko: { + [ADDRESSES.null]: { coingeckoId: 'wrapped-dmt', decimals: 18 }, + "0x754cdad6f5821077d6915004be2ce05f93d176f8": { coingeckoId: 'wrapped-dmt', decimals: 18 }, + "0xe01e3b20c5819cf919f7f1a2b4c18bbfd222f376": { coingeckoId: 'sanko-bridged-weth-sanko', decimals: 18 }, + "0x13d675bc5e659b11cfa331594cf35a20815dcf02": { coingeckoId: 'sanko-bridged-usdc-sanko', decimals: 6 }, + "0x3c84f959f4b8ca0c39847d02f936e13fa8fc4eb9": { coingeckoId: 'beat-the-allegations', decimals: 18 }, // star + }, + xai: { + "0x3fb787101dc6be47cfe18aeee15404dcc842e6af": { coingeckoId: 'xai-blockchain', decimals: 18 }, + "0xbee82cfdaff4a6aa4e4793cb81eb1c2e79ac463c": { coingeckoId: 'weth', decimals: 18 }, + "0x1e3769bd5fb2e9e9e7d4ed8667c947661f9a82e3": { coingeckoId: 'usd-coin', decimals: 6 } + }, + mint: { + [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, + [ADDRESSES.mint.WETH]: { coingeckoId: 'ethereum', decimals: 18 }, + [ADDRESSES.mint.USDT]: { coingeckoId: 'tether', decimals: 6 }, + [ADDRESSES.mint.USDC]: { coingeckoId: 'usd-coin', decimals: 6 }, + [ADDRESSES.mint.WBTC]: { coingeckoId: 'wrapped-bitcoin', decimals: 8 }, + + }, + rari: { + [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, + "0xf037540e51d71b2d2b1120e8432ba49f29edfbd0": { coingeckoId: 'weth', decimals: 18 }, + "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6": { coingeckoId: 'usd-coin', decimals: 6 }, + }, + ailayer: { + [ADDRESSES.ailayer.ABTC]: { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, + '0xc5ed6c946cdc82f4599f0f2f012e1822502e70e3': { coingeckoId: 'artificial-neural-network-ordinals', decimals: 18 }, + '0x0a3bb08b3a15a19b4de82f8acfc862606fb69a2d': { coingeckoId: 'izumi-bond-usd', decimals: 18 }, + }, + fraxtal: { + [ADDRESSES.fraxtal.WETH]: { coingeckoId: 'ethereum', decimals: 18 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index b6eef6184f..3be5849ca6 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -879,7 +879,6 @@ async function sumTokens2({ if (resolveSlipstream) await unwrapSlipstreamNFTs({ balances, chain, block, 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) diff --git a/projects/icecreamswap-v3/index.js b/projects/icecreamswap-v3/index.js new file mode 100644 index 0000000000..426c5aea73 --- /dev/null +++ b/projects/icecreamswap-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + core: { factory: '0xa8a3AAD4f592b7f30d6514ee9A863A4cEFF6531D', fromBlock: 9212906, }, +}) \ No newline at end of file diff --git a/projects/infinity-hedge-fund/index.js b/projects/infinity-hedge-fund/index.js new file mode 100644 index 0000000000..f354c5563a --- /dev/null +++ b/projects/infinity-hedge-fund/index.js @@ -0,0 +1,7 @@ +const { staking } = require('../helper/staking') +module.exports = { + base: { + tvl: () => ({}), + staking: staking('0x042Fef60aD51f48C65E6106F9b950178910A3300', '0x3B9728bD65Ca2c11a817ce39A6e91808CceeF6FD'), + } +} diff --git a/projects/ip/index.js b/projects/ip/index.js index c1721e5ed3..f9f78c593f 100644 --- a/projects/ip/index.js +++ b/projects/ip/index.js @@ -1,79 +1,102 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); const { sumTokens2 } = require('../helper/unwrapLPs') -const {lendingMarket} = require('../helper/methodologies') - -const VaultController = "0x4aaE9823Fb4C70490F1d802fC697F3ffF8D5CbE3" +const { lendingMarket } = require('../helper/methodologies'); const vaultSummaryAbi = 'function vaultSummaries(uint96 start, uint96 stop) view returns (tuple(uint96 id, uint192 borrowingPower, uint192 vaultLiability, address[] tokenAddresses, uint256[] tokenBalances)[])' -const cappedTokens = { - "0x5aC39Ed42e14Cf330A864d7D1B82690B4D1B9E61": { - address: ADDRESSES.ethereum.MATIC, - symbol: 'MATIC', - }, - "0xfb42f5AFb722d2b01548F77C31AC05bf80e03381": { - address: '0xc18360217d8f7ab5e7c516566761ea12ce7f9d72', - symbol: 'ENS', - }, - "0x05498574BD0Fa99eeCB01e1241661E7eE58F8a85": { - address: '0xba100000625a3754423978a60c9317c58a424e3d', - symbol: 'BAL', - }, - "0xd3bd7a8777c042De830965de1C1BCC9784135DD2": { - address: ADDRESSES.ethereum.AAVE, - symbol: 'AAVE', - }, - "0x7C1Caa71943Ef43e9b203B02678000755a4eCdE9": { - address: ADDRESSES.ethereum.LIDO, - symbol: 'LDO', - }, - "0xDDB3BCFe0304C970E263bf1366db8ed4DE0e357a": { - address: '0x92d6c1e31e14520e676a687f0a93788b716beff5', - symbol: 'DYDX', - }, - "0x9d878eC06F628e883D2F9F1D793adbcfd52822A8": { - address: ADDRESSES.ethereum.CRV, - symbol: 'CRV', - }, - "0x64eA012919FD9e53bDcCDc0Fc89201F484731f41": { - address: ADDRESSES.ethereum.RETH, - symbol: 'rETH', - }, - "0x99bd1f28a5A7feCbE39a53463a916794Be798FC3": { - address: ADDRESSES.ethereum.cbETH, - symbol: 'cbETH', - }, -} +async function getVaultData(api, vaultController) { + const cappedTokens = {} + let pullMoreTokens = true + let enabledTokenIndex = 0 + const batchSize = 10 + const allTokens = [] + do { + let calls = [] + for (let i = 0; i < 10; i++) { + calls.push(enabledTokenIndex + i) + } + enabledTokenIndex += batchSize + const tokens = await api.multiCall({ abi: 'function _enabledTokens(uint256) view returns (address)', calls, permitFailure: true, target: vaultController }) + allTokens.push(...tokens.filter(i => i)) + pullMoreTokens = !tokens.some(token => !token) + } while (pullMoreTokens) + + const uTokens = await api.multiCall({ abi: 'address:_underlying', calls: allTokens, permitFailure: true, }) + uTokens.forEach((token, i) => { + if (!token) return; + cappedTokens[allTokens[i].toLowerCase()] = token + }) -async function tvl(api) { - const balances = {} - const count = await api.call({ abi: " function vaultsMinted() view returns (uint96)", target: VaultController }) + const count = await api.call({ abi: " function vaultsMinted() view returns (uint96)", target: vaultController }) const calls = [] - for (let i = 1; i <= count; i++) - calls.push({ params: [i, i]}) + for (let i = 1; i <= count; i++) + calls.push({ params: [i, i] }) - const vaults = (await api.multiCall({ abi: vaultSummaryAbi, target: VaultController, calls, permitFailure: true })).filter(i => i).flat() + const vaults = (await api.multiCall({ abi: vaultSummaryAbi, target: vaultController, calls, permitFailure: true })).filter(i => i).flat() + + return { cappedTokens, vaults } +} + +async function eth_tvl(api) { + const VaultController = "0x4aaE9823Fb4C70490F1d802fC697F3ffF8D5CbE3" + + const { cappedTokens, vaults } = await getVaultData(api, VaultController) vaults.map(vault => { vault.tokenAddresses.map((token, i) => { - token = cappedTokens[token]?.address || token - sdk.util.sumSingleBalance(balances,token,vault.tokenBalances[i]) + token = cappedTokens[token.toLowerCase()] ?? token + api.add(token, vault.tokenBalances[i]) }) }) - return sumTokens2({ api, balances, owner: '0x2A54bA2964C8Cd459Dc568853F79813a60761B58', tokens: [ADDRESSES.ethereum.USDC]}) + //get reserves + return sumTokens2({ api, owner: '0x2A54bA2964C8Cd459Dc568853F79813a60761B58', tokens: [ADDRESSES.ethereum.USDC] }) +} + +async function op_tvl(api) { + //get reserves + const USDI = "0x889be273BE5F75a177f9a1D00d84D607d75fB4e1" + await api.sumTokens({ owner: USDI, tokens: [ADDRESSES.optimism.USDC, ADDRESSES.optimism.USDC_CIRCLE] }) + + //get collaterals + const positionWrapper = "0x7131FF92a3604966d7D96CCc9d596F7e9435195c".toLowerCase() + const VaultController = "0x05498574BD0Fa99eeCB01e1241661E7eE58F8a85" + const { cappedTokens, vaults } = await getVaultData(api, VaultController) + + vaults.map(vault => { + vault.tokenAddresses.map((token, i) => { + const bal = vault.tokenBalances[i] + if (+bal === 0) return; + token = cappedTokens[token.toLowerCase()] ?? token + token = token.toLowerCase() + if (token === ADDRESSES.optimism.WBTC.toLowerCase()) { + //scale for wbtc decimals + api.add(token, bal / 1e10) + } else if (token === positionWrapper) { + //total is already in usd 1e18 terms, add as DAI, as this is a stablecoin at 1e18 + api.add(ADDRESSES.optimism.DAI, bal) + } else { + api.add(token, bal) + } + }) + }) } module.exports = { start: 14962974, ethereum: { - tvl, + tvl: eth_tvl + }, + optimism: { + tvl: op_tvl }, methodology: `${lendingMarket}. - For Interest Protocol, TVL is Reserve + Total Collateral Value - Reserve is found through calling USDC.getBalances(USDI) + For Interest Protocol, TVL is USDC Reserve + Total Deposited Collateral Value + Reserve is the amount of USDC held by the USDI contract Balances are found through VaultController.vaultSummaries(1,VaultController.vaultsMinted()) Capped tokens converted 1:1 to underlying + Wrapped Uni V3 Positions as implemented report their values to Interest Protocol in USD terms * 1e18, + as such, they are currently listed as DAI in the TVL calculation, + therefore DAI numbers in the TVL should be treated as Uniswap V3 position collateral value, as DAI is not otherwise listed on IP. ` }; diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 63ce4f8601..256c2d5b2a 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -34,6 +34,7 @@ const poolHelpers = { 'xlayer': ['0xF42C48f971bDaA130573039B6c940212EeAb8496'], 'bob': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], 'taiko': ['0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF'], + 'core': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], } // iziswap liquidityManager contracts const blacklistedTokens = [ diff --git a/projects/jax-protocol/index.js b/projects/jax-protocol/index.js new file mode 100644 index 0000000000..e7bf371af2 --- /dev/null +++ b/projects/jax-protocol/index.js @@ -0,0 +1,5 @@ +const { compoundExports2 } = require('../helper/compound') + +module.exports = { + taiko: compoundExports2({ comptroller: '0x8D86d4070b9432863FE9522B2c931C410085E1d4', cether: '0xdc1af71e6b9b4572cdf7832496efbea06cbecfc5', }), +} \ No newline at end of file diff --git a/projects/kalax/index.js b/projects/kalax/index.js index 2977f9f232..971b519abe 100644 --- a/projects/kalax/index.js +++ b/projects/kalax/index.js @@ -1,31 +1,20 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2 } = require("../helper/unwrapLPs"); +const { sumTokens2 } = require("../helper/unwrapLPs") -const KALAX = "0x2F67F59b3629Bf24962290DB9edE0CD4127e606D"; +const KALAX = "0x2F67F59b3629Bf24962290DB9edE0CD4127e606D" +const farms = ['0xE63153C3360aCa0F4e7Ca7A1FC61c2215FAEF5A1', '0xFe899401A1d86cC1113020fb40878c76239142a5'] async function tvl(api) { - const FARM = "0xE63153C3360aCa0F4e7Ca7A1FC61c2215FAEF5A1"; - - let pools = await api.call({ abi: abiInfo.poolInfos, target: FARM }); + let pools = (await api.multiCall({ abi: abiInfo.poolInfos, calls: farms })).flat() pools .filter((i) => i.assets !== KALAX) - .forEach((i) => { - if (i.assets === ADDRESSES.linea.WETH_1) { - i.assets = ADDRESSES.null; - } - api.add(i.assets, i.tvl); - }); - return await sumTokens2({ api, resolveLP: true }); + .forEach((i) => api.add(i.assets, i.tvl)) + + return sumTokens2({ api, resolveLP: true }) } async function staking(api) { - const FARM = "0xE63153C3360aCa0F4e7Ca7A1FC61c2215FAEF5A1"; - - let pools = await api.call({ abi: abiInfo.poolInfos, target: FARM }); - let target = pools.find((i) => i.assets === KALAX); - - api.add(target.assets, target.tvl); - return api.getBalances(); + let pools = (await api.multiCall({ abi: abiInfo.poolInfos, calls: farms })).flat() + pools.filter((i) => i.assets === KALAX).forEach((i) => api.add(i.assets, i.tvl)) } module.exports = { @@ -33,9 +22,9 @@ module.exports = { tvl, staking, }, -}; +} const abiInfo = { poolInfos: "function getPoolTotalTvl() view returns (tuple(uint256 pid, address assets, uint256 tvl)[])", -}; +} diff --git a/projects/kayak/index.js b/projects/kayak/index.js new file mode 100644 index 0000000000..9227635cfa --- /dev/null +++ b/projects/kayak/index.js @@ -0,0 +1,23 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + avax: { factory: '0x4df3038C2C7e13F46F0d63eC3AF5728F75Be3775', fromBlock: 46950081, } +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ + api, + factory, + eventAbi: 'event NewStableSwapPair(address indexed swapContract, address indexed tokenA, address indexed tokenB)', + fromBlock, + }) + + const ownerTokens = logs.map(i => [[i.tokenA, i.tokenB], i.swapContract]) + return sumTokens2({ api, ownerTokens }) + } + } +}) \ No newline at end of file diff --git a/projects/kayen/index.js b/projects/kayen/index.js new file mode 100644 index 0000000000..b37cf8f7cc --- /dev/null +++ b/projects/kayen/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +module.exports = { + misrepresentedTokens: true, + methodology: + "We count liquidity of all paris through Factory Contract and Pools (single tokens) seccions through Factory Contract.", + chz: { + tvl: getUniTVL({ + factory: "0xE2918AA38088878546c1A18F2F9b1BC83297fdD3", + useDefaultCoreAssets: true, + fetchBalances: true, + }), + }, +}; \ No newline at end of file diff --git a/projects/loopfi/index.js b/projects/loopfi/index.js new file mode 100644 index 0000000000..1cc6ccdb44 --- /dev/null +++ b/projects/loopfi/index.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs") + +const LOOP_PRELAUNCH = "0xaBEEcB1d3414550B30694bB37ac24CAaD0b82aE9" + +const tokens = { + WETH: ADDRESSES.ethereum.WETH, + weETH: "0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee", + ezETH: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110", + rsETH: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7", + rswETH: "0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0", + uniETH: "0xF1376bceF0f78459C0Ed0ba5ddce976F1ddF51F4", + pufETH: "0xD9A442856C234a39a81a089C06451EBAa4306a72", +} + +module.exports = { + methodology: + "Counts the number of WETH and LRT tokens in the LoopFi Prelaunch Contract.", + start: 1718390875, + ethereum: { + tvl: sumTokensExport({ + owner: LOOP_PRELAUNCH, + tokens: Object.values(tokens), + }), + }, +} diff --git a/projects/lovelyswap-v2/index.js b/projects/lovelyswap-v2/index.js new file mode 100644 index 0000000000..ed77cf9848 --- /dev/null +++ b/projects/lovelyswap-v2/index.js @@ -0,0 +1,7 @@ +const { uniTvlExports } = require('../helper/unknownTokens') + +module.exports = uniTvlExports({ + bsc: '0x7db16925214B2F5D65dB741D59208A1187B9961c', + base: '0x7db16925214B2F5D65dB741D59208A1187B9961c', + polygon: '0x177aeb3727c91c4796766336923c4da431c59637', +}) diff --git a/projects/lynx/index.js b/projects/lynx/index.js index 783bb6e68e..38ecda6e9e 100644 --- a/projects/lynx/index.js +++ b/projects/lynx/index.js @@ -12,6 +12,52 @@ const config = { ], ], }, + fantom: { + tokenAndOwnerPair: [ + [ + // FTM Token + "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", + // OFTChipAdapter (owner) + "0x614aA983f54409D475aeC5D18120FECFD6320eF4" + ], + [ + // USDC Token + "0x04068da6c83afcfa0e13ba15a6696662335d5b75", + // OFTChipAdapter (owner) + "0x194609ea1C1D77e66eaB28C48CE266A48f3bC30a", + ], + [ + // FSONIC Token + "0x05e31a691405d06708a355c029599c12d5da8b28", + // OFTChipAdapter (owner) + "0xCCC0d9d276176FED7E6918dCf99F23DCAaCFcAc5" + ], + [ + // BRUSH Token + "0x85dec8c4b2680793661bca91a8f129607571863d", + // OFTChipAdapter (owner) + "0xcbd1a63a84af4baa9541331420ff98d8fca3ba1c", + ], + [ + // POLTER Token + "0x5c725631FD299703D0A74C23F89a55c6B9A0C52F", + // OFTChipAdapter (owner) + "0x089cd8ac58d9a1488b3cdfdfeb20963e7bb33732", + ], + [ + // fBUX Token + "0x1e2Ea3f3209D66647f959CF00627107e079B870d", + // OFTChipAdapter (owner) + "0x86facb048fee156a16104531bd36cdff118d8107", + ], + [ + // fTAILS Token + "0x5cF90b977C86415a53CE3B7bE13b26f6abdDfee2", + // OFTChipAdapter (owner) + "0x2c241eefc4b61ed475d7f1ded112df99e5de0e8f", + ], + ], + }, fuse: { tokenAndOwnerPair: [ [ diff --git a/projects/lyra-v2/index.js b/projects/lyra-v2/index.js index 667113cf9a..8f70fff2e3 100644 --- a/projects/lyra-v2/index.js +++ b/projects/lyra-v2/index.js @@ -11,7 +11,8 @@ module.exports = { [ADDRESSES.ethereum.SNX, '0x7D7aC8d55A9bD4152b703011f3E61AB3bB0A5592'], [ADDRESSES.ethereum.WSTETH, '0xeBB5D642aA8ccDeE98373D6aC3ee0602b63824b3'], ['0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee', '0x8180EcCC825b692ef65FF099a0A387743788bf78'], // weETH - ['0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0', '0x4BB4C3CDc7562f08e9910A0C7D8bB7e108861eB4'] // rswETH + ['0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0', '0x4BB4C3CDc7562f08e9910A0C7D8bB7e108861eB4'], // rswETH + ['0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7','0x35d4D9bc79B0a543934b1769304B90d752691caD'] // rsETH ], }) }, @@ -43,7 +44,8 @@ module.exports = { [ADDRESSES.arbitrum.WBTC, '0x3D20c6A2b719129af175E0ff7B1875DEb360896f'], [ADDRESSES.arbitrum.USDT, '0xb2Cb9aDA6e00118dA8E83a6A53dF1EC6331A60a6'], [ADDRESSES.arbitrum.WSTETH, '0x8574CBC539c26Df9ec11bA283218268101ff10e1'], - ['0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe', '0x3FBFD80EF7591658d1D7DdEC067F413eFd6f985c'] + ['0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe', '0x3FBFD80EF7591658d1D7DdEC067F413eFd6f985c'], + ['0x4186BFC76E2E237523CBC30FD220FE055156b41F','0x486936FB1CE805e8C46E71C69256e72f3f550d38'] // rsETH ] }) }, diff --git a/projects/meanfinance/index.js b/projects/meanfinance/index.js index 491b89b3e0..ee8962fa60 100644 --- a/projects/meanfinance/index.js +++ b/projects/meanfinance/index.js @@ -2,7 +2,10 @@ const { V1_POOLS, TOKENS_IN_LEGACY_VERSIONS } = require("./addresses"); const { sumTokens2 } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') -const YIELD_VERSION = '0xA5AdC5484f9997fBF7D405b9AA62A7d88883C345' +const YIELD_VERSION = (chain) => { + if (chain == 'rsk') return '0x8CC0Df843610cefF7f4AFa01100B6abf6756Bdf2'; + else return '0xA5AdC5484f9997fBF7D405b9AA62A7d88883C345'; +} const YIELDLESS_VERSION = '0x059d306A25c4cE8D7437D25743a8B94520536BD5' const VULN_VERSION = '0x230C63702D1B5034461ab2ca889a30E343D81349' const BETA_VERSION = '0x24F85583FAa9F8BD0B8Aa7B1D1f4f53F0F450038' @@ -13,7 +16,7 @@ const LEGACY_VERSIONS = { } async function getTokensInChain(chain) { - const data = await getConfig('mean-finance/'+chain, `https://api.mean.finance/v1/dca/networks/${chain}/tokens?includeNotAllowed`) + const data = await getConfig('mean-finance/'+chain, `https://api.balmy.xyz/v1/dca/networks/${chain}/tokens?includeNotAllowed`) return data.map(({ address }) => address) } @@ -29,7 +32,7 @@ async function getV2TVL(chain, block) { const tokens = await getTokensInChain(chain) const versions = [ ...legacyVersions.map(contract => ({ contract, tokens: legacyTokens })), - { contract: YIELD_VERSION, tokens } + { contract: YIELD_VERSION(chain), tokens } ] const toa = versions.map(({ contract, tokens }) => tokens.map(t => ([t, contract]))).flat() @@ -62,6 +65,7 @@ module.exports = { bsc: getV2TvlObject('bsc'), xdai: getV2TvlObject('xdai'), moonbeam: getV2TvlObject('moonbeam'), + rsk: getV2TvlObject('rsk'), hallmarks: [ [1650082958, "Protocol is paused due to non-critical vulnerability"], [1654057358, "Deployment on Optimism"], diff --git a/projects/mellow-protocol-v2/index.js b/projects/mellow-protocol-v2/index.js index 44a634f7e1..a18cfc7fce 100644 --- a/projects/mellow-protocol-v2/index.js +++ b/projects/mellow-protocol-v2/index.js @@ -4,7 +4,13 @@ const config = { '0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc', '0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a', '0x5fD13359Ba15A84B76f7F87568309040176167cd', - '0x7a4EffD87C2f3C55CA251080b1343b605f327E3a' + '0x7a4EffD87C2f3C55CA251080b1343b605f327E3a', + '0xc65433845ecD16688eda196497FA9130d6C47Bd8', + '0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26', + '0x49cd586dd9BA227Be9654C735A659a1dB08232a9', + '0x82dc3260f599f4fC4307209A1122B6eAa007163b', + '0xd6E09a5e6D719d1c881579C9C8670a210437931b', + '0x8c9532a60E0E7C6BbD2B2c1303F63aCE1c3E9811' ], }, } diff --git a/projects/meson/index.js b/projects/meson/index.js index 3760dabd8a..6b6fbe6e19 100644 --- a/projects/meson/index.js +++ b/projects/meson/index.js @@ -65,6 +65,7 @@ const config = { ADDRESSES.tron.WTRX, ], }, + taiko: { id: 'taiko' }, ancient8: { id: 'ancient8' }, arbitrum: { id: 'arb' }, aurora: {}, diff --git a/projects/mimswap/index.js b/projects/mimswap/index.js index 6121e57d58..fd60862869 100644 --- a/projects/mimswap/index.js +++ b/projects/mimswap/index.js @@ -1,6 +1,7 @@ const { getLogs2 } = require('../helper/cache/getLogs') const config = { + arbitrum: { factory: '0x8D0Cd3eEf1794F59F2B3a664Ef07fCAD401FEc73', fromBlock: 205217727 }, blast: { factory: '0x7E05363E225c1c8096b1cd233B59457104B84908', fromBlock: 1067907 }, } diff --git a/projects/mintswap-finance-v3/index.js b/projects/mintswap-finance-v3/index.js new file mode 100644 index 0000000000..4c1f4bd9b7 --- /dev/null +++ b/projects/mintswap-finance-v3/index.js @@ -0,0 +1,7 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +const factory = "0x1f88BB455E02646224A0a65f3eb4B2FCb4fb8e49"; + +module.exports = uniV3Export({ + mint: { factory, fromBlock: 1025232 }, +}) \ No newline at end of file diff --git a/projects/moonbiz/index.js b/projects/moonbiz/index.js deleted file mode 100644 index e316ff8a82..0000000000 --- a/projects/moonbiz/index.js +++ /dev/null @@ -1,5 +0,0 @@ -const { uniTvlExport } = require("../helper/unknownTokens"); - -const factory = "0x9B2593839E1390ECee3B348a47B3D93b2Ec2834C"; - -module.exports = uniTvlExport('bsc', factory, { fetchBalances: true, }) diff --git a/projects/munchables-season2/index.js b/projects/munchables-season2/index.js index 8c8a101bdb..95d1cc941b 100644 --- a/projects/munchables-season2/index.js +++ b/projects/munchables-season2/index.js @@ -5,7 +5,7 @@ module.exports = { blast: { tvl: sumTokensExport({ owner: "0xEA091311Fc07139d753A6BBfcA27aB0224854Bae", - tokens: [ADDRESSES.null, ADDRESSES.blast.USDB, ADDRESSES.blast.WETH], + tokens: [ADDRESSES.null, ADDRESSES.blast.USDB, ADDRESSES.blast.WETH, ADDRESSES.blast.BLAST], }), }, }; \ No newline at end of file diff --git a/projects/netweave-lending/index.js b/projects/netweave-lending/index.js new file mode 100644 index 0000000000..a58faf317d --- /dev/null +++ b/projects/netweave-lending/index.js @@ -0,0 +1,7 @@ +const { compoundExports2 } = require("../helper/compound"); + +module.exports = { + mode: compoundExports2({ + comptroller: '0x86112d3176c537B953560EA6fE43f79382E7bffE', + }) +} diff --git a/projects/netweave-vault/index.js b/projects/netweave-vault/index.js new file mode 100644 index 0000000000..359cd5b119 --- /dev/null +++ b/projects/netweave-vault/index.js @@ -0,0 +1,12 @@ +const { yieldHelper } = require("../helper/yieldHelper") + +const vault = '0x28d46E6A97273865561142124056eb3243568d3C' +const abis = { + poolInfo: 'function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardTime, uint256 accSushiPerShare, uint256 amount, address strat)', +} +module.exports = yieldHelper({ + project: 'NetWeave', + chain: 'mode', + masterchef: vault, + abis, +}) diff --git a/projects/nolus/index.js b/projects/nolus/index.js index 2be45251c9..b1983f2736 100644 --- a/projects/nolus/index.js +++ b/projects/nolus/index.js @@ -1,71 +1,31 @@ -const sdk = require("@defillama/sdk"); -const { transformBalances } = require("../helper/portedTokens"); +const sdk = require('@defillama/sdk') +const { transformBalances } = require('../helper/portedTokens') const { queryContract, queryManyContracts, queryContracts } = require('../helper/chain/cosmos') -// Osmosis -const osmosisLeaserAddr = 'nolus1wn625s4jcmvk0szpl85rj5azkfc6suyvf75q6vrddscjdphtve8s5gg42f' -const osmosisAxlLppAddr = 'nolus1qg5ega6dykkxc307y25pecuufrjkxkaggkkxh7nad0vhyhtuhw3sqaa3c5' +// Osmosis Noble USDC Protocol Contracts (OSMOSIS-OSMOSIS-USDC_NOBLE) pirin-1 +const osmosisNobleOracleAddr = 'nolus1vjlaegqa7ssm2ygf2nnew6smsj8ref9cmurerc7pzwxqjre2wzpqyez4w6' const osmosisNobleLppAddr = 'nolus1ueytzwqyadm6r0z8ajse7g6gzum4w3vv04qazctf8ugqrrej6n4sq027cf' +const osmosisNobleLeaserAddr = 'nolus1dca9sf0knq3qfg55mv2sn03rdw6gukkc4n764x5pvdgrgnpf9mzsfkcjp6' + +// Osmosis axlUSDC Protocol Contracts (OSMOSIS-OSMOSIS-USDC_AXELAR) pirin-1 +const osmosisAxlOracleAddr = 'nolus1vjlaegqa7ssm2ygf2nnew6smsj8ref9cmurerc7pzwxqjre2wzpqyez4w6' +const osmosisAxlLeaserAddr = 'nolus1wn625s4jcmvk0szpl85rj5azkfc6suyvf75q6vrddscjdphtve8s5gg42f' +const osmosisAxlLppAddr = 'nolus1qg5ega6dykkxc307y25pecuufrjkxkaggkkxh7nad0vhyhtuhw3sqaa3c5' -// Neutron (Astroport) -const neutronLeaserAddr = 'nolus1et45v5gepxs44jxewfxah0hk4wqmw34m8pm4alf44ucxvj895kas5yrxd8' -const neutronLppAddr = 'nolus1qqcr7exupnymvg6m63eqwu8pd4n5x6r5t3pyyxdy7r97rcgajmhqy3gn94' +// Astroport Protocol Contracts (NEUTRON-ASTROPORT-USDC_AXELAR) pirin-1 +const astroportOracleAddr = 'nolus1jew4l5nq7m3xhkqzy8j7cc99083m5j8d9w004ayyv8xl3yv4h0dql2dd4e' +const astroportLppAddr = 'nolus1qqcr7exupnymvg6m63eqwu8pd4n5x6r5t3pyyxdy7r97rcgajmhqy3gn94' +const astroportLeaserAddr = 'nolus1et45v5gepxs44jxewfxah0hk4wqmw34m8pm4alf44ucxvj895kas5yrxd8' const _6Zeros = 1000000 -const denomsMapping = { - "neutron": { - "ATOM": "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9", - "DYDX": "ibc/2CB87BCE0937B1D1DFCEE79BE4501AAF3C265E923509AEAC410AD85D27F35130", - "NLS": "ibc/6C9E6701AC217C0FC7D74B0F7A6265B9B4E3C3CDA6E80AADE5F950A8F52F9972", - "NTRN": "neutron:untrn", - "ST_ATOM": "ibc/B7864B03E1B9FD4F049243E92ABD691586F682137037A9F3FCA5222815620B3C", - "ST_TIA": "ibc/6569E05DEE32B339D9286A52BE33DFCEFC97267F23EF9CFDE0C055140967A9A5", - "STK_ATOM": "ibc/3649CE0C8A2C79048D8C6F31FF18FA69C9BC7EB193512E0BD03B733011290445", - "TIA": "ibc/773B4D0A3CD667B2275D5A4A7A2F0909C0BA0F4059C0B9181E680DDF4965DCC7", - "USDC_AXELAR": "ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349", - "USDC_NOBLE": "ibc/B559A80D62249C8AA07A380E2A2BEA6E5CA9A6F079C912C3A9E9B494105E4F81" - }, - "osmosis": { - "AKT": "ibc/1480B8FD20AD5FCAE81EA87584D269547DD4D436843C1D20F15E00EB64743EF4", - "ATOM": "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", - "AXL": "ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E", - "CRO": "ibc/E6931F78057F7CC5DA0FD6CEF82FF39373A6E0452BF1FD76910B93292CF356C1", - "DYM": "ibc/9A76CDF0CBCEF37923F32518FA15E5DC92B9F56128292BC4D63C4AEA76CBB110", - "EVMOS": "ibc/6AE98883D4D5D5FF9E50D7130F1305DA2FFA0C652D1DD9C123657C6B4EB2DF8A", - "INJ": "ibc/64BA6E31FE887D66C6F8F31C7B1A80C7CA179239677B4088BB55F5EA07DBE273", - "JKL": "ibc/8E697BDABE97ACE8773C6DF7402B2D1D5104DD1EEABE12608E3469B7F64C15BA", - "JUNO": "ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED", - "LVN": "factory/osmo1mlng7pz4pnyxtpq0akfwall37czyk9lukaucsrn30ameplhhshtqdvfm5c/ulvn", - "MARS": "ibc/573FCD90FACEE750F55A8864EF7D38265F07E5A9273FA0E8DAFD39951332B580", - "MILK_TIA": "factory/osmo1f5vfcph2dvfeqcqkhetwv75fda69z7e5c2dldm3kvgj23crkv6wqcn47a0/umilkTIA", - "NLS": "ibc/D9AFCECDD361D38302AA66EB3BAC23B95234832C51D12489DC451FA2B7C72782", - "OSMO": "osmosis:uosmo", - "PICA": "ibc/56D7C03B8F6A07AD322EEE1BEF3AE996E09D1C1E34C27CF37E0D4A0AC5972516", - "Q_ATOM": "ibc/FA602364BEC305A696CBDF987058E99D8B479F0318E47314C49173E8838C5BAC", - "QSR": "ibc/1B708808D372E959CD4839C594960309283424C775F4A038AAEBE7F83A988477", - "SCRT": "ibc/0954E1C28EB7AF5B72D24F3BC2B47BBB2FDF91BDDFD57B74B99E133AED40972A", - "ST_ATOM": "ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901", - "ST_OSMO": "ibc/D176154B0C63D1F9C6DCFB4F70349EBF2E2B5A87A05902F57A6AE92B863E9AEC", - "ST_TIA": "ibc/698350B8A61D575025F3ED13E9AC9C0F45C89DEFE92F76D5838F1D3C1A7FF7C9", - "STARS": "ibc/987C17B11ABC2B20019178ACE62929FE9840202CE79498E29FE8E5CB02B7C0A4", - "STK_ATOM": "ibc/CAA179E40F0266B0B29FB5EAA288FB9212E628822265D4141EBD1C47C3CBFCBC", - "STRD": "ibc/A8CA5EE328FA10C9519DF6057DA1F69682D28F7D0F5CCC7ECB72E3DCA2D157A4", - "TIA": "ibc/D79E7D83AB399BFFF93433E54FAA480C191248FC556924A2A8351AE2638B3877", - "USDC": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "USDC_AXELAR": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "USDC_NOBLE": "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4", - "WBTC": "ibc/D1542AA8762DB13087D8364F3EA6509FD6F009A34F00426AF9E4F9FA85CBBF1F", - "WETH": "ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5" - } + +const nativeTokens = { + 'untrn': 'neutron:untrn', + 'uosmo': 'osmosis:uosmo' } async function getLeaseCodeId(leaserAddress) { - const leaserContract = await queryContract({ - contract: leaserAddress, - chain: "nolus", - data: { config: {} } - }) - + const leaserContract = await queryContract({ contract: leaserAddress, chain: 'nolus', data: { 'config': {} } }) const leaseCodeId = leaserContract?.config?.lease_code if (!leaseCodeId) { return 0 @@ -75,27 +35,15 @@ async function getLeaseCodeId(leaserAddress) { } async function getLeaseContracts(leaseCodeId) { - return await queryContracts({ - chain: "nolus", - codeId: leaseCodeId, - }) + return await queryContracts({ chain: 'nolus', codeId: leaseCodeId, }) } async function getLeases(leaseAddresses) { - return await queryManyContracts({ - permitFailure: true, - contracts: leaseAddresses, - chain: "nolus", - data: {} - }) + return await queryManyContracts({ permitFailure: true, contracts: leaseAddresses, chain: 'nolus', data: {} }) } async function getLppTvl(lppAddresses) { - const lpps = await queryManyContracts({ - contracts: lppAddresses, - chain: "nolus", - data: { "lpp_balance": [] }, - }) + const lpps = await queryManyContracts({ contracts: lppAddresses, chain: 'nolus', data: { 'lpp_balance': [] } }) let totalLpp = 0 lpps.forEach(v => { @@ -105,45 +53,65 @@ async function getLppTvl(lppAddresses) { return totalLpp / _6Zeros } -function sumAssests(chain, leases) { - let balances = {} +function sumAssests(balances, leases, currencies) { leases.forEach(v => { if (v.opened) { - const ticker = v.opened.amount.ticker + let ticker = v.opened.amount.ticker const amount = parseInt(v.opened.amount.amount, 10) - const denom = denomsMapping[chain][ticker] - sdk.util.sumSingleBalance(balances, denom, amount) + const currencyData = find(currencies, (n) => n.ticker == ticker) + if (nativeTokens.hasOwnProperty(currencyData.dex_symbol)) { + sdk.util.sumSingleBalance(balances, nativeTokens[currencyData.dex_symbol], amount) + } + sdk.util.sumSingleBalance(balances, currencyData.dex_symbol, amount) } }) - return balances } -async function tvl(chain, leaserAddr) { - const leaseCodeId = await getLeaseCodeId(leaserAddr) - const leaseContracts = await getLeaseContracts(leaseCodeId) - const leases = await getLeases(leaseContracts) - const balances = sumAssests(chain, leases) - return transformBalances("nolus", balances); +function find (collection, predicate) { + for (let i = 0; i < collection.length; i++) { + if (predicate(collection[i])) { + return collection[i]; + } + } + return undefined; +} + +async function tvl(protocols) { + let balances = {} + for (let i = 0; i < protocols.length; i++) { + const p = protocols[i] + const oracleData = await queryContract({ contract: p.oracle, chain: 'nolus', data: { 'currencies': {} } }) + const leaseCodeId = await getLeaseCodeId(p.leaser) + const leaseContracts = await getLeaseContracts(leaseCodeId) + const leases = await getLeases(leaseContracts) + sumAssests(balances, leases, oracleData) + } + return transformBalances('nolus', balances) } module.exports = { - methodology: "The combined total of lending pool assets and the current market value of active leases", + methodology: 'The combined total of lending pool assets and the current market value of active leases', nolus: { tvl: async () => { return { - 'axlusdc': await getLppTvl([osmosisAxlLppAddr, neutronLppAddr]), + 'axlusdc': await getLppTvl([osmosisAxlLppAddr, astroportLppAddr]), 'usd-coin': await getLppTvl([osmosisNobleLppAddr]) } } }, neutron: { tvl: async () => { - return await tvl("neutron", neutronLeaserAddr) + return await tvl([ + { leaser: astroportLeaserAddr, oracle: astroportOracleAddr } + ]) } }, osmosis: { tvl: async () => { - return await tvl("osmosis", osmosisLeaserAddr) + return await tvl([ + { leaser: osmosisNobleLeaserAddr, oracle: osmosisNobleOracleAddr }, + { leaser: osmosisAxlLeaserAddr, oracle: osmosisAxlOracleAddr }, + ]) } } } diff --git a/projects/nostra/index.js b/projects/nostra/index.js index b16b13d9d7..f30b87d7a4 100644 --- a/projects/nostra/index.js +++ b/projects/nostra/index.js @@ -52,6 +52,11 @@ const supplyTokens = [ "0x2a3a9d7bcecc6d3121e3b6180b73c7e8f4c5f81c35a90c8dd457a70a842b723", "0x6757ef9960c5bc711d1ba7f7a3bff44a45ba9e28f2ac0cc63ee957e6cada8ea", "0x7d717fb27c9856ea10068d864465a2a8f9f669f4f78013967de06149c09b9af", + // NSTR + "0x2b674ffda238279de5550d6f996bf717228d316555f07a77ef0a082d925b782", + "0x6f8ad459c712873993e9ffb9013a469248343c3d361e4d91a8cac6f98575834", + "0x2589fc11f60f21af6a1dda3aeb7a44305c552928af122f2834d1c3b1a7aa626", + "0x46ab56ec0c6a6d42384251c97e9331aa75eb693e05ed8823e2df4de5713e9a4", ]; const debtTokens = [ "0x0491480f21299223b9ce770f23a2c383437f9fbf57abc2ac952e9af8cdb12c97", @@ -64,6 +69,7 @@ const debtTokens = [ "0x1258eae3eae5002125bebf062d611a772e8aea3a1879b64a19f363ebd00947", "0x292be6baee291a148006db984f200dbdb34b12fb2136c70bfe88649c12d934b", "0x4b036839a8769c04144cc47415c64b083a2b26e4a7daa53c07f6042a0d35792", + "0x3e0576565c1b51fcac3b402eb002447f21e97abb5da7011c0a2e0b465136814", ]; function* chunks(arr, n) { diff --git a/projects/notional-v3/index.js b/projects/notional-v3/index.js index cbf2b9ba94..77ec4f3eb2 100644 --- a/projects/notional-v3/index.js +++ b/projects/notional-v3/index.js @@ -3,8 +3,8 @@ const abi = require('../notional/abi'); const { cachedGraphQuery } = require('../helper/cache') const SUBGRAPHS = { - arbitrum: 'https://api.studio.thegraph.com/query/36749/notional-v3-arbitrum/version/latest', - ethereum: 'https://api.studio.thegraph.com/query/36749/notional-v3-mainnet/version/latest' + arbitrum: 'DnghsCNvJ4xmp4czX8Qn7UpkJ8HyHjy7cFN4wcH91Nrx', + ethereum: '4oVxkMtN4cFepbiYrSKz1u6HWnJym435k5DQRAFt2vHW' }; const vaultsQuery = `{ vaultConfigurations { id } }` diff --git a/projects/nyke/index.js b/projects/nyke/index.js new file mode 100644 index 0000000000..5671107595 --- /dev/null +++ b/projects/nyke/index.js @@ -0,0 +1,9 @@ +const { compoundExports2, methodology, } = require('../helper/compound'); + +module.exports = { + methodology, + ethereumclassic: compoundExports2({ + comptroller: '0x0040DCf62C380833dE60a502649567e939635fdB', + cether: '0x2896c67c0cea9D4954d6d8f695b6680fCfa7C0e0', + }) +}; diff --git a/projects/otsea/config.js b/projects/otsea/config.js new file mode 100644 index 0000000000..5486511947 --- /dev/null +++ b/projects/otsea/config.js @@ -0,0 +1,17 @@ +module.exports = { + chains: [ + { + name: 'ethereum', + graphql: 'https://api.studio.thegraph.com/query/65203/otsea-v1/version/latest', + }, + { + name: 'base', + graphql: 'https://api.studio.thegraph.com/query/65203/otsea-base-v1/version/latest', + }, + { + name: 'blast', + graphql: 'https://api.studio.thegraph.com/query/65203/otsea-blast-v1/version/latest', + }, + ] + } + \ No newline at end of file diff --git a/projects/otsea/index.js b/projects/otsea/index.js new file mode 100644 index 0000000000..ee83ffc1f3 --- /dev/null +++ b/projects/otsea/index.js @@ -0,0 +1,69 @@ + +const { GraphQLClient, gql } = require("graphql-request"); +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require("../helper/staking"); +const config = require("./config"); + +const OTSEA_TOKEN = "0x5dA151B95657e788076D04d56234Bd93e409CB09"; +const OTSEA_MARKET_CONTRACT = "0x6E8B67B315b44519f8C2BEfdbbE11097c45353b4"; +const OTSEA_STAKING_CONTRACT = "0xF2c8e860ca12Cde3F3195423eCf54427A4f30916"; + +// OTSEA market volume by network +function getMarketVolume(endpoint) { + return async (api) => { + // locked in sell orders (ETH amount on sell orders) + let graphQLClient = new GraphQLClient(endpoint); + let query = gql` + query openSellOrders { + orders (where: { type: 1, state: 0 }) { + fulfilledOutput + totalOutput + } + } + `; + const results = await graphQLClient.request(query) + + const { orders } = results || { + orders: [{ totalOutput: 0 }], + } + const lockedInSellOrders = orders.reduce((sum, o) => sum += +o.totalOutput - o.fulfilledOutput, 0) + + // Locked in buy orders (ETH balance of market contract) + const lockedInBuyOrders = await api.sumTokens({ owner: OTSEA_MARKET_CONTRACT, tokens: [ADDRESSES.null] }); + + api.addCGToken('ethereum', parseFloat(lockedInSellOrders + lockedInBuyOrders) / 1e18) + } +} + +// Total Volume of OTSEA +async function otsea_total_volume(api) { + const collateralBalance = await api.call({ + abi: 'erc20:totalSupply', + target: OTSEA_TOKEN, + params: [], + }); + + api.add(OTSEA_TOKEN, collateralBalance) +} + +// Global export +module.exports = { + methodology: "We aggregated the assets locked on OTSea market", + misrepresentedTokens: true, +}; + +// Network exports +config.chains.forEach(async chainInfo => { + const { name: chain, graphql: endpoint } = chainInfo + + if (chain == 'ethereum') { + module.exports[chain] = { + tvl: getMarketVolume(endpoint), + staking: staking(OTSEA_STAKING_CONTRACT, OTSEA_TOKEN), + } + } else { + module.exports[chain] = { + tvl: getMarketVolume(endpoint), + } + } +}) \ No newline at end of file diff --git a/projects/pac-finance/index.js b/projects/pac-finance/index.js index 231eb54e08..d07df91722 100644 --- a/projects/pac-finance/index.js +++ b/projects/pac-finance/index.js @@ -1,6 +1,47 @@ -const { aaveExports } = require("../helper/aave"); +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const UiPoolDataProviderABI = { + "getReservesData": "function getReservesData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, uint256 decimals, uint256 baseLTVasCollateral, uint256 reserveLiquidationThreshold, uint256 reserveLiquidationBonus, uint256 reserveFactor, bool usageAsCollateralEnabled, bool borrowingEnabled, bool stableBorrowRateEnabled, bool isActive, bool isFrozen, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 liquidityRate, uint128 variableBorrowRate, uint128 stableBorrowRate, uint40 lastUpdateTimestamp, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint256 availableLiquidity, uint256 totalPrincipalStableDebt, uint256 averageStableRate, uint256 stableDebtLastUpdateTimestamp, uint256 totalScaledVariableDebt, uint256 priceInMarketReferenceCurrency, address priceOracle, uint256 variableRateSlope1, uint256 variableRateSlope2, uint256 stableRateSlope1, uint256 stableRateSlope2, uint256 baseStableBorrowRate, uint256 baseVariableBorrowRate, uint256 optimalUsageRatio, bool isPaused, bool isSiloedBorrowing, uint128 accruedToTreasury, uint128 unbacked, uint128 isolationModeTotalDebt, bool flashLoanEnabled, uint256 debtCeiling, uint256 debtCeilingDecimals, uint8 eModeCategoryId, uint256 borrowCap, uint256 supplyCap, uint16 eModeLtv, uint16 eModeLiquidationThreshold, uint16 eModeLiquidationBonus, address eModePriceSource, string eModeLabel, bool borrowableInIsolation)[], tuple(uint256 marketReferenceCurrencyUnit, int256 marketReferenceCurrencyPriceInUsd, int256 networkBaseTokenPriceInUsd, uint8 networkBaseTokenPriceDecimals))" +} + +const address = { + blast: { + UiPoolDataProvider: "0x1205529dc4fe0844039099cf7125aEF38B7c058F", + PoolAddressProvider: "0x688B5fd3C3E3724b4De08C4BCB3A755F9b579c9a", + }, +}; + +async function tvl(api) { + const { UiPoolDataProvider, PoolAddressProvider } = address[api.chain]; + let [reservesData] = await api.call({ + target: UiPoolDataProvider, + params: PoolAddressProvider, + abi: UiPoolDataProviderABI.getReservesData, + }); + + let toa = reservesData.map((i) => [i.underlyingAsset, i.aTokenAddress]); + + return sumTokens2({ api, resolveLP: true, tokensAndOwners: toa }); +} + +async function borrowed(api) { + const { UiPoolDataProvider, PoolAddressProvider } = address[api.chain]; + let [reservesData] = await api.call({ + target: UiPoolDataProvider, + params: PoolAddressProvider, + abi: UiPoolDataProviderABI.getReservesData, + }); + + reservesData.forEach((d) => { + api.add(d.underlyingAsset, d.totalScaledVariableDebt * d.variableBorrowIndex * 1e-27) + }); + + return sumTokens2({ api, resolveLP: true, }); +} -// https://docs.pac.finance/developer/mainnet-addresses module.exports = { - blast: aaveExports("blast", undefined, undefined, ["0x742316f430002D067dC273469236D0F3670bE446",], { hasV2LPs: true }), + blast: { + tvl, + borrowed, + }, }; diff --git a/projects/paxo-finance/index.js b/projects/paxo-finance/index.js index f9dd2cd90e..099a49b8c1 100644 --- a/projects/paxo-finance/index.js +++ b/projects/paxo-finance/index.js @@ -6,6 +6,7 @@ module.exports = { polygon: compoundExports('0x1eDf64B621F17dc45c82a65E1312E8df988A94D3', 'polygon'), xdc: compoundExports('0x301C76e7b60e9824E32991B8F29e1c4a03B4F65b', 'xdc'), linea: compoundExports('0x301C76e7b60e9824E32991B8F29e1c4a03B4F65b', 'linea'), + boba: compoundExports('0x301C76e7b60e9824E32991B8F29e1c4a03B4F65b', 'boba'), methodology: `${lendingMarket}. TVL is calculated by getting the market addresses from comptroller and calling the getCash() on-chain method to get the amount of tokens locked in each of these addresses.`, } diff --git a/projects/penpad/index.js b/projects/penpad/index.js index 0ef51da7aa..4a835dafc8 100644 --- a/projects/penpad/index.js +++ b/projects/penpad/index.js @@ -19,6 +19,18 @@ module.exports = { '0xa25b25548B4C98B0c7d3d27dcA5D5ca743d68b7F', '0x27D2B6cEcd759D289B0227966cC6Fe69Cc2b0424', ], // wrsETH + [ + '0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32', + '0x96cB437706111548c3D2e1Dc21E5Ab69E5dA057a', + ], // wstETH + [ + '0xcA0bFd5f735924e34Cc567146989e467fFbbCe1a', + '0x25D710AC957A54bdD6578b5DC8187a355c805edb', + ], // weETH + [ + '0x3C1BCa5a656e69edCD0D4E36BEbb3FcDAcA60Cf1', + '0x1C04CedF3Aac5fE35A7811689Ac6Da25b01BDc81', + ], // WBTC ], }), }, diff --git a/projects/perp88/index.js b/projects/perp88/index.js index 8a0cba31a2..58521b33fa 100644 --- a/projects/perp88/index.js +++ b/projects/perp88/index.js @@ -1,40 +1,43 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unwrapLPs'); +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require("../helper/unwrapLPs"); const tokens = { - "WMATIC": ADDRESSES.polygon.WMATIC_2, - "WETH": ADDRESSES.polygon.WETH_1, - "WBTC": ADDRESSES.polygon.WBTC, - "DAI": ADDRESSES.polygon.DAI, - "USDC": ADDRESSES.polygon.USDC, - "USDT": ADDRESSES.polygon.USDT -} -const POOL_DIAMOND_CONTRACT = '0xE7D96684A56e60ffBAAe0fC0683879da48daB383'; + WMATIC: ADDRESSES.polygon.WMATIC_2, + WETH: ADDRESSES.polygon.WETH_1, + WBTC: ADDRESSES.polygon.WBTC, + DAI: ADDRESSES.polygon.DAI, + USDC: ADDRESSES.polygon.USDC, + USDT: ADDRESSES.polygon.USDT, +}; +const POOL_DIAMOND_CONTRACT = "0xE7D96684A56e60ffBAAe0fC0683879da48daB383"; async function blastTvl(api) { - const vaultStorageAddress = '0x97e94BdA44a2Df784Ab6535aaE2D62EFC6D2e303' + const vaultStorageAddress = "0x97e94BdA44a2Df784Ab6535aaE2D62EFC6D2e303"; const hlpUnderlyings = [ - "0x2EAd9c6C7cAB1DD3442714A8A8533078C402135A", - "0x620aa22aA45F59Af91CaFBAd0ab58181FcDBfB08", - ] - return api.sumTokens({ owner: vaultStorageAddress, tokens: hlpUnderlyings, }) + "0xb9d94A3490bA2482E2D4F21F0E76b92E5661Ded8", + "0xCD732d21c1B23A3f84Bb386E9759b5b6A1BcBe39", + ]; + return api.sumTokens({ owner: vaultStorageAddress, tokens: hlpUnderlyings }); } module.exports = { start: 1668684025, polygon: { - tvl: sumTokensExport({ owner: POOL_DIAMOND_CONTRACT, tokens: Object.values(tokens), }), + tvl: sumTokensExport({ + owner: POOL_DIAMOND_CONTRACT, + tokens: Object.values(tokens), + }), }, arbitrum: { tvl: sumTokensExport({ - owner: '0x56CC5A9c0788e674f17F7555dC8D3e2F1C0313C0', + owner: "0x56CC5A9c0788e674f17F7555dC8D3e2F1C0313C0", tokens: [ "0x70d95587d40A2caf56bd97485aB3Eec10Bee6336", "0x47c031236e19d024b42f8AE6780E44A573170703", ], fetchCoValentTokens: true, - }) + }), }, blast: { - tvl: blastTvl - } -} + tvl: blastTvl, + }, +}; diff --git a/projects/poseidollar/index.js b/projects/poseidollar/index.js index 436c7336b9..900db73c08 100644 --- a/projects/poseidollar/index.js +++ b/projects/poseidollar/index.js @@ -1,5 +1,4 @@ const ADDRESSES = require("../helper/coreAssets.json"); -const { default: BigNumber } = require("bignumber.js"); const sui = require("../helper/chain/sui"); const extractRewardTokenType = (type) => { @@ -14,13 +13,12 @@ const extractRewardTokenType = (type) => { const extractFarmTokensTypeLP = (type) => { if (type.includes("::LP<")) { const pair = type.split("::LP<")[1]; - const lpType = `${ - type + const lpType = `${type .split( type.includes("::Custodian<") ? "::Custodian<" : "::FeeCollector<"[1] )[1] .split(">")[0] - }>`; + }>`; const coinXType = pair.split(",")[0]?.trim(); const coinYType = pair.split(",")[1].split(">")[0]?.trim(); return { coinXType, coinYType, lpType }; @@ -51,21 +49,24 @@ const getPool = async (listPoolFlowX, poolRegistry) => { poolInfo[0].objectType ); - let coinXStaked = new BigNumber(0); - let coinYStaked = new BigNumber(0); + let coinXStaked = 0; + let coinYStaked = 0; if (lpType) { const flowxPoolInfo = listPoolFlowX.find((item) => item.lp_supply.type.includes(lpType) ); - const lpRate = new BigNumber(totalStaked).div( - flowxPoolInfo.lp_supply.fields.value - ); - coinXStaked = lpRate.multipliedBy(flowxPoolInfo.reserve_x.fields.balance); - coinYStaked = lpRate.multipliedBy(flowxPoolInfo.reserve_y.fields.balance); + const lpRate = totalStaked / flowxPoolInfo.lp_supply.fields.value + coinXStaked = lpRate * flowxPoolInfo.reserve_x.fields.balance + coinYStaked = lpRate * flowxPoolInfo.reserve_y.fields.balance } else { - coinXStaked = new BigNumber(totalStaked); + coinXStaked = totalStaked } + if (coinXType === ADDRESSES.sui.USDC) + coinXStaked = coinXStaked / 1e3 + if (coinYType === ADDRESSES.sui.USDC) + coinYStaked = coinYStaked / 1e3 + poolInfoResult.push({ poolId: poolId, totalStaked: totalStaked, @@ -92,34 +93,12 @@ async function suiTVL(api) { "0x3cfad71fc1f65addbadc0d4056fbd1106aa6b9a219e3ea1f5356a2f500d13182" ); - let totalResult = {}; - //TVL on PSH Earn for (let i = 0; i < poolShareInfo.length; i++) { - if (!totalResult.hasOwnProperty(poolShareInfo[i].coinX)) { - totalResult[poolShareInfo[i].coinX] = poolShareInfo[i].coinXStaked; - } else { - totalResult[poolShareInfo[i].coinX] = totalResult[ - poolShareInfo[i].coinX - ].plus(poolShareInfo[i].coinXStaked); - } + api.add(poolShareInfo[i].coinX, poolShareInfo[i].coinXStaked) - if (poolShareInfo[i].coinY) { - if (!totalResult.hasOwnProperty(poolShareInfo[i].coinY)) { - totalResult[poolShareInfo[i].coinY] = poolShareInfo[i].coinYStaked; - } else { - totalResult[poolShareInfo[i].coinY] = totalResult[ - poolShareInfo[i].coinY - ].plus(poolShareInfo[i].coinYStaked); - } - } - } - - //Result - for (const property in totalResult) { - if (property) { - api.add(property, totalResult[property].toFixed(0)); - } + if (poolShareInfo[i].coinY) + api.add(poolShareInfo[i].coinY, poolShareInfo[i].coinYStaked) } } diff --git a/projects/prdt/index.js b/projects/prdt/index.js index 19a9b6564a..e7100be91e 100644 --- a/projects/prdt/index.js +++ b/projects/prdt/index.js @@ -5,14 +5,16 @@ const config = { ethereum: { owners: Object.values({ predictionPROV2: "0x062EB9830D1f1f0C64ac598eC7921f0cbD6d4841", + predictionPROV3: "0x792b18ec0d39093f10f8b34676e2f8669a495e9b", }), tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC], }, arbitrum: { owners: Object.values({ predictionPROV2: "0x062EB9830D1f1f0C64ac598eC7921f0cbD6d4841", + predictionPROV3: "0xe2ca0a434effea151d5b2c649b754acd3c8a20f0", }), - tokens: [ADDRESSES.null, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.USDC], + tokens: [ADDRESSES.null, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.USDC_CIRCLE], }, bsc: { owners: Object.values({ @@ -22,8 +24,9 @@ const config = { predictionPRO: "0x599974D3f2948b50545Fb5aa77C9e0bddc230ADE", predictionPROV2: "0x22dB94d719659d7861612E0f43EE28C9FF9909C7", predictionclassicV3: "0x00199E444155f6a06d74CF36315419d39b874f5c", + predictionPROV3: "0x49eFb44831aD88A9cFFB183d48C0c60bF4028da8", }), - tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT, ADDRESSES.bsc.USDC], + tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT, ADDRESSES.bsc.USDC, ADDRESSES.bsc.ETH], }, polygon: { owners: Object.values({ @@ -32,8 +35,9 @@ const config = { predictionPRO: "0x764C3Ea13e7457261E5C1AaD597F281f3e738240", predictionPROV2: "0x8251E5EBc2d2C20f6a116144800D569FAF75d746", predictionclassicv3: "0x9f9564BE7b566dfE4B091a83a591752102aF3F33", + predictionPROV3: "0x0b9c8c0a04354f41b985c10daf7db30bc66998f5", }), - tokens: [ADDRESSES.null, ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC], + tokens: [ADDRESSES.null, ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC_CIRCLE, ADDRESSES.polygon.WETH], }, }; diff --git a/projects/pu239/index.js b/projects/pu239/index.js new file mode 100644 index 0000000000..7a849903a1 --- /dev/null +++ b/projects/pu239/index.js @@ -0,0 +1,13 @@ +const { aaveExports } = require("../helper/aave"); +const methodologies = require("../helper/methodologies"); + +module.exports = { + methodology: methodologies.lendingMarket, + map: aaveExports( + "map", + "0x0fBB7d9866D357f75a8fAf83330b7d089703464e", + undefined, + ["0xa9fc4Ea8A1dE8C722D8a70a73f26E2DBD89475bd"], + { v3: true } + ), +}; diff --git a/projects/raydium/api.js b/projects/raydium/api.js new file mode 100644 index 0000000000..22d01f64b5 --- /dev/null +++ b/projects/raydium/api.js @@ -0,0 +1,6 @@ +const { getExports } = require('../helper/heroku-api') + +module.exports = { + timetravel: false, + ...getExports("raydium", ['solana'], ['staking']), +} diff --git a/projects/raydium.js b/projects/raydium/index.js similarity index 78% rename from projects/raydium.js rename to projects/raydium/index.js index b179ff1d78..dc6ddd7664 100644 --- a/projects/raydium.js +++ b/projects/raydium/index.js @@ -1,10 +1,9 @@ -const { getConnection, sumTokens2, decodeAccount, } = require("./helper/solana"); +const { getConnection, sumTokens2, decodeAccount, } = require("../helper/solana"); const { PublicKey, } = require("@solana/web3.js"); -const sdk = require('@defillama/sdk') -const { TokenAmountLayout, KeyLayoutv4 } = require("./helper/utils/solana/layouts/raydium-layout"); +const { TokenAmountLayout, KeyLayoutv4 } = require("../helper/utils/solana/layouts/raydium-layout"); const { transformDexBalances } = require("./helper/portedTokens"); -const { sleep } = require("./helper/utils"); +const { sleep } = require("../helper/utils"); const CLMM = 'CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK' const AmmV4 = '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8' @@ -30,6 +29,8 @@ async function tvlCLMM() { }] }) const data = accounts.map(i => decodeAccount('raydiumCLMM', i.account)) + console.log(data.length, 'fetched CLMM accounts') + const tokenAccounts = data.map(i => [i.vaultA, i.vaultB]).flat().map(i => i.toString()) return sumTokens2({ tokenAccounts }) } @@ -40,15 +41,19 @@ async function ammV4Tvl(api) { const auth = '5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1' await sleep(10000) + console.time('raydium: ammV4Tvl fetching vault balances') const allPoolVaultAmount = await connection.getProgramAccounts(new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'), { filters: [{ dataSize: 165 }, { memcmp: { offset: 32, bytes: auth } }], dataSlice: { offset: 64, length: TokenAmountLayout.span } }) + console.timeEnd('raydium: ammV4Tvl fetching vault balances') + console.log(allPoolVaultAmount.length, 'fetched vault amounts') await sleep(30000) - const allPoolKeyInfo = await connection.getProgramAccounts(new PublicKey(AmmV4), { filters: [{ dataSize: 752 }], dataSlice: { offset: 336, length: KeyLayoutv4.span } }) - const vaultIdToAmount = {} for (const item of allPoolVaultAmount) { vaultIdToAmount[item.pubkey.toString()] = TokenAmountLayout.decode(item.account.data).amount.toString() } + console.log(vaultIdToAmount['XMt99QwT4NuzQotsLhp2G4PwdkUfXekFTezmyq1q5AB'], 'account value') + const allPoolKeyInfo = await connection.getProgramAccounts(new PublicKey(AmmV4), { filters: [{ dataSize: 752 }], dataSlice: { offset: 336, length: KeyLayoutv4.span } }) + let i = 0 let j = 0 let data = [] @@ -113,12 +118,39 @@ async function ammV2V3() { }) } +async function combinedTvl(api) { + console.time('raydium: combinedTvl') + + console.time('raydium: tvlCLMM') + const balancesCLMM = await tvlCLMM() + api.addBalances(balancesCLMM) + console.timeEnd('raydium: tvlCLMM') + + console.time('raydium: ammStableTvl') + const balancesAmmStable = await ammStableTvl() + api.addBalances(balancesAmmStable) + console.timeEnd('raydium: ammStableTvl') + + console.time('raydium: ammV2V3') + const balancesAmmV2V3 = await ammV2V3() + api.addBalances(balancesAmmV2V3) + console.timeEnd('raydium: ammV2V3') + + console.time('raydium: ammV4Tvl') + await ammV4Tvl(api) + console.timeEnd('raydium: ammV4Tvl') + + + console.timeEnd('raydium: combinedTvl') + return api.getBalances() +} + module.exports = { timetravel: false, misrepresentedTokens: true, hallmarks: [[1667865600, "FTX collapse"]], solana: { - tvl: sdk.util.sumChainTvls([tvlCLMM, ammStableTvl, ammV4Tvl, ammV2V3]), + tvl: combinedTvl, staking: () => sumTokens2({ tokenAccounts: ['8tnpAECxAT9nHBqR1Ba494Ar5dQMPGhL31MmPJz1zZvY'] }) }, }; \ No newline at end of file diff --git a/projects/resolv/index.js b/projects/resolv/index.js new file mode 100644 index 0000000000..95ba4c2387 --- /dev/null +++ b/projects/resolv/index.js @@ -0,0 +1,17 @@ +const USR = "0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110"; +const RLP = "0x4956b52aE2fF65D74CA2d61207523288e4528f96"; + +const erc20 = { + "totalSupply": "uint256:totalSupply" +}; + +async function ethTvl(api) { + api.add(USR, await api.call({ abi: erc20.totalSupply, target: USR })); + api.add(RLP, await api.call({ abi: erc20.totalSupply, target: RLP })); +} + +module.exports = { + ethereum: { + tvl: ethTvl + } +}; \ No newline at end of file diff --git a/projects/return-finance/index.js b/projects/return-finance/index.js index 73c4b6961b..8a173a7ca4 100644 --- a/projects/return-finance/index.js +++ b/projects/return-finance/index.js @@ -5,11 +5,18 @@ module.exports = { }; const config = { - ethereum: ['0xFD360A096E4a4c3C424fc3aCd85da8010D0Db9a5', '0x201254227f9fE57296C257397Be6c617389a8cCb'], - avax: ['0x3B6385493a1d4603809dDbaE647200eF8baA53F5'], - polygon: ['0x3B6385493a1d4603809dDbaE647200eF8baA53F5'], - base: ['0x3B6385493a1d4603809dDbaE647200eF8baA53F5'], -} + ethereum: [ + "0xFD360A096E4a4c3C424fc3aCd85da8010D0Db9a5", + "0x201254227f9fE57296C257397Be6c617389a8cCb", + ], + avax: [ + "0x3B6385493a1d4603809dDbaE647200eF8baA53F5", + "0xB86e10A24172155aE20B524e6e8E17a244c4d3aE", + ], + polygon: ["0x3B6385493a1d4603809dDbaE647200eF8baA53F5"], + base: ["0x3B6385493a1d4603809dDbaE647200eF8baA53F5"], +}; + Object.keys(config).forEach(chain => { diff --git a/projects/rho-markets/index.js b/projects/rho-markets/index.js new file mode 100644 index 0000000000..79ea498355 --- /dev/null +++ b/projects/rho-markets/index.js @@ -0,0 +1,6 @@ +const { compoundExports2, methodology } = require('../helper/compound') + +module.exports = { + scroll: compoundExports2({ comptroller: '0x8a67AB98A291d1AEA2E1eB0a79ae4ab7f2D76041', cether: '0x639355f34Ca9935E0004e30bD77b9cE2ADA0E692' }), + methodology, +} \ No newline at end of file diff --git a/projects/rivera_money/index.js b/projects/rivera_money/index.js index 4ee8512d0a..bd45d7734e 100644 --- a/projects/rivera_money/index.js +++ b/projects/rivera_money/index.js @@ -38,6 +38,8 @@ const config = { "0xA95417805d18d00844c3C6FB7742577Cd263fE05", "0x39dD79E8b1e74E8B514D7e133b3671435Ec3Da42", "0xE45F416eE25844281edF2780247E28569303c7Cd", + "0xB9107C1Ad02bD2E20692499156F99411297d23F5", + "0x17A6b417249D92A2F3F7a88384c5Aa88D0d95A28", ], bsquared: [ @@ -48,6 +50,11 @@ const config = { polygon: [ "0x67e07BFfce318ADbA7b08618CBf4B8E271499197" ], + + core: [ + "0xBC91a7a0eE37085af193C61747ecE693979Ec0C1", + "0x018BeE125A17D456E6dacE22A66E8B9aF3c69449", + ], } module.exports = { diff --git a/projects/sakai-vault/index.js b/projects/sakai-vault/index.js index c41f30ac46..c42b387a33 100644 --- a/projects/sakai-vault/index.js +++ b/projects/sakai-vault/index.js @@ -1,17 +1,15 @@ -const { staking } = require("../helper/staking"); +const { staking } = require("../helper/staking") +const SAKAI = "0x43b35e89d15b91162dea1c51133c4c93bdd1c4af" const contracts = { - SAKAI: "0x43b35e89d15b91162dea1c51133c4c93bdd1c4af", "Sakai-SP": "0xc20A079c7962D9fc92173cda349e80D484dFA42A", //Sakai Staking Protocol Contract - "Sakai-SP-V2": "0xba94E7c2306aC3BE22C123041Fd7823d7fA15933", //Sakai Staking Protocol Contract V2, -}; + "Sakai-SP-V2": "0xba94E7c2306aC3BE22C123041Fd7823d7fA15933", //Sakai Staking Protocol Contract V2 + "Sakai-DAO": "0xeEC3514a5A66432ff2887e44664b5a82db229e5F", //Sakai DAO Contract +} module.exports = { bsc: { tvl: () => ({}), - staking: staking( - [contracts["Sakai-SP"], contracts["Sakai-SP-V2"]], - contracts.SAKAI - ), + staking: staking(Object.values(contracts), SAKAI), }, -}; +} \ No newline at end of file diff --git a/projects/sanko-bridge/index.js b/projects/sanko-bridge/index.js new file mode 100644 index 0000000000..69fd836d25 --- /dev/null +++ b/projects/sanko-bridge/index.js @@ -0,0 +1,15 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + arbitrum: { + tvl: (api) => + sumTokens2({ + api, + owners: [ + "0x2f285781B8d58678a3483de52D618198E4d27532", + "0xb4951c0C41CFceB0D195A95FE66280457A80a990", + ], + fetchCoValentTokens: true, + }), + }, +}; diff --git a/projects/scoreplay/index.js b/projects/scoreplay/index.js new file mode 100644 index 0000000000..1ddddeb1a6 --- /dev/null +++ b/projects/scoreplay/index.js @@ -0,0 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + start: 1717958404, + base: { tvl: sumTokensExport({ owner: '0xFcab8B765FB0BCB05407d16173941e2d1F09DE12', tokens: [ADDRESSES.base.WETH] }) }, +} \ No newline at end of file diff --git a/projects/shoebillFinance-v2/index.js b/projects/shoebillFinance-v2/index.js index a411d75fab..720f27cd0e 100644 --- a/projects/shoebillFinance-v2/index.js +++ b/projects/shoebillFinance-v2/index.js @@ -75,5 +75,16 @@ module.exports = mergeExports([ cether: "0xD13bE8b716b18265e294831FCb1330d170840BB3", }), }, - + { + fuse: compoundExports2({ + comptroller: "0x9f53Cd350c3aC49cE6CE673abff647E5fe79A3CC", + cether: "0xD13bE8b716b18265e294831FCb1330d170840BB3", + }), + }, + { + zklink: compoundExports2({ + comptroller: "0x89e348e0ab4D83aEDbf1354004552822a805a12e", + cether: "0x4dA697a89ea1D166881362b56E6863294820eC97", + }), + }, ]); diff --git a/projects/sofa-org/index.js b/projects/sofa-org/index.js new file mode 100644 index 0000000000..380b0d6d94 --- /dev/null +++ b/projects/sofa-org/index.js @@ -0,0 +1,48 @@ +const config = { + arbitrum: { + vaults: [ + "0x7ECd1b5255543F4C2D7D8E475afCd01699dBE2B0", + "0xdFEb3460771148799b2D4344c369e2b2d6C26c42", + "0x00aEca021D0f06c7dee54D58ee6Af47B5645aB19", + "0x989897f1D976EE0b59Bf0A3172C170D8f3Cb84e3", + "0x6E72C8726c71a4Cbc6e31ff7d47B399Fa983C7B8", + "0x106825b71ccE77a70B69f57A0ACf9C4a6acf292a" + ], aVaults: [ + "0x3a253838121b9ad9736fAFc030Cf4971615D68b2", + "0xD9cFF1bc89f705EaB2579fA2DC86E9a6F971370a", + "0x9C5D3C3AbD633b8eA68C5a51325f8630DC620AD9", + "0x2F1C60bA96ec6925fA9bBbFC9Eb7908bD35Bc224", + "0x72e0906558e4Ee528974cD7803bfF12d9f2869C3", + "0x9377f17ABde96887943e5Fcc92Db034c76820529" + ] + }, + ethereum: { + vaults: [ + "0x3a253838121b9ad9736fAFc030Cf4971615D68b2", + "0xD9cFF1bc89f705EaB2579fA2DC86E9a6F971370a", + "0x106825b71ccE77a70B69f57A0ACf9C4a6acf292a", + "0x5494855B98858Ea4eF54D13E1d003197A387CE34", + "0x9C5D3C3AbD633b8eA68C5a51325f8630DC620AD9", + "0x2F1C60bA96ec6925fA9bBbFC9Eb7908bD35Bc224" + ], aVaults: [ + "0x00aEca021D0f06c7dee54D58ee6Af47B5645aB19", + "0x989897f1D976EE0b59Bf0A3172C170D8f3Cb84e3", + "0x9377f17ABde96887943e5Fcc92Db034c76820529", + "0x99c59D82b10c56950F6C031946656e6D0aD509ca", + "0xF6c70b5F034070001E833C9EbC6a3A0176B683A6", + "0x62104e40fA81a19f2B7E17C78C3ffBF4aCa4F212" + ] + } +} + +Object.keys(config).forEach(chain => { + const { vaults = [], aVaults = [] } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const tokens = await api.multiCall({ abi: 'address:collateral', calls: vaults }) + const tokens2 = await api.multiCall({ abi: 'address:collateral', calls: aVaults }) + const atokens = await api.multiCall({ abi: 'address:aToken', calls: aVaults }) + return api.sumTokens({ tokensAndOwners2: [[tokens, tokens2, atokens].flat(), [vaults, aVaults, aVaults].flat()] }) + } + } +}) \ No newline at end of file diff --git a/projects/solayer/index.js b/projects/solayer/index.js new file mode 100644 index 0000000000..9657dd6952 --- /dev/null +++ b/projects/solayer/index.js @@ -0,0 +1,28 @@ +const { sumTokens2, getConnection } = require("../helper/solana"); +const { PublicKey } = require("@solana/web3.js"); + +async function tvl() { + const connection = getConnection(); + const [account, lst] = await Promise.all([ + connection.getAccountInfo(new PublicKey('po1osKDWYF9oiVEGmzKA4eTs8eMveFRMox3bUKazGN2')), + sumTokens2({ + tokensAndOwners: [ + ['J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn', 'GgTE2exWZ36Q82FoVgEEzEHYCfsbGjm3P6zRfx3hLUv4'], + ['mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So', 'E9LmYVKU5oyjWs9Zmzv9ji8NkzhJxJQbUEH3FWDKZt8D'], + ['bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1', '2DRZbbse5b5souvMQkifpS8CRBsDeLt6a9xDqqVJvmdw'], + ['5oVNBeEEQvYi1cX3ir8Dx5n1P7pdxydbGF2X4TxVusJm', 'GF8jvNGY44tnCfhnzdoSUBpgfog9YnLc6BRBCnt8j9do'] + ], + }) + ]); + + return { + solana: Number(account.data.readBigUint64LE(258)) / 1e9, + ...lst + }; +} + +module.exports = { + timetravel: false, + methodology: "TVL is calculated by summing all re-staked assets.", + solana: { tvl }, +}; diff --git a/projects/solv-protocol-funds/index.js b/projects/solv-protocol-funds/index.js index efdf9aec3a..c086c8a4c7 100644 --- a/projects/solv-protocol-funds/index.js +++ b/projects/solv-protocol-funds/index.js @@ -10,7 +10,7 @@ const graphUrlList = { ethereum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-prod/version/latest', bsc: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-bsc/version/latest', arbitrum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-arbitrum/version/latest', - mantle: 'http://api.0xgraph.xyz/subgraphs/name/solv-payable-factory-mentle-0xgraph', + mantle: 'https://api.0xgraph.xyz/api/public/65c5cf65-bd77-4da0-b41c-cb6d237e7e2f/subgraphs/solv-payable-factory-mantle/-/gn', merlin: 'http://solv-subgraph-server-alb-694489734.us-west-1.elb.amazonaws.com:8000/subgraphs/name/solv-payable-factory-merlin', } diff --git a/projects/solv-protocol-rwa/index.js b/projects/solv-protocol-rwa/index.js index 19ea2fc662..25d703b28e 100644 --- a/projects/solv-protocol-rwa/index.js +++ b/projects/solv-protocol-rwa/index.js @@ -5,7 +5,7 @@ const { cachedGraphQuery } = require("../helper/cache"); // The Graph const graphUrlList = { - mantle: 'http://api.0xgraph.xyz/subgraphs/name/solv-payable-factory-mentle-0xgraph', + mantle: 'https://api.0xgraph.xyz/api/public/65c5cf65-bd77-4da0-b41c-cb6d237e7e2f/subgraphs/solv-payable-factory-mantle/-/gn', } const slotListUrl = 'https://cdn.jsdelivr.net/gh/solv-finance-dev/solv-protocol-rwa-slot/slot.json'; diff --git a/projects/solvbtc/index.js b/projects/solvbtc/index.js index c255fdf3f3..1c35f29559 100644 --- a/projects/solvbtc/index.js +++ b/projects/solvbtc/index.js @@ -8,7 +8,7 @@ const graphUrlList = { ethereum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-prod/version/latest', bsc: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-bsc/version/latest', arbitrum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-arbitrum/version/latest', - mantle: 'http://api.0xgraph.xyz/subgraphs/name/solv-payable-factory-mentle-0xgraph', + mantle: 'https://api.0xgraph.xyz/api/public/65c5cf65-bd77-4da0-b41c-cb6d237e7e2f/subgraphs/solv-payable-factory-mantle/-/gn', merlin: 'http://solv-subgraph-server-alb-694489734.us-west-1.elb.amazonaws.com:8000/subgraphs/name/solv-payable-factory-merlin', } diff --git a/projects/soroswap/index.js b/projects/soroswap/index.js new file mode 100644 index 0000000000..14a806760c --- /dev/null +++ b/projects/soroswap/index.js @@ -0,0 +1,44 @@ +const utils = require("../helper/utils"); +const { getApiTvl } = require("../helper/historicalApi"); + +const getCurrentTvl = (pools) => { + return pools?.data?.reduce((acc, pool) => { + return acc + (pool.tvl || 0); + }, 0); +}; + +const getTvlDayData = (pools) => { + const tvlChartData = {}; + + pools?.data?.forEach((pool) => { + pool.tvlChartData?.forEach((data) => { + tvlChartData[data.date] = { + tvl: (tvlChartData?.[data?.date]?.tvl || 0) + data.tvl, + date: data.date, + }; + }); + }); + + return Object.keys(tvlChartData).map((key) => ({ + date: tvlChartData[key].date, + totalLiquidityUSD: tvlChartData[key].tvl, + })); +}; + +async function tvl(time) { + const pools = await utils.fetchURL( + "https://info.soroswap.finance/api/pairs?network=MAINNET" + ); + + return getApiTvl( + time, + () => getCurrentTvl(pools), + () => getTvlDayData(pools) + ); +} + +module.exports = { + methodology: + 'TVL counts the liquidity of the Pools on AMM, data is pulled from the Soroswap Info: "https://info.soroswap.finance/".', + stellar: { tvl }, +}; diff --git a/projects/splice-fi/index.js b/projects/splice-fi/index.js index 19c5c84c35..9848b6456f 100644 --- a/projects/splice-fi/index.js +++ b/projects/splice-fi/index.js @@ -5,6 +5,10 @@ const config = { factoryV3: "0x9e6d12097339ddd5402FDD39fc0Ef86Eec54AB39", fromBlockV3: 7764229, }, + blast: { + factoryV3: "0x96A6C433078059577F0CEB707d596A5F81d64375", + fromBlockV3: 1850297, + }, } Object.keys(config).forEach((chain) => { diff --git a/projects/stablejack/index.js b/projects/stablejack/index.js new file mode 100644 index 0000000000..e44943b730 --- /dev/null +++ b/projects/stablejack/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + avax: { tvl }, +} + +async function tvl(api) { + const wsAVAX = '0x7aa5c727270c7e1642af898e0ea5b85a094c17a1' + const sAVAX = '0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE' + const wsAvaxBal= await api.call({ abi: 'erc20:balanceOf', target: wsAVAX, params: '0xDC325ad34C762C19FaAB37d439fbf219715f9D58'}) + const wsAvaxSupply = await api.call({ abi: 'uint256:totalSupply', target: wsAVAX }) + const sAvaxBal= await api.call({ abi: 'erc20:balanceOf', target: '0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE', params: wsAVAX}) + api.add(sAVAX, wsAvaxBal * sAvaxBal / wsAvaxSupply) +} \ No newline at end of file diff --git a/projects/steer/index.js b/projects/steer/index.js index 615bdc660a..753bca2cb0 100644 --- a/projects/steer/index.js +++ b/projects/steer/index.js @@ -142,6 +142,13 @@ const supportedChains = [ chainId: 196, identifier: 'xlayer' }, + { + name: 'Rootstock', + subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-rootstock/1.1.1/gn', + chainId: 30, + identifier: 'rsk' + }, + // { // name: 'Celo', // subgraphEndpoint: sdk.graph.modifyEndpoint('DDwt4z55qLHPNmasiQXFH3nRjgCBrBhsiz3uEqKRJoa'), diff --git a/projects/sudoswap-v2/index.js b/projects/sudoswap-v2/index.js index c7946391ca..d5aca64cb9 100644 --- a/projects/sudoswap-v2/index.js +++ b/projects/sudoswap-v2/index.js @@ -28,8 +28,9 @@ const config = { ethereum: { target: '0xA020d57aB0448Ef74115c112D18a9C231CC86000', fromBlock: 17309203 }, arbitrum: { target: '0x4f1627be4C72aEB9565D4c751550C4D262a96B51', fromBlock: 168473054 }, base: { target: '0x605145d263482684590f630e9e581b21e4938eb8', fromBlock: 7529192 }, + sanko: { target: '0x5bfE2ef160EaaAa4aFa89A8fa09775b6580162c9', fromBlock: 5317 }, } Object.keys(config).forEach(chain => { module.exports[chain] = { tvl } -}) \ No newline at end of file +}) diff --git a/projects/summer-fi/index.js b/projects/summer-fi/index.js index adcaec1005..4ac4457ea7 100644 --- a/projects/summer-fi/index.js +++ b/projects/summer-fi/index.js @@ -5,6 +5,7 @@ const { getCache, setCache } = require("../helper/cache"); module.exports = { doublecounted: true, + methodology: "Summer.fi TVL is calculated by fetching on-chain data, retrieving CDP IDs, and using them to determine locked assets via the automationTvl function, excluding frontend-managed Maker vaults", ethereum: { tvl }, }; diff --git a/projects/superform/index.js b/projects/superform/index.js index 16122439a9..322f58ef1e 100644 --- a/projects/superform/index.js +++ b/projects/superform/index.js @@ -2,14 +2,22 @@ const superform_chains = ["ethereum", "polygon", "bsc", "avax", "arbitrum", "opt const factory_contract = "0xD85ec15A9F814D6173bF1a89273bFB3964aAdaEC"; const fantom_factory_contract = "0xbc85043544CC2b3Fd095d54b6431822979BBB62A"; +// These vaults have misconfigured implementation affecting TVL +const blacklisted_vaults = ["0xd3a17928245064b6df5095a76e277fe441d538a4"] + async function tvl(api) { const forms = await api.fetchList({ lengthAbi: 'getSuperformCount', itemAbi: "function superforms(uint256) external view returns(uint256)", target: api.chainId === 250 ? fantom_factory_contract : factory_contract }) const getSuperformRes = await api.multiCall({ abi: "function getSuperform(uint256) external view returns(address, uint32, uint64)", calls: forms, target: api.chainId === 250 ? fantom_factory_contract : factory_contract }) const super4626 = getSuperformRes.map(v => v[0]) const vaults = await api.multiCall({ abi: 'address:vault', calls: super4626 }) - const assets = await api.multiCall({ abi: 'address:asset', calls: super4626 }) - const vBals = await api.multiCall({ abi: "erc20:balanceOf", calls: vaults.map((v, i) => ({ target: v, params: super4626[i] })) }) - const bals = await api.multiCall({ abi: "function previewRedeemFrom(uint256) external view returns(uint256)", calls: super4626.map((v, i) => ({ target: v, params: vBals[i] })), permitFailure: true }) + + // Filter out blacklisted vaults + const filteredVaults = vaults.filter(vault => !blacklisted_vaults.includes(vault.toLowerCase())); + const filteredSuper4626 = super4626.filter((_, index) => !blacklisted_vaults.includes(vaults[index].toLowerCase())); + + const assets = await api.multiCall({ abi: 'address:asset', calls: filteredSuper4626 }) + const vBals = await api.multiCall({ abi: "erc20:balanceOf", calls: filteredVaults.map((v, i) => ({ target: v, params: filteredSuper4626[i] })) }) + const bals = await api.multiCall({ abi: "function previewRedeemFrom(uint256) external view returns(uint256)", calls: filteredSuper4626.map((v, i) => ({ target: v, params: vBals[i] })), permitFailure: true }) bals.forEach((bal, i) => { if (bal) api.add(assets[i], bal) }) diff --git a/projects/sushiswap-bentobox/helper.js b/projects/sushiswap-bentobox/helper.js index eba23cee88..425a6f8a3c 100644 --- a/projects/sushiswap-bentobox/helper.js +++ b/projects/sushiswap-bentobox/helper.js @@ -123,7 +123,7 @@ const kashiQuery = gql` `; const tridentSubgraphs = { - polygon: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-polygon", + polygon: sdk.graph.modifyEndpoint('BSdbRfU6PjWSdKjhpfUQ6EgUpzMxgpf5c1ugaVwBJFsQ'), optimism: sdk.graph.modifyEndpoint('FEgRuH9zeTRMZgpVv5YavoFEcisoK6KHk3zgQRRBqt51'), kava: "https://pvt.graph.kava.io/subgraphs/name/sushi-v2/trident-kava", metis: diff --git a/projects/sushiswap-trident/trident.js b/projects/sushiswap-trident/trident.js index d30085dd2b..4e7b29cb88 100644 --- a/projects/sushiswap-trident/trident.js +++ b/projects/sushiswap-trident/trident.js @@ -2,7 +2,7 @@ const sdk = require("@defillama/sdk"); const { blockQuery } = require('../helper/http') const graphUrls = { - polygon: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-polygon", + polygon: sdk.graph.modifyEndpoint('BSdbRfU6PjWSdKjhpfUQ6EgUpzMxgpf5c1ugaVwBJFsQ'), polygonOldRouter: sdk.graph.modifyEndpoint('5LBvcUQthQDZTMe6cyJ7DbeokFkYeVpYYBZruHPUjMG5'), optimism: sdk.graph.modifyEndpoint('FEgRuH9zeTRMZgpVv5YavoFEcisoK6KHk3zgQRRBqt51'), diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js index 3cbc37b1b4..f09968b398 100644 --- a/projects/sushiswap-v3/index.js +++ b/projects/sushiswap-v3/index.js @@ -75,6 +75,7 @@ module.exports = uniV3Export({ zeta: { factory: '0xB45e53277a7e0F1D35f2a77160e91e25507f1763', fromBlock: 1551069, }, islm: { factory, fromBlock: 6541826, }, blast: { factory: '0x7680d4b43f3d1d54d6cfeeb2169463bfa7a6cf0d', fromBlock: 284122, }, + europa: { factory: '0x51d15889b66A2c919dBbD624d53B47a9E8feC4bB', fromBlock: 5124250, }, rsk: { factory: '0x46B3fDF7B5cde91Ac049936bF0Bdb12C5D22202E', fromBlock: 6365060, }, //this one }); diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 4f9445c484..4e4e3a3819 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -68,7 +68,7 @@ module.exports = { bsc: { tvl, }, heco: { tvl, }, boba: { tvl, }, - boba_avax: { tvl, }, + //boba_avax: { tvl, }, boba_bnb: { tvl, }, avax: { tvl, }, fuse: { @@ -97,6 +97,13 @@ module.exports = { blast: { tvl: getUniTVL({ factory: '0x42Fa929fc636e657AC568C0b5Cf38E203b67aC2b', useDefaultCoreAssets: true, }) }, core: { tvl: tvl2 }, rsk: { tvl: tvl2 }, + europa: { tvl: getUniTVL({ factory: '0x1aaF6eB4F85F8775400C1B10E6BbbD98b2FF8483', useDefaultCoreAssets: true, }) }, + moonbeam: { tvl: getUniTVL({ factory: '0xc35DADB65012eC5796536bD9864eD8773aBc74C4', useDefaultCoreAssets: true, }) }, + polygon_zkevm: { tvl: tvl2 }, + optimism: { tvl: getUniTVL({ factory: '0xFbc12984689e5f15626Bad03Ad60160Fe98B303C', useDefaultCoreAssets: true, }) }, + linea: { tvl: getUniTVL({ factory: '0xFbc12984689e5f15626Bad03Ad60160Fe98B303C', useDefaultCoreAssets: true, }) }, + thundercore: { tvl: tvl2 }, + //haqq: { tvl: tvl2 }, } module.exports.polygon.tvl = getChainTVL('polygon') diff --git a/projects/sushiswap/index.js b/projects/sushiswap/index.js index 4a4ea92d3f..3739a6b487 100644 --- a/projects/sushiswap/index.js +++ b/projects/sushiswap/index.js @@ -17,6 +17,4 @@ module.exports = indexExports module.exports.misrepresentedTokens = true module.exports.ethereum.staking = staking(xSUSHI, SUSHI) -// node test.js projects/sushiswap/index.js - -module.exports.boba_avax.tvl = () => ({}) // boba avax is sunset \ No newline at end of file +// node test.js projects/sushiswap/index.js \ No newline at end of file diff --git a/projects/swaap-v2/index.js b/projects/swaap-v2/index.js index 0b4ad43ee0..85b4c30539 100644 --- a/projects/swaap-v2/index.js +++ b/projects/swaap-v2/index.js @@ -8,6 +8,10 @@ const config = { ethereum: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 17598578, }, arbitrum: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 137451745,}, polygon: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 44520023,}, + optimism: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 120693792, }, + bsc: { vault: '0x03c01acae3d0173a93d819efdc832c7c4f153b06', fromBlock: 39148730,}, + base: { vault: '0x03c01acae3d0173a93d819efdc832c7c4f153b06', fromBlock: 14451361,}, + mode: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 7242549,}, } /** diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 52682d590f..89c49ce315 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -27,6 +27,12 @@ const TOKENS = { }, zklink: { pufETH: "0x1B49eCf1A8323Db4abf48b2F5EFaA33F7DdAB3FC" + }, + cronos: { + USDC: ADDRESSES.cronos.USDC + }, + fraxtal: { + WETH: ADDRESSES.fraxtal.WETH } } @@ -380,5 +386,23 @@ module.exports = { '0x8a7F930003BedD63A1ebD99C5917FD6aE7E3dedf', // portal v2 ] }, + { + name: 'cronos', + tokens: [ + TOKENS.cronos.USDC, + ], + holders: [ + '0xE75C7E85FE6ADd07077467064aD15847E6ba9877', // portal v2 + ] + }, + { + name: 'fraxtal', + tokens: [ + TOKENS.fraxtal.WETH, + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 + ] + }, ] } \ No newline at end of file diff --git a/projects/synthetix-v3/index.js b/projects/synthetix-v3/index.js index f756e24a03..a556bbf52c 100644 --- a/projects/synthetix-v3/index.js +++ b/projects/synthetix-v3/index.js @@ -4,5 +4,8 @@ const ADDRESSES = require('../helper/coreAssets.json') module.exports = { base: { tvl: sumTokensExport({ owner: '0x32C222A9A159782aFD7529c87FA34b96CA72C696', tokens: [ADDRESSES.base.USDC] }) + }, + arbitrum: { + tvl: sumTokensExport({ owner: '0xffffffaEff0B96Ea8e4f94b2253f31abdD875847', tokens: [ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.ARB] }) } } diff --git a/projects/synthetix/api.js b/projects/synthetix/api.js index ec2936a087..1e5cc6072d 100644 --- a/projects/synthetix/api.js +++ b/projects/synthetix/api.js @@ -26,7 +26,7 @@ const synthetixs = { optimism: '0x8700daec35af8ff88c16bdf0418774cb3d7599b4' } const snxGraphEndpoints = { - ethereum: 'https://api.thegraph.com/subgraphs/name/0xngmi/snx-lite-ethereum', + ethereum: sdk.graph.modifyEndpoint('2chLKUMdvBJEbrceCdvCF8VGB1xQ3Ytbyujj9Rw3WyKY'), optimism: sdk.graph.modifyEndpoint('5NQi9n4ztd8M6EEDFKA6gwcCnbLdmzZRymiDbPkbjEWN') } const ethStaking = "0xc1aae9d18bbe386b102435a8632c8063d31e747c" diff --git a/projects/synthetix/apiCache.js b/projects/synthetix/apiCache.js index 50c94547c1..9280915254 100644 --- a/projects/synthetix/apiCache.js +++ b/projects/synthetix/apiCache.js @@ -29,7 +29,7 @@ const synthetixs = { optimism: '0x8700daec35af8ff88c16bdf0418774cb3d7599b4' } const snxGraphEndpoints = { - ethereum: 'https://api.thegraph.com/subgraphs/name/0xngmi/snx-lite-ethereum', + ethereum: sdk.graph.modifyEndpoint('2chLKUMdvBJEbrceCdvCF8VGB1xQ3Ytbyujj9Rw3WyKY'), optimism: sdk.graph.modifyEndpoint('5NQi9n4ztd8M6EEDFKA6gwcCnbLdmzZRymiDbPkbjEWN') } const ethStaking = "0xc1aae9d18bbe386b102435a8632c8063d31e747c" diff --git a/projects/tachyswap/index.js b/projects/tachyswap/index.js new file mode 100644 index 0000000000..582afc546d --- /dev/null +++ b/projects/tachyswap/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + etlk: { + tvl: getUniTVL({ + fetchBalances: true, + useDefaultCoreAssets: true, + factory: '0x033eff22bC5Bd30c597e1fdE8Ca6fB1C1274C688', + }) + } +} \ No newline at end of file diff --git a/projects/taidog/index.js b/projects/taidog/index.js new file mode 100644 index 0000000000..8e56a5ad2d --- /dev/null +++ b/projects/taidog/index.js @@ -0,0 +1,95 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const TAIDOG_TOKEN = "0x1Fd2f219B59b88bDda7dacd50c6e0667aA2d3Ee7"; +const TAIDOG_STAKING_CONTRACT = "0x9b4484D5A2665930702d09f74086CAD86d96b25E"; + +const TAIDOG_WETH_LP = "0x28Be5f9caBd48B712a031a901590b71f5509526D"; +const LP_STAKING_CONTRACT = "0xD664c3b22c60b4927ab1e0035b99F157bc2d8F1B"; + +const TAIKO_TOKEN = "0xA9d23408b9bA935c230493c40C73824Df71A0975"; +const TAIKO_STAKING_CONTRACT = "0x89a95021E45AcAB4B89eb20C18691E3E0D1d2170"; + +async function poolsTvl(api) { + const lpTAIDOGReserves = await api.call({ + abi: "erc20:balanceOf", + target: TAIDOG_TOKEN, + params: [TAIDOG_WETH_LP], + }); + + const lpWETHReserves = await api.call({ + abi: "erc20:balanceOf", + target: ADDRESSES.taiko.WETH, + params: [TAIDOG_WETH_LP], + }); + + const lpStakingBalance = await api.call({ + abi: "erc20:balanceOf", + target: TAIDOG_WETH_LP, + params: [LP_STAKING_CONTRACT], + }); + + const totalLPSupply = await api.call({ + abi: "erc20:totalSupply", + target: TAIDOG_WETH_LP, + params: [], + }); + + // (STAKED_LP_TOKENS / LP_TOTALSUPPLY) * LP_TAIDOG_TOKEN_0_RESERVE + api.add(TAIDOG_TOKEN, (lpStakingBalance / totalLPSupply) * lpTAIDOGReserves); + + // (STAKED_LP_TOKENS / LP_TOTALSUPPLY) * LP_WETH_TOKEN_1_RESERVE + api.add( + ADDRESSES.taiko.WETH, + (lpStakingBalance / totalLPSupply) * lpWETHReserves + ); +} + +async function stakingTvl(api) { + const stakingBalance = await api.call({ + abi: "erc20:balanceOf", + target: TAIDOG_TOKEN, + params: [TAIDOG_STAKING_CONTRACT], + }); + + // Transform token via LP Pricing + // TOKEN_0 ==> LP_RESERVES ==> WETH_TOKEN_1 + + const lpTAIDOGReserves = await api.call({ + abi: "erc20:balanceOf", + target: TAIDOG_TOKEN, + params: [TAIDOG_WETH_LP], + }); + + const lpWETHReserves = await api.call({ + abi: "erc20:balanceOf", + target: ADDRESSES.taiko.WETH, + params: [TAIDOG_WETH_LP], + }); + + // transform conversion via price (staking_TOKEN_0 / TOKEN_0_RESERVE * TOKEN_1_RESERVE) + const transformedToWETHBalance = + (stakingBalance / lpTAIDOGReserves) * lpWETHReserves; + + // TAIDOG staking token TRANSFORM to WETH via LP Pricing + api.add(ADDRESSES.taiko.WETH, transformedToWETHBalance); +} + +module.exports = { + misrepresentedTokens: true, + methodology: + "TVL counts user deposits of assets like (ETH, USDC, TAIKO) into protocol, counts pool2 (lp tokens) in staking contract 0xD664c3b22c60b4927ab1e0035b99F157bc2d8F1B, and counts the number of TAIDOG tokens in the staking contract 0x9b4484D5A2665930702d09f74086CAD86d96b25E", + start: 84000, + taiko: { + tvl: sumTokensExport({ + tokensAndOwners: [ + [TAIKO_TOKEN, TAIKO_STAKING_CONTRACT], + [ADDRESSES.taiko.WETH, "0x4625F913FF1ed54859b31Cce2CE1a4DBED33b825"], + [ADDRESSES.taiko.USDC, "0xc004e7d1eA0f69476dc26BE343E8643088246A08"], + ], + resolveLP: true, + }), + pool2: poolsTvl, + staking: stakingTvl, + }, +}; diff --git a/projects/tangible-ustb/index.js b/projects/tangible-ustb/index.js new file mode 100644 index 0000000000..b04203fbda --- /dev/null +++ b/projects/tangible-ustb/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const USTB = '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd' + +module.exports = { + ethereum: { + tvl: sumTokensExport({ owner: USTB, tokens: ["0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C"]}), + }, +} \ No newline at end of file diff --git a/projects/tarot/index.js b/projects/tarot/index.js index 541ce31315..c802d74fbc 100644 --- a/projects/tarot/index.js +++ b/projects/tarot/index.js @@ -74,6 +74,11 @@ const config = { '0xb6193DF61351736e5190bF1DEB2E4f0769bd1BF2', // Tarot Leyline ] }, + scroll: { + factories: [ + '0x2217AEC3440E8FD6d49A118B1502e539f88Dba55', // Tarot Osirion + ] + }, } tarotHelper(module.exports, config) diff --git a/projects/teahouse-v3/index.js b/projects/teahouse-v3/index.js index 2b1d0d1b8f..df331983ca 100644 --- a/projects/teahouse-v3/index.js +++ b/projects/teahouse-v3/index.js @@ -3,14 +3,14 @@ const starknet = require("../helper/chain/starknet"); const { getConfig } = require("../helper/cache"); // teahouse public api for vault -const teahouseVaultAPI = "https://vault-content-api.teahouse.finance/vaults"; +const teahouseVaultAPI = "https://raw.githubusercontent.com/TeahouseFinance/Vaults-for-DeFiLlama/main/vaults.json"; // get vault contract addresses from teahouse api async function getVaultContractsAddress(chain) { let pairVault = []; let portVault = []; let starknetPairVault = []; - const { vaults } = await getConfig("teahouse/v3_reset_cache", teahouseVaultAPI); + const { vaults } = await getConfig("teahouse/v3_vault_data", teahouseVaultAPI); vaults.forEach((element) => { // permissionless vaults if (element.isDeFi == true && element.isActive == true) { diff --git a/projects/teahouse/index.js b/projects/teahouse/index.js index 4e54008cf9..e6cbbf4fa1 100644 --- a/projects/teahouse/index.js +++ b/projects/teahouse/index.js @@ -2,13 +2,13 @@ const abi = require("./abi.json"); const { getConfig } = require("../helper/cache"); // teahouse public api for vault -const teahouseVaultAPI = "https://vault-content-api.teahouse.finance/vaults"; +const teahouseVaultAPI = "https://raw.githubusercontent.com/TeahouseFinance/Vaults-for-DeFiLlama/main/vaults.json"; // get vault contract addresses from teahouse api async function getVaultContractsAddress(chain) { let htAddress = []; - const { vaults } = await getConfig("teahouse/v1_reset_cache", teahouseVaultAPI); + const { vaults } = await getConfig("teahouse/vault_data", teahouseVaultAPI); vaults.forEach((element) => { // v2 vaults if (element.isDeFi == false && element.isActive == true) { diff --git a/projects/term-finance/index.js b/projects/term-finance/index.js index cd2787efac..d3a6af8476 100644 --- a/projects/term-finance/index.js +++ b/projects/term-finance/index.js @@ -3,7 +3,7 @@ const { getLogs } = require('../helper/cache/getLogs') const graphs = { ethereum: - "https://graph-node.mainnet.termfinance.io/subgraphs/name/term-finance-mainnet", + "https://public-graph-proxy.mainnet.termfinance.io", avax: "https://public-graph-proxy.avalanche.mainnet.termfinance.io", }; diff --git a/projects/term-structure/index.js b/projects/term-structure/index.js new file mode 100644 index 0000000000..8724f8b9e4 --- /dev/null +++ b/projects/term-structure/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokens2 } = require('../helper/unwrapLPs'); + +const ZkTrueUpContractAddress = "0x09E01425780094a9754B2bd8A3298f73ce837CF9"; + +module.exports = { + ethereum: { + tvl: async (api) => { + const infoAbi = "function getAssetConfig(uint16 tokenId) external view returns (bool isStableCoin, bool isTsbToken, uint8 decimals, uint128 minDepositAmt, address token)" + const tokenInfo = await api.fetchList({ lengthAbi: 'getTokenNum', itemAbi: infoAbi, target: ZkTrueUpContractAddress, startFrom: 1 }) + const tokens = tokenInfo.map(i => i.token) + tokens.push(ADDRESSES.ethereum.WETH) + return sumTokens2({ api, tokens, owner: ZkTrueUpContractAddress }) + }, + }, +}; diff --git a/projects/thUSD/index.js b/projects/thUSD/index.js new file mode 100644 index 0000000000..368dc65b0c --- /dev/null +++ b/projects/thUSD/index.js @@ -0,0 +1,11 @@ +const sdk = require('@defillama/sdk') +const { getLiquityTvl } = require("../helper/liquity") +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs") +const tBTCTvl = getLiquityTvl('0xf5e4ffeb7d2183b61753aa4074d72e51873c1d0a', { nonNativeCollateralToken: true, abis: { collateralToken: 'address:collateralAddress' } }) +const ethTvl = sumTokensExport({ owner: '0x1f490764473eb1013461D6079F827DB95d8B4DC5', tokens: [nullAddress]}) + +module.exports = { + ethereum: { + tvl: sdk.util.sumChainTvls([tBTCTvl, ethTvl]) + } +} diff --git a/projects/time-fun/index.js b/projects/time-fun/index.js new file mode 100644 index 0000000000..89e0c994ee --- /dev/null +++ b/projects/time-fun/index.js @@ -0,0 +1,7 @@ +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') + +module.exports = { + base: { + tvl: sumTokensExport({ owner: '0x428aef7fb31e4e86162d62d4530a4dd7232d953d', tokens: [nullAddress] }) + } +} \ No newline at end of file diff --git a/projects/tivel-finance/index.js b/projects/tivel-finance/index.js new file mode 100644 index 0000000000..8cff75dd4c --- /dev/null +++ b/projects/tivel-finance/index.js @@ -0,0 +1,14 @@ +const config = { + era: '0x846FcA826196B3D674fd1691Bb785F3E4216bc0F' +} + +Object.keys(config).forEach(chain => { + const factory = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const pools = await api.fetchList({ lengthAbi: 'poolLength', itemAbi: 'pools', target: factory }) + const tokens = await api.multiCall({ abi: 'address:quoteToken', calls: pools }) + return api.sumTokens({ tokensAndOwners2: [tokens, pools] }) + } + } +}) \ No newline at end of file diff --git a/projects/traderjoe-lb-v2-2/index.js b/projects/traderjoe-lb-v2-2/index.js new file mode 100644 index 0000000000..e2028cfd49 --- /dev/null +++ b/projects/traderjoe-lb-v2-2/index.js @@ -0,0 +1,7 @@ +//const { staking } = require("../helper/staking.js") +const { joeV2Export } = require('../helper/traderJoeV2') + +module.exports = joeV2Export({ + avax: '0xb43120c4745967fa9b93E79C149E66B0f2D6Fe0c', + arbitrum: '0xb43120c4745967fa9b93E79C149E66B0f2D6Fe0c', +}) \ No newline at end of file diff --git a/projects/treasury/dexfinance.js b/projects/treasury/dexfinance.js new file mode 100644 index 0000000000..d336eb63cc --- /dev/null +++ b/projects/treasury/dexfinance.js @@ -0,0 +1,84 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk'); +const { treasuryExports } = require("../helper/treasury"); + +const mainTreasury = '0x776e9df67667cb568f0e7951f74347fd985d615b'; +const multisig = '0xacB39b9Bf0462203b4Ca0CB74eC1AffB1b17c3b6'; + + +module.exports = treasuryExports({ + arbitrum: { + owners: [mainTreasury, multisig], + tokens: [ + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.WETH, + '0x92a212d9f5eef0b262ac7d84aea64a0d0758b94f', //gdex + '0x4117ec0a779448872d3820f37ba2060ae0b7c34b', //usdex + '0x1b896893dfc86bb67cf57767298b9073d2c1ba2c', //cake + '0x6985884c4392d348587b19cb9eaaf157f13271cd', //zro + '0xd56734d7f9979dd94fae3d67c7e928234e71cd4c', //tia + '0x0c880f6761f1af8d9aa9c466984b80dab9a8c9e8', //pendle + '0x25d887ce7a35172c62febfd67a1856f20faebb00', //pepe + '0xf97f4df75117a78c1a5a0dbb814af92458539fb4', //link + '0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a', //gmx + '0x912ce59144191c1204e64559fe8253a0e49e6548', //arb + '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f', //wbtc + ] + }, + avax: { + owners: [mainTreasury], + tokens: [ + ADDRESSES.avax.USDT_e, + ADDRESSES.avax.WETH_e, + ] + }, + optimism: { + owners: [mainTreasury], + tokens: [ + ADDRESSES.optimism.OP, + ADDRESSES.optimism.WETH, + ADDRESSES.optimism.USDC, + ] + }, + manta: { + owners: [mainTreasury], + tokens: [ + ADDRESSES.manta.USDC, + '0x95cef13441be50d20ca4558cc0a27b601ac544e5', //MANTA + '0x4c2a0f964a37a3ce305fe41c575beeb48c8c3fa2', //gCETO + '0x3af03e8c993900f0ea6b84217071e1d4cc783982', //CETO + '0xe68874e57224d1e4e6d4c6b4cf5af7ca51867611', //bCETO + '0x6da9ebd271a0676f39c088a2b5fd849d5080c0af', //USDEX + ] + }, + // pulse: { + // owners: [mainTreasury], + // tokens: [ + // ADDRESSES.pulse.WETH, + // '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', //usdc(fork) + // '0x30fcb23a906493371b1721c8feb8815804808d74', //sdai + // '0xaa2c47a35c1298795b5271490971ec4874c8e53d', //usdex + // '0x6386704cd6f7a584ea9d23ccca66af7eba5a727e', //spark + // ] + // }, + base: { + owners: [mainTreasury], + tokens: [ + ADDRESSES.base.USDC, + '0x532f27101965dd16442e59d40670faf5ebb142e4', //brett + '0xece7b98bd817ee5b1f2f536daf34d0b6af8bb542', //rock + '0x5babfc2f240bc5de90eb7e19d789412db1dec402', //circle + '0x6921b130d297cc43754afba22e5eac0fbf8db75b', //doginme + '0x7d9ce55d54ff3feddb611fc63ff63ec01f26d15f', //fungi + '0xcde90558fc317c69580deeaf3efc509428df9080', //normilio + '0xba0dda8762c24da9487f5fa026a9b64b695a07ea', //ox + '0xa3d1a8deb97b111454b294e2324efad13a9d8396', //ovn + '0xb79dd08ea68a908a97220c76d19a6aa9cbde4376', //usd+ + '0x940181a94a35a4569e4529a3cdfb74e38fd98631', //aero + '0x7f62ac1e974d65fab4a81821ca6af659a5f46298', //wels + '0x78b3c724a2f663d11373c4a1978689271895256f', //tkn + '0xc1cba3fcea344f92d9239c08c0568f6f2f0ee452', //wsteth + '0x373504da48418c67e6fcd071f33cb0b3b47613c7', //wbasedoge + ] + }, +}) \ No newline at end of file diff --git a/projects/truefi/abi.json b/projects/truefi/abi.json index c291f46fb2..ad9087e274 100644 --- a/projects/truefi/abi.json +++ b/projects/truefi/abi.json @@ -9,5 +9,7 @@ "liquidValue": "uint256:liquidValue", "getAssetVaults": "address[]:getAssetVaults", "liquidAssets": "uint256:liquidAssets", - "outstandingAssets": "uint256:outstandingAssets" + "outstandingAssets": "uint256:outstandingAssets", + "getAlocVaults": "address[]:getPortfolios", + "borrowedAssets": "uint256:borrowedAmount" } \ No newline at end of file diff --git a/projects/truefi/index.js b/projects/truefi/index.js index 2a4291a383..87aef85eb8 100644 --- a/projects/truefi/index.js +++ b/projects/truefi/index.js @@ -5,6 +5,9 @@ const stkTRU = '0x23696914Ca9737466D8553a2d619948f548Ee424' const TRU = '0x4C19596f5aAfF459fA38B0f7eD92F11AE6543784' const managedPortfolioFactory = '0x17b7b75FD4288197cFd99D20e13B0dD9da1FF3E7' const assetVaultFactory = '0x5Def383172C7dFB6F937e32aDf5be4D252168eDA' +const alocVaultFactory = '0x1672f101be9FfE121AfF7514B373e956272fe249' + +const alocVaultFactoryArbitrum = '0xCA1353dAB799d87D70E3750c2280205A5c8f62e9' const pools = [ '0x97cE06c3e3D027715b2d6C22e67D5096000072E5', // TUSD @@ -29,15 +32,36 @@ async function getAllTvl(api, isBorrowed) { const avLiquidAssets = await api.multiCall({ calls: assetVaults, abi: abi.liquidAssets, }) const avIlliquidAssets = await api.multiCall({ calls: assetVaults, abi: abi.outstandingAssets, }) + const alocVaults = await api.call({target: alocVaultFactory, abi: abi.getAlocVaults}) + const alocUnderlyingTokens = await api.multiCall({calls: alocVaults, abi: abi.asset}) + const alocLiquidAssets = await api.multiCall({calls: alocVaults, abi: abi.liquidAssets}) + const alocIlliquidAssets = await api.multiCall({calls: alocVaults, abi: abi.borrowedAssets}) + if (!isBorrowed) { api.addTokens(tokens, currencyBalance) api.addTokens(underlyingToken, liquidValue) api.addTokens(avUnderlyingTokens, avLiquidAssets) + api.addTokens(alocUnderlyingTokens, alocLiquidAssets) } else { api.addTokens(tokens, loansValue) api.addTokens(underlyingToken, illiquidValue) api.addTokens(avUnderlyingTokens, avIlliquidAssets) + api.addTokens(alocUnderlyingTokens, alocIlliquidAssets) + } +} + +async function getArbitrumTvl(api, isBorrowed) { + const alocVaults = await api.call({target: alocVaultFactoryArbitrum, abi: abi.getAlocVaults, chain: 'arbitrum'}) + const alocUnderlyingTokens = await api.multiCall({calls: alocVaults, abi: abi.asset, chain: 'arbitrum'}) + const alocLiquidAssets = await api.multiCall({calls: alocVaults, abi: abi.liquidAssets, chain: 'arbitrum'}) + const alocIlliquidAssets = await api.multiCall({calls: alocVaults, abi: abi.borrowedAssets, chain: 'arbitrum'}) + + if(!isBorrowed) { + api.addTokens(alocUnderlyingTokens, alocLiquidAssets) + } else { + api.addTokens(alocUnderlyingTokens, alocIlliquidAssets) } + } async function borrowed(api) { @@ -48,11 +72,23 @@ async function tvl(api) { return getAllTvl(api, false) } +async function borrowedArbitrum(api) { + return getArbitrumTvl(api, true) +} + +async function tvlArbitrum(api) { + return getArbitrumTvl(api, false) +} + module.exports = { start: 1605830400, // 11/20/2020 @ 12:00am (UTC) ethereum: { tvl, staking: staking(stkTRU, TRU), borrowed, + }, + arbitrum: { + tvl: tvlArbitrum, + borrowed: borrowedArbitrum, } } \ No newline at end of file diff --git a/projects/trufin-trustake/index.js b/projects/trufin-trustake/index.js index b070741614..c9a9b38a22 100644 --- a/projects/trufin-trustake/index.js +++ b/projects/trufin-trustake/index.js @@ -1,4 +1,15 @@ const ADDRESSES = require('../helper/coreAssets.json') +const { function_view } = require('../helper/chain/aptos') + +const TRUSTAKE_APT_CONTRACT_ADDR = "0x6f8ca77dd0a4c65362f475adb1c26ae921b1d75aa6b70e53d0e340efd7d8bc80" +const MODULE = "staker" +const FUNCTION = "total_staked" + +async function aptosTvl(api) { + const totalStaked = await function_view({ functionStr: `${TRUSTAKE_APT_CONTRACT_ADDR}::${MODULE}::${FUNCTION}` }) + api.add(ADDRESSES.aptos.APT, totalStaked[0]) +} + const abi = { "totalShares": "uint256:totalShares", "sharePrice": "function sharePrice() external view returns (uint256, uint256)", @@ -20,5 +31,8 @@ module.exports = { methodology: `Counts the TVL of MATIC tokens in TruFin's TruStake vault.`, ethereum: { tvl + }, + aptos: { + tvl: aptosTvl } } diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index c8d11e9308..efef5c8241 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -84,7 +84,8 @@ module.exports = { linea: { factory: "0x31FAfd4889FA1269F7a13A66eE0fB458f27D72A9", fromBlock: 25247, }, manta: { factory: "0x06D830e15081f65923674268121FF57Cc54e4e23", fromBlock: 1191705 }, avax: { factory: "0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD", fromBlock: 27832972 }, - taiko: { factory: "0x75FC67473A91335B5b8F8821277262a13B38c9b3", fromBlock: 961 } + taiko: { factory: "0x75FC67473A91335B5b8F8821277262a13B38c9b3", fromBlock: 961 }, + sei: { factory: "0x75FC67473A91335B5b8F8821277262a13B38c9b3", fromBlock: 79245151 } }), filecoin: { tvl: filecoinTvl }, diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index 4d85a4af3c..b6eb22698c 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -39,6 +39,7 @@ module.exports = { sake: "0x45BeC5Bb0EE87181A7Aa20402C66A6dC4A923758", sakeWater: "0x6b367F9EB22B2E6074E9548689cddaF9224FC0Ab", sakeV2: "0xc53A53552191BeE184557A15f114a87a757e5b6F", + sakeV3: "0x7Fe1A53c23C0a7a6c9dF6560518DDE36e1dd1184", sakeWaterV2: "0x806e8538FC05774Ea83d9428F778E423F6492475", vodkaV1_Water: "0xC99C6427cB0B824207606dC2745A512C6b066E7C", VodkaV1: "0x88D7500aF99f11fF52E9f185C7aAFBdF9acabD93", @@ -124,6 +125,12 @@ module.exports = { abi: contractAbis.stakedVlpBalance, target: addresses.sakeV2, }); + + const StakedVLPBalV3 = await api.call({ + abi: contractAbis.stakedVlpBalance, + target: addresses.sakeV3, + }); + const StakedHLPBal = await api.call({ abi: contractAbis.stakedHlpBalance, target: addresses.hlpStaking, @@ -159,6 +166,7 @@ module.exports = { api.add(addresses.VLP, StakedVLPBal); api.add(addresses.VLP, StakedVLPBalV2); + api.add(addresses.VLP, StakedVLPBalV3); api.add(addresses.hlp, StakedHLPBal); api.add(ADDRESSES.arbitrum.USDC, alpValue); api.add(ADDRESSES.arbitrum.USDC, klpValue); diff --git a/projects/vertex/index.js b/projects/vertex/index.js index c503377815..e82cca2d13 100644 --- a/projects/vertex/index.js +++ b/projects/vertex/index.js @@ -11,6 +11,16 @@ const config = { "perpEngine": "0xb74C78cca0FADAFBeE52B2f48A67eE8c834b5fd1" } +const mantleConfig = { + "querier": "0x71b50Ce0E7f7B920c1BAee3BDE00F2c3F7470395", + //"feeCalculator": "", + "clearinghouse": "0x5bcfC8AD38Ee1da5F45d9795aCaDf57D37FEC172", + "clearinghouseLiq": "0x4b62c8179F85E399ce24fB279d44803F17118Aa4", + "endpoint": "0x526D7C7ea3677efF28CB5bA457f9d341F297Fd52", + "spotEngine": "0xb64d2d606DC23D7a055B770e192631f5c8e1d9f8", + "perpEngine": "0x38080ee5fb939d045A9e533dF355e85Ff4f7e13D" +} + module.exports = { arbitrum: { @@ -18,5 +28,11 @@ module.exports = { owners: [config.clearinghouse, config.endpoint], tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.ARB, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.USDC_CIRCLE], }) + }, + mantle: { + tvl: sumTokensExport({ + owners: [mantleConfig.clearinghouse, mantleConfig.endpoint], + tokens: ["0xcDA86A272531e8640cD7F1a92c01839911B90bb0", ADDRESSES.mantle.USDC, ADDRESSES.mantle.WETH, ADDRESSES.mantle.WMNT], + }) } } \ No newline at end of file diff --git a/projects/wagmi-com/index.js b/projects/wagmi-com/index.js index 24f8afe3e9..5840df0b84 100644 --- a/projects/wagmi-com/index.js +++ b/projects/wagmi-com/index.js @@ -8,6 +8,7 @@ module.exports = uniV3Export({ ethereum: { factory: '0xB9a14EE1cd3417f3AcC988F61650895151abde24', fromBlock: 18240112, }, metis: { factory: '0x8112E18a34b63964388a3B2984037d6a2EFE5B8A', fromBlock: 9740222, }, zklink: { factory: '0x6175b648473F1d4c1549aAC3c2d007e7720585e6', fromBlock: 1339353, }, + iotaevm: { factory: '0x01Bd510B2eA106917e711f9a05a42fC162bee2Ac', fromBlock: 143828, }, }) module.exports.kava = { tvl: uniV3GraphExport({ name: 'wagmi-kava', graphURL: 'https://kava.graph.wagmi.com/subgraphs/name/v3', minTVLUSD: 0 }) } diff --git a/projects/wbrockstaking/index.js b/projects/wbrockstaking/index.js new file mode 100644 index 0000000000..2f72feb04f --- /dev/null +++ b/projects/wbrockstaking/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require("../helper/staking"); + +const stakingContract = "0x1a71F508d536c7Ab1D1B53a5D261abD494524C96"; +const BITROCKETHstakingContract = "0x46363C31Be0c677Bd6F3eD429686753794ee8b97"; + +module.exports = { + bitrock: { + tvl: staking(stakingContract, ADDRESSES.bitrock.WBR), + }, + ethereum: { + tvl: staking(BITROCKETHstakingContract, ADDRESSES.bitrock.BR), + }, + methodology: "Wrapped Bitrock tokens locked in staking contract", +}; + diff --git a/projects/woodswap/index.js b/projects/woodswap/index.js new file mode 100644 index 0000000000..8fb05ca6eb --- /dev/null +++ b/projects/woodswap/index.js @@ -0,0 +1,10 @@ +const { iziswapExport } = require('../helper/iziswap') + +const poolHelpers = { + 'rsk': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], +} // iziswap 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/xai-bridge/index.js b/projects/xai-bridge/index.js new file mode 100644 index 0000000000..ab93d3ca0b --- /dev/null +++ b/projects/xai-bridge/index.js @@ -0,0 +1,15 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + arbitrum: { + tvl: (api) => + sumTokens2({ + api, + owners: [ + "0xb591cE747CF19cF30e11d656EB94134F523A9e77", + "0xb15A0826d65bE4c2fDd961b72636168ee70Af030", + ], + fetchCoValentTokens: true, + }), + }, +}; diff --git a/projects/xlink/index.js b/projects/xlink/index.js index 8a9d91ab9a..ad6c513dc3 100644 --- a/projects/xlink/index.js +++ b/projects/xlink/index.js @@ -10,18 +10,54 @@ const config = { bitcoin: { owners: [ + 'bc1qh604n2zey83dnlwt4p0m8j4rvetyersm0p6fts', + '31wQsi1uV8h7mL3QvBXQ3gzkH9zXNTp5cF', 'bc1q9hs56nskqsxmgend4w0823lmef33sux6p8rzlp', '32jbimS6dwSEebMb5RyjGxcmRoZEC5rFrS', 'bc1qlhkfxlzzzcc25z95v7c0v7svlp5exegxn0tf58', - '3MJ8mbu4sNseNeCprG85emwgG9G9SCort7' + '3MJ8mbu4sNseNeCprG85emwgG9G9SCort7', + 'bc1qeph95q50cq6y66elk3zzp48s9eg66g47cptpft', + 'bc1qfcwjrdjk3agmg50n4c7t4ew2kjqqxc09qgvu7d', + '1882c4wfo2CzNo4Y4LCqxKGQvz7BsE7nqJ', + '1KGnLjKyqiGSdTNH9s6okFk2t5J7R6CdWt', ], }, - bsc: { owners: ['0xFFda60ed91039Dd4dE20492934bC163e0F61e7f5',], tokens: [ADDRESSES.bsc.USDT] }, - ethereum: { owners: ['0x13b72A19e221275D3d18ed4D9235F8F859626673'], tokens: [ADDRESSES.ethereum.USDT] }, - stacks: { owners: ['SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.cross-bridge-registry-v2-01', 'SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.btc-peg-out-endpoint-v2-01'], blacklistedTokens: [ - 'SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.token-abtc::bridged-btc', // already counted as part of bitcoin? - 'SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex::alex', // project linked token - ] }, + bsc: { + owners: + [ + '0xFFda60ed91039Dd4dE20492934bC163e0F61e7f5', + // '0x5caeb9d58325044a1ad9d4abff2e0d525928812d' // is EOA + ], + tokens: + [ + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.BTCB + ] + }, + ethereum: { + owners: + [ + '0x13b72A19e221275D3d18ed4D9235F8F859626673', + // '0x1bf78679b001c5efa20d80600e085ae52d25abc1' // is EOA + ], + tokens: + [ + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.WBTC + ] + }, + stacks: { + owners: + [ + 'SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.cross-bridge-registry-v2-01', + 'SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.btc-peg-out-endpoint-v2-01' + ], + blacklistedTokens: + [ + 'SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.token-abtc::bridged-btc', + 'SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex::alex', + ] + }, } Object.keys(config).forEach(chain => { diff --git a/projects/xy-finance/index.js b/projects/xy-finance/index.js index 07f7100730..307d67cbec 100644 --- a/projects/xy-finance/index.js +++ b/projects/xy-finance/index.js @@ -70,6 +70,9 @@ const config = { }, taiko: { chainId: '167000' + }, + ox_chain: { + chainId: '6699' } } @@ -103,7 +106,19 @@ const yPoolDepositContract = { "LOOT": { "contractAddress": "0xD95841e7eC6b61f708829B57a3433C3Fd24B2A8c", "tokenAddress": "0x721A1B990699eE9D90b6327FaaD0A3E840aE8335" - } + }, + "PEPE": { + "contractAddress": "0x4F19699cb57543B76167b7d38040f34db4d11fEC", + "tokenAddress": "0x6982508145454Ce325dDbE47a25d4ec3d2311933" + }, + "MOG": { + "contractAddress": "0x0790eF241DC85Adf32998aae5E5738579c417701", + "tokenAddress": "0xaaeE1A9723aaDB7afA2810263653A34bA2C21C7a" + }, + // "BITCOIN": { + // "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", + // "tokenAddress": "0x92073dE2706eB8f0265998bCf7B8F751e1349b8F" // doesnt exist + // } }, "25": { "ETH": { @@ -149,6 +164,10 @@ const yPoolDepositContract = { "LLT": { "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", "tokenAddress": "0x92073dE2706eB8f0265998bCf7B8F751e1349b8F" + }, + "RIP": { + "contractAddress": "0xd15f36e89e08A67AEe910629fCe9aBA7D2e8Ac80", + "tokenAddress": "0x34aceA6Cc02578aF041a5E976b7289ca23cCB7A8" } }, "56": { @@ -363,16 +382,20 @@ const yPoolDepositContract = { }, "8453": { "ETH": { - "contractAddress": "0xD195070107d853e55Dad9A2e6e7E970c400E67b8", + "contractAddress": "0x4F19699cb57543B76167b7d38040f34db4d11fEC", "tokenAddress": ethAddress }, "USDC": { - "contractAddress": "0xA5Cb30E5d30A9843B6481fFd8D8D35DDED3a3251", + "contractAddress": "0xd15f36e89e08A67AEe910629fCe9aBA7D2e8Ac80", "tokenAddress": ADDRESSES.base.USDbC }, "LOOT": { "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", "tokenAddress": "0x94a42083948d86432246eAD625B30d49014A4BFF" + }, + "RIP": { + "contractAddress": "0x0790eF241DC85Adf32998aae5E5738579c417701", + "tokenAddress": "0x34aceA6Cc02578aF041a5E976b7289ca23cCB7A8" } }, "5000": { @@ -432,6 +455,28 @@ const yPoolDepositContract = { "contractAddress": "0x1e4992E1Be86c9d8ed7dcBFcF3665FE568dE98Ab", "tokenAddress": ADDRESSES.taiko.USDC } + }, + "6699": { + "USDC": { + "contractAddress": "0xd15f36e89e08A67AEe910629fCe9aBA7D2e8Ac80", + "tokenAddress": "0xcE8f4E26e2532A78DAcD7A497A1827692b14b31D" + }, + "ETH": { + "contractAddress": "0x4F19699cb57543B76167b7d38040f34db4d11fEC", + "tokenAddress": "0x7e6ecF974310d75325Ab1209253250aC7fCCe09b" + }, + "PEPE": { + "contractAddress": "0x0790eF241DC85Adf32998aae5E5738579c417701", + "tokenAddress": "0x4aE774bF3dEfF2eaD31D5D51Aa636EE216fBE274" + }, + "MOG": { + "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", + "tokenAddress": "0xfaffa4b4D8538A2ba63bEa39ACbF709E3A972714" + }, + // "BITCOIN": { + // "contractAddress": "0xD95841e7eC6b61f708829B57a3433C3Fd24B2A8c", + // "tokenAddress": "0x92073dE2706eB8f0265998bCf7B8F751e1349b8F" + // } } } diff --git a/projects/zkfinance/index.js b/projects/zkfinance/index.js new file mode 100644 index 0000000000..1ba6e29c4e --- /dev/null +++ b/projects/zkfinance/index.js @@ -0,0 +1,11 @@ +const { compoundExports2 } = require("../helper/compound"); +const zksyncComptroller = "0x218EBB63dfDf74eA689fBb2C55964E00ec905332"; +const zkEther = "0x36002f692234cDF2f115Ee701a9899DCB69F19d8"; + +module.exports = { + era: compoundExports2({ + comptroller: zksyncComptroller, + cether: zkEther, + fetchBalances: true, + }), +}; diff --git a/test.js b/test.js index 81060fd6bd..5846caef10 100644 --- a/test.js +++ b/test.js @@ -424,6 +424,7 @@ setTimeout(() => { }, 10 * 60 * 1000) // 10 minutes function buildPricesGetQueries(readKeys) { + if (!readKeys.length) return [] const burl = 'https://coins.llama.fi/prices/current/' const queries = [] let query = burl diff --git a/utils/handleError.js b/utils/handleError.js index 254c51a97e..049f9b2cd9 100644 --- a/utils/handleError.js +++ b/utils/handleError.js @@ -4,7 +4,7 @@ function handleError(error){ console.log('\n',errorString, '\n\n') const isGraphError = error.stack?.includes('graphql-request') && error.response?.errors?.length if (isGraphError) - console.error(error.response.errors.map(e => e.message).join('\n')) + console.error(`On chain ${error.chain ?? "Unknown"}:` + error.response.errors.map(e => e.message).join('\n')) else console.error(error.toString()) const axiosError = error?.response?.data?.message